@editora/core 1.0.23 → 1.0.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/dist/{A11yCheckerPlugin.native-qW_njhLY.mjs → A11yCheckerPlugin.native-BBCsR5Ur.mjs} +7 -5
  2. package/dist/{AnchorPlugin.native-Drmxhy98.mjs → AnchorPlugin.native-Dk9R26cF.mjs} +20 -19
  3. package/dist/{ApprovalWorkflowPlugin.native-ZsS_2xmn.mjs → ApprovalWorkflowPlugin.native-AeJsehXM.mjs} +56 -55
  4. package/dist/{BackgroundColorPlugin.native-H3XyYD7_.mjs → BackgroundColorPlugin.native-DCAd94kp.mjs} +103 -98
  5. package/dist/{BlocksLibraryPlugin.native-CownM6Rk.mjs → BlocksLibraryPlugin.native-D9OPcnQV.mjs} +42 -43
  6. package/dist/{CitationsPlugin.native-C_7wWQ-k.mjs → CitationsPlugin.native-BFChgCSV.mjs} +51 -51
  7. package/dist/{CodePlugin.native-DZgIez08.mjs → CodePlugin.native-CPfKDrkr.mjs} +1383 -1094
  8. package/dist/{CodePlugin.native-CAHk9ecG.mjs → CodePlugin.native-CRpX2G93.mjs} +167 -113
  9. package/dist/{CodeSamplePlugin.native-svbAFWh_.mjs → CodeSamplePlugin.native-Bai8bgl3.mjs} +5 -5
  10. package/dist/{CommentsPlugin.native-DncTHiEe.mjs → CommentsPlugin.native-DHCDUm9f.mjs} +161 -141
  11. package/dist/{ConditionalContentPlugin.native-Bf7XgRSW.mjs → ConditionalContentPlugin.native-B3R6xcqn.mjs} +3 -3
  12. package/dist/{ContentRulesPlugin.native-vPx5nC73.mjs → ContentRulesPlugin.native-BISqhQKJ.mjs} +52 -52
  13. package/dist/{DataBindingPlugin.native-B7lpI_0c.mjs → DataBindingPlugin.native-DbaDeXNp.mjs} +37 -37
  14. package/dist/{DocumentManagerPlugin.native-B8K-Oqom.mjs → DocumentManagerPlugin.native-CaBqCH-p.mjs} +21 -20
  15. package/dist/{EmbedIframePlugin.native-BfZ_HGlV.mjs → EmbedIframePlugin.native-qHMf1Jtg.mjs} +7 -7
  16. package/dist/{EmojisPlugin.native-D92aaOKi.mjs → EmojisPlugin.native-B64efKg5.mjs} +4 -4
  17. package/dist/{FormatPainterPlugin.native-BhjzsiVq.mjs → FormatPainterPlugin.native-CAc1N6xU.mjs} +183 -161
  18. package/dist/{HeadingPlugin.native-DZdvubrQ.mjs → HeadingPlugin.native-C3YiGERx.mjs} +85 -72
  19. package/dist/HistoryPlugin.native-C8GyxsgC.mjs +330 -0
  20. package/dist/{LinkPlugin.native-BsQXYsK6.mjs → LinkPlugin.native-Dt_p6Ukb.mjs} +4 -4
  21. package/dist/ListPlugin.native-UYaoRiub.mjs +239 -0
  22. package/dist/{MathPlugin.native-Byo3WL0f.mjs → MathPlugin.native-Cq9WQ7cq.mjs} +148 -130
  23. package/dist/MediaManagerPlugin.native-0YFHZfsb.mjs +4823 -0
  24. package/dist/MediaManagerPlugin.native-mXWWARRX.mjs +4908 -0
  25. package/dist/{MentionPlugin.native-S_lwGZQO.mjs → MentionPlugin.native-Zb1dwdxU.mjs} +304 -300
  26. package/dist/{MergeTagPlugin.native-7-6F3S1Y.mjs → MergeTagPlugin.native-BXkVPvCo.mjs} +6 -4
  27. package/dist/{PIIRedactionPlugin.native-g7j4jOmm.mjs → PIIRedactionPlugin.native-Cm0bpzQb.mjs} +2 -2
  28. package/dist/{PreviewPlugin.native-Dv5OsffK.mjs → PreviewPlugin.native-CrfiwP2J.mjs} +2 -2
  29. package/dist/{SlashCommandsPlugin.native-BDIIwGNs.mjs → SlashCommandsPlugin.native-BzGTRmMB.mjs} +264 -240
  30. package/dist/{SmartPastePlugin.native-BATLCds5.mjs → SmartPastePlugin.native-DnOJhDsf.mjs} +2 -2
  31. package/dist/{SpecialCharactersPlugin.native-CdZoc1GB.mjs → SpecialCharactersPlugin.native-B0XaCfjZ.mjs} +4 -4
  32. package/dist/{SpellCheckPlugin.native-BGm2qPfn.mjs → SpellCheckPlugin.native-BE7os1Xj.mjs} +302 -265
  33. package/dist/{TablePlugin.native-C1YZ372P.mjs → TablePlugin.native-CWxEFpV8.mjs} +159 -136
  34. package/dist/{TemplatePlugin.native-Dwk8TgxI.mjs → TemplatePlugin.native-OD8Wc1R7.mjs} +6 -4
  35. package/dist/{TextColorPlugin.native-KMZ2uzlq.mjs → TextColorPlugin.native-C2IjioNM.mjs} +75 -71
  36. package/dist/{TranslationWorkflowPlugin.native-CZtG--06.mjs → TranslationWorkflowPlugin.native-BGXVJD9f.mjs} +101 -98
  37. package/dist/{VersionDiffPlugin.native-Ca1fMWUJ.mjs → VersionDiffPlugin.native-DJZIzFSK.mjs} +11 -11
  38. package/dist/anchoredPopover-QN4jNbW1.mjs +134 -0
  39. package/dist/confirmDialog-CNqPHT5x.mjs +92 -0
  40. package/dist/dialogHelpers-Dzn8DHoF.mjs +194 -0
  41. package/dist/{documentManager-BWK_-KJp.mjs → documentManager-DHLCoWzw.mjs} +1963 -1969
  42. package/dist/editora.min.js +21 -21
  43. package/dist/editora.umd.js +10 -10
  44. package/dist/index-DHPPVQwx.js +12 -0
  45. package/dist/{index-DGMYWPLx.mjs → index-gI4djib2.mjs} +407 -327
  46. package/dist/index.cjs.js +1 -1
  47. package/dist/index.esm.js +2 -2
  48. package/dist/katex-DLIObQUm.mjs +11683 -0
  49. package/dist/katex.min--Ws3c9be.mjs +6 -0
  50. package/dist/notify-DCQGpmq-.mjs +60 -0
  51. package/dist/plugin-loader.js +54 -54
  52. package/dist/shared-config-DuA34Iii.mjs +26 -0
  53. package/dist/webcomponent-core.js +315 -235
  54. package/dist/webcomponent-core.min.css +1 -1
  55. package/dist/webcomponent-core.min.js +153 -80
  56. package/dist/webcomponent.cjs.js +1 -1
  57. package/dist/webcomponent.esm.js +1 -1
  58. package/dist/webcomponent.js +672 -592
  59. package/dist/webcomponent.min.css +1 -1
  60. package/dist/webcomponent.min.js +3099 -1532
  61. package/package.json +1 -1
  62. package/dist/HistoryPlugin.native-DPvhks6h.mjs +0 -246
  63. package/dist/ListPlugin.native-Bt0LANbO.mjs +0 -139
  64. package/dist/MediaManagerPlugin.native-BT1NZIJS.mjs +0 -998
  65. package/dist/anchoredPopover-DJFD2oAP.mjs +0 -116
  66. package/dist/dialogHelpers-DBf7WqYH.mjs +0 -40
  67. package/dist/index-C1sO7DAC.js +0 -12
@@ -403,13 +403,14 @@ class pn {
403
403
  exportPdf: "exportPdf",
404
404
  insertImage: "insertImage",
405
405
  insertVideo: "insertVideo",
406
+ insertAudio: "insertAudio",
406
407
  codeBlock: "insertCodeBlock"
407
408
  };
408
409
  return o.forEach((c) => {
409
410
  const f = [];
410
- c.split(/\s+/).filter(Boolean).forEach((v) => {
411
- if (v === "direction") {
412
- const w = r.get("setDirectionLTR"), E = r.get("setDirectionRTL");
411
+ c.split(/\s+/).filter(Boolean).forEach((g) => {
412
+ if (g === "direction") {
413
+ const w = r.get("setDirectionLTR"), v = r.get("setDirectionRTL");
413
414
  w && f.push({
414
415
  id: "directionLTR",
415
416
  label: w.label,
@@ -417,18 +418,18 @@ class pn {
417
418
  icon: w.icon,
418
419
  type: w.type || "button",
419
420
  options: w.options
420
- }), E && f.push({
421
+ }), v && f.push({
421
422
  id: "directionRTL",
422
- label: E.label,
423
- command: E.command,
424
- icon: E.icon,
425
- type: E.type || "button",
426
- options: E.options
423
+ label: v.label,
424
+ command: v.command,
425
+ icon: v.icon,
426
+ type: v.type || "button",
427
+ options: v.options
427
428
  });
428
429
  return;
429
430
  }
430
- if (v === "comments") {
431
- const w = r.get("addComment"), E = r.get("toggleComments");
431
+ if (g === "comments") {
432
+ const w = r.get("addComment"), v = r.get("toggleComments");
432
433
  w && f.push({
433
434
  id: "addComment",
434
435
  label: w.label,
@@ -436,26 +437,26 @@ class pn {
436
437
  icon: w.icon,
437
438
  type: w.type || "button",
438
439
  options: w.options
439
- }), E && f.push({
440
+ }), v && f.push({
440
441
  id: "toggleComments",
441
- label: E.label,
442
- command: E.command,
443
- icon: E.icon,
444
- type: E.type || "button",
445
- options: E.options
442
+ label: v.label,
443
+ command: v.command,
444
+ icon: v.icon,
445
+ type: v.type || "button",
446
+ options: v.options
446
447
  });
447
448
  return;
448
449
  }
449
- const A = l[v] || v;
450
- let C = r.get(A);
451
- C || (C = r.get(v)), C && f.push({
452
- id: v,
453
- label: C.label,
454
- command: C.command,
455
- icon: C.icon,
456
- type: C.type === "separator" ? "separator" : C.type || "button",
457
- options: C.options,
458
- items: C.items
450
+ const T = l[g] || g;
451
+ let k = r.get(T);
452
+ k || (k = r.get(g)), k && f.push({
453
+ id: g,
454
+ label: k.label,
455
+ command: k.command,
456
+ icon: k.icon,
457
+ type: k.type === "separator" ? "separator" : k.type || "button",
458
+ options: k.options,
459
+ items: k.items
459
460
  });
460
461
  }), f.length > 0 && e.push(f);
461
462
  }), e;
@@ -499,23 +500,23 @@ class pn {
499
500
  const r = () => {
500
501
  const c = this.overflowUnits;
501
502
  if (c.length === 0) return;
502
- c.forEach((D) => {
503
+ c.forEach((O) => {
503
504
  var N;
504
- D.parentElement === i && ((N = this.overflowUnitHomes.get(D)) == null || N.appendChild(D));
505
+ O.parentElement === i && ((N = this.overflowUnitHomes.get(O)) == null || N.appendChild(O));
505
506
  });
506
- const f = t.clientWidth, m = 16, v = 40, A = 4, C = Math.max(0, f - m - v - A);
507
- let w = 0, E = 0;
508
- for (const D of c) {
509
- const N = D.getBoundingClientRect().width + A;
510
- if (w + N <= C)
511
- w += N, E++;
507
+ const f = t.clientWidth, m = 16, g = 40, T = 4, k = Math.max(0, f - m - g - T);
508
+ let w = 0, v = 0;
509
+ for (const O of c) {
510
+ const N = O.getBoundingClientRect().width + T;
511
+ if (w + N <= k)
512
+ w += N, v++;
512
513
  else
513
514
  break;
514
515
  }
515
- E = Math.max(1, Math.min(E, c.length));
516
- const Y = E < c.length;
517
- o.style.display = Y ? "" : "none", o.classList.toggle("active", Y && this.expandedOpen), !Y && this.expandedOpen && this.setExpandedOpen(!1), c.forEach((D, N) => {
518
- N >= E && i.appendChild(D);
516
+ v = Math.max(1, Math.min(v, c.length));
517
+ const Y = v < c.length;
518
+ o.style.display = Y ? "" : "none", o.classList.toggle("active", Y && this.expandedOpen), !Y && this.expandedOpen && this.setExpandedOpen(!1), c.forEach((O, N) => {
519
+ N >= v && i.appendChild(O);
519
520
  });
520
521
  }, l = () => {
521
522
  this.overflowRafId !== void 0 && cancelAnimationFrame(this.overflowRafId), this.overflowRafId = requestAnimationFrame(r);
@@ -595,6 +596,57 @@ class pn {
595
596
  o.preventDefault(), this.commandHandler && t.command && this.commandHandler(t.command);
596
597
  }), e;
597
598
  }
599
+ /**
600
+ * What a toolbar menu needs besides its look, so it can be used without a mouse: the trigger says it opens a menu
601
+ * and whether it is open, the menu and its items have menu roles, and the keyboard works in it. Enter, Space or an
602
+ * arrow key on the trigger opens it and moves the focus to the first (or, with ArrowUp, the last) item; arrows,
603
+ * Home and End move between items; Escape closes it and gives the focus back to the trigger; Tab closes it. A
604
+ * mouse click leaves the focus alone, so the editor keeps its selection.
605
+ */
606
+ makeMenuAccessible(t, e, o, i) {
607
+ e.setAttribute("aria-haspopup", "menu"), e.setAttribute("aria-expanded", "false"), o.setAttribute("role", "menu"), o.setAttribute("aria-label", i), o.querySelectorAll(".editora-toolbar-dropdown-item").forEach((m) => {
608
+ m.setAttribute("role", "menuitem"), m.tabIndex = -1;
609
+ });
610
+ const r = () => Array.from(o.querySelectorAll('[role="menuitem"]')), l = () => o.style.display === "block", c = new MutationObserver(() => {
611
+ e.setAttribute("aria-expanded", l() ? "true" : "false");
612
+ });
613
+ c.observe(o, { attributes: !0, attributeFilter: ["style"] });
614
+ const f = t._cleanupDropdown;
615
+ t._cleanupDropdown = () => {
616
+ c.disconnect(), f == null || f();
617
+ }, e.addEventListener("click", (m) => {
618
+ var g;
619
+ m.detail === 0 && l() && ((g = r()[0]) == null || g.focus());
620
+ }), e.addEventListener("keydown", (m) => {
621
+ var T;
622
+ if (m.key !== "ArrowDown" && m.key !== "ArrowUp") return;
623
+ m.preventDefault(), l() || e.click();
624
+ const g = r();
625
+ (T = m.key === "ArrowUp" ? g[g.length - 1] : g[0]) == null || T.focus();
626
+ }), o.addEventListener("keydown", (m) => {
627
+ const g = r();
628
+ if (g.length === 0) return;
629
+ const T = g.indexOf(document.activeElement), k = (w) => {
630
+ m.preventDefault(), g[(w + g.length) % g.length].focus();
631
+ };
632
+ switch (m.key) {
633
+ case "ArrowDown":
634
+ return k(T + 1);
635
+ case "ArrowUp":
636
+ return k(T < 0 ? g.length - 1 : T - 1);
637
+ case "Home":
638
+ return k(0);
639
+ case "End":
640
+ return k(g.length - 1);
641
+ case "Escape":
642
+ m.preventDefault(), m.stopPropagation(), o.style.display = "none", e.focus();
643
+ return;
644
+ case "Tab":
645
+ o.style.display = "none";
646
+ return;
647
+ }
648
+ });
649
+ }
598
650
  /**
599
651
  * Create a dropdown element
600
652
  */
@@ -621,7 +673,7 @@ class pn {
621
673
  };
622
674
  return document.addEventListener("mousedown", r, !0), document.addEventListener("keydown", l), e._cleanupDropdown = () => {
623
675
  document.removeEventListener("mousedown", r, !0), document.removeEventListener("keydown", l);
624
- }, e.appendChild(o), e.appendChild(i), e;
676
+ }, e.appendChild(o), e.appendChild(i), this.makeMenuAccessible(e, o, i, t.label), e;
625
677
  }
626
678
  /**
627
679
  * Create an inline menu element (like dropdown but triggered by button click)
@@ -650,8 +702,8 @@ class pn {
650
702
  const f = (m = this.container) == null ? void 0 : m.querySelectorAll(
651
703
  ".editora-toolbar-dropdown-menu"
652
704
  );
653
- f == null || f.forEach((v) => {
654
- v !== i && (v.style.display = "none");
705
+ f == null || f.forEach((g) => {
706
+ g !== i && (g.style.display = "none");
655
707
  }), i.style.display = i.style.display === "none" ? "block" : "none";
656
708
  });
657
709
  const r = (c) => {
@@ -661,7 +713,7 @@ class pn {
661
713
  };
662
714
  return document.addEventListener("mousedown", r, !0), document.addEventListener("keydown", l), e._cleanupDropdown = () => {
663
715
  document.removeEventListener("mousedown", r, !0), document.removeEventListener("keydown", l);
664
- }, e.appendChild(o), e.appendChild(i), e;
716
+ }, e.appendChild(o), e.appendChild(i), this.makeMenuAccessible(e, o, i, t.label), e;
665
717
  }
666
718
  /**
667
719
  * Get default toolbar string if none provided
@@ -1195,8 +1247,8 @@ function Tn(a, t) {
1195
1247
  var o, i, r, l, c = [], f = !0, m = !1;
1196
1248
  try {
1197
1249
  if (r = (e = e.call(a)).next, t !== 0) for (; !(f = (o = r.call(e)).done) && (c.push(o.value), c.length !== t); f = !0) ;
1198
- } catch (v) {
1199
- m = !0, i = v;
1250
+ } catch (g) {
1251
+ m = !0, i = g;
1200
1252
  } finally {
1201
1253
  try {
1202
1254
  if (!f && e.return != null && (l = e.return(), Object(l) !== l)) return;
@@ -1237,7 +1289,7 @@ Te || (Te = function(t) {
1237
1289
  for (var e = arguments.length, o = new Array(e > 1 ? e - 1 : 0), i = 1; i < e; i++) o[i - 1] = arguments[i];
1238
1290
  return new t(...o);
1239
1291
  });
1240
- const rt = L(Array.prototype.forEach), Ln = L(Array.prototype.lastIndexOf), so = L(Array.prototype.pop), kt = L(Array.prototype.push), Mn = L(Array.prototype.splice), bt = Array.isArray, _t = L(String.prototype.toLowerCase), fe = L(String.prototype.toString), lo = L(String.prototype.match), xt = L(String.prototype.replace), co = L(String.prototype.indexOf), In = L(String.prototype.trim), On = L(Number.prototype.toString), Dn = L(Boolean.prototype.toString), uo = typeof BigInt == "undefined" ? null : L(BigInt.prototype.toString), po = typeof Symbol == "undefined" ? null : L(Symbol.prototype.toString), z = L(Object.prototype.hasOwnProperty), At = L(Object.prototype.toString), O = L(RegExp.prototype.test), Z = Rn(TypeError);
1292
+ const rt = L(Array.prototype.forEach), Ln = L(Array.prototype.lastIndexOf), so = L(Array.prototype.pop), kt = L(Array.prototype.push), Mn = L(Array.prototype.splice), bt = Array.isArray, _t = L(String.prototype.toLowerCase), fe = L(String.prototype.toString), lo = L(String.prototype.match), xt = L(String.prototype.replace), co = L(String.prototype.indexOf), In = L(String.prototype.trim), Dn = L(Number.prototype.toString), On = L(Boolean.prototype.toString), uo = typeof BigInt == "undefined" ? null : L(BigInt.prototype.toString), po = typeof Symbol == "undefined" ? null : L(Symbol.prototype.toString), z = L(Object.prototype.hasOwnProperty), At = L(Object.prototype.toString), D = L(RegExp.prototype.test), Z = Rn(TypeError);
1241
1293
  function L(a) {
1242
1294
  return function(t) {
1243
1295
  t instanceof RegExp && (t.lastIndex = 0);
@@ -1251,7 +1303,7 @@ function Rn(a) {
1251
1303
  return Te(a, e);
1252
1304
  };
1253
1305
  }
1254
- function y(a, t) {
1306
+ function E(a, t) {
1255
1307
  let e = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : _t;
1256
1308
  if (ao && ao(a, null), !bt(t)) return a;
1257
1309
  let o = t.length;
@@ -1269,12 +1321,12 @@ function Nn(a) {
1269
1321
  for (let t = 0; t < a.length; t++) z(a, t) || (a[t] = null);
1270
1322
  return a;
1271
1323
  }
1272
- function H(a) {
1324
+ function F(a) {
1273
1325
  const t = gt(null);
1274
1326
  for (const o of So(a)) {
1275
1327
  var e = xn(o, 2);
1276
1328
  const i = e[0], r = e[1];
1277
- z(a, i) && (bt(r) ? t[i] = Nn(r) : r && typeof r == "object" && r.constructor === Object ? t[i] = H(r) : t[i] = r);
1329
+ z(a, i) && (bt(r) ? t[i] = Nn(r) : r && typeof r == "object" && r.constructor === Object ? t[i] = F(r) : t[i] = r);
1278
1330
  }
1279
1331
  return t;
1280
1332
  }
@@ -1283,9 +1335,9 @@ function Pn(a) {
1283
1335
  case "string":
1284
1336
  return a;
1285
1337
  case "number":
1286
- return On(a);
1287
- case "boolean":
1288
1338
  return Dn(a);
1339
+ case "boolean":
1340
+ return On(a);
1289
1341
  case "bigint":
1290
1342
  return uo ? uo(a) : "0";
1291
1343
  case "symbol":
@@ -1322,7 +1374,7 @@ function j(a, t) {
1322
1374
  }
1323
1375
  function zn(a) {
1324
1376
  try {
1325
- return O(a, ""), !0;
1377
+ return D(a, ""), !0;
1326
1378
  } catch (t) {
1327
1379
  return !1;
1328
1380
  }
@@ -1521,7 +1573,7 @@ const fo = M([
1521
1573
  "feSpotLight",
1522
1574
  "feTile",
1523
1575
  "feTurbulence"
1524
- ]), Bn = M([
1576
+ ]), Hn = M([
1525
1577
  "animate",
1526
1578
  "color-profile",
1527
1579
  "cursor",
@@ -1575,7 +1627,7 @@ const fo = M([
1575
1627
  "munder",
1576
1628
  "munderover",
1577
1629
  "mprescripts"
1578
- ]), Fn = M([
1630
+ ]), Bn = M([
1579
1631
  "maction",
1580
1632
  "maligngroup",
1581
1633
  "malignmark",
@@ -1964,7 +2016,7 @@ const fo = M([
1964
2016
  "xlink:title",
1965
2017
  "xml:space",
1966
2018
  "xmlns:xlink"
1967
- ]), Hn = I(/{{[\w\W]*|^[\w\W]*}}/g), Un = I(/<%[\w\W]*|^[\w\W]*%>/g), jn = I(/\${[\w\W]*/g), Wn = I(/^data-[\-\w.\u00B7-\uFFFF]+$/), $n = I(/^aria-[\-\w]+$/), bo = I(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i), Gn = I(/^(?:\w+script|data):/i), Kn = I(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g), Yn = I(/^html$/i), qn = I(/^[a-z][.\w]*(-[.\w]+)+$/i), yo = I(/<[/\w!]/g), Eo = I(/<[/\w]/g), Vn = I(/<\/no(script|embed|frames)/i), Xn = I(/\/>/i), F = {
2019
+ ]), Fn = I(/{{[\w\W]*|^[\w\W]*}}/g), Un = I(/<%[\w\W]*|^[\w\W]*%>/g), jn = I(/\${[\w\W]*/g), Wn = I(/^data-[\-\w.\u00B7-\uFFFF]+$/), $n = I(/^aria-[\-\w]+$/), bo = I(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i), Gn = I(/^(?:\w+script|data):/i), Kn = I(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g), Yn = I(/^html$/i), qn = I(/^[a-z][.\w]*(-[.\w]+)+$/i), yo = I(/<[/\w!]/g), Eo = I(/<[/\w]/g), Vn = I(/<\/no(script|embed|frames)/i), Xn = I(/\/>/i), B = {
1968
2020
  element: 1,
1969
2021
  attribute: 2,
1970
2022
  text: 3,
@@ -1986,7 +2038,7 @@ const fo = M([
1986
2038
  "noframes",
1987
2039
  "plaintext",
1988
2040
  "noscript"
1989
- ], Zn = M(y({}, Lo)), Jn = (function() {
2041
+ ], Zn = M(E({}, Lo)), Jn = (function() {
1990
2042
  const a = {};
1991
2043
  return rt(Lo, (t) => {
1992
2044
  a[t] = I(new RegExp("</" + t + "(?=[\\t\\n\\f\\r />])", "i"));
@@ -2024,22 +2076,22 @@ const fo = M([
2024
2076
  uponSanitizeShadowNode: []
2025
2077
  };
2026
2078
  }, J = function(t, e, o, i) {
2027
- return z(t, e) && bt(t[e]) ? y(i.base ? H(i.base) : {}, t[e], i.transform) : o;
2079
+ return z(t, e) && bt(t[e]) ? E(i.base ? F(i.base) : {}, t[e], i.transform) : o;
2028
2080
  }, ye = function(t, e, o) {
2029
2081
  const i = z(t, e) ? t[e] : void 0;
2030
- return i && typeof i == "object" ? H(i) : o();
2082
+ return i && typeof i == "object" ? F(i) : o();
2031
2083
  };
2032
2084
  function Mo() {
2033
2085
  let a = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : Qn();
2034
2086
  const t = (u) => Mo(u);
2035
- if (t.version = "3.4.16", t.removed = [], !a || !a.document || a.document.nodeType !== F.document || !a.Element)
2087
+ if (t.version = "3.4.16", t.removed = [], !a || !a.document || a.document.nodeType !== B.document || !a.Element)
2036
2088
  return t.isSupported = !1, t;
2037
2089
  let e = a.document;
2038
2090
  const o = e, i = o.currentScript;
2039
2091
  a.DocumentFragment;
2040
2092
  const r = a.HTMLTemplateElement, l = a.Node, c = a.Element, f = a.NodeFilter;
2041
2093
  a.NamedNodeMap === void 0 && (a.NamedNodeMap || a.MozNamedAttrMap), a.HTMLFormElement;
2042
- const m = a.DOMParser, v = a.trustedTypes, A = c.prototype, C = j(A, "cloneNode"), w = j(A, "remove"), E = j(A, "removeAttributeNode"), Y = j(A, "nextSibling"), D = j(A, "childNodes"), N = j(A, "parentNode"), Ce = j(A, "shadowRoot"), qt = j(A, "attributes"), tt = l && l.prototype ? j(l.prototype, "nodeType") : null, at = l && l.prototype ? j(l.prototype, "nodeName") : null, Lt = l && l.prototype ? j(l.prototype, "ownerDocument") : null, yt = function(n) {
2094
+ const m = a.DOMParser, g = a.trustedTypes, T = c.prototype, k = j(T, "cloneNode"), w = j(T, "remove"), v = j(T, "removeAttributeNode"), Y = j(T, "nextSibling"), O = j(T, "childNodes"), N = j(T, "parentNode"), Ce = j(T, "shadowRoot"), qt = j(T, "attributes"), tt = l && l.prototype ? j(l.prototype, "nodeType") : null, at = l && l.prototype ? j(l.prototype, "nodeName") : null, Lt = l && l.prototype ? j(l.prototype, "ownerDocument") : null, yt = function(n) {
2043
2095
  return tt ? tt(n) : n.nodeType;
2044
2096
  }, Vt = function(n) {
2045
2097
  return at ? at(n) : n.nodeName;
@@ -2058,7 +2110,7 @@ function Mo() {
2058
2110
  } finally {
2059
2111
  Et--;
2060
2112
  }
2061
- }, Do = function(n) {
2113
+ }, Oo = function(n) {
2062
2114
  _e(), Et++;
2063
2115
  try {
2064
2116
  return P.createScriptURL(n);
@@ -2066,21 +2118,21 @@ function Mo() {
2066
2118
  Et--;
2067
2119
  }
2068
2120
  }, Ro = function() {
2069
- return Se || (Xt = ti(v, i), Se = !0), Xt;
2121
+ return Se || (Xt = ti(g, i), Se = !0), Xt;
2070
2122
  }, Mt = e, Zt = Mt.implementation, Le = Mt.createNodeIterator, No = Mt.createDocumentFragment, Po = Mt.getElementsByTagName, zo = o.importNode;
2071
- let T = vo();
2123
+ let x = vo();
2072
2124
  t.isSupported = typeof So == "function" && typeof N == "function" && Zt && Zt.createHTMLDocument !== void 0;
2073
- const Bo = Hn, Fo = Un, Ho = jn, Uo = Wn, jo = $n, Wo = Gn, Me = Kn, $o = qn;
2074
- let Ie = bo, k = null;
2075
- const Jt = y({}, [
2125
+ const Ho = Fn, Bo = Un, Fo = jn, Uo = Wn, jo = $n, Wo = Gn, Me = Kn, $o = qn;
2126
+ let Ie = bo, A = null;
2127
+ const Jt = E({}, [
2076
2128
  ...fo,
2077
2129
  ...he,
2078
2130
  ...me,
2079
2131
  ...ge,
2080
2132
  ...ho
2081
2133
  ]);
2082
- let x = null;
2083
- const Qt = y({}, [
2134
+ let C = null;
2135
+ const Qt = E({}, [
2084
2136
  ...mo,
2085
2137
  ...be,
2086
2138
  ...go,
@@ -2105,7 +2157,7 @@ function Mo() {
2105
2157
  enumerable: !0,
2106
2158
  value: !1
2107
2159
  }
2108
- })), vt = null, Oe = null;
2160
+ })), vt = null, De = null;
2109
2161
  const q = Object.seal(gt(null, {
2110
2162
  tagCheck: {
2111
2163
  writable: !0,
@@ -2120,10 +2172,10 @@ function Mo() {
2120
2172
  value: null
2121
2173
  }
2122
2174
  }));
2123
- let De = !0, te = !0, Re = !1, Ne = !0, V = !1, ot = !0, nt = !1, ee = !1, It = null, Ot = null, oe = !1, lt = !1, Dt = !1, Rt = !1, Pe = !0, ze = !1;
2124
- const Be = "user-content-";
2175
+ let Oe = !0, te = !0, Re = !1, Ne = !0, V = !1, ot = !0, nt = !1, ee = !1, It = null, Dt = null, oe = !1, lt = !1, Ot = !1, Rt = !1, Pe = !0, ze = !1;
2176
+ const He = "user-content-";
2125
2177
  let ne = !0, ie = !1, ct = {}, dt = null;
2126
- const Fe = y({}, [
2178
+ const Be = E({}, [
2127
2179
  "annotation-xml",
2128
2180
  "audio",
2129
2181
  "colgroup",
@@ -2151,8 +2203,8 @@ function Mo() {
2151
2203
  "video",
2152
2204
  "xmp"
2153
2205
  ]);
2154
- let He = null;
2155
- const Ue = y({}, [
2206
+ let Fe = null;
2207
+ const Ue = E({}, [
2156
2208
  "audio",
2157
2209
  "video",
2158
2210
  "img",
@@ -2161,7 +2213,7 @@ function Mo() {
2161
2213
  "track"
2162
2214
  ]);
2163
2215
  let je = null;
2164
- const We = y({}, [
2216
+ const We = E({}, [
2165
2217
  "alt",
2166
2218
  "class",
2167
2219
  "for",
@@ -2178,7 +2230,7 @@ function Mo() {
2178
2230
  "xmlns"
2179
2231
  ]), Nt = "http://www.w3.org/1998/Math/MathML", Pt = "http://www.w3.org/2000/svg", $ = "http://www.w3.org/1999/xhtml";
2180
2232
  let ut = $, re = !1, ae = null;
2181
- const Go = y({}, [
2233
+ const Go = E({}, [
2182
2234
  Nt,
2183
2235
  Pt,
2184
2236
  $
@@ -2189,10 +2241,10 @@ function Mo() {
2189
2241
  "ms",
2190
2242
  "mtext"
2191
2243
  ]);
2192
- let se = y({}, $e);
2244
+ let se = E({}, $e);
2193
2245
  const Ge = M(["annotation-xml"]);
2194
- let le = y({}, Ge);
2195
- const Ko = y({}, [
2246
+ let le = E({}, Ge);
2247
+ const Ko = E({}, [
2196
2248
  "title",
2197
2249
  "style",
2198
2250
  "font",
@@ -2207,19 +2259,19 @@ function Mo() {
2207
2259
  }, ce = function() {
2208
2260
  let n = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
2209
2261
  if (pt && pt === n) return;
2210
- (!n || typeof n != "object") && (n = {}), n = H(n), wt = Yo.indexOf(n.PARSER_MEDIA_TYPE) === -1 ? qo : n.PARSER_MEDIA_TYPE, _ = wt === "application/xhtml+xml" ? fe : _t, k = J(n, "ALLOWED_TAGS", Jt, { transform: _ }), x = J(n, "ALLOWED_ATTR", Qt, { transform: _ }), ae = J(n, "ALLOWED_NAMESPACES", Go, { transform: fe }), je = J(n, "ADD_URI_SAFE_ATTR", We, {
2262
+ (!n || typeof n != "object") && (n = {}), n = F(n), wt = Yo.indexOf(n.PARSER_MEDIA_TYPE) === -1 ? qo : n.PARSER_MEDIA_TYPE, _ = wt === "application/xhtml+xml" ? fe : _t, A = J(n, "ALLOWED_TAGS", Jt, { transform: _ }), C = J(n, "ALLOWED_ATTR", Qt, { transform: _ }), ae = J(n, "ALLOWED_NAMESPACES", Go, { transform: fe }), je = J(n, "ADD_URI_SAFE_ATTR", We, {
2211
2263
  transform: _,
2212
2264
  base: We
2213
- }), He = J(n, "ADD_DATA_URI_TAGS", Ue, {
2265
+ }), Fe = J(n, "ADD_DATA_URI_TAGS", Ue, {
2214
2266
  transform: _,
2215
2267
  base: Ue
2216
- }), dt = J(n, "FORBID_CONTENTS", Fe, { transform: _ }), vt = J(n, "FORBID_TAGS", H({}), { transform: _ }), Oe = J(n, "FORBID_ATTR", H({}), { transform: _ }), ct = z(n, "USE_PROFILES") ? n.USE_PROFILES && typeof n.USE_PROFILES == "object" ? H(n.USE_PROFILES) : n.USE_PROFILES : !1, De = n.ALLOW_ARIA_ATTR !== !1, te = n.ALLOW_DATA_ATTR !== !1, Re = n.ALLOW_UNKNOWN_PROTOCOLS || !1, Ne = n.ALLOW_SELF_CLOSE_IN_ATTR !== !1, V = n.SAFE_FOR_TEMPLATES || !1, ot = n.SAFE_FOR_XML !== !1, nt = n.WHOLE_DOCUMENT || !1, lt = n.RETURN_DOM || !1, Dt = n.RETURN_DOM_FRAGMENT || !1, Rt = n.RETURN_TRUSTED_TYPE || !1, oe = n.FORCE_BODY || !1, Pe = n.SANITIZE_DOM !== !1, ze = n.SANITIZE_NAMED_PROPS || !1, ne = n.KEEP_CONTENT !== !1, ie = n.IN_PLACE || !1, Ie = zn(n.ALLOWED_URI_REGEXP) ? n.ALLOWED_URI_REGEXP : bo, ut = typeof n.NAMESPACE == "string" ? n.NAMESPACE : $, se = ye(n, "MATHML_TEXT_INTEGRATION_POINTS", () => y({}, $e)), le = ye(n, "HTML_INTEGRATION_POINTS", () => y({}, Ge));
2268
+ }), dt = J(n, "FORBID_CONTENTS", Be, { transform: _ }), vt = J(n, "FORBID_TAGS", F({}), { transform: _ }), De = J(n, "FORBID_ATTR", F({}), { transform: _ }), ct = z(n, "USE_PROFILES") ? n.USE_PROFILES && typeof n.USE_PROFILES == "object" ? F(n.USE_PROFILES) : n.USE_PROFILES : !1, Oe = n.ALLOW_ARIA_ATTR !== !1, te = n.ALLOW_DATA_ATTR !== !1, Re = n.ALLOW_UNKNOWN_PROTOCOLS || !1, Ne = n.ALLOW_SELF_CLOSE_IN_ATTR !== !1, V = n.SAFE_FOR_TEMPLATES || !1, ot = n.SAFE_FOR_XML !== !1, nt = n.WHOLE_DOCUMENT || !1, lt = n.RETURN_DOM || !1, Ot = n.RETURN_DOM_FRAGMENT || !1, Rt = n.RETURN_TRUSTED_TYPE || !1, oe = n.FORCE_BODY || !1, Pe = n.SANITIZE_DOM !== !1, ze = n.SANITIZE_NAMED_PROPS || !1, ne = n.KEEP_CONTENT !== !1, ie = n.IN_PLACE || !1, Ie = zn(n.ALLOWED_URI_REGEXP) ? n.ALLOWED_URI_REGEXP : bo, ut = typeof n.NAMESPACE == "string" ? n.NAMESPACE : $, se = ye(n, "MATHML_TEXT_INTEGRATION_POINTS", () => E({}, $e)), le = ye(n, "HTML_INTEGRATION_POINTS", () => E({}, Ge));
2217
2269
  const s = ye(n, "CUSTOM_ELEMENT_HANDLING", () => gt(null));
2218
- if (W = gt(null), z(s, "tagNameCheck") && Ke(s.tagNameCheck) && (W.tagNameCheck = s.tagNameCheck), z(s, "attributeNameCheck") && Ke(s.attributeNameCheck) && (W.attributeNameCheck = s.attributeNameCheck), z(s, "allowCustomizedBuiltInElements") && typeof s.allowCustomizedBuiltInElements == "boolean" && (W.allowCustomizedBuiltInElements = s.allowCustomizedBuiltInElements), I(W), V && (te = !1), Dt && (lt = !0), ct && (k = y({}, ho), x = gt(null), ct.html === !0 && (y(k, fo), y(x, mo)), ct.svg === !0 && (y(k, he), y(x, be), y(x, Wt)), ct.svgFilters === !0 && (y(k, me), y(x, be), y(x, Wt)), ct.mathMl === !0 && (y(k, ge), y(x, go), y(x, Wt))), q.tagCheck = null, q.attributeCheck = null, z(n, "ADD_TAGS") && (typeof n.ADD_TAGS == "function" ? q.tagCheck = n.ADD_TAGS : bt(n.ADD_TAGS) && (k === Jt && (k = H(k)), y(k, n.ADD_TAGS, _))), z(n, "ADD_ATTR") && (typeof n.ADD_ATTR == "function" ? q.attributeCheck = n.ADD_ATTR : bt(n.ADD_ATTR) && (x === Qt && (x = H(x)), y(x, n.ADD_ATTR, _))), z(n, "ADD_FORBID_CONTENTS") && bt(n.ADD_FORBID_CONTENTS) && (dt === Fe && (dt = H(dt)), y(dt, n.ADD_FORBID_CONTENTS, _)), ne && (k["#text"] = !0), nt && y(k, [
2270
+ if (W = gt(null), z(s, "tagNameCheck") && Ke(s.tagNameCheck) && (W.tagNameCheck = s.tagNameCheck), z(s, "attributeNameCheck") && Ke(s.attributeNameCheck) && (W.attributeNameCheck = s.attributeNameCheck), z(s, "allowCustomizedBuiltInElements") && typeof s.allowCustomizedBuiltInElements == "boolean" && (W.allowCustomizedBuiltInElements = s.allowCustomizedBuiltInElements), I(W), V && (te = !1), Ot && (lt = !0), ct && (A = E({}, ho), C = gt(null), ct.html === !0 && (E(A, fo), E(C, mo)), ct.svg === !0 && (E(A, he), E(C, be), E(C, Wt)), ct.svgFilters === !0 && (E(A, me), E(C, be), E(C, Wt)), ct.mathMl === !0 && (E(A, ge), E(C, go), E(C, Wt))), q.tagCheck = null, q.attributeCheck = null, z(n, "ADD_TAGS") && (typeof n.ADD_TAGS == "function" ? q.tagCheck = n.ADD_TAGS : bt(n.ADD_TAGS) && (A === Jt && (A = F(A)), E(A, n.ADD_TAGS, _))), z(n, "ADD_ATTR") && (typeof n.ADD_ATTR == "function" ? q.attributeCheck = n.ADD_ATTR : bt(n.ADD_ATTR) && (C === Qt && (C = F(C)), E(C, n.ADD_ATTR, _))), z(n, "ADD_FORBID_CONTENTS") && bt(n.ADD_FORBID_CONTENTS) && (dt === Be && (dt = F(dt)), E(dt, n.ADD_FORBID_CONTENTS, _)), ne && (A["#text"] = !0), nt && E(A, [
2219
2271
  "html",
2220
2272
  "head",
2221
2273
  "body"
2222
- ]), k.table && (y(k, ["tbody"]), delete vt.tbody), n.TRUSTED_TYPES_POLICY) {
2274
+ ]), A.table && (E(A, ["tbody"]), delete vt.tbody), n.TRUSTED_TYPES_POLICY) {
2223
2275
  if (typeof n.TRUSTED_TYPES_POLICY.createHTML != "function") throw Z('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');
2224
2276
  if (typeof n.TRUSTED_TYPES_POLICY.createScriptURL != "function") throw Z('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
2225
2277
  const d = P;
@@ -2231,11 +2283,11 @@ function Mo() {
2231
2283
  }
2232
2284
  } else n.TRUSTED_TYPES_POLICY === null ? (P = void 0, et = "") : (P === void 0 && (P = Ro()), P && typeof et == "string" && (et = st("")));
2233
2285
  M && M(n), pt = n;
2234
- }, Ye = y({}, [
2286
+ }, Ye = E({}, [
2235
2287
  ...he,
2236
2288
  ...me,
2237
- ...Bn
2238
- ]), qe = y({}, [...ge, ...Fn]), Xo = function(n, s, d) {
2289
+ ...Hn
2290
+ ]), qe = E({}, [...ge, ...Bn]), Xo = function(n, s, d) {
2239
2291
  return s.namespaceURI === $ ? n === "svg" : s.namespaceURI === Nt ? n === "svg" && (d === "annotation-xml" || se[d]) : !!Ye[n];
2240
2292
  }, Zo = function(n, s, d) {
2241
2293
  return s.namespaceURI === $ ? n === "math" : s.namespaceURI === Pt ? n === "math" && le[d] : !!qe[n];
@@ -2258,7 +2310,7 @@ function Mo() {
2258
2310
  }
2259
2311
  }, Ve = function(n, s, d) {
2260
2312
  try {
2261
- E(n, s);
2313
+ v(n, s);
2262
2314
  } catch (p) {
2263
2315
  try {
2264
2316
  n.removeAttribute(d);
@@ -2266,8 +2318,8 @@ function Mo() {
2266
2318
  }
2267
2319
  }
2268
2320
  }, zt = function(n) {
2269
- Bt(n);
2270
- const s = D(n);
2321
+ Ht(n);
2322
+ const s = O(n);
2271
2323
  if (s) {
2272
2324
  const p = [];
2273
2325
  rt(s, (h) => {
@@ -2275,14 +2327,14 @@ function Mo() {
2275
2327
  }), rt(p, (h) => {
2276
2328
  try {
2277
2329
  w(h);
2278
- } catch (g) {
2330
+ } catch (b) {
2279
2331
  }
2280
2332
  });
2281
2333
  }
2282
2334
  const d = qt(n);
2283
2335
  if (d) for (let p = d.length - 1; p >= 0; --p) {
2284
- const h = d[p], g = h && h.name;
2285
- typeof g == "string" && Ve(n, h, g);
2336
+ const h = d[p], b = h && h.name;
2337
+ typeof b == "string" && Ve(n, h, b);
2286
2338
  }
2287
2339
  }, it = function(n, s, d) {
2288
2340
  if (!d) try {
@@ -2295,7 +2347,7 @@ function Mo() {
2295
2347
  from: s
2296
2348
  });
2297
2349
  try {
2298
- d ? E(s, d) : s.removeAttribute(n);
2350
+ d ? v(s, d) : s.removeAttribute(n);
2299
2351
  } catch (p) {
2300
2352
  try {
2301
2353
  s.removeAttribute(n);
@@ -2303,7 +2355,7 @@ function Mo() {
2303
2355
  }
2304
2356
  }
2305
2357
  if (n === "is")
2306
- if (lt || Dt) try {
2358
+ if (lt || Ot) try {
2307
2359
  X(s);
2308
2360
  } catch (p) {
2309
2361
  }
@@ -2316,14 +2368,14 @@ function Mo() {
2316
2368
  if (s)
2317
2369
  for (let d = s.length - 1; d >= 0; --d) {
2318
2370
  const p = s[d], h = p && p.name;
2319
- typeof h != "string" || x[_(h)] || Ve(n, p, h);
2371
+ typeof h != "string" || C[_(h)] || Ve(n, p, h);
2320
2372
  }
2321
- }, Bt = function(n) {
2373
+ }, Ht = function(n) {
2322
2374
  const s = [n];
2323
2375
  for (; s.length > 0; ) {
2324
2376
  const d = s.pop();
2325
- yt(d) === F.element && tn(d);
2326
- const p = D(d);
2377
+ yt(d) === B.element && tn(d);
2378
+ const p = O(d);
2327
2379
  if (p) for (let h = p.length - 1; h >= 0; --h) s.push(p[h]);
2328
2380
  }
2329
2381
  }, Xe = function(n, s) {
@@ -2333,41 +2385,41 @@ function Mo() {
2333
2385
  const s = [n];
2334
2386
  for (; s.length > 0; ) {
2335
2387
  const d = s.pop(), p = yt(d);
2336
- if (p === F.processingInstruction || p === F.comment && O(Eo, d.data)) {
2388
+ if (p === B.processingInstruction || p === B.comment && D(Eo, d.data)) {
2337
2389
  try {
2338
2390
  w(d);
2339
- } catch (g) {
2391
+ } catch (b) {
2340
2392
  }
2341
2393
  continue;
2342
2394
  }
2343
- if (p === F.element) {
2344
- const g = d, b = _(Vt(d));
2395
+ if (p === B.element) {
2396
+ const b = d, y = _(Vt(d));
2345
2397
  try {
2346
- g.hasAttribute && g.hasAttribute("patchsrc") && g.removeAttribute("patchsrc"), g.hasAttribute && g.hasAttribute("for") && Xe("for", b) && g.removeAttribute("for");
2398
+ b.hasAttribute && b.hasAttribute("patchsrc") && b.removeAttribute("patchsrc"), b.hasAttribute && b.hasAttribute("for") && Xe("for", y) && b.removeAttribute("for");
2347
2399
  } catch (S) {
2348
2400
  }
2349
2401
  }
2350
- const h = D(d);
2351
- if (h) for (let g = h.length - 1; g >= 0; --g) s.push(h[g]);
2402
+ const h = O(d);
2403
+ if (h) for (let b = h.length - 1; b >= 0; --b) s.push(h[b]);
2352
2404
  }
2353
2405
  }, Ze = function(n) {
2354
2406
  let s = null, d = null;
2355
2407
  if (oe) n = "<remove></remove>" + n;
2356
2408
  else {
2357
- const g = lo(n, /^[\r\n\t ]+/);
2358
- d = g && g[0];
2409
+ const b = lo(n, /^[\r\n\t ]+/);
2410
+ d = b && b[0];
2359
2411
  }
2360
2412
  wt === "application/xhtml+xml" && ut === $ && (n = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + n + "</body></html>");
2361
2413
  const p = P ? st(n) : n;
2362
2414
  if (ut === $) try {
2363
2415
  s = new m().parseFromString(p, wt);
2364
- } catch (g) {
2416
+ } catch (b) {
2365
2417
  }
2366
2418
  if (!s || !s.documentElement) {
2367
2419
  s = Zt.createDocument(ut, "template", null);
2368
2420
  try {
2369
2421
  s.documentElement.innerHTML = re ? et : p;
2370
- } catch (g) {
2422
+ } catch (b) {
2371
2423
  }
2372
2424
  }
2373
2425
  const h = s.body || s.documentElement;
@@ -2375,26 +2427,26 @@ function Mo() {
2375
2427
  }, Je = function(n) {
2376
2428
  const s = Lt ? Lt(n) : n.ownerDocument;
2377
2429
  return Le.call(s || n, n, f.SHOW_ELEMENT | f.SHOW_COMMENT | f.SHOW_TEXT | f.SHOW_PROCESSING_INSTRUCTION | f.SHOW_CDATA_SECTION, null);
2378
- }, Ft = function(n) {
2379
- return n = xt(n, Bo, " "), n = xt(n, Fo, " "), n = xt(n, Ho, " "), n;
2430
+ }, Bt = function(n) {
2431
+ return n = xt(n, Ho, " "), n = xt(n, Bo, " "), n = xt(n, Fo, " "), n;
2380
2432
  }, de = function(n) {
2381
2433
  var s;
2382
2434
  n.normalize();
2383
2435
  const d = Lt ? Lt(n) : n.ownerDocument, p = Le.call(d || n, n, f.SHOW_TEXT | f.SHOW_COMMENT | f.SHOW_CDATA_SECTION | f.SHOW_PROCESSING_INSTRUCTION, null);
2384
2436
  let h = p.nextNode();
2385
2437
  for (; h; )
2386
- h.data = Ft(h.data), h = p.nextNode();
2387
- const g = (s = n.querySelectorAll) === null || s === void 0 ? void 0 : s.call(n, "template");
2388
- g && rt(g, (b) => {
2389
- ft(b.content) && de(b.content);
2438
+ h.data = Bt(h.data), h = p.nextNode();
2439
+ const b = (s = n.querySelectorAll) === null || s === void 0 ? void 0 : s.call(n, "template");
2440
+ b && rt(b, (y) => {
2441
+ ft(y.content) && de(y.content);
2390
2442
  });
2391
- }, Ht = function(n) {
2443
+ }, Ft = function(n) {
2392
2444
  const s = at ? at(n) : null;
2393
- return typeof s != "string" || _(s) !== "form" ? !1 : typeof n.nodeName != "string" || typeof n.textContent != "string" || typeof n.removeChild != "function" || n.attributes !== qt(n) || typeof n.removeAttribute != "function" || typeof n.removeAttributeNode != "function" || typeof n.getAttributeNode != "function" || typeof n.setAttribute != "function" || typeof n.namespaceURI != "string" || typeof n.insertBefore != "function" || typeof n.hasChildNodes != "function" || n.nodeType !== tt(n) || n.childNodes !== D(n);
2445
+ return typeof s != "string" || _(s) !== "form" ? !1 : typeof n.nodeName != "string" || typeof n.textContent != "string" || typeof n.removeChild != "function" || n.attributes !== qt(n) || typeof n.removeAttribute != "function" || typeof n.removeAttributeNode != "function" || typeof n.getAttributeNode != "function" || typeof n.setAttribute != "function" || typeof n.namespaceURI != "string" || typeof n.insertBefore != "function" || typeof n.hasChildNodes != "function" || n.nodeType !== tt(n) || n.childNodes !== O(n);
2394
2446
  }, ft = function(n) {
2395
2447
  if (!tt || typeof n != "object" || n === null) return !1;
2396
2448
  try {
2397
- return tt(n) === F.documentFragment;
2449
+ return tt(n) === B.documentFragment;
2398
2450
  } catch (s) {
2399
2451
  return !1;
2400
2452
  }
@@ -2412,9 +2464,9 @@ function Mo() {
2412
2464
  });
2413
2465
  }
2414
2466
  const on = function(n, s) {
2415
- return !!(ot && n.hasChildNodes() && !Tt(n.firstElementChild) && O(yo, n.textContent) && O(yo, n.innerHTML) || ot && n.namespaceURI === $ && Zn[s] && (Tt(n.firstElementChild) || typeof n.textContent == "string" && O(Jn[s], n.textContent)) || n.nodeType === F.processingInstruction || ot && n.nodeType === F.comment && O(Eo, n.data));
2467
+ return !!(ot && n.hasChildNodes() && !Tt(n.firstElementChild) && D(yo, n.textContent) && D(yo, n.innerHTML) || ot && n.namespaceURI === $ && Zn[s] && (Tt(n.firstElementChild) || typeof n.textContent == "string" && D(Jn[s], n.textContent)) || n.nodeType === B.processingInstruction || ot && n.nodeType === B.comment && D(Eo, n.data));
2416
2468
  }, Ut = function(n, s) {
2417
- if (n instanceof RegExp) return O(n, s);
2469
+ if (n instanceof RegExp) return D(n, s);
2418
2470
  if (n instanceof Function) {
2419
2471
  for (var d = arguments.length, p = new Array(d > 2 ? d - 2 : 0), h = 2; h < d; h++) p[h - 2] = arguments[h];
2420
2472
  return !!n(s, ...p);
@@ -2423,47 +2475,47 @@ function Mo() {
2423
2475
  }, nn = function(n, s, d) {
2424
2476
  if (!vt[s] && oo(s) && Ut(W.tagNameCheck, s)) return !1;
2425
2477
  if (ne && !dt[s]) {
2426
- const p = N(n), h = D(n);
2478
+ const p = N(n), h = O(n);
2427
2479
  if (h && p) {
2428
- const g = h.length;
2429
- for (let b = g - 1; b >= 0; --b) {
2430
- const S = n === d ? C(h[b], !0) : h[b];
2480
+ const b = h.length;
2481
+ for (let y = b - 1; y >= 0; --y) {
2482
+ const S = n === d ? k(h[y], !0) : h[y];
2431
2483
  p.insertBefore(S, Y(n));
2432
2484
  }
2433
2485
  }
2434
2486
  }
2435
2487
  return X(n), !0;
2436
2488
  }, Qe = function(n, s, d, p) {
2437
- return n.length === 0 ? s : s === d || s === p ? H(s) : s;
2489
+ return n.length === 0 ? s : s === d || s === p ? F(s) : s;
2438
2490
  }, ht = function(n, s) {
2439
- return n === s || N(n) !== null ? !1 : (ie && Bt(n), !0);
2491
+ return n === s || N(n) !== null ? !1 : (ie && Ht(n), !0);
2440
2492
  }, to = function(n, s) {
2441
- if (G(T.beforeSanitizeElements, n, null), ht(n, s)) return !0;
2442
- if (Ht(n))
2493
+ if (G(x.beforeSanitizeElements, n, null), ht(n, s)) return !0;
2494
+ if (Ft(n))
2443
2495
  return X(n), !0;
2444
2496
  const d = _(Vt(n));
2445
- if (k = Qe(T.uponSanitizeElement, k, Jt, It), G(T.uponSanitizeElement, n, {
2497
+ if (A = Qe(x.uponSanitizeElement, A, Jt, It), G(x.uponSanitizeElement, n, {
2446
2498
  tagName: d,
2447
- allowedTags: k
2499
+ allowedTags: A
2448
2500
  }), ht(n, s)) return !0;
2449
2501
  if (on(n, d))
2450
2502
  return X(n), !0;
2451
- if (vt[d] || !(q.tagCheck instanceof Function && q.tagCheck(d)) && !k[d]) {
2503
+ if (vt[d] || !(q.tagCheck instanceof Function && q.tagCheck(d)) && !A[d]) {
2452
2504
  const p = nn(n, d, s);
2453
- return p === !1 && (G(T.afterSanitizeElements, n, null), ht(n, s)) ? !0 : p;
2505
+ return p === !1 && (G(x.afterSanitizeElements, n, null), ht(n, s)) ? !0 : p;
2454
2506
  }
2455
- if (yt(n) === F.element && !Qo(n) || (d === "noscript" || d === "noembed" || d === "noframes") && O(Vn, n.innerHTML))
2507
+ if (yt(n) === B.element && !Qo(n) || (d === "noscript" || d === "noembed" || d === "noframes") && D(Vn, n.innerHTML))
2456
2508
  return X(n), !0;
2457
- if (V && n.nodeType === F.text) {
2458
- const p = Ft(n.textContent);
2509
+ if (V && n.nodeType === B.text) {
2510
+ const p = Bt(n.textContent);
2459
2511
  n.textContent !== p && (kt(t.removed, { element: n.cloneNode() }), n.textContent = p);
2460
2512
  }
2461
- return G(T.afterSanitizeElements, n, null), ht(n, s);
2513
+ return G(x.afterSanitizeElements, n, null), ht(n, s);
2462
2514
  }, eo = function(n, s, d) {
2463
- if (Oe[s] || Xe(s, n) || Pe && (s === "id" || s === "name") && (d in e || d in Vo)) return !1;
2464
- const p = x[s] || q.attributeCheck instanceof Function && q.attributeCheck(s, n);
2465
- return te && O(Uo, s) || De && O(jo, s) ? !0 : p ? je[s] || O(Ie, xt(d, Me, "")) || (s === "src" || s === "xlink:href" || s === "href") && n !== "script" && co(d, "data:") === 0 && He[n] || Re && !O(Wo, xt(d, Me, "")) ? !0 : !d : oo(n) && Ut(W.tagNameCheck, n) && Ut(W.attributeNameCheck, s, n) || s === "is" && W.allowCustomizedBuiltInElements && Ut(W.tagNameCheck, d);
2466
- }, rn = y({}, [
2515
+ if (De[s] || Xe(s, n) || Pe && (s === "id" || s === "name") && (d in e || d in Vo)) return !1;
2516
+ const p = C[s] || q.attributeCheck instanceof Function && q.attributeCheck(s, n);
2517
+ return te && D(Uo, s) || Oe && D(jo, s) ? !0 : p ? je[s] || D(Ie, xt(d, Me, "")) || (s === "src" || s === "xlink:href" || s === "href") && n !== "script" && co(d, "data:") === 0 && Fe[n] || Re && !D(Wo, xt(d, Me, "")) ? !0 : !d : oo(n) && Ut(W.tagNameCheck, n) && Ut(W.attributeNameCheck, s, n) || s === "is" && W.allowCustomizedBuiltInElements && Ut(W.tagNameCheck, d);
2518
+ }, rn = E({}, [
2467
2519
  "annotation-xml",
2468
2520
  "color-profile",
2469
2521
  "font-face",
@@ -2473,72 +2525,72 @@ function Mo() {
2473
2525
  "font-face-uri",
2474
2526
  "missing-glyph"
2475
2527
  ]), oo = function(n) {
2476
- return !rn[_t(n)] && O($o, n);
2528
+ return !rn[_t(n)] && D($o, n);
2477
2529
  }, an = function(n, s, d, p) {
2478
- if (P && typeof v == "object" && typeof v.getAttributeType == "function" && !d) switch (v.getAttributeType(n, s)) {
2530
+ if (P && typeof g == "object" && typeof g.getAttributeType == "function" && !d) switch (g.getAttributeType(n, s)) {
2479
2531
  case "TrustedHTML":
2480
2532
  return st(p);
2481
2533
  case "TrustedScriptURL":
2482
- return Do(p);
2534
+ return Oo(p);
2483
2535
  }
2484
2536
  return p;
2485
2537
  }, sn = function(n, s, d, p) {
2486
2538
  try {
2487
- return d ? n.setAttributeNS(d, s, p) : n.setAttribute(s, p), Ht(n) ? (X(n), !1) : !0;
2539
+ return d ? n.setAttributeNS(d, s, p) : n.setAttribute(s, p), Ft(n) ? (X(n), !1) : !0;
2488
2540
  } catch (h) {
2489
2541
  return it(s, n), !1;
2490
2542
  }
2491
2543
  }, no = function(n, s) {
2492
- if (G(T.beforeSanitizeAttributes, n, null), ht(n, s)) return;
2544
+ if (G(x.beforeSanitizeAttributes, n, null), ht(n, s)) return;
2493
2545
  const d = n.attributes;
2494
- if (!d || Ht(n)) return;
2495
- x = Qe(T.uponSanitizeAttribute, x, Qt, Ot);
2546
+ if (!d || Ft(n)) return;
2547
+ C = Qe(x.uponSanitizeAttribute, C, Qt, Dt);
2496
2548
  const p = {
2497
2549
  attrName: "",
2498
2550
  attrValue: "",
2499
2551
  keepAttr: !0,
2500
- allowedAttributes: x,
2552
+ allowedAttributes: C,
2501
2553
  forceKeepAttr: void 0
2502
2554
  };
2503
2555
  let h = d.length;
2504
- const g = _(n.nodeName);
2556
+ const b = _(n.nodeName);
2505
2557
  for (; h--; ) {
2506
- const b = d[h], S = b.name, U = b.namespaceURI, B = b.value, mt = _(S), pe = B;
2558
+ const y = d[h], S = y.name, U = y.namespaceURI, H = y.value, mt = _(S), pe = H;
2507
2559
  let R = S === "value" ? pe : In(pe), io = !1;
2508
- if (p.attrName = mt, p.attrValue = R, p.keepAttr = !0, p.forceKeepAttr = void 0, G(T.uponSanitizeAttribute, n, p), R = p.attrValue, ze && (mt === "id" || mt === "name") && co(R, Be) !== 0 && (it(S, n, b), R = Be + R, io = !0), ot && O(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i, R)) {
2509
- it(S, n, b);
2560
+ if (p.attrName = mt, p.attrValue = R, p.keepAttr = !0, p.forceKeepAttr = void 0, G(x.uponSanitizeAttribute, n, p), R = p.attrValue, ze && (mt === "id" || mt === "name") && co(R, He) !== 0 && (it(S, n, y), R = He + R, io = !0), ot && D(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i, R)) {
2561
+ it(S, n, y);
2510
2562
  continue;
2511
2563
  }
2512
2564
  if (mt === "attributename" && lo(R, "href")) {
2513
- it(S, n, b);
2565
+ it(S, n, y);
2514
2566
  continue;
2515
2567
  }
2516
2568
  if (!p.forceKeepAttr) {
2517
2569
  if (!p.keepAttr) {
2518
- it(S, n, b);
2570
+ it(S, n, y);
2519
2571
  continue;
2520
2572
  }
2521
- if (!Ne && O(Xn, R)) {
2522
- it(S, n, b);
2573
+ if (!Ne && D(Xn, R)) {
2574
+ it(S, n, y);
2523
2575
  continue;
2524
2576
  }
2525
- if (V && (R = Ft(R)), !eo(g, mt, R)) {
2526
- it(S, n, b);
2577
+ if (V && (R = Bt(R)), !eo(b, mt, R)) {
2578
+ it(S, n, y);
2527
2579
  continue;
2528
2580
  }
2529
- R = an(g, mt, U, R), R !== pe && sn(n, S, U, R) && io && so(t.removed);
2581
+ R = an(b, mt, U, R), R !== pe && sn(n, S, U, R) && io && so(t.removed);
2530
2582
  }
2531
2583
  }
2532
- G(T.afterSanitizeAttributes, n, null), ht(n, s);
2584
+ G(x.afterSanitizeAttributes, n, null), ht(n, s);
2533
2585
  }, jt = function(n) {
2534
2586
  let s = null;
2535
2587
  const d = Je(n);
2536
- for (G(T.beforeSanitizeShadowDOM, n, null); s = d.nextNode(); )
2537
- if (G(T.uponSanitizeShadowNode, s, null), to(s, n), no(s, n), ft(s.content) && jt(s.content), yt(s) === F.element) {
2588
+ for (G(x.beforeSanitizeShadowDOM, n, null); s = d.nextNode(); )
2589
+ if (G(x.uponSanitizeShadowNode, s, null), to(s, n), no(s, n), ft(s.content) && jt(s.content), yt(s) === B.element) {
2538
2590
  const p = Ce(s);
2539
2591
  ft(p) && (ue(p), jt(p));
2540
2592
  }
2541
- G(T.afterSanitizeShadowDOM, n, null);
2593
+ G(x.afterSanitizeShadowDOM, n, null);
2542
2594
  }, ue = function(n) {
2543
2595
  const s = [{
2544
2596
  node: n,
@@ -2550,14 +2602,14 @@ function Mo() {
2550
2602
  jt(d.shadow);
2551
2603
  continue;
2552
2604
  }
2553
- const p = d.node, h = yt(p) === F.element, g = D(p);
2554
- if (g) for (let b = g.length - 1; b >= 0; --b) s.push({
2555
- node: g[b],
2605
+ const p = d.node, h = yt(p) === B.element, b = O(p);
2606
+ if (b) for (let y = b.length - 1; y >= 0; --y) s.push({
2607
+ node: b[y],
2556
2608
  shadow: null
2557
2609
  });
2558
2610
  if (h) {
2559
- const b = at ? at(p) : null;
2560
- if (typeof b == "string" && _(b) === "template") {
2611
+ const y = at ? at(p) : null;
2612
+ if (typeof y == "string" && _(y) === "template") {
2561
2613
  const S = p.content;
2562
2614
  ft(S) && s.push({
2563
2615
  node: S,
@@ -2566,12 +2618,12 @@ function Mo() {
2566
2618
  }
2567
2619
  }
2568
2620
  if (h) {
2569
- const b = Ce(p);
2570
- ft(b) && s.push({
2621
+ const y = Ce(p);
2622
+ ft(y) && s.push({
2571
2623
  node: null,
2572
- shadow: b
2624
+ shadow: y
2573
2625
  }, {
2574
- node: b,
2626
+ node: y,
2575
2627
  shadow: null
2576
2628
  });
2577
2629
  }
@@ -2582,79 +2634,79 @@ function Mo() {
2582
2634
  if (re = !u, re && (u = "<!-->"), typeof u != "string" && !Tt(u) && (u = Pn(u), typeof u != "string"))
2583
2635
  throw Z("dirty is not a string, aborting");
2584
2636
  if (!t.isSupported) return u;
2585
- ee ? (k = It, x = Ot) : ce(n), (T.uponSanitizeElement.length > 0 || T.uponSanitizeAttribute.length > 0) && (k = H(k)), T.uponSanitizeAttribute.length > 0 && (x = H(x)), t.removed = [];
2586
- const g = ie && typeof u != "string" && Tt(u);
2587
- if (g) {
2637
+ ee ? (A = It, C = Dt) : ce(n), (x.uponSanitizeElement.length > 0 || x.uponSanitizeAttribute.length > 0) && (A = F(A)), x.uponSanitizeAttribute.length > 0 && (C = F(C)), t.removed = [];
2638
+ const b = ie && typeof u != "string" && Tt(u);
2639
+ if (b) {
2588
2640
  en(u);
2589
2641
  const U = Vt(u);
2590
2642
  if (typeof U == "string") {
2591
- const B = _(U);
2592
- if (!k[B] || vt[B])
2643
+ const H = _(U);
2644
+ if (!A[H] || vt[H])
2593
2645
  throw zt(u), Z("root node is forbidden and cannot be sanitized in-place");
2594
2646
  }
2595
- if (Ht(u))
2647
+ if (Ft(u))
2596
2648
  throw zt(u), Z("root node is clobbered and cannot be sanitized in-place");
2597
2649
  try {
2598
2650
  ue(u);
2599
- } catch (B) {
2600
- throw zt(u), B;
2651
+ } catch (H) {
2652
+ throw zt(u), H;
2601
2653
  }
2602
2654
  } else if (Tt(u))
2603
- s = Ze("<!---->"), d = s.ownerDocument.importNode(u, !0), d.nodeType === F.element && d.nodeName === "BODY" || d.nodeName === "HTML" ? s = d : s.appendChild(d), ue(s);
2655
+ s = Ze("<!---->"), d = s.ownerDocument.importNode(u, !0), d.nodeType === B.element && d.nodeName === "BODY" || d.nodeName === "HTML" ? s = d : s.appendChild(d), ue(s);
2604
2656
  else {
2605
2657
  if (!lt && !V && !nt && u.indexOf("<") === -1) return P && Rt ? st(u) : u;
2606
2658
  if (s = Ze(u), !s) return lt ? null : Rt ? et : "";
2607
2659
  }
2608
2660
  s && oe && X(s.firstChild);
2609
- const b = g ? u : s;
2661
+ const y = b ? u : s;
2610
2662
  try {
2611
- const U = Je(b);
2663
+ const U = Je(y);
2612
2664
  for (; p = U.nextNode(); )
2613
- to(p, b), no(p, b), ft(p.content) && jt(p.content);
2665
+ to(p, y), no(p, y), ft(p.content) && jt(p.content);
2614
2666
  } catch (U) {
2615
- throw g && (zt(u), rt(t.removed, (B) => {
2616
- B.element && Bt(B.element);
2667
+ throw b && (zt(u), rt(t.removed, (H) => {
2668
+ H.element && Ht(H.element);
2617
2669
  })), U;
2618
2670
  }
2619
- if (g) {
2671
+ if (b) {
2620
2672
  let U = !1;
2621
- if (rt(t.removed, (B) => {
2622
- B.element && (B.element === u && (U = !0), Bt(B.element));
2673
+ if (rt(t.removed, (H) => {
2674
+ H.element && (H.element === u && (U = !0), Ht(H.element));
2623
2675
  }), U) throw Z("a node selected for removal could not be safely returned; refusing to sanitize in place");
2624
2676
  return V && de(u), u;
2625
2677
  }
2626
2678
  if (lt) {
2627
- if (V && de(s), Dt)
2679
+ if (V && de(s), Ot)
2628
2680
  for (h = No.call(s.ownerDocument); s.firstChild; ) h.appendChild(s.firstChild);
2629
2681
  else h = s;
2630
- return (x.shadowroot || x.shadowrootmode) && (h = zo.call(o, h, !0)), h;
2682
+ return (C.shadowroot || C.shadowrootmode) && (h = zo.call(o, h, !0)), h;
2631
2683
  }
2632
2684
  let S = nt ? s.outerHTML : s.innerHTML;
2633
- return nt && k["!doctype"] && s.ownerDocument && s.ownerDocument.doctype && s.ownerDocument.doctype.name && O(Yn, s.ownerDocument.doctype.name) && (S = "<!DOCTYPE " + s.ownerDocument.doctype.name + `>
2634
- ` + S), V && (S = Ft(S)), P && Rt ? st(S) : S;
2685
+ return nt && A["!doctype"] && s.ownerDocument && s.ownerDocument.doctype && s.ownerDocument.doctype.name && D(Yn, s.ownerDocument.doctype.name) && (S = "<!DOCTYPE " + s.ownerDocument.doctype.name + `>
2686
+ ` + S), V && (S = Bt(S)), P && Rt ? st(S) : S;
2635
2687
  }, t.setConfig = function() {
2636
2688
  let u = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
2637
- ce(u), ee = !0, It = k, Ot = x;
2689
+ ce(u), ee = !0, It = A, Dt = C;
2638
2690
  }, t.clearConfig = function() {
2639
- pt = null, ee = !1, It = null, Ot = null, P = Xt, et = "";
2691
+ pt = null, ee = !1, It = null, Dt = null, P = Xt, et = "";
2640
2692
  }, t.isValidAttribute = function(u, n, s) {
2641
2693
  pt || ce({});
2642
2694
  const d = _(u), p = _(n);
2643
2695
  return eo(d, p, s);
2644
2696
  }, t.addHook = function(u, n) {
2645
- typeof n == "function" && z(T, u) && kt(T[u], n);
2697
+ typeof n == "function" && z(x, u) && kt(x[u], n);
2646
2698
  }, t.removeHook = function(u, n) {
2647
- if (z(T, u)) {
2699
+ if (z(x, u)) {
2648
2700
  if (n !== void 0) {
2649
- const s = Ln(T[u], n);
2650
- return s === -1 ? void 0 : Mn(T[u], s, 1)[0];
2701
+ const s = Ln(x[u], n);
2702
+ return s === -1 ? void 0 : Mn(x[u], s, 1)[0];
2651
2703
  }
2652
- return so(T[u]);
2704
+ return so(x[u]);
2653
2705
  }
2654
2706
  }, t.removeHooks = function(u) {
2655
- z(T, u) && (T[u] = []);
2707
+ z(x, u) && (x[u] = []);
2656
2708
  }, t.removeAllHooks = function() {
2657
- T = vo();
2709
+ x = vo();
2658
2710
  }, t;
2659
2711
  }
2660
2712
  var $t = Mo();
@@ -2694,6 +2746,9 @@ const ei = [
2694
2746
  "span",
2695
2747
  "div",
2696
2748
  "section",
2749
+ // A captioned image or video (the media manager's output). Neither carries behaviour of its own.
2750
+ "figure",
2751
+ "figcaption",
2697
2752
  "sup",
2698
2753
  "sub",
2699
2754
  "hr"
@@ -2735,22 +2790,22 @@ function Io(a, t, e, o) {
2735
2790
  if ((t == null ? void 0 : t.sanitize) === !1)
2736
2791
  return a;
2737
2792
  const i = t != null && t.allowedTags && t.allowedTags.length > 0 ? t.allowedTags : ei, r = e != null && e.length ? Array.from(/* @__PURE__ */ new Set([...i, ...e])) : i, c = !!(t != null && t.allowedAttributes) && Object.keys(t.allowedAttributes).length > 0 ? t.allowedAttributes : oi, f = /* @__PURE__ */ new Set();
2738
- for (const A of Object.values(c))
2739
- for (const C of A) f.add(C);
2793
+ for (const T of Object.values(c))
2794
+ for (const k of T) f.add(k);
2740
2795
  const m = {
2741
2796
  ALLOWED_TAGS: r,
2742
2797
  ALLOWED_ATTR: Array.from(f)
2743
2798
  };
2744
2799
  if (!o)
2745
2800
  return $t.sanitize(a, m);
2746
- const v = r.includes("iframe");
2801
+ const g = r.includes("iframe");
2747
2802
  $t.addHook(
2748
2803
  "uponSanitizeElement",
2749
- (A, C) => {
2750
- var E;
2751
- if (C.tagName !== "iframe") return;
2752
- const w = A;
2753
- C.allowedTags.iframe = v || ((E = w.getAttribute) == null ? void 0 : E.call(w, ni)) === "true" && ii(w.getAttribute("src"));
2804
+ (T, k) => {
2805
+ var v;
2806
+ if (k.tagName !== "iframe") return;
2807
+ const w = T;
2808
+ k.allowedTags.iframe = g || ((v = w.getAttribute) == null ? void 0 : v.call(w, ni)) === "true" && ii(w.getAttribute("src"));
2754
2809
  }
2755
2810
  );
2756
2811
  try {
@@ -2768,8 +2823,8 @@ function ai(a, t, e) {
2768
2823
  function wo(a, t, e, o) {
2769
2824
  return (e == null ? void 0 : e.sanitizeOnInput) === !1 ? a : Io(a, t, o, !0);
2770
2825
  }
2771
- const si = ".resize-handle, .table-resize-handle", li = /resize-handle/;
2772
- function Oo(a) {
2826
+ const si = ".resize-handle, .table-resize-handle, [data-rte-media-pending]", li = /resize-handle|data-rte-media-pending|rte-media/;
2827
+ function Do(a) {
2773
2828
  if (!a || !li.test(a)) return a;
2774
2829
  const t = document.createElement("template");
2775
2830
  t.innerHTML = a;
@@ -2780,10 +2835,15 @@ function Oo(a) {
2780
2835
  }), e.forEach((o) => {
2781
2836
  var i;
2782
2837
  o.style.position === "relative" && (o.style.removeProperty("position"), (i = o.getAttribute("style")) != null && i.trim() || o.removeAttribute("style"));
2838
+ }), t.content.querySelectorAll("figure.rte-media").forEach((o) => {
2839
+ var r;
2840
+ o.removeAttribute("contenteditable");
2841
+ const i = o.querySelector(":scope > figcaption");
2842
+ i && (i.removeAttribute("contenteditable"), !((r = i.textContent) != null && r.trim()) && !i.querySelector("img, video, a") && i.remove());
2783
2843
  }), t.innerHTML;
2784
2844
  }
2785
2845
  function Ct(a) {
2786
- return a ? Oo(a.innerHTML) : "";
2846
+ return a ? Do(a.innerHTML) : "";
2787
2847
  }
2788
2848
  const Yt = class Yt {
2789
2849
  /**
@@ -3125,7 +3185,7 @@ function bi() {
3125
3185
  }
3126
3186
  class K extends HTMLElement {
3127
3187
  constructor() {
3128
- if (super(), this.pluginLoader = bi(), this.config = {}, this.isInitialized = !1, this.keyboardShortcutManager = new vn(), this.lastAutosavedContent = "", this.preservedContent = null, this.loadedPlugins = [], this.lastBeforeInputType = null, gi(), !this.hasAttribute("data-initial-content")) {
3188
+ if (super(), this.pluginLoader = bi(), this.config = {}, this.isInitialized = !1, this.keyboardShortcutManager = new vn(), this.lastAutosavedContent = "", this.preservedContent = null, this.loadedPlugins = [], this.lastBeforeInputType = null, this.pendingHistorySnapshot = null, gi(), !this.hasAttribute("data-initial-content")) {
3129
3189
  const t = this.innerHTML.trim();
3130
3190
  t && this.setAttribute("data-initial-content", t);
3131
3191
  }
@@ -3586,8 +3646,8 @@ class K extends HTMLElement {
3586
3646
  this.contentElement.focus();
3587
3647
  const f = window.getSelection();
3588
3648
  if (!f || f.rangeCount === 0 || !this.contentElement.contains(f.anchorNode)) {
3589
- const m = document.createRange(), v = this.contentElement.lastChild || this.contentElement;
3590
- v.nodeType === Node.TEXT_NODE ? m.setStart(v, ((c = v.textContent) == null ? void 0 : c.length) || 0) : v.nodeType === Node.ELEMENT_NODE ? (m.selectNodeContents(v), m.collapse(!1)) : m.setStart(this.contentElement, 0), m.collapse(!0), f == null || f.removeAllRanges(), f == null || f.addRange(m);
3649
+ const m = document.createRange(), g = this.contentElement.lastChild || this.contentElement;
3650
+ g.nodeType === Node.TEXT_NODE ? m.setStart(g, ((c = g.textContent) == null ? void 0 : c.length) || 0) : g.nodeType === Node.ELEMENT_NODE ? (m.selectNodeContents(g), m.collapse(!1)) : m.setStart(this.contentElement, 0), m.collapse(!0), f == null || f.removeAllRanges(), f == null || f.addRange(m);
3591
3651
  }
3592
3652
  }
3593
3653
  return this.executeCommand(r, l);
@@ -3613,6 +3673,20 @@ class K extends HTMLElement {
3613
3673
  return (r = this.contentElement) == null ? void 0 : r.focus();
3614
3674
  }, 0);
3615
3675
  }
3676
+ /**
3677
+ * Hands what a keystroke changed to the history plugin, so Undo takes back typing. Without this the
3678
+ * plugin only knew about changes that plugins reported themselves, and typed text could not be undone.
3679
+ */
3680
+ recordInputHistory(t) {
3681
+ const e = this.pendingHistorySnapshot;
3682
+ if (this.pendingHistorySnapshot = null, !e || !this.contentElement || e.beforeHTML === t) return;
3683
+ const o = window.execEditorCommand;
3684
+ typeof o == "function" && o("recordDomTransaction", this.contentElement, e.beforeHTML, t, {
3685
+ inputType: e.inputType,
3686
+ data: e.data,
3687
+ selectionCollapsed: e.selectionCollapsed
3688
+ });
3689
+ }
3616
3690
  /**
3617
3691
  * Setup event listeners
3618
3692
  */
@@ -3620,43 +3694,49 @@ class K extends HTMLElement {
3620
3694
  if (!this.contentElement || !this.engine) return;
3621
3695
  const t = this.keyboardShortcutManager;
3622
3696
  this.contentElement.addEventListener("beforeinput", (o) => {
3623
- this.lastBeforeInputType = o.inputType || null;
3697
+ var i, r;
3698
+ this.lastBeforeInputType = o.inputType || null, o.inputType === "historyUndo" || o.inputType === "historyRedo" ? this.pendingHistorySnapshot = null : this.contentElement && (this.pendingHistorySnapshot = {
3699
+ beforeHTML: this.contentElement.innerHTML,
3700
+ inputType: o.inputType || null,
3701
+ data: typeof o.data == "string" ? o.data : null,
3702
+ selectionCollapsed: (r = (i = window.getSelection()) == null ? void 0 : i.isCollapsed) != null ? r : !0
3703
+ });
3624
3704
  }), this.contentElement.addEventListener("input", (o) => {
3625
- var C;
3705
+ var k;
3626
3706
  if (!this.contentElement) return;
3627
3707
  let i = this.contentElement.innerHTML;
3628
- const r = (C = o == null ? void 0 : o.detail) == null ? void 0 : C.allowedTags, l = this.getPerformanceConfig(), c = this.getContentSanitizeConfig(), f = this.getSecurityConfig(), m = this.lastBeforeInputType;
3708
+ const r = (k = o == null ? void 0 : o.detail) == null ? void 0 : k.allowedTags, l = this.getPerformanceConfig(), c = this.getContentSanitizeConfig(), f = this.getSecurityConfig(), m = this.lastBeforeInputType;
3629
3709
  if (this.lastBeforeInputType = null, f.sanitizeOnInput !== !1 && c.sanitize !== !1 && !m) {
3630
3710
  const w = wo(i, c, f, r);
3631
3711
  if (w !== i) {
3632
- const E = window.getSelection(), Y = E && E.rangeCount > 0 ? E.getRangeAt(0) : null;
3633
- if (this.contentElement.innerHTML = w, Y && E)
3712
+ const v = window.getSelection(), Y = v && v.rangeCount > 0 ? v.getRangeAt(0) : null;
3713
+ if (this.contentElement.innerHTML = w, Y && v)
3634
3714
  try {
3635
- E.removeAllRanges(), E.addRange(Y);
3636
- } catch (D) {
3715
+ v.removeAllRanges(), v.addRange(Y);
3716
+ } catch (O) {
3637
3717
  }
3638
3718
  i = w;
3639
3719
  }
3640
3720
  }
3641
- this.contentChangeDebounceTimer && clearTimeout(this.contentChangeDebounceTimer);
3642
- const A = () => {
3721
+ this.recordInputHistory(i), this.contentChangeDebounceTimer && clearTimeout(this.contentChangeDebounceTimer);
3722
+ const T = () => {
3643
3723
  this.dispatchEvent(new CustomEvent("content-change", {
3644
- detail: { html: Oo(i) },
3724
+ detail: { html: Do(i) },
3645
3725
  bubbles: !0
3646
3726
  }));
3647
3727
  };
3648
- l.debounceInputMs > 0 ? this.contentChangeDebounceTimer = setTimeout(A, l.debounceInputMs) : A(), this.updateStatusBar();
3728
+ l.debounceInputMs > 0 ? this.contentChangeDebounceTimer = setTimeout(T, l.debounceInputMs) : T(), this.updateStatusBar();
3649
3729
  }), this.contentElement.addEventListener("contextmenu", (o) => {
3650
3730
  const i = this.config.contextMenu;
3651
3731
  (i === !1 || typeof i == "object" && i !== null && i.enabled === !1) && o.preventDefault();
3652
3732
  }), this.contentElement.addEventListener("paste", (o) => {
3653
- var v, A;
3733
+ var g, T;
3654
3734
  if (o.__editoraSmartPasteHandled === !0 || o.defaultPrevented)
3655
3735
  return;
3656
3736
  o.preventDefault();
3657
3737
  const i = this.config.paste || {};
3658
- let r = ((v = o.clipboardData) == null ? void 0 : v.getData("text/html")) || "";
3659
- const l = ((A = o.clipboardData) == null ? void 0 : A.getData("text/plain")) || "", c = this.getContentSanitizeConfig(), f = this.getSecurityConfig(), m = !!r && /class=["'][^"']*Mso|xmlns:w=|urn:schemas-microsoft-com:office/i.test(r);
3738
+ let r = ((g = o.clipboardData) == null ? void 0 : g.getData("text/html")) || "";
3739
+ const l = ((T = o.clipboardData) == null ? void 0 : T.getData("text/plain")) || "", c = this.getContentSanitizeConfig(), f = this.getSecurityConfig(), m = !!r && /class=["'][^"']*Mso|xmlns:w=|urn:schemas-microsoft-com:office/i.test(r);
3660
3740
  if ((i.clean || !i.keepFormatting) && l) {
3661
3741
  document.execCommand("insertText", !1, l);
3662
3742
  return;
@@ -3919,11 +3999,11 @@ const yi = {
3919
3999
  underline: () => import("./UnderlinePlugin.native-DZzg23rv.mjs").then((a) => a.UnderlinePlugin()),
3920
4000
  strikethrough: () => import("./StrikethroughPlugin.native-V0TL4F48.mjs").then((a) => a.StrikethroughPlugin()),
3921
4001
  clearFormatting: () => import("./ClearFormattingPlugin.native-Pp0O-SBf.mjs").then((a) => a.ClearFormattingPlugin()),
3922
- heading: () => import("./HeadingPlugin.native-DZdvubrQ.mjs").then((a) => a.HeadingPlugin()),
4002
+ heading: () => import("./HeadingPlugin.native-C3YiGERx.mjs").then((a) => a.HeadingPlugin()),
3923
4003
  blockquote: () => import("./BlockquotePlugin.native-D8jjGd0c.mjs").then((a) => a.BlockquotePlugin()),
3924
- code: () => import("./CodePlugin.native-DZgIez08.mjs").then((a) => a.CodePlugin()),
3925
- list: () => import("./ListPlugin.native-Bt0LANbO.mjs").then((a) => a.ListPlugin()),
3926
- history: () => import("./HistoryPlugin.native-DPvhks6h.mjs").then((a) => a.HistoryPlugin())
4004
+ code: () => import("./CodePlugin.native-CPfKDrkr.mjs").then((a) => a.CodePlugin()),
4005
+ list: () => import("./ListPlugin.native-UYaoRiub.mjs").then((a) => a.ListPlugin()),
4006
+ history: () => import("./HistoryPlugin.native-C8GyxsgC.mjs").then((a) => a.HistoryPlugin())
3927
4007
  };
3928
4008
  async function Ei() {
3929
4009
  return Object.entries(yi).forEach(([a, t]) => {