fable-editor 1.3.0 → 1.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- const rt = {
1
+ const ht = {
2
2
  en: {
3
3
  dir: "ltr",
4
4
  file: "File",
@@ -384,10 +384,10 @@ const rt = {
384
384
  emcat_flags: "أعلام"
385
385
  }
386
386
  };
387
- function D(d) {
388
- return rt[d];
387
+ function F(h) {
388
+ return ht[h];
389
389
  }
390
- const at = "undo redo | preview print | importword revhistory | fontfamily fontsize | fontsizeincrease fontsizedecrease | bold italic underline strikethrough | forecolor backcolor | alignleft aligncenter alignright alignjustify | bullist numlist | outdent indent | link blockquote code changecase lineheight wordspacing letterspacing | removeformat | blocks | ltr rtl | quickimage quickvideo quicktable codesample template charmap emoji | fullscreen sourcecode", ct = "file edit view insert format tools table help", ht = [
390
+ const dt = "undo redo | preview print | importword revhistory | fontfamily fontsize | fontsizeincrease fontsizedecrease | bold italic underline strikethrough | forecolor backcolor | alignleft aligncenter alignright alignjustify | bullist numlist | outdent indent | link blockquote code changecase lineheight wordspacing letterspacing | removeformat | blocks | ltr rtl | quickimage quickvideo quicktable codesample template charmap emoji | fullscreen sourcecode", pt = "file edit view insert format tools table help", ut = [
391
391
  ["Andale Mono", "andale mono,times"],
392
392
  ["Arial", "arial,helvetica,sans-serif"],
393
393
  ["Arial Black", "arial black,avant garde"],
@@ -407,7 +407,7 @@ const at = "undo redo | preview print | importword revhistory | fontfamily fonts
407
407
  ["Verdana", "verdana,geneva"],
408
408
  ["Webdings", "webdings"],
409
409
  ["Wingdings", "wingdings,zapf dingbats"]
410
- ], dt = ["8px", "9px", "10px", "11px", "12px", "14px", "16px", "18px", "20px", "24px", "28px", "32px", "36px", "48px", "72px", "96px"], pt = 1, mt = 100, U = ["1", "1.15", "1.4", "1.5", "1.75", "2", "2.5", "3"], W = ["1px", "2px", "4px", "6px", "8px", "12px"], j = ["0.5px", "1px", "1.5px", "2px", "3px", "4px"], V = [
410
+ ], mt = ["8px", "9px", "10px", "11px", "12px", "14px", "16px", "18px", "20px", "24px", "28px", "32px", "36px", "48px", "72px", "96px"], gt = 1, ft = 100, W = ["1", "1.15", "1.4", "1.5", "1.75", "2", "2.5", "3"], V = ["1px", "2px", "4px", "6px", "8px", "12px"], j = ["0.5px", "1px", "1.5px", "2px", "3px", "4px"], X = [
411
411
  ["plain", "Plain text"],
412
412
  ["html", "HTML/XML"],
413
413
  ["css", "CSS"],
@@ -424,7 +424,7 @@ const at = "undo redo | preview print | importword revhistory | fontfamily fonts
424
424
  ["rust", "Rust"],
425
425
  ["sql", "SQL"],
426
426
  ["bash", "Bash/Shell"]
427
- ], X = [
427
+ ], Q = [
428
428
  ["p", "para"],
429
429
  ["h1", "heading1"],
430
430
  ["h2", "heading2"],
@@ -433,7 +433,7 @@ const at = "undo redo | preview print | importword revhistory | fontfamily fonts
433
433
  ["h5", "heading5"],
434
434
  ["h6", "heading6"],
435
435
  ["pre", "pre"]
436
- ], ut = ["#F76707", "#4263EB", "#CC5DE8"], gt = [
436
+ ], vt = ["#F76707", "#4263EB", "#CC5DE8"], bt = [
437
437
  "#FFFFFF",
438
438
  "#F4F4F4",
439
439
  "#E8EAED",
@@ -459,7 +459,7 @@ const at = "undo redo | preview print | importword revhistory | fontfamily fonts
459
459
  "#8E24AA",
460
460
  "#C2185B",
461
461
  "#6D4C41"
462
- ], ft = [
462
+ ], yt = [
463
463
  {
464
464
  key: "chcat_currency",
465
465
  chars: [
@@ -799,7 +799,7 @@ const at = "undo redo | preview print | importword revhistory | fontfamily fonts
799
799
  "ة"
800
800
  ]
801
801
  }
802
- ], vt = [
802
+ ], xt = [
803
803
  {
804
804
  key: "emcat_smileys",
805
805
  chars: [
@@ -1524,7 +1524,7 @@ const at = "undo redo | preview print | importword revhistory | fontfamily fonts
1524
1524
  "🇲🇦"
1525
1525
  ]
1526
1526
  }
1527
- ], Jt = [
1527
+ ], ge = [
1528
1528
  "©",
1529
1529
  "®",
1530
1530
  "™",
@@ -1573,244 +1573,244 @@ const at = "undo redo | preview print | importword revhistory | fontfamily fonts
1573
1573
  "ـ",
1574
1574
  "٠",
1575
1575
  "١"
1576
- ], y = (d, t) => `<svg viewBox="${t || "0 0 24 24"}">${d}</svg>`, f = (d) => y(`<path class="f" d="${d}"/>`, "0 -960 960 960"), q = (d, t = 7.5) => y(
1577
- '<path d="M10 6h10M10 12h10M10 18h10"/>' + d.map(
1576
+ ], x = (h, t) => `<svg viewBox="${t || "0 0 24 24"}">${h}</svg>`, v = (h) => x(`<path class="f" d="${h}"/>`, "0 -960 960 960"), q = (h, t = 7.5) => x(
1577
+ '<path d="M10 6h10M10 12h10M10 18h10"/>' + h.map(
1578
1578
  (e, i) => `<text x="2.5" y="${8.4 + i * 6}" font-size="${t}" stroke="none" fill="#222f3e" font-family="Arial">${e}</text>`
1579
1579
  ).join("")
1580
1580
  ), c = {
1581
- bold: f(
1581
+ bold: v(
1582
1582
  "M272-200v-560h221q65 0 120 40t55 111q0 51-23 78.5T602-491q25 11 55.5 41t30.5 90q0 89-65 124.5T501-200H272Zm121-112h104q48 0 58.5-24.5T566-372q0-11-10.5-35.5T494-432H393v120Zm0-228h93q33 0 48-17t15-38q0-24-17-39t-44-15h-95v109Z"
1583
1583
  ),
1584
- italic: f("M200-200v-100h160l120-360H320v-100h400v100H580L460-300h140v100H200Z"),
1585
- underline: f(
1584
+ italic: v("M200-200v-100h160l120-360H320v-100h400v100H580L460-300h140v100H200Z"),
1585
+ underline: v(
1586
1586
  "M200-120v-80h560v80H200Zm123-223q-56-63-56-167v-330h103v336q0 56 28 91t82 35q54 0 82-35t28-91v-336h103v330q0 104-56 167t-157 63q-101 0-157-63Z"
1587
1587
  ),
1588
- strikethrough: f(
1588
+ strikethrough: v(
1589
1589
  "M486-160q-76 0-135-45t-85-123l88-38q14 48 48.5 79t85.5 31q42 0 76-20t34-64q0-18-7-33t-19-27h112q5 14 7.5 28.5T694-340q0 86-61.5 133T486-160ZM80-480v-80h800v80H80Zm402-326q66 0 115.5 32.5T674-674l-88 39q-9-29-33.5-52T484-710q-41 0-68 18.5T386-640h-96q2-69 54.5-117.5T482-806Z"
1590
1590
  ),
1591
- undo: f("M280-200v-80h284q63 0 109.5-40T720-420q0-60-46.5-100T564-560H312l104 104-56 56-200-200 200-200 56 56-104 104h252q97 0 166.5 63T800-420q0 94-69.5 157T564-200H280Z"),
1592
- redo: f("M396-200q-97 0-166.5-63T160-420q0-94 69.5-157T396-640h252L544-744l56-56 200 200-200 200-56-56 104-104H396q-63 0-109.5 40T240-420q0 60 46.5 100T396-280h284v80H396Z"),
1593
- ltr: f(
1591
+ undo: v("M280-200v-80h284q63 0 109.5-40T720-420q0-60-46.5-100T564-560H312l104 104-56 56-200-200 200-200 56 56-104 104h252q97 0 166.5 63T800-420q0 94-69.5 157T564-200H280Z"),
1592
+ redo: v("M396-200q-97 0-166.5-63T160-420q0-94 69.5-157T396-640h252L544-744l56-56 200 200-200 200-56-56 104-104H396q-63 0-109.5 40T240-420q0 60 46.5 100T396-280h284v80H396Z"),
1593
+ ltr: v(
1594
1594
  "M360-360v-200q-66 0-113-47t-47-113q0-66 47-113t113-47h320v80h-80v440h-80v-440h-80v440h-80Zm0-280v-160q-33 0-56.5 23.5T280-720q0 33 23.5 56.5T360-640Zm0-80ZM680-80l-56-56 64-64H120v-80h568l-64-64 56-56 160 160L680-80Z"
1595
1595
  ),
1596
- rtl: f(
1596
+ rtl: v(
1597
1597
  "M360-360v-200q-66 0-113-47t-47-113q0-66 47-113t113-47h320v80h-80v440h-80v-440h-80v440h-80Zm-88 160 64 64-56 56-160-160 160-160 56 56-64 64h568v80H272Zm88-440v-160q-33 0-56.5 23.5T280-720q0 33 23.5 56.5T360-640Zm0-80Z"
1598
1598
  ),
1599
- alignleft: f(
1599
+ alignleft: v(
1600
1600
  "M120-120v-80h720v80H120Zm0-160v-80h480v80H120Zm0-160v-80h720v80H120Zm0-160v-80h480v80H120Zm0-160v-80h720v80H120Z"
1601
1601
  ),
1602
- aligncenter: f(
1602
+ aligncenter: v(
1603
1603
  "M120-120v-80h720v80H120Zm160-160v-80h400v80H280ZM120-440v-80h720v80H120Zm160-160v-80h400v80H280ZM120-760v-80h720v80H120Z"
1604
1604
  ),
1605
- alignright: f(
1605
+ alignright: v(
1606
1606
  "M120-760v-80h720v80H120Zm240 160v-80h480v80H360ZM120-440v-80h720v80H120Zm240 160v-80h480v80H360ZM120-120v-80h720v80H120Z"
1607
1607
  ),
1608
- alignjustify: f(
1608
+ alignjustify: v(
1609
1609
  "M120-120v-80h720v80H120Zm0-160v-80h720v80H120Zm0-160v-80h720v80H120Zm0-160v-80h720v80H120Zm0-160v-80h720v80H120Z"
1610
1610
  ),
1611
- fullscreen: f(
1611
+ fullscreen: v(
1612
1612
  "M120-120v-200h80v120h120v80H120Zm520 0v-80h120v-120h80v200H640ZM120-640v-200h200v80H200v120h-80Zm640 0v-120H640v-80h200v200h-80Z"
1613
1613
  ),
1614
- clearformatic: f(
1614
+ clearformatic: v(
1615
1615
  "m528-546-93-93-121-121h486v120H568l-40 94ZM792-56 460-388l-80 188H249l119-280L56-792l56-56 736 736-56 56Z"
1616
1616
  ),
1617
- numlist: f(
1617
+ numlist: v(
1618
1618
  "M120-80v-60h100v-30h-60v-60h60v-30H120v-60h120q17 0 28.5 11.5T280-280v40q0 17-11.5 28.5T240-200q17 0 28.5 11.5T280-160v40q0 17-11.5 28.5T240-80H120Zm0-280v-110q0-17 11.5-28.5T160-510h60v-30H120v-60h120q17 0 28.5 11.5T280-560v70q0 17-11.5 28.5T240-450h-60v30h100v60H120Zm60-280v-180h-60v-60h120v240h-60Zm180 440v-80h480v80H360Zm0-240v-80h480v80H360Zm0-240v-80h480v80H360Z"
1619
1619
  ),
1620
- bullist: f(
1620
+ bullist: v(
1621
1621
  "M360-200v-80h480v80H360Zm0-240v-80h480v80H360Zm0-240v-80h480v80H360ZM200-160q-33 0-56.5-23.5T120-240q0-33 23.5-56.5T200-320q33 0 56.5 23.5T280-240q0 33-23.5 56.5T200-160Zm0-240q-33 0-56.5-23.5T120-480q0-33 23.5-56.5T200-560q33 0 56.5 23.5T280-480q0 33-23.5 56.5T200-400Zm-56.5-263.5Q120-687 120-720t23.5-56.5Q167-800 200-800t56.5 23.5Q280-753 280-720t-23.5 56.5Q233-640 200-640t-56.5-23.5Z"
1622
1622
  ),
1623
- chev: y('<path d="M2 3.5 6 7.5 10 3.5"/>', "0 0 12 11"),
1624
- backcolor: f(
1623
+ chev: x('<path d="M2 3.5 6 7.5 10 3.5"/>', "0 0 12 11"),
1624
+ backcolor: v(
1625
1625
  "M440-80q-33 0-56.5-23.5T360-160v-160H240q-33 0-56.5-23.5T160-400v-280q0-66 47-113t113-47h480v440q0 33-23.5 56.5T720-320H600v160q0 33-23.5 56.5T520-80h-80ZM240-560h480v-200h-40v160h-80v-160h-40v80h-80v-80H320q-33 0-56.5 23.5T240-680v120Zm0 160h480v-80H240v80Zm0 0v-80 80Z"
1626
1626
  ),
1627
- outdent: f(
1627
+ outdent: v(
1628
1628
  "M120-120v-80h720v80H120Zm320-160v-80h400v80H440Zm0-160v-80h400v80H440Zm0-160v-80h400v80H440ZM120-760v-80h720v80H120Zm160 440L120-480l160-160v320Z"
1629
1629
  ),
1630
- indent: f(
1630
+ indent: v(
1631
1631
  "M120-120v-80h720v80H120Zm320-160v-80h400v80H440Zm0-160v-80h400v80H440Zm0-160v-80h400v80H440ZM120-760v-80h720v80H120Zm0 440v-320l160 160-160 160Z"
1632
1632
  ),
1633
- more: y(
1633
+ more: x(
1634
1634
  '<circle class="f" cx="5" cy="12" r="1.7"/><circle class="f" cx="12" cy="12" r="1.7"/><circle class="f" cx="19" cy="12" r="1.7"/>'
1635
1635
  ),
1636
- image: f(
1636
+ image: v(
1637
1637
  "M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h560v-560H200v560Zm40-80h480L570-480 450-320l-90-120-120 160Zm-40 80v-560 560Z"
1638
1638
  ),
1639
- uploadic: f(
1639
+ uploadic: v(
1640
1640
  "M440-200v-326L336-422l-56-58 200-200 200 200-56 58-104-104v326h-80ZM240-80q-33 0-56.5-23.5T160-160v-120h80v120h480v-120h80v120q0 33-23.5 56.5T720-80H240Z"
1641
1641
  ),
1642
- tableic: f(
1642
+ tableic: v(
1643
1643
  "M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm240-240H200v160h240v-160Zm80 0v160h240v-160H520Zm-80-80v-160H200v160h240Zm80 0h240v-160H520v160ZM200-680h560v-80H200v80Z"
1644
1644
  ),
1645
- hric: y('<path d="M4 12h16"/>'),
1646
- charic: f(
1645
+ hric: x('<path d="M4 12h16"/>'),
1646
+ charic: v(
1647
1647
  "M120-120v-120h200q-84-45-132-125t-48-175q0-142 99-241t241-99q142 0 241 99t99 241q0 95-48 175T640-240h200v120H520v-204q78-14 129-75t51-141q0-92-64-156t-156-64q-92 0-156 64t-64 156q0 80 51 141t129 75v204H120Z"
1648
1648
  ),
1649
- dateic: y(
1649
+ dateic: x(
1650
1650
  '<rect x="4" y="6" width="16" height="14" rx="1.5"/><path d="M4 10h16M8 4v4M16 4v4"/>'
1651
1651
  ),
1652
- pbic: f(
1652
+ pbic: v(
1653
1653
  "M240-80q-33 0-56.5-23.5T160-160v-120h80v120h480v-120h80v120q0 33-23.5 56.5T720-80H240Zm-80-440v-280q0-33 23.5-56.5T240-880h320l240 240v120h-80v-80H520v-200H240v280h-80Zm200 160v-80h240v80H360Zm320 0v-80h240v80H680Zm-640 0v-80h240v80H40Zm440-160Zm0 240Z"
1654
1654
  ),
1655
- nbspic: y('<path d="M6 12v4h12v-4"/>'),
1656
- srcic: f(
1655
+ nbspic: x('<path d="M6 12v4h12v-4"/>'),
1656
+ srcic: v(
1657
1657
  "M240-280 40-480l200-200 56 56-143 144 143 144-56 56Zm178 132-76-24 200-640 76 24-200 640Zm302-132-56-56 143-144-143-144 56-56 200 200-200 200Z"
1658
1658
  ),
1659
- prevw: f(
1659
+ prevw: v(
1660
1660
  "M607.5-372.5Q660-425 660-500t-52.5-127.5Q555-680 480-680t-127.5 52.5Q300-575 300-500t52.5 127.5Q405-320 480-320t127.5-52.5Zm-204-51Q372-455 372-500t31.5-76.5Q435-608 480-608t76.5 31.5Q588-545 588-500t-31.5 76.5Q525-392 480-392t-76.5-31.5ZM214-281.5Q94-363 40-500q54-137 174-218.5T480-800q146 0 266 81.5T920-500q-54 137-174 218.5T480-200q-146 0-266-81.5ZM480-500Zm207.5 160.5Q782-399 832-500q-50-101-144.5-160.5T480-720q-113 0-207.5 59.5T128-500q50 101 144.5 160.5T480-280q113 0 207.5-59.5Z"
1661
1661
  ),
1662
- printic: f(
1662
+ printic: v(
1663
1663
  "M640-640v-120H320v120h-80v-200h480v200h-80Zm-480 80h640-640Zm560 100q17 0 28.5-11.5T760-500q0-17-11.5-28.5T720-540q-17 0-28.5 11.5T680-500q0 17 11.5 28.5T720-460Zm-80 260v-160H320v160h320Zm80 80H240v-160H80v-240q0-51 35-85.5t85-34.5h560q51 0 85.5 34.5T880-520v240H720v160Zm80-240v-160q0-17-11.5-28.5T760-560H200q-17 0-28.5 11.5T160-520v160h80v-80h480v80h80Z"
1664
1664
  ),
1665
- cutic: f(
1665
+ cutic: v(
1666
1666
  "M760-120 480-400l-94 94q8 15 11 32t3 34q0 66-47 113T240-80q-66 0-113-47T80-240q0-66 47-113t113-47q17 0 34 3t32 11l94-94-94-94q-15 8-32 11t-34 3q-66 0-113-47T80-720q0-66 47-113t113-47q66 0 113 47t47 113q0 17-3 34t-11 32l494 494v40H760ZM600-520l-80-80 240-240h120v40L600-520ZM296.5-663.5Q320-687 320-720t-23.5-56.5Q273-800 240-800t-56.5 23.5Q160-753 160-720t23.5 56.5Q207-640 240-640t56.5-23.5ZM494-466q6-6 6-14t-6-14q-6-6-14-6t-14 6q-6 6-6 14t6 14q6 6 14 6t14-6ZM296.5-183.5Q320-207 320-240t-23.5-56.5Q273-320 240-320t-56.5 23.5Q160-273 160-240t23.5 56.5Q207-160 240-160t56.5-23.5Z"
1667
1667
  ),
1668
- copyic: f(
1668
+ copyic: v(
1669
1669
  "M360-240q-33 0-56.5-23.5T280-320v-480q0-33 23.5-56.5T360-880h360q33 0 56.5 23.5T800-800v480q0 33-23.5 56.5T720-240H360Zm0-80h360v-480H360v480ZM200-80q-33 0-56.5-23.5T120-160v-560h80v560h440v80H200Zm160-240v-480 480Z"
1670
1670
  ),
1671
- pasteic: f(
1671
+ pasteic: v(
1672
1672
  "M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h167q11-35 43-57.5t70-22.5q40 0 71.5 22.5T594-840h166q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h560v-560h-80v120H280v-120h-80v560Zm308.5-571.5Q520-783 520-800t-11.5-28.5Q497-840 480-840t-28.5 11.5Q440-817 440-800t11.5 28.5Q463-760 480-760t28.5-11.5Z"
1673
1673
  ),
1674
- selall: f(
1674
+ selall: v(
1675
1675
  "M280-280v-400h400v400H280Zm80-80h240v-240H360v240ZM200-200v80q-33 0-56.5-23.5T120-200h80Zm-80-80v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm80-160h-80q0-33 23.5-56.5T200-840v80Zm80 640v-80h80v80h-80Zm0-640v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-640v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-640v-80h80v80h-80Zm160 640v-80h80q0 33-23.5 56.5T760-120Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80q33 0 56.5 23.5T840-760h-80Z"
1676
1676
  ),
1677
- superscriptic: f(
1677
+ superscriptic: v(
1678
1678
  "M760-600v-80q0-17 11.5-28.5T800-720h80v-40H760v-40h120q17 0 28.5 11.5T920-760v40q0 17-11.5 28.5T880-680h-80v40h120v40H760ZM235-160l185-291-172-269h106l124 200h4l123-200h107L539-451l186 291H618L482-377h-4L342-160H235Z"
1679
1679
  ),
1680
- subscriptic: f(
1680
+ subscriptic: v(
1681
1681
  "M760-160v-80q0-17 11.5-28.5T800-280h80v-40H760v-40h120q17 0 28.5 11.5T920-320v40q0 17-11.5 28.5T880-240h-80v40h120v40H760Zm-525-80 185-291-172-269h106l124 200h4l123-200h107L539-531l186 291H618L482-457h-4L342-240H235Z"
1682
1682
  ),
1683
- newic: y('<path d="M6 3h8l5 5v13H6z"/><path d="M14 3v5h5"/>'),
1684
- helpic: y(
1683
+ newic: x('<path d="M6 3h8l5 5v13H6z"/><path d="M14 3v5h5"/>'),
1684
+ helpic: x(
1685
1685
  '<circle cx="12" cy="12" r="8.5"/><path d="M9.6 9.6a2.5 2.5 0 1 1 3.4 2.6c-.8.3-1 .9-1 1.8"/><circle class="f" cx="12" cy="16.6" r="1.1"/>'
1686
1686
  ),
1687
- wcic: y('<path d="M4 6h16M4 10h16M4 14h9"/><path d="M15 17.5l2 2 3.6-4"/>'),
1688
- rowbefore: f(
1687
+ wcic: x('<path d="M4 6h16M4 10h16M4 14h9"/><path d="M15 17.5l2 2 3.6-4"/>'),
1688
+ rowbefore: v(
1689
1689
  "M200-160h560v-240H200v240Zm640 80H120v-720h160v80h-80v240h560v-240h-80v-80h160v720ZM480-480Zm0 80v-80 80Zm0 0Zm-40-240v-80h-80v-80h80v-80h80v80h80v80h-80v80h-80Z"
1690
1690
  ),
1691
- rowafter: f(
1691
+ rowafter: v(
1692
1692
  "M200-560h560v-240H200v240Zm-80 400v-720h720v720H680v-80h80v-240H200v240h80v80H120Zm360-320Zm0-80v80-80Zm0 0ZM440-80v-80h-80v-80h80v-80h80v80h80v80h-80v80h-80Z"
1693
1693
  ),
1694
- rowdelete: f(
1694
+ rowdelete: v(
1695
1695
  "M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200ZM200-200h560v-560H200ZM200-400v-160h560v160H200ZM330-580l250 250 50-50-250-250ZM330-380l250-250 50 50-250 250Z"
1696
1696
  ),
1697
- colbefore: f(
1697
+ colbefore: v(
1698
1698
  "M800-200v-560H560v560h240Zm-640 80v-160h80v80h240v-560H240v80h-80v-160h720v720H160Zm320-360Zm80 0h-80 80Zm0 0ZM160-360v-80H80v-80h80v-80h80v80h80v80h-80v80h-80Z"
1699
1699
  ),
1700
- colafter: f(
1700
+ colafter: v(
1701
1701
  "M160-760v560h240v-560H160ZM80-120v-720h720v160h-80v-80H480v560h240v-80h80v160H80Zm400-360Zm-80 0h80-80Zm0 0Zm320 120v-80h-80v-80h80v-80h80v80h80v80h-80v80h-80Z"
1702
1702
  ),
1703
- coldelete: f(
1703
+ coldelete: v(
1704
1704
  "M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200ZM200-200h560v-560H200ZM400-200v-560h160v560H400ZM330-580l250 250 50-50-250-250ZM330-380l250-250 50 50-250 250Z"
1705
1705
  ),
1706
- tabledelete: y(
1706
+ tabledelete: x(
1707
1707
  '<rect x="4" y="5" width="16" height="14" rx="1.5"/><path d="M4 10h16M4 14.5h16M9.5 5v14M14.5 5v14"/><path d="M6.5 6.5l11 11M17.5 6.5l-11 11" stroke-width="2.1"/>'
1708
1708
  ),
1709
- quote: f(
1709
+ quote: v(
1710
1710
  "m228-240 92-160q-66 0-113-47t-47-113q0-66 47-113t113-47q66 0 113 47t47 113q0 23-5.5 42.5T458-480L320-240h-92Zm360 0 92-160q-66 0-113-47t-47-113q0-66 47-113t113-47q66 0 113 47t47 113q0 23-5.5 42.5T818-480L680-240h-92ZM362.5-517.5Q380-535 380-560t-17.5-42.5Q345-620 320-620t-42.5 17.5Q260-585 260-560t17.5 42.5Q295-500 320-500t42.5-17.5Zm360 0Q740-535 740-560t-17.5-42.5Q705-620 680-620t-42.5 17.5Q620-585 620-560t17.5 42.5Q655-500 680-500t42.5-17.5ZM680-560Zm-360 0Z"
1711
1711
  ),
1712
- link: f(
1712
+ link: v(
1713
1713
  "M440-280H280q-83 0-141.5-58.5T80-480q0-83 58.5-141.5T280-680h160v80H280q-50 0-85 35t-35 85q0 50 35 85t85 35h160v80ZM320-440v-80h320v80H320Zm200 160v-80h160q50 0 85-35t35-85q0-50-35-85t-85-35H520v-80h160q83 0 141.5 58.5T880-480q0 83-58.5 141.5T680-280H520Z"
1714
1714
  ),
1715
- unlink: y(
1715
+ unlink: x(
1716
1716
  '<path d="M13.5 6.5l1.7-1.7a4 4 0 0 1 5.6 5.6L19 12.2"/><path d="M10.5 17.5l-1.7 1.7a4 4 0 0 1-5.6-5.6L5 11.8"/><path d="M4 4l16 16"/>'
1717
1717
  ),
1718
- lineheight: f(
1718
+ lineheight: v(
1719
1719
  "M240-160 80-320l56-56 64 62v-332l-64 62-56-56 160-160 160 160-56 56-64-62v332l64-62 56 56-160 160Zm240-40v-80h400v80H480Zm0-240v-80h400v80H480Zm0-240v-80h400v80H480Z"
1720
1720
  ),
1721
- wordspacing: f(
1721
+ wordspacing: v(
1722
1722
  "M320-80 160-240l160-160 57 56-64 64h334l-63-64 56-56 160 160L640-80l-57-56 64-64H313l63 64-56 56ZM200-480v-400h80v400h-80Zm240 0v-400h80v400h-80Zm240 0v-400h80v400h-80Z"
1723
1723
  ),
1724
- caseic: f(
1724
+ caseic: v(
1725
1725
  "m131-252 165-440h79l165 440h-76l-39-112H247l-40 112h-76Zm139-176h131l-64-182h-4l-63 182Zm395 186q-51 0-81-27.5T554-342q0-44 34.5-72.5T677-443q23 0 45 4t38 11v-12q0-29-20.5-47T685-505q-23 0-42 9.5T610-468l-47-35q24-29 54.5-43t68.5-14q69 0 103 32.5t34 97.5v178h-63v-37h-4q-14 23-38 35t-53 12Zm12-54q35 0 59.5-24t24.5-56q-14-8-33.5-12.5T689-393q-32 0-50 14t-18 37q0 20 16 33t40 13Z"
1726
1726
  ),
1727
- uppercaseic: f(
1727
+ uppercaseic: v(
1728
1728
  "M660-240v-248l-64 64-56-56 160-160 160 160-56 56-64-64v248h-80Zm-540 0 165-440h79l165 440h-76l-39-113H236l-40 113h-76Zm139-177h131l-65-182h-4l-62 182Z"
1729
1729
  ),
1730
- lowercaseic: f(
1730
+ lowercaseic: v(
1731
1731
  "M300-240q-51 0-81-27.5T189-340q0-44 34.5-72.5T312-441q23 0 45 4t38 11v-12q0-29-20.5-47T320-503q-23 0-42 9.5T245-466l-47-35q24-29 54.5-43t68.5-14q69 0 103 32.5t34 97.5v178h-63v-37h-4q-14 23-38 35t-53 12Zm12-54q35 0 59.5-24t24.5-56q-14-8-33.5-12.5T324-391q-32 0-50 14t-18 37q0 20 16 33t40 13Zm388 54L540-400l56-56 64 64v-248h80v248l64-64 56 56-160 160Z"
1732
1732
  ),
1733
- capitalizeic: f(
1733
+ capitalizeic: v(
1734
1734
  "M344-250v-366H224v-64h308v64H412v366h-68Zm344 10q-44 0-69-25.5T594-336v-162h-54v-58h54v-87h66v87h74v58h-74v148q0 23 10.5 36t28.5 13q9 0 18.5-3.5T736-314v65q-10 5-22 7t-26 2Z"
1735
1735
  ),
1736
- plus: y('<path d="M12 5.5v13M5.5 12h13"/>'),
1737
- minus: y('<path d="M5.5 12h13"/>'),
1738
- fontsizeup: f(
1736
+ plus: x('<path d="M12 5.5v13M5.5 12h13"/>'),
1737
+ minus: x('<path d="M5.5 12h13"/>'),
1738
+ fontsizeup: v(
1739
1739
  "m40-200 210-560h100l210 560h-96l-51-143H187l-51 143H40Zm176-224h168l-82-232h-4l-82 232Zm504 104v-120H600v-80h120v-120h80v120h120v80H800v120h-80Z"
1740
1740
  ),
1741
- fontsizedown: f(
1741
+ fontsizedown: v(
1742
1742
  "m40-200 210-560h100l210 560h-96l-51-143H187l-51 143H40Zm176-224h168l-82-232h-4l-82 232Zm384-16v-80h320v80H600Z"
1743
1743
  ),
1744
- historyic: f(
1744
+ historyic: v(
1745
1745
  "M480-120q-138 0-240.5-91.5T122-440h82q14 104 92.5 172T480-200q117 0 198.5-81.5T760-480q0-117-81.5-198.5T480-760q-69 0-129 32t-101 88h110v80H120v-240h80v94q51-64 124.5-99T480-840q75 0 140.5 28.5t114 77q48.5 48.5 77 114T840-480q0 75-28.5 140.5t-77 114q-48.5 48.5-114 77T480-120Zm112-192L440-464v-216h80v184l128 128-56 56Z"
1746
1746
  ),
1747
- wordic: y(
1747
+ wordic: x(
1748
1748
  '<path d="M6 3h8l5 5v13H6z"/><path d="M14 3v5h5"/><text x="8" y="17" font-size="8.5" stroke="none" fill="#222f3e" font-family="Arial" font-weight="bold">W</text>'
1749
1749
  ),
1750
- draftic: f(
1750
+ draftic: v(
1751
1751
  "M480-160q-134 0-227-93t-93-227q0-134 93-227t227-93q69 0 132 28.5T720-690v-110h80v280H520v-80h168q-32-56-87.5-88T480-720q-100 0-170 70t-70 170q0 100 70 170t170 70q77 0 139-44t87-116h84q-28 106-114 173t-196 67Z"
1752
1752
  ),
1753
- trash: y(
1753
+ trash: x(
1754
1754
  '<path d="M5 7h14M10 7V5h4v2M7.5 7l1 13h7l1-13"/>'
1755
1755
  ),
1756
- templateic: y(
1756
+ templateic: x(
1757
1757
  '<rect x="4" y="4" width="16" height="16" rx="1.5"/><rect x="6.5" y="6.5" width="5" height="5" rx=".5"/><path d="M14 7.5h3.5M14 10h3.5M6.5 14h11M6.5 17h11"/>'
1758
1758
  ),
1759
- tplleft: y(
1759
+ tplleft: x(
1760
1760
  '<rect x="3" y="5" width="8" height="8" rx=".8"/><path d="M13.5 6.5H21M13.5 9.5H21M13.5 12.5H21M3 15.5h18M3 18.5h18"/>'
1761
1761
  ),
1762
- tplright: y(
1762
+ tplright: x(
1763
1763
  '<rect x="13" y="5" width="8" height="8" rx=".8"/><path d="M3 6.5h7.5M3 9.5h7.5M3 12.5h7.5M3 15.5h18M3 18.5h18"/>'
1764
1764
  ),
1765
- tpltop: y(
1765
+ tpltop: x(
1766
1766
  '<rect x="5" y="3" width="14" height="9" rx=".8"/><path d="M3 15h18M3 18h18M3 21h12"/>'
1767
1767
  ),
1768
- tplcenter: y(
1768
+ tplcenter: x(
1769
1769
  '<path d="M3 4h18M3 7h18M3 10h12"/><rect x="5" y="12.5" width="14" height="9" rx=".8"/>'
1770
1770
  ),
1771
- rotateleft: y(
1771
+ rotateleft: x(
1772
1772
  '<polyline points="1 4 1 10 7 10"/><path d="M3.51 15a9 9 0 1 0 2.13-9.36L1 10"/>'
1773
1773
  ),
1774
- rotateright: y(
1774
+ rotateright: x(
1775
1775
  '<polyline points="23 4 23 10 17 10"/><path d="M20.49 15a9 9 0 1 1-2.12-9.36L23 10"/>'
1776
1776
  ),
1777
- fliphorizontal: y(
1777
+ fliphorizontal: x(
1778
1778
  '<path d="M12 3v18"/><path d="M7 8l-4 4 4 4"/><path d="M17 8l4 4-4 4"/>'
1779
1779
  ),
1780
- flipvertical: y(
1780
+ flipvertical: x(
1781
1781
  '<path d="M3 12h18"/><path d="M8 7l4-4 4 4"/><path d="M8 17l4 4 4-4"/>'
1782
1782
  ),
1783
- check: y('<path d="M5 12.5 9.5 17 19 7"/>'),
1784
- palette: y(
1783
+ check: x('<path d="M5 12.5 9.5 17 19 7"/>'),
1784
+ palette: x(
1785
1785
  '<path d="M12 3a9 9 0 1 0 0 18h1.2a2 2 0 0 0 2-2 2 2 0 0 1 2-2H18a3 3 0 0 0 3-3c0-6.1-4.5-11-9-11z"/><circle class="f" cx="7.8" cy="10.2" r="1.3"/><circle class="f" cx="11.6" cy="7.3" r="1.3"/><circle class="f" cx="15.8" cy="9.6" r="1.3"/><circle class="f" cx="9" cy="14.8" r="1.3"/>'
1786
1786
  ),
1787
- ul_circle: f(
1787
+ ul_circle: v(
1788
1788
  "M280-600v-80h560v80H280Zm0 160v-80h560v80H280Zm0 160v-80h560v80H280ZM160-600q-17 0-28.5-11.5T120-640q0-17 11.5-28.5T160-680q17 0 28.5 11.5T200-640q0 17-11.5 28.5T160-600Zm0 160q-17 0-28.5-11.5T120-480q0-17 11.5-28.5T160-520q17 0 28.5 11.5T200-480q0 17-11.5 28.5T160-440Zm0 160q-17 0-28.5-11.5T120-320q0-17 11.5-28.5T160-360q17 0 28.5 11.5T200-320q0 17-11.5 28.5T160-280Z"
1789
1789
  ),
1790
- ul_square: f(
1790
+ ul_square: v(
1791
1791
  "M80-160v-160h160v160H80Zm240 0v-160h560v160H320ZM80-400v-160h160v160H80Zm240 0v-160h560v160H320ZM80-640v-160h160v160H80Zm240 0v-160h560v160H320Z"
1792
1792
  ),
1793
1793
  ol_alpha: q(["a", "b", "c"]),
1794
1794
  ol_roman: q(["i", "ii", "iii"], 6.5),
1795
1795
  ol_alphau: q(["A", "B", "C"]),
1796
1796
  ol_romanu: q(["I", "II", "III"], 6.5),
1797
- video: y('<rect x="3" y="6" width="13" height="12" rx="1.5"/><path d="M16 10l5-3v10l-5-3z"/>'),
1798
- editic: y('<path d="M4 20l1-4.5L15.5 5 19 8.5 8.5 19 4 20z"/><path d="M13.5 6.5l4 4"/>'),
1799
- letterspacing: y(
1797
+ video: x('<rect x="3" y="6" width="13" height="12" rx="1.5"/><path d="M16 10l5-3v10l-5-3z"/>'),
1798
+ editic: x('<path d="M4 20l1-4.5L15.5 5 19 8.5 8.5 19 4 20z"/><path d="M13.5 6.5l4 4"/>'),
1799
+ letterspacing: x(
1800
1800
  '<text x="2.5" y="13" font-size="12" stroke="none" fill="#222f3e" font-family="Arial" font-weight="bold">A</text><text x="13" y="13" font-size="12" stroke="none" fill="#222f3e" font-family="Arial" font-weight="bold">B</text><path d="M7 18.5h10"/><path class="f" d="M7.5 18.5 4.5 16.6v3.8z"/><path class="f" d="M16.5 18.5l3-1.9v3.8z"/>'
1801
1801
  ),
1802
- emojiic: y(
1802
+ emojiic: x(
1803
1803
  '<circle cx="12" cy="12" r="8.5"/><path d="M8.6 14.3a4.6 4.6 0 0 0 6.8 0"/><path d="M9.2 9.6v.7M14.8 9.6v.7"/>'
1804
1804
  ),
1805
- inlinecodeic: y('<path d="M8.5 8 4.5 12l4 4M15.5 8l4 4-4 4"/><path d="M13 6l-2 12"/>'),
1806
- moverowup: y('<rect x="4" y="15.5" width="16" height="5" rx="1"/><path d="M12 12.5V4M8.5 7.5 12 4l3.5 3.5"/>'),
1807
- moverowdown: y('<rect x="4" y="3.5" width="16" height="5" rx="1"/><path d="M12 11.5V20M8.5 16.5 12 20l3.5-3.5"/>'),
1808
- movecolleft: y('<rect x="15.5" y="4" width="5" height="16" rx="1"/><path d="M12.5 12H4M7.5 8.5 4 12l3.5 3.5"/>'),
1809
- movecolright: y('<rect x="3.5" y="4" width="5" height="16" rx="1"/><path d="M11.5 12H20M16.5 8.5 20 12l-3.5 3.5"/>'),
1810
- codesampleic: y(
1805
+ inlinecodeic: x('<path d="M8.5 8 4.5 12l4 4M15.5 8l4 4-4 4"/><path d="M13 6l-2 12"/>'),
1806
+ moverowup: x('<rect x="4" y="15.5" width="16" height="5" rx="1"/><path d="M12 12.5V4M8.5 7.5 12 4l3.5 3.5"/>'),
1807
+ moverowdown: x('<rect x="4" y="3.5" width="16" height="5" rx="1"/><path d="M12 11.5V20M8.5 16.5 12 20l3.5-3.5"/>'),
1808
+ movecolleft: x('<rect x="15.5" y="4" width="5" height="16" rx="1"/><path d="M12.5 12H4M7.5 8.5 4 12l3.5 3.5"/>'),
1809
+ movecolright: x('<rect x="3.5" y="4" width="5" height="16" rx="1"/><path d="M11.5 12H20M16.5 8.5 20 12l-3.5 3.5"/>'),
1810
+ codesampleic: x(
1811
1811
  '<rect x="3.5" y="4" width="17" height="16" rx="2"/><path d="M3.5 8.5h17"/><path d="M9.5 12 7 14.25l2.5 2.25M14.5 12l2.5 2.25-2.5 2.25"/>'
1812
1812
  )
1813
- }, te = (d) => `<span class="txt">${d}</span>`, bt = /* @__PURE__ */ new Set([
1813
+ }, fe = (h) => `<span class="txt">${h}</span>`, wt = /* @__PURE__ */ new Set([
1814
1814
  "p",
1815
1815
  "div",
1816
1816
  "span",
@@ -1852,7 +1852,7 @@ const at = "undo redo | preview print | importword revhistory | fontfamily fonts
1852
1852
  "figure",
1853
1853
  "figcaption",
1854
1854
  "mark"
1855
- ]), yt = /* @__PURE__ */ new Set([
1855
+ ]), Ct = /* @__PURE__ */ new Set([
1856
1856
  "text-align",
1857
1857
  "direction",
1858
1858
  "unicode-bidi",
@@ -1908,7 +1908,7 @@ const at = "undo redo | preview print | importword revhistory | fontfamily fonts
1908
1908
  "box-sizing",
1909
1909
  "list-style-type",
1910
1910
  "white-space"
1911
- ]), Q = {
1911
+ ]), G = {
1912
1912
  "*": ["dir", "lang", "colspan", "rowspan"],
1913
1913
  a: ["href", "target", "rel", "title"],
1914
1914
  img: ["src", "alt", "width", "height", "title"],
@@ -1917,26 +1917,26 @@ const at = "undo redo | preview print | importword revhistory | fontfamily fonts
1917
1917
  th: ["width", "valign"],
1918
1918
  table: ["width", "cellpadding", "cellspacing"]
1919
1919
  };
1920
- function R(d) {
1921
- const t = {}, e = d.getAttribute && d.getAttribute("style");
1920
+ function D(h) {
1921
+ const t = {}, e = h.getAttribute && h.getAttribute("style");
1922
1922
  return e && e.split(";").forEach((i) => {
1923
1923
  const s = i.indexOf(":");
1924
1924
  s < 1 || (t[i.slice(0, s).trim().toLowerCase()] = i.slice(s + 1).trim());
1925
1925
  }), t;
1926
1926
  }
1927
- function xt(d) {
1928
- return d.replace(/<!--\[if !supportLists\]-->([\s\S]*?)<!--\[endif\]-->/gi, "$1").replace(/<!--\[if !supportLists\]>([\s\S]*?)<!\[endif\]-->/gi, "$1").replace(/<!\[if !supportLists\]>([\s\S]*?)<!\[endif\]>/gi, "$1").replace(/<!--\[if [\s\S]*?<!\[endif\]-->/gi, "").replace(/<!--[\s\S]*?-->/g, "").replace(/<(script|style|xml|title)[\s\S]*?<\/\1>/gi, "").replace(/<\/?(meta|link)[^>]*>/gi, "").replace(/<\?xml[\s\S]*?\?>/gi, "").replace(/<\/?(o|v|w|m|st1):[^>]*>/gi, "");
1927
+ function Tt(h) {
1928
+ return h.replace(/<!--\[if !supportLists\]-->([\s\S]*?)<!--\[endif\]-->/gi, "$1").replace(/<!--\[if !supportLists\]>([\s\S]*?)<!\[endif\]-->/gi, "$1").replace(/<!\[if !supportLists\]>([\s\S]*?)<!\[endif\]>/gi, "$1").replace(/<!--\[if [\s\S]*?<!\[endif\]-->/gi, "").replace(/<!--[\s\S]*?-->/g, "").replace(/<(script|style|xml|title)[\s\S]*?<\/\1>/gi, "").replace(/<\/?(meta|link)[^>]*>/gi, "").replace(/<\?xml[\s\S]*?\?>/gi, "").replace(/<\/?(o|v|w|m|st1):[^>]*>/gi, "");
1929
1929
  }
1930
- function Ct(d) {
1931
- return /^[0-9]+[\.\)،]/.test(d) ? { ordered: !0 } : /^[٠-٩۰-۹]+/.test(d) ? { ordered: !0, style: "arabic-indic" } : /^[ivxlc]{2,}[\.\)]/.test(d) ? { ordered: !0, style: "lower-roman" } : /^[IVXLC]{2,}[\.\)]/.test(d) ? { ordered: !0, style: "upper-roman" } : /^[a-z][\.\)]/.test(d) ? { ordered: !0, style: "lower-alpha" } : /^[A-Z][\.\)]/.test(d) ? { ordered: !0, style: "upper-alpha" } : /^[ء-ي][\.\)،-]/.test(d) ? { ordered: !0, style: "arabic-indic" } : { ordered: !1 };
1930
+ function St(h) {
1931
+ return /^[0-9]+[\.\)،]/.test(h) ? { ordered: !0 } : /^[٠-٩۰-۹]+/.test(h) ? { ordered: !0, style: "arabic-indic" } : /^[ivxlc]{2,}[\.\)]/.test(h) ? { ordered: !0, style: "lower-roman" } : /^[IVXLC]{2,}[\.\)]/.test(h) ? { ordered: !0, style: "upper-roman" } : /^[a-z][\.\)]/.test(h) ? { ordered: !0, style: "lower-alpha" } : /^[A-Z][\.\)]/.test(h) ? { ordered: !0, style: "upper-alpha" } : /^[ء-ي][\.\)،-]/.test(h) ? { ordered: !0, style: "arabic-indic" } : { ordered: !1 };
1932
1932
  }
1933
- function wt(d) {
1933
+ function Et(h) {
1934
1934
  const t = (s) => {
1935
1935
  const l = (s.getAttribute("style") || "") + " " + (s.className || "");
1936
1936
  return /mso-list\s*:(?!\s*ignore)/i.test(l) || /MsoListParagraph/i.test(l);
1937
1937
  }, e = [];
1938
1938
  let i = null;
1939
- Array.from(d.body.querySelectorAll("p")).forEach((s) => {
1939
+ Array.from(h.body.querySelectorAll("p")).forEach((s) => {
1940
1940
  if (!t(s)) {
1941
1941
  i = null;
1942
1942
  return;
@@ -1944,68 +1944,68 @@ function wt(d) {
1944
1944
  const l = s.previousElementSibling;
1945
1945
  i && l && i[i.length - 1] === l ? i.push(s) : (i = [s], e.push(i));
1946
1946
  }), e.forEach((s) => {
1947
- const l = [], n = s[0];
1948
- s.forEach((o) => {
1949
- var x, C, S;
1950
- const a = +(((x = (o.getAttribute("style") || "").match(/level(\d+)/i)) == null ? void 0 : x[1]) || 1), h = Array.from(o.querySelectorAll("span")).find(
1951
- (w) => /mso-list\s*:\s*ignore/i.test(w.getAttribute("style") || "")
1952
- ), p = h ? ((C = h.textContent) == null ? void 0 : C.trim()) || "" : (((S = o.textContent) == null ? void 0 : S.trim().match(/^\S{1,4}/)) || [""])[0], { ordered: m, style: g } = Ct(p);
1953
- for (h && h.remove(); l.length && l[l.length - 1].level > a; ) l.pop();
1947
+ const l = [], o = s[0];
1948
+ s.forEach((n) => {
1949
+ var y, w, S;
1950
+ const a = +(((y = (n.getAttribute("style") || "").match(/level(\d+)/i)) == null ? void 0 : y[1]) || 1), d = Array.from(n.querySelectorAll("span")).find(
1951
+ (C) => /mso-list\s*:\s*ignore/i.test(C.getAttribute("style") || "")
1952
+ ), p = d ? ((w = d.textContent) == null ? void 0 : w.trim()) || "" : (((S = n.textContent) == null ? void 0 : S.trim().match(/^\S{1,4}/)) || [""])[0], { ordered: u, style: g } = St(p);
1953
+ for (d && d.remove(); l.length && l[l.length - 1].level > a; ) l.pop();
1954
1954
  if (!l.length || l[l.length - 1].level < a) {
1955
- const w = d.createElement(m ? "ol" : "ul");
1956
- if (m && g && (w.style.listStyleType = g), l.length) {
1955
+ const C = h.createElement(u ? "ol" : "ul");
1956
+ if (u && g && (C.style.listStyleType = g), l.length) {
1957
1957
  const k = l[l.length - 1].list;
1958
- (k.lastElementChild || k).appendChild(w);
1958
+ (k.lastElementChild || k).appendChild(C);
1959
1959
  } else
1960
- n.parentNode.insertBefore(w, n);
1961
- l.push({ list: w, level: a });
1960
+ o.parentNode.insertBefore(C, o);
1961
+ l.push({ list: C, level: a });
1962
1962
  }
1963
- const u = d.createElement("li"), v = R(o), b = ["text-align", "direction", "unicode-bidi", "color", "font-size", "font-family", "background-color"].filter((w) => v[w]).map((w) => w + ":" + v[w]).join(";");
1964
- for (b && u.setAttribute("style", b), o.getAttribute("dir") && u.setAttribute("dir", o.getAttribute("dir")); o.firstChild; ) u.appendChild(o.firstChild);
1965
- l[l.length - 1].list.appendChild(u), o.remove();
1963
+ const m = h.createElement("li"), f = D(n), b = ["text-align", "direction", "unicode-bidi", "color", "font-size", "font-family", "background-color"].filter((C) => f[C]).map((C) => C + ":" + f[C]).join(";");
1964
+ for (b && m.setAttribute("style", b), n.getAttribute("dir") && m.setAttribute("dir", n.getAttribute("dir")); n.firstChild; ) m.appendChild(n.firstChild);
1965
+ l[l.length - 1].list.appendChild(m), n.remove();
1966
1966
  });
1967
1967
  });
1968
1968
  }
1969
- function Tt(d) {
1970
- d.querySelectorAll('b[id^="docs-internal-guid"]').forEach((t) => {
1969
+ function Mt(h) {
1970
+ h.querySelectorAll('b[id^="docs-internal-guid"]').forEach((t) => {
1971
1971
  for (; t.firstChild; ) t.parentNode.insertBefore(t.firstChild, t);
1972
1972
  t.remove();
1973
1973
  });
1974
1974
  }
1975
- function St(d) {
1976
- d.querySelectorAll("table").forEach((t) => {
1975
+ function Lt(h) {
1976
+ h.querySelectorAll("table").forEach((t) => {
1977
1977
  const e = t;
1978
- R(e)["border-collapse"] || (e.style.borderCollapse = "collapse");
1979
- }), d.querySelectorAll("[align]").forEach((t) => {
1978
+ D(e)["border-collapse"] || (e.style.borderCollapse = "collapse");
1979
+ }), h.querySelectorAll("[align]").forEach((t) => {
1980
1980
  const e = t, i = e.getAttribute("align").toLowerCase();
1981
1981
  e.tagName.toLowerCase() === "table" ? i === "center" ? (e.style.marginLeft = e.style.marginLeft || "auto", e.style.marginRight = e.style.marginRight || "auto") : i === "right" ? e.style.marginLeft = e.style.marginLeft || "auto" : i === "left" && (e.style.marginRight = e.style.marginRight || "auto") : ["left", "right", "center", "justify"].includes(i) && (e.style.textAlign = e.style.textAlign || i, Array.from(e.children).forEach((s) => {
1982
1982
  if (s.tagName.toLowerCase() !== "table") return;
1983
1983
  const l = s;
1984
1984
  i === "center" ? (l.style.marginLeft = l.style.marginLeft || "auto", l.style.marginRight = l.style.marginRight || "auto") : i === "right" ? l.style.marginLeft = l.style.marginLeft || "auto" : i === "left" && (l.style.marginRight = l.style.marginRight || "auto");
1985
1985
  })), e.removeAttribute("align");
1986
- }), d.querySelectorAll("center table").forEach((t) => {
1986
+ }), h.querySelectorAll("center table").forEach((t) => {
1987
1987
  const e = t;
1988
1988
  e.style.marginLeft = e.style.marginLeft || "auto", e.style.marginRight = e.style.marginRight || "auto";
1989
- }), d.querySelectorAll("[bgcolor]").forEach((t) => {
1989
+ }), h.querySelectorAll("[bgcolor]").forEach((t) => {
1990
1990
  const e = t;
1991
1991
  e.style.backgroundColor = e.style.backgroundColor || e.getAttribute("bgcolor"), e.removeAttribute("bgcolor");
1992
1992
  });
1993
1993
  }
1994
- function Z(d, t) {
1995
- Array.from(d.childNodes).forEach((e) => {
1994
+ function Z(h, t) {
1995
+ Array.from(h.childNodes).forEach((e) => {
1996
1996
  if (e.nodeType === Node.COMMENT_NODE) {
1997
1997
  e.remove();
1998
1998
  return;
1999
1999
  }
2000
2000
  if (e.nodeType !== Node.ELEMENT_NODE) return;
2001
2001
  const i = e, s = i.tagName.toLowerCase();
2002
- if (!bt.has(s)) {
2002
+ if (!wt.has(s)) {
2003
2003
  if (s === "font") {
2004
2004
  const r = t.createElement("span");
2005
2005
  i.getAttribute("style") && r.setAttribute("style", i.getAttribute("style")), i.getAttribute("color") && (r.style.color = i.getAttribute("color")), i.getAttribute("face") && (r.style.fontFamily = i.getAttribute("face"));
2006
2006
  const a = i.getAttribute("size");
2007
2007
  if (a && !r.style.fontSize) {
2008
- const h = {
2008
+ const d = {
2009
2009
  1: "8pt",
2010
2010
  2: "10pt",
2011
2011
  3: "12pt",
@@ -2014,7 +2014,7 @@ function Z(d, t) {
2014
2014
  6: "24pt",
2015
2015
  7: "36pt"
2016
2016
  };
2017
- h[a] && (r.style.fontSize = h[a]);
2017
+ d[a] && (r.style.fontSize = d[a]);
2018
2018
  }
2019
2019
  for (; i.firstChild; ) r.appendChild(i.firstChild);
2020
2020
  i.replaceWith(r), Z(r, t);
@@ -2024,7 +2024,7 @@ function Z(d, t) {
2024
2024
  i.remove();
2025
2025
  return;
2026
2026
  }
2027
- const l = /* @__PURE__ */ new Set([...Q["*"] || [], ...Q[s] || []]);
2027
+ const l = /* @__PURE__ */ new Set([...G["*"] || [], ...G[s] || []]);
2028
2028
  if (Array.from(i.attributes).forEach((r) => {
2029
2029
  const a = r.name.toLowerCase();
2030
2030
  a !== "style" && !l.has(a) && i.removeAttribute(r.name);
@@ -2040,228 +2040,259 @@ function Z(d, t) {
2040
2040
  return;
2041
2041
  }
2042
2042
  }
2043
- const n = R(i), o = [];
2044
- for (const [r, a] of Object.entries(n))
2045
- yt.has(r) && (/expression|javascript|url\s*\(\s*['"]?\s*file:/i.test(a) || r === "font-weight" && /^(400|normal)$/i.test(a) || r === "font-style" && /^normal$/i.test(a) || r === "text-decoration" && /^none$/i.test(a) || o.push(r + ":" + a));
2046
- if (o.length ? i.setAttribute("style", o.join(";")) : i.removeAttribute("style"), i.removeAttribute("class"), Z(i, t), s === "span" && !i.attributes.length) {
2043
+ const o = D(i), n = [];
2044
+ for (const [r, a] of Object.entries(o))
2045
+ Ct.has(r) && (/expression|javascript|url\s*\(\s*['"]?\s*file:/i.test(a) || r === "font-weight" && /^(400|normal)$/i.test(a) || r === "font-style" && /^normal$/i.test(a) || r === "text-decoration" && /^none$/i.test(a) || n.push(r + ":" + a));
2046
+ if (n.length ? i.setAttribute("style", n.join(";")) : i.removeAttribute("style"), i.removeAttribute("class"), Z(i, t), s === "span" && !i.attributes.length) {
2047
2047
  for (; i.firstChild; ) i.parentNode.insertBefore(i.firstChild, i);
2048
2048
  i.remove();
2049
2049
  }
2050
2050
  });
2051
2051
  }
2052
- function Mt(d) {
2052
+ function Ht(h) {
2053
2053
  const t = [], e = /<style[^>]*>([\s\S]*?)<\/style>/gi;
2054
2054
  let i;
2055
- for (; i = e.exec(d); ) {
2055
+ for (; i = e.exec(h); ) {
2056
2056
  let s = i[1].replace(/<!--|-->/g, "").replace(/\/\*[\s\S]*?\*\//g, "");
2057
2057
  s = s.replace(/@media[^{]*\{(?:[^{}]*\{[^{}]*\})*[^{}]*\}/gi, ""), s = s.replace(/@[\w-]+[^{]*\{[^{}]*\}/g, "");
2058
2058
  let l;
2059
- const n = /([^{}]+)\{([^}]*)\}/g;
2060
- for (; l = n.exec(s); ) {
2061
- const o = l[2].split(";").map((r) => {
2059
+ const o = /([^{}]+)\{([^}]*)\}/g;
2060
+ for (; l = o.exec(s); ) {
2061
+ const n = l[2].split(";").map((r) => {
2062
2062
  const a = r.indexOf(":");
2063
2063
  return a < 1 ? null : [r.slice(0, a).trim().toLowerCase(), r.slice(a + 1).trim()];
2064
2064
  }).filter((r) => !!r && !!r[1]);
2065
- o.length && l[1].split(",").map((r) => r.trim()).filter((r) => r && !r.startsWith("@")).forEach((r) => t.push({ sel: r, decls: o }));
2065
+ n.length && l[1].split(",").map((r) => r.trim()).filter((r) => r && !r.startsWith("@")).forEach((r) => t.push({ sel: r, decls: n }));
2066
2066
  }
2067
2067
  }
2068
2068
  return t;
2069
2069
  }
2070
- function Et(d, t) {
2070
+ function kt(h, t) {
2071
2071
  if (!t.length) return;
2072
2072
  const e = /* @__PURE__ */ new Map();
2073
2073
  t.forEach(({ sel: i, decls: s }) => {
2074
2074
  let l;
2075
2075
  try {
2076
- l = d.querySelectorAll(i);
2076
+ l = h.querySelectorAll(i);
2077
2077
  } catch {
2078
2078
  return;
2079
2079
  }
2080
- l.forEach((n) => {
2081
- let o = e.get(n);
2082
- o || (o = {}, e.set(n, o)), s.forEach(([r, a]) => {
2083
- o[r] = a;
2080
+ l.forEach((o) => {
2081
+ let n = e.get(o);
2082
+ n || (n = {}, e.set(o, n)), s.forEach(([r, a]) => {
2083
+ n[r] = a;
2084
2084
  });
2085
2085
  });
2086
2086
  }), e.forEach((i, s) => {
2087
- const l = R(s), n = s.hasAttribute("dir"), o = s.hasAttribute("align"), r = Object.entries(i).filter(([p]) => !(p in l || (p === "direction" || p === "unicode-bidi") && n || p === "text-align" && (o || n) || (p === "background" || p === "background-color") && s.hasAttribute("bgcolor")));
2087
+ const l = D(s), o = s.hasAttribute("dir"), n = s.hasAttribute("align"), r = Object.entries(i).filter(([p]) => !(p in l || (p === "direction" || p === "unicode-bidi") && o || p === "text-align" && (n || o) || (p === "background" || p === "background-color") && s.hasAttribute("bgcolor")));
2088
2088
  if (!r.length) return;
2089
- const a = r.map(([p, m]) => p + ":" + m).join(";"), h = s.getAttribute("style");
2090
- s.setAttribute("style", h ? a + ";" + h : a);
2089
+ const a = r.map(([p, u]) => p + ":" + u).join(";"), d = s.getAttribute("style");
2090
+ s.setAttribute("style", d ? a + ";" + d : a);
2091
2091
  });
2092
2092
  }
2093
- function st(d) {
2094
- return d.replace(/[ﭐ-﷿ﹰ-ﻼ]+/g, (t) => t.normalize("NFKC"));
2093
+ function nt(h) {
2094
+ return h.replace(/[ﭐ-﷿ﹰ-ﻼ]+/g, (t) => t.normalize("NFKC"));
2095
2095
  }
2096
- function Lt(d) {
2097
- const t = d.createTreeWalker(d.body, NodeFilter.SHOW_TEXT, null);
2096
+ function At(h) {
2097
+ const t = h.createTreeWalker(h.body, NodeFilter.SHOW_TEXT, null);
2098
2098
  let e;
2099
2099
  for (; e = t.nextNode(); )
2100
- /[ﭐ-﷿ﹰ-ﻼ]/.test(e.nodeValue || "") && (e.nodeValue = st(e.nodeValue || ""));
2100
+ /[ﭐ-﷿ﹰ-ﻼ]/.test(e.nodeValue || "") && (e.nodeValue = nt(e.nodeValue || ""));
2101
2101
  }
2102
- function Ht(d, t = "ltr") {
2103
- const e = Mt(d), i = new DOMParser().parseFromString(xt(d), "text/html");
2104
- Et(i, e), /class="?Mso|mso-|urn:schemas-microsoft-com/i.test(i.body.innerHTML) && wt(i), Tt(i), St(i), Z(i.body, i), Lt(i);
2102
+ function It(h, t = "ltr") {
2103
+ const e = Ht(h), i = new DOMParser().parseFromString(Tt(h), "text/html");
2104
+ kt(i, e), /class="?Mso|mso-|urn:schemas-microsoft-com/i.test(i.body.innerHTML) && Et(i), Mt(i), Lt(i), Z(i.body, i), At(i);
2105
2105
  const s = (l) => {
2106
- var n;
2107
- return l && l.tagName === "P" && !((n = l.textContent) != null && n.trim()) && !l.querySelector("img,table");
2106
+ var o;
2107
+ return l && l.tagName === "P" && !((o = l.textContent) != null && o.trim()) && !l.querySelector("img,table");
2108
2108
  };
2109
2109
  for (; s(i.body.firstElementChild); ) i.body.firstElementChild.remove();
2110
2110
  for (; s(i.body.lastElementChild); ) i.body.lastElementChild.remove();
2111
2111
  return i.body.innerHTML.trim();
2112
2112
  }
2113
- function kt(d) {
2114
- const t = st(d).replace(/\r/g, ""), e = (i) => i.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
2113
+ function qt(h) {
2114
+ const t = nt(h).replace(/\r/g, ""), e = (i) => i.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
2115
2115
  return /\n/.test(t) ? t.split(/\n{2,}/).map((i) => `<p dir="auto">${e(i).replace(/\n/g, "<br>") || "<br>"}</p>`).join("") : e(t);
2116
2116
  }
2117
- const At = 10 * 1024 * 1024, lt = /^(https?:|data:image\/|blob:)/i;
2118
- function G(d, t) {
2117
+ const Bt = 10 * 1024 * 1024, ot = /^(https?:|data:image\/|blob:)/i;
2118
+ function Y(h, t) {
2119
2119
  const e = [], i = "{\\" + t;
2120
2120
  let s = 0;
2121
- for (; (s = d.indexOf(i, s)) !== -1; ) {
2122
- const l = d[s + i.length];
2121
+ for (; (s = h.indexOf(i, s)) !== -1; ) {
2122
+ const l = h[s + i.length];
2123
2123
  if (l && /[a-z0-9]/i.test(l)) {
2124
2124
  s += i.length;
2125
2125
  continue;
2126
2126
  }
2127
- let n = 0, o = s;
2128
- for (; o < d.length; o++) {
2129
- const r = d[o];
2127
+ let o = 0, n = s;
2128
+ for (; n < h.length; n++) {
2129
+ const r = h[n];
2130
2130
  if (r === "\\") {
2131
- o++;
2131
+ n++;
2132
2132
  continue;
2133
2133
  }
2134
- if (r === "{") n++;
2135
- else if (r === "}" && (n--, !n))
2134
+ if (r === "{") o++;
2135
+ else if (r === "}" && (o--, !o))
2136
2136
  break;
2137
2137
  }
2138
- e.push({ start: s, end: o + 1, body: d.slice(s + i.length, o) }), s = o + 1;
2138
+ e.push({ start: s, end: n + 1, body: h.slice(s + i.length, n) }), s = n + 1;
2139
2139
  }
2140
2140
  return e;
2141
2141
  }
2142
- function It(d) {
2143
- const t = new Uint8Array(d.length / 2);
2144
- for (let e = 0; e < t.length; e++) t[e] = parseInt(d.substr(e * 2, 2), 16);
2142
+ function Nt(h) {
2143
+ const t = new Uint8Array(h.length / 2);
2144
+ for (let e = 0; e < t.length; e++) t[e] = parseInt(h.substr(e * 2, 2), 16);
2145
2145
  return t;
2146
2146
  }
2147
- function F(d) {
2147
+ function O(h) {
2148
2148
  let t = "";
2149
- for (let e = 0; e < d.length; e++) t += String.fromCharCode(d[e]);
2149
+ for (let e = 0; e < h.length; e++) t += String.fromCharCode(h[e]);
2150
2150
  return btoa(t);
2151
2151
  }
2152
- function Y(d, t) {
2153
- t: for (let e = 0; e + t.length <= d.length; e++) {
2154
- for (let i = 0; i < t.length; i++) if (d[e + i] !== t[i]) continue t;
2152
+ function K(h, t) {
2153
+ t: for (let e = 0; e + t.length <= h.length; e++) {
2154
+ for (let i = 0; i < t.length; i++) if (h[e + i] !== t[i]) continue t;
2155
2155
  return e;
2156
2156
  }
2157
2157
  return -1;
2158
2158
  }
2159
- const qt = [137, 80, 78, 71], Bt = [255, 216, 255];
2160
- function Nt(d) {
2159
+ const Rt = [137, 80, 78, 71], Zt = [255, 216, 255];
2160
+ function Pt(h) {
2161
2161
  let t = null;
2162
- if (/\\pngblip/.test(d) ? t = "image/png" : /\\jpegblip/.test(d) ? t = "image/jpeg" : (/\\wmetafile\d*/.test(d) || /\\emfblip/.test(d)) && (t = "metafile"), !t) return null;
2163
- let e = d.replace(/\{[^{}]*\}/g, "").replace(/\\[a-z]+-?\d*\s?/gi, "").replace(/[^0-9a-fA-F]/g, "");
2162
+ if (/\\pngblip/.test(h) ? t = "image/png" : /\\jpegblip/.test(h) ? t = "image/jpeg" : (/\\wmetafile\d*/.test(h) || /\\emfblip/.test(h)) && (t = "metafile"), !t) return null;
2163
+ let e = h.replace(/\{[^{}]*\}/g, " ").replace(/\\[a-z]+-?\d*\s?/gi, " ").replace(/[^0-9a-fA-F]/g, "");
2164
2164
  if (e.length % 2 && (e = e.slice(0, -1)), !e) return null;
2165
- const i = It(e);
2165
+ const i = Nt(e);
2166
2166
  if (t === "metafile") {
2167
- const s = Y(i, qt);
2168
- if (s >= 0) return "data:image/png;base64," + F(i.slice(s));
2169
- const l = Y(i, Bt);
2170
- return l >= 0 ? "data:image/jpeg;base64," + F(i.slice(l)) : null;
2167
+ const s = K(i, Rt);
2168
+ if (s >= 0) return "data:image/png;base64," + O(i.slice(s));
2169
+ const l = K(i, Zt);
2170
+ return l >= 0 ? "data:image/jpeg;base64," + O(i.slice(l)) : null;
2171
2171
  }
2172
- return "data:" + t + ";base64," + F(i);
2172
+ return "data:" + t + ";base64," + O(i);
2173
2173
  }
2174
- function Zt(d) {
2175
- if (!d || d.indexOf("\\pict") === -1) return [];
2176
- let t = d;
2177
- G(d, "nonshppict").reverse().forEach((i) => {
2174
+ function Dt(h) {
2175
+ if (!h || h.indexOf("\\pict") === -1) return [];
2176
+ let t = h;
2177
+ Y(h, "nonshppict").reverse().forEach((i) => {
2178
2178
  t = t.slice(0, i.start) + t.slice(i.end);
2179
2179
  });
2180
- let e = At;
2181
- return G(t, "pict").map((i) => {
2180
+ let e = Bt;
2181
+ return Y(t, "pict").map((i) => {
2182
2182
  if (e <= 0) return null;
2183
- const s = Nt(i.body);
2183
+ const s = Pt(i.body);
2184
2184
  return s && (e -= s.length * 0.75), s;
2185
2185
  });
2186
2186
  }
2187
- function nt(d, t) {
2188
- if (!d || !t.length) return { html: d, injected: [] };
2187
+ function J(h) {
2188
+ const t = h.match(/^\s*(-?[\d.]+)\s*(pt|px|in|cm|mm)?\s*$/i);
2189
+ if (!t) return null;
2190
+ const e = parseFloat(t[1]);
2191
+ if (!isFinite(e) || e <= 0) return null;
2192
+ const i = (t[2] || "px").toLowerCase(), s = i === "pt" ? e * 4 / 3 : i === "in" ? e * 96 : i === "cm" ? e * 96 / 2.54 : i === "mm" ? e * 96 / 25.4 : e;
2193
+ return Math.round(s);
2194
+ }
2195
+ function Ft(h, t) {
2196
+ const e = h.match(new RegExp("\\s" + t + `\\s*=\\s*(?:"([^"]*)"|'([^']*)'|([^\\s>]+))`, "i"));
2197
+ return e ? e[1] ?? e[2] ?? e[3] ?? "" : "";
2198
+ }
2199
+ function Ot(h) {
2200
+ if (!/<v:imagedata\b/i.test(h)) return h;
2201
+ const t = (i, s) => {
2202
+ const l = Ft(i, "src");
2203
+ if (!l) return null;
2204
+ const o = l.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
2205
+ if (new RegExp(`<img\\b[^>]*\\bsrc\\s*=\\s*["']?` + o, "i").test(h)) return null;
2206
+ const n = (s.match(/<v:shape\b[^>]*\sstyle\s*=\s*(?:"([^"]*)"|'([^']*)')/i) || []).slice(1).find(Boolean) || "", r = J((n.match(/(?:^|;)\s*width\s*:\s*([^;]+)/i) || [])[1] || ""), a = J((n.match(/(?:^|;)\s*height\s*:\s*([^;]+)/i) || [])[1] || "");
2207
+ return '<img src="' + l.replace(/"/g, "&quot;") + '"' + (r ? ' width="' + r + '"' : "") + (a ? ' height="' + a + '"' : "") + ">";
2208
+ };
2209
+ let e = h.replace(/<!--\[if [^\]]*\]>([\s\S]*?)<!\[endif\]-->/gi, (i, s) => {
2210
+ const l = s.match(/<v:imagedata\b[^>]*>/i);
2211
+ return l && t(l[0], s) || i;
2212
+ });
2213
+ return e = e.replace(/<v:shape\b[^>]*>[\s\S]*?<\/v:shape\s*>/gi, (i) => {
2214
+ const s = i.match(/<v:imagedata\b[^>]*>/i);
2215
+ return s && t(s[0], i) || i;
2216
+ }), e.replace(/<v:imagedata\b[^>]*>/gi, (i) => t(i, "") || i);
2217
+ }
2218
+ function rt(h, t) {
2219
+ if (!h || !t.length) return { html: h, injected: [] };
2189
2220
  const e = [];
2190
2221
  let i = 0;
2191
- return { html: d.replace(/<img\b[^>]*>/gi, (l) => {
2192
- const n = (l.match(/\ssrc\s*=\s*["']?([^"'\s>]+)/i) || [])[1] || "";
2193
- if (lt.test(n)) return l;
2194
- const o = t[i++];
2195
- return o ? (e.push(o), /\ssrc\s*=\s*["']/i.test(l) ? l.replace(/(\ssrc\s*=\s*)(["'])[^"']*\2/i, '$1"' + o + '"') : l.replace(/(\ssrc\s*=\s*)[^\s>]+/i, '$1"' + o + '"')) : l;
2222
+ return { html: Ot(h).replace(/<img\b[^>]*>/gi, (l) => {
2223
+ const o = (l.match(/\ssrc\s*=\s*["']?([^"'\s>]+)/i) || [])[1] || "";
2224
+ if (ot.test(o)) return l;
2225
+ const n = t[i++];
2226
+ return n ? (e.push(n), /\ssrc\s*=\s*["']/i.test(l) ? l.replace(/(\ssrc\s*=\s*)(["'])[^"']*\2/i, '$1"' + n + '"') : l.replace(/(\ssrc\s*=\s*)[^\s>]+/i, '$1"' + n + '"')) : l;
2196
2227
  }), injected: e };
2197
2228
  }
2198
- function Pt(d, t) {
2199
- return !d || !t ? { html: d, injected: [] } : nt(d, Zt(t));
2229
+ function $t(h, t) {
2230
+ return !h || !t ? { html: h, injected: [] } : rt(h, Dt(t));
2200
2231
  }
2201
- function Rt(d) {
2202
- const t = d.match(/<img\b[^>]*>/gi);
2232
+ function _t(h) {
2233
+ const t = h.match(/<img\b[^>]*>/gi);
2203
2234
  return t ? t.filter((e) => {
2204
2235
  const i = (e.match(/\ssrc\s*=\s*["']?([^"'\s>]+)/i) || [])[1] || "";
2205
- return !lt.test(i);
2236
+ return !ot.test(i);
2206
2237
  }).length : 0;
2207
2238
  }
2208
- function Dt(d, t) {
2209
- const e = d.match(/^data:([^;,]+);base64,(.*)$/);
2239
+ function zt(h, t) {
2240
+ const e = h.match(/^data:([^;,]+);base64,(.*)$/);
2210
2241
  if (!e) return null;
2211
2242
  const i = (e[1].split("/")[1] || "png").replace(/[^a-z0-9]/gi, "") || "png";
2212
2243
  try {
2213
2244
  const s = atob(e[2]), l = new Uint8Array(s.length);
2214
- for (let n = 0; n < s.length; n++) l[n] = s.charCodeAt(n);
2245
+ for (let o = 0; o < s.length; o++) l[o] = s.charCodeAt(o);
2215
2246
  return new File([l], t + "." + (i === "jpeg" ? "jpg" : i), { type: e[1] });
2216
2247
  } catch {
2217
2248
  return null;
2218
2249
  }
2219
2250
  }
2220
- function Ft(d) {
2221
- const t = new DataView(d), e = /* @__PURE__ */ new Map();
2251
+ function Ut(h) {
2252
+ const t = new DataView(h), e = /* @__PURE__ */ new Map();
2222
2253
  let i = -1;
2223
- for (let o = d.byteLength - 22; o >= Math.max(0, d.byteLength - 22 - 65535); o--)
2224
- if (t.getUint32(o, !0) === 101010256) {
2225
- i = o;
2254
+ for (let n = h.byteLength - 22; n >= Math.max(0, h.byteLength - 22 - 65535); n--)
2255
+ if (t.getUint32(n, !0) === 101010256) {
2256
+ i = n;
2226
2257
  break;
2227
2258
  }
2228
2259
  if (i < 0) throw new Error("EOCD not found");
2229
2260
  const s = t.getUint16(i + 10, !0);
2230
2261
  let l = t.getUint32(i + 16, !0);
2231
- const n = new TextDecoder();
2232
- for (let o = 0; o < s && t.getUint32(l, !0) === 33639248; o++) {
2233
- const r = t.getUint16(l + 10, !0), a = t.getUint32(l + 20, !0), h = t.getUint16(l + 28, !0), p = t.getUint16(l + 30, !0), m = t.getUint16(l + 32, !0), g = t.getUint32(l + 42, !0), u = n.decode(new Uint8Array(d, l + 46, h));
2234
- e.set(u, { name: u, method: r, compSize: a, localOffset: g }), l += 46 + h + p + m;
2262
+ const o = new TextDecoder();
2263
+ for (let n = 0; n < s && t.getUint32(l, !0) === 33639248; n++) {
2264
+ const r = t.getUint16(l + 10, !0), a = t.getUint32(l + 20, !0), d = t.getUint16(l + 28, !0), p = t.getUint16(l + 30, !0), u = t.getUint16(l + 32, !0), g = t.getUint32(l + 42, !0), m = o.decode(new Uint8Array(h, l + 46, d));
2265
+ e.set(m, { name: m, method: r, compSize: a, localOffset: g }), l += 46 + d + p + u;
2235
2266
  }
2236
2267
  return e;
2237
2268
  }
2238
- async function K(d, t) {
2239
- const e = new DataView(d, t.localOffset);
2269
+ async function tt(h, t) {
2270
+ const e = new DataView(h, t.localOffset);
2240
2271
  if (e.getUint32(0, !0) !== 67324752) throw new Error("Bad local header");
2241
- const i = e.getUint16(26, !0), s = e.getUint16(28, !0), l = t.localOffset + 30 + i + s, n = new Uint8Array(d.slice(l, l + t.compSize));
2242
- if (t.method === 0) return n;
2272
+ const i = e.getUint16(26, !0), s = e.getUint16(28, !0), l = t.localOffset + 30 + i + s, o = new Uint8Array(h.slice(l, l + t.compSize));
2273
+ if (t.method === 0) return o;
2243
2274
  if (t.method !== 8) throw new Error("Unsupported compression method " + t.method);
2244
- const o = new Blob([n]).stream().pipeThrough(new DecompressionStream("deflate-raw"));
2245
- return new Uint8Array(await new Response(o).arrayBuffer());
2275
+ const n = new Blob([o]).stream().pipeThrough(new DecompressionStream("deflate-raw"));
2276
+ return new Uint8Array(await new Response(n).arrayBuffer());
2246
2277
  }
2247
- const J = (d) => d.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;"), P = (d, t) => Array.from(d.children).filter((e) => e.localName === t), M = (d, ...t) => {
2248
- let e = d;
2278
+ const et = (h) => h.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;"), P = (h, t) => Array.from(h.children).filter((e) => e.localName === t), E = (h, ...t) => {
2279
+ let e = h;
2249
2280
  for (const i of t) {
2250
2281
  if (!e) return null;
2251
2282
  e = Array.from(e.children).find((s) => s.localName === i) || null;
2252
2283
  }
2253
2284
  return e;
2254
- }, T = (d, t = "val") => {
2255
- if (!d) return "";
2256
- for (const e of Array.from(d.attributes))
2285
+ }, T = (h, t = "val") => {
2286
+ if (!h) return "";
2287
+ for (const e of Array.from(h.attributes))
2257
2288
  if (e.localName === t) return e.value;
2258
2289
  return "";
2259
- }, B = (d, t) => {
2260
- const e = d ? M(d, t) : null;
2290
+ }, B = (h, t) => {
2291
+ const e = h ? E(h, t) : null;
2261
2292
  if (!e) return !1;
2262
2293
  const i = T(e);
2263
2294
  return i !== "false" && i !== "0";
2264
- }, tt = {
2295
+ }, it = {
2265
2296
  yellow: "#FFFF00",
2266
2297
  green: "#00FF00",
2267
2298
  cyan: "#00FFFF",
@@ -2278,7 +2309,7 @@ const J = (d) => d.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&
2278
2309
  lightGray: "#D3D3D3",
2279
2310
  black: "#000000",
2280
2311
  white: "#FFFFFF"
2281
- }, Ot = {
2312
+ }, Wt = {
2282
2313
  png: "image/png",
2283
2314
  jpg: "image/jpeg",
2284
2315
  jpeg: "image/jpeg",
@@ -2286,13 +2317,13 @@ const J = (d) => d.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&
2286
2317
  bmp: "image/bmp",
2287
2318
  webp: "image/webp"
2288
2319
  };
2289
- function $t(d) {
2320
+ function Vt(h) {
2290
2321
  let t = "";
2291
- for (let e = 0; e < d.length; e += 32768)
2292
- t += String.fromCharCode(...d.subarray(e, e + 32768));
2322
+ for (let e = 0; e < h.length; e += 32768)
2323
+ t += String.fromCharCode(...h.subarray(e, e + 32768));
2293
2324
  return btoa(t);
2294
2325
  }
2295
- class _t {
2326
+ class jt {
2296
2327
  constructor(t, e, i) {
2297
2328
  this.rels = t, this.images = e, this.numFmt = i;
2298
2329
  }
@@ -2303,12 +2334,12 @@ class _t {
2303
2334
  };
2304
2335
  for (const l of Array.from(t.children))
2305
2336
  if (l.localName === "p") {
2306
- const n = this.paraList(l);
2307
- if (n) {
2308
- const o = n.ilvl + 1;
2309
- for (; i.length > o; ) e += `</${i.pop()}>`;
2310
- for (i.length === o && i[o - 1] !== n.type && (e += `</${i.pop()}>`); i.length < o; )
2311
- e += `<${n.type}>`, i.push(n.type);
2337
+ const o = this.paraList(l);
2338
+ if (o) {
2339
+ const n = o.ilvl + 1;
2340
+ for (; i.length > n; ) e += `</${i.pop()}>`;
2341
+ for (i.length === n && i[n - 1] !== o.type && (e += `</${i.pop()}>`); i.length < n; )
2342
+ e += `<${o.type}>`, i.push(o.type);
2312
2343
  e += `<li>${this.runsOf(l) || "<br>"}</li>`;
2313
2344
  continue;
2314
2345
  }
@@ -2317,21 +2348,21 @@ class _t {
2317
2348
  return s(0), e || "<p><br></p>";
2318
2349
  }
2319
2350
  paraList(t) {
2320
- const e = M(t, "pPr", "numPr");
2351
+ const e = E(t, "pPr", "numPr");
2321
2352
  if (!e) return null;
2322
- const i = T(M(e, "numId"));
2353
+ const i = T(E(e, "numId"));
2323
2354
  if (!i || i === "0") return null;
2324
- const s = parseInt(T(M(e, "ilvl")) || "0", 10) || 0;
2355
+ const s = parseInt(T(E(e, "ilvl")) || "0", 10) || 0;
2325
2356
  return { type: this.numFmt.get(i) || "ul", ilvl: Math.min(s, 8) };
2326
2357
  }
2327
2358
  convertPara(t) {
2328
- const e = M(t, "pPr"), i = T(M(t, "pPr", "pStyle"));
2359
+ const e = E(t, "pPr"), i = T(E(t, "pPr", "pStyle"));
2329
2360
  let s = "p";
2330
2361
  const l = /^Heading([1-6])$/i.exec(i);
2331
2362
  l ? s = "h" + l[1] : /^Title$/i.test(i) && (s = "h1");
2332
- const n = [], o = T(M(t, "pPr", "jc"));
2333
- o === "center" ? n.push("text-align:center") : o === "right" || o === "end" ? n.push("text-align:right") : (o === "both" || o === "distribute") && n.push("text-align:justify"), e && M(e, "bidi") && n.push("direction:rtl");
2334
- const r = this.runsOf(t), a = n.length ? ` style="${n.join(";")}"` : "";
2363
+ const o = [], n = T(E(t, "pPr", "jc"));
2364
+ n === "center" ? o.push("text-align:center") : n === "right" || n === "end" ? o.push("text-align:right") : (n === "both" || n === "distribute") && o.push("text-align:justify"), e && E(e, "bidi") && o.push("direction:rtl");
2365
+ const r = this.runsOf(t), a = o.length ? ` style="${o.join(";")}"` : "";
2335
2366
  return `<${s}${a}>${r || "<br>"}</${s}>`;
2336
2367
  }
2337
2368
  runsOf(t) {
@@ -2342,167 +2373,241 @@ class _t {
2342
2373
  let s = this.rels.get(T(i, "id")) || "";
2343
2374
  const l = T(i, "anchor");
2344
2375
  !s && l && (s = "#" + l);
2345
- const n = this.runsOf(i);
2346
- e += s ? `<a href="${J(s)}">${n}</a>` : n;
2376
+ const o = this.runsOf(i);
2377
+ e += s ? `<a href="${et(s)}">${o}</a>` : o;
2347
2378
  } else (i.localName === "smartTag" || i.localName === "ins") && (e += this.runsOf(i));
2348
2379
  return e;
2349
2380
  }
2350
2381
  convertRun(t) {
2351
- const e = M(t, "rPr");
2382
+ const e = E(t, "rPr");
2352
2383
  let i = "";
2353
2384
  for (const p of Array.from(t.children))
2354
- p.localName === "t" ? i += J(p.textContent || "") : p.localName === "br" || p.localName === "cr" ? i += "<br>" : p.localName === "tab" ? i += "&emsp;" : (p.localName === "drawing" || p.localName === "pict" || p.localName === "object") && (i += this.convertImage(p));
2385
+ p.localName === "t" ? i += et(p.textContent || "") : p.localName === "br" || p.localName === "cr" ? i += "<br>" : p.localName === "tab" ? i += "&emsp;" : (p.localName === "drawing" || p.localName === "pict" || p.localName === "object") && (i += this.convertImage(p));
2355
2386
  if (!i) return "";
2356
- const s = [], l = T(e ? M(e, "color") : null);
2387
+ const s = [], l = T(e ? E(e, "color") : null);
2357
2388
  l && l !== "auto" && s.push("color:#" + l);
2358
- const n = T(e ? M(e, "highlight") : null);
2359
- n && tt[n] && s.push("background-color:" + tt[n]);
2360
- const o = parseFloat(T(e ? M(e, "sz") : null));
2361
- o && s.push("font-size:" + Math.round(o / 2 * (4 / 3)) + "px");
2362
- const r = e ? M(e, "rFonts") : null, a = T(r, "ascii") || T(r, "cs");
2363
- a && s.push(`font-family:'${a}'`), s.length && (i = `<span style="${s.join(";")}">${i}</span>`), B(e, "b") && (i = `<strong>${i}</strong>`), B(e, "i") && (i = `<em>${i}</em>`), B(e, "u") && T(M(e, "u")) !== "none" && (i = `<u>${i}</u>`), B(e, "strike") && (i = `<s>${i}</s>`);
2364
- const h = T(e ? M(e, "vertAlign") : null);
2365
- return h === "superscript" ? i = `<sup>${i}</sup>` : h === "subscript" && (i = `<sub>${i}</sub>`), i;
2389
+ const o = T(e ? E(e, "highlight") : null);
2390
+ o && it[o] && s.push("background-color:" + it[o]);
2391
+ const n = parseFloat(T(e ? E(e, "sz") : null));
2392
+ n && s.push("font-size:" + Math.round(n / 2 * (4 / 3)) + "px");
2393
+ const r = e ? E(e, "rFonts") : null, a = T(r, "ascii") || T(r, "cs");
2394
+ a && s.push(`font-family:'${a}'`), s.length && (i = `<span style="${s.join(";")}">${i}</span>`), B(e, "b") && (i = `<strong>${i}</strong>`), B(e, "i") && (i = `<em>${i}</em>`), B(e, "u") && T(E(e, "u")) !== "none" && (i = `<u>${i}</u>`), B(e, "strike") && (i = `<s>${i}</s>`);
2395
+ const d = T(e ? E(e, "vertAlign") : null);
2396
+ return d === "superscript" ? i = `<sup>${i}</sup>` : d === "subscript" && (i = `<sub>${i}</sub>`), i;
2366
2397
  }
2367
2398
  convertImage(t) {
2368
2399
  let e = "", i = 0;
2369
- const s = (o) => {
2370
- if (o.localName === "blip" && (e = e || T(o, "embed") || T(o, "link")), o.localName === "imagedata" && (e = e || T(o, "id")), o.localName === "extent") {
2371
- const r = parseFloat(o.getAttribute("cx") || "0");
2400
+ const s = (n) => {
2401
+ if (n.localName === "blip" && (e = e || T(n, "embed") || T(n, "link")), n.localName === "imagedata" && (e = e || T(n, "id")), n.localName === "extent") {
2402
+ const r = parseFloat(n.getAttribute("cx") || "0");
2372
2403
  r && (i = Math.round(r / 9525));
2373
2404
  }
2374
- for (const r of Array.from(o.children)) s(r);
2405
+ for (const r of Array.from(n.children)) s(r);
2375
2406
  };
2376
2407
  if (s(t), !e) return "";
2377
2408
  const l = this.images.get(e);
2378
2409
  if (!l) return "";
2379
- const n = i ? ` width="${i}"` : "";
2380
- return `<img src="${l}" alt=""${n}>`;
2410
+ const o = i ? ` width="${i}"` : "";
2411
+ return `<img src="${l}" alt=""${o}>`;
2381
2412
  }
2382
2413
  convertTable(t) {
2383
2414
  let e = '<table style="border-collapse:collapse;width:100%"><tbody>';
2384
2415
  for (const i of P(t, "tr")) {
2385
2416
  e += "<tr>";
2386
2417
  for (const s of P(i, "tc")) {
2387
- const l = parseInt(T(M(s, "tcPr", "gridSpan")) || "1", 10) || 1, n = l > 1 ? ` colspan="${l}"` : "";
2388
- let o = "";
2418
+ const l = parseInt(T(E(s, "tcPr", "gridSpan")) || "1", 10) || 1, o = l > 1 ? ` colspan="${l}"` : "";
2419
+ let n = "";
2389
2420
  for (const r of Array.from(s.children))
2390
- r.localName === "p" ? o += this.convertPara(r) : r.localName === "tbl" && (o += this.convertTable(r));
2391
- e += `<td style="border:1px solid #b9c2cc"${n}>${o || "<br>"}</td>`;
2421
+ r.localName === "p" ? n += this.convertPara(r) : r.localName === "tbl" && (n += this.convertTable(r));
2422
+ e += `<td style="border:1px solid #b9c2cc"${o}>${n || "<br>"}</td>`;
2392
2423
  }
2393
2424
  e += "</tr>";
2394
2425
  }
2395
2426
  return e + "</tbody></table>";
2396
2427
  }
2397
2428
  }
2398
- async function zt(d) {
2399
- const t = d instanceof ArrayBuffer ? d : await d.arrayBuffer(), e = Ft(t), i = new TextDecoder(), s = async (u) => {
2400
- const v = e.get(u);
2401
- return v ? new DOMParser().parseFromString(i.decode(await K(t, v)), "application/xml") : null;
2402
- }, l = await s("word/document.xml"), n = l == null ? void 0 : l.getElementsByTagName("*");
2403
- let o = null;
2404
- if (n) {
2405
- for (const u of Array.from(n))
2406
- if (u.localName === "body") {
2407
- o = u;
2429
+ async function Xt(h) {
2430
+ const t = h instanceof ArrayBuffer ? h : await h.arrayBuffer(), e = Ut(t), i = new TextDecoder(), s = async (m) => {
2431
+ const f = e.get(m);
2432
+ return f ? new DOMParser().parseFromString(i.decode(await tt(t, f)), "application/xml") : null;
2433
+ }, l = await s("word/document.xml"), o = l == null ? void 0 : l.getElementsByTagName("*");
2434
+ let n = null;
2435
+ if (o) {
2436
+ for (const m of Array.from(o))
2437
+ if (m.localName === "body") {
2438
+ n = m;
2408
2439
  break;
2409
2440
  }
2410
2441
  }
2411
- if (!o) throw new Error("word/document.xml missing or invalid");
2412
- const r = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), h = await s("word/_rels/document.xml.rels");
2413
- if (h)
2414
- for (const u of Array.from(h.getElementsByTagName("*"))) {
2415
- if (u.localName !== "Relationship") continue;
2416
- const v = u.getAttribute("Id") || "", b = u.getAttribute("Target") || "", x = u.getAttribute("Type") || "";
2417
- /hyperlink/i.test(x) ? r.set(v, b) : /image/i.test(x) && a.set(v, b);
2442
+ if (!n) throw new Error("word/document.xml missing or invalid");
2443
+ const r = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), d = await s("word/_rels/document.xml.rels");
2444
+ if (d)
2445
+ for (const m of Array.from(d.getElementsByTagName("*"))) {
2446
+ if (m.localName !== "Relationship") continue;
2447
+ const f = m.getAttribute("Id") || "", b = m.getAttribute("Target") || "", y = m.getAttribute("Type") || "";
2448
+ /hyperlink/i.test(y) ? r.set(f, b) : /image/i.test(y) && a.set(f, b);
2418
2449
  }
2419
2450
  const p = /* @__PURE__ */ new Map();
2420
- for (const [u, v] of a) {
2421
- const b = v.startsWith("/") ? v.slice(1) : "word/" + v.replace(/^\.\//, ""), x = e.get(b);
2422
- if (!x) continue;
2423
- const C = (b.split(".").pop() || "").toLowerCase(), S = Ot[C];
2451
+ for (const [m, f] of a) {
2452
+ const b = f.startsWith("/") ? f.slice(1) : "word/" + f.replace(/^\.\//, ""), y = e.get(b);
2453
+ if (!y) continue;
2454
+ const w = (b.split(".").pop() || "").toLowerCase(), S = Wt[w];
2424
2455
  if (S)
2425
2456
  try {
2426
- p.set(u, `data:${S};base64,${$t(await K(t, x))}`);
2457
+ p.set(m, `data:${S};base64,${Vt(await tt(t, y))}`);
2427
2458
  } catch {
2428
2459
  }
2429
2460
  }
2430
- const m = /* @__PURE__ */ new Map(), g = await s("word/numbering.xml");
2461
+ const u = /* @__PURE__ */ new Map(), g = await s("word/numbering.xml");
2431
2462
  if (g) {
2432
- const u = /* @__PURE__ */ new Map(), v = Array.from(g.getElementsByTagName("*"));
2433
- for (const b of v) {
2463
+ const m = /* @__PURE__ */ new Map(), f = Array.from(g.getElementsByTagName("*"));
2464
+ for (const b of f) {
2434
2465
  if (b.localName !== "abstractNum") continue;
2435
- const x = T(b, "abstractNumId"), C = P(b, "lvl").find((w) => T(w, "ilvl") === "0") || P(b, "lvl")[0], S = C ? T(M(C, "numFmt")) : "";
2436
- u.set(x, S === "bullet" ? "ul" : "ol");
2466
+ const y = T(b, "abstractNumId"), w = P(b, "lvl").find((C) => T(C, "ilvl") === "0") || P(b, "lvl")[0], S = w ? T(E(w, "numFmt")) : "";
2467
+ m.set(y, S === "bullet" ? "ul" : "ol");
2437
2468
  }
2438
- for (const b of v) {
2469
+ for (const b of f) {
2439
2470
  if (b.localName !== "num") continue;
2440
- const x = T(b, "numId"), C = T(M(b, "abstractNumId"));
2441
- m.set(x, u.get(C) || "ul");
2471
+ const y = T(b, "numId"), w = T(E(b, "abstractNumId"));
2472
+ u.set(y, m.get(w) || "ul");
2442
2473
  }
2443
2474
  }
2444
- return new _t(r, p, m).convertBody(o);
2475
+ return new jt(r, p, u).convertBody(n);
2445
2476
  }
2446
- const Ut = ["nw", "ne", "sw", "se"], O = ["img-left", "img-right", "img-top", "img-center"], $ = {
2477
+ const Qt = ["nw", "ne", "sw", "se"], $ = ["img-left", "img-right", "img-top", "img-center"], _ = {
2447
2478
  "img-left": "tplimgleft",
2448
2479
  "img-right": "tplimgright",
2449
2480
  "img-top": "tplimgtop",
2450
2481
  "img-center": "tplimgcenter"
2451
- }, Wt = {
2482
+ }, Gt = {
2452
2483
  "img-left": c.tplleft,
2453
2484
  "img-right": c.tplright,
2454
2485
  "img-top": c.tpltop,
2455
2486
  "img-center": c.tplcenter
2456
- }, jt = ".tox,.pop,.tblctx,.imgctx,.selctx,.dlg";
2457
- let E = null, A = null, _ = 0, et = !1;
2487
+ }, Yt = ".tox,.pop,.tblctx,.imgctx,.selctx,.dlg";
2488
+ let M = null, A = null, z = 0, st = !1;
2458
2489
  function N() {
2459
- clearTimeout(_), A = null, E && E.classList.remove("show");
2490
+ clearTimeout(z), A = null, M && M.classList.remove("show");
2460
2491
  }
2461
- function Vt(d) {
2462
- const t = d.dataset.tip;
2492
+ function Kt(h) {
2493
+ const t = h.dataset.tip;
2463
2494
  if (!t) return;
2464
- A = d, clearTimeout(_);
2465
- const e = E && E.classList.contains("show") ? 60 : 350;
2466
- _ = window.setTimeout(() => {
2467
- if (A !== d || !document.contains(d)) return;
2468
- E || (E = document.createElement("div"), E.className = "etip", document.body.appendChild(E)), E.textContent = t, E.classList.add("show");
2469
- const i = d.getBoundingClientRect(), s = E.offsetWidth, l = E.offsetHeight;
2470
- let n = i.left + i.width / 2 - s / 2;
2471
- n = Math.max(6, Math.min(n, innerWidth - s - 6));
2472
- let o = i.bottom + 7;
2473
- o + l > innerHeight - 6 && (o = i.top - l - 7), E.style.left = n + "px", E.style.top = o + "px";
2495
+ A = h, clearTimeout(z);
2496
+ const e = M && M.classList.contains("show") ? 60 : 350;
2497
+ z = window.setTimeout(() => {
2498
+ if (A !== h || !document.contains(h)) return;
2499
+ M || (M = document.createElement("div"), M.className = "etip", document.body.appendChild(M)), M.textContent = t, M.classList.add("show");
2500
+ const i = h.getBoundingClientRect(), s = M.offsetWidth, l = M.offsetHeight;
2501
+ let o = i.left + i.width / 2 - s / 2;
2502
+ o = Math.max(6, Math.min(o, innerWidth - s - 6));
2503
+ let n = i.bottom + 7;
2504
+ n + l > innerHeight - 6 && (n = i.top - l - 7), M.style.left = o + "px", M.style.top = n + "px";
2474
2505
  }, e);
2475
2506
  }
2476
- function Xt() {
2477
- et || (et = !0, document.addEventListener("mouseover", (d) => {
2478
- const t = d.target, e = t.closest ? t.closest("[title],[data-tip]") : null;
2479
- if (!e || !e.closest(jt) || e.closest(".earea")) {
2507
+ function Jt() {
2508
+ st || (st = !0, document.addEventListener("mouseover", (h) => {
2509
+ const t = h.target, e = t.closest ? t.closest("[title],[data-tip]") : null;
2510
+ if (!e || !e.closest(Yt) || e.closest(".earea")) {
2480
2511
  e !== A && N();
2481
2512
  return;
2482
2513
  }
2483
2514
  const i = e.getAttribute("title");
2484
- i && (e.dataset.tip = i, e.removeAttribute("title"), e.getAttribute("aria-label") || e.setAttribute("aria-label", i)), e !== A && Vt(e);
2485
- }), document.addEventListener("mouseout", (d) => {
2486
- A && !A.contains(d.relatedTarget) && N();
2515
+ i && (e.dataset.tip = i, e.removeAttribute("title"), e.getAttribute("aria-label") || e.setAttribute("aria-label", i)), e !== A && Kt(e);
2516
+ }), document.addEventListener("mouseout", (h) => {
2517
+ A && !A.contains(h.relatedTarget) && N();
2487
2518
  }), document.addEventListener("mousedown", N, !0), addEventListener("scroll", N, !0));
2488
2519
  }
2489
- const Qt = /[\u0590-\u05FF\u0600-\u06FF\u0750-\u077F\u0780-\u07BF\u08A0-\u08FF\uFB1D-\uFB4F\uFB50-\uFDFF\uFE70-\uFEFF]/, Gt = new RegExp("\\p{L}", "u"), Yt = "p,div,li,td,th,blockquote,h1,h2,h3,h4,h5,h6,pre,figcaption";
2490
- function Kt(d) {
2491
- for (const t of d) {
2492
- if (Qt.test(t)) return "rtl";
2493
- if (Gt.test(t)) return "ltr";
2520
+ const te = /[\u0590-\u05FF\u0600-\u06FF\u0750-\u077F\u0780-\u07BF\u08A0-\u08FF\uFB1D-\uFB4F\uFB50-\uFDFF\uFE70-\uFEFF]/, ee = new RegExp("\\p{L}", "u"), ie = "p,div,li,td,th,blockquote,h1,h2,h3,h4,h5,h6,pre,figcaption";
2521
+ function se(h) {
2522
+ for (const t of h) {
2523
+ if (te.test(t)) return "rtl";
2524
+ if (ee.test(t)) return "ltr";
2494
2525
  }
2495
2526
  return null;
2496
2527
  }
2497
- function ot(d) {
2528
+ const R = ["top", "right", "bottom", "left"], le = /^(none|hidden|dotted|dashed|solid|double|groove|ridge|inset|outset)$/i, ne = /^(thin|medium|thick|[+-]?(\d+\.?\d*|\.\d+)(px|pt|em|rem|ex|ch|cm|mm|in|pc|q)?)$/i, oe = /^[+-]?0*(\.0*)?(px|pt|em|rem|ex|ch|cm|mm|in|pc|q)?$/i, re = /^border-(collapse|spacing|radius|image|block|inline|start|end)/i, ae = /^border(?:-(top|right|bottom|left))?(?:-(width|style|color))?$/, ce = /^(inherit|initial|unset|revert|revert-layer)$/i;
2529
+ function at(h) {
2530
+ const t = [];
2531
+ let e = 0, i = "";
2532
+ for (const s of h)
2533
+ s === "(" ? e++ : s === ")" && e--, e === 0 && /\s/.test(s) ? (i && t.push(i), i = "") : i += s;
2534
+ return i && t.push(i), t;
2535
+ }
2536
+ function he(h) {
2537
+ const [t, e = t, i = t, s = e] = h;
2538
+ return [t, e, i, s];
2539
+ }
2540
+ function de(h) {
2541
+ const t = { width: "medium", style: "none", color: "" };
2542
+ return at(h).forEach((e) => {
2543
+ le.test(e) ? t.style = e.toLowerCase() : ne.test(e) ? t.width = e : t.color = e;
2544
+ }), t;
2545
+ }
2546
+ function pe(h) {
2547
+ return !h || /^currentcolor$/i.test(h) ? "" : /^windowtext$/i.test(h) ? "#000000" : h;
2548
+ }
2549
+ function ue(h) {
2550
+ if (h.width === null && h.style === null && h.color === null) return "";
2551
+ const t = h.style ?? "solid";
2552
+ return t === "none" || t === "hidden" || h.width && oe.test(h.width) ? "none" : [h.width && h.width !== "medium" ? h.width : "", t, pe(h.color || "")].filter(Boolean).join(" ");
2553
+ }
2554
+ function me(h) {
2555
+ h.querySelectorAll("table,td,th").forEach((t) => {
2556
+ const e = t.getAttribute("style") || "";
2557
+ if (!/border/i.test(e)) return;
2558
+ const i = {
2559
+ top: { width: null, style: null, color: null },
2560
+ right: { width: null, style: null, color: null },
2561
+ bottom: { width: null, style: null, color: null },
2562
+ left: { width: null, style: null, color: null }
2563
+ }, s = [];
2564
+ let l = !1, o = !1;
2565
+ if (e.split(";").forEach((a) => {
2566
+ const d = a.indexOf(":");
2567
+ if (d < 1) {
2568
+ a.trim() && s.push(a.trim());
2569
+ return;
2570
+ }
2571
+ const p = a.slice(0, d).trim().toLowerCase(), u = a.slice(d + 1).trim(), g = ae.exec(p);
2572
+ if (!g || re.test(p)) {
2573
+ s.push(p + ":" + u);
2574
+ return;
2575
+ }
2576
+ if (ce.test(u)) {
2577
+ o = !0;
2578
+ return;
2579
+ }
2580
+ l = !0;
2581
+ const m = g[1], f = g[2];
2582
+ if (f)
2583
+ if (m)
2584
+ i[m][f] = u;
2585
+ else {
2586
+ const b = he(at(u));
2587
+ R.forEach((y, w) => {
2588
+ i[y][f] = b[w];
2589
+ });
2590
+ }
2591
+ else {
2592
+ const b = de(u);
2593
+ (m ? [m] : R.slice()).forEach((y) => {
2594
+ i[y] = { ...b };
2595
+ });
2596
+ }
2597
+ }), o || !l) return;
2598
+ const n = R.map((a) => ue(i[a])), r = s.slice();
2599
+ n.every((a) => a && a === n[0]) ? r.push("border:" + n[0]) : R.forEach((a, d) => n[d] && r.push(`border-${a}:` + n[d])), t.setAttribute("style", r.join(";"));
2600
+ });
2601
+ }
2602
+ function ct(h) {
2498
2603
  let t = "";
2499
- return d.childNodes.forEach((e) => {
2604
+ return h.childNodes.forEach((e) => {
2500
2605
  if (e.nodeType === Node.TEXT_NODE)
2501
2606
  t += e.nodeValue || "";
2502
2607
  else if (e.nodeType === Node.ELEMENT_NODE) {
2503
2608
  const i = e, s = (i.getAttribute("dir") || "").toLowerCase();
2504
2609
  if (s === "rtl" || s === "ltr") return;
2505
- t += ot(i);
2610
+ t += ct(i);
2506
2611
  }
2507
2612
  }), t;
2508
2613
  }
@@ -2522,20 +2627,20 @@ const I = class I {
2522
2627
  statusbar: t.statusbar ?? !0,
2523
2628
  readonly: t.readonly ?? !1,
2524
2629
  draftKey: t.draftKey ?? (typeof location < "u" ? location.pathname : "default"),
2525
- fontFamilyFormats: t.fontFamilyFormats ?? ht,
2630
+ fontFamilyFormats: t.fontFamilyFormats ?? ut,
2526
2631
  imageFileTypes: t.imageFileTypes ?? ["image/jpeg", "image/jpg", "image/png", "image/gif", "image/bmp", "image/webp"],
2527
2632
  videoFileTypes: t.videoFileTypes ?? ["video/mp4", "video/webm", "video/ogg"]
2528
2633
  }, this.imageUploadHandler = t.imageUploadHandler, this.onImageUploadError = t.onImageUploadError, this.videoUploadHandler = t.videoUploadHandler, this.onVideoUploadError = t.onVideoUploadError, this.contentStyle = t.contentStyle, this.applyTheme(t), this.lang = this.options.language, this.draftStorageKey = "tmclone-draft:" + this.options.draftKey, this.initDOM(), this.bindEvents(), this.initUI(), this.recordRevision(), this.stampExistingImages(), this.options.onReady(this);
2529
2634
  }
2530
2635
  t(t) {
2531
- const e = D(this.lang)[t];
2636
+ const e = F(this.lang)[t];
2532
2637
  return typeof e == "string" ? e : e.join(",");
2533
2638
  }
2534
2639
  tArr(t) {
2535
- return D(this.lang)[t];
2640
+ return F(this.lang)[t];
2536
2641
  }
2537
2642
  dir() {
2538
- return D(this.lang).dir;
2643
+ return F(this.lang).dir;
2539
2644
  }
2540
2645
  /* ---------------------------------------------------------- DOM setup */
2541
2646
  initDOM() {
@@ -2548,7 +2653,7 @@ const I = class I {
2548
2653
  </span>
2549
2654
  `, this.sbHelp = this.statusbar.querySelector(".mid"), this.sbWords = this.statusbar.querySelector(".words");
2550
2655
  const e = this.statusbar.querySelector(".grip");
2551
- this.bindGrip(e), this.shell.appendChild(this.menubar), this.shell.appendChild(this.toolbar), this.shell.appendChild(this.ed), this.shell.appendChild(this.statusbar), this.contentStyle && (this.contentStyleEl = document.createElement("style"), this.contentStyleEl.textContent = this.scopeContentStyle(this.contentStyle), this.shell.appendChild(this.contentStyleEl)), t.appendChild(this.shell), Xt(), this.options.statusbar || (this.statusbar.style.display = "none"), this.imgInput = document.createElement("input"), this.imgInput.type = "file", this.imgInput.accept = this.options.imageFileTypes.join(","), this.imgInput.style.display = "none", t.appendChild(this.imgInput), this.vidInput = document.createElement("input"), this.vidInput.type = "file", this.vidInput.accept = this.options.videoFileTypes.join(","), this.vidInput.style.display = "none", t.appendChild(this.vidInput), this.docInput = document.createElement("input"), this.docInput.type = "file", this.docInput.accept = ".docx,application/vnd.openxmlformats-officedocument.wordprocessingml.document", this.docInput.style.display = "none", t.appendChild(this.docInput);
2656
+ this.bindGrip(e), this.shell.appendChild(this.menubar), this.shell.appendChild(this.toolbar), this.shell.appendChild(this.ed), this.shell.appendChild(this.statusbar), this.contentStyle && (this.contentStyleEl = document.createElement("style"), this.contentStyleEl.textContent = this.scopeContentStyle(this.contentStyle), this.shell.appendChild(this.contentStyleEl)), t.appendChild(this.shell), Jt(), this.options.statusbar || (this.statusbar.style.display = "none"), this.imgInput = document.createElement("input"), this.imgInput.type = "file", this.imgInput.accept = this.options.imageFileTypes.join(","), this.imgInput.style.display = "none", t.appendChild(this.imgInput), this.vidInput = document.createElement("input"), this.vidInput.type = "file", this.vidInput.accept = this.options.videoFileTypes.join(","), this.vidInput.style.display = "none", t.appendChild(this.vidInput), this.docInput = document.createElement("input"), this.docInput.type = "file", this.docInput.accept = ".docx,application/vnd.openxmlformats-officedocument.wordprocessingml.document", this.docInput.style.display = "none", t.appendChild(this.docInput);
2552
2657
  }
2553
2658
  /** Theme options land as CSS variables on the document root rather than the editor
2554
2659
  * shell, because dialogs, popups and floating context toolbars are appended to
@@ -2568,12 +2673,12 @@ const I = class I {
2568
2673
  let e = 0, i = 0;
2569
2674
  const s = (l) => {
2570
2675
  e = l.clientY, i = this.ed.offsetHeight, l.preventDefault();
2571
- const n = (r) => {
2676
+ const o = (r) => {
2572
2677
  this.ed.style.height = Math.max(120, i + r.clientY - e) + "px";
2573
- }, o = () => {
2574
- window.removeEventListener("mousemove", n), window.removeEventListener("mouseup", o);
2678
+ }, n = () => {
2679
+ window.removeEventListener("mousemove", o), window.removeEventListener("mouseup", n);
2575
2680
  };
2576
- window.addEventListener("mousemove", n), window.addEventListener("mouseup", o);
2681
+ window.addEventListener("mousemove", o), window.addEventListener("mouseup", n);
2577
2682
  };
2578
2683
  t.addEventListener("mousedown", s), this.listeners.push(() => t.removeEventListener("mousedown", s));
2579
2684
  }
@@ -2591,32 +2696,32 @@ const I = class I {
2591
2696
  }), this.on(this.ed, "keydown", (t) => {
2592
2697
  t.altKey && t.key === "0" && (t.preventDefault(), this.helpDlg()), (t.key === "Delete" || t.key === "Backspace") && this.phActive && (t.preventDefault(), this.removeImgPlaceholder()), (t.key === "Delete" || t.key === "Backspace") && this.vphActive && (t.preventDefault(), this.removeVphPlaceholder()), t.key === "`" && !t.ctrlKey && !t.metaKey && !t.altKey && this.tryCodeTyping(t), t.key === "Enter" && !t.shiftKey && !t.ctrlKey && !t.metaKey && !t.altKey && this.tryExitBlockquote(t);
2593
2698
  }), this.on(this.ed, "paste", (t) => this.handlePaste(t)), this.on(this.ed, "drop", (t) => {
2594
- var l, n, o, r;
2699
+ var l, o, n, r;
2595
2700
  t.preventDefault();
2596
2701
  const e = t.target, i = (l = e.closest) == null ? void 0 : l.call(e, ".img-ph:not(.vid-ph)");
2597
2702
  if (i && this.ed.contains(i) && !this.options.readonly) {
2598
- const a = Array.from(((n = t.dataTransfer) == null ? void 0 : n.files) || []).find((h) => h.type.startsWith("image/"));
2703
+ const a = Array.from(((o = t.dataTransfer) == null ? void 0 : o.files) || []).find((d) => d.type.startsWith("image/"));
2599
2704
  a && this.readImageFileInto(a, i);
2600
2705
  return;
2601
2706
  }
2602
- const s = (o = e.closest) == null ? void 0 : o.call(e, ".vid-ph");
2707
+ const s = (n = e.closest) == null ? void 0 : n.call(e, ".vid-ph");
2603
2708
  if (s && this.ed.contains(s) && !this.options.readonly) {
2604
- const a = Array.from(((r = t.dataTransfer) == null ? void 0 : r.files) || []).find((h) => h.type.startsWith("video/"));
2709
+ const a = Array.from(((r = t.dataTransfer) == null ? void 0 : r.files) || []).find((d) => d.type.startsWith("video/"));
2605
2710
  a && this.readVideoFileInto(a, s);
2606
2711
  }
2607
2712
  }), this.on(this.ed, "dragover", (t) => t.preventDefault()), this.on(this.ed, "mousedown", (t) => {
2608
- var h, p, m, g, u, v, b;
2609
- const e = t.target, i = (h = e.closest) == null ? void 0 : h.call(e, "table");
2713
+ var d, p, u, g, m, f, b;
2714
+ const e = t.target, i = (d = e.closest) == null ? void 0 : d.call(e, "table");
2610
2715
  i && this.ed.contains(i) ? this.selectTableForResize(i) : this.clearTableHandles();
2611
2716
  const s = (p = e.closest) == null ? void 0 : p.call(e, ".img-ph:not(.vid-ph)");
2612
2717
  s && this.ed.contains(s) && !this.options.readonly ? (t.preventDefault(), this.ed.focus(), this.selectImgPlaceholder(s)) : this.clearImgPlaceholderSel();
2613
- const l = (m = e.closest) == null ? void 0 : m.call(e, ".vid-ph");
2718
+ const l = (u = e.closest) == null ? void 0 : u.call(e, ".vid-ph");
2614
2719
  l && this.ed.contains(l) && !this.options.readonly ? (t.preventDefault(), this.ed.focus(), this.selectVphPlaceholder(l)) : this.clearVphPlaceholderSel();
2615
- const n = (g = e.closest) == null ? void 0 : g.call(e, ".tpl");
2616
- n && this.ed.contains(n) && !this.options.readonly ? this.selectTemplate(n) : this.clearTplSel();
2617
- const o = (u = e.closest) == null ? void 0 : u.call(e, "pre.code-block");
2618
- o && this.ed.contains(o) && !this.options.readonly ? (t.preventDefault(), this.selectCodeEl(o)) : this.clearCodeSel();
2619
- const r = (v = e.closest) == null ? void 0 : v.call(e, "img");
2720
+ const o = (g = e.closest) == null ? void 0 : g.call(e, ".tpl");
2721
+ o && this.ed.contains(o) && !this.options.readonly ? this.selectTemplate(o) : this.clearTplSel();
2722
+ const n = (m = e.closest) == null ? void 0 : m.call(e, "pre.code-block");
2723
+ n && this.ed.contains(n) && !this.options.readonly ? (t.preventDefault(), this.selectCodeEl(n)) : this.clearCodeSel();
2724
+ const r = (f = e.closest) == null ? void 0 : f.call(e, "img");
2620
2725
  r && this.ed.contains(r) && !this.options.readonly ? (t.preventDefault(), this.selectImage(r)) : this.clearImageHandles();
2621
2726
  const a = (b = e.closest) == null ? void 0 : b.call(e, "video, .video-embed");
2622
2727
  a && this.ed.contains(a) && !this.options.readonly ? (t.preventDefault(), this.selectVideo(a)) : this.clearVidHandles();
@@ -2626,11 +2731,11 @@ const I = class I {
2626
2731
  const e = (s = (i = t.target).closest) == null ? void 0 : s.call(i, "img");
2627
2732
  e && this.ed.contains(e) && (this.cancelImgHide(), this.selectImage(e));
2628
2733
  }), this.on(this.ed, "mouseout", (t) => {
2629
- var s, l, n, o;
2734
+ var s, l, o, n;
2630
2735
  const e = (l = (s = t.target).closest) == null ? void 0 : l.call(s, "img");
2631
2736
  if (!e) return;
2632
2737
  const i = t.relatedTarget;
2633
- i && ((n = this.imgCtx) != null && n.contains(i) || this.imgHandles.some((r) => r.contains(i)) || ((o = i.closest) == null ? void 0 : o.call(i, "img")) === e) || this.scheduleImgHide();
2738
+ i && ((o = this.imgCtx) != null && o.contains(i) || this.imgHandles.some((r) => r.contains(i)) || ((n = i.closest) == null ? void 0 : n.call(i, "img")) === e) || this.scheduleImgHide();
2634
2739
  }), this.on(this.ed, "scroll", () => {
2635
2740
  this.positionTableHandles(), this.positionImageHandles(), this.positionImgPhCtx(), this.positionTplCtx(), this.positionVphCtx(), this.positionVidCtx(), this.positionCodeCtx();
2636
2741
  }), this.onWin(
@@ -2712,37 +2817,40 @@ const I = class I {
2712
2817
  * content with no strongly-directional character anywhere falls back to the
2713
2818
  * editor's current direction. */
2714
2819
  getContentForEmail() {
2715
- const t = (o, r) => {
2716
- const a = (o.getAttribute("style") || "").trim();
2717
- o.setAttribute("style", a ? a.replace(/;?$/, "; ") + r : r);
2820
+ const t = (n, r) => {
2821
+ const a = (n.getAttribute("style") || "").trim();
2822
+ n.setAttribute("style", a ? a.replace(/;?$/, "; ") + r : r);
2718
2823
  }, e = document.createElement("div");
2719
2824
  e.innerHTML = this.ed.innerHTML;
2720
2825
  let i = null;
2721
- e.querySelectorAll("[dir]").forEach((o) => {
2722
- const r = (o.getAttribute("dir") || "").toLowerCase();
2826
+ e.querySelectorAll("[dir]").forEach((n) => {
2827
+ const r = (n.getAttribute("dir") || "").toLowerCase();
2723
2828
  if (r !== "rtl" && r !== "ltr") return;
2724
2829
  const a = r;
2725
- i || (i = a), /text-align\s*:/i.test(o.getAttribute("style") || "") || t(o, `text-align:${a === "rtl" ? "right" : "left"}`);
2726
- }), e.querySelectorAll(Yt).forEach((o) => {
2727
- const r = (o.getAttribute("dir") || "").toLowerCase();
2830
+ i || (i = a), /text-align\s*:/i.test(n.getAttribute("style") || "") || t(n, `text-align:${a === "rtl" ? "right" : "left"}`);
2831
+ }), e.querySelectorAll(ie).forEach((n) => {
2832
+ const r = (n.getAttribute("dir") || "").toLowerCase();
2728
2833
  if (r === "rtl" || r === "ltr") return;
2729
- const a = Kt(ot(o));
2834
+ const a = se(ct(n));
2730
2835
  if (!a) return;
2731
- i || (i = a), o.setAttribute("dir", a);
2732
- const h = /text-align\s*:/i.test(o.getAttribute("style") || "");
2733
- t(o, h ? `direction:${a}` : `direction:${a};text-align:${a === "rtl" ? "right" : "left"}`);
2836
+ i || (i = a), n.setAttribute("dir", a);
2837
+ const d = /text-align\s*:/i.test(n.getAttribute("style") || "");
2838
+ t(n, d ? `direction:${a}` : `direction:${a};text-align:${a === "rtl" ? "right" : "left"}`);
2734
2839
  });
2735
2840
  const s = this.ed.querySelectorAll("img");
2736
- e.querySelectorAll("img").forEach((o, r) => {
2737
- if (o.closest(".tpl-media")) return;
2738
- const a = s[r], h = Math.round((a == null ? void 0 : a.getBoundingClientRect().width) || 0);
2739
- h > 0 && !o.getAttribute("width") && o.setAttribute("width", String(h));
2740
- const p = o.getAttribute("style") || "";
2741
- h > 0 && !/(^|;)\s*width\s*:/i.test(p) && t(o, `width:${h}px`), /max-width\s*:/i.test(o.getAttribute("style") || "") || t(o, "max-width:100%"), /(^|;)\s*height\s*:/i.test(o.getAttribute("style") || "") || t(o, "height:auto");
2841
+ e.querySelectorAll("img").forEach((n, r) => {
2842
+ if (n.closest(".tpl-media")) return;
2843
+ const a = s[r], d = Math.round((a == null ? void 0 : a.getBoundingClientRect().width) || 0);
2844
+ d > 0 && !n.getAttribute("width") && n.setAttribute("width", String(d));
2845
+ const p = n.getAttribute("style") || "";
2846
+ d > 0 && !/(^|;)\s*width\s*:/i.test(p) && t(n, `width:${d}px`), /max-width\s*:/i.test(n.getAttribute("style") || "") || t(n, "max-width:100%"), /(^|;)\s*height\s*:/i.test(n.getAttribute("style") || "") || t(n, "height:auto");
2847
+ }), me(e), e.querySelectorAll("table").forEach((n) => {
2848
+ const r = n.getAttribute("style") || "";
2849
+ /border-collapse\s*:/i.test(r) || t(n, "border-collapse:collapse"), !/border-spacing\s*:/i.test(r) && !n.hasAttribute("cellspacing") && n.setAttribute("cellspacing", "0");
2742
2850
  });
2743
2851
  const l = i || this.ed.getAttribute("dir") || this.dir();
2744
- return e.querySelectorAll("table:not([dir])").forEach((o) => {
2745
- o.setAttribute("dir", l), /direction\s*:/i.test(o.getAttribute("style") || "") || t(o, `direction:${l}`);
2852
+ return e.querySelectorAll("table:not([dir])").forEach((n) => {
2853
+ n.setAttribute("dir", l), /direction\s*:/i.test(n.getAttribute("style") || "") || t(n, `direction:${l}`);
2746
2854
  }), `<div dir="${l}" style="direction:${l};text-align:${l === "rtl" ? "right" : "left"}">${e.innerHTML}</div>`;
2747
2855
  }
2748
2856
  setContent(t) {
@@ -2758,7 +2866,7 @@ const I = class I {
2758
2866
  this.ed.focus();
2759
2867
  }
2760
2868
  async importWordFile(t) {
2761
- const e = await zt(t);
2869
+ const e = await Xt(t);
2762
2870
  this.recordRevision(), this.setContent(e), this.recordRevision();
2763
2871
  }
2764
2872
  restoreDraft() {
@@ -2817,8 +2925,8 @@ const I = class I {
2817
2925
  t.preventDefault();
2818
2926
  const l = document.createElement("p");
2819
2927
  l.appendChild(document.createElement("br")), s.after(l), i.remove(), s.firstElementChild || s.remove();
2820
- const n = document.createRange();
2821
- n.setStart(l, 0), n.collapse(!0), e.removeAllRanges(), e.addRange(n), this.saveSel(), this.onChange();
2928
+ const o = document.createRange();
2929
+ o.setStart(l, 0), o.collapse(!0), e.removeAllRanges(), e.addRange(o), this.saveSel(), this.onChange();
2822
2930
  }
2823
2931
  selectedBlocks() {
2824
2932
  const t = window.getSelection();
@@ -2868,30 +2976,30 @@ const I = class I {
2868
2976
  s.className = "revprev";
2869
2977
  const l = document.createElement("button");
2870
2978
  l.type = "button", l.className = "revrestore", l.textContent = this.t("restore");
2871
- let n = this.revisions.length - 1;
2872
- const o = new Intl.DateTimeFormat(this.lang === "ar" ? "ar-AE" : "en-GB", {
2979
+ let o = this.revisions.length - 1;
2980
+ const n = new Intl.DateTimeFormat(this.lang === "ar" ? "ar-AE" : "en-GB", {
2873
2981
  year: "numeric",
2874
2982
  month: "short",
2875
2983
  day: "numeric",
2876
2984
  hour: "2-digit",
2877
2985
  minute: "2-digit",
2878
2986
  second: "2-digit"
2879
- }), r = {}, a = (h) => {
2880
- n = h, this.revisions.forEach((p, m) => {
2987
+ }), r = {}, a = (d) => {
2988
+ o = d, this.revisions.forEach((p, u) => {
2881
2989
  var g;
2882
- return (g = r[m]) == null ? void 0 : g.classList.toggle("on", m === h);
2883
- }), s.innerHTML = this.revisions[h].html, l.disabled = h === this.revisions.length - 1;
2990
+ return (g = r[u]) == null ? void 0 : g.classList.toggle("on", u === d);
2991
+ }), s.innerHTML = this.revisions[d].html, l.disabled = d === this.revisions.length - 1;
2884
2992
  };
2885
- for (let h = this.revisions.length - 1; h >= 0; h--) {
2886
- const p = this.revisions[h], m = document.createElement("button");
2887
- m.type = "button";
2888
- const g = (new DOMParser().parseFromString(p.html, "text/html").body.textContent || "").trim(), u = g ? g.split(/\s+/).length : 0, v = h === this.revisions.length - 1;
2889
- m.innerHTML = `<span>${v ? this.t("currentver") : o.format(new Date(p.time))}</span><span class="wc">${u} ${this.t("words")}</span>`, m.addEventListener("click", () => a(h)), r[h] = m, i.appendChild(m);
2993
+ for (let d = this.revisions.length - 1; d >= 0; d--) {
2994
+ const p = this.revisions[d], u = document.createElement("button");
2995
+ u.type = "button";
2996
+ const g = (new DOMParser().parseFromString(p.html, "text/html").body.textContent || "").trim(), m = g ? g.split(/\s+/).length : 0, f = d === this.revisions.length - 1;
2997
+ u.innerHTML = `<span>${f ? this.t("currentver") : n.format(new Date(p.time))}</span><span class="wc">${m} ${this.t("words")}</span>`, u.addEventListener("click", () => a(d)), r[d] = u, i.appendChild(u);
2890
2998
  }
2891
2999
  i.append(l), l.addEventListener("click", () => {
2892
- const h = this.revisions[n];
2893
- h && (this.recordRevision(), this.setContent(h.html), this.recordRevision(), this.closeDlg());
2894
- }), e.append(i, s), t.appendChild(e), a(n);
3000
+ const d = this.revisions[o];
3001
+ d && (this.recordRevision(), this.setContent(d.html), this.recordRevision(), this.closeDlg());
3002
+ }), e.append(i, s), t.appendChild(e), a(o);
2895
3003
  });
2896
3004
  }
2897
3005
  /* ---------------------------------------------------------- popups / menus */
@@ -2928,10 +3036,10 @@ const I = class I {
2928
3036
  l.className = "pop sub", l.dir = this.dir(), t.subBuild ? t.subBuild(l) : t.sub && this.menuItems(l, t.sub), l.addEventListener("mousedown", (a) => {
2929
3037
  a.target.tagName !== "INPUT" && a.preventDefault();
2930
3038
  }), document.body.appendChild(l);
2931
- let o = this.dir() === "rtl" ? i.left - l.offsetWidth + 2 : i.right - 2;
2932
- o = Math.max(8, Math.min(o + scrollX, scrollX + innerWidth - l.offsetWidth - 8));
3039
+ let n = this.dir() === "rtl" ? i.left - l.offsetWidth + 2 : i.right - 2;
3040
+ n = Math.max(8, Math.min(n + scrollX, scrollX + innerWidth - l.offsetWidth - 8));
2933
3041
  let r = i.top + scrollY - 6;
2934
- r = Math.max(8 + scrollY, Math.min(r, scrollY + innerHeight - l.offsetHeight - 8)), l.style.left = o + "px", l.style.top = r + "px", this.subStack.push(l);
3042
+ r = Math.max(8 + scrollY, Math.min(r, scrollY + innerHeight - l.offsetHeight - 8)), l.style.left = n + "px", l.style.top = r + "px", this.subStack.push(l);
2935
3043
  }
2936
3044
  popup(t, e, i) {
2937
3045
  if (this.openPop && this.popAnchor === t) {
@@ -2943,8 +3051,8 @@ const I = class I {
2943
3051
  s.className = "pop" + (i ? " " + i : ""), s.dir = this.dir(), e(s), document.body.appendChild(s);
2944
3052
  const l = t.getBoundingClientRect();
2945
3053
  s.style.minWidth = Math.max(160, Math.round(l.width)) + "px";
2946
- let n = l.bottom + scrollY + 2;
2947
- n = Math.max(8 + scrollY, Math.min(n, scrollY + innerHeight - s.offsetHeight - 8)), s.style.top = n + "px";
3054
+ let o = l.bottom + scrollY + 2;
3055
+ o = Math.max(8 + scrollY, Math.min(o, scrollY + innerHeight - s.offsetHeight - 8)), s.style.top = o + "px";
2948
3056
  let r = this.dir() === "rtl" ? l.right - s.offsetWidth : l.left;
2949
3057
  r = Math.max(8, Math.min(r + scrollX, scrollX + innerWidth - s.offsetWidth - 8)), s.style.left = r + "px", s.addEventListener("mousedown", (a) => {
2950
3058
  a.target.tagName !== "INPUT" && a.preventDefault();
@@ -2960,18 +3068,18 @@ const I = class I {
2960
3068
  l.className = "mi" + (i.on ? " on" : ""), l.innerHTML = `<span class="ic">${i.icon || ""}</span><span class="prev" ${i.previewStyle ? `style="${i.previewStyle}"` : ""}>${i.label}</span>${i.shortcut ? `<span class="sc">${i.shortcut}</span>` : ""}${s ? `<span class="subarrow">${c.chev}</span>` : ""}`, l.addEventListener("click", () => {
2961
3069
  i.action && (this.closePop(), i.action());
2962
3070
  }), l.addEventListener("mouseenter", () => {
2963
- var n;
2964
- s ? this.openSubFor(i, l) : this.closeSubFrom(this.subLevelOf(t)), (n = i.hover) == null || n.call(i, !0);
3071
+ var o;
3072
+ s ? this.openSubFor(i, l) : this.closeSubFrom(this.subLevelOf(t)), (o = i.hover) == null || o.call(i, !0);
2965
3073
  }), l.addEventListener("mouseleave", () => {
2966
- var n;
2967
- return (n = i.hover) == null ? void 0 : n.call(i, !1);
3074
+ var o;
3075
+ return (o = i.hover) == null ? void 0 : o.call(i, !1);
2968
3076
  }), t.appendChild(l);
2969
3077
  });
2970
3078
  }
2971
3079
  /* ---------------------------------------------------------- toolbar builders */
2972
3080
  tbtn(t, e, i, s) {
2973
3081
  const l = document.createElement("button");
2974
- return l.className = "tbtn", l.type = "button", l.title = e, l.innerHTML = t, s && (l.dataset.id = s), l.addEventListener("mousedown", (n) => n.preventDefault()), l.addEventListener("click", i), l;
3082
+ return l.className = "tbtn", l.type = "button", l.title = e, l.innerHTML = t, s && (l.dataset.id = s), l.addEventListener("mousedown", (o) => o.preventDefault()), l.addEventListener("click", i), l;
2975
3083
  }
2976
3084
  /** Font-size increase / decrease step button. */
2977
3085
  stepBtn(t) {
@@ -2987,10 +3095,10 @@ const I = class I {
2987
3095
  colorChips() {
2988
3096
  const t = (s) => {
2989
3097
  const l = document.createElement("button");
2990
- return l.type = "button", l.className = "cchip", l.title = s, l.addEventListener("mousedown", (n) => {
2991
- n.preventDefault(), this.saveSel();
3098
+ return l.type = "button", l.className = "cchip", l.title = s, l.addEventListener("mousedown", (o) => {
3099
+ o.preventDefault(), this.saveSel();
2992
3100
  }), l;
2993
- }, e = ut.map((s) => {
3101
+ }, e = vt.map((s) => {
2994
3102
  const l = t(this.t("forecolor"));
2995
3103
  return l.style.background = s, l.addEventListener("click", () => this.applyColor("fore", s)), l;
2996
3104
  }), i = t(this.t("forecolor"));
@@ -3004,17 +3112,17 @@ const I = class I {
3004
3112
  }
3005
3113
  tsel(t, e, i, s) {
3006
3114
  const l = document.createElement("button");
3007
- return l.className = "tsel " + t, l.type = "button", l.dataset.id = e, l.innerHTML = `<span class="lbl empty">${i || ""}</span>${c.chev}`, l.addEventListener("mousedown", (n) => {
3008
- n.preventDefault(), this.saveSel();
3115
+ return l.className = "tsel " + t, l.type = "button", l.dataset.id = e, l.innerHTML = `<span class="lbl empty">${i || ""}</span>${c.chev}`, l.addEventListener("mousedown", (o) => {
3116
+ o.preventDefault(), this.saveSel();
3009
3117
  }), l.addEventListener("click", () => s(l)), l;
3010
3118
  }
3011
3119
  setListStyle(t, e) {
3012
- var l, n;
3120
+ var l, o;
3013
3121
  this.restoreSel();
3014
3122
  const i = window.getSelection();
3015
3123
  if (!i) return;
3016
3124
  let s = (l = this.closestBlock(i.anchorNode)) == null ? void 0 : l.closest(t);
3017
- s || (this.exec(t === "ol" ? "insertOrderedList" : "insertUnorderedList"), s = (n = this.closestBlock(i.anchorNode)) == null ? void 0 : n.closest(t)), s && (s.style.listStyleType = e), this.saveSel(), this.onChange();
3125
+ s || (this.exec(t === "ol" ? "insertOrderedList" : "insertUnorderedList"), s = (o = this.closestBlock(i.anchorNode)) == null ? void 0 : o.closest(t)), s && (s.style.listStyleType = e), this.saveSel(), this.onChange();
3018
3126
  }
3019
3127
  listMenu(t, e) {
3020
3128
  var a;
@@ -3026,23 +3134,23 @@ const I = class I {
3026
3134
  ] : [
3027
3135
  ["circle", c.ul_circle],
3028
3136
  ["square", c.ul_square]
3029
- ], l = this.tArr(e === "ol" ? "liststyles_ol" : "liststyles_ul").slice(1), n = window.getSelection(), o = n ? (a = this.closestBlock(n.anchorNode)) == null ? void 0 : a.closest(e) : null, r = o ? o.style.listStyleType : "";
3030
- this.popup(t, (h) => {
3031
- this.menuItems(h, [
3137
+ ], l = this.tArr(e === "ol" ? "liststyles_ol" : "liststyles_ul").slice(1), o = window.getSelection(), n = o ? (a = this.closestBlock(o.anchorNode)) == null ? void 0 : a.closest(e) : null, r = n ? n.style.listStyleType : "";
3138
+ this.popup(t, (d) => {
3139
+ this.menuItems(d, [
3032
3140
  {
3033
3141
  label: this.t(e === "ol" ? "numlist" : "bullist"),
3034
3142
  icon: e === "ol" ? c.numlist : c.bullist,
3035
3143
  on: document.queryCommandState(i),
3036
3144
  action: () => this.exec(i)
3037
3145
  }
3038
- ]), h.insertAdjacentHTML("beforeend", '<div class="sep"></div>');
3146
+ ]), d.insertAdjacentHTML("beforeend", '<div class="sep"></div>');
3039
3147
  const p = document.createElement("div");
3040
- p.className = "mi-grid", s.forEach(([m, g], u) => {
3041
- const v = document.createElement("button");
3042
- v.className = "mi" + (r === m ? " on" : ""), v.innerHTML = `<span class="ic">${g}</span><span class="prev">${l[u]}</span>`, v.addEventListener("click", () => {
3043
- this.closePop(), this.setListStyle(e, m);
3044
- }), p.appendChild(v);
3045
- }), h.appendChild(p);
3148
+ p.className = "mi-grid", s.forEach(([u, g], m) => {
3149
+ const f = document.createElement("button");
3150
+ f.className = "mi" + (r === u ? " on" : ""), f.innerHTML = `<span class="ic">${g}</span><span class="prev">${l[m]}</span>`, f.addEventListener("click", () => {
3151
+ this.closePop(), this.setListStyle(e, u);
3152
+ }), p.appendChild(f);
3153
+ }), d.appendChild(p);
3046
3154
  });
3047
3155
  }
3048
3156
  /** Shared color-picker popup body — swatch grid plus the current-color /
@@ -3050,26 +3158,26 @@ const I = class I {
3050
3158
  * table cell-background menu all show the identical popup. */
3051
3159
  buildPaletteInto(t, e, i) {
3052
3160
  const s = document.createElement("div");
3053
- s.className = "cpal", gt.forEach((p) => {
3054
- const m = document.createElement("button");
3055
- m.type = "button", m.style.background = p, m.title = p, m.addEventListener("click", () => {
3161
+ s.className = "cpal", bt.forEach((p) => {
3162
+ const u = document.createElement("button");
3163
+ u.type = "button", u.style.background = p, u.title = p, u.addEventListener("click", () => {
3056
3164
  this.closePop(), i(p);
3057
- }), s.appendChild(m);
3165
+ }), s.appendChild(u);
3058
3166
  }), t.appendChild(s), t.insertAdjacentHTML("beforeend", '<div class="sep"></div>');
3059
3167
  const l = document.createElement("div");
3060
3168
  l.className = "cfoot";
3061
- const n = /^#[0-9a-f]{6}$/i.test(e) ? e : "#000000", o = document.createElement("div");
3062
- o.className = "cswatch cur", o.title = this.t("currentcolor"), o.style.background = n, o.innerHTML = c.check;
3169
+ const o = /^#[0-9a-f]{6}$/i.test(e) ? e : "#000000", n = document.createElement("div");
3170
+ n.className = "cswatch cur", n.title = this.t("currentcolor"), n.style.background = o, n.innerHTML = c.check;
3063
3171
  const r = document.createElement("button");
3064
3172
  r.type = "button", r.className = "cswatch nocolor", r.title = this.t("removecolor"), r.addEventListener("click", () => {
3065
3173
  this.closePop(), i(null);
3066
3174
  });
3067
3175
  const a = document.createElement("label");
3068
3176
  a.className = "cswatch cwheel", a.title = this.t("customcolor"), a.innerHTML = c.palette;
3069
- const h = document.createElement("input");
3070
- h.type = "color", h.value = n, h.addEventListener("change", () => {
3071
- this.closePop(), i(h.value);
3072
- }), a.appendChild(h), l.append(o, r, a), t.appendChild(l);
3177
+ const d = document.createElement("input");
3178
+ d.type = "color", d.value = o, d.addEventListener("change", () => {
3179
+ this.closePop(), i(d.value);
3180
+ }), a.appendChild(d), l.append(n, r, a), t.appendChild(l);
3073
3181
  }
3074
3182
  colorMenu(t, e) {
3075
3183
  this.popup(
@@ -3099,7 +3207,7 @@ const I = class I {
3099
3207
  this.popup(t, (e) => this.menuItems(e, this.fontItems()));
3100
3208
  }
3101
3209
  sizeItems() {
3102
- return dt.map((t) => ({
3210
+ return mt.map((t) => ({
3103
3211
  label: t,
3104
3212
  on: this.currentSize() === t,
3105
3213
  action: () => this.applyFontSize(t)
@@ -3115,19 +3223,19 @@ const I = class I {
3115
3223
  const t = window.getSelection();
3116
3224
  if (!t) return;
3117
3225
  if (!t.rangeCount) {
3118
- const n = document.createRange();
3119
- n.selectNodeContents(this.ed), n.collapse(!0), t.addRange(n);
3226
+ const o = document.createRange();
3227
+ o.selectNodeContents(this.ed), o.collapse(!0), t.addRange(o);
3120
3228
  }
3121
3229
  if (!t.isCollapsed) return;
3122
3230
  const e = t.getRangeAt(0), i = e.startContainer;
3123
3231
  if (i.nodeType === 3) {
3124
- const n = i.data;
3125
- let o = e.startOffset, r = e.startOffset;
3126
- for (; o > 0 && /\S/.test(n[o - 1]); ) o--;
3127
- for (; r < n.length && /\S/.test(n[r]); ) r++;
3128
- if (r > o) {
3232
+ const o = i.data;
3233
+ let n = e.startOffset, r = e.startOffset;
3234
+ for (; n > 0 && /\S/.test(o[n - 1]); ) n--;
3235
+ for (; r < o.length && /\S/.test(o[r]); ) r++;
3236
+ if (r > n) {
3129
3237
  const a = document.createRange();
3130
- a.setStart(i, o), a.setEnd(i, r), t.removeAllRanges(), t.addRange(a), this.savedRange = a.cloneRange();
3238
+ a.setStart(i, n), a.setEnd(i, r), t.removeAllRanges(), t.addRange(a), this.savedRange = a.cloneRange();
3131
3239
  return;
3132
3240
  }
3133
3241
  }
@@ -3152,7 +3260,7 @@ const I = class I {
3152
3260
  this.saveSel(), this.refreshState(), this.onChange();
3153
3261
  }
3154
3262
  stepFontSize(t) {
3155
- const e = parseInt(this.currentSize(), 10) || 14, i = Math.min(mt, Math.max(pt, e + t));
3263
+ const e = parseInt(this.currentSize(), 10) || 14, i = Math.min(ft, Math.max(gt, e + t));
3156
3264
  i !== e && this.applyFontSize(i + "px");
3157
3265
  }
3158
3266
  /* ------------------------------------------------ case / spacing / link */
@@ -3161,14 +3269,14 @@ const I = class I {
3161
3269
  const e = window.getSelection();
3162
3270
  if (!e || !e.rangeCount || e.isCollapsed) return;
3163
3271
  const i = e.getRangeAt(0), s = document.createTreeWalker(this.ed, NodeFilter.SHOW_TEXT), l = [];
3164
- let n;
3165
- for (; n = s.nextNode(); ) i.intersectsNode(n) && l.push(n);
3166
- l.forEach((o) => {
3167
- const r = o === i.startContainer ? i.startOffset : 0, a = o === i.endContainer ? i.endOffset : o.data.length;
3272
+ let o;
3273
+ for (; o = s.nextNode(); ) i.intersectsNode(o) && l.push(o);
3274
+ l.forEach((n) => {
3275
+ const r = n === i.startContainer ? i.startOffset : 0, a = n === i.endContainer ? i.endOffset : n.data.length;
3168
3276
  if (a <= r) return;
3169
- const h = o.data.slice(r, a);
3170
- let p = h;
3171
- t === "lower" ? p = h.toLowerCase() : t === "upper" ? p = h.toUpperCase() : p = h.replace(/(^|\s)(\S)/g, (m, g, u) => g + u.toUpperCase()), o.replaceData(r, a - r, p);
3277
+ const d = n.data.slice(r, a);
3278
+ let p = d;
3279
+ t === "lower" ? p = d.toLowerCase() : t === "upper" ? p = d.toUpperCase() : p = d.replace(/(^|\s)(\S)/g, (u, g, m) => g + m.toUpperCase()), n.replaceData(r, a - r, p);
3172
3280
  }), this.saveSel(), this.refreshState(), this.onChange();
3173
3281
  }
3174
3282
  caseItems() {
@@ -3204,10 +3312,10 @@ const I = class I {
3204
3312
  ];
3205
3313
  }
3206
3314
  lineHeightMenu(t) {
3207
- this.popup(t, (e) => this.menuItems(e, this.blockStyleItems("lineHeight", U)));
3315
+ this.popup(t, (e) => this.menuItems(e, this.blockStyleItems("lineHeight", W)));
3208
3316
  }
3209
3317
  wordSpacingMenu(t) {
3210
- this.popup(t, (e) => this.menuItems(e, this.blockStyleItems("wordSpacing", W)));
3318
+ this.popup(t, (e) => this.menuItems(e, this.blockStyleItems("wordSpacing", V)));
3211
3319
  }
3212
3320
  letterSpacingMenu(t) {
3213
3321
  this.popup(t, (e) => this.menuItems(e, this.blockStyleItems("letterSpacing", j)));
@@ -3256,14 +3364,14 @@ const I = class I {
3256
3364
  (s) => {
3257
3365
  const l = document.createElement("div");
3258
3366
  l.style.cssText = "display:flex;align-items:center;gap:10px;margin:10px 0;min-width:360px";
3259
- const n = document.createElement("span");
3260
- n.style.cssText = "width:60px;color:#556;flex:none", n.textContent = this.t("linkurl"), e = document.createElement("input"), e.type = "url", e.placeholder = "https://", e.style.cssText = "flex:1;border:1px solid #cfd6df;border-radius:6px;padding:7px 9px;font:14px inherit", e.value = (t == null ? void 0 : t.getAttribute("href")) || "", l.append(n, e), s.appendChild(l), setTimeout(() => e.focus(), 0);
3367
+ const o = document.createElement("span");
3368
+ o.style.cssText = "width:60px;color:#556;flex:none", o.textContent = this.t("linkurl"), e = document.createElement("input"), e.type = "url", e.placeholder = "https://", e.style.cssText = "flex:1;border:1px solid #cfd6df;border-radius:6px;padding:7px 9px;font:14px inherit", e.value = (t == null ? void 0 : t.getAttribute("href")) || "", l.append(o, e), s.appendChild(l), setTimeout(() => e.focus(), 0);
3261
3369
  },
3262
3370
  i
3263
3371
  );
3264
3372
  }
3265
3373
  blockItems() {
3266
- return X.map(([t]) => ({
3374
+ return Q.map(([t]) => ({
3267
3375
  label: this.blockLabel(t),
3268
3376
  previewStyle: t.startsWith("h") ? `font-weight:700;font-size:${22 - 2 * +t[1]}px` : t === "pre" ? "font-family:monospace" : "",
3269
3377
  on: this.currentBlock() === t,
@@ -3300,15 +3408,15 @@ const I = class I {
3300
3408
  s.className = "tgrid";
3301
3409
  const l = document.createElement("div");
3302
3410
  l.className = "tgridlbl", l.textContent = "1 × 1";
3303
- const n = [];
3304
- for (let o = 0; o < 8; o++)
3411
+ const o = [];
3412
+ for (let n = 0; n < 8; n++)
3305
3413
  for (let r = 0; r < 10; r++) {
3306
3414
  const a = document.createElement("span");
3307
- a.dataset.r = String(o), a.dataset.c = String(r), a.addEventListener("mouseenter", () => {
3308
- n.forEach((h) => h.classList.toggle("hot", +h.dataset.r <= o && +h.dataset.c <= r)), l.textContent = r + 1 + " × " + (o + 1);
3415
+ a.dataset.r = String(n), a.dataset.c = String(r), a.addEventListener("mouseenter", () => {
3416
+ o.forEach((d) => d.classList.toggle("hot", +d.dataset.r <= n && +d.dataset.c <= r)), l.textContent = r + 1 + " × " + (n + 1);
3309
3417
  }), a.addEventListener("click", () => {
3310
- this.closePop(), this.insertTable(o + 1, r + 1), e == null || e();
3311
- }), n.push(a), s.appendChild(a);
3418
+ this.closePop(), this.insertTable(n + 1, r + 1), e == null || e();
3419
+ }), o.push(a), s.appendChild(a);
3312
3420
  }
3313
3421
  i.append(s, l), t.appendChild(i);
3314
3422
  }
@@ -3393,17 +3501,17 @@ const I = class I {
3393
3501
  }
3394
3502
  buildToolbar() {
3395
3503
  this.toolbar.innerHTML = "";
3396
- const t = this.options.toolbar === !0 ? at : this.options.toolbar, e = this.buildToolbarRegistry();
3504
+ const t = this.options.toolbar === !0 ? dt : this.options.toolbar, e = this.buildToolbarRegistry();
3397
3505
  this.parseToolbarString(t).forEach((i) => {
3398
3506
  const s = [];
3399
3507
  i.forEach((l) => {
3400
- const n = e[l];
3401
- if (!n) {
3508
+ const o = e[l];
3509
+ if (!o) {
3402
3510
  console.warn(`FableEditor: unknown toolbar item "${l}"`);
3403
3511
  return;
3404
3512
  }
3405
- const o = n();
3406
- Array.isArray(o) ? s.push(...o) : s.push(o);
3513
+ const n = o();
3514
+ Array.isArray(n) ? s.push(...n) : s.push(n);
3407
3515
  }), s.length && this.toolbar.appendChild(this.group(...s));
3408
3516
  }), this.tbrMore = this.tbtn(c.more, this.t("more"), () => {
3409
3517
  this.tbrExpanded = !this.tbrExpanded, this.updateToolbarOverflow();
@@ -3503,8 +3611,8 @@ const I = class I {
3503
3611
  { label: this.t("fontsize"), subBuild: (s) => this.menuItems(s, this.sizeItems()) },
3504
3612
  { label: this.t("blocks"), subBuild: (s) => this.menuItems(s, this.blockItems()) },
3505
3613
  { label: this.t("align"), subBuild: (s) => this.menuItems(s, this.alignItems()) },
3506
- { label: this.t("lineheight"), icon: c.lineheight, subBuild: (s) => this.menuItems(s, this.blockStyleItems("lineHeight", U)) },
3507
- { label: this.t("wordspacing"), icon: c.wordspacing, subBuild: (s) => this.menuItems(s, this.blockStyleItems("wordSpacing", W)) },
3614
+ { label: this.t("lineheight"), icon: c.lineheight, subBuild: (s) => this.menuItems(s, this.blockStyleItems("lineHeight", W)) },
3615
+ { label: this.t("wordspacing"), icon: c.wordspacing, subBuild: (s) => this.menuItems(s, this.blockStyleItems("wordSpacing", V)) },
3508
3616
  { label: this.t("letterspacing"), icon: c.letterspacing, subBuild: (s) => this.menuItems(s, this.blockStyleItems("letterSpacing", j)) },
3509
3617
  "|",
3510
3618
  { label: this.t("forecolor"), icon: c.palette, subBuild: (s) => this.buildPaletteInto(s, this.foreColor, (l) => this.applyColor("fore", l)) },
@@ -3575,7 +3683,7 @@ const I = class I {
3575
3683
  { label: this.t("deltable"), icon: c.trash, action: () => this.tableOp("deltable") }
3576
3684
  ],
3577
3685
  help: [this.mItem("helpttl", c.helpic, () => this.helpDlg(), "Alt+0")]
3578
- }, e = this.options.menubar === !0 ? ct : this.options.menubar, i = /* @__PURE__ */ new Set();
3686
+ }, e = this.options.menubar === !0 ? pt : this.options.menubar, i = /* @__PURE__ */ new Set();
3579
3687
  e.split(/\s+/).filter(Boolean).forEach((s) => {
3580
3688
  if (i.has(s)) return;
3581
3689
  if (i.add(s), !t[s]) {
@@ -3583,36 +3691,36 @@ const I = class I {
3583
3691
  return;
3584
3692
  }
3585
3693
  const l = document.createElement("button");
3586
- l.type = "button", l.textContent = this.t(s), l.dataset.menuKey = s, l.addEventListener("mousedown", (n) => {
3587
- n.preventDefault(), this.saveSel();
3588
- }), l.addEventListener("click", () => this.popup(l, (n) => this.menuItems(n, t[s]))), this.menubar.appendChild(l);
3694
+ l.type = "button", l.textContent = this.t(s), l.dataset.menuKey = s, l.addEventListener("mousedown", (o) => {
3695
+ o.preventDefault(), this.saveSel();
3696
+ }), l.addEventListener("click", () => this.popup(l, (o) => this.menuItems(o, t[s]))), this.menubar.appendChild(l);
3589
3697
  });
3590
3698
  }
3591
3699
  /* ---------------------------------------------------------- table ops */
3592
3700
  tableOp(t) {
3593
- var r, a, h;
3701
+ var r, a, d;
3594
3702
  this.restoreSel();
3595
3703
  const e = window.getSelection();
3596
3704
  if (!e) return;
3597
- const i = ((r = this.closestBlock(e.anchorNode)) == null ? void 0 : r.closest("td,th")) || (e.anchorNode && e.anchorNode.nodeType === 1 ? (h = (a = e.anchorNode).closest) == null ? void 0 : h.call(a, "td,th") : null);
3705
+ const i = ((r = this.closestBlock(e.anchorNode)) == null ? void 0 : r.closest("td,th")) || (e.anchorNode && e.anchorNode.nodeType === 1 ? (d = (a = e.anchorNode).closest) == null ? void 0 : d.call(a, "td,th") : null);
3598
3706
  if (!i) return;
3599
- const s = i.parentElement, l = i.closest("table"), n = Array.from(s.children).indexOf(i), o = () => {
3707
+ const s = i.parentElement, l = i.closest("table"), o = Array.from(s.children).indexOf(i), n = () => {
3600
3708
  const p = s.cloneNode(!1);
3601
- return Array.from(s.children).forEach((m) => {
3602
- const g = document.createElement("td"), u = m.getAttribute("style");
3603
- u && g.setAttribute("style", u), g.style.removeProperty("background-color"), g.innerHTML = "<br>", p.appendChild(g);
3709
+ return Array.from(s.children).forEach((u) => {
3710
+ const g = document.createElement("td"), m = u.getAttribute("style");
3711
+ m && g.setAttribute("style", m), g.style.removeProperty("background-color"), g.innerHTML = "<br>", p.appendChild(g);
3604
3712
  }), p;
3605
3713
  };
3606
- if (t === "rowabove" && s.before(o()), t === "rowbelow" && s.after(o()), t === "delrow") {
3714
+ if (t === "rowabove" && s.before(n()), t === "rowbelow" && s.after(n()), t === "delrow") {
3607
3715
  const p = s.parentElement;
3608
3716
  s.remove(), p.querySelector("tr") || l.remove();
3609
3717
  }
3610
3718
  (t === "colbefore" || t === "colafter") && l.querySelectorAll("tr").forEach((p) => {
3611
- const m = p.children[Math.min(n, p.children.length - 1)], g = document.createElement("td"), u = m.getAttribute("style");
3612
- u && g.setAttribute("style", u), g.style.removeProperty("width"), g.style.removeProperty("background-color"), g.innerHTML = "<br>", t === "colbefore" ? m.before(g) : m.after(g);
3719
+ const u = p.children[Math.min(o, p.children.length - 1)], g = document.createElement("td"), m = u.getAttribute("style");
3720
+ m && g.setAttribute("style", m), g.style.removeProperty("width"), g.style.removeProperty("background-color"), g.innerHTML = "<br>", t === "colbefore" ? u.before(g) : u.after(g);
3613
3721
  }), t === "delcol" && (l.querySelectorAll("tr").forEach((p) => {
3614
- var m;
3615
- return (m = p.children[n]) == null ? void 0 : m.remove();
3722
+ var u;
3723
+ return (u = p.children[o]) == null ? void 0 : u.remove();
3616
3724
  }), l.querySelector("td,th") || l.remove()), t === "deltable" && l.remove(), this.onChange(), this.positionTableHandles();
3617
3725
  }
3618
3726
  /** Reorders the current row/column: 'rowup'/'rowdown' swap the caret's row with
@@ -3632,16 +3740,16 @@ const I = class I {
3632
3740
  r && r.after(i);
3633
3741
  }
3634
3742
  t === "colleft" && l > 0 && s.querySelectorAll("tr").forEach((r) => {
3635
- const a = r.children[l], h = r.children[l - 1];
3636
- a && h && h.before(a);
3743
+ const a = r.children[l], d = r.children[l - 1];
3744
+ a && d && d.before(a);
3637
3745
  }), t === "colright" && s.querySelectorAll("tr").forEach((r) => {
3638
- const a = r.children[l], h = r.children[l + 1];
3639
- a && h && h.after(a);
3746
+ const a = r.children[l], d = r.children[l + 1];
3747
+ a && d && d.after(a);
3640
3748
  });
3641
- const n = document.createRange();
3642
- n.selectNodeContents(e), n.collapse(!0);
3643
- const o = window.getSelection();
3644
- o && (o.removeAllRanges(), o.addRange(n)), this.saveSel(), this.onChange(), this.positionTableHandles(), this.positionCellMarker();
3749
+ const o = document.createRange();
3750
+ o.selectNodeContents(e), o.collapse(!0);
3751
+ const n = window.getSelection();
3752
+ n && (n.removeAllRanges(), n.addRange(o)), this.saveSel(), this.onChange(), this.positionTableHandles(), this.positionCellMarker();
3645
3753
  }
3646
3754
  /** Align the whole table via auto margins — same semantics as the align
3647
3755
  * field in the table-properties dialog. */
@@ -3678,26 +3786,26 @@ const I = class I {
3678
3786
  tablePropsDlg() {
3679
3787
  const t = this.tblActive;
3680
3788
  if (!t) return;
3681
- let e, i, s, l, n;
3682
- const o = "display:flex;align-items:center;gap:10px;margin:10px 0", r = "width:120px;color:#556;flex:none", a = "flex:1;border:1px solid #cfd6df;border-radius:6px;padding:7px 9px;font:14px inherit", h = t.querySelector("td,th"), p = t.style.width || "", m = h && h.style.padding ? parseFloat(h.style.padding) : "", g = t.style.borderSpacing ? parseFloat(t.style.borderSpacing) : "", u = t.style.borderWidth ? parseFloat(t.style.borderWidth) : "", v = t.style.marginLeft, b = t.style.marginRight, x = v === "auto" && b === "auto" ? "center" : v === "auto" ? "right" : b === "auto" && v === "0" ? "left" : "";
3789
+ let e, i, s, l, o;
3790
+ const n = "display:flex;align-items:center;gap:10px;margin:10px 0", r = "width:120px;color:#556;flex:none", a = "flex:1;border:1px solid #cfd6df;border-radius:6px;padding:7px 9px;font:14px inherit", d = t.querySelector("td,th"), p = t.style.width || "", u = d && d.style.padding ? parseFloat(d.style.padding) : "", g = t.style.borderSpacing ? parseFloat(t.style.borderSpacing) : "", m = t.style.borderWidth ? parseFloat(t.style.borderWidth) : "", f = t.style.marginLeft, b = t.style.marginRight, y = f === "auto" && b === "auto" ? "center" : f === "auto" ? "right" : b === "auto" && f === "0" ? "left" : "";
3683
3791
  this.dialog(
3684
3792
  this.t("tablepropsttl"),
3685
- (C) => {
3686
- const S = (w, k) => {
3793
+ (w) => {
3794
+ const S = (C, k) => {
3687
3795
  const L = document.createElement("div");
3688
- L.style.cssText = o;
3796
+ L.style.cssText = n;
3689
3797
  const H = document.createElement("span");
3690
- H.style.cssText = r, H.textContent = this.t(w), L.append(H, k), C.appendChild(L);
3798
+ H.style.cssText = r, H.textContent = this.t(C), L.append(H, k), w.appendChild(L);
3691
3799
  };
3692
- e = document.createElement("input"), e.type = "text", e.style.cssText = a, e.placeholder = "e.g. 600px or 100%", e.value = p, S("tblwidth", e), i = document.createElement("input"), i.type = "number", i.min = "0", i.style.cssText = a, i.value = String(m), S("tblcellpadding", i), s = document.createElement("input"), s.type = "number", s.min = "0", s.style.cssText = a, s.value = String(g), S("tblcellspacing", s), l = document.createElement("input"), l.type = "number", l.min = "0", l.style.cssText = a, l.value = String(u), S("tblborder", l), n = document.createElement("select"), n.style.cssText = a, [
3800
+ e = document.createElement("input"), e.type = "text", e.style.cssText = a, e.placeholder = "e.g. 600px or 100%", e.value = p, S("tblwidth", e), i = document.createElement("input"), i.type = "number", i.min = "0", i.style.cssText = a, i.value = String(u), S("tblcellpadding", i), s = document.createElement("input"), s.type = "number", s.min = "0", s.style.cssText = a, s.value = String(g), S("tblcellspacing", s), l = document.createElement("input"), l.type = "number", l.min = "0", l.style.cssText = a, l.value = String(m), S("tblborder", l), o = document.createElement("select"), o.style.cssText = a, [
3693
3801
  ["", "alignnone"],
3694
3802
  ["left", "alignleft"],
3695
3803
  ["center", "aligncenter"],
3696
3804
  ["right", "alignright"]
3697
- ].forEach(([w, k]) => {
3805
+ ].forEach(([C, k]) => {
3698
3806
  const L = document.createElement("option");
3699
- L.value = w, L.textContent = this.t(k), w === x && (L.selected = !0), n.appendChild(L);
3700
- }), S("tblalign", n);
3807
+ L.value = C, L.textContent = this.t(k), C === y && (L.selected = !0), o.appendChild(L);
3808
+ }), S("tblalign", o);
3701
3809
  },
3702
3810
  [
3703
3811
  { label: this.t("cancel"), action: () => this.closeDlg() },
@@ -3710,7 +3818,7 @@ const I = class I {
3710
3818
  cellpadding: i.value.trim(),
3711
3819
  cellspacing: s.value.trim(),
3712
3820
  border: l.value.trim(),
3713
- align: n.value
3821
+ align: o.value
3714
3822
  }), this.closeDlg(), this.onChange(), this.positionTableHandles();
3715
3823
  }
3716
3824
  }
@@ -3749,8 +3857,8 @@ const I = class I {
3749
3857
  formSelect(t, e) {
3750
3858
  const i = document.createElement("select");
3751
3859
  return i.style.cssText = "flex:1;border:1px solid #cfd6df;border-radius:6px;padding:7px 9px;font:14px inherit;background:#fff", t.forEach(([s, l]) => {
3752
- const n = document.createElement("option");
3753
- n.value = s, n.textContent = l, s === e && (n.selected = !0), i.appendChild(n);
3860
+ const o = document.createElement("option");
3861
+ o.value = s, o.textContent = l, s === e && (o.selected = !0), i.appendChild(o);
3754
3862
  }), i;
3755
3863
  }
3756
3864
  formBg(t) {
@@ -3760,8 +3868,8 @@ const I = class I {
3760
3868
  s.type = "color", s.value = i || "#ffffff", s.style.cssText = "width:36px;height:29px;border:1px solid #cfd6df;border-radius:4px;padding:1px;background:none;cursor:pointer";
3761
3869
  const l = document.createElement("label");
3762
3870
  l.style.cssText = "display:flex;align-items:center;gap:6px;cursor:pointer;color:#556";
3763
- const n = document.createElement("input");
3764
- return n.type = "checkbox", n.checked = !!i, l.append(n, document.createTextNode(this.t("fill"))), s.addEventListener("input", () => n.checked = !0), e.append(s, l), { wrap: e, color: s, fill: n };
3871
+ const o = document.createElement("input");
3872
+ return o.type = "checkbox", o.checked = !!i, l.append(o, document.createTextNode(this.t("fill"))), s.addEventListener("input", () => o.checked = !0), e.append(s, l), { wrap: e, color: s, fill: o };
3765
3873
  }
3766
3874
  setOrClear(t, e, i) {
3767
3875
  i ? t.style.setProperty(e, /^(width|height)$/.test(e) && /^\d+$/.test(i) ? i + "px" : i) : t.style.removeProperty(e);
@@ -3772,11 +3880,11 @@ const I = class I {
3772
3880
  alert(this.t("nocell"));
3773
3881
  return;
3774
3882
  }
3775
- let e, i, s, l, n;
3883
+ let e, i, s, l, o;
3776
3884
  this.dialog(
3777
3885
  this.t("cellprops").replace("…", ""),
3778
- (o) => {
3779
- e = this.formInput(t.style.width, "e.g. 120px / 25%"), this.formRow(o, this.t("tblwidth"), e), i = this.formInput(t.style.height, "e.g. 40px"), this.formRow(o, this.t("tblheight"), i), s = this.formSelect(
3886
+ (n) => {
3887
+ e = this.formInput(t.style.width, "e.g. 120px / 25%"), this.formRow(n, this.t("tblwidth"), e), i = this.formInput(t.style.height, "e.g. 40px"), this.formRow(n, this.t("tblheight"), i), s = this.formSelect(
3780
3888
  [
3781
3889
  ["", this.t("alignnone")],
3782
3890
  ["left", this.t("alignleft")],
@@ -3784,7 +3892,7 @@ const I = class I {
3784
3892
  ["right", this.t("alignright")]
3785
3893
  ],
3786
3894
  t.style.textAlign || ""
3787
- ), this.formRow(o, this.t("tblalign"), s), l = this.formSelect(
3895
+ ), this.formRow(n, this.t("tblalign"), s), l = this.formSelect(
3788
3896
  [
3789
3897
  ["", this.t("alignnone")],
3790
3898
  ["top", this.t("valigntop")],
@@ -3792,7 +3900,7 @@ const I = class I {
3792
3900
  ["bottom", this.t("valignbottom")]
3793
3901
  ],
3794
3902
  t.style.verticalAlign || ""
3795
- ), this.formRow(o, this.t("valign"), l), n = this.formBg(t.style.backgroundColor || ""), this.formRow(o, this.t("backcolor"), n.wrap);
3903
+ ), this.formRow(n, this.t("valign"), l), o = this.formBg(t.style.backgroundColor || ""), this.formRow(n, this.t("backcolor"), o.wrap);
3796
3904
  },
3797
3905
  [
3798
3906
  { label: this.t("cancel"), action: () => this.closeDlg() },
@@ -3800,7 +3908,7 @@ const I = class I {
3800
3908
  label: this.t("save"),
3801
3909
  primary: !0,
3802
3910
  action: () => {
3803
- this.setOrClear(t, "width", e.value.trim()), this.setOrClear(t, "height", i.value.trim()), this.setOrClear(t, "text-align", s.value), this.setOrClear(t, "vertical-align", l.value), this.setOrClear(t, "background-color", n.fill.checked ? n.color.value : ""), this.closeDlg(), this.onChange(), this.positionTableHandles();
3911
+ this.setOrClear(t, "width", e.value.trim()), this.setOrClear(t, "height", i.value.trim()), this.setOrClear(t, "text-align", s.value), this.setOrClear(t, "vertical-align", l.value), this.setOrClear(t, "background-color", o.fill.checked ? o.color.value : ""), this.closeDlg(), this.onChange(), this.positionTableHandles();
3804
3912
  }
3805
3913
  }
3806
3914
  ]
@@ -3838,11 +3946,11 @@ const I = class I {
3838
3946
  return;
3839
3947
  }
3840
3948
  const e = t.parentElement, i = t.closest("table"), s = Array.from(e.children).indexOf(t), l = Array.from(i.rows).map((r) => r.cells[s]).filter(Boolean);
3841
- let n, o;
3949
+ let o, n;
3842
3950
  this.dialog(
3843
3951
  this.t("colprops").replace("…", ""),
3844
3952
  (r) => {
3845
- n = this.formInput(t.style.width, "e.g. 120px / 25%"), this.formRow(r, this.t("tblwidth"), n), o = this.formBg(t.style.backgroundColor || ""), this.formRow(r, this.t("backcolor"), o.wrap);
3953
+ o = this.formInput(t.style.width, "e.g. 120px / 25%"), this.formRow(r, this.t("tblwidth"), o), n = this.formBg(t.style.backgroundColor || ""), this.formRow(r, this.t("backcolor"), n.wrap);
3846
3954
  },
3847
3955
  [
3848
3956
  { label: this.t("cancel"), action: () => this.closeDlg() },
@@ -3851,7 +3959,7 @@ const I = class I {
3851
3959
  primary: !0,
3852
3960
  action: () => {
3853
3961
  l.forEach((r) => {
3854
- this.setOrClear(r, "width", n.value.trim()), this.setOrClear(r, "background-color", o.fill.checked ? o.color.value : "");
3962
+ this.setOrClear(r, "width", o.value.trim()), this.setOrClear(r, "background-color", n.fill.checked ? n.color.value : "");
3855
3963
  }), this.closeDlg(), this.onChange(), this.positionTableHandles();
3856
3964
  }
3857
3965
  }
@@ -3867,8 +3975,8 @@ const I = class I {
3867
3975
  const s = document.createElement("div");
3868
3976
  s.className = "dlg", s.dir = this.dir(), s.innerHTML = `<header><span>${t}</span><button type="button">×</button></header>
3869
3977
  <div class="body"></div><footer></footer>`, s.querySelector("header button").onclick = () => this.closeDlg(), e(s.querySelector(".body")), (i || [{ label: this.t("close"), primary: !0, action: () => this.closeDlg() }]).forEach((l) => {
3870
- const n = document.createElement("button");
3871
- n.type = "button", n.textContent = l.label, l.primary && (n.className = "pri"), n.onclick = l.action, s.querySelector("footer").appendChild(n);
3978
+ const o = document.createElement("button");
3979
+ o.type = "button", o.textContent = l.label, l.primary && (o.className = "pri"), o.onclick = l.action, s.querySelector("footer").appendChild(o);
3872
3980
  }), this.dlgOvl.appendChild(s), this.dlgOvl.addEventListener("mousedown", (l) => {
3873
3981
  l.target === this.dlgOvl && this.closeDlg();
3874
3982
  }), document.body.appendChild(this.dlgOvl);
@@ -3932,31 +4040,31 @@ const I = class I {
3932
4040
  this.saveSel(), this.dialog(t, (s) => {
3933
4041
  const l = document.createElement("div");
3934
4042
  l.className = "chmap";
3935
- const n = document.createElement("div");
3936
- n.className = "chtabs";
3937
4043
  const o = document.createElement("div");
3938
- o.className = "chpanel";
4044
+ o.className = "chtabs";
4045
+ const n = document.createElement("div");
4046
+ n.className = "chpanel";
3939
4047
  const r = document.createElement("div");
3940
- r.className = "chgrid" + (i ? " emgrid" : ""), o.appendChild(r);
3941
- const a = (h) => {
3942
- n.querySelectorAll("button").forEach((p, m) => p.classList.toggle("on", m === h)), r.innerHTML = "", e[h].chars.forEach((p) => {
3943
- const m = document.createElement("button");
3944
- m.type = "button", m.textContent = p, m.onclick = () => {
4048
+ r.className = "chgrid" + (i ? " emgrid" : ""), n.appendChild(r);
4049
+ const a = (d) => {
4050
+ o.querySelectorAll("button").forEach((p, u) => p.classList.toggle("on", u === d)), r.innerHTML = "", e[d].chars.forEach((p) => {
4051
+ const u = document.createElement("button");
4052
+ u.type = "button", u.textContent = p, u.onclick = () => {
3945
4053
  this.closeDlg(), this.exec("insertText", p);
3946
- }, r.appendChild(m);
3947
- }), o.scrollTop = 0;
4054
+ }, r.appendChild(u);
4055
+ }), n.scrollTop = 0;
3948
4056
  };
3949
- e.forEach((h, p) => {
3950
- const m = document.createElement("button");
3951
- m.type = "button", m.textContent = this.t(h.key), m.addEventListener("click", () => a(p)), n.appendChild(m);
3952
- }), l.append(n, o), s.appendChild(l), a(0);
4057
+ e.forEach((d, p) => {
4058
+ const u = document.createElement("button");
4059
+ u.type = "button", u.textContent = this.t(d.key), u.addEventListener("click", () => a(p)), o.appendChild(u);
4060
+ }), l.append(o, n), s.appendChild(l), a(0);
3953
4061
  });
3954
4062
  }
3955
4063
  charMap() {
3956
- this.glyphPickerDlg(this.t("charmap").replace("…", ""), ft, !1);
4064
+ this.glyphPickerDlg(this.t("charmap").replace("…", ""), yt, !1);
3957
4065
  }
3958
4066
  emojiMap() {
3959
- this.glyphPickerDlg(this.t("emoji").replace("…", ""), vt, !0);
4067
+ this.glyphPickerDlg(this.t("emoji").replace("…", ""), xt, !0);
3960
4068
  }
3961
4069
  printDoc() {
3962
4070
  const t = window.open("", "_blank");
@@ -4018,17 +4126,17 @@ const I = class I {
4018
4126
  const i = document.createElement("button");
4019
4127
  i.type = "button", i.className = "txtbtn", i.textContent = this.t("insertimg");
4020
4128
  const s = () => {
4021
- const l = e.value.trim(), n = this.phActive;
4022
- if (!n) return;
4129
+ const l = e.value.trim(), o = this.phActive;
4130
+ if (!o) return;
4023
4131
  if (!/^(https?:|data:image\/|blob:)/i.test(l)) {
4024
4132
  e.classList.add("err"), e.focus();
4025
4133
  return;
4026
4134
  }
4027
4135
  i.disabled = !0, e.disabled = !0;
4028
- const o = new Image();
4029
- o.onload = () => this.replacePlaceholderWithImage(n, l, ""), o.onerror = () => {
4136
+ const n = new Image();
4137
+ n.onload = () => this.replacePlaceholderWithImage(o, l, ""), n.onerror = () => {
4030
4138
  i.disabled = !1, e.disabled = !1, e.classList.add("err"), e.focus();
4031
- }, o.src = l;
4139
+ }, n.src = l;
4032
4140
  };
4033
4141
  i.addEventListener("click", s), e.addEventListener("input", () => e.classList.remove("err")), e.addEventListener("keydown", (l) => {
4034
4142
  l.key === "Enter" ? (l.preventDefault(), s()) : l.key === "Escape" && (l.stopPropagation(), this.renderPhCtxButtons());
@@ -4054,8 +4162,8 @@ const I = class I {
4054
4162
  s && (s.textContent = this.t("uploading")), this.imageUploadHandler(t).then((l) => {
4055
4163
  this.ed.contains(e) && this.replacePlaceholderWithImage(e, l, i);
4056
4164
  }).catch((l) => {
4057
- var n;
4058
- this.ed.contains(e) && (e.classList.remove("uploading"), e.classList.add("upload-error"), s && (s.textContent = this.t("uploadfailed")), (n = this.onImageUploadError) == null || n.call(this, l, t));
4165
+ var o;
4166
+ this.ed.contains(e) && (e.classList.remove("uploading"), e.classList.add("upload-error"), s && (s.textContent = this.t("uploadfailed")), (o = this.onImageUploadError) == null || o.call(this, l, t));
4059
4167
  });
4060
4168
  }
4061
4169
  replacePlaceholderWithImage(t, e, i) {
@@ -4093,8 +4201,8 @@ const I = class I {
4093
4201
  if (!this.ed.contains(t) || t.closest(".tpl-media") || t.getAttribute("width") || t.getAttribute("height") || t.style.width || t.style.height) return i(!1);
4094
4202
  const l = t.naturalWidth;
4095
4203
  if (!l) return i(!1);
4096
- const n = this.contentWidth(), o = Math.round(n > 0 ? Math.min(l, n) : l);
4097
- t.setAttribute("width", String(o)), t.style.width = o + "px", t.style.height = "auto", i(!0);
4204
+ const o = this.contentWidth(), n = Math.round(o > 0 ? Math.min(l, o) : l);
4205
+ t.setAttribute("width", String(n)), t.style.width = n + "px", t.style.height = "auto", i(!0);
4098
4206
  };
4099
4207
  t.complete && t.naturalWidth ? s() : (t.addEventListener("load", s, { once: !0 }), t.addEventListener("error", () => i(!1), { once: !0 }));
4100
4208
  }
@@ -4169,20 +4277,20 @@ const I = class I {
4169
4277
  const i = document.createElement("button");
4170
4278
  i.type = "button", i.className = "txtbtn", i.textContent = this.t("insertvideo");
4171
4279
  const s = () => {
4172
- const l = e.value.trim(), n = this.vphActive;
4173
- if (!n) return;
4280
+ const l = e.value.trim(), o = this.vphActive;
4281
+ if (!o) return;
4174
4282
  if (!/^(https?:|data:video\/|blob:)/i.test(l)) {
4175
4283
  e.classList.add("err"), e.focus();
4176
4284
  return;
4177
4285
  }
4178
- const o = this.videoEmbedUrl(l);
4179
- if (o) {
4180
- this.replacePlaceholderWithEmbed(n, o);
4286
+ const n = this.videoEmbedUrl(l);
4287
+ if (n) {
4288
+ this.replacePlaceholderWithEmbed(o, n);
4181
4289
  return;
4182
4290
  }
4183
4291
  i.disabled = !0, e.disabled = !0;
4184
4292
  const r = document.createElement("video");
4185
- r.preload = "metadata", r.onloadedmetadata = () => this.replacePlaceholderWithVideo(n, l, ""), r.onerror = () => {
4293
+ r.preload = "metadata", r.onloadedmetadata = () => this.replacePlaceholderWithVideo(o, l, ""), r.onerror = () => {
4186
4294
  i.disabled = !1, e.disabled = !1, e.classList.add("err"), e.focus();
4187
4295
  }, r.src = l;
4188
4296
  };
@@ -4210,8 +4318,8 @@ const I = class I {
4210
4318
  s && (s.textContent = this.t("uploading")), this.videoUploadHandler(t).then((l) => {
4211
4319
  this.ed.contains(e) && this.replacePlaceholderWithVideo(e, l, i);
4212
4320
  }).catch((l) => {
4213
- var n;
4214
- this.ed.contains(e) && (e.classList.remove("uploading"), e.classList.add("upload-error"), s && (s.textContent = this.t("uploadfailed")), (n = this.onVideoUploadError) == null || n.call(this, l, t));
4321
+ var o;
4322
+ this.ed.contains(e) && (e.classList.remove("uploading"), e.classList.add("upload-error"), s && (s.textContent = this.t("uploadfailed")), (o = this.onVideoUploadError) == null || o.call(this, l, t));
4215
4323
  });
4216
4324
  }
4217
4325
  replacePlaceholderWithVideo(t, e, i) {
@@ -4250,19 +4358,19 @@ const I = class I {
4250
4358
  const e = document.createElement("div");
4251
4359
  e.className = "imgctx", e.dir = this.dir();
4252
4360
  const i = () => {
4253
- var h;
4361
+ var d;
4254
4362
  const a = this.buildVideoCtxToolbar(t);
4255
- (h = this.vidCtx) == null || h.replaceWith(a), this.vidCtx = a, this.positionVidCtx();
4363
+ (d = this.vidCtx) == null || d.replaceWith(a), this.vidCtx = a, this.positionVidCtx();
4256
4364
  }, s = (a) => {
4257
4365
  this.setVideoAlign(t, a), i();
4258
- }, l = t.style.float === "left", n = t.style.float === "right", o = !l && !n && t.style.marginLeft === "auto" && t.style.marginRight === "auto", r = (a, h, p, m) => {
4259
- const g = this.ctxBtn(a, h, m);
4366
+ }, l = t.style.float === "left", o = t.style.float === "right", n = !l && !o && t.style.marginLeft === "auto" && t.style.marginRight === "auto", r = (a, d, p, u) => {
4367
+ const g = this.ctxBtn(a, d, u);
4260
4368
  return g.classList.toggle("on", p), g;
4261
4369
  };
4262
4370
  return e.append(
4263
4371
  r(c.alignleft, this.t("alignleft"), l, () => s("left")),
4264
- r(c.aligncenter, this.t("aligncenter"), o, () => s("center")),
4265
- r(c.alignright, this.t("alignright"), n, () => s("right")),
4372
+ r(c.aligncenter, this.t("aligncenter"), n, () => s("center")),
4373
+ r(c.alignright, this.t("alignright"), o, () => s("right")),
4266
4374
  this.ctxSep(),
4267
4375
  r(c.trash, this.t("deletevideo"), !1, () => {
4268
4376
  t.remove(), this.clearVidHandles(), this.onChange();
@@ -4304,12 +4412,12 @@ const I = class I {
4304
4412
  * (videoUploadHandler when configured, else inline base64). */
4305
4413
  videoDlg() {
4306
4414
  this.saveSel();
4307
- let t, e, i, s, l, n;
4308
- const o = (a, h) => {
4415
+ let t, e, i, s, l, o;
4416
+ const n = (a, d) => {
4309
4417
  const p = document.createElement("div");
4310
4418
  p.className = "dfield";
4311
- const m = document.createElement("label");
4312
- return m.textContent = this.t(a), p.append(m, h), p;
4419
+ const u = document.createElement("label");
4420
+ return u.textContent = this.t(a), p.append(u, d), p;
4313
4421
  }, r = () => {
4314
4422
  const a = document.createElement("input");
4315
4423
  return a.type = "url", a;
@@ -4317,55 +4425,55 @@ const I = class I {
4317
4425
  this.dialog(
4318
4426
  this.t("videodlgttl"),
4319
4427
  (a) => {
4320
- const h = document.createElement("div");
4321
- h.className = "dtabs";
4322
- const p = [], m = (v, b) => {
4323
- const x = document.createElement("button");
4324
- x.type = "button", x.textContent = this.t(v);
4325
- const C = document.createElement("div");
4326
- C.className = "dtabpanel", b(C);
4428
+ const d = document.createElement("div");
4429
+ d.className = "dtabs";
4430
+ const p = [], u = (f, b) => {
4431
+ const y = document.createElement("button");
4432
+ y.type = "button", y.textContent = this.t(f);
4433
+ const w = document.createElement("div");
4434
+ w.className = "dtabpanel", b(w);
4327
4435
  const S = p.length;
4328
- p.push(C), x.addEventListener("click", () => g(S)), h.appendChild(x);
4329
- }, g = (v) => {
4330
- h.querySelectorAll("button").forEach((b, x) => b.classList.toggle("on", x === v)), p.forEach((b, x) => b.style.display = x === v ? "" : "none");
4436
+ p.push(w), y.addEventListener("click", () => g(S)), d.appendChild(y);
4437
+ }, g = (f) => {
4438
+ d.querySelectorAll("button").forEach((b, y) => b.classList.toggle("on", y === f)), p.forEach((b, y) => b.style.display = y === f ? "" : "none");
4331
4439
  };
4332
- m("vidgeneral", (v) => {
4440
+ u("vidgeneral", (f) => {
4333
4441
  t = r(), t.placeholder = this.t("videourlph");
4334
4442
  const b = document.createElement("div");
4335
4443
  b.className = "drow";
4336
- const x = document.createElement("button");
4337
- x.type = "button", x.className = "txtbtn", x.textContent = this.t("uploadvideo");
4338
- const C = document.createElement("input");
4339
- C.type = "file", C.accept = this.options.videoFileTypes.join(","), C.style.display = "none", x.addEventListener("click", () => {
4340
- C.value = "", C.click();
4341
- }), C.addEventListener("change", () => {
4444
+ const y = document.createElement("button");
4445
+ y.type = "button", y.className = "txtbtn", y.textContent = this.t("uploadvideo");
4446
+ const w = document.createElement("input");
4447
+ w.type = "file", w.accept = this.options.videoFileTypes.join(","), w.style.display = "none", y.addEventListener("click", () => {
4448
+ w.value = "", w.click();
4449
+ }), w.addEventListener("change", () => {
4342
4450
  var L;
4343
- const w = (L = C.files) == null ? void 0 : L[0];
4344
- if (!w) return;
4345
- x.disabled = !0, x.textContent = this.t("uploading");
4451
+ const C = (L = w.files) == null ? void 0 : L[0];
4452
+ if (!C) return;
4453
+ y.disabled = !0, y.textContent = this.t("uploading");
4346
4454
  const k = (H) => {
4347
- t.value = H, x.disabled = !1, x.textContent = this.t("uploadvideo");
4455
+ t.value = H, y.disabled = !1, y.textContent = this.t("uploadvideo");
4348
4456
  };
4349
4457
  if (this.videoUploadHandler)
4350
- this.videoUploadHandler(w).then(k).catch((H) => {
4351
- var z;
4352
- x.disabled = !1, x.textContent = this.t("uploadfailed"), (z = this.onVideoUploadError) == null || z.call(this, H, w);
4458
+ this.videoUploadHandler(C).then(k).catch((H) => {
4459
+ var U;
4460
+ y.disabled = !1, y.textContent = this.t("uploadfailed"), (U = this.onVideoUploadError) == null || U.call(this, H, C);
4353
4461
  });
4354
4462
  else {
4355
4463
  const H = new FileReader();
4356
- H.onload = () => k(H.result), H.readAsDataURL(w);
4464
+ H.onload = () => k(H.result), H.readAsDataURL(C);
4357
4465
  }
4358
- }), b.append(t, x, C), t.style.flex = "1", v.appendChild(o("vidsource", b));
4466
+ }), b.append(t, y, w), t.style.flex = "1", f.appendChild(n("vidsource", b));
4359
4467
  const S = document.createElement("div");
4360
- S.className = "drow", e = document.createElement("input"), e.type = "number", e.value = "560", i = document.createElement("input"), i.type = "number", i.value = "314", S.append(o("tblwidth", e), o("tblheight", i)), v.appendChild(S);
4361
- }), m("vidembed", (v) => {
4468
+ S.className = "drow", e = document.createElement("input"), e.type = "number", e.value = "560", i = document.createElement("input"), i.type = "number", i.value = "314", S.append(n("tblwidth", e), n("tblheight", i)), f.appendChild(S);
4469
+ }), u("vidembed", (f) => {
4362
4470
  const b = document.createElement("p");
4363
- b.textContent = this.t("vidembedhint"), b.style.cssText = "margin:0 0 8px;color:#556;font-size:13.5px", s = document.createElement("textarea"), s.style.cssText = "width:100%;box-sizing:border-box;height:160px", v.append(b, s);
4364
- }), m("vidadvanced", (v) => {
4365
- l = r(), n = r(), v.append(o("vidaltsource", l), o("vidposter", n));
4471
+ b.textContent = this.t("vidembedhint"), b.style.cssText = "margin:0 0 8px;color:#556;font-size:13.5px", s = document.createElement("textarea"), s.style.cssText = "width:100%;box-sizing:border-box;height:160px", f.append(b, s);
4472
+ }), u("vidadvanced", (f) => {
4473
+ l = r(), o = r(), f.append(n("vidaltsource", l), n("vidposter", o));
4366
4474
  });
4367
- const u = document.createElement("div");
4368
- u.className = "dtabbody", p.forEach((v) => u.appendChild(v)), a.append(h, u), g(0), setTimeout(() => t.focus(), 0);
4475
+ const m = document.createElement("div");
4476
+ m.className = "dtabbody", p.forEach((f) => m.appendChild(f)), a.append(d, m), g(0), setTimeout(() => t.focus(), 0);
4369
4477
  },
4370
4478
  [
4371
4479
  { label: this.t("cancel"), action: () => this.closeDlg() },
@@ -4373,21 +4481,21 @@ const I = class I {
4373
4481
  label: this.t("save"),
4374
4482
  primary: !0,
4375
4483
  action: () => {
4376
- const a = s.value.trim(), h = t.value.trim(), p = parseInt(e.value, 10) || 560, m = parseInt(i.value, 10) || 314;
4377
- if (this.closeDlg(), !a && !h) return;
4484
+ const a = s.value.trim(), d = t.value.trim(), p = parseInt(e.value, 10) || 560, u = parseInt(i.value, 10) || 314;
4485
+ if (this.closeDlg(), !a && !d) return;
4378
4486
  if (this.restoreSel(), a) {
4379
4487
  document.execCommand("insertHTML", !1, `<span class="video-embed" contenteditable="false">${a}</span>`), this.onChange();
4380
4488
  return;
4381
4489
  }
4382
- const g = this.videoEmbedUrl(h);
4490
+ const g = this.videoEmbedUrl(d);
4383
4491
  if (g)
4384
- document.execCommand("insertHTML", !1, this.videoEmbedHTML(g, p, m));
4492
+ document.execCommand("insertHTML", !1, this.videoEmbedHTML(g, p, u));
4385
4493
  else {
4386
- const u = l.value.trim(), v = n.value.trim();
4494
+ const m = l.value.trim(), f = o.value.trim();
4387
4495
  document.execCommand(
4388
4496
  "insertHTML",
4389
4497
  !1,
4390
- `<video controls width="${p}" height="${m}"${v ? ` poster="${this.escapeAttr(v)}"` : ""}><source src="${this.escapeAttr(h)}">${u ? `<source src="${this.escapeAttr(u)}">` : ""}</video>`
4498
+ `<video controls width="${p}" height="${u}"${f ? ` poster="${this.escapeAttr(f)}"` : ""}><source src="${this.escapeAttr(d)}">${m ? `<source src="${this.escapeAttr(m)}">` : ""}</video>`
4391
4499
  );
4392
4500
  }
4393
4501
  this.onChange();
@@ -4438,20 +4546,20 @@ const I = class I {
4438
4546
  /** Typing `snippet` converts to an inline <code> run the moment the closing
4439
4547
  * backtick is typed, so code can be marked up without reaching for the toolbar. */
4440
4548
  tryCodeTyping(t) {
4441
- var h;
4549
+ var d;
4442
4550
  const e = window.getSelection();
4443
4551
  if (!e || !e.isCollapsed || !e.anchorNode) return;
4444
4552
  const i = e.anchorNode;
4445
- if (i.nodeType !== Node.TEXT_NODE || !this.ed.contains(i) || (h = i.parentElement) != null && h.closest("code, pre")) return;
4553
+ if (i.nodeType !== Node.TEXT_NODE || !this.ed.contains(i) || (d = i.parentElement) != null && d.closest("code, pre")) return;
4446
4554
  const l = (i.textContent || "").slice(0, e.anchorOffset).match(/(?:^|[^`])`([^`]+)$/);
4447
4555
  if (!l) return;
4448
- const n = l[1];
4449
- if (/^\s|\s$/.test(n)) return;
4556
+ const o = l[1];
4557
+ if (/^\s|\s$/.test(o)) return;
4450
4558
  t.preventDefault();
4451
- const o = document.createRange();
4452
- o.setStart(i, e.anchorOffset - n.length - 1), o.setEnd(i, e.anchorOffset), o.deleteContents();
4559
+ const n = document.createRange();
4560
+ n.setStart(i, e.anchorOffset - o.length - 1), n.setEnd(i, e.anchorOffset), n.deleteContents();
4453
4561
  const r = document.createElement("code");
4454
- r.textContent = n, o.insertNode(r);
4562
+ r.textContent = o, n.insertNode(r);
4455
4563
  const a = document.createRange();
4456
4564
  a.setStartAfter(r), a.collapse(!0), e.removeAllRanges(), e.addRange(a), this.saveSel(), this.onChange();
4457
4565
  }
@@ -4465,22 +4573,22 @@ const I = class I {
4465
4573
  s.className = "dsel";
4466
4574
  const l = document.createElement("button");
4467
4575
  l.type = "button", l.className = "dsel-btn";
4468
- const n = document.createElement("span");
4469
- n.className = "lbl", n.textContent = ((r = t.find(([a]) => a === e)) == null ? void 0 : r[1]) || "", l.append(n), l.insertAdjacentHTML("beforeend", c.chev);
4470
- const o = document.createElement("div");
4471
- return o.className = "dsel-list", t.forEach(([a, h]) => {
4576
+ const o = document.createElement("span");
4577
+ o.className = "lbl", o.textContent = ((r = t.find(([a]) => a === e)) == null ? void 0 : r[1]) || "", l.append(o), l.insertAdjacentHTML("beforeend", c.chev);
4578
+ const n = document.createElement("div");
4579
+ return n.className = "dsel-list", t.forEach(([a, d]) => {
4472
4580
  const p = document.createElement("button");
4473
- p.type = "button", p.textContent = h, p.classList.toggle("on", a === i), p.addEventListener("click", () => {
4474
- i = a, n.textContent = h, o.querySelectorAll("button").forEach((m) => m.classList.toggle("on", m === p)), s.classList.remove("open"), l.focus();
4475
- }), o.appendChild(p);
4581
+ p.type = "button", p.textContent = d, p.classList.toggle("on", a === i), p.addEventListener("click", () => {
4582
+ i = a, o.textContent = d, n.querySelectorAll("button").forEach((u) => u.classList.toggle("on", u === p)), s.classList.remove("open"), l.focus();
4583
+ }), n.appendChild(p);
4476
4584
  }), l.addEventListener("click", () => {
4477
4585
  var a;
4478
- s.classList.toggle("open"), s.classList.contains("open") && ((a = o.querySelector(".on")) == null || a.scrollIntoView({ block: "nearest" }));
4586
+ s.classList.toggle("open"), s.classList.contains("open") && ((a = n.querySelector(".on")) == null || a.scrollIntoView({ block: "nearest" }));
4479
4587
  }), s.addEventListener("focusout", (a) => {
4480
4588
  s.contains(a.relatedTarget) || s.classList.remove("open");
4481
4589
  }), s.addEventListener("keydown", (a) => {
4482
4590
  a.key === "Escape" && s.classList.contains("open") && (a.stopPropagation(), s.classList.remove("open"), l.focus());
4483
- }), s.append(l, o), { el: s, value: () => i };
4591
+ }), s.append(l, n), { el: s, value: () => i };
4484
4592
  }
4485
4593
  /** Insert/edit-code-sample dialog: language dropdown + monospace textarea to
4486
4594
  * paste or type code into. Inserts a non-editable <pre class="code-block">
@@ -4491,11 +4599,11 @@ const I = class I {
4491
4599
  this.dialog(
4492
4600
  this.t("codedlgttl"),
4493
4601
  (s) => {
4494
- var o;
4602
+ var n;
4495
4603
  const l = document.createElement("div");
4496
4604
  l.className = "dfield";
4497
- const n = document.createElement("label");
4498
- n.textContent = this.t("codelang"), e = this.dlgSelect(V, (t == null ? void 0 : t.dataset.lang) || "plain"), l.append(n, e.el), i = document.createElement("textarea"), i.className = "code-input", i.spellcheck = !1, i.value = ((o = t == null ? void 0 : t.querySelector("code")) == null ? void 0 : o.textContent) || "", i.placeholder = "const answer = 42;", s.append(l, i), setTimeout(() => i.focus(), 0);
4605
+ const o = document.createElement("label");
4606
+ o.textContent = this.t("codelang"), e = this.dlgSelect(X, (t == null ? void 0 : t.dataset.lang) || "plain"), l.append(o, e.el), i = document.createElement("textarea"), i.className = "code-input", i.spellcheck = !1, i.value = ((n = t == null ? void 0 : t.querySelector("code")) == null ? void 0 : n.textContent) || "", i.placeholder = "const answer = 42;", s.append(l, i), setTimeout(() => i.focus(), 0);
4499
4607
  },
4500
4608
  [
4501
4609
  { label: this.t("cancel"), action: () => this.closeDlg() },
@@ -4503,11 +4611,11 @@ const I = class I {
4503
4611
  label: this.t("save"),
4504
4612
  primary: !0,
4505
4613
  action: () => {
4506
- var o;
4507
- const s = i.value.replace(/\s+$/, ""), l = e.value(), n = ((o = V.find(([r]) => r === l)) == null ? void 0 : o[1]) || l;
4614
+ var n;
4615
+ const s = i.value.replace(/\s+$/, ""), l = e.value(), o = ((n = X.find(([r]) => r === l)) == null ? void 0 : n[1]) || l;
4508
4616
  if (this.closeDlg(), !!s.trim()) {
4509
4617
  if (t) {
4510
- t.dataset.lang = l, t.setAttribute("data-lang-label", n);
4618
+ t.dataset.lang = l, t.setAttribute("data-lang-label", o);
4511
4619
  const r = t.querySelector("code") || t;
4512
4620
  r.textContent = s, this.clearCodeSel(), this.onChange();
4513
4621
  return;
@@ -4515,7 +4623,7 @@ const I = class I {
4515
4623
  this.restoreSel(), document.execCommand(
4516
4624
  "insertHTML",
4517
4625
  !1,
4518
- `<pre class="code-block" contenteditable="false" data-lang="${l}" data-lang-label="${this.escapeAttr(n)}"><code>${this.escHtml(s)}</code></pre><p><br></p>`
4626
+ `<pre class="code-block" contenteditable="false" data-lang="${l}" data-lang-label="${this.escapeAttr(o)}"><code>${this.escHtml(s)}</code></pre><p><br></p>`
4519
4627
  ), this.onChange();
4520
4628
  }
4521
4629
  }
@@ -4572,14 +4680,14 @@ const I = class I {
4572
4680
  /** Miniature div-based mockup of a layout, mirroring what the block looks
4573
4681
  like in the editor: grey box = image slot, bars = heading/paragraph. */
4574
4682
  tplPreviewHTML(t) {
4575
- const e = '<span class="pv-img"></span>', i = '<span class="pv-h"></span>', s = (r) => `<span class="pv-l" style="width:${r}%"></span>`, l = (r) => `<span class="pv-col">${r}</span>`, n = (r) => `<span class="pv-row">${r}</span>`, o = l(i + s(100) + s(88));
4576
- return t === "img-left" ? `<span class="pv">${n(e + o)}${s(100)}${s(72)}</span>` : t === "img-right" ? `<span class="pv">${n(o + e)}${s(100)}${s(72)}</span>` : t === "img-top" ? `<span class="pv pv-c">${e}${i}${s(100)}${s(72)}</span>` : `<span class="pv pv-c">${i}${s(100)}${s(72)}${e}</span>`;
4683
+ const e = '<span class="pv-img"></span>', i = '<span class="pv-h"></span>', s = (r) => `<span class="pv-l" style="width:${r}%"></span>`, l = (r) => `<span class="pv-col">${r}</span>`, o = (r) => `<span class="pv-row">${r}</span>`, n = l(i + s(100) + s(88));
4684
+ return t === "img-left" ? `<span class="pv">${o(e + n)}${s(100)}${s(72)}</span>` : t === "img-right" ? `<span class="pv">${o(n + e)}${s(100)}${s(72)}</span>` : t === "img-top" ? `<span class="pv pv-c">${e}${i}${s(100)}${s(72)}</span>` : `<span class="pv pv-c">${i}${s(100)}${s(72)}${e}</span>`;
4577
4685
  }
4578
4686
  buildTemplatePickInto(t, e) {
4579
4687
  const i = document.createElement("div");
4580
- i.className = "tplpick", O.forEach((s) => {
4688
+ i.className = "tplpick", $.forEach((s) => {
4581
4689
  const l = document.createElement("button");
4582
- l.type = "button", l.className = "tpltile", l.title = this.t($[s]), l.innerHTML = this.tplPreviewHTML(s) + `<span class="tpllbl">${this.t($[s])}</span>`, l.addEventListener("click", () => {
4690
+ l.type = "button", l.className = "tpltile", l.title = this.t(_[s]), l.innerHTML = this.tplPreviewHTML(s) + `<span class="tpllbl">${this.t(_[s])}</span>`, l.addEventListener("click", () => {
4583
4691
  this.closePop(), this.insertTemplate(s), e == null || e();
4584
4692
  }), i.appendChild(l);
4585
4693
  }), t.appendChild(i);
@@ -4598,15 +4706,15 @@ const I = class I {
4598
4706
  }
4599
4707
  renderTplCtxButtons() {
4600
4708
  const t = this.tplCtx, e = this.tplActive;
4601
- !t || !e || (t.innerHTML = "", O.forEach((i) => {
4602
- const s = this.ctxBtn(Wt[i], this.t($[i]), () => this.setTplLayout(i));
4709
+ !t || !e || (t.innerHTML = "", $.forEach((i) => {
4710
+ const s = this.ctxBtn(Gt[i], this.t(_[i]), () => this.setTplLayout(i));
4603
4711
  s.classList.toggle("on", e.classList.contains("tpl-" + i)), t.appendChild(s);
4604
4712
  }), t.append(this.ctxSep(), this.ctxBtn(c.trash, this.t("deltemplate"), () => this.removeTemplate())), this.positionTplCtx());
4605
4713
  }
4606
4714
  setTplLayout(t) {
4607
4715
  const e = this.tplActive;
4608
4716
  if (!e) return;
4609
- O.forEach((l) => e.classList.remove("tpl-" + l)), e.classList.add("tpl-" + t);
4717
+ $.forEach((l) => e.classList.remove("tpl-" + l)), e.classList.add("tpl-" + t);
4610
4718
  const i = e.querySelector(":scope > .tpl-media"), s = e.querySelector(":scope > .tpl-text");
4611
4719
  i && s && (t === "img-center" ? e.appendChild(i) : e.insertBefore(i, s)), this.renderTplCtxButtons(), this.positionImgPhCtx(), this.positionImageHandles(), this.onChange();
4612
4720
  }
@@ -4638,7 +4746,7 @@ const I = class I {
4638
4746
  /* ---------------------------------------------------------- table resize */
4639
4747
  clearTableHandles() {
4640
4748
  var t, e, i, s, l;
4641
- (t = this.tblCorner) == null || t.remove(), this.tblCorner = null, this.tblColBars.forEach((n) => n.remove()), this.tblColBars = [], (e = this.tblCtx) == null || e.remove(), this.tblCtx = null, (i = this.tblCellMark) == null || i.remove(), this.tblCellMark = null, (s = this.tblOpMark) == null || s.remove(), this.tblOpMark = null, this.tblOpMarkKind = null, (l = this.tblActive) == null || l.classList.remove("tbl-selected"), this.tblActive = null;
4749
+ (t = this.tblCorner) == null || t.remove(), this.tblCorner = null, this.tblColBars.forEach((o) => o.remove()), this.tblColBars = [], (e = this.tblCtx) == null || e.remove(), this.tblCtx = null, (i = this.tblCellMark) == null || i.remove(), this.tblCellMark = null, (s = this.tblOpMark) == null || s.remove(), this.tblOpMark = null, this.tblOpMarkKind = null, (l = this.tblActive) == null || l.classList.remove("tbl-selected"), this.tblActive = null;
4642
4750
  }
4643
4751
  /** Blue outline around the cell that holds the caret, so it is clear
4644
4752
  which cell / row / column the table operations will target. */
@@ -4658,15 +4766,15 @@ const I = class I {
4658
4766
  this.tblOpMarkKind = t, this.positionOpMark();
4659
4767
  }
4660
4768
  positionOpMark() {
4661
- var h;
4769
+ var d;
4662
4770
  const t = this.tblOpMarkKind, e = t ? this.currentCell() : null;
4663
4771
  if (!t || !e || !this.tblActive || e.closest("table") !== this.tblActive) {
4664
- (h = this.tblOpMark) == null || h.remove(), this.tblOpMark = null;
4772
+ (d = this.tblOpMark) == null || d.remove(), this.tblOpMark = null;
4665
4773
  return;
4666
4774
  }
4667
4775
  this.tblOpMark || (this.tblOpMark = document.createElement("div"), this.tblOpMark.className = "tbl-opmark", document.body.appendChild(this.tblOpMark));
4668
- const i = this.tblActive.getBoundingClientRect(), s = e.getBoundingClientRect(), l = e.parentElement.getBoundingClientRect(), n = t === "row" ? l.left : s.left, o = t === "row" ? l.top : i.top, r = t === "row" ? l.width : s.width, a = t === "row" ? l.height : i.height;
4669
- this.tblOpMark.style.left = n + scrollX + "px", this.tblOpMark.style.top = o + scrollY + "px", this.tblOpMark.style.width = r + "px", this.tblOpMark.style.height = a + "px";
4776
+ const i = this.tblActive.getBoundingClientRect(), s = e.getBoundingClientRect(), l = e.parentElement.getBoundingClientRect(), o = t === "row" ? l.left : s.left, n = t === "row" ? l.top : i.top, r = t === "row" ? l.width : s.width, a = t === "row" ? l.height : i.height;
4777
+ this.tblOpMark.style.left = o + scrollX + "px", this.tblOpMark.style.top = n + scrollY + "px", this.tblOpMark.style.width = r + "px", this.tblOpMark.style.height = a + "px";
4670
4778
  }
4671
4779
  /** Lowest allowed top for floating context toolbars — keeps them from
4672
4780
  covering the editor menubar/toolbar when the target sits on the first line. */
@@ -4675,7 +4783,7 @@ const I = class I {
4675
4783
  }
4676
4784
  ctxBtn(t, e, i, s) {
4677
4785
  const l = document.createElement("button");
4678
- return l.type = "button", l.title = e, l.innerHTML = t, s && (l.dataset.id = s), l.addEventListener("mousedown", (n) => n.preventDefault()), l.addEventListener("click", i), l;
4786
+ return l.type = "button", l.title = e, l.innerHTML = t, s && (l.dataset.id = s), l.addEventListener("mousedown", (o) => o.preventDefault()), l.addEventListener("click", i), l;
4679
4787
  }
4680
4788
  ctxSep() {
4681
4789
  const t = document.createElement("div");
@@ -4712,20 +4820,20 @@ const I = class I {
4712
4820
  this.clearTableHandles();
4713
4821
  return;
4714
4822
  }
4715
- const t = this.ed.getAttribute("dir") === "rtl", e = this.tblActive.getBoundingClientRect(), i = e.top + scrollY, s = e.left + scrollX, l = e.right + scrollX, n = e.bottom + scrollY;
4716
- if (this.tblCorner && (this.tblCorner.style.top = n - 5 + "px", this.tblCorner.style.left = (t ? s - 5 : l - 5) + "px", this.tblCorner.style.cursor = t ? "nesw-resize" : "nwse-resize"), this.tblCtx) {
4823
+ const t = this.ed.getAttribute("dir") === "rtl", e = this.tblActive.getBoundingClientRect(), i = e.top + scrollY, s = e.left + scrollX, l = e.right + scrollX, o = e.bottom + scrollY;
4824
+ if (this.tblCorner && (this.tblCorner.style.top = o - 5 + "px", this.tblCorner.style.left = (t ? s - 5 : l - 5) + "px", this.tblCorner.style.cursor = t ? "nesw-resize" : "nwse-resize"), this.tblCtx) {
4717
4825
  const r = this.tblCtx.offsetWidth, a = this.tblCtx.offsetHeight;
4718
- let h = s + (l - s) / 2 - r / 2;
4719
- h = Math.max(8 + scrollX, Math.min(h, scrollX + innerWidth - r - 8));
4826
+ let d = s + (l - s) / 2 - r / 2;
4827
+ d = Math.max(8 + scrollX, Math.min(d, scrollX + innerWidth - r - 8));
4720
4828
  let p = i - a - 8;
4721
- p < this.ctxMinTop() && (p = n + 8), this.tblCtx.style.left = h + "px", this.tblCtx.style.top = p + "px";
4829
+ p < this.ctxMinTop() && (p = o + 8), this.tblCtx.style.left = d + "px", this.tblCtx.style.top = p + "px";
4722
4830
  }
4723
4831
  this.tblColBars.forEach((r) => r.remove()), this.tblColBars = [];
4724
- const o = this.tblActive.rows[0];
4725
- if (o)
4726
- for (let r = 0; r < o.cells.length - 1; r++) {
4727
- const a = o.cells[r].getBoundingClientRect(), h = (t ? a.left : a.right) + scrollX, p = document.createElement("div");
4728
- p.className = "tbl-colbar", p.style.top = i + "px", p.style.left = h + "px", p.style.height = n - i + "px", document.body.appendChild(p), p.addEventListener("mousedown", (m) => this.startColBarDrag(m, r)), this.tblColBars.push(p);
4832
+ const n = this.tblActive.rows[0];
4833
+ if (n)
4834
+ for (let r = 0; r < n.cells.length - 1; r++) {
4835
+ const a = n.cells[r].getBoundingClientRect(), d = (t ? a.left : a.right) + scrollX, p = document.createElement("div");
4836
+ p.className = "tbl-colbar", p.style.top = i + "px", p.style.left = d + "px", p.style.height = o - i + "px", document.body.appendChild(p), p.addEventListener("mousedown", (u) => this.startColBarDrag(u, r)), this.tblColBars.push(p);
4729
4837
  }
4730
4838
  this.positionCellMarker(), this.positionOpMark();
4731
4839
  }
@@ -4743,31 +4851,31 @@ const I = class I {
4743
4851
  const e = this.tblActive;
4744
4852
  if (!e) return;
4745
4853
  const i = this.ed.getAttribute("dir") === "rtl", s = t.clientX, l = e.getBoundingClientRect().width;
4746
- e.style.tableLayout = e.style.tableLayout || "fixed", this.withNoTextSelect((n) => {
4747
- const o = (a) => {
4748
- const h = i ? -(a.clientX - s) : a.clientX - s;
4749
- e.style.width = Math.max(60, Math.round(l + h)) + "px", this.positionTableHandles();
4854
+ e.style.tableLayout = e.style.tableLayout || "fixed", this.withNoTextSelect((o) => {
4855
+ const n = (a) => {
4856
+ const d = i ? -(a.clientX - s) : a.clientX - s;
4857
+ e.style.width = Math.max(60, Math.round(l + d)) + "px", this.positionTableHandles();
4750
4858
  }, r = () => {
4751
- window.removeEventListener("mousemove", o), window.removeEventListener("mouseup", r), n(), this.onChange();
4859
+ window.removeEventListener("mousemove", n), window.removeEventListener("mouseup", r), o(), this.onChange();
4752
4860
  };
4753
- window.addEventListener("mousemove", o), window.addEventListener("mouseup", r);
4861
+ window.addEventListener("mousemove", n), window.addEventListener("mouseup", r);
4754
4862
  });
4755
4863
  }
4756
4864
  startColBarDrag(t, e) {
4757
4865
  t.preventDefault(), t.stopPropagation();
4758
4866
  const i = this.tblActive;
4759
4867
  if (!i) return;
4760
- const s = this.ed.getAttribute("dir") === "rtl", l = Array.from(i.rows), n = l.map((p) => p.cells[e]).filter(Boolean), o = l.map((p) => p.cells[e + 1]).filter(Boolean);
4761
- if (!n.length || !o.length) return;
4762
- const r = t.clientX, a = n[0].getBoundingClientRect().width, h = o[0].getBoundingClientRect().width;
4868
+ const s = this.ed.getAttribute("dir") === "rtl", l = Array.from(i.rows), o = l.map((p) => p.cells[e]).filter(Boolean), n = l.map((p) => p.cells[e + 1]).filter(Boolean);
4869
+ if (!o.length || !n.length) return;
4870
+ const r = t.clientX, a = o[0].getBoundingClientRect().width, d = n[0].getBoundingClientRect().width;
4763
4871
  i.style.tableLayout = "fixed", this.withNoTextSelect((p) => {
4764
- const m = (u) => {
4765
- const v = (s ? -1 : 1) * (u.clientX - r);
4766
- n.forEach((b) => b.style.width = Math.max(24, Math.round(a + v)) + "px"), o.forEach((b) => b.style.width = Math.max(24, Math.round(h - v)) + "px"), this.positionTableHandles();
4872
+ const u = (m) => {
4873
+ const f = (s ? -1 : 1) * (m.clientX - r);
4874
+ o.forEach((b) => b.style.width = Math.max(24, Math.round(a + f)) + "px"), n.forEach((b) => b.style.width = Math.max(24, Math.round(d - f)) + "px"), this.positionTableHandles();
4767
4875
  }, g = () => {
4768
- window.removeEventListener("mousemove", m), window.removeEventListener("mouseup", g), p(), this.onChange();
4876
+ window.removeEventListener("mousemove", u), window.removeEventListener("mouseup", g), p(), this.onChange();
4769
4877
  };
4770
- window.addEventListener("mousemove", m), window.addEventListener("mouseup", g);
4878
+ window.addEventListener("mousemove", u), window.addEventListener("mouseup", g);
4771
4879
  });
4772
4880
  }
4773
4881
  /* ---------------------------------------------------------- image toolbar / resize */
@@ -4782,7 +4890,7 @@ const I = class I {
4782
4890
  this.cancelImgHide(), this.imgHandles.forEach((i) => i.remove()), this.imgHandles = [], (t = this.imgCtx) == null || t.remove(), this.imgCtx = null, (e = this.imgActive) == null || e.classList.remove("img-selected"), this.imgActive = null;
4783
4891
  }
4784
4892
  selectImage(t) {
4785
- this.imgActive !== t && (this.clearImageHandles(), this.imgActive = t, t.classList.add("img-selected"), this.imgHandles = Ut.map((e) => {
4893
+ this.imgActive !== t && (this.clearImageHandles(), this.imgActive = t, t.classList.add("img-selected"), this.imgHandles = Qt.map((e) => {
4786
4894
  const i = document.createElement("div");
4787
4895
  return i.className = "img-handle img-handle-" + e, i.dataset.corner = e, i.addEventListener("mousedown", (s) => this.startImageResizeDrag(s, e)), i.addEventListener("mouseenter", () => this.cancelImgHide()), i.addEventListener("mouseleave", () => this.scheduleImgHide()), document.body.appendChild(i), i;
4788
4896
  }), this.imgCtx = this.buildImageCtxToolbar(t), this.positionImageHandles());
@@ -4791,19 +4899,19 @@ const I = class I {
4791
4899
  const e = document.createElement("div");
4792
4900
  e.className = "imgctx", e.dir = this.dir();
4793
4901
  const i = () => {
4794
- var h;
4902
+ var d;
4795
4903
  const a = this.buildImageCtxToolbar(t);
4796
- (h = this.imgCtx) == null || h.replaceWith(a), this.imgCtx = a, this.positionImageHandles();
4904
+ (d = this.imgCtx) == null || d.replaceWith(a), this.imgCtx = a, this.positionImageHandles();
4797
4905
  }, s = (a) => {
4798
4906
  this.setImageAlign(t, a), i();
4799
- }, l = t.style.float === "left", n = t.style.float === "right", o = !l && !n && t.style.marginLeft === "auto" && t.style.marginRight === "auto", r = (a, h, p, m) => {
4800
- const g = this.ctxBtn(a, h, m);
4907
+ }, l = t.style.float === "left", o = t.style.float === "right", n = !l && !o && t.style.marginLeft === "auto" && t.style.marginRight === "auto", r = (a, d, p, u) => {
4908
+ const g = this.ctxBtn(a, d, u);
4801
4909
  return g.classList.toggle("on", p), g;
4802
4910
  };
4803
4911
  return e.append(
4804
4912
  r(c.alignleft, this.t("alignleft"), l, () => s("left")),
4805
- r(c.aligncenter, this.t("aligncenter"), o, () => s("center")),
4806
- r(c.alignright, this.t("alignright"), n, () => s("right")),
4913
+ r(c.aligncenter, this.t("aligncenter"), n, () => s("center")),
4914
+ r(c.alignright, this.t("alignright"), o, () => s("right")),
4807
4915
  this.ctxSep(),
4808
4916
  r(c.rotateleft, this.t("rotateleft"), !1, () => {
4809
4917
  this.rotateImage(t, -90), i();
@@ -4845,21 +4953,21 @@ const I = class I {
4845
4953
  this.clearImageHandles();
4846
4954
  return;
4847
4955
  }
4848
- const t = this.imgActive.getBoundingClientRect(), e = t.top + scrollY, i = t.left + scrollX, s = t.right + scrollX, l = t.bottom + scrollY, n = {
4956
+ const t = this.imgActive.getBoundingClientRect(), e = t.top + scrollY, i = t.left + scrollX, s = t.right + scrollX, l = t.bottom + scrollY, o = {
4849
4957
  nw: [i, e],
4850
4958
  ne: [s, e],
4851
4959
  sw: [i, l],
4852
4960
  se: [s, l]
4853
4961
  };
4854
- if (this.imgHandles.forEach((o) => {
4855
- const [r, a] = n[o.dataset.corner];
4856
- o.style.left = r - 5 + "px", o.style.top = a - 5 + "px";
4962
+ if (this.imgHandles.forEach((n) => {
4963
+ const [r, a] = o[n.dataset.corner];
4964
+ n.style.left = r - 5 + "px", n.style.top = a - 5 + "px";
4857
4965
  }), this.imgCtx) {
4858
- const o = this.imgCtx.offsetWidth, r = this.imgCtx.offsetHeight;
4859
- let a = i + (s - i) / 2 - o / 2;
4860
- a = Math.max(8 + scrollX, Math.min(a, scrollX + innerWidth - o - 8));
4861
- let h = e - r - 8;
4862
- h < this.ctxMinTop() && (h = l + 8), this.imgCtx.style.left = a + "px", this.imgCtx.style.top = h + "px";
4966
+ const n = this.imgCtx.offsetWidth, r = this.imgCtx.offsetHeight;
4967
+ let a = i + (s - i) / 2 - n / 2;
4968
+ a = Math.max(8 + scrollX, Math.min(a, scrollX + innerWidth - n - 8));
4969
+ let d = e - r - 8;
4970
+ d < this.ctxMinTop() && (d = l + 8), this.imgCtx.style.left = a + "px", this.imgCtx.style.top = d + "px";
4863
4971
  }
4864
4972
  }
4865
4973
  startImageResizeDrag(t, e) {
@@ -4867,14 +4975,14 @@ const I = class I {
4867
4975
  const i = this.imgActive;
4868
4976
  if (!i) return;
4869
4977
  this.cancelImgHide();
4870
- const s = t.clientX, l = i.getBoundingClientRect().width, n = e === "nw" || e === "sw" ? -1 : 1;
4871
- this.withNoTextSelect((o) => {
4872
- const r = (h) => {
4873
- i.style.width = Math.max(24, Math.round(l + n * (h.clientX - s))) + "px", i.style.height = "auto", this.positionImageHandles();
4978
+ const s = t.clientX, l = i.getBoundingClientRect().width, o = e === "nw" || e === "sw" ? -1 : 1;
4979
+ this.withNoTextSelect((n) => {
4980
+ const r = (d) => {
4981
+ i.style.width = Math.max(24, Math.round(l + o * (d.clientX - s))) + "px", i.style.height = "auto", this.positionImageHandles();
4874
4982
  }, a = () => {
4875
- window.removeEventListener("mousemove", r), window.removeEventListener("mouseup", a), o();
4876
- const h = parseInt(i.style.width, 10);
4877
- h > 0 && !i.closest(".tpl-media") && (i.setAttribute("width", String(h)), i.removeAttribute("height")), this.onChange();
4983
+ window.removeEventListener("mousemove", r), window.removeEventListener("mouseup", a), n();
4984
+ const d = parseInt(i.style.width, 10);
4985
+ d > 0 && !i.closest(".tpl-media") && (i.setAttribute("width", String(d)), i.removeAttribute("height")), this.onChange();
4878
4986
  };
4879
4987
  window.addEventListener("mousemove", r), window.addEventListener("mouseup", a);
4880
4988
  });
@@ -4915,7 +5023,7 @@ const I = class I {
4915
5023
  this.selCtx || (this.selCtx = this.buildSelToolbar()), this.positionSelToolbar(e);
4916
5024
  }
4917
5025
  buildSelToolbar() {
4918
- var o;
5026
+ var n;
4919
5027
  const t = document.createElement("div");
4920
5028
  t.className = "selctx", t.dir = this.dir();
4921
5029
  const e = this.ctxBtn(
@@ -4923,8 +5031,8 @@ const I = class I {
4923
5031
  this.t("forecolor"),
4924
5032
  () => this.colorMenu(e, "fore")
4925
5033
  ), i = this.ctxBtn(c.backcolor, this.t("backcolor"), () => this.colorMenu(i, "back"));
4926
- (o = i.querySelector("svg")) == null || o.insertAdjacentHTML("afterend", '<span class="colorbar" data-cb="back"></span>');
4927
- const s = this.ctxBtn(c.caseic, this.t("changecase"), () => this.caseMenu(s)), l = this.ctxBtn(c.lineheight, this.t("lineheight"), () => this.lineHeightMenu(l)), n = this.ctxBtn(c.wordspacing, this.t("wordspacing"), () => this.wordSpacingMenu(n));
5034
+ (n = i.querySelector("svg")) == null || n.insertAdjacentHTML("afterend", '<span class="colorbar" data-cb="back"></span>');
5035
+ const s = this.ctxBtn(c.caseic, this.t("changecase"), () => this.caseMenu(s)), l = this.ctxBtn(c.lineheight, this.t("lineheight"), () => this.lineHeightMenu(l)), o = this.ctxBtn(c.wordspacing, this.t("wordspacing"), () => this.wordSpacingMenu(o));
4928
5036
  return t.append(
4929
5037
  this.ctxBtn(c.bold, this.t("bold"), () => this.exec("bold"), "bold"),
4930
5038
  this.ctxBtn(c.italic, this.t("italic"), () => this.exec("italic"), "italic"),
@@ -4939,16 +5047,16 @@ const I = class I {
4939
5047
  this.ctxBtn(c.link, this.t("linkttl"), () => this.linkDlg()),
4940
5048
  s,
4941
5049
  l,
4942
- n
5050
+ o
4943
5051
  ), t.addEventListener("mousedown", (r) => r.preventDefault()), document.body.appendChild(t), this.syncColorSwatches(t), t;
4944
5052
  }
4945
5053
  positionSelToolbar(t) {
4946
5054
  if (!this.selCtx) return;
4947
- const e = t.getBoundingClientRect(), i = e.top + scrollY, s = e.left + scrollX, l = e.right + scrollX, n = e.bottom + scrollY, o = this.selCtx.offsetWidth, r = this.selCtx.offsetHeight;
4948
- let a = s + (l - s) / 2 - o / 2;
4949
- a = Math.max(8 + scrollX, Math.min(a, scrollX + innerWidth - o - 8));
4950
- let h = i - r - 8;
4951
- h < this.ctxMinTop() && (h = n + 8), this.selCtx.style.left = a + "px", this.selCtx.style.top = h + "px";
5055
+ const e = t.getBoundingClientRect(), i = e.top + scrollY, s = e.left + scrollX, l = e.right + scrollX, o = e.bottom + scrollY, n = this.selCtx.offsetWidth, r = this.selCtx.offsetHeight;
5056
+ let a = s + (l - s) / 2 - n / 2;
5057
+ a = Math.max(8 + scrollX, Math.min(a, scrollX + innerWidth - n - 8));
5058
+ let d = i - r - 8;
5059
+ d < this.ctxMinTop() && (d = o + 8), this.selCtx.style.left = a + "px", this.selCtx.style.top = d + "px";
4952
5060
  }
4953
5061
  repositionSelToolbar() {
4954
5062
  if (!this.selCtx) return;
@@ -4981,7 +5089,7 @@ const I = class I {
4981
5089
  return t > 0 ? t + "px" : "";
4982
5090
  }
4983
5091
  refreshState() {
4984
- var r, a, h;
5092
+ var r, a, d;
4985
5093
  const t = window.getSelection(), e = t ? this.ed.contains(t.anchorNode) : !1, i = this.currentBlock();
4986
5094
  [this.toolbar, this.selCtx].filter(Boolean).forEach((p) => {
4987
5095
  [
@@ -4996,22 +5104,22 @@ const I = class I {
4996
5104
  "insertOrderedList",
4997
5105
  "insertUnorderedList"
4998
5106
  ].forEach((g) => {
4999
- const u = p.querySelector(`[data-id=${g}]`);
5000
- u && u.classList.toggle("on", e && document.queryCommandState(g));
5107
+ const m = p.querySelector(`[data-id=${g}]`);
5108
+ m && m.classList.toggle("on", e && document.queryCommandState(g));
5001
5109
  }), ["h2", "h3", "blockquote"].forEach((g) => {
5002
- const u = p.querySelector(`[data-id=${g}]`);
5003
- u && u.classList.toggle("on", e && i === g);
5110
+ const m = p.querySelector(`[data-id=${g}]`);
5111
+ m && m.classList.toggle("on", e && i === g);
5004
5112
  });
5005
- const m = p.querySelector("[data-id=code]");
5006
- m && m.classList.toggle("on", e && !!this.closestInlineCode());
5113
+ const u = p.querySelector("[data-id=code]");
5114
+ u && u.classList.toggle("on", e && !!this.closestInlineCode());
5007
5115
  });
5008
- const l = t ? this.closestBlock(t.anchorNode) : null, n = ((r = l == null ? void 0 : l.closest("[dir]")) == null ? void 0 : r.getAttribute("dir")) || this.ed.getAttribute("dir") || this.dir();
5009
- (a = this.toolbar.querySelector("[data-id=ltr]")) == null || a.classList.toggle("on", e && n === "ltr"), (h = this.toolbar.querySelector("[data-id=rtl]")) == null || h.classList.toggle("on", e && n === "rtl");
5010
- const o = (p, m, g) => {
5011
- const u = this.toolbar.querySelector(`[data-id=${p}] .lbl`);
5012
- u && (u.textContent = m || g || "", u.classList.toggle("empty", !m));
5116
+ const l = t ? this.closestBlock(t.anchorNode) : null, o = ((r = l == null ? void 0 : l.closest("[dir]")) == null ? void 0 : r.getAttribute("dir")) || this.ed.getAttribute("dir") || this.dir();
5117
+ (a = this.toolbar.querySelector("[data-id=ltr]")) == null || a.classList.toggle("on", e && o === "ltr"), (d = this.toolbar.querySelector("[data-id=rtl]")) == null || d.classList.toggle("on", e && o === "rtl");
5118
+ const n = (p, u, g) => {
5119
+ const m = this.toolbar.querySelector(`[data-id=${p}] .lbl`);
5120
+ m && (m.textContent = u || g || "", m.classList.toggle("empty", !u));
5013
5121
  };
5014
- o("fontsel", this.currentFont()), o("sizesel", this.currentSize().replace("px", "")), e && o("blocksel", X.some((p) => p[0] === i) ? this.blockLabel(i) : this.t("para")), this.sbWords.textContent = this.countWords() + " " + this.t("words");
5122
+ n("fontsel", this.currentFont()), n("sizesel", this.currentSize().replace("px", "")), e && n("blocksel", Q.some((p) => p[0] === i) ? this.blockLabel(i) : this.t("para")), this.sbWords.textContent = this.countWords() + " " + this.t("words");
5015
5123
  }
5016
5124
  countWords() {
5017
5125
  const t = (this.ed.textContent || "").trim();
@@ -5031,13 +5139,13 @@ const I = class I {
5031
5139
  return;
5032
5140
  }
5033
5141
  if (!i) {
5034
- const l = e.getData("text/plain"), n = /^\S+$/.test(l.trim()) ? this.videoEmbedUrl(l.trim()) : null;
5035
- if (n) {
5036
- document.execCommand("insertHTML", !1, this.videoEmbedHTML(n)), this.onChange();
5142
+ const l = e.getData("text/plain"), o = /^\S+$/.test(l.trim()) ? this.videoEmbedUrl(l.trim()) : null;
5143
+ if (o) {
5144
+ document.execCommand("insertHTML", !1, this.videoEmbedHTML(o)), this.onChange();
5037
5145
  return;
5038
5146
  }
5039
5147
  }
5040
- i ? this.pasteRichHTML(i, e, s) : (document.execCommand("insertHTML", !1, kt(e.getData("text/plain"))), this.onChange());
5148
+ i ? this.pasteRichHTML(i, e, s) : (document.execCommand("insertHTML", !1, qt(e.getData("text/plain"))), this.onChange());
5041
5149
  }
5042
5150
  /** Rich-HTML paste. Before the (untouched) paste engine runs, pictures Word left
5043
5151
  * behind as unreadable file:// refs are pulled out of the clipboard's RTF flavor
@@ -5049,19 +5157,19 @@ const I = class I {
5049
5157
  let s = [];
5050
5158
  const l = e.getData("text/rtf");
5051
5159
  if (l) {
5052
- const n = Pt(t, l);
5053
- t = n.html, s = n.injected;
5160
+ const o = $t(t, l);
5161
+ t = o.html, s = o.injected;
5054
5162
  }
5055
- if (i && Rt(t) === 1) {
5056
- const n = i.getAsFile();
5057
- if (n) {
5058
- const o = t;
5163
+ if (i && _t(t) === 1) {
5164
+ const o = i.getAsFile();
5165
+ if (o) {
5166
+ const n = t;
5059
5167
  this.saveSel();
5060
5168
  const r = new FileReader();
5061
5169
  r.onload = () => {
5062
- const a = nt(o, [r.result]);
5170
+ const a = rt(n, [r.result]);
5063
5171
  this.finishRichPaste(a.html, s.concat(a.injected), !0);
5064
- }, r.onerror = () => this.finishRichPaste(o, s, !0), r.readAsDataURL(n);
5172
+ }, r.onerror = () => this.finishRichPaste(n, s, !0), r.readAsDataURL(o);
5065
5173
  return;
5066
5174
  }
5067
5175
  }
@@ -5075,26 +5183,26 @@ const I = class I {
5075
5183
  this.insertPastedHTML(t, i);
5076
5184
  return;
5077
5185
  }
5078
- const s = this.imageUploadHandler, l = e.filter((n, o) => e.indexOf(n) === o);
5186
+ const s = this.imageUploadHandler, l = e.filter((o, n) => e.indexOf(o) === n);
5079
5187
  i || this.saveSel(), Promise.all(
5080
- l.map((n, o) => {
5081
- const r = Dt(n, "pasted-image-" + (o + 1));
5188
+ l.map((o, n) => {
5189
+ const r = zt(o, "pasted-image-" + (n + 1));
5082
5190
  return r ? s(r).catch((a) => {
5083
- var h;
5084
- return (h = this.onImageUploadError) == null || h.call(this, a, r), n;
5085
- }) : Promise.resolve(n);
5191
+ var d;
5192
+ return (d = this.onImageUploadError) == null || d.call(this, a, r), o;
5193
+ }) : Promise.resolve(o);
5086
5194
  })
5087
- ).then((n) => {
5088
- let o = t;
5195
+ ).then((o) => {
5196
+ let n = t;
5089
5197
  l.forEach((r, a) => {
5090
- n[a] !== r && (o = o.split(r).join(n[a]));
5091
- }), this.insertPastedHTML(o, !0);
5198
+ o[a] !== r && (n = n.split(r).join(o[a]));
5199
+ }), this.insertPastedHTML(n, !0);
5092
5200
  });
5093
5201
  }
5094
5202
  /** `deferred` means the insert is happening after an async hop, so the caret the
5095
5203
  * paste started from has to be put back first. */
5096
5204
  insertPastedHTML(t, e = !1) {
5097
- e && this.restoreSel(), document.execCommand("insertHTML", !1, Ht(t, this.dir())), e && this.saveSel(), this.onChange();
5205
+ e && this.restoreSel(), document.execCommand("insertHTML", !1, It(t, this.dir())), e && this.saveSel(), this.onChange();
5098
5206
  }
5099
5207
  /* ---------------------------------------------------------- init */
5100
5208
  initUI() {
@@ -5102,18 +5210,18 @@ const I = class I {
5102
5210
  }
5103
5211
  };
5104
5212
  I.instanceCounter = 0, I.TBR_COLLAPSE_MAX = 992;
5105
- let it = I;
5213
+ let lt = I;
5106
5214
  export {
5107
- X as BLOCKS,
5108
- Jt as CHARS,
5109
- gt as COLORS,
5110
- ht as FONTS,
5111
- it as FableEditor,
5112
- rt as I18N,
5215
+ Q as BLOCKS,
5216
+ ge as CHARS,
5217
+ bt as COLORS,
5218
+ ut as FONTS,
5219
+ lt as FableEditor,
5220
+ ht as I18N,
5113
5221
  c as IC,
5114
- dt as SIZES,
5115
- te as TXT,
5116
- Ht as cleanPastedHTML,
5117
- D as getStrings,
5118
- kt as normalizeTextPaste
5222
+ mt as SIZES,
5223
+ fe as TXT,
5224
+ It as cleanPastedHTML,
5225
+ F as getStrings,
5226
+ qt as normalizeTextPaste
5119
5227
  };