hexagon-editor 0.1.7 → 0.1.8

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 (145) hide show
  1. package/README.md +381 -52
  2. package/dist/MarkdownEditor.vue.d.ts +16 -4
  3. package/dist/MarkdownEditor.vue.d.ts.map +1 -1
  4. package/dist/{MarkdownEditorLinkForm-B9dEX3WT.js → MarkdownEditorLinkForm-nx1gDLpK.js} +17 -6
  5. package/dist/{base-BPdMUtQo.js → base-BOV5nzwj.js} +1005 -728
  6. package/dist/classname.d.ts.map +1 -1
  7. package/dist/{index-D_CMntQU.js → color-7y9Yd6c7.js} +512 -442
  8. package/dist/components/MarkdownEditorFloatingMenus.vue.d.ts +5 -1
  9. package/dist/components/MarkdownEditorFloatingMenus.vue.d.ts.map +1 -1
  10. package/dist/components/MarkdownEditorImageActions.vue.d.ts.map +1 -1
  11. package/dist/components/MarkdownEditorToolbar.vue.d.ts +5 -2
  12. package/dist/components/MarkdownEditorToolbar.vue.d.ts.map +1 -1
  13. package/dist/components/MarkdownEditorToolbarIcon.vue.d.ts.map +1 -1
  14. package/dist/composables/useFloatingPanel.d.ts.map +1 -1
  15. package/dist/composables/useMarkdownEditorValue.d.ts.map +1 -1
  16. package/dist/configure.d.ts.map +1 -1
  17. package/dist/core/actions.d.ts.map +1 -1
  18. package/dist/core/basic-editor-atomic-source.d.ts.map +1 -1
  19. package/dist/core/basic-editor-command-helpers.d.ts +2 -1
  20. package/dist/core/basic-editor-command-helpers.d.ts.map +1 -1
  21. package/dist/core/basic-editor-markdown.d.ts.map +1 -1
  22. package/dist/core/basic-editor-renderers.d.ts.map +1 -1
  23. package/dist/core/basic-editor-runtime-plugins.d.ts.map +1 -1
  24. package/dist/core/basic-editor-selection.d.ts.map +1 -1
  25. package/dist/core/basic-editor-table-controls.d.ts.map +1 -1
  26. package/dist/core/basic-editor-types.d.ts +2 -1
  27. package/dist/core/basic-editor-types.d.ts.map +1 -1
  28. package/dist/core/basic-editor.d.ts.map +1 -1
  29. package/dist/core/content-handler.d.ts.map +1 -1
  30. package/dist/core/editor-instance.d.ts.map +1 -1
  31. package/dist/core/events.d.ts.map +1 -1
  32. package/dist/core/extension-builder.d.ts +1 -1
  33. package/dist/core/extension-builder.d.ts.map +1 -1
  34. package/dist/core/extensions-manager.d.ts.map +1 -1
  35. package/dist/core/lists.d.ts.map +1 -1
  36. package/dist/core/logger.d.ts.map +1 -1
  37. package/dist/core/markdown-parser.d.ts.map +1 -1
  38. package/dist/core/markdown.d.ts.map +1 -1
  39. package/dist/core/markup-commands.d.ts.map +1 -1
  40. package/dist/core/markup-editor.d.ts.map +1 -1
  41. package/dist/core/registries.d.ts.map +1 -1
  42. package/dist/core/schema-dynamic-modifier.d.ts.map +1 -1
  43. package/dist/core/vue-renderer.d.ts.map +1 -1
  44. package/dist/core.js +2 -2
  45. package/dist/directives.d.ts.map +1 -1
  46. package/dist/extensions/additional/folding-heading.d.ts.map +1 -1
  47. package/dist/extensions/additional/math.d.ts.map +1 -1
  48. package/dist/extensions/additional/mermaid.d.ts.map +1 -1
  49. package/dist/extensions/additional/quote-link.d.ts.map +1 -1
  50. package/dist/extensions/additional/yfm-html-block.d.ts.map +1 -1
  51. package/dist/extensions/base.d.ts.map +1 -1
  52. package/dist/extensions/behavior/clicks-on-edges.d.ts.map +1 -1
  53. package/dist/extensions/behavior/clipboard.d.ts.map +1 -1
  54. package/dist/extensions/behavior/cursor.d.ts.map +1 -1
  55. package/dist/extensions/behavior/editor-mode-keymap.d.ts.map +1 -1
  56. package/dist/extensions/behavior/history.d.ts.map +1 -1
  57. package/dist/extensions/behavior/placeholder.d.ts.map +1 -1
  58. package/dist/extensions/behavior/resizable.d.ts.map +1 -1
  59. package/dist/extensions/behavior/selection-commands.d.ts.map +1 -1
  60. package/dist/extensions/behavior/selection-context.d.ts.map +1 -1
  61. package/dist/extensions/behavior/selection.d.ts.map +1 -1
  62. package/dist/extensions/markdown/blockquote-specs.d.ts.map +1 -1
  63. package/dist/extensions/markdown/blockquote.d.ts.map +1 -1
  64. package/dist/extensions/markdown/bold-specs.d.ts.map +1 -1
  65. package/dist/extensions/markdown/bold.d.ts.map +1 -1
  66. package/dist/extensions/markdown/breaks-specs.d.ts.map +1 -1
  67. package/dist/extensions/markdown/breaks.d.ts +1 -1
  68. package/dist/extensions/markdown/breaks.d.ts.map +1 -1
  69. package/dist/extensions/markdown/code-block-specs.d.ts.map +1 -1
  70. package/dist/extensions/markdown/code-block.d.ts +1 -1
  71. package/dist/extensions/markdown/code-block.d.ts.map +1 -1
  72. package/dist/extensions/markdown/code-specs.d.ts.map +1 -1
  73. package/dist/extensions/markdown/code.d.ts.map +1 -1
  74. package/dist/extensions/markdown/color.d.ts +15 -0
  75. package/dist/extensions/markdown/color.d.ts.map +1 -0
  76. package/dist/extensions/markdown/deflist-specs.d.ts.map +1 -1
  77. package/dist/extensions/markdown/deflist.d.ts +1 -1
  78. package/dist/extensions/markdown/deflist.d.ts.map +1 -1
  79. package/dist/extensions/markdown/heading-specs.d.ts.map +1 -1
  80. package/dist/extensions/markdown/heading.d.ts +1 -1
  81. package/dist/extensions/markdown/heading.d.ts.map +1 -1
  82. package/dist/extensions/markdown/horizontal-rule-specs.d.ts.map +1 -1
  83. package/dist/extensions/markdown/horizontal-rule.d.ts.map +1 -1
  84. package/dist/extensions/markdown/html.d.ts.map +1 -1
  85. package/dist/extensions/markdown/image.d.ts +1 -1
  86. package/dist/extensions/markdown/image.d.ts.map +1 -1
  87. package/dist/extensions/markdown/italic-specs.d.ts.map +1 -1
  88. package/dist/extensions/markdown/italic.d.ts +1 -1
  89. package/dist/extensions/markdown/italic.d.ts.map +1 -1
  90. package/dist/extensions/markdown/link-specs.d.ts.map +1 -1
  91. package/dist/extensions/markdown/link.d.ts +1 -1
  92. package/dist/extensions/markdown/link.d.ts.map +1 -1
  93. package/dist/extensions/markdown/list-specs.d.ts.map +1 -1
  94. package/dist/extensions/markdown/lists.d.ts.map +1 -1
  95. package/dist/extensions/markdown/mark.d.ts.map +1 -1
  96. package/dist/extensions/markdown/strike.d.ts.map +1 -1
  97. package/dist/extensions/markdown/subscript.d.ts.map +1 -1
  98. package/dist/extensions/markdown/table-actions.d.ts.map +1 -1
  99. package/dist/extensions/markdown/table-specs.d.ts.map +1 -1
  100. package/dist/extensions/markdown/table.d.ts +2 -2
  101. package/dist/extensions/markdown/table.d.ts.map +1 -1
  102. package/dist/extensions/markdown/underline.d.ts.map +1 -1
  103. package/dist/extensions.js +2 -2
  104. package/dist/forms/MarkdownEditorForm.vue.d.ts.map +1 -1
  105. package/dist/forms/MarkdownEditorImageForm.vue.d.ts.map +1 -1
  106. package/dist/forms/MarkdownEditorLinkForm.vue.d.ts.map +1 -1
  107. package/dist/forms/MarkdownEditorTextInput.vue.d.ts.map +1 -1
  108. package/dist/forms/index.d.ts.map +1 -1
  109. package/dist/forms.js +1 -1
  110. package/dist/{full-Da8esvj2.js → full-s-sYdwp2.js} +1 -1
  111. package/dist/{full-specs-hXKoMF-0.js → full-specs-Cm3QffD5.js} +1 -1
  112. package/dist/{heading-specs-D7Bj4aIM.js → heading-specs-Dnjn5FYs.js} +136 -51
  113. package/dist/i18n/index.d.ts +7 -0
  114. package/dist/i18n/index.d.ts.map +1 -1
  115. package/dist/i18n.js +17 -3
  116. package/dist/index.css +1 -1
  117. package/dist/index.d.ts +8 -8
  118. package/dist/index.d.ts.map +1 -1
  119. package/dist/index.js +847 -744
  120. package/dist/{markup-commands-BYsx8ADT.js → markup-commands-uq7LBcNQ.js} +4056 -4404
  121. package/dist/presets/commonmark-specs.d.ts.map +1 -1
  122. package/dist/presets/commonmark.d.ts.map +1 -1
  123. package/dist/presets/default.d.ts.map +1 -1
  124. package/dist/presets/full-specs.d.ts.map +1 -1
  125. package/dist/presets/full.d.ts.map +1 -1
  126. package/dist/presets/index.d.ts.map +1 -1
  127. package/dist/presets/zero.d.ts.map +1 -1
  128. package/dist/presets.js +2 -2
  129. package/dist/public-types.d.ts.map +1 -1
  130. package/dist/renderer/MarkdownRenderer.vue.d.ts.map +1 -1
  131. package/dist/renderer/index.d.ts.map +1 -1
  132. package/dist/renderer/markdown.d.ts.map +1 -1
  133. package/dist/renderer.css +1 -1
  134. package/dist/renderer.js +368 -311
  135. package/dist/specs.js +53 -14
  136. package/dist/toolbar/config.d.ts +1 -1
  137. package/dist/toolbar/config.d.ts.map +1 -1
  138. package/dist/toolbar/index.d.ts.map +1 -1
  139. package/dist/toolbar.js +1 -3
  140. package/dist/use-markdown-editor.d.ts.map +1 -1
  141. package/dist/version.d.ts +1 -1
  142. package/dist/version.d.ts.map +1 -1
  143. package/package.json +1 -2
  144. package/dist/core/basic-editor-table-popover.d.ts +0 -5
  145. package/dist/core/basic-editor-table-popover.d.ts.map +0 -1
@@ -1,6 +1,6 @@
1
- import { B as Da, o as fi, b as Ea, r as Aa, d as Ia, c as Wi, f as va, y as Ra, e as Pa, v as Gn, C as di, h as Ba, g as hr, i as za, R as La, S as ks, j as $a, W as Va, k as Fa, L as fe, Z as Wa, m as z, l as xs, T as ui, n as Ka, H as Ha, O as _a, M as Fr } from "./heading-specs-D7Bj4aIM.js";
1
+ import { B as Da, o as ci, b as Ea, r as Aa, d as Ia, c as Fi, f as va, y as Ra, e as Pa, v as Gn, C as fi, h as Ba, g as hr, i as za, R as La, S as ks, j as $a, W as Va, k as Fa, L as fe, Z as Wa, m as z, l as xs, T as di, n as Ka, H as _a, O as Ha, M as Vr } from "./heading-specs-Dnjn5FYs.js";
2
2
  import { i as qa, s as Ja, a as ja } from "./index-CqpK5VVw.js";
3
- import { reactive as Ss, h as Ki, render as Hi } from "vue";
3
+ import { reactive as Ss, h as Wi, render as Ki } from "vue";
4
4
  function F(n) {
5
5
  this.content = n;
6
6
  }
@@ -438,7 +438,7 @@ function En(n, e) {
438
438
  }
439
439
  return !0;
440
440
  }
441
- let E = class Wr {
441
+ let E = class Fr {
442
442
  /**
443
443
  @internal
444
444
  */
@@ -536,8 +536,8 @@ let E = class Wr {
536
536
  */
537
537
  static setFrom(e) {
538
538
  if (!e || Array.isArray(e) && e.length == 0)
539
- return Wr.none;
540
- if (e instanceof Wr)
539
+ return Fr.none;
540
+ if (e instanceof Fr)
541
541
  return [e];
542
542
  let t = e.slice();
543
543
  return t.sort((r, i) => r.type.rank - i.type.rank), t;
@@ -671,7 +671,7 @@ function Es(n, e) {
671
671
  if (!e.type.compatibleContent(n.type))
672
672
  throw new Gt("Cannot join " + e.type.name + " onto " + n.type.name);
673
673
  }
674
- function Kr(n, e, t) {
674
+ function Wr(n, e, t) {
675
675
  let r = n.node(t);
676
676
  return Es(r, e.node(t)), r;
677
677
  }
@@ -679,7 +679,7 @@ function nt(n, e) {
679
679
  let t = e.length - 1;
680
680
  t >= 0 && n.isText && n.sameMarkup(e[t]) ? e[t] = n.withText(e[t].text + n.text) : e.push(n);
681
681
  }
682
- function Ht(n, e, t, r) {
682
+ function _t(n, e, t, r) {
683
683
  let i = (e || n).node(t), o = 0, s = e ? e.index(t) : i.childCount;
684
684
  n && (o = n.index(t), n.depth > t ? o++ : n.textOffset && (nt(n.nodeAfter, r), o++));
685
685
  for (let l = o; l < s; l++)
@@ -692,16 +692,16 @@ function rt(n, e) {
692
692
  return n.copy(e);
693
693
  }
694
694
  function As(n, e, t, r, i) {
695
- let o = n.depth > i && Kr(n, e, i + 1), s = r.depth > i && Kr(t, r, i + 1), l = [];
696
- return Ht(null, n, i, l), o && s && e.index(i) == t.index(i) ? (Es(o, s), nt(rt(o, As(n, e, t, r, i + 1)), l)) : (o && nt(rt(o, An(n, e, i + 1)), l), Ht(e, t, i, l), s && nt(rt(s, An(t, r, i + 1)), l)), Ht(r, null, i, l), new b(l);
695
+ let o = n.depth > i && Wr(n, e, i + 1), s = r.depth > i && Wr(t, r, i + 1), l = [];
696
+ return _t(null, n, i, l), o && s && e.index(i) == t.index(i) ? (Es(o, s), nt(rt(o, As(n, e, t, r, i + 1)), l)) : (o && nt(rt(o, An(n, e, i + 1)), l), _t(e, t, i, l), s && nt(rt(s, An(t, r, i + 1)), l)), _t(r, null, i, l), new b(l);
697
697
  }
698
698
  function An(n, e, t) {
699
699
  let r = [];
700
- if (Ht(null, n, t, r), n.depth > t) {
701
- let i = Kr(n, e, t + 1);
700
+ if (_t(null, n, t, r), n.depth > t) {
701
+ let i = Wr(n, e, t + 1);
702
702
  nt(rt(i, An(n, e, t + 1)), r);
703
703
  }
704
- return Ht(e, null, t, r), new b(r);
704
+ return _t(e, null, t, r), new b(r);
705
705
  }
706
706
  function Ga(n, e) {
707
707
  let t = e.depth - n.openStart, i = e.node(t).copy(n.content);
@@ -1006,7 +1006,7 @@ class In {
1006
1006
  }
1007
1007
  }
1008
1008
  const Qa = /* @__PURE__ */ Object.create(null);
1009
- let it = class Hr {
1009
+ let it = class Kr {
1010
1010
  /**
1011
1011
  @internal
1012
1012
  */
@@ -1132,14 +1132,14 @@ let it = class Hr {
1132
1132
  the given content (or empty, if no content is given).
1133
1133
  */
1134
1134
  copy(e = null) {
1135
- return e == this.content ? this : new Hr(this.type, this.attrs, e, this.marks);
1135
+ return e == this.content ? this : new Kr(this.type, this.attrs, e, this.marks);
1136
1136
  }
1137
1137
  /**
1138
1138
  Create a copy of this node, with the given set of marks instead
1139
1139
  of the node's own marks.
1140
1140
  */
1141
1141
  mark(e) {
1142
- return e == this.marks ? this : new Hr(this.type, this.attrs, this.content, e);
1142
+ return e == this.marks ? this : new Kr(this.type, this.attrs, this.content, e);
1143
1143
  }
1144
1144
  /**
1145
1145
  Create a copy of this node with only the content between the
@@ -1626,14 +1626,14 @@ function tc(n) {
1626
1626
  break;
1627
1627
  return e;
1628
1628
  }
1629
- function qi(n) {
1629
+ function Hi(n) {
1630
1630
  /\D/.test(n.next) && n.err("Expected number, got '" + n.next + "'");
1631
1631
  let e = Number(n.next);
1632
1632
  return n.pos++, e;
1633
1633
  }
1634
1634
  function nc(n, e) {
1635
- let t = qi(n), r = t;
1636
- return n.eat(",") && (n.next != "}" ? r = qi(n) : r = -1), n.eat("}") || n.err("Unclosed braced range"), { type: "range", min: t, max: r, expr: e };
1635
+ let t = Hi(n), r = t;
1636
+ return n.eat(",") && (n.next != "}" ? r = Hi(n) : r = -1), n.eat("}") || n.err("Unclosed braced range"), { type: "range", min: t, max: r, expr: e };
1637
1637
  }
1638
1638
  function rc(n, e) {
1639
1639
  let t = n.nodeTypes, r = t[e];
@@ -1714,7 +1714,7 @@ function oc(n) {
1714
1714
  function Rs(n, e) {
1715
1715
  return e - n;
1716
1716
  }
1717
- function Ji(n, e) {
1717
+ function qi(n, e) {
1718
1718
  let t = [];
1719
1719
  return r(e), t.sort(Rs);
1720
1720
  function r(i) {
@@ -1730,7 +1730,7 @@ function Ji(n, e) {
1730
1730
  }
1731
1731
  function sc(n) {
1732
1732
  let e = /* @__PURE__ */ Object.create(null);
1733
- return t(Ji(n, 0));
1733
+ return t(qi(n, 0));
1734
1734
  function t(r) {
1735
1735
  let i = [];
1736
1736
  r.forEach((s) => {
@@ -1740,7 +1740,7 @@ function sc(n) {
1740
1740
  let c;
1741
1741
  for (let f = 0; f < i.length; f++)
1742
1742
  i[f][0] == l && (c = i[f][1]);
1743
- Ji(n, a).forEach((f) => {
1743
+ qi(n, a).forEach((f) => {
1744
1744
  c || i.push([l, c = []]), c.indexOf(f) == -1 && c.push(f);
1745
1745
  });
1746
1746
  });
@@ -1802,7 +1802,7 @@ function Ls(n, e) {
1802
1802
  t[r] = new cc(n, r, e[r]);
1803
1803
  return t;
1804
1804
  }
1805
- let ji = class $s {
1805
+ let Ji = class $s {
1806
1806
  /**
1807
1807
  @internal
1808
1808
  */
@@ -2061,7 +2061,7 @@ class Em {
2061
2061
  let t = this.spec = {};
2062
2062
  for (let i in e)
2063
2063
  t[i] = e[i];
2064
- t.nodes = F.from(e.nodes), t.marks = F.from(e.marks || {}), this.nodes = ji.compile(this.spec.nodes, this), this.marks = Yn.compile(this.spec.marks, this);
2064
+ t.nodes = F.from(e.nodes), t.marks = F.from(e.marks || {}), this.nodes = Ji.compile(this.spec.nodes, this), this.marks = Yn.compile(this.spec.marks, this);
2065
2065
  let r = /* @__PURE__ */ Object.create(null);
2066
2066
  for (let i in this.nodes) {
2067
2067
  if (i in this.marks)
@@ -2074,11 +2074,11 @@ class Em {
2074
2074
  throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");
2075
2075
  this.linebreakReplacement = o;
2076
2076
  }
2077
- o.markSet = l == "_" ? null : l ? Ui(this, l.split(" ")) : l == "" || !o.inlineContent ? [] : null;
2077
+ o.markSet = l == "_" ? null : l ? ji(this, l.split(" ")) : l == "" || !o.inlineContent ? [] : null;
2078
2078
  }
2079
2079
  for (let i in this.marks) {
2080
2080
  let o = this.marks[i], s = o.spec.excludes;
2081
- o.excluded = s == null ? [o] : s == "" ? [] : Ui(this, s.split(" "));
2081
+ o.excluded = s == null ? [o] : s == "" ? [] : ji(this, s.split(" "));
2082
2082
  }
2083
2083
  this.nodeFromJSON = (i) => it.fromJSON(this, i), this.markFromJSON = (i) => E.fromJSON(this, i), this.topNodeType = this.nodes[this.spec.topNode || "doc"], this.cached.wrappings = /* @__PURE__ */ Object.create(null);
2084
2084
  }
@@ -2091,7 +2091,7 @@ class Em {
2091
2091
  node(e, t = null, r, i) {
2092
2092
  if (typeof e == "string")
2093
2093
  e = this.nodeType(e);
2094
- else if (e instanceof ji) {
2094
+ else if (e instanceof Ji) {
2095
2095
  if (e.schema != this)
2096
2096
  throw new RangeError("Node type from different schema used (" + e.name + ")");
2097
2097
  } else throw new RangeError("Invalid node type: " + e);
@@ -2121,7 +2121,7 @@ class Em {
2121
2121
  return t;
2122
2122
  }
2123
2123
  }
2124
- function Ui(n, e) {
2124
+ function ji(n, e) {
2125
2125
  let t = [];
2126
2126
  for (let r = 0; r < e.length; r++) {
2127
2127
  let i = e[r], o = n.marks[i], s = o;
@@ -2169,7 +2169,7 @@ class Xt {
2169
2169
  Parse a document from the content of a DOM node.
2170
2170
  */
2171
2171
  parse(e, t = {}) {
2172
- let r = new Yi(this, t, !1);
2172
+ let r = new Gi(this, t, !1);
2173
2173
  return r.addAll(e, E.none, t.from, t.to), r.finish();
2174
2174
  }
2175
2175
  /**
@@ -2181,7 +2181,7 @@ class Xt {
2181
2181
  the left of the input and the end of nodes at the end.
2182
2182
  */
2183
2183
  parseSlice(e, t = {}) {
2184
- let r = new Yi(this, t, !0);
2184
+ let r = new Gi(this, t, !0);
2185
2185
  return r.addAll(e, E.none, t.from, t.to), x.maxOpen(r.finish());
2186
2186
  }
2187
2187
  /**
@@ -2238,13 +2238,13 @@ class Xt {
2238
2238
  for (let i in e.marks) {
2239
2239
  let o = e.marks[i].spec.parseDOM;
2240
2240
  o && o.forEach((s) => {
2241
- r(s = Xi(s)), s.mark || s.ignore || s.clearMark || (s.mark = i);
2241
+ r(s = Yi(s)), s.mark || s.ignore || s.clearMark || (s.mark = i);
2242
2242
  });
2243
2243
  }
2244
2244
  for (let i in e.nodes) {
2245
2245
  let o = e.nodes[i].spec.parseDOM;
2246
2246
  o && o.forEach((s) => {
2247
- r(s = Xi(s)), s.node || s.ignore || s.mark || (s.node = i);
2247
+ r(s = Yi(s)), s.node || s.ignore || s.mark || (s.node = i);
2248
2248
  });
2249
2249
  }
2250
2250
  return t;
@@ -2299,13 +2299,13 @@ const Vs = {
2299
2299
  script: !0,
2300
2300
  style: !0,
2301
2301
  title: !0
2302
- }, Fs = { ol: !0, ul: !0 }, Qt = 1, _r = 2, _t = 4;
2303
- function Gi(n, e, t) {
2304
- return e != null ? (e ? Qt : 0) | (e === "full" ? _r : 0) : n && n.whitespace == "pre" ? Qt | _r : t & ~_t;
2302
+ }, Fs = { ol: !0, ul: !0 }, Qt = 1, _r = 2, Ht = 4;
2303
+ function Ui(n, e, t) {
2304
+ return e != null ? (e ? Qt : 0) | (e === "full" ? _r : 0) : n && n.whitespace == "pre" ? Qt | _r : t & ~Ht;
2305
2305
  }
2306
2306
  class gn {
2307
2307
  constructor(e, t, r, i, o, s) {
2308
- this.type = e, this.attrs = t, this.marks = r, this.solid = i, this.options = s, this.content = [], this.activeMarks = E.none, this.match = o || (s & _t ? null : e.contentMatch);
2308
+ this.type = e, this.attrs = t, this.marks = r, this.solid = i, this.options = s, this.content = [], this.activeMarks = E.none, this.match = o || (s & Ht ? null : e.contentMatch);
2309
2309
  }
2310
2310
  findWrapping(e) {
2311
2311
  if (!this.match) {
@@ -2336,10 +2336,10 @@ class gn {
2336
2336
  return this.type ? this.type.inlineContent : this.content.length ? this.content[0].isInline : e.parentNode && !Vs.hasOwnProperty(e.parentNode.nodeName.toLowerCase());
2337
2337
  }
2338
2338
  }
2339
- class Yi {
2339
+ class Gi {
2340
2340
  constructor(e, t, r) {
2341
2341
  this.parser = e, this.options = t, this.isOpen = r, this.open = 0, this.localPreserveWS = !1;
2342
- let i = t.topNode, o, s = Gi(null, t.preserveWhitespace, 0) | (r ? _t : 0);
2342
+ let i = t.topNode, o, s = Ui(null, t.preserveWhitespace, 0) | (r ? Ht : 0);
2343
2343
  i ? o = new gn(i.type, i.attrs, E.none, !0, t.topMatch || i.type.contentMatch, s) : r ? o = new gn(null, null, E.none, !0, null, s) : o = new gn(e.schema.topNodeType, null, E.none, !0, null, s), this.nodes = [o], this.find = t.findPositions, this.needsBlock = !1;
2344
2344
  }
2345
2345
  get top() {
@@ -2505,7 +2505,7 @@ class Yi {
2505
2505
  o.match && (o.match = o.match.matchType(e.type));
2506
2506
  let s = E.none;
2507
2507
  for (let l of i.concat(e.marks))
2508
- (o.type ? o.type.allowsMarkType(l.type) : Qi(l.type, e.type)) && (s = l.addToSet(s));
2508
+ (o.type ? o.type.allowsMarkType(l.type) : Xi(l.type, e.type)) && (s = l.addToSet(s));
2509
2509
  return o.content.push(e.mark(s)), !0;
2510
2510
  }
2511
2511
  return !1;
@@ -2521,10 +2521,10 @@ class Yi {
2521
2521
  this.closeExtra();
2522
2522
  let s = this.top;
2523
2523
  s.match = s.match && s.match.matchType(e);
2524
- let l = Gi(e, o, s.options);
2525
- s.options & _t && s.content.length == 0 && (l |= _t);
2524
+ let l = Ui(e, o, s.options);
2525
+ s.options & Ht && s.content.length == 0 && (l |= Ht);
2526
2526
  let a = E.none;
2527
- return r = r.filter((c) => (s.type ? s.type.allowsMarkType(c.type) : Qi(c.type, e)) ? (a = c.addToSet(a), !1) : !0), this.nodes.push(new gn(e, t, a, i, null, l)), this.open++, r;
2527
+ return r = r.filter((c) => (s.type ? s.type.allowsMarkType(c.type) : Xi(c.type, e)) ? (a = c.addToSet(a), !1) : !0), this.nodes.push(new gn(e, t, a, i, null, l)), this.open++, r;
2528
2528
  }
2529
2529
  // Make sure all nodes above this.open are finished and added to
2530
2530
  // their parents
@@ -2627,13 +2627,13 @@ function hc(n) {
2627
2627
  function pc(n, e) {
2628
2628
  return (n.matches || n.msMatchesSelector || n.webkitMatchesSelector || n.mozMatchesSelector).call(n, e);
2629
2629
  }
2630
- function Xi(n) {
2630
+ function Yi(n) {
2631
2631
  let e = {};
2632
2632
  for (let t in n)
2633
2633
  e[t] = n[t];
2634
2634
  return e;
2635
2635
  }
2636
- function Qi(n, e) {
2636
+ function Xi(n, e) {
2637
2637
  let t = e.schema.nodes;
2638
2638
  for (let r in t) {
2639
2639
  let i = t[r];
@@ -2747,17 +2747,17 @@ class yt {
2747
2747
  This can be useful as a base to build a custom serializer from.
2748
2748
  */
2749
2749
  static nodesFromSchema(e) {
2750
- let t = Zi(e.nodes);
2750
+ let t = Qi(e.nodes);
2751
2751
  return t.text || (t.text = (r) => r.text), t;
2752
2752
  }
2753
2753
  /**
2754
2754
  Gather the serializers in a schema's mark specs into an object.
2755
2755
  */
2756
2756
  static marksFromSchema(e) {
2757
- return Zi(e.marks);
2757
+ return Qi(e.marks);
2758
2758
  }
2759
2759
  }
2760
- function Zi(n) {
2760
+ function Qi(n) {
2761
2761
  let e = {};
2762
2762
  for (let t in n) {
2763
2763
  let r = n[t].spec.toDOM;
@@ -2768,10 +2768,10 @@ function Zi(n) {
2768
2768
  function yn(n) {
2769
2769
  return n.document || window.document;
2770
2770
  }
2771
- const eo = /* @__PURE__ */ new WeakMap();
2771
+ const Zi = /* @__PURE__ */ new WeakMap();
2772
2772
  function mc(n) {
2773
- let e = eo.get(n);
2774
- return e === void 0 && eo.set(n, e = gc(n)), e;
2773
+ let e = Zi.get(n);
2774
+ return e === void 0 && Zi.set(n, e = gc(n)), e;
2775
2775
  }
2776
2776
  function gc(n) {
2777
2777
  let e = null;
@@ -2833,14 +2833,14 @@ const Ws = 65535, Ks = Math.pow(2, 16);
2833
2833
  function yc(n, e) {
2834
2834
  return n + e * Ks;
2835
2835
  }
2836
- function to(n) {
2836
+ function eo(n) {
2837
2837
  return n & Ws;
2838
2838
  }
2839
2839
  function bc(n) {
2840
2840
  return (n - (n & Ws)) / Ks;
2841
2841
  }
2842
- const Hs = 1, _s = 2, wn = 4, qs = 8;
2843
- class qr {
2842
+ const _s = 1, Hs = 2, wn = 4, qs = 8;
2843
+ class Hr {
2844
2844
  /**
2845
2845
  @internal
2846
2846
  */
@@ -2859,13 +2859,13 @@ class qr {
2859
2859
  Tells you whether the token before the mapped position was deleted.
2860
2860
  */
2861
2861
  get deletedBefore() {
2862
- return (this.delInfo & (Hs | wn)) > 0;
2862
+ return (this.delInfo & (_s | wn)) > 0;
2863
2863
  }
2864
2864
  /**
2865
2865
  True when the token after the mapped position was deleted.
2866
2866
  */
2867
2867
  get deletedAfter() {
2868
- return (this.delInfo & (_s | wn)) > 0;
2868
+ return (this.delInfo & (Hs | wn)) > 0;
2869
2869
  }
2870
2870
  /**
2871
2871
  Tells whether any of the steps mapped through deletes across the
@@ -2890,7 +2890,7 @@ class Z {
2890
2890
  @internal
2891
2891
  */
2892
2892
  recover(e) {
2893
- let t = 0, r = to(e);
2893
+ let t = 0, r = eo(e);
2894
2894
  if (!this.inverted)
2895
2895
  for (let i = 0; i < r; i++)
2896
2896
  t += this.ranges[i * 3 + 2] - this.ranges[i * 3 + 1];
@@ -2916,18 +2916,18 @@ class Z {
2916
2916
  let u = c ? e == a ? -1 : e == d ? 1 : t : t, h = a + i + (u < 0 ? 0 : f);
2917
2917
  if (r)
2918
2918
  return h;
2919
- let p = e == (t < 0 ? a : d) ? null : yc(l / 3, e - a), m = e == a ? _s : e == d ? Hs : wn;
2920
- return (t < 0 ? e != a : e != d) && (m |= qs), new qr(h, m, p);
2919
+ let p = e == (t < 0 ? a : d) ? null : yc(l / 3, e - a), m = e == a ? Hs : e == d ? _s : wn;
2920
+ return (t < 0 ? e != a : e != d) && (m |= qs), new Hr(h, m, p);
2921
2921
  }
2922
2922
  i += f - c;
2923
2923
  }
2924
- return r ? e + i : new qr(e + i, 0, null);
2924
+ return r ? e + i : new Hr(e + i, 0, null);
2925
2925
  }
2926
2926
  /**
2927
2927
  @internal
2928
2928
  */
2929
2929
  touches(e, t) {
2930
- let r = 0, i = to(t), o = this.inverted ? 2 : 1, s = this.inverted ? 1 : 2;
2930
+ let r = 0, i = eo(t), o = this.inverted ? 2 : 1, s = this.inverted ? 1 : 2;
2931
2931
  for (let l = 0; l < this.ranges.length; l += 3) {
2932
2932
  let a = this.ranges[l] - (this.inverted ? r : 0);
2933
2933
  if (a > e)
@@ -3077,7 +3077,7 @@ class Zt {
3077
3077
  }
3078
3078
  i |= l.delInfo, e = l.pos;
3079
3079
  }
3080
- return r ? e : new qr(e, i, null);
3080
+ return r ? e : new Hr(e, i, null);
3081
3081
  }
3082
3082
  }
3083
3083
  const mr = /* @__PURE__ */ Object.create(null);
@@ -3156,11 +3156,11 @@ class B {
3156
3156
  }
3157
3157
  }
3158
3158
  }
3159
- function hi(n, e, t) {
3159
+ function ui(n, e, t) {
3160
3160
  let r = [];
3161
3161
  for (let i = 0; i < n.childCount; i++) {
3162
3162
  let o = n.child(i);
3163
- o.content.size && (o = o.copy(hi(o.content, e, o))), o.isInline && (o = e(o, t, i)), r.push(o);
3163
+ o.content.size && (o = o.copy(ui(o.content, e, o))), o.isInline && (o = e(o, t, i)), r.push(o);
3164
3164
  }
3165
3165
  return b.fromArray(r);
3166
3166
  }
@@ -3172,7 +3172,7 @@ class Be extends j {
3172
3172
  super(), this.from = e, this.to = t, this.mark = r;
3173
3173
  }
3174
3174
  apply(e) {
3175
- let t = e.slice(this.from, this.to), r = e.resolve(this.from), i = r.node(r.sharedDepth(this.to)), o = new x(hi(t.content, (s, l) => !s.isAtom || !l.type.allowsMarkType(this.mark.type) ? s : s.mark(this.mark.addToSet(s.marks)), i), t.openStart, t.openEnd);
3175
+ let t = e.slice(this.from, this.to), r = e.resolve(this.from), i = r.node(r.sharedDepth(this.to)), o = new x(ui(t.content, (s, l) => !s.isAtom || !l.type.allowsMarkType(this.mark.type) ? s : s.mark(this.mark.addToSet(s.marks)), i), t.openStart, t.openEnd);
3176
3176
  return B.fromReplace(e, this.from, this.to, o);
3177
3177
  }
3178
3178
  invert() {
@@ -3211,7 +3211,7 @@ class he extends j {
3211
3211
  super(), this.from = e, this.to = t, this.mark = r;
3212
3212
  }
3213
3213
  apply(e) {
3214
- let t = e.slice(this.from, this.to), r = new x(hi(t.content, (i) => i.mark(this.mark.removeFromSet(i.marks)), e), t.openStart, t.openEnd);
3214
+ let t = e.slice(this.from, this.to), r = new x(ui(t.content, (i) => i.mark(this.mark.removeFromSet(i.marks)), e), t.openStart, t.openEnd);
3215
3215
  return B.fromReplace(e, this.from, this.to, r);
3216
3216
  }
3217
3217
  invert() {
@@ -3335,7 +3335,7 @@ class $ extends j {
3335
3335
  super(), this.from = e, this.to = t, this.slice = r, this.structure = i;
3336
3336
  }
3337
3337
  apply(e) {
3338
- return this.structure && Jr(e, this.from, this.to) ? B.fail("Structure replace would overwrite content") : B.fromReplace(e, this.from, this.to, this.slice);
3338
+ return this.structure && qr(e, this.from, this.to) ? B.fail("Structure replace would overwrite content") : B.fromReplace(e, this.from, this.to, this.slice);
3339
3339
  }
3340
3340
  getMap() {
3341
3341
  return new Z([this.from, this.to - this.from, this.slice.size]);
@@ -3374,7 +3374,7 @@ class $ extends j {
3374
3374
  }
3375
3375
  $.MAP_BIAS = 1;
3376
3376
  j.jsonID("replace", $);
3377
- class _ extends j {
3377
+ class H extends j {
3378
3378
  /**
3379
3379
  Create a replace-around step with the given range and gap.
3380
3380
  `insert` should be the point in the slice into which the content
@@ -3385,7 +3385,7 @@ class _ extends j {
3385
3385
  super(), this.from = e, this.to = t, this.gapFrom = r, this.gapTo = i, this.slice = o, this.insert = s, this.structure = l;
3386
3386
  }
3387
3387
  apply(e) {
3388
- if (this.structure && (Jr(e, this.from, this.gapFrom) || Jr(e, this.gapTo, this.to)))
3388
+ if (this.structure && (qr(e, this.from, this.gapFrom) || qr(e, this.gapTo, this.to)))
3389
3389
  return B.fail("Structure gap-replace would overwrite content");
3390
3390
  let t = e.slice(this.gapFrom, this.gapTo);
3391
3391
  if (t.openStart || t.openEnd)
@@ -3405,11 +3405,11 @@ class _ extends j {
3405
3405
  }
3406
3406
  invert(e) {
3407
3407
  let t = this.gapTo - this.gapFrom;
3408
- return new _(this.from, this.from + this.slice.size + t, this.from + this.insert, this.from + this.insert + t, e.slice(this.from, this.to).removeBetween(this.gapFrom - this.from, this.gapTo - this.from), this.gapFrom - this.from, this.structure);
3408
+ return new H(this.from, this.from + this.slice.size + t, this.from + this.insert, this.from + this.insert + t, e.slice(this.from, this.to).removeBetween(this.gapFrom - this.from, this.gapTo - this.from), this.gapFrom - this.from, this.structure);
3409
3409
  }
3410
3410
  map(e) {
3411
3411
  let t = e.mapResult(this.from, 1), r = e.mapResult(this.to, -1), i = this.from == this.gapFrom ? t.pos : e.map(this.gapFrom, -1), o = this.to == this.gapTo ? r.pos : e.map(this.gapTo, 1);
3412
- return t.deletedAcross && r.deletedAcross || i < t.pos || o > r.pos ? null : new _(t.pos, r.pos, i, o, this.slice, this.insert, this.structure);
3412
+ return t.deletedAcross && r.deletedAcross || i < t.pos || o > r.pos ? null : new H(t.pos, r.pos, i, o, this.slice, this.insert, this.structure);
3413
3413
  }
3414
3414
  toJSON() {
3415
3415
  let e = {
@@ -3428,11 +3428,11 @@ class _ extends j {
3428
3428
  static fromJSON(e, t) {
3429
3429
  if (typeof t.from != "number" || typeof t.to != "number" || typeof t.gapFrom != "number" || typeof t.gapTo != "number" || typeof t.insert != "number")
3430
3430
  throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");
3431
- return new _(t.from, t.to, t.gapFrom, t.gapTo, x.fromJSON(e, t.slice), t.insert, !!t.structure);
3431
+ return new H(t.from, t.to, t.gapFrom, t.gapTo, x.fromJSON(e, t.slice), t.insert, !!t.structure);
3432
3432
  }
3433
3433
  }
3434
- j.jsonID("replaceAround", _);
3435
- function Jr(n, e, t) {
3434
+ j.jsonID("replaceAround", H);
3435
+ function qr(n, e, t) {
3436
3436
  let r = n.resolve(e), i = t - e, o = r.depth;
3437
3437
  for (; i > 0 && o > 0 && r.indexAfter(o) == r.node(o).childCount; )
3438
3438
  o--, i--;
@@ -3485,7 +3485,7 @@ function xc(n, e, t, r) {
3485
3485
  }
3486
3486
  }), i.forEach((s) => n.step(new he(s.from, s.to, s.style)));
3487
3487
  }
3488
- function pi(n, e, t, r = t.contentMatch, i = !0) {
3488
+ function hi(n, e, t, r = t.contentMatch, i = !0) {
3489
3489
  let o = n.doc.nodeAt(e), s = [], l = e + 1;
3490
3490
  for (let a = 0; a < o.childCount; a++) {
3491
3491
  let c = o.child(a), f = l + c.nodeSize, d = r.matchType(c.type);
@@ -3532,13 +3532,13 @@ function wc(n, e, t) {
3532
3532
  let u = b.empty, h = 0;
3533
3533
  for (let p = o, m = !1; p > t; p--)
3534
3534
  m || i.after(p + 1) < i.end(p) ? (m = !0, u = b.from(i.node(p).copy(u)), h++) : c++;
3535
- n.step(new _(a, c, s, l, new x(f.append(u), d, h), f.size - d, !0));
3535
+ n.step(new H(a, c, s, l, new x(f.append(u), d, h), f.size - d, !0));
3536
3536
  }
3537
- function mi(n, e, t = null, r = n) {
3537
+ function pi(n, e, t = null, r = n) {
3538
3538
  let i = Cc(n, e), o = i && Mc(r, e);
3539
- return o ? i.map(no).concat({ type: e, attrs: t }).concat(o.map(no)) : null;
3539
+ return o ? i.map(to).concat({ type: e, attrs: t }).concat(o.map(to)) : null;
3540
3540
  }
3541
- function no(n) {
3541
+ function to(n) {
3542
3542
  return { type: n, attrs: null };
3543
3543
  }
3544
3544
  function Cc(n, e) {
@@ -3568,7 +3568,7 @@ function Oc(n, e, t) {
3568
3568
  r = b.from(t[s].type.create(t[s].attrs, r));
3569
3569
  }
3570
3570
  let i = e.start, o = e.end;
3571
- n.step(new _(i, o, i, o, new x(r, 0, 0), t.length, !0));
3571
+ n.step(new H(i, o, i, o, new x(r, 0, 0), t.length, !0));
3572
3572
  }
3573
3573
  function Tc(n, e, t, r, i) {
3574
3574
  if (!r.isTextblock)
@@ -3582,9 +3582,9 @@ function Tc(n, e, t, r, i) {
3582
3582
  let h = r.whitespace == "pre", p = !!r.contentMatch.matchType(r.schema.linebreakReplacement);
3583
3583
  h && !p ? c = !1 : !h && p && (c = !0);
3584
3584
  }
3585
- c === !1 && js(n, s, l, o), pi(n, n.mapping.slice(o).map(l, 1), r, void 0, c === null);
3585
+ c === !1 && js(n, s, l, o), hi(n, n.mapping.slice(o).map(l, 1), r, void 0, c === null);
3586
3586
  let f = n.mapping.slice(o), d = f.map(l, 1), u = f.map(l + s.nodeSize, 1);
3587
- return n.step(new _(d, u, d + 1, u - 1, new x(b.from(r.create(a, null, s.marks)), 0, 0), 1, !0)), c === !0 && Js(n, s, l, o), !1;
3587
+ return n.step(new H(d, u, d + 1, u - 1, new x(b.from(r.create(a, null, s.marks)), 0, 0), 1, !0)), c === !0 && Js(n, s, l, o), !1;
3588
3588
  }
3589
3589
  });
3590
3590
  }
@@ -3622,7 +3622,7 @@ function Dc(n, e, t, r, i) {
3622
3622
  return n.replaceWith(e, e + o.nodeSize, s);
3623
3623
  if (!t.validContent(o.content))
3624
3624
  throw new RangeError("Invalid content for node type " + t.name);
3625
- n.step(new _(e, e + o.nodeSize, e + 1, e + o.nodeSize - 1, new x(b.from(s), 0, 0), 1, !0));
3625
+ n.step(new H(e, e + o.nodeSize, e + 1, e + o.nodeSize - 1, new x(b.from(s), 0, 0), 1, !0));
3626
3626
  }
3627
3627
  function Mt(n, e, t = 1, r) {
3628
3628
  let i = n.resolve(e), o = i.depth - t, s = r && r[r.length - 1] || i.parent;
@@ -3678,7 +3678,7 @@ function vc(n, e, t) {
3678
3678
  let f = n.doc.resolve(e + t);
3679
3679
  js(n, f.node(), f.before(), l);
3680
3680
  }
3681
- s.inlineContent && pi(n, e + t - 1, s, o.node().contentMatchAt(o.index()), r == null);
3681
+ s.inlineContent && hi(n, e + t - 1, s, o.node().contentMatchAt(o.index()), r == null);
3682
3682
  let a = n.mapping.slice(l), c = a.map(e - t);
3683
3683
  if (n.step(new $(c, a.map(e + t, -1), x.empty, !0)), r === !0) {
3684
3684
  let f = n.doc.resolve(c);
@@ -3729,7 +3729,7 @@ function Us(n, e, t) {
3729
3729
  }
3730
3730
  return null;
3731
3731
  }
3732
- function gi(n, e, t = e, r = x.empty) {
3732
+ function mi(n, e, t = e, r = x.empty) {
3733
3733
  if (e == t && !r.size)
3734
3734
  return null;
3735
3735
  let i = n.resolve(e), o = n.resolve(t);
@@ -3766,7 +3766,7 @@ class Pc {
3766
3766
  for (; s && l && o.childCount == 1; )
3767
3767
  o = o.firstChild.content, s--, l--;
3768
3768
  let a = new x(o, s, l);
3769
- return e > -1 ? new _(r.pos, e, this.$to.pos, this.$to.end(), a, t) : a.size || r.pos != this.$to.pos ? new $(r.pos, i.pos, a) : null;
3769
+ return e > -1 ? new H(r.pos, e, this.$to.pos, this.$to.end(), a, t) : a.size || r.pos != this.$to.pos ? new $(r.pos, i.pos, a) : null;
3770
3770
  }
3771
3771
  // Find a position on the start spine of `this.unplaced` that has
3772
3772
  // content that can be moved somewhere on the frontier. Returns two
@@ -4168,7 +4168,7 @@ class Fc {
4168
4168
  given `slice`.
4169
4169
  */
4170
4170
  replace(e, t = e, r = x.empty) {
4171
- let i = gi(this.doc, e, t, r);
4171
+ let i = mi(this.doc, e, t, r);
4172
4172
  return i && this.step(i), this;
4173
4173
  }
4174
4174
  /**
@@ -4341,7 +4341,7 @@ class Fc {
4341
4341
  third argument.
4342
4342
  */
4343
4343
  clearIncompatible(e, t, r) {
4344
- return pi(this, e, t, r), this;
4344
+ return hi(this, e, t, r), this;
4345
4345
  }
4346
4346
  }
4347
4347
  const br = /* @__PURE__ */ Object.create(null);
@@ -4417,7 +4417,7 @@ let T = class {
4417
4417
  let o = e.steps.length, s = this.ranges;
4418
4418
  for (let l = 0; l < s.length; l++) {
4419
4419
  let { $from: a, $to: c } = s[l], f = e.mapping.slice(o);
4420
- e.replaceRange(f.map(a.pos), f.map(c.pos), l ? x.empty : t), l == 0 && oo(e, o, (r ? r.isInline : i && i.isTextblock) ? -1 : 1);
4420
+ e.replaceRange(f.map(a.pos), f.map(c.pos), l ? x.empty : t), l == 0 && io(e, o, (r ? r.isInline : i && i.isTextblock) ? -1 : 1);
4421
4421
  }
4422
4422
  }
4423
4423
  /**
@@ -4428,7 +4428,7 @@ let T = class {
4428
4428
  let r = e.steps.length, i = this.ranges;
4429
4429
  for (let o = 0; o < i.length; o++) {
4430
4430
  let { $from: s, $to: l } = i[o], a = e.mapping.slice(r), c = a.map(s.pos), f = a.map(l.pos);
4431
- o ? e.deleteRange(c, f) : (e.replaceRangeWith(c, f, t), oo(e, r, t.isInline ? -1 : 1));
4431
+ o ? e.deleteRange(c, f) : (e.replaceRangeWith(c, f, t), io(e, r, t.isInline ? -1 : 1));
4432
4432
  }
4433
4433
  }
4434
4434
  /**
@@ -4518,16 +4518,16 @@ class Wc {
4518
4518
  this.$from = e, this.$to = t;
4519
4519
  }
4520
4520
  }
4521
- let ro = !1;
4522
- function io(n) {
4523
- !ro && !n.parent.inlineContent && (ro = !0, console.warn("TextSelection endpoint not pointing into a node with inline content (" + n.parent.type.name + ")"));
4521
+ let no = !1;
4522
+ function ro(n) {
4523
+ !no && !n.parent.inlineContent && (no = !0, console.warn("TextSelection endpoint not pointing into a node with inline content (" + n.parent.type.name + ")"));
4524
4524
  }
4525
4525
  class k extends T {
4526
4526
  /**
4527
4527
  Construct a text selection between the given points.
4528
4528
  */
4529
4529
  constructor(e, t = e) {
4530
- io(e), io(t), super(e, t);
4530
+ ro(e), ro(t), super(e, t);
4531
4531
  }
4532
4532
  /**
4533
4533
  Returns a resolved position if this is a cursor selection (an
@@ -4628,7 +4628,7 @@ class w extends T {
4628
4628
  return { type: "node", anchor: this.anchor };
4629
4629
  }
4630
4630
  getBookmark() {
4631
- return new yi(this.anchor);
4631
+ return new gi(this.anchor);
4632
4632
  }
4633
4633
  /**
4634
4634
  @internal
@@ -4654,13 +4654,13 @@ class w extends T {
4654
4654
  }
4655
4655
  w.prototype.visible = !1;
4656
4656
  T.jsonID("node", w);
4657
- class yi {
4657
+ class gi {
4658
4658
  constructor(e) {
4659
4659
  this.anchor = e;
4660
4660
  }
4661
4661
  map(e) {
4662
4662
  let { deleted: t, pos: r } = e.mapResult(this.anchor);
4663
- return t ? new Qn(r, r) : new yi(r);
4663
+ return t ? new Qn(r, r) : new gi(r);
4664
4664
  }
4665
4665
  resolve(e) {
4666
4666
  let t = e.resolve(this.anchor), r = t.nodeAfter;
@@ -4727,20 +4727,20 @@ function wt(n, e, t, r, i, o = !1) {
4727
4727
  }
4728
4728
  return null;
4729
4729
  }
4730
- function oo(n, e, t) {
4730
+ function io(n, e, t) {
4731
4731
  let r = n.steps.length - 1;
4732
4732
  if (r < e)
4733
4733
  return;
4734
4734
  let i = n.steps[r];
4735
- if (!(i instanceof $ || i instanceof _))
4735
+ if (!(i instanceof $ || i instanceof H))
4736
4736
  return;
4737
4737
  let o = n.mapping.maps[r], s;
4738
4738
  o.forEach((l, a, c, f) => {
4739
4739
  s == null && (s = f);
4740
4740
  }), n.setSelection(T.near(n.doc.resolve(s), t));
4741
4741
  }
4742
- const so = 1, bn = 2, lo = 4;
4743
- class Hc extends Fc {
4742
+ const oo = 1, bn = 2, so = 4;
4743
+ class _c extends Fc {
4744
4744
  /**
4745
4745
  @internal
4746
4746
  */
@@ -4763,13 +4763,13 @@ class Hc extends Fc {
4763
4763
  setSelection(e) {
4764
4764
  if (e.$from.doc != this.doc)
4765
4765
  throw new RangeError("Selection passed to setSelection must point at the current document");
4766
- return this.curSelection = e, this.curSelectionFor = this.steps.length, this.updated = (this.updated | so) & ~bn, this.storedMarks = null, this;
4766
+ return this.curSelection = e, this.curSelectionFor = this.steps.length, this.updated = (this.updated | oo) & ~bn, this.storedMarks = null, this;
4767
4767
  }
4768
4768
  /**
4769
4769
  Whether the selection was explicitly updated by this transaction.
4770
4770
  */
4771
4771
  get selectionSet() {
4772
- return (this.updated & so) > 0;
4772
+ return (this.updated & oo) > 0;
4773
4773
  }
4774
4774
  /**
4775
4775
  Set the current stored marks.
@@ -4882,24 +4882,24 @@ class Hc extends Fc {
4882
4882
  when updated to the state produced by this transaction.
4883
4883
  */
4884
4884
  scrollIntoView() {
4885
- return this.updated |= lo, this;
4885
+ return this.updated |= so, this;
4886
4886
  }
4887
4887
  /**
4888
4888
  True when this transaction has had `scrollIntoView` called on it.
4889
4889
  */
4890
4890
  get scrolledIntoView() {
4891
- return (this.updated & lo) > 0;
4891
+ return (this.updated & so) > 0;
4892
4892
  }
4893
4893
  }
4894
- function ao(n, e) {
4894
+ function lo(n, e) {
4895
4895
  return !e || !n ? n : n.bind(e);
4896
4896
  }
4897
4897
  class Kt {
4898
4898
  constructor(e, t, r) {
4899
- this.name = e, this.init = ao(t.init, r), this.apply = ao(t.apply, r);
4899
+ this.name = e, this.init = lo(t.init, r), this.apply = lo(t.apply, r);
4900
4900
  }
4901
4901
  }
4902
- const _c = [
4902
+ const Hc = [
4903
4903
  new Kt("doc", {
4904
4904
  init(n) {
4905
4905
  return n.doc || n.schema.topNodeType.createAndFill();
@@ -4935,7 +4935,7 @@ const _c = [
4935
4935
  ];
4936
4936
  class kr {
4937
4937
  constructor(e, t) {
4938
- this.schema = e, this.plugins = [], this.pluginsByKey = /* @__PURE__ */ Object.create(null), this.fields = _c.slice(), t && t.forEach((r) => {
4938
+ this.schema = e, this.plugins = [], this.pluginsByKey = /* @__PURE__ */ Object.create(null), this.fields = Hc.slice(), t && t.forEach((r) => {
4939
4939
  if (this.pluginsByKey[r.key])
4940
4940
  throw new RangeError("Adding different instances of a keyed plugin (" + r.key + ")");
4941
4941
  this.plugins.push(r), this.pluginsByKey[r.key] = r, r.spec.state && this.fields.push(new Kt(r.key, r.spec.state, r));
@@ -5028,7 +5028,7 @@ class pe {
5028
5028
  Accessor that constructs and returns a new [transaction](https://prosemirror.net/docs/ref/#state.Transaction) from this state.
5029
5029
  */
5030
5030
  get tr() {
5031
- return new Hc(this);
5031
+ return new _c(this);
5032
5032
  }
5033
5033
  /**
5034
5034
  Create a new state.
@@ -5172,7 +5172,7 @@ const Jc = (n, e, t) => {
5172
5172
  return !0;
5173
5173
  if (r.parent.content.size == 0 && (At(o, "end") || w.isSelectable(o)))
5174
5174
  for (let s = r.depth; ; s--) {
5175
- let l = gi(n.doc, r.before(s), r.after(s), x.empty);
5175
+ let l = mi(n.doc, r.before(s), r.after(s), x.empty);
5176
5176
  if (l && l.slice.size < l.to - l.from) {
5177
5177
  if (e) {
5178
5178
  let a = n.tr.step(l);
@@ -5231,7 +5231,7 @@ const Gc = (n, e, t) => {
5231
5231
  if (ll(n, i, e, 1))
5232
5232
  return !0;
5233
5233
  if (r.parent.content.size == 0 && (At(o, "start") || w.isSelectable(o))) {
5234
- let s = gi(n.doc, r.before(), r.after(), x.empty);
5234
+ let s = mi(n.doc, r.before(), r.after(), x.empty);
5235
5235
  if (s && s.slice.size < s.to - s.from) {
5236
5236
  if (e) {
5237
5237
  let l = n.tr.step(s);
@@ -5272,7 +5272,7 @@ const Zn = (n, e) => {
5272
5272
  return !t.parent.type.spec.code || !t.sameParent(r) ? !1 : (e && e(n.tr.insertText(`
5273
5273
  `).scrollIntoView()), !0);
5274
5274
  };
5275
- function bi(n) {
5275
+ function yi(n) {
5276
5276
  for (let e = 0; e < n.edgeCount; e++) {
5277
5277
  let { type: t } = n.edge(e);
5278
5278
  if (t.isTextblock && !t.hasRequiredAttrs())
@@ -5284,7 +5284,7 @@ const il = (n, e) => {
5284
5284
  let { $head: t, $anchor: r } = n.selection;
5285
5285
  if (!t.parent.type.spec.code || !t.sameParent(r))
5286
5286
  return !1;
5287
- let i = t.node(-1), o = t.indexAfter(-1), s = bi(i.contentMatchAt(o));
5287
+ let i = t.node(-1), o = t.indexAfter(-1), s = yi(i.contentMatchAt(o));
5288
5288
  if (!s || !i.canReplaceWith(o, o, s))
5289
5289
  return !1;
5290
5290
  if (e) {
@@ -5296,7 +5296,7 @@ const il = (n, e) => {
5296
5296
  let t = n.selection, { $from: r, $to: i } = t;
5297
5297
  if (t instanceof Y || r.parent.inlineContent || i.parent.inlineContent)
5298
5298
  return !1;
5299
- let o = bi(i.parent.contentMatchAt(i.indexAfter()));
5299
+ let o = yi(i.parent.contentMatchAt(i.indexAfter()));
5300
5300
  if (!o || !o.isTextblock)
5301
5301
  return !1;
5302
5302
  if (e) {
@@ -5326,7 +5326,7 @@ function Zc(n) {
5326
5326
  let o = [], s, l, a = !1, c = !1;
5327
5327
  for (let h = r.depth; ; h--)
5328
5328
  if (r.node(h).isBlock) {
5329
- a = r.end(h) == r.pos + (r.depth - h), c = r.start(h) == r.pos - (r.depth - h), l = bi(r.node(h - 1).contentMatchAt(r.indexAfter(h - 1))), o.unshift(a && l ? { type: l } : null), s = h;
5329
+ a = r.end(h) == r.pos + (r.depth - h), c = r.start(h) == r.pos - (r.depth - h), l = yi(r.node(h - 1).contentMatchAt(r.indexAfter(h - 1))), o.unshift(a && l ? { type: l } : null), s = h;
5330
5330
  break;
5331
5331
  } else {
5332
5332
  if (h == 1)
@@ -5364,7 +5364,7 @@ function ll(n, e, t, r) {
5364
5364
  for (let y = s.length - 1; y >= 0; y--)
5365
5365
  p = b.from(s[y].create(null, p));
5366
5366
  p = b.from(i.copy(p));
5367
- let m = n.tr.step(new _(e.pos - 1, h, e.pos, h, new x(p, 1, 0), s.length, !0)), g = m.doc.resolve(h + 2 * s.length);
5367
+ let m = n.tr.step(new H(e.pos - 1, h, e.pos, h, new x(p, 1, 0), s.length, !0)), g = m.doc.resolve(h + 2 * s.length);
5368
5368
  g.nodeAfter && g.nodeAfter.type == i.type && Xn(m.doc, g.pos) && m.join(g.pos), t(m.scrollIntoView());
5369
5369
  }
5370
5370
  return !0;
@@ -5384,7 +5384,7 @@ function ll(n, e, t, r) {
5384
5384
  let y = b.empty;
5385
5385
  for (let M = p.length - 1; M >= 0; M--)
5386
5386
  y = b.from(p[M].copy(y));
5387
- let C = n.tr.step(new _(e.pos - p.length, e.pos + o.nodeSize, e.pos + g, e.pos + o.nodeSize - g, new x(y, p.length, 0), 0, !0));
5387
+ let C = n.tr.step(new H(e.pos - p.length, e.pos + o.nodeSize, e.pos + g, e.pos + o.nodeSize - g, new x(y, p.length, 0), 0, !0));
5388
5388
  t(C.scrollIntoView());
5389
5389
  }
5390
5390
  return !0;
@@ -5406,7 +5406,7 @@ function al(n) {
5406
5406
  const rf = al(-1), of = al(1);
5407
5407
  function Rn(n, e = null) {
5408
5408
  return function(t, r) {
5409
- let { $from: i, $to: o } = t.selection, s = i.blockRange(o), l = s && mi(s, n, e);
5409
+ let { $from: i, $to: o } = t.selection, s = i.blockRange(o), l = s && pi(s, n, e);
5410
5410
  return l ? (r && r(t.tr.wrap(s, l).scrollIntoView()), !0) : !1;
5411
5411
  };
5412
5412
  }
@@ -5485,15 +5485,15 @@ function er(...n) {
5485
5485
  return !1;
5486
5486
  };
5487
5487
  }
5488
- let Sr = er(tl, Jc, jc), co = er(tl, Gc, Yc);
5488
+ let Sr = er(tl, Jc, jc), ao = er(tl, Gc, Yc);
5489
5489
  const xe = {
5490
5490
  Enter: er(Xc, Qc, ol, ef),
5491
5491
  "Mod-Enter": il,
5492
5492
  Backspace: Sr,
5493
5493
  "Mod-Backspace": Sr,
5494
5494
  "Shift-Backspace": Sr,
5495
- Delete: co,
5496
- "Mod-Delete": co,
5495
+ Delete: ao,
5496
+ "Mod-Delete": ao,
5497
5497
  "Mod-a": tf
5498
5498
  }, cl = {
5499
5499
  "Ctrl-h": xe.Backspace,
@@ -5669,14 +5669,14 @@ function yf(n, e, t, r = null) {
5669
5669
  let a = s.resolve(e.start - 2);
5670
5670
  o = new In(a, a, e.depth), e.endIndex < e.parent.childCount && (e = new In(e.$from, s.resolve(e.$to.end(e.depth)), e.depth)), i = !0;
5671
5671
  }
5672
- let l = mi(o, t, r, e);
5672
+ let l = pi(o, t, r, e);
5673
5673
  return l ? (n && bf(n, e, l, i, t), !0) : !1;
5674
5674
  }
5675
5675
  function bf(n, e, t, r, i) {
5676
5676
  let o = b.empty;
5677
5677
  for (let f = t.length - 1; f >= 0; f--)
5678
5678
  o = b.from(t[f].type.create(t[f].attrs, o));
5679
- n.step(new _(e.start - (r ? 2 : 0), e.end, e.start, e.end, new x(o, 0, 0), t.length, !0));
5679
+ n.step(new H(e.start - (r ? 2 : 0), e.end, e.start, e.end, new x(o, 0, 0), t.length, !0));
5680
5680
  let s = 0;
5681
5681
  for (let f = 0; f < t.length; f++)
5682
5682
  t[f].type == i && (s = f + 1);
@@ -5723,7 +5723,7 @@ function tn(n) {
5723
5723
  }
5724
5724
  function kf(n, e, t, r) {
5725
5725
  let i = n.tr, o = r.end, s = r.$to.end(r.depth);
5726
- o < s && (i.step(new _(o - 1, s, o, s, new x(b.from(t.create(null, r.parent.copy())), 1, 0), 1, !0)), r = new In(i.doc.resolve(r.$from.pos), i.doc.resolve(s), r.depth));
5726
+ o < s && (i.step(new H(o - 1, s, o, s, new x(b.from(t.create(null, r.parent.copy())), 1, 0), 1, !0)), r = new In(i.doc.resolve(r.$from.pos), i.doc.resolve(s), r.depth));
5727
5727
  const l = Bt(r);
5728
5728
  if (l == null)
5729
5729
  return !1;
@@ -5742,7 +5742,7 @@ function xf(n, e, t) {
5742
5742
  if (!c.canReplace(f + (l ? 0 : 1), f + 1, s.content.append(a ? b.empty : b.from(i))))
5743
5743
  return !1;
5744
5744
  let d = o.pos, u = d + s.nodeSize;
5745
- return r.step(new _(d - (l ? 1 : 0), u + (a ? 1 : 0), d + 1, u - 1, new x((l ? b.empty : b.from(i.copy(b.empty))).append(a ? b.empty : b.from(i.copy(b.empty))), l ? 0 : 1, a ? 0 : 1), l ? 0 : 1)), e(r.scrollIntoView()), !0;
5745
+ return r.step(new H(d - (l ? 1 : 0), u + (a ? 1 : 0), d + 1, u - 1, new x((l ? b.empty : b.from(i.copy(b.empty))).append(a ? b.empty : b.from(i.copy(b.empty))), l ? 0 : 1, a ? 0 : 1), l ? 0 : 1)), e(r.scrollIntoView()), !0;
5746
5746
  }
5747
5747
  const K = function(n) {
5748
5748
  for (var e = 0; ; e++)
@@ -5752,16 +5752,16 @@ const K = function(n) {
5752
5752
  let e = n.assignedSlot || n.parentNode;
5753
5753
  return e && e.nodeType == 11 ? e.host : e;
5754
5754
  };
5755
- let jr = null;
5755
+ let Jr = null;
5756
5756
  const ke = function(n, e, t) {
5757
- let r = jr || (jr = document.createRange());
5757
+ let r = Jr || (Jr = document.createRange());
5758
5758
  return r.setEnd(n, t ?? n.nodeValue.length), r.setStart(n, e || 0), r;
5759
5759
  }, Sf = function() {
5760
- jr = null;
5760
+ Jr = null;
5761
5761
  }, ht = function(n, e, t, r) {
5762
- return t && (fo(n, e, t, r, -1) || fo(n, e, t, r, 1));
5762
+ return t && (co(n, e, t, r, -1) || co(n, e, t, r, 1));
5763
5763
  }, wf = /^(img|br|input|textarea|hr)$/i;
5764
- function fo(n, e, t, r, i) {
5764
+ function co(n, e, t, r, i) {
5765
5765
  for (var o; ; ) {
5766
5766
  if (n == t && e == r)
5767
5767
  return !0;
@@ -5857,9 +5857,9 @@ function Nf(n, e, t) {
5857
5857
  return { node: r.startContainer, offset: Math.min(ie(r.startContainer), r.startOffset) };
5858
5858
  }
5859
5859
  }
5860
- const me = typeof navigator < "u" ? navigator : null, uo = typeof document < "u" ? document : null, je = me && me.userAgent || "", Ur = /Edge\/(\d+)/.exec(je), ul = /MSIE \d/.exec(je), Gr = /Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(je), X = !!(ul || Gr || Ur), $e = ul ? document.documentMode : Gr ? +Gr[1] : Ur ? +Ur[1] : 0, oe = !X && /gecko\/(\d+)/i.test(je);
5860
+ const me = typeof navigator < "u" ? navigator : null, fo = typeof document < "u" ? document : null, je = me && me.userAgent || "", jr = /Edge\/(\d+)/.exec(je), ul = /MSIE \d/.exec(je), Ur = /Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(je), X = !!(ul || Ur || jr), $e = ul ? document.documentMode : Ur ? +Ur[1] : jr ? +jr[1] : 0, oe = !X && /gecko\/(\d+)/i.test(je);
5861
5861
  oe && +(/Firefox\/(\d+)/.exec(je) || [0, 0])[1];
5862
- const Yr = !X && /Chrome\/(\d+)/.exec(je), H = !!Yr, hl = Yr ? +Yr[1] : 0, J = !X && !!me && /Apple Computer/.test(me.vendor), Rt = J && (/Mobile\/\w+/.test(je) || !!me && me.maxTouchPoints > 2), re = Rt || (me ? /Mac/.test(me.platform) : !1), pl = me ? /Win/.test(me.platform) : !1, Se = /Android \d/.test(je), dn = !!uo && "webkitFontSmoothing" in uo.documentElement.style, Df = dn ? +(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent) || [0, 0])[1] : 0;
5862
+ const Gr = !X && /Chrome\/(\d+)/.exec(je), _ = !!Gr, hl = Gr ? +Gr[1] : 0, J = !X && !!me && /Apple Computer/.test(me.vendor), Rt = J && (/Mobile\/\w+/.test(je) || !!me && me.maxTouchPoints > 2), re = Rt || (me ? /Mac/.test(me.platform) : !1), pl = me ? /Win/.test(me.platform) : !1, Se = /Android \d/.test(je), dn = !!fo && "webkitFontSmoothing" in fo.documentElement.style, Df = dn ? +(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent) || [0, 0])[1] : 0;
5863
5863
  function Ef(n) {
5864
5864
  let e = n.defaultView && n.defaultView.visualViewport;
5865
5865
  return e ? {
@@ -5886,8 +5886,8 @@ function Af(n) {
5886
5886
  bottom: e.top + n.clientHeight * r
5887
5887
  };
5888
5888
  }
5889
- function ho(n, e, t) {
5890
- if (!Xr(e) && e.left == 0)
5889
+ function uo(n, e, t) {
5890
+ if (!Yr(e) && e.left == 0)
5891
5891
  return;
5892
5892
  let r = n.someProp("scrollThreshold") || 0, i = n.someProp("scrollMargin") || 5, o = n.dom.ownerDocument;
5893
5893
  for (let s = t || n.dom; s; ) {
@@ -5987,14 +5987,14 @@ function Pf(n, e) {
5987
5987
  for (let o = 0; o < t; o++) {
5988
5988
  r.setEnd(n, o + 1), r.setStart(n, o);
5989
5989
  let s = Ee(r, 1);
5990
- if (s.top != s.bottom && ki(e, s)) {
5990
+ if (s.top != s.bottom && bi(e, s)) {
5991
5991
  i = { node: n, offset: o + (e.left >= (s.left + s.right) / 2 ? 1 : 0) };
5992
5992
  break;
5993
5993
  }
5994
5994
  }
5995
5995
  return r.detach(), i || { node: n, offset: 0 };
5996
5996
  }
5997
- function ki(n, e) {
5997
+ function bi(n, e) {
5998
5998
  return n.left >= e.left - 1 && n.left <= e.right + 1 && n.top >= e.top - 1 && n.top <= e.bottom + 1;
5999
5999
  }
6000
6000
  function Bf(n, e) {
@@ -6031,7 +6031,7 @@ function bl(n, e, t) {
6031
6031
  let l = s.getClientRects();
6032
6032
  for (let a = 0; a < l.length; a++) {
6033
6033
  let c = l[a];
6034
- if (ki(e, c))
6034
+ if (bi(e, c))
6035
6035
  return bl(s, e, c);
6036
6036
  }
6037
6037
  }
@@ -6046,7 +6046,7 @@ function $f(n, e) {
6046
6046
  let s = (n.root.elementFromPoint ? n.root : t).elementFromPoint(e.left, e.top), l;
6047
6047
  if (!s || !n.dom.contains(s.nodeType != 1 ? s.parentNode : s)) {
6048
6048
  let c = n.dom.getBoundingClientRect();
6049
- if (!ki(e, c) || (s = bl(n.dom, e, c), !s))
6049
+ if (!bi(e, c) || (s = bl(n.dom, e, c), !s))
6050
6050
  return null;
6051
6051
  }
6052
6052
  if (J)
@@ -6064,17 +6064,17 @@ function $f(n, e) {
6064
6064
  let a = n.docView.nearestDesc(s, !0);
6065
6065
  return { pos: l, inside: a ? a.posAtStart - a.border : -1 };
6066
6066
  }
6067
- function Xr(n) {
6067
+ function Yr(n) {
6068
6068
  return n.top < n.bottom || n.left < n.right;
6069
6069
  }
6070
6070
  function Ee(n, e) {
6071
6071
  let t = n.getClientRects();
6072
6072
  if (t.length) {
6073
6073
  let r = t[e < 0 ? 0 : t.length - 1];
6074
- if (Xr(r))
6074
+ if (Yr(r))
6075
6075
  return r;
6076
6076
  }
6077
- return Array.prototype.find.call(t, Xr) || n.getBoundingClientRect();
6077
+ return Array.prototype.find.call(t, Yr) || n.getBoundingClientRect();
6078
6078
  }
6079
6079
  const Vf = /[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;
6080
6080
  function kl(n, e, t) {
@@ -6193,11 +6193,11 @@ function Kf(n, e, t) {
6193
6193
  return u != null && (l.caretBidiLevel = u), g;
6194
6194
  }) : r.pos == r.start() || r.pos == r.end();
6195
6195
  }
6196
- let po = null, mo = null, go = !1;
6197
- function Hf(n, e, t) {
6198
- return po == e && mo == t ? go : (po = e, mo = t, go = t == "up" || t == "down" ? Ff(n, e, t) : Kf(n, e, t));
6196
+ let ho = null, po = null, mo = !1;
6197
+ function _f(n, e, t) {
6198
+ return ho == e && po == t ? mo : (ho = e, po = t, mo = t == "up" || t == "down" ? Ff(n, e, t) : Kf(n, e, t));
6199
6199
  }
6200
- const se = 0, yo = 1, et = 2, de = 3;
6200
+ const se = 0, go = 1, et = 2, de = 3;
6201
6201
  class un {
6202
6202
  constructor(e, t, r, i) {
6203
6203
  this.parent = e, this.children = t, this.dom = r, this.contentDOM = i, this.dirty = se, r.pmViewDesc = this;
@@ -6513,7 +6513,7 @@ class un {
6513
6513
  if (r == s ? e <= s && t >= r : e < s && t > r) {
6514
6514
  let l = r + o.border, a = s - o.border;
6515
6515
  if (e >= l && t <= a) {
6516
- this.dirty = e == r || t == s ? et : yo, e == l && t == a && (o.contentLost || o.dom.parentNode != this.contentDOM) ? o.dirty = de : o.markDirty(e - l, t - l);
6516
+ this.dirty = e == r || t == s ? et : go, e == l && t == a && (o.contentLost || o.dom.parentNode != this.contentDOM) ? o.dirty = de : o.markDirty(e - l, t - l);
6517
6517
  return;
6518
6518
  } else
6519
6519
  o.dirty = o.dom == o.contentDOM && o.dom.parentNode == this.contentDOM && !o.children.length ? et : de;
@@ -6525,7 +6525,7 @@ class un {
6525
6525
  markParentsDirty() {
6526
6526
  let e = 1;
6527
6527
  for (let t = this.parent; t; t = t.parent, e++) {
6528
- let r = e == 1 ? et : yo;
6528
+ let r = e == 1 ? et : go;
6529
6529
  t.dirty < r && (t.dirty = r);
6530
6530
  }
6531
6531
  }
@@ -6585,7 +6585,7 @@ class Sl extends un {
6585
6585
  return this.widget.type.side;
6586
6586
  }
6587
6587
  }
6588
- class _f extends un {
6588
+ class Hf extends un {
6589
6589
  constructor(e, t, r, i) {
6590
6590
  super(e, [], t, null), this.textDOM = r, this.text = i;
6591
6591
  }
@@ -6626,7 +6626,7 @@ class Ve extends un {
6626
6626
  }
6627
6627
  slice(e, t, r) {
6628
6628
  let i = Ve.create(this.parent, this.mark, !0, r), o = this.children, s = this.size;
6629
- t < s && (o = Zr(o, t, s, r)), e > 0 && (o = Zr(o, 0, e, r));
6629
+ t < s && (o = Qr(o, t, s, r)), e > 0 && (o = Qr(o, 0, e, r));
6630
6630
  for (let l = 0; l < o.length; l++)
6631
6631
  o[l].parent = i;
6632
6632
  return i.children = o, i;
@@ -6738,8 +6738,8 @@ class Fe extends un {
6738
6738
  o.parentNode.removeChild(o.nextSibling);
6739
6739
  o.pmViewDesc && (o.pmViewDesc = void 0);
6740
6740
  }
6741
- let s = new _f(this, o, t, i);
6742
- e.input.compositionNodes.push(s), this.children = Zr(this.children, r, r + i.length, e, s);
6741
+ let s = new Hf(this, o, t, i);
6742
+ e.input.compositionNodes.push(s), this.children = Qr(this.children, r, r + i.length, e, s);
6743
6743
  }
6744
6744
  // If this desc must be updated to match the given node decoration,
6745
6745
  // do so and return true.
@@ -6753,7 +6753,7 @@ class Fe extends un {
6753
6753
  if (Bn(e, this.outerDeco))
6754
6754
  return;
6755
6755
  let t = this.nodeDOM.nodeType != 1, r = this.dom;
6756
- this.dom = Ml(this.dom, this.nodeDOM, Qr(this.outerDeco, this.node, t), Qr(e, this.node, t)), this.dom != r && (r.pmViewDesc = void 0, this.dom.pmViewDesc = this), this.outerDeco = e;
6756
+ this.dom = Ml(this.dom, this.nodeDOM, Xr(this.outerDeco, this.node, t), Xr(e, this.node, t)), this.dom != r && (r.pmViewDesc = void 0, this.dom.pmViewDesc = this), this.outerDeco = e;
6757
6757
  }
6758
6758
  // Mark this node as being the selected node.
6759
6759
  selectNode() {
@@ -6767,7 +6767,7 @@ class Fe extends un {
6767
6767
  return this.node.isAtom;
6768
6768
  }
6769
6769
  }
6770
- function bo(n, e, t, r, i) {
6770
+ function yo(n, e, t, r, i) {
6771
6771
  Ol(r, e, n);
6772
6772
  let o = new Fe(void 0, n, e, t, r, r, r);
6773
6773
  return o.contentDOM && o.updateChildren(i, 0), o;
@@ -6869,7 +6869,7 @@ function Cl(n, e, t) {
6869
6869
  let s = e[o], l = s.dom;
6870
6870
  if (l.parentNode == n) {
6871
6871
  for (; l != r; )
6872
- r = ko(r), i = !0;
6872
+ r = bo(r), i = !0;
6873
6873
  r = r.nextSibling;
6874
6874
  } else
6875
6875
  i = !0, n.insertBefore(l, r);
@@ -6879,7 +6879,7 @@ function Cl(n, e, t) {
6879
6879
  }
6880
6880
  }
6881
6881
  for (; r; )
6882
- r = ko(r), i = !0;
6882
+ r = bo(r), i = !0;
6883
6883
  i && t.trackWrites == n && (t.trackWrites = null);
6884
6884
  }
6885
6885
  const qt = function(n) {
@@ -6887,7 +6887,7 @@ const qt = function(n) {
6887
6887
  };
6888
6888
  qt.prototype = /* @__PURE__ */ Object.create(null);
6889
6889
  const tt = [new qt()];
6890
- function Qr(n, e, t) {
6890
+ function Xr(n, e, t) {
6891
6891
  if (n.length == 0)
6892
6892
  return tt;
6893
6893
  let r = t ? tt[0] : new qt(), i = [r];
@@ -6940,7 +6940,7 @@ function Jf(n, e, t) {
6940
6940
  }
6941
6941
  }
6942
6942
  function Ol(n, e, t) {
6943
- return Ml(n, n, tt, Qr(e, t, n.nodeType != 1));
6943
+ return Ml(n, n, tt, Xr(e, t, n.nodeType != 1));
6944
6944
  }
6945
6945
  function Bn(n, e) {
6946
6946
  if (n.length != e.length)
@@ -6950,7 +6950,7 @@ function Bn(n, e) {
6950
6950
  return !1;
6951
6951
  return !0;
6952
6952
  }
6953
- function ko(n) {
6953
+ function bo(n) {
6954
6954
  let e = n.nextSibling;
6955
6955
  return n.parentNode.removeChild(n), e;
6956
6956
  }
@@ -7093,7 +7093,7 @@ class jf {
7093
7093
  for (; e instanceof Ve; )
7094
7094
  t = e, e = t.children[t.children.length - 1];
7095
7095
  (!e || // Empty textblock
7096
- !(e instanceof nr) || /\n$/.test(e.node.text) || this.view.requiresGeckoHackNode && /\s$/.test(e.node.text)) && ((J || H) && e && e.dom.contentEditable == "false" && this.addHackNode("IMG", t), this.addHackNode("BR", this.top));
7096
+ !(e instanceof nr) || /\n$/.test(e.node.text) || this.view.requiresGeckoHackNode && /\s$/.test(e.node.text)) && ((J || _) && e && e.dom.contentEditable == "false" && this.addHackNode("IMG", t), this.addHackNode("BR", this.top));
7097
7097
  }
7098
7098
  addHackNode(e, t) {
7099
7099
  if (t == this.top && this.index < t.children.length && t.children[this.index].matchesHack(e))
@@ -7217,7 +7217,7 @@ function Qf(n, e, t, r) {
7217
7217
  }
7218
7218
  return -1;
7219
7219
  }
7220
- function Zr(n, e, t, r, i) {
7220
+ function Qr(n, e, t, r, i) {
7221
7221
  let o = [];
7222
7222
  for (let s = 0, l = 0; s < n.length; s++) {
7223
7223
  let a = n[s], c = l, f = l += a.size;
@@ -7225,7 +7225,7 @@ function Zr(n, e, t, r, i) {
7225
7225
  }
7226
7226
  return o;
7227
7227
  }
7228
- function xi(n, e = null) {
7228
+ function ki(n, e = null) {
7229
7229
  let t = n.domSelectionRange(), r = n.state.doc;
7230
7230
  if (!t.focusNode)
7231
7231
  return null;
@@ -7259,7 +7259,7 @@ function xi(n, e = null) {
7259
7259
  let f = r.resolve(a);
7260
7260
  if (!c) {
7261
7261
  let d = e == "pointer" || n.state.selection.head < l.pos && !o ? 1 : -1;
7262
- c = Si(n, f, l, d);
7262
+ c = xi(n, f, l, d);
7263
7263
  }
7264
7264
  return c;
7265
7265
  }
@@ -7271,7 +7271,7 @@ function Ce(n, e = !1) {
7271
7271
  if (Nl(n, t), !Tl(n))
7272
7272
  return;
7273
7273
  let r = n.input.mouseDown;
7274
- if (!e && H && r) {
7274
+ if (!e && _ && r) {
7275
7275
  let i = n.domSelectionRange(), o = n.domObserver.currentSelection;
7276
7276
  if (i.anchorNode && o.anchorNode && ht(i.anchorNode, i.anchorOffset, o.anchorNode, o.anchorOffset) && r.delaySelUpdate()) {
7277
7277
  n.domObserver.setCurSelection();
@@ -7282,12 +7282,12 @@ function Ce(n, e = !1) {
7282
7282
  ed(n);
7283
7283
  else {
7284
7284
  let { anchor: i, head: o } = t, s, l;
7285
- xo && !(t instanceof k) && (t.$from.parent.inlineContent || (s = So(n, t.from)), !t.empty && !t.$from.parent.inlineContent && (l = So(n, t.to))), n.docView.setSelection(i, o, n, e), xo && (s && wo(s), l && wo(l)), t.visible ? n.dom.classList.remove("ProseMirror-hideselection") : (n.dom.classList.add("ProseMirror-hideselection"), "onselectionchange" in document && Zf(n));
7285
+ ko && !(t instanceof k) && (t.$from.parent.inlineContent || (s = xo(n, t.from)), !t.empty && !t.$from.parent.inlineContent && (l = xo(n, t.to))), n.docView.setSelection(i, o, n, e), ko && (s && So(s), l && So(l)), t.visible ? n.dom.classList.remove("ProseMirror-hideselection") : (n.dom.classList.add("ProseMirror-hideselection"), "onselectionchange" in document && Zf(n));
7286
7286
  }
7287
7287
  n.domObserver.setCurSelection(), n.domObserver.connectSelection();
7288
7288
  }
7289
- const xo = J || H && hl < 63;
7290
- function So(n, e) {
7289
+ const ko = J || _ && hl < 63;
7290
+ function xo(n, e) {
7291
7291
  let { node: t, offset: r } = n.docView.domFromPos(e, 0), i = r < t.childNodes.length ? t.childNodes[r] : null, o = r ? t.childNodes[r - 1] : null;
7292
7292
  if (J && i && i.contentEditable == "false")
7293
7293
  return Or(i);
@@ -7301,7 +7301,7 @@ function So(n, e) {
7301
7301
  function Or(n) {
7302
7302
  return n.contentEditable = "true", J && n.draggable && (n.draggable = !1, n.wasDraggable = !0), n;
7303
7303
  }
7304
- function wo(n) {
7304
+ function So(n) {
7305
7305
  n.contentEditable = "false", n.wasDraggable && (n.draggable = !0, n.wasDraggable = null);
7306
7306
  }
7307
7307
  function Zf(n) {
@@ -7324,17 +7324,17 @@ function ed(n) {
7324
7324
  function Nl(n, e) {
7325
7325
  if (e instanceof w) {
7326
7326
  let t = n.docView.descAt(e.from);
7327
- t != n.lastSelectedViewDesc && (Co(n), t && t.selectNode(), n.lastSelectedViewDesc = t);
7327
+ t != n.lastSelectedViewDesc && (wo(n), t && t.selectNode(), n.lastSelectedViewDesc = t);
7328
7328
  } else
7329
- Co(n);
7329
+ wo(n);
7330
7330
  }
7331
- function Co(n) {
7331
+ function wo(n) {
7332
7332
  n.lastSelectedViewDesc && (n.lastSelectedViewDesc.parent && n.lastSelectedViewDesc.deselectNode(), n.lastSelectedViewDesc = void 0);
7333
7333
  }
7334
- function Si(n, e, t, r) {
7334
+ function xi(n, e, t, r) {
7335
7335
  return n.someProp("createSelectionBetween", (i) => i(n, e, t)) || k.between(e, t, r);
7336
7336
  }
7337
- function Mo(n) {
7337
+ function Co(n) {
7338
7338
  return n.editable && !n.hasFocus() ? !1 : Dl(n);
7339
7339
  }
7340
7340
  function Dl(n) {
@@ -7351,14 +7351,14 @@ function td(n) {
7351
7351
  let e = n.docView.domFromPos(n.state.selection.anchor, 0), t = n.domSelectionRange();
7352
7352
  return ht(e.node, e.offset, t.anchorNode, t.anchorOffset);
7353
7353
  }
7354
- function ei(n, e) {
7354
+ function Zr(n, e) {
7355
7355
  let { $anchor: t, $head: r } = n.selection, i = e > 0 ? t.max(r) : t.min(r), o = i.parent.inlineContent ? i.depth ? n.doc.resolve(e > 0 ? i.after() : i.before()) : null : i;
7356
7356
  return o && T.findFrom(o, e);
7357
7357
  }
7358
7358
  function Ie(n, e) {
7359
7359
  return n.dispatch(n.state.tr.setSelection(e).scrollIntoView()), !0;
7360
7360
  }
7361
- function Oo(n, e, t) {
7361
+ function Mo(n, e, t) {
7362
7362
  let r = n.state.selection;
7363
7363
  if (r instanceof k)
7364
7364
  if (t.indexOf("s") > -1) {
@@ -7369,7 +7369,7 @@ function Oo(n, e, t) {
7369
7369
  return Ie(n, new k(r.$anchor, s));
7370
7370
  } else if (r.empty) {
7371
7371
  if (n.endOfTextblock(e > 0 ? "forward" : "backward")) {
7372
- let i = ei(n.state, e);
7372
+ let i = Zr(n.state, e);
7373
7373
  return i && i instanceof w ? Ie(n, i) : !1;
7374
7374
  } else if (!(re && t.indexOf("m") > -1)) {
7375
7375
  let i = r.$head, o = i.textOffset ? null : e < 0 ? i.nodeBefore : i.nodeAfter, s;
@@ -7383,7 +7383,7 @@ function Oo(n, e, t) {
7383
7383
  if (r instanceof w && r.node.isInline)
7384
7384
  return Ie(n, new k(e > 0 ? r.$to : r.$from));
7385
7385
  {
7386
- let i = ei(n.state, e);
7386
+ let i = Zr(n.state, e);
7387
7387
  return i ? Ie(n, i) : !1;
7388
7388
  }
7389
7389
  }
@@ -7432,7 +7432,7 @@ function nd(n) {
7432
7432
  }
7433
7433
  }
7434
7434
  }
7435
- s ? ti(n, t, r) : i && ti(n, i, o);
7435
+ s ? ei(n, t, r) : i && ei(n, i, o);
7436
7436
  }
7437
7437
  function rd(n) {
7438
7438
  let e = n.domSelectionRange(), t = e.focusNode, r = e.focusOffset;
@@ -7464,7 +7464,7 @@ function rd(n) {
7464
7464
  }
7465
7465
  }
7466
7466
  }
7467
- o && ti(n, o, s);
7467
+ o && ei(n, o, s);
7468
7468
  }
7469
7469
  function El(n) {
7470
7470
  let e = n.pmViewDesc;
@@ -7494,7 +7494,7 @@ function od(n, e) {
7494
7494
  n = t, e = n.childNodes.length;
7495
7495
  }
7496
7496
  }
7497
- function ti(n, e, t) {
7497
+ function ei(n, e, t) {
7498
7498
  if (e.nodeType != 3) {
7499
7499
  let o, s;
7500
7500
  (s = id(e, t)) ? (e = s, t = 0) : (o = od(e, t)) && (e = o, t = o.nodeValue.length);
@@ -7512,9 +7512,9 @@ function ti(n, e, t) {
7512
7512
  n.state == i && Ce(n);
7513
7513
  }, 50);
7514
7514
  }
7515
- function To(n, e) {
7515
+ function Oo(n, e) {
7516
7516
  let t = n.state.doc.resolve(e);
7517
- if (!(H || pl) && t.parent.inlineContent) {
7517
+ if (!(_ || pl) && t.parent.inlineContent) {
7518
7518
  let i = n.coordsAtPos(e);
7519
7519
  if (e > t.start()) {
7520
7520
  let o = n.coordsAtPos(e - 1), s = (o.top + o.bottom) / 2;
@@ -7529,13 +7529,13 @@ function To(n, e) {
7529
7529
  }
7530
7530
  return getComputedStyle(n.dom).direction == "rtl" ? "rtl" : "ltr";
7531
7531
  }
7532
- function No(n, e, t) {
7532
+ function To(n, e, t) {
7533
7533
  let r = n.state.selection;
7534
7534
  if (r instanceof k && !r.empty || t.indexOf("s") > -1 || re && t.indexOf("m") > -1)
7535
7535
  return !1;
7536
7536
  let { $from: i, $to: o } = r;
7537
7537
  if (!i.parent.inlineContent || n.endOfTextblock(e < 0 ? "up" : "down")) {
7538
- let s = ei(n.state, e);
7538
+ let s = Zr(n.state, e);
7539
7539
  if (s && s instanceof w)
7540
7540
  return Ie(n, s);
7541
7541
  }
@@ -7545,7 +7545,7 @@ function No(n, e, t) {
7545
7545
  }
7546
7546
  return !1;
7547
7547
  }
7548
- function Do(n, e) {
7548
+ function No(n, e) {
7549
7549
  if (!(n.state.selection instanceof k))
7550
7550
  return !0;
7551
7551
  let { $head: t, $anchor: r, empty: i } = n.state.selection;
@@ -7562,7 +7562,7 @@ function Do(n, e) {
7562
7562
  }
7563
7563
  return !1;
7564
7564
  }
7565
- function Eo(n, e, t) {
7565
+ function Do(n, e, t) {
7566
7566
  n.domObserver.stop(), e.contentEditable = t, n.domObserver.start();
7567
7567
  }
7568
7568
  function sd(n) {
@@ -7571,7 +7571,7 @@ function sd(n) {
7571
7571
  let { focusNode: e, focusOffset: t } = n.domSelectionRange();
7572
7572
  if (e && e.nodeType == 1 && t == 0 && e.firstChild && e.firstChild.contentEditable == "false") {
7573
7573
  let r = e.firstChild;
7574
- Eo(n, r, "true"), setTimeout(() => Eo(n, r, "false"), 20);
7574
+ Do(n, r, "true"), setTimeout(() => Do(n, r, "false"), 20);
7575
7575
  }
7576
7576
  return !1;
7577
7577
  }
@@ -7582,28 +7582,28 @@ function ld(n) {
7582
7582
  function ad(n, e) {
7583
7583
  let t = e.keyCode, r = ld(e);
7584
7584
  if (t == 8 || re && t == 72 && r == "c")
7585
- return Do(n, -1) || kt(n, -1);
7585
+ return No(n, -1) || kt(n, -1);
7586
7586
  if (t == 46 && !e.shiftKey || re && t == 68 && r == "c")
7587
- return Do(n, 1) || kt(n, 1);
7587
+ return No(n, 1) || kt(n, 1);
7588
7588
  if (t == 13 || t == 27)
7589
7589
  return !0;
7590
7590
  if (t == 37 || re && t == 66 && r == "c") {
7591
- let i = t == 37 ? To(n, n.state.selection.from) == "ltr" ? -1 : 1 : -1;
7592
- return Oo(n, i, r) || kt(n, i);
7591
+ let i = t == 37 ? Oo(n, n.state.selection.from) == "ltr" ? -1 : 1 : -1;
7592
+ return Mo(n, i, r) || kt(n, i);
7593
7593
  } else if (t == 39 || re && t == 70 && r == "c") {
7594
- let i = t == 39 ? To(n, n.state.selection.from) == "ltr" ? 1 : -1 : 1;
7595
- return Oo(n, i, r) || kt(n, i);
7594
+ let i = t == 39 ? Oo(n, n.state.selection.from) == "ltr" ? 1 : -1 : 1;
7595
+ return Mo(n, i, r) || kt(n, i);
7596
7596
  } else {
7597
7597
  if (t == 38 || re && t == 80 && r == "c")
7598
- return No(n, -1, r) || kt(n, -1);
7598
+ return To(n, -1, r) || kt(n, -1);
7599
7599
  if (t == 40 || re && t == 78 && r == "c")
7600
- return sd(n) || No(n, 1, r) || kt(n, 1);
7600
+ return sd(n) || To(n, 1, r) || kt(n, 1);
7601
7601
  if (r == (re ? "m" : "c") && (t == 66 || t == 73 || t == 89 || t == 90))
7602
7602
  return !0;
7603
7603
  }
7604
7604
  return !1;
7605
7605
  }
7606
- function wi(n, e) {
7606
+ function Si(n, e) {
7607
7607
  n.someProp("transformCopied", (h) => {
7608
7608
  e = h(e, n);
7609
7609
  });
@@ -7675,14 +7675,14 @@ function Al(n, e, t, r, i) {
7675
7675
  return u.nodeName == "BR" && !u.nextSibling && u.parentNode && !cd.test(u.parentNode.nodeName) ? { ignore: !0 } : null;
7676
7676
  }
7677
7677
  })), f)
7678
- l = pd(Ao(l, +f[1], +f[2]), f[4]);
7678
+ l = pd(Eo(l, +f[1], +f[2]), f[4]);
7679
7679
  else if (l = x.maxOpen(fd(l.content, i), !0), l.openStart || l.openEnd) {
7680
7680
  let d = 0, u = 0;
7681
7681
  for (let h = l.content.firstChild; d < l.openStart && !h.type.spec.isolating; d++, h = h.firstChild)
7682
7682
  ;
7683
7683
  for (let h = l.content.lastChild; u < l.openEnd && !h.type.spec.isolating; u++, h = h.lastChild)
7684
7684
  ;
7685
- l = Ao(l, d, u);
7685
+ l = Eo(l, d, u);
7686
7686
  }
7687
7687
  return n.someProp("transformPasted", (d) => {
7688
7688
  l = d(l, n, a);
@@ -7732,12 +7732,12 @@ function Rl(n, e) {
7732
7732
  let t = n.content.replaceChild(n.childCount - 1, Rl(n.lastChild, e - 1)), r = n.contentMatchAt(n.childCount).fillBefore(b.empty, !0);
7733
7733
  return n.copy(t.append(r));
7734
7734
  }
7735
- function ni(n, e, t, r, i, o) {
7735
+ function ti(n, e, t, r, i, o) {
7736
7736
  let s = e < 0 ? n.firstChild : n.lastChild, l = s.content;
7737
- return n.childCount > 1 && (o = 0), i < r - 1 && (l = ni(l, e, t, r, i + 1, o)), i >= t && (l = e < 0 ? s.contentMatchAt(0).fillBefore(l, o <= i).append(l) : l.append(s.contentMatchAt(s.childCount).fillBefore(b.empty, !0))), n.replaceChild(e < 0 ? 0 : n.childCount - 1, s.copy(l));
7737
+ return n.childCount > 1 && (o = 0), i < r - 1 && (l = ti(l, e, t, r, i + 1, o)), i >= t && (l = e < 0 ? s.contentMatchAt(0).fillBefore(l, o <= i).append(l) : l.append(s.contentMatchAt(s.childCount).fillBefore(b.empty, !0))), n.replaceChild(e < 0 ? 0 : n.childCount - 1, s.copy(l));
7738
7738
  }
7739
- function Ao(n, e, t) {
7740
- return e < n.openStart && (n = new x(ni(n.content, -1, e, n.openStart, 0, n.openEnd), e, n.openEnd)), t < n.openEnd && (n = new x(ni(n.content, 1, t, n.openEnd, 0, 0), n.openStart, t)), n;
7739
+ function Eo(n, e, t) {
7740
+ return e < n.openStart && (n = new x(ti(n.content, -1, e, n.openStart, 0, n.openEnd), e, n.openEnd)), t < n.openEnd && (n = new x(ti(n.content, 1, t, n.openEnd, 0, 0), n.openStart, t)), n;
7741
7741
  }
7742
7742
  const Pl = {
7743
7743
  thead: ["table"],
@@ -7779,7 +7779,7 @@ function ud(n) {
7779
7779
  return r;
7780
7780
  }
7781
7781
  function hd(n) {
7782
- let e = n.querySelectorAll(H ? "span:not([class]):not([style])" : "span.Apple-converted-space");
7782
+ let e = n.querySelectorAll(_ ? "span:not([class]):not([style])" : "span.Apple-converted-space");
7783
7783
  for (let t = 0; t < e.length; t++) {
7784
7784
  let r = e[t];
7785
7785
  r.childNodes.length == 1 && r.textContent == " " && r.parentNode && r.parentNode.replaceChild(n.ownerDocument.createTextNode(" "), r);
@@ -7813,10 +7813,10 @@ function yd(n) {
7813
7813
  for (let e in U) {
7814
7814
  let t = U[e];
7815
7815
  n.dom.addEventListener(e, n.input.eventHandlers[e] = (r) => {
7816
- kd(n, r) && !Ci(n, r) && (n.editable || !(r.type in G)) && t(n, r);
7816
+ kd(n, r) && !wi(n, r) && (n.editable || !(r.type in G)) && t(n, r);
7817
7817
  }, md[e] ? { passive: !0 } : void 0);
7818
7818
  }
7819
- J && n.dom.addEventListener("input", () => null), ri(n);
7819
+ J && n.dom.addEventListener("input", () => null), ni(n);
7820
7820
  }
7821
7821
  function we(n, e) {
7822
7822
  n.input.lastSelectionOrigin = e, n.input.lastSelectionTime = Date.now();
@@ -7827,13 +7827,13 @@ function bd(n) {
7827
7827
  n.dom.removeEventListener(e, n.input.eventHandlers[e]);
7828
7828
  clearTimeout(n.input.composingTimeout), clearTimeout(n.input.lastIOSEnterFallbackTimeout);
7829
7829
  }
7830
- function ri(n) {
7830
+ function ni(n) {
7831
7831
  n.someProp("handleDOMEvents", (e) => {
7832
7832
  for (let t in e)
7833
- n.input.eventHandlers[t] || n.dom.addEventListener(t, n.input.eventHandlers[t] = (r) => Ci(n, r));
7833
+ n.input.eventHandlers[t] || n.dom.addEventListener(t, n.input.eventHandlers[t] = (r) => wi(n, r));
7834
7834
  });
7835
7835
  }
7836
- function Ci(n, e) {
7836
+ function wi(n, e) {
7837
7837
  return n.someProp("handleDOMEvents", (t) => {
7838
7838
  let r = t[e.type];
7839
7839
  return r ? r(n, e) || e.defaultPrevented : !1;
@@ -7850,11 +7850,11 @@ function kd(n, e) {
7850
7850
  return !0;
7851
7851
  }
7852
7852
  function xd(n, e) {
7853
- !Ci(n, e) && U[e.type] && (n.editable || !(e.type in G)) && U[e.type](n, e);
7853
+ !wi(n, e) && U[e.type] && (n.editable || !(e.type in G)) && U[e.type](n, e);
7854
7854
  }
7855
7855
  G.keydown = (n, e) => {
7856
7856
  let t = e;
7857
- if (n.input.shiftKey = t.keyCode == 16 || t.shiftKey, !Vl(n) && (n.input.lastKeyCode = t.keyCode, n.input.lastKeyCodeTime = Date.now(), !(Se && H && t.keyCode == 13)))
7857
+ if (n.input.shiftKey = t.keyCode == 16 || t.shiftKey, !Vl(n) && (n.input.lastKeyCode = t.keyCode, n.input.lastKeyCodeTime = Date.now(), !(Se && _ && t.keyCode == 13)))
7858
7858
  if (t.keyCode != 229 && n.domObserver.forceFlush(), Rt && t.keyCode == 13 && !t.ctrlKey && !t.altKey && !t.metaKey) {
7859
7859
  let r = Date.now();
7860
7860
  n.input.lastIOSEnter = r, n.input.lastIOSEnterFallbackTimeout = setTimeout(() => {
@@ -7886,7 +7886,7 @@ function Sd(n, e) {
7886
7886
  let t = e.x - n.clientX, r = e.y - n.clientY;
7887
7887
  return t * t + r * r < 100;
7888
7888
  }
7889
- function Mi(n, e, t, r, i) {
7889
+ function Ci(n, e, t, r, i) {
7890
7890
  if (r == -1)
7891
7891
  return !1;
7892
7892
  let o = n.state.doc.resolve(r);
@@ -7923,13 +7923,13 @@ function Cd(n, e) {
7923
7923
  return i != null ? (pn(n, w.create(n.state.doc, i)), !0) : !1;
7924
7924
  }
7925
7925
  function Md(n, e, t, r, i) {
7926
- return Mi(n, "handleClickOn", e, t, r) || n.someProp("handleClick", (o) => o(n, e, r)) || (i ? Cd(n, t) : wd(n, t));
7926
+ return Ci(n, "handleClickOn", e, t, r) || n.someProp("handleClick", (o) => o(n, e, r)) || (i ? Cd(n, t) : wd(n, t));
7927
7927
  }
7928
7928
  function Od(n, e, t, r) {
7929
- return Mi(n, "handleDoubleClickOn", e, t, r) || n.someProp("handleDoubleClick", (i) => i(n, e, r));
7929
+ return Ci(n, "handleDoubleClickOn", e, t, r) || n.someProp("handleDoubleClick", (i) => i(n, e, r));
7930
7930
  }
7931
7931
  function Td(n, e, t, r) {
7932
- return Mi(n, "handleTripleClickOn", e, t, r) || n.someProp("handleTripleClick", (i) => i(n, e, r)) || Nd(n, t, r);
7932
+ return Ci(n, "handleTripleClickOn", e, t, r) || n.someProp("handleTripleClick", (i) => i(n, e, r)) || Nd(n, t, r);
7933
7933
  }
7934
7934
  function Nd(n, e, t) {
7935
7935
  if (t.button != 0)
@@ -7951,14 +7951,14 @@ function zl(n, e, t) {
7951
7951
  }
7952
7952
  return null;
7953
7953
  }
7954
- function Oi(n) {
7954
+ function Mi(n) {
7955
7955
  return Ln(n);
7956
7956
  }
7957
7957
  const Ll = re ? "metaKey" : "ctrlKey";
7958
7958
  U.mousedown = (n, e) => {
7959
7959
  let t = e;
7960
7960
  n.input.shiftKey = t.shiftKey;
7961
- let r = Oi(n), i = Date.now(), o = "singleClick";
7961
+ let r = Mi(n), i = Date.now(), o = "singleClick";
7962
7962
  i - n.input.lastClick.time < 500 && Sd(t, n.input.lastClick) && !t[Ll] && n.input.lastClick.button == t.button && (n.input.lastClick.type == "singleClick" ? o = "doubleClick" : n.input.lastClick.type == "doubleClick" && (o = "tripleClick")), n.input.lastClick = { time: i, x: t.clientX, y: t.clientY, type: o, button: t.button }, n.input.mouseDown && n.input.mouseDown.done();
7963
7963
  let s = n.posAtCoords(hn(t));
7964
7964
  s && (o == "singleClick" ? n.input.mouseDown = new Dd(n, s, t, !!r) : (o == "doubleClick" ? Od : Td)(n, s.pos, s.inside, t) ? t.preventDefault() : we(n, "pointer"));
@@ -8019,7 +8019,7 @@ class Dd extends $l {
8019
8019
  // (hidden) cursor is doesn't change the selection, and
8020
8020
  // thus doesn't get a reaction from ProseMirror. This
8021
8021
  // works around that.
8022
- H && !this.view.state.selection.visible && Math.min(Math.abs(t.pos - this.view.state.selection.from), Math.abs(t.pos - this.view.state.selection.to)) <= 2) ? (pn(this.view, T.near(this.view.state.doc.resolve(t.pos))), e.preventDefault()) : we(this.view, "pointer");
8022
+ _ && !this.view.state.selection.visible && Math.min(Math.abs(t.pos - this.view.state.selection.from), Math.abs(t.pos - this.view.state.selection.to)) <= 2) ? (pn(this.view, T.near(this.view.state.doc.resolve(t.pos))), e.preventDefault()) : we(this.view, "pointer");
8023
8023
  }
8024
8024
  move(e) {
8025
8025
  this.updateAllowDefault(e), we(this.view, "pointer"), super.move(e);
@@ -8049,12 +8049,12 @@ class Ed extends $l {
8049
8049
  }
8050
8050
  }
8051
8051
  U.touchstart = (n) => {
8052
- n.input.lastTouch = Date.now(), Oi(n), we(n, "pointer");
8052
+ n.input.lastTouch = Date.now(), Mi(n), we(n, "pointer");
8053
8053
  };
8054
8054
  U.touchmove = (n) => {
8055
8055
  n.input.lastTouch = Date.now(), we(n, "pointer");
8056
8056
  };
8057
- U.contextmenu = (n) => Oi(n);
8057
+ U.contextmenu = (n) => Mi(n);
8058
8058
  function Vl(n, e) {
8059
8059
  return n.composing ? !0 : J && Math.abs(Date.now() - n.input.compositionEndedAt) < 500 ? (n.input.compositionEndedAt = -2e8, !0) : !1;
8060
8060
  }
@@ -8063,7 +8063,7 @@ G.compositionstart = G.compositionupdate = (n) => {
8063
8063
  if (!n.composing) {
8064
8064
  n.domObserver.flush();
8065
8065
  let { state: e } = n, t = e.selection.$to;
8066
- if (e.selection instanceof k && (e.storedMarks || !t.textOffset && t.parentOffset && t.nodeBefore.marks.some((r) => r.type.spec.inclusive === !1) || H && pl && Id(n)))
8066
+ if (e.selection instanceof k && (e.storedMarks || !t.textOffset && t.parentOffset && t.nodeBefore.marks.some((r) => r.type.spec.inclusive === !1) || _ && pl && Id(n)))
8067
8067
  n.markCursor = n.state.storedMarks || t.marks(), Ln(n, !0), n.markCursor = null;
8068
8068
  else if (Ln(n, !e.selection.empty), oe && e.selection.empty && t.parentOffset && !t.textOffset && t.nodeBefore.marks.length) {
8069
8069
  let r = n.domSelectionRange();
@@ -8122,7 +8122,7 @@ function vd(n) {
8122
8122
  function Ln(n, e = !1) {
8123
8123
  if (!(Se && n.domObserver.flushingSoon >= 0)) {
8124
8124
  if (n.domObserver.forceFlush(), Wl(n), e || n.docView && n.docView.dirty) {
8125
- let t = xi(n), r = n.state.selection;
8125
+ let t = ki(n), r = n.state.selection;
8126
8126
  return t && !t.eq(r) ? n.dispatch(n.state.tr.setSelection(t)) : (n.markCursor || e) && !r.$from.node(r.$from.sharedDepth(r.to)).inlineContent ? n.dispatch(n.state.tr.deleteSelection()) : n.updateState(n.state), !0;
8127
8127
  }
8128
8128
  return !1;
@@ -8143,7 +8143,7 @@ U.copy = G.cut = (n, e) => {
8143
8143
  let t = e, r = n.state.selection, i = t.type == "cut";
8144
8144
  if (r.empty)
8145
8145
  return;
8146
- let o = nn ? null : t.clipboardData, s = r.content(), { dom: l, text: a } = wi(n, s);
8146
+ let o = nn ? null : t.clipboardData, s = r.content(), { dom: l, text: a } = Si(n, s);
8147
8147
  o ? (t.preventDefault(), o.clearData(), o.setData("text/html", l.innerHTML), o.setData("text/plain", a)) : Rd(n, l), i && n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent", "cut"));
8148
8148
  };
8149
8149
  function Pd(n) {
@@ -8182,13 +8182,13 @@ G.paste = (n, e) => {
8182
8182
  let r = nn ? null : t.clipboardData, i = n.input.shiftKey && n.input.lastKeyCode != 45;
8183
8183
  r && rn(n, Kl(r), r.getData("text/html"), i, t) ? t.preventDefault() : Bd(n, t);
8184
8184
  };
8185
- class Hl {
8185
+ class _l {
8186
8186
  constructor(e, t, r) {
8187
8187
  this.slice = e, this.move = t, this.node = r;
8188
8188
  }
8189
8189
  }
8190
8190
  const zd = re ? "altKey" : "ctrlKey";
8191
- function _l(n, e) {
8191
+ function Hl(n, e) {
8192
8192
  let t;
8193
8193
  return n.someProp("dragCopies", (r) => {
8194
8194
  t = t || r(e);
@@ -8207,8 +8207,8 @@ U.dragstart = (n, e) => {
8207
8207
  d && d.node.type.spec.draggable && d != n.docView && (s = w.create(n.state.doc, d.posBefore));
8208
8208
  }
8209
8209
  }
8210
- let l = (s || n.state.selection).content(), { dom: a, text: c, slice: f } = wi(n, l);
8211
- (!t.dataTransfer.files.length || !H || hl > 120) && t.dataTransfer.clearData(), t.dataTransfer.setData(nn ? "Text" : "text/html", a.innerHTML), t.dataTransfer.effectAllowed = "copyMove", nn || t.dataTransfer.setData("text/plain", c), n.dragging = new Hl(f, _l(n, t), s);
8210
+ let l = (s || n.state.selection).content(), { dom: a, text: c, slice: f } = Si(n, l);
8211
+ (!t.dataTransfer.files.length || !_ || hl > 120) && t.dataTransfer.clearData(), t.dataTransfer.setData(nn ? "Text" : "text/html", a.innerHTML), t.dataTransfer.effectAllowed = "copyMove", nn || t.dataTransfer.setData("text/plain", c), n.dragging = new _l(f, Hl(n, t), s);
8212
8212
  };
8213
8213
  U.dragend = (n) => {
8214
8214
  let e = n.dragging;
@@ -8234,7 +8234,7 @@ function Ld(n, e, t) {
8234
8234
  o ? n.someProp("transformPasted", (h) => {
8235
8235
  o = h(o, n, !1);
8236
8236
  }) : o = Al(n, Kl(e.dataTransfer), nn ? null : e.dataTransfer.getData("text/html"), !1, i);
8237
- let s = !!(t && _l(n, e));
8237
+ let s = !!(t && Hl(n, e));
8238
8238
  if (n.someProp("handleDrop", (h) => h(n, e, o || x.empty, s))) {
8239
8239
  e.preventDefault();
8240
8240
  return;
@@ -8257,7 +8257,7 @@ function Ld(n, e, t) {
8257
8257
  a.setSelection(new w(u));
8258
8258
  else {
8259
8259
  let h = a.mapping.map(l);
8260
- a.mapping.maps[a.mapping.maps.length - 1].forEach((p, m, g, y) => h = y), a.setSelection(Si(n, u, a.doc.resolve(h)));
8260
+ a.mapping.maps[a.mapping.maps.length - 1].forEach((p, m, g, y) => h = y), a.setSelection(xi(n, u, a.doc.resolve(h)));
8261
8261
  }
8262
8262
  n.focus(), n.dispatch(a.setMeta("uiEvent", "drop"));
8263
8263
  }
@@ -8333,7 +8333,7 @@ class We {
8333
8333
  destroy() {
8334
8334
  }
8335
8335
  }
8336
- class Ti {
8336
+ class Oi {
8337
8337
  constructor(e, t) {
8338
8338
  this.attrs = e, this.spec = t || ot;
8339
8339
  }
@@ -8349,7 +8349,7 @@ class Ti {
8349
8349
  return i == t.from && !(o = e.child(r)).isText && i + o.nodeSize == t.to;
8350
8350
  }
8351
8351
  eq(e) {
8352
- return this == e || e instanceof Ti && on(this.attrs, e.attrs) && on(this.spec, e.spec);
8352
+ return this == e || e instanceof Oi && on(this.attrs, e.attrs) && on(this.spec, e.spec);
8353
8353
  }
8354
8354
  destroy() {
8355
8355
  }
@@ -8403,7 +8403,7 @@ class I {
8403
8403
  node, will receive the given attributes.
8404
8404
  */
8405
8405
  static node(e, t, r, i) {
8406
- return new I(e, t, new Ti(r, i));
8406
+ return new I(e, t, new Oi(r, i));
8407
8407
  }
8408
8408
  /**
8409
8409
  The spec provided when creating this decoration. Can be useful
@@ -8578,7 +8578,7 @@ class D {
8578
8578
  @internal
8579
8579
  */
8580
8580
  locals(e) {
8581
- return Ni(this.localsInner(e));
8581
+ return Ti(this.localsInner(e));
8582
8582
  }
8583
8583
  /**
8584
8584
  @internal
@@ -8598,7 +8598,7 @@ class D {
8598
8598
  }
8599
8599
  }
8600
8600
  D.empty = new D([], []);
8601
- D.removeOverlap = Ni;
8601
+ D.removeOverlap = Ti;
8602
8602
  const q = D.empty;
8603
8603
  class Re {
8604
8604
  constructor(e) {
@@ -8639,7 +8639,7 @@ class Re {
8639
8639
  t.push(o[s]);
8640
8640
  }
8641
8641
  }
8642
- return t ? Ni(r ? t : t.sort(st)) : Ct;
8642
+ return t ? Ti(r ? t : t.sort(st)) : Ct;
8643
8643
  }
8644
8644
  // Create a group for the given array of decoration sets, or return
8645
8645
  // a single set when possible.
@@ -8762,7 +8762,7 @@ function Vn(n, e, t, r) {
8762
8762
  function st(n, e) {
8763
8763
  return n.from - e.from || n.to - e.to;
8764
8764
  }
8765
- function Ni(n) {
8765
+ function Ti(n) {
8766
8766
  let e = n;
8767
8767
  for (let t = 0; t < e.length - 1; t++) {
8768
8768
  let r = e[t];
@@ -8770,17 +8770,17 @@ function Ni(n) {
8770
8770
  for (let i = t + 1; i < e.length; i++) {
8771
8771
  let o = e[i];
8772
8772
  if (o.from == r.from) {
8773
- o.to != r.to && (e == n && (e = n.slice()), e[i] = o.copy(o.from, r.to), Io(e, i + 1, o.copy(r.to, o.to)));
8773
+ o.to != r.to && (e == n && (e = n.slice()), e[i] = o.copy(o.from, r.to), Ao(e, i + 1, o.copy(r.to, o.to)));
8774
8774
  continue;
8775
8775
  } else {
8776
- o.from < r.to && (e == n && (e = n.slice()), e[t] = r.copy(r.from, o.from), Io(e, i, r.copy(o.from, r.to)));
8776
+ o.from < r.to && (e == n && (e = n.slice()), e[t] = r.copy(r.from, o.from), Ao(e, i, r.copy(o.from, r.to)));
8777
8777
  break;
8778
8778
  }
8779
8779
  }
8780
8780
  }
8781
8781
  return e;
8782
8782
  }
8783
- function Io(n, e, t) {
8783
+ function Ao(n, e, t) {
8784
8784
  for (; e < n.length && st(t, n[e]) > 0; )
8785
8785
  e++;
8786
8786
  n.splice(e, 0, t);
@@ -8814,7 +8814,7 @@ class Kd {
8814
8814
  return e.anchorNode == this.anchorNode && e.anchorOffset == this.anchorOffset && e.focusNode == this.focusNode && e.focusOffset == this.focusOffset;
8815
8815
  }
8816
8816
  }
8817
- class Hd {
8817
+ class _d {
8818
8818
  constructor(e, t) {
8819
8819
  this.view = e, this.handleDOMChange = t, this.queue = [], this.flushingSoon = -1, this.observer = null, this.currentSelection = new Kd(), this.onCharData = null, this.suppressingSelectionUpdates = !1, this.lastChangedTextNode = null, this.observer = window.MutationObserver && new window.MutationObserver((r) => {
8820
8820
  for (let i = 0; i < r.length; i++)
@@ -8857,7 +8857,7 @@ class Hd {
8857
8857
  this.suppressingSelectionUpdates = !0, setTimeout(() => this.suppressingSelectionUpdates = !1, 50);
8858
8858
  }
8859
8859
  onSelectionChange() {
8860
- if (Mo(this.view)) {
8860
+ if (Co(this.view)) {
8861
8861
  if (this.suppressingSelectionUpdates)
8862
8862
  return Ce(this.view);
8863
8863
  if (X && $e <= 11 && !this.view.state.selection.empty) {
@@ -8901,13 +8901,13 @@ class Hd {
8901
8901
  return;
8902
8902
  let t = this.pendingRecords();
8903
8903
  t.length && (this.queue = []);
8904
- let r = e.domSelectionRange(), i = !this.suppressingSelectionUpdates && !this.currentSelection.eq(r) && Mo(e) && !this.ignoreSelectionChange(r), o = -1, s = -1, l = !1, a = [];
8904
+ let r = e.domSelectionRange(), i = !this.suppressingSelectionUpdates && !this.currentSelection.eq(r) && Co(e) && !this.ignoreSelectionChange(r), o = -1, s = -1, l = !1, a = [];
8905
8905
  if (e.editable)
8906
8906
  for (let f = 0; f < t.length; f++) {
8907
8907
  let d = this.registerMutation(t[f], a);
8908
8908
  d && (o = o < 0 ? d.from : Math.min(d.from, o), s = s < 0 ? d.to : Math.max(d.to, s), d.typeOver && (l = !0));
8909
8909
  }
8910
- if (a.some((f) => f.nodeName == "BR") && (e.input.lastKeyCode == 8 || e.input.lastKeyCode == 46 || H && (e.composing || e.input.compositionEndedAt > Date.now() - 50) && t.some((f) => f.type == "childList" && f.removedNodes.length))) {
8910
+ if (a.some((f) => f.nodeName == "BR") && (e.input.lastKeyCode == 8 || e.input.lastKeyCode == 46 || _ && (e.composing || e.input.compositionEndedAt > Date.now() - 50) && t.some((f) => f.type == "childList" && f.removedNodes.length))) {
8911
8911
  for (let f of a)
8912
8912
  if (f.nodeName == "BR" && f.parentNode) {
8913
8913
  let d = f.nextSibling;
@@ -8933,7 +8933,7 @@ class Hd {
8933
8933
  }
8934
8934
  }
8935
8935
  let c = null;
8936
- o < 0 && i && e.input.lastFocus > Date.now() - 200 && Math.max(e.input.lastTouch, e.input.lastClick.time) < Date.now() - 300 && tr(r) && (c = xi(e)) && c.eq(T.near(e.state.doc.resolve(0), 1)) ? (e.input.lastFocus = 0, Ce(e), this.currentSelection.set(r), e.scrollToSelection()) : (o > -1 || i) && (o > -1 && (e.docView.markDirty(o, s), _d(e)), e.input.badSafariComposition && (e.input.badSafariComposition = !1, jd(e, a)), this.handleDOMChange(o, s, l, a), e.docView && e.docView.dirty ? e.updateState(e.state) : this.currentSelection.eq(r) || Ce(e), this.currentSelection.set(r));
8936
+ o < 0 && i && e.input.lastFocus > Date.now() - 200 && Math.max(e.input.lastTouch, e.input.lastClick.time) < Date.now() - 300 && tr(r) && (c = ki(e)) && c.eq(T.near(e.state.doc.resolve(0), 1)) ? (e.input.lastFocus = 0, Ce(e), this.currentSelection.set(r), e.scrollToSelection()) : (o > -1 || i) && (o > -1 && (e.docView.markDirty(o, s), Hd(e)), e.input.badSafariComposition && (e.input.badSafariComposition = !1, jd(e, a)), this.handleDOMChange(o, s, l, a), e.docView && e.docView.dirty ? e.updateState(e.state) : this.currentSelection.eq(r) || Ce(e), this.currentSelection.set(r));
8937
8937
  }
8938
8938
  registerMutation(e, t) {
8939
8939
  if (t.indexOf(e.target) > -1)
@@ -8968,15 +8968,15 @@ class Hd {
8968
8968
  });
8969
8969
  }
8970
8970
  }
8971
- let vo = /* @__PURE__ */ new WeakMap(), Ro = !1;
8972
- function _d(n) {
8973
- if (!vo.has(n) && (vo.set(n, null), ["normal", "nowrap", "pre-line"].indexOf(getComputedStyle(n.dom).whiteSpace) !== -1)) {
8974
- if (n.requiresGeckoHackNode = oe, Ro)
8971
+ let Io = /* @__PURE__ */ new WeakMap(), vo = !1;
8972
+ function Hd(n) {
8973
+ if (!Io.has(n) && (Io.set(n, null), ["normal", "nowrap", "pre-line"].indexOf(getComputedStyle(n.dom).whiteSpace) !== -1)) {
8974
+ if (n.requiresGeckoHackNode = oe, vo)
8975
8975
  return;
8976
- console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."), Ro = !0;
8976
+ console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."), vo = !0;
8977
8977
  }
8978
8978
  }
8979
- function Po(n, e) {
8979
+ function Ro(n, e) {
8980
8980
  let t = e.startContainer, r = e.startOffset, i = e.endContainer, o = e.endOffset, s = n.domAtPos(n.state.selection.anchor);
8981
8981
  return ht(s.node, s.offset, i, o) && ([t, r, i, o] = [i, o, t, r]), { anchorNode: t, anchorOffset: r, focusNode: i, focusOffset: o };
8982
8982
  }
@@ -8984,13 +8984,13 @@ function qd(n, e) {
8984
8984
  if (e.getComposedRanges) {
8985
8985
  let i = e.getComposedRanges(n.root)[0];
8986
8986
  if (i)
8987
- return Po(n, i);
8987
+ return Ro(n, i);
8988
8988
  }
8989
8989
  let t;
8990
8990
  function r(i) {
8991
8991
  i.preventDefault(), i.stopImmediatePropagation(), t = i.getTargetRanges()[0];
8992
8992
  }
8993
- return n.dom.addEventListener("beforeinput", r, !0), document.execCommand("indent"), n.dom.removeEventListener("beforeinput", r, !0), t ? Po(n, t) : null;
8993
+ return n.dom.addEventListener("beforeinput", r, !0), document.execCommand("indent"), n.dom.removeEventListener("beforeinput", r, !0), t ? Ro(n, t) : null;
8994
8994
  }
8995
8995
  function Jd(n, e) {
8996
8996
  for (let t = e.parentNode; t && t != n.dom; t = t.parentNode) {
@@ -9023,7 +9023,7 @@ function jd(n, e) {
9023
9023
  }
9024
9024
  function Ud(n, e, t, r) {
9025
9025
  let { node: i, fromOffset: o, toOffset: s, from: l, to: a } = n.docView.parseRange(e, t), c = n.domSelectionRange(), f, d = c.anchorNode;
9026
- if (d && n.dom.contains(d.nodeType == 1 ? d : d.parentNode) && (f = [{ node: d, offset: c.anchorOffset }], tr(c) || f.push({ node: c.focusNode, offset: c.focusOffset })), H && n.input.lastKeyCode === 8)
9026
+ if (d && n.dom.contains(d.nodeType == 1 ? d : d.parentNode) && (f = [{ node: d, offset: c.anchorOffset }], tr(c) || f.push({ node: c.focusNode, offset: c.focusOffset })), _ && n.input.lastKeyCode === 8)
9027
9027
  for (let y = s; y > o; y--) {
9028
9028
  let C = i.childNodes[y - 1], M = C.pmViewDesc;
9029
9029
  if (C.nodeName == "BR" && !M) {
@@ -9067,9 +9067,9 @@ const Gd = (n) => (e) => {
9067
9067
  function Xd(n, e, t, r, i) {
9068
9068
  let o = n.input.compositionPendingChanges || (n.composing ? n.input.compositionID : 0);
9069
9069
  if (n.input.compositionPendingChanges = 0, e < 0) {
9070
- let O = n.input.lastSelectionTime > Date.now() - 50 ? n.input.lastSelectionOrigin : null, A = xi(n, O);
9070
+ let O = n.input.lastSelectionTime > Date.now() - 50 ? n.input.lastSelectionOrigin : null, A = ki(n, O);
9071
9071
  if (A && !n.state.selection.eq(A)) {
9072
- if (H && Se && n.input.lastKeyCode === 13 && Date.now() - 100 < n.input.lastKeyCodeTime && n.someProp("handleKeyDown", (ne) => ne(n, Ze(13, "Enter"))))
9072
+ if (_ && Se && n.input.lastKeyCode === 13 && Date.now() - 100 < n.input.lastKeyCodeTime && n.someProp("handleKeyDown", (ne) => ne(n, Ze(13, "Enter"))))
9073
9073
  return;
9074
9074
  let R = n.state.tr.setSelection(A);
9075
9075
  O == "pointer" ? R.setMeta("pointer", !0) : O == "key" && R.scrollIntoView(), o && R.setMeta("composition", o), n.dispatch(R);
@@ -9090,7 +9090,7 @@ function Xd(n, e, t, r, i) {
9090
9090
  p = { start: a.from, endA: a.to, endB: a.to };
9091
9091
  else {
9092
9092
  if (c.sel) {
9093
- let O = Bo(n, n.state.doc, c.sel);
9093
+ let O = Po(n, n.state.doc, c.sel);
9094
9094
  if (O && !O.eq(n.state.selection)) {
9095
9095
  let A = n.state.tr.setSelection(O);
9096
9096
  o && A.setMeta("composition", o), n.dispatch(A);
@@ -9105,10 +9105,10 @@ function Xd(n, e, t, r, i) {
9105
9105
  return;
9106
9106
  }
9107
9107
  if (n.state.selection.anchor > p.start && Zd(f, p.start, p.endA, m, g) && n.someProp("handleKeyDown", (O) => O(n, Ze(8, "Backspace")))) {
9108
- Se && H && n.domObserver.suppressSelectionUpdates();
9108
+ Se && _ && n.domObserver.suppressSelectionUpdates();
9109
9109
  return;
9110
9110
  }
9111
- H && p.endB == p.start && (n.input.lastChromeDelete = Date.now()), Se && !C && m.start() != g.start() && g.parentOffset == 0 && m.depth == g.depth && c.sel && c.sel.anchor == c.sel.head && c.sel.head == p.endA && (p.endB -= 2, g = c.doc.resolveNoCache(p.endB - c.from), setTimeout(() => {
9111
+ _ && p.endB == p.start && (n.input.lastChromeDelete = Date.now()), Se && !C && m.start() != g.start() && g.parentOffset == 0 && m.depth == g.depth && c.sel && c.sel.anchor == c.sel.head && c.sel.head == p.endA && (p.endB -= 2, g = c.doc.resolveNoCache(p.endB - c.from), setTimeout(() => {
9112
9112
  n.someProp("handleKeyDown", function(O) {
9113
9113
  return O(n, Ze(13, "Enter"));
9114
9114
  });
@@ -9116,8 +9116,8 @@ function Xd(n, e, t, r, i) {
9116
9116
  let M = p.start, N = p.endA, v = (O) => {
9117
9117
  let A = O || n.state.tr.replace(M, N, c.doc.slice(p.start - c.from, p.endB - c.from));
9118
9118
  if (c.sel) {
9119
- let R = Bo(n, A.doc, c.sel);
9120
- R && !(H && n.composing && R.empty && (p.start != p.endB || n.input.lastChromeDelete < Date.now() - 100) && (R.head == M || R.head == A.mapping.map(N) - 1) || X && R.empty && R.head == M) && A.setSelection(R);
9119
+ let R = Po(n, A.doc, c.sel);
9120
+ R && !(_ && n.composing && R.empty && (p.start != p.endB || n.input.lastChromeDelete < Date.now() - 100) && (R.head == M || R.head == A.mapping.map(N) - 1) || X && R.empty && R.head == M) && A.setSelection(R);
9121
9121
  }
9122
9122
  return o && A.setMeta("composition", o), A.scrollIntoView();
9123
9123
  }, L;
@@ -9140,8 +9140,8 @@ function Xd(n, e, t, r, i) {
9140
9140
  else
9141
9141
  n.dispatch(v());
9142
9142
  }
9143
- function Bo(n, e, t) {
9144
- return Math.max(t.anchor, t.head) > e.content.size ? null : Si(n, e.resolve(t.anchor), e.resolve(t.head));
9143
+ function Po(n, e, t) {
9144
+ return Math.max(t.anchor, t.head) > e.content.size ? null : xi(n, e.resolve(t.anchor), e.resolve(t.head));
9145
9145
  }
9146
9146
  function Qd(n, e) {
9147
9147
  let t = n.firstChild.marks, r = e.firstChild.marks, i = t, o = r, s, l, a;
@@ -9216,7 +9216,7 @@ class tu {
9216
9216
  added to the document.
9217
9217
  */
9218
9218
  constructor(e, t) {
9219
- this._root = null, this.focused = !1, this.trackWrites = null, this.mounted = !1, this.markCursor = null, this.cursorWrapper = null, this.lastSelectedViewDesc = void 0, this.input = new gd(), this.prevDirectPlugins = [], this.pluginViews = [], this.requiresGeckoHackNode = !1, this.dragging = null, this._props = t, this.state = t.state, this.directPlugins = t.plugins || [], this.directPlugins.forEach(Fo), this.dispatch = this.dispatch.bind(this), this.dom = e && e.mount || document.createElement("div"), e && (e.appendChild ? e.appendChild(this.dom) : typeof e == "function" ? e(this.dom) : e.mount && (this.mounted = !0)), this.editable = $o(this), Lo(this), this.nodeViews = Vo(this), this.docView = bo(this.state.doc, zo(this), Nr(this), this.dom, this), this.domObserver = new Hd(this, (r, i, o, s) => Xd(this, r, i, o, s)), this.domObserver.start(), yd(this), this.updatePluginViews();
9219
+ this._root = null, this.focused = !1, this.trackWrites = null, this.mounted = !1, this.markCursor = null, this.cursorWrapper = null, this.lastSelectedViewDesc = void 0, this.input = new gd(), this.prevDirectPlugins = [], this.pluginViews = [], this.requiresGeckoHackNode = !1, this.dragging = null, this._props = t, this.state = t.state, this.directPlugins = t.plugins || [], this.directPlugins.forEach(Vo), this.dispatch = this.dispatch.bind(this), this.dom = e && e.mount || document.createElement("div"), e && (e.appendChild ? e.appendChild(this.dom) : typeof e == "function" ? e(this.dom) : e.mount && (this.mounted = !0)), this.editable = Lo(this), zo(this), this.nodeViews = $o(this), this.docView = yo(this.state.doc, Bo(this), Nr(this), this.dom, this), this.domObserver = new _d(this, (r, i, o, s) => Xd(this, r, i, o, s)), this.domObserver.start(), yd(this), this.updatePluginViews();
9220
9220
  }
9221
9221
  /**
9222
9222
  Holds `true` when a
@@ -9244,9 +9244,9 @@ class tu {
9244
9244
  the DOM.
9245
9245
  */
9246
9246
  update(e) {
9247
- e.handleDOMEvents != this._props.handleDOMEvents && ri(this);
9247
+ e.handleDOMEvents != this._props.handleDOMEvents && ni(this);
9248
9248
  let t = this._props;
9249
- this._props = e, e.plugins && (e.plugins.forEach(Fo), this.directPlugins = e.plugins), this.updateStateInner(e.state, t);
9249
+ this._props = e, e.plugins && (e.plugins.forEach(Vo), this.directPlugins = e.plugins), this.updateStateInner(e.state, t);
9250
9250
  }
9251
9251
  /**
9252
9252
  Update the view by updating existing props object with the object
@@ -9275,19 +9275,19 @@ class tu {
9275
9275
  e.storedMarks && this.composing && (Wl(this), s = !0), this.state = e;
9276
9276
  let l = i.plugins != e.plugins || this._props.plugins != t.plugins;
9277
9277
  if (l || this._props.plugins != t.plugins || this._props.nodeViews != t.nodeViews) {
9278
- let h = Vo(this);
9278
+ let h = $o(this);
9279
9279
  ru(h, this.nodeViews) && (this.nodeViews = h, o = !0);
9280
9280
  }
9281
- (l || t.handleDOMEvents != this._props.handleDOMEvents) && ri(this), this.editable = $o(this), Lo(this);
9282
- let a = Nr(this), c = zo(this), f = i.plugins != e.plugins && !i.doc.eq(e.doc) ? "reset" : e.scrollToSelection > i.scrollToSelection ? "to selection" : "preserve", d = o || !this.docView.matchesNode(e.doc, c, a);
9281
+ (l || t.handleDOMEvents != this._props.handleDOMEvents) && ni(this), this.editable = Lo(this), zo(this);
9282
+ let a = Nr(this), c = Bo(this), f = i.plugins != e.plugins && !i.doc.eq(e.doc) ? "reset" : e.scrollToSelection > i.scrollToSelection ? "to selection" : "preserve", d = o || !this.docView.matchesNode(e.doc, c, a);
9283
9283
  (d || !e.selection.eq(i.selection)) && (s = !0);
9284
9284
  let u = f == "preserve" && s && this.dom.style.overflowAnchor == null && If(this);
9285
9285
  if (s) {
9286
9286
  this.domObserver.stop();
9287
- let h = d && (X || H) && !this.composing && !i.selection.empty && !e.selection.empty && nu(i.selection, e.selection);
9287
+ let h = d && (X || _) && !this.composing && !i.selection.empty && !e.selection.empty && nu(i.selection, e.selection);
9288
9288
  if (d) {
9289
- let m = H ? this.trackWrites = this.domSelectionRange().focusNode : null;
9290
- this.composing && (this.input.compositionNode = vd(this)), (o || !this.docView.update(e.doc, c, a, this)) && (this.docView.updateOuterDeco(c), this.docView.destroy(), this.docView = bo(e.doc, c, a, this.dom, this)), m && (!this.trackWrites || !this.dom.contains(this.trackWrites)) && (h = !0);
9289
+ let m = _ ? this.trackWrites = this.domSelectionRange().focusNode : null;
9290
+ this.composing && (this.input.compositionNode = vd(this)), (o || !this.docView.update(e.doc, c, a, this)) && (this.docView.updateOuterDeco(c), this.docView.destroy(), this.docView = yo(e.doc, c, a, this.dom, this)), m && (!this.trackWrites || !this.dom.contains(this.trackWrites)) && (h = !0);
9291
9291
  }
9292
9292
  let p = this.input.mouseDown;
9293
9293
  h || !(p && this.domObserver.currentSelection.eq(this.domSelectionRange()) && td(this) && p.delaySelUpdate()) ? Ce(this, h) : (Nl(this, e.selection), this.domObserver.setCurSelection()), this.domObserver.start();
@@ -9302,9 +9302,9 @@ class tu {
9302
9302
  if (!(!e || !this.dom.contains(e.nodeType == 1 ? e : e.parentNode))) {
9303
9303
  if (!this.someProp("handleScrollToSelection", (t) => t(this))) if (this.state.selection instanceof w) {
9304
9304
  let t = this.docView.domAfterPos(this.state.selection.from);
9305
- t.nodeType == 1 && ho(this, t.getBoundingClientRect(), e);
9305
+ t.nodeType == 1 && uo(this, t.getBoundingClientRect(), e);
9306
9306
  } else
9307
- ho(this, this.coordsAtPos(this.state.selection.head, 1), e);
9307
+ uo(this, this.coordsAtPos(this.state.selection.head, 1), e);
9308
9308
  }
9309
9309
  }
9310
9310
  destroyPluginViews() {
@@ -9337,7 +9337,7 @@ class tu {
9337
9337
  let o = r.from + (this.state.doc.content.size - t.doc.content.size);
9338
9338
  (o > 0 && o < this.state.doc.content.size && this.state.doc.nodeAt(o)) == r.node && (i = o);
9339
9339
  }
9340
- this.dragging = new Hl(e.slice, e.move, i < 0 ? void 0 : w.create(this.state.doc, i));
9340
+ this.dragging = new _l(e.slice, e.move, i < 0 ? void 0 : w.create(this.state.doc, i));
9341
9341
  }
9342
9342
  someProp(e, t) {
9343
9343
  let r = this._props && this._props[e], i;
@@ -9478,7 +9478,7 @@ class tu {
9478
9478
  pass a different state.
9479
9479
  */
9480
9480
  endOfTextblock(e, t) {
9481
- return Hf(this, t || this.state, e);
9481
+ return _f(this, t || this.state, e);
9482
9482
  }
9483
9483
  /**
9484
9484
  Run the editor's paste logic with the given HTML string. The
@@ -9503,7 +9503,7 @@ class tu {
9503
9503
  [`transformCopied`](https://prosemirror.net/docs/ref/#view.EditorProps.transformCopied)).
9504
9504
  */
9505
9505
  serializeForClipboard(e) {
9506
- return wi(this, e);
9506
+ return Si(this, e);
9507
9507
  }
9508
9508
  /**
9509
9509
  Removes the editor from the DOM and destroys all [node
@@ -9544,7 +9544,7 @@ tu.prototype.dispatch = function(n) {
9544
9544
  let e = this._props.dispatchTransaction;
9545
9545
  e ? e.call(this, n) : this.updateState(this.state.apply(n));
9546
9546
  };
9547
- function zo(n) {
9547
+ function Bo(n) {
9548
9548
  let e = /* @__PURE__ */ Object.create(null);
9549
9549
  return e.class = "ProseMirror", e.contenteditable = String(n.editable), n.someProp("attributes", (t) => {
9550
9550
  if (typeof t == "function" && (t = t(n.state)), t)
@@ -9552,21 +9552,21 @@ function zo(n) {
9552
9552
  r == "class" ? e.class += " " + t[r] : r == "style" ? e.style = (e.style ? e.style + ";" : "") + t[r] : !e[r] && r != "contenteditable" && r != "nodeName" && (e[r] = String(t[r]));
9553
9553
  }), e.translate || (e.translate = "no"), [I.node(0, n.state.doc.content.size, e)];
9554
9554
  }
9555
- function Lo(n) {
9555
+ function zo(n) {
9556
9556
  if (n.markCursor) {
9557
9557
  let e = document.createElement("img");
9558
9558
  e.className = "ProseMirror-separator", e.setAttribute("mark-placeholder", "true"), e.setAttribute("alt", ""), n.cursorWrapper = { dom: e, deco: I.widget(n.state.selection.from, e, { raw: !0, marks: n.markCursor }) };
9559
9559
  } else
9560
9560
  n.cursorWrapper = null;
9561
9561
  }
9562
- function $o(n) {
9562
+ function Lo(n) {
9563
9563
  return !n.someProp("editable", (e) => e(n.state) === !1);
9564
9564
  }
9565
9565
  function nu(n, e) {
9566
9566
  let t = Math.min(n.$anchor.sharedDepth(n.head), e.$anchor.sharedDepth(e.head));
9567
9567
  return n.$anchor.start(t) != e.$anchor.start(t);
9568
9568
  }
9569
- function Vo(n) {
9569
+ function $o(n) {
9570
9570
  let e = /* @__PURE__ */ Object.create(null);
9571
9571
  function t(r) {
9572
9572
  for (let i in r)
@@ -9585,7 +9585,7 @@ function ru(n, e) {
9585
9585
  r++;
9586
9586
  return t != r;
9587
9587
  }
9588
- function Fo(n) {
9588
+ function Vo(n) {
9589
9589
  if (n.spec.state || n.spec.filterTransaction || n.spec.appendTransaction)
9590
9590
  throw new RangeError("Plugins passed directly to the view must not have a state component");
9591
9591
  }
@@ -9636,13 +9636,13 @@ function su({ rules: n }) {
9636
9636
  },
9637
9637
  props: {
9638
9638
  handleTextInput(t, r, i, o) {
9639
- return Wo(t, r, i, o, n, e);
9639
+ return Fo(t, r, i, o, n, e);
9640
9640
  },
9641
9641
  handleDOMEvents: {
9642
9642
  compositionend: (t) => {
9643
9643
  setTimeout(() => {
9644
9644
  let { $cursor: r } = t.state.selection;
9645
- r && Wo(t, r.pos, r.pos, "", n, e);
9645
+ r && Fo(t, r.pos, r.pos, "", n, e);
9646
9646
  });
9647
9647
  }
9648
9648
  }
@@ -9651,7 +9651,7 @@ function su({ rules: n }) {
9651
9651
  });
9652
9652
  return e;
9653
9653
  }
9654
- function Wo(n, e, t, r, i, o) {
9654
+ function Fo(n, e, t, r, i, o) {
9655
9655
  if (n.composing)
9656
9656
  return !1;
9657
9657
  let s = n.state, l = s.doc.resolve(e), a = l.parent.textBetween(Math.max(0, l.parentOffset - ou), l.parentOffset, null, "") + r;
@@ -9710,7 +9710,7 @@ new te(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(')$/, "‘", { inCodeMark: !1 });
9710
9710
  new te(/'$/, "’", { inCodeMark: !1 });
9711
9711
  function Fn(n, e, t = null, r) {
9712
9712
  return new te(n, (i, o, s, l) => {
9713
- let a = t instanceof Function ? t(o) : t, c = i.tr.delete(s, l), f = c.doc.resolve(s), d = f.blockRange(), u = d && mi(d, e, a);
9713
+ let a = t instanceof Function ? t(o) : t, c = i.tr.delete(s, l), f = c.doc.resolve(s), d = f.blockRange(), u = d && pi(d, e, a);
9714
9714
  if (!u)
9715
9715
  return null;
9716
9716
  c.wrap(d, u);
@@ -9725,17 +9725,18 @@ function Ul(n, e, t = null) {
9725
9725
  });
9726
9726
  }
9727
9727
  var Gl = /* @__PURE__ */ ((n) => (n.Inline = "inline_math", n.Block = "math_block", n))(Gl || {});
9728
- const Di = "E = mc^2", cu = "addMathInline", fu = "toMathBlock", Ko = "vscode-editor-data", du = /* @__PURE__ */ new Set(["tex", "latex", "bibtex", "doctex", "latex-expl3", "pweave", "jlweave", "rsweave"]), uu = new zt("latex-paste");
9728
+ const Ni = "E = mc^2", cu = "addMathInline", fu = "toMathBlock", Wo = "vscode-editor-data", du = /* @__PURE__ */ new Set(["tex", "latex", "bibtex", "doctex", "latex-expl3", "pweave", "jlweave", "rsweave"]), uu = new zt("latex-paste");
9729
9729
  function hu(n) {
9730
9730
  return n.inline.ruler.after("backticks", "inline_math", (e, t) => {
9731
- if (e.src.charCodeAt(e.pos) !== 36 || e.src.charCodeAt(e.pos + 1) === 36 || jo(e.src, e.pos)) return !1;
9731
+ if (e.src.charCodeAt(e.pos) !== 36 || e.src.charCodeAt(e.pos + 1) === 36 || Jo(e.src, e.pos)) return !1;
9732
9732
  let r = e.pos + 1;
9733
9733
  for (; r < e.posMax; ) {
9734
9734
  if (r = e.src.indexOf("$", r), r < 0 || r >= e.posMax) return !1;
9735
- if (!jo(e.src, r)) break;
9735
+ if (!Jo(e.src, r)) break;
9736
9736
  r += 1;
9737
9737
  }
9738
- if (r <= e.pos + 1 || /\s/.test(e.src[e.pos + 1] ?? "") || /\s/.test(e.src[r - 1] ?? "")) return !1;
9738
+ if (r <= e.pos + 1 || /\s/.test(e.src[e.pos + 1] ?? "") || /\s/.test(e.src[r - 1] ?? ""))
9739
+ return !1;
9739
9740
  if (!t) {
9740
9741
  const i = e.push("inline_math", "", 0);
9741
9742
  i.content = e.src.slice(e.pos + 1, r);
@@ -9763,16 +9764,33 @@ function hu(n) {
9763
9764
  return e.line = l + 1, !0;
9764
9765
  }), n;
9765
9766
  }
9766
- const ii = {
9767
- inline_math: { atom: !0, attrs: { latex: { default: "" } }, group: "inline", inline: !0, toDOM: (n) => ["span", { "data-math-inline": "" }, `$${n.attrs.latex}$`] },
9768
- math_block: { atom: !0, attrs: { latex: { default: "" } }, group: "block", toDOM: (n) => ["pre", { "data-math-block": "" }, `$$
9767
+ const ri = {
9768
+ inline_math: {
9769
+ atom: !0,
9770
+ attrs: { latex: { default: "" } },
9771
+ group: "inline",
9772
+ inline: !0,
9773
+ toDOM: (n) => ["span", { "data-math-inline": "" }, `$${n.attrs.latex}$`]
9774
+ },
9775
+ math_block: {
9776
+ atom: !0,
9777
+ attrs: { latex: { default: "" } },
9778
+ group: "block",
9779
+ toDOM: (n) => ["pre", { "data-math-block": "" }, `$$
9769
9780
  ${n.attrs.latex}
9770
- $$`] }
9781
+ $$`]
9782
+ }
9771
9783
  };
9772
9784
  function vm(n) {
9773
9785
  return {
9774
- inline_math: { ...ii.inline_math, toDOM: (e) => n(e.attrs.latex, !1) },
9775
- math_block: { ...ii.math_block, toDOM: (e) => n(e.attrs.latex, !0) }
9786
+ inline_math: {
9787
+ ...ri.inline_math,
9788
+ toDOM: (e) => n(e.attrs.latex, !1)
9789
+ },
9790
+ math_block: {
9791
+ ...ri.math_block,
9792
+ toDOM: (e) => n(e.attrs.latex, !0)
9793
+ }
9776
9794
  };
9777
9795
  }
9778
9796
  const pu = {
@@ -9794,7 +9812,7 @@ ${e.attrs.latex}
9794
9812
  $$`), n.closeBlock(e);
9795
9813
  }
9796
9814
  };
9797
- function Ho(n, e) {
9815
+ function Ko(n, e) {
9798
9816
  const t = n.nodes[e];
9799
9817
  if (t === void 0) throw new Error(`Math extension requires a ${e} node`);
9800
9818
  return t;
@@ -9803,9 +9821,11 @@ function gu(n) {
9803
9821
  return n !== void 0 && du.has(n.toLowerCase());
9804
9822
  }
9805
9823
  function yu(n) {
9806
- return n.split(/\n\s*\n/).map((e) => e.split(`
9824
+ return n.split(/\n\s*\n/).map(
9825
+ (e) => e.split(`
9807
9826
  `).map((t) => t.trim()).filter(Boolean).join(`
9808
- `)).filter(Boolean);
9827
+ `)
9828
+ ).filter(Boolean);
9809
9829
  }
9810
9830
  function bu() {
9811
9831
  return new P({
@@ -9814,11 +9834,14 @@ function bu() {
9814
9834
  handleDOMEvents: {
9815
9835
  paste: (n, e) => {
9816
9836
  const t = e.clipboardData;
9817
- if (t == null || n.state.selection.$from.parent.type.spec.code === !0) return !1;
9837
+ if (t == null || n.state.selection.$from.parent.type.spec.code === !0)
9838
+ return !1;
9818
9839
  const r = Mu(t), i = n.state.schema.nodes.math_block;
9819
9840
  if (r === void 0 || i === void 0) return !1;
9820
9841
  const o = yu(r).map((s) => i.create({ latex: s }));
9821
- return n.dispatch(n.state.tr.replaceWith(n.state.selection.from, n.state.selection.to, b.from(o)).scrollIntoView()), e.preventDefault(), !0;
9842
+ return n.dispatch(
9843
+ n.state.tr.replaceWith(n.state.selection.from, n.state.selection.to, b.from(o)).scrollIntoView()
9844
+ ), e.preventDefault(), !0;
9822
9845
  }
9823
9846
  }
9824
9847
  }
@@ -9833,16 +9856,20 @@ function ku(n) {
9833
9856
  const _o = (n, e) => {
9834
9857
  const t = n.schema.nodes.inline_math;
9835
9858
  if (t === void 0) return !1;
9836
- const { from: r, to: i } = n.selection, o = n.doc.textBetween(r, i) || Di, s = n.tr.replaceSelectionWith(t.create({ latex: o }));
9859
+ const { from: r, to: i } = n.selection, o = n.doc.textBetween(r, i) || Ni, s = n.tr.replaceSelectionWith(t.create({ latex: o }));
9837
9860
  return e?.(s.setSelection(k.create(s.doc, r + 1)).scrollIntoView()), !0;
9838
9861
  }, Rm = (n, e) => {
9839
9862
  const { $from: t, empty: r } = n.selection;
9840
9863
  if (!r || !t.parent.isTextblock || t.parent.content.size !== 0) return !1;
9841
9864
  const i = n.schema.nodes.math_block;
9842
- return i === void 0 ? !1 : (e?.(n.tr.replaceWith(t.before(), t.after(), i.create({ latex: Di })).scrollIntoView()), !0);
9843
- }, qo = (n, e) => {
9865
+ return i === void 0 ? !1 : (e?.(
9866
+ n.tr.replaceWith(t.before(), t.after(), i.create({ latex: Ni })).scrollIntoView()
9867
+ ), !0);
9868
+ }, Ho = (n, e) => {
9844
9869
  const t = n.schema.nodes.math_block, { $from: r } = n.selection;
9845
- return t === void 0 || !r.parent.isTextblock ? !1 : (e?.(n.tr.replaceWith(r.before(), r.after(), t.create({ latex: Di })).scrollIntoView()), !0);
9870
+ return t === void 0 || !r.parent.isTextblock ? !1 : (e?.(
9871
+ n.tr.replaceWith(r.before(), r.after(), t.create({ latex: Ni })).scrollIntoView()
9872
+ ), !0);
9846
9873
  }, xu = (n, e) => {
9847
9874
  const { $from: t } = n.selection, r = t.nodeBefore;
9848
9875
  return !t.parent.isTextblock || t.parentOffset === 0 || r === null || r.type !== n.schema.nodes.inline_math ? !1 : (e?.(n.tr.setSelection(k.create(n.doc, t.pos - r.nodeSize))), !0);
@@ -9853,7 +9880,7 @@ const _o = (n, e) => {
9853
9880
  const { $from: t } = n.selection, r = t.nodeBefore;
9854
9881
  return !t.parent.isTextblock || r === null || r.type !== n.schema.nodes.inline_math ? !1 : (e?.(n.tr.setSelection(w.create(n.doc, t.pos - r.nodeSize))), !0);
9855
9882
  };
9856
- function Jo(n, e) {
9883
+ function qo(n, e) {
9857
9884
  if (n.selection instanceof w && n.selection.node.type.name === e) return !0;
9858
9885
  for (let t = n.selection.$from.depth; t > 0; t -= 1)
9859
9886
  if (n.selection.$from.node(t).type.name === e) return !0;
@@ -9866,15 +9893,15 @@ function Cu(n, e, t) {
9866
9893
  const r = n.schema.marks.code;
9867
9894
  return r !== void 0 && (n.doc.rangeHasMark(e, t, r) || n.selection.$from.marks().some((i) => i.type === r));
9868
9895
  }
9869
- function jo(n, e) {
9896
+ function Jo(n, e) {
9870
9897
  let t = 0;
9871
9898
  for (let r = e - 1; r >= 0 && n[r] === "\\"; r -= 1) t += 1;
9872
9899
  return t % 2 === 1;
9873
9900
  }
9874
9901
  function Mu(n) {
9875
- if (n.types.includes(Ko))
9902
+ if (n.types.includes(Wo))
9876
9903
  try {
9877
- const e = JSON.parse(n.getData(Ko));
9904
+ const e = JSON.parse(n.getData(Wo));
9878
9905
  return typeof e != "object" || e === null || !("mode" in e) || typeof e.mode != "string" || !gu(e.mode) ? void 0 : n.getData("text/plain");
9879
9906
  } catch {
9880
9907
  return;
@@ -9883,9 +9910,9 @@ function Mu(n) {
9883
9910
  const Pm = (n) => {
9884
9911
  n.configureMd(hu);
9885
9912
  for (const e of Object.values(Gl))
9886
- n.addNodeSpec(e, () => ii[e]).addMarkdownTokenParserSpec(e, () => pu[e]).addNodeSerializerSpec(e, () => mu[e]);
9913
+ n.addNodeSpec(e, () => ri[e]).addMarkdownTokenParserSpec(e, () => pu[e]).addNodeSerializerSpec(e, () => mu[e]);
9887
9914
  n.addAction(cu, () => ({
9888
- isActive: (e) => xt(e) && Jo(
9915
+ isActive: (e) => xt(e) && qo(
9889
9916
  e.state,
9890
9917
  "inline_math"
9891
9918
  /* Inline */
@@ -9897,25 +9924,25 @@ const Pm = (n) => {
9897
9924
  xt(e) && _o(e.state, e.dispatch);
9898
9925
  }
9899
9926
  })).addAction(fu, () => ({
9900
- isActive: (e) => xt(e) && Jo(
9927
+ isActive: (e) => xt(e) && qo(
9901
9928
  e.state,
9902
9929
  "math_block"
9903
9930
  /* Block */
9904
9931
  ),
9905
- isEnabled: (e) => xt(e) && qo(e.state),
9932
+ isEnabled: (e) => xt(e) && Ho(e.state),
9906
9933
  metadata: () => {
9907
9934
  },
9908
9935
  run: (e) => {
9909
- xt(e) && qo(e.state, e.dispatch);
9936
+ xt(e) && Ho(e.state, e.dispatch);
9910
9937
  }
9911
9938
  })).addInputRules(({ schema: e }) => ({
9912
9939
  rules: [
9913
- Ul(/^\$\$\s$/, Ho(
9940
+ Ul(/^\$\$\s$/, Ko(
9914
9941
  e,
9915
9942
  "math_block"
9916
9943
  /* Block */
9917
9944
  )),
9918
- ku(Ho(
9945
+ ku(Ko(
9919
9946
  e,
9920
9947
  "inline_math"
9921
9948
  /* Inline */
@@ -9953,21 +9980,21 @@ const Du = {
9953
9980
  n.write(`\`\`\`mermaid
9954
9981
  ${e.attrs.source}
9955
9982
  \`\`\``), n.closeBlock(e);
9956
- }, Uo = (n, e) => {
9983
+ }, jo = (n, e) => {
9957
9984
  const t = n.schema.nodes[Tt];
9958
9985
  return t === void 0 || !n.selection.empty ? !1 : (e?.(n.tr.replaceSelectionWith(t.create({ source: Tu })).scrollIntoView()), !0);
9959
9986
  };
9960
- function Go(n) {
9987
+ function Uo(n) {
9961
9988
  return typeof n == "object" && n !== null && "state" in n && n.state instanceof pe;
9962
9989
  }
9963
9990
  const zm = (n) => {
9964
9991
  n.configureMd(Nu).addNodeSpec(Tt, () => Yl).addMarkdownTokenParserSpec(Tt, () => Du).addNodeSerializerSpec(Tt, () => Eu).addAction(Ou, () => ({
9965
9992
  isActive: () => !1,
9966
- isEnabled: (e) => Go(e) && Uo(e.state),
9993
+ isEnabled: (e) => Uo(e) && jo(e.state),
9967
9994
  metadata: () => {
9968
9995
  },
9969
9996
  run: (e) => {
9970
- Go(e) && Uo(e.state, e.dispatch);
9997
+ Uo(e) && jo(e.state, e.dispatch);
9971
9998
  }
9972
9999
  }));
9973
10000
  }, Ke = "quote_link", Au = "quoteLink";
@@ -9985,7 +10012,9 @@ function Iu(n) {
9985
10012
  t += 1;
9986
10013
  continue;
9987
10014
  }
9988
- const a = e.tokens.findIndex((c, f) => f > t && c.type === "blockquote_close");
10015
+ const a = e.tokens.findIndex(
10016
+ (c, f) => f > t && c.type === "blockquote_close"
10017
+ );
9989
10018
  if (a === -1) {
9990
10019
  t += 1;
9991
10020
  continue;
@@ -9999,10 +10028,21 @@ const vu = {
9999
10028
  content: "block+",
10000
10029
  defining: !0,
10001
10030
  group: "block",
10002
- toDOM: (n) => ["blockquote", { cite: n.attrs.cite, "data-content": n.attrs.content, "data-quote-link": "" }, 0]
10031
+ toDOM: (n) => [
10032
+ "blockquote",
10033
+ {
10034
+ cite: n.attrs.cite,
10035
+ "data-content": n.attrs.content,
10036
+ "data-quote-link": ""
10037
+ },
10038
+ 0
10039
+ ]
10003
10040
  }, Ru = {
10004
10041
  block: Ke,
10005
- getAttrs: (n) => ({ cite: n.attrGet("cite"), content: n.attrGet("data-content") })
10042
+ getAttrs: (n) => ({
10043
+ cite: n.attrGet("cite"),
10044
+ content: n.attrGet("data-content")
10045
+ })
10006
10046
  }, Pu = (n, e) => {
10007
10047
  n.wrapBlock("> ", null, e, () => {
10008
10048
  n.write(`[${e.attrs.content}](${e.attrs.cite}){data-quotelink=true}`), n.write(`
@@ -10015,7 +10055,7 @@ function Xl(n) {
10015
10055
  if (e === void 0) throw new Error("QuoteLink extension requires a quote_link node");
10016
10056
  return e;
10017
10057
  }
10018
- const Yo = (n, e) => {
10058
+ const Go = (n, e) => {
10019
10059
  const t = Xl(n.schema);
10020
10060
  for (let r = n.selection.$from.depth; r > 0; r -= 1)
10021
10061
  if (n.selection.$from.node(r).type === t) return Zn(n, e);
@@ -10032,13 +10072,18 @@ function Bu(n) {
10032
10072
  const Lm = (n) => {
10033
10073
  n.configureMd(Iu).addNodeSpec(Ke, () => vu).addMarkdownTokenParserSpec(Ke, () => Ru).addNodeSerializerSpec(Ke, () => Pu).addAction(Au, () => ({
10034
10074
  isActive: (e) => Er(e) && Bu(e.state),
10035
- isEnabled: (e) => Er(e) && Yo(e.state),
10075
+ isEnabled: (e) => Er(e) && Go(e.state),
10036
10076
  metadata: () => {
10037
10077
  },
10038
10078
  run: (e) => {
10039
- Er(e) && Yo(e.state, e.dispatch);
10079
+ Er(e) && Go(e.state, e.dispatch);
10040
10080
  }
10041
- })).addInputRules(({ schema: e }) => ({ rules: [Fn(/^\s*>\s$/, Xl(e))] }), n.Priority.High);
10081
+ })).addInputRules(
10082
+ ({ schema: e }) => ({
10083
+ rules: [Fn(/^\s*>\s$/, Xl(e))]
10084
+ }),
10085
+ n.Priority.High
10086
+ );
10042
10087
  }, lt = "yfm_html_block", zu = "createYfmHtmlBlock", Ar = "<div>YFM HTML</div>";
10043
10088
  function Lu(n) {
10044
10089
  return n.block.ruler.before("fence", lt, (e, t, r, i) => {
@@ -10070,7 +10115,7 @@ const $u = {
10070
10115
  n.write(`:::html
10071
10116
  ${e.attrs.html}
10072
10117
  :::`), n.closeBlock(e);
10073
- }, Xo = (n, e) => {
10118
+ }, Yo = (n, e) => {
10074
10119
  const t = n.schema.nodes[lt];
10075
10120
  if (t === void 0 || !n.selection.empty) return !1;
10076
10121
  const r = t.isTextblock ? t.create({ html: Ar }, n.schema.text(`:::html
@@ -10078,46 +10123,52 @@ ${Ar}
10078
10123
  :::`)) : t.create({ html: Ar });
10079
10124
  return e?.(n.tr.replaceSelectionWith(r).scrollIntoView()), !0;
10080
10125
  };
10081
- function Qo(n) {
10126
+ function Xo(n) {
10082
10127
  return typeof n == "object" && n !== null && "state" in n && n.state instanceof pe;
10083
10128
  }
10084
10129
  const Vm = (n) => {
10085
10130
  n.configureMd(Lu).addNodeSpec(lt, () => Ql).addMarkdownTokenParserSpec(lt, () => $u).addNodeSerializerSpec(lt, () => Vu).addAction(zu, () => ({
10086
10131
  isActive: () => !1,
10087
- isEnabled: (e) => Qo(e) && Xo(e.state),
10132
+ isEnabled: (e) => Xo(e) && Yo(e.state),
10088
10133
  metadata: () => {
10089
10134
  },
10090
10135
  run: (e) => {
10091
- Qo(e) && Xo(e.state, e.dispatch);
10136
+ Xo(e) && Yo(e.state, e.dispatch);
10092
10137
  }
10093
10138
  }));
10094
10139
  };
10095
- function oi(n) {
10096
- const e = n.nodes[fi];
10140
+ function ii(n) {
10141
+ const e = n.nodes[ci];
10097
10142
  if (e === void 0) throw new Error("Blockquote extension requires a blockquote node");
10098
10143
  return e;
10099
10144
  }
10100
10145
  const Fu = (n, e) => {
10101
10146
  const { selection: t } = n;
10102
- return !(t instanceof k) || t.$cursor === null || t.$cursor.parentOffset !== 0 || t.$cursor.node(-1).type.name !== fi ? !1 : Zn(n, e);
10147
+ return !(t instanceof k) || t.$cursor === null || t.$cursor.parentOffset !== 0 || t.$cursor.node(-1).type.name !== ci ? !1 : Zn(n, e);
10103
10148
  }, Fm = (n, e) => {
10104
- const t = oi(n.schema), { selection: r } = n;
10149
+ const t = ii(n.schema), { selection: r } = n;
10105
10150
  if (!(r instanceof k) || r.$cursor === null)
10106
10151
  return Rn(t)(n, e);
10107
10152
  for (let i = r.$cursor.depth; i > 0; i -= 1)
10108
- if (r.$cursor.node(i).type.name === fi)
10153
+ if (r.$cursor.node(i).type.name === ci)
10109
10154
  return Zn(n, e);
10110
10155
  return Rn(t)(n, e);
10111
10156
  }, Wm = (n, e) => {
10112
- n.use(Da), e?.qouteKey !== null && e?.qouteKey !== void 0 && n.addKeymap(({ schema: t }) => ({ [e.qouteKey]: Rn(oi(t)) })), n.addKeymap(() => ({ Backspace: Fu })), n.addInputRules(({ schema: t }) => ({ rules: [Fn(/^\s*>\s$/, oi(t))] }));
10157
+ n.use(Da), e?.qouteKey !== null && e?.qouteKey !== void 0 && n.addKeymap(({ schema: t }) => ({
10158
+ [e.qouteKey]: Rn(ii(t))
10159
+ })), n.addKeymap(() => ({ Backspace: Fu })), n.addInputRules(({ schema: t }) => ({
10160
+ rules: [Fn(/^\s*>\s$/, ii(t))]
10161
+ }));
10113
10162
  };
10114
10163
  function Cn(n) {
10115
10164
  const e = n.marks[Aa];
10116
10165
  if (e === void 0) throw new Error("Bold extension requires a strong mark");
10117
10166
  return e;
10118
10167
  }
10119
- const Km = (n, e, t) => ee(Cn(n.schema))(n, e, t), Hm = (n, e) => {
10120
- n.use(Ea), e?.boldKey !== null && e?.boldKey !== void 0 && n.addKeymap(({ schema: t }) => ({ [e.boldKey]: ee(Cn(t)) })), n.addInputRules(({ schema: t }) => ({
10168
+ const Km = (n, e, t) => ee(Cn(n.schema))(n, e, t), _m = (n, e) => {
10169
+ n.use(Ea), e?.boldKey !== null && e?.boldKey !== void 0 && n.addKeymap(({ schema: t }) => ({
10170
+ [e.boldKey]: ee(Cn(t))
10171
+ })), n.addInputRules(({ schema: t }) => ({
10121
10172
  rules: [
10122
10173
  Je({ close: "**", ignoreBetween: "*", open: "**" }, Cn(t)),
10123
10174
  Je({ close: "__", ignoreBetween: "_", open: "__" }, Cn(t))
@@ -10130,7 +10181,8 @@ function Je(n, e) {
10130
10181
  const f = l;
10131
10182
  if (f.index !== void 0 && f.index > 0 && f.input?.[f.index - 1] !== " ") return null;
10132
10183
  const d = s.schema.marks.code;
10133
- if (d !== void 0 && (s.doc.rangeHasMark(a, c, d) || s.selection.$from.marks().some((v) => v.type === d))) return null;
10184
+ if (d !== void 0 && (s.doc.rangeHasMark(a, c, d) || s.selection.$from.marks().some((v) => v.type === d)))
10185
+ return null;
10134
10186
  const u = f.length - 1, h = f[u];
10135
10187
  if (h === void 0) return null;
10136
10188
  const p = f[u - 1];
@@ -10156,20 +10208,26 @@ const Ku = (n) => er(il, (e, t) => {
10156
10208
  if (!(r instanceof k) || r.$cursor === null) return !1;
10157
10209
  const i = e.schema.nodes.paragraph, o = e.schema.nodes[n];
10158
10210
  if (i === void 0 || o === void 0 || r.$cursor.parent.type !== i) return !1;
10159
- if (Zo(r.$cursor.nodeBefore)) {
10211
+ if (Qo(r.$cursor.nodeBefore)) {
10160
10212
  if (t === void 0) return !0;
10161
- const s = r.$cursor.pos, l = r.$cursor.end(), a = r.$cursor.after(), c = e.doc.slice(Zo(r.$cursor.nodeAfter) ? s + 1 : s, l, !1).content, f = e.tr.insert(a, i.create(null, c)).setSelection(k.create(e.tr.doc, a + 1)).delete(s, l).delete(s - 1, s);
10213
+ const s = r.$cursor.pos, l = r.$cursor.end(), a = r.$cursor.after(), c = e.doc.slice(
10214
+ Qo(r.$cursor.nodeAfter) ? s + 1 : s,
10215
+ l,
10216
+ !1
10217
+ ).content, f = e.tr.insert(a, i.create(null, c)).setSelection(k.create(e.tr.doc, a + 1)).delete(s, l).delete(s - 1, s);
10162
10218
  return t(f.scrollIntoView()), !0;
10163
10219
  }
10164
10220
  return t?.(e.tr.replaceSelectionWith(o.create()).scrollIntoView()), !0;
10165
- }), _m = (n, e) => {
10221
+ }), Hm = (n, e) => {
10166
10222
  const t = e?.preferredBreak ?? "hard";
10167
- n.use(Ia, { preferredBreak: t }), n.addKeymap(() => ({ "Shift-Enter": Ku(t === "soft" ? Wi.SoftBreak : Wi.HardBreak) }));
10223
+ n.use(Ia, { preferredBreak: t }), n.addKeymap(() => ({
10224
+ "Shift-Enter": Ku(t === "soft" ? Fi.SoftBreak : Fi.HardBreak)
10225
+ }));
10168
10226
  };
10169
- function Zo(n) {
10227
+ function Qo(n) {
10170
10228
  return n?.type.spec.isBreak === !0;
10171
10229
  }
10172
- const Hu = "codemark", si = 100, _u = new zt(Hu);
10230
+ const _u = "codemark", oi = 100, Hu = new zt(_u);
10173
10231
  function Ae(n, e) {
10174
10232
  var t, r;
10175
10233
  return "schema" in n ? (t = e?.markType) !== null && t !== void 0 ? t : n.schema.marks.code : (r = e?.markType) !== null && r !== void 0 ? r : n.state.schema.marks.code;
@@ -10182,7 +10240,7 @@ function Zl(n, e, t, r) {
10182
10240
  const o = n.isInSet((i = e.state.storedMarks) !== null && i !== void 0 ? i : e.state.doc.resolve(t).marks()), s = e.state.doc.rangeHasMark(t, r, n);
10183
10241
  return !!(o || s);
10184
10242
  }
10185
- const es = {
10243
+ const Zo = {
10186
10244
  match: /`((?:[^`\w]|[\w])+)`$/,
10187
10245
  handler: (n, e, t, r, i, o, s) => {
10188
10246
  if (Zl(n, e, i, o))
@@ -10195,7 +10253,7 @@ const es = {
10195
10253
  });
10196
10254
  return e.dispatch(u), !0;
10197
10255
  }
10198
- }, ts = {
10256
+ }, es = {
10199
10257
  match: /^`((?:[^`\w]|[\w])+)`/,
10200
10258
  handler: (n, e, t, r, i, o, s) => {
10201
10259
  if (Zl(n, e, i, o))
@@ -10215,13 +10273,13 @@ function qu(n, e, t, r, i, o) {
10215
10273
  const { state: s } = e, l = s.doc.resolve(t);
10216
10274
  if (l.parent.type.spec.code)
10217
10275
  return !1;
10218
- const a = "", c = l.parent.textBetween(Math.max(0, l.parentOffset - si), l.parentOffset, void 0, a) + i, f = i + l.parent.textBetween(l.parentOffset, Math.min(l.parent.nodeSize - 2, l.parentOffset + si), void 0, a), d = es.match.exec(c), u = ts.match.exec(f);
10276
+ const a = "", c = l.parent.textBetween(Math.max(0, l.parentOffset - oi), l.parentOffset, void 0, a) + i, f = i + l.parent.textBetween(l.parentOffset, Math.min(l.parent.nodeSize - 2, l.parentOffset + oi), void 0, a), d = Zo.match.exec(c), u = es.match.exec(f);
10219
10277
  if (d) {
10220
- const h = es.handler(n, e, i, d, t - d[0].length + i.length, r, o);
10278
+ const h = Zo.handler(n, e, i, d, t - d[0].length + i.length, r, o);
10221
10279
  if (h)
10222
10280
  return h;
10223
10281
  }
10224
- return u ? ts.handler(n, e, i, u, t, r + u[0].length - i.length, o) : !1;
10282
+ return u ? es.handler(n, e, i, u, t, r + u[0].length - i.length, o) : !1;
10225
10283
  }
10226
10284
  function Ju(n, e) {
10227
10285
  const t = new P({
@@ -10250,7 +10308,7 @@ function ju(n, e, t, r) {
10250
10308
  if (n.state.selection.empty || t.metaKey || t.shiftKey || t.altKey || t.ctrlKey)
10251
10309
  return !1;
10252
10310
  const { from: i, to: o } = n.state.selection;
10253
- if (o - i >= si || n.state.doc.rangeHasMark(i, o, r))
10311
+ if (o - i >= oi || n.state.doc.rangeHasMark(i, o, r))
10254
10312
  return !1;
10255
10313
  const s = n.state.tr.addMark(i, o, r.create()), l = s.setSelection(k.create(s.doc, o)).removeStoredMark(r);
10256
10314
  return n.dispatch(l), !0;
@@ -10349,7 +10407,7 @@ function th() {
10349
10407
  }
10350
10408
  function nh(n) {
10351
10409
  const e = new P({
10352
- key: _u,
10410
+ key: Hu,
10353
10411
  appendTransaction: (t, r, i) => {
10354
10412
  var o;
10355
10413
  const s = e.getState(r), l = (o = t[0]) === null || o === void 0 ? void 0 : o.getMeta(e);
@@ -10421,18 +10479,24 @@ function Mn(n) {
10421
10479
  return e;
10422
10480
  }
10423
10481
  const qm = (n, e, t) => ee(Mn(n.schema))(n, e, t), Jm = (n, e) => {
10424
- n.use(va), e?.codeKey !== null && e?.codeKey !== void 0 && n.addKeymap(({ schema: t }) => ({ [e.codeKey]: ee(Mn(t)) })), n.addPlugin(({ schema: t }) => rh({ markType: Mn(t) })).addPlugin(() => new P({
10425
- props: {
10426
- handleTextInput: (t, r, i, o) => {
10427
- const { $anchor: s } = t.state.selection;
10428
- return !s.nodeBefore?.text?.endsWith("`") || !s.nodeAfter?.text?.startsWith("`") ? !1 : (t.dispatch(t.state.tr.replaceRangeWith(
10429
- r - 1,
10430
- i + 1,
10431
- t.state.schema.text(o, [Mn(t.state.schema).create()])
10432
- )), !0);
10482
+ n.use(va), e?.codeKey !== null && e?.codeKey !== void 0 && n.addKeymap(({ schema: t }) => ({
10483
+ [e.codeKey]: ee(Mn(t))
10484
+ })), n.addPlugin(({ schema: t }) => rh({ markType: Mn(t) })).addPlugin(
10485
+ () => new P({
10486
+ props: {
10487
+ handleTextInput: (t, r, i, o) => {
10488
+ const { $anchor: s } = t.state.selection;
10489
+ return !s.nodeBefore?.text?.endsWith("`") || !s.nodeAfter?.text?.startsWith("`") ? !1 : (t.dispatch(
10490
+ t.state.tr.replaceRangeWith(
10491
+ r - 1,
10492
+ i + 1,
10493
+ t.state.schema.text(o, [Mn(t.state.schema).create()])
10494
+ )
10495
+ ), !0);
10496
+ }
10433
10497
  }
10434
- }
10435
- }));
10498
+ })
10499
+ );
10436
10500
  };
10437
10501
  function sn(n) {
10438
10502
  const e = n.nodes[Gn];
@@ -10440,13 +10504,20 @@ function sn(n) {
10440
10504
  return e;
10441
10505
  }
10442
10506
  const jm = (n, e, t) => It(sn(n.schema))(n, e, t), Um = (n) => (e, t) => {
10443
- const r = e.selection instanceof w && e.selection.node.type === sn(e.schema) ? { attrs: e.selection.node.attrs, position: e.selection.from } : e.selection.$from.parent.type === sn(e.schema) ? { attrs: e.selection.$from.parent.attrs, position: e.selection.$from.before() } : void 0;
10444
- return r === void 0 ? !1 : (t?.(e.tr.setNodeMarkup(r.position, void 0, {
10445
- ...r.attrs,
10446
- [di.Lang]: n
10447
- })), !0);
10507
+ const r = e.selection instanceof w && e.selection.node.type === sn(e.schema) ? { attrs: e.selection.node.attrs, position: e.selection.from } : e.selection.$from.parent.type === sn(e.schema) ? {
10508
+ attrs: e.selection.$from.parent.attrs,
10509
+ position: e.selection.$from.before()
10510
+ } : void 0;
10511
+ return r === void 0 ? !1 : (t?.(
10512
+ e.tr.setNodeMarkup(r.position, void 0, {
10513
+ ...r.attrs,
10514
+ [fi.Lang]: n
10515
+ })
10516
+ ), !0);
10448
10517
  }, Gm = (n, e, t) => !n.selection.empty || n.selection.$from.parent.type !== sn(n.schema) ? !1 : t?.endOfTextblock("backward", n) === !0 ? It(n.schema.nodes.paragraph)(n, e, t) : !1, Ym = (n, e) => {
10449
- n.use(Pa).addPlugin(() => ih()), e?.codeBlockKey !== null && e?.codeBlockKey !== void 0 && n.addKeymap(({ schema: t }) => ({ [e.codeBlockKey]: It(sn(t)) }));
10518
+ n.use(Pa).addPlugin(() => ih()), e?.codeBlockKey !== null && e?.codeBlockKey !== void 0 && n.addKeymap(({ schema: t }) => ({
10519
+ [e.codeBlockKey]: It(sn(t))
10520
+ }));
10450
10521
  };
10451
10522
  function ih() {
10452
10523
  return new P({
@@ -10455,14 +10526,18 @@ function ih() {
10455
10526
  const e = [];
10456
10527
  return n.doc.descendants((t, r) => {
10457
10528
  if (t.type.name !== Gn) return !0;
10458
- const i = t.textContent, o = t.attrs[di.Lang], s = oh(n, r, i);
10529
+ const i = t.textContent, o = t.attrs[fi.Lang], s = oh(n, r, i);
10459
10530
  let l = 1;
10460
- e.push(sh(r, o)), e.push(ns(r + 1, l));
10531
+ e.push(sh(r, o)), e.push(ts(r + 1, l));
10461
10532
  for (const [a, c] of i.split("").entries())
10462
10533
  c === `
10463
- ` && (l += 1, e.push(ns(r + a + 2, l)));
10534
+ ` && (l += 1, e.push(ts(r + a + 2, l)));
10464
10535
  for (const a of ah(i, o))
10465
- s !== void 0 && a.from < s.to && a.to > s.from || e.push(I.inline(r + a.from + 1, r + a.to + 1, { class: `markdown-editor__code-token--${a.kind}` }));
10536
+ s !== void 0 && a.from < s.to && a.to > s.from || e.push(
10537
+ I.inline(r + a.from + 1, r + a.to + 1, {
10538
+ class: `markdown-editor__code-token--${a.kind}`
10539
+ })
10540
+ );
10466
10541
  return !1;
10467
10542
  }), D.create(n.doc, e);
10468
10543
  }
@@ -10483,22 +10558,41 @@ function oh(n, e, t) {
10483
10558
  };
10484
10559
  }
10485
10560
  function sh(n, e) {
10486
- return I.widget(n + 1, (t) => {
10487
- const r = document.createElement("select");
10488
- r.className = "markdown-editor__code-language", r.contentEditable = "false", r.setAttribute("aria-label", "Code language");
10489
- for (const [i, o] of [["", "Text"], ["javascript", "JavaScript"], ["typescript", "TypeScript"], ["json", "JSON"], ["html", "HTML"], ["css", "CSS"]])
10490
- r.add(new Option(o, i));
10491
- return r.value = e, r.addEventListener("change", () => {
10492
- const i = t.state.doc.nodeAt(n);
10493
- i?.type.name === Gn && (t.dispatch(t.state.tr.setNodeMarkup(n, void 0, {
10494
- ...i.attrs,
10495
- [di.Lang]: r.value
10496
- })), t.focus());
10497
- }), r;
10498
- }, { key: `code-language-${n}-${e}`, side: -2, stopEvent: () => !0 });
10561
+ return I.widget(
10562
+ n + 1,
10563
+ (t) => {
10564
+ const r = document.createElement("select");
10565
+ r.className = "markdown-editor__code-language", r.contentEditable = "false", r.setAttribute("aria-label", "Code language");
10566
+ for (const [i, o] of [
10567
+ ["", "Text"],
10568
+ ["javascript", "JavaScript"],
10569
+ ["typescript", "TypeScript"],
10570
+ ["json", "JSON"],
10571
+ ["html", "HTML"],
10572
+ ["css", "CSS"]
10573
+ ])
10574
+ r.add(new Option(o, i));
10575
+ return r.value = e, r.addEventListener("change", () => {
10576
+ const i = t.state.doc.nodeAt(n);
10577
+ i?.type.name === Gn && (t.dispatch(
10578
+ t.state.tr.setNodeMarkup(n, void 0, {
10579
+ ...i.attrs,
10580
+ [fi.Lang]: r.value
10581
+ })
10582
+ ), t.focus());
10583
+ }), r;
10584
+ },
10585
+ {
10586
+ key: `code-language-${n}-${e}`,
10587
+ side: -2,
10588
+ stopEvent: () => !0
10589
+ }
10590
+ );
10499
10591
  }
10500
- function ns(n, e) {
10501
- return I.widget(n, () => lh(e), { side: -1 });
10592
+ function ts(n, e) {
10593
+ return I.widget(n, () => lh(e), {
10594
+ side: -1
10595
+ });
10502
10596
  }
10503
10597
  function lh(n) {
10504
10598
  const e = document.createElement("span");
@@ -10510,15 +10604,22 @@ function ah(n, e) {
10510
10604
  const r = [];
10511
10605
  for (const i of n.matchAll(t)) {
10512
10606
  const o = i[0], s = i.index;
10513
- o === void 0 || s === void 0 || r.push({ from: s, kind: fh(o), to: s + o.length });
10607
+ o === void 0 || s === void 0 || r.push({
10608
+ from: s,
10609
+ kind: fh(o),
10610
+ to: s + o.length
10611
+ });
10514
10612
  }
10515
10613
  return r;
10516
10614
  }
10517
10615
  function ch(n) {
10518
- if (["js", "javascript", "ts", "typescript"].includes(n)) return /\/\/.*$|\/\*[\s\S]*?\*\/|(['"`])(?:\\.|(?!\1)[^\\])*\1|\b(?:async|await|class|const|export|function|if|import|let|new|return|throw|type|interface|var)\b|\b\d+(?:\.\d+)?\b/gm;
10616
+ if (["js", "javascript", "ts", "typescript"].includes(n))
10617
+ return /\/\/.*$|\/\*[\s\S]*?\*\/|(['"`])(?:\\.|(?!\1)[^\\])*\1|\b(?:async|await|class|const|export|function|if|import|let|new|return|throw|type|interface|var)\b|\b\d+(?:\.\d+)?\b/gm;
10519
10618
  if (n === "json") return /"(?:\\.|[^"\\])*"|\b(?:true|false|null)\b|\b\d+(?:\.\d+)?\b/g;
10520
- if (["html", "xml", "vue"].includes(n)) return /<!--[\s\S]*?-->|<\/?[\w-]+(?:\s[^<>]*)?>|(['"])(?:\\.|(?!\1)[^\\])*\1/g;
10521
- if (n === "css") return /\/\*[\s\S]*?\*\/|(['"])(?:\\.|(?!\1)[^\\])*\1|\b[\w-]+(?=\s*:)|#[\da-fA-F]{3,8}|\b\d+(?:\.\d+)?(?:px|rem|em|%)?/g;
10619
+ if (["html", "xml", "vue"].includes(n))
10620
+ return /<!--[\s\S]*?-->|<\/?[\w-]+(?:\s[^<>]*)?>|(['"])(?:\\.|(?!\1)[^\\])*\1/g;
10621
+ if (n === "css")
10622
+ return /\/\*[\s\S]*?\*\/|(['"])(?:\\.|(?!\1)[^\\])*\1|\b[\w-]+(?=\s*:)|#[\da-fA-F]{3,8}|\b\d+(?:\.\d+)?(?:px|rem|em|%)?/g;
10522
10623
  }
10523
10624
  function fh(n) {
10524
10625
  return n.startsWith("//") || n.startsWith("/*") || n.startsWith("<!--") ? "comment" : n.startsWith("<") ? "tag" : n.startsWith('"') || n.startsWith("'") || n.startsWith("`") ? "string" : /^\d|^#/.test(n) ? "number" : "keyword";
@@ -10543,23 +10644,38 @@ const ae = { Content: "html-content" }, hh = {
10543
10644
  atom: !0,
10544
10645
  attrs: { [ae.Content]: {} },
10545
10646
  group: "block",
10546
- parseDOM: [{
10547
- getAttrs: (n) => ({ [ae.Content]: n.getAttribute("data-html-raw") ?? n.innerHTML }),
10548
- tag: "[data-html]"
10549
- }],
10550
- toDOM: (n) => ["div", {
10551
- "data-html": "",
10552
- "data-html-raw": n.attrs[ae.Content],
10553
- "data-raw-html": "",
10554
- contenteditable: "false"
10555
- }, n.attrs[ae.Content]]
10647
+ parseDOM: [
10648
+ {
10649
+ getAttrs: (n) => ({
10650
+ [ae.Content]: n.getAttribute("data-html-raw") ?? n.innerHTML
10651
+ }),
10652
+ tag: "[data-html]"
10653
+ }
10654
+ ],
10655
+ toDOM: (n) => [
10656
+ "div",
10657
+ {
10658
+ "data-html": "",
10659
+ "data-html-raw": n.attrs[ae.Content],
10660
+ "data-raw-html": "",
10661
+ contenteditable: "false"
10662
+ },
10663
+ n.attrs[ae.Content]
10664
+ ]
10556
10665
  },
10557
10666
  html_inline: {
10558
10667
  atom: !0,
10559
10668
  attrs: { [ae.Content]: {} },
10560
10669
  group: "inline",
10561
10670
  inline: !0,
10562
- parseDOM: [{ getAttrs: (n) => ({ [ae.Content]: n.textContent }), tag: "span[data-html]" }],
10671
+ parseDOM: [
10672
+ {
10673
+ getAttrs: (n) => ({
10674
+ [ae.Content]: n.textContent
10675
+ }),
10676
+ tag: "span[data-html]"
10677
+ }
10678
+ ],
10563
10679
  toDOM: (n) => ["span", { "data-html": "", contenteditable: "false" }, n.attrs[ae.Content]]
10564
10680
  }
10565
10681
  }, ph = {
@@ -10609,20 +10725,31 @@ const eg = (n) => (e, t) => {
10609
10725
  return t(o.scrollIntoView()), !0;
10610
10726
  }, tg = (n) => {
10611
10727
  n.use(za), n.addInputRules(({ schema: e }) => ({
10612
- rules: [new te(/^(---|___|\*\*\*)$/, (t, r, i, o) => {
10613
- const s = t.schema.nodes.paragraph;
10614
- return s === void 0 ? null : t.tr.replaceWith(
10615
- i - 1,
10616
- o,
10617
- [gh(e).create({ [La]: r[0] }), s.create()]
10618
- ).setSelection(k.create(t.tr.doc, i + 1));
10619
- })]
10728
+ rules: [
10729
+ new te(/^(---|___|\*\*\*)$/, (t, r, i, o) => {
10730
+ const s = t.schema.nodes.paragraph;
10731
+ return s === void 0 ? null : t.tr.replaceWith(i - 1, o, [
10732
+ gh(e).create({
10733
+ [La]: r[0]
10734
+ }),
10735
+ s.create()
10736
+ ]).setSelection(k.create(t.tr.doc, i + 1));
10737
+ })
10738
+ ]
10620
10739
  }));
10621
10740
  };
10622
10741
  function yh(n) {
10623
10742
  return n instanceof w && n.node.type.name === ks;
10624
10743
  }
10625
- const He = "image", S = { Alt: "alt", Height: "height", Loading: "loading", ObjectFit: "object-fit", Src: "src", Title: "title", Width: "width" }, ng = ["contain", "cover", "fill", "none", "scale-down"], bh = {
10744
+ const _e = "image", S = {
10745
+ Alt: "alt",
10746
+ Height: "height",
10747
+ Loading: "loading",
10748
+ ObjectFit: "object-fit",
10749
+ Src: "src",
10750
+ Title: "title",
10751
+ Width: "width"
10752
+ }, ng = ["contain", "cover", "fill", "none", "scale-down"], bh = {
10626
10753
  attrs: {
10627
10754
  [S.Alt]: { default: null },
10628
10755
  [S.Height]: { default: null },
@@ -10636,18 +10763,20 @@ const He = "image", S = { Alt: "alt", Height: "height", Loading: "loading", Obje
10636
10763
  group: "inline",
10637
10764
  inline: !0,
10638
10765
  allowSelection: !0,
10639
- parseDOM: [{
10640
- getAttrs: (n) => ({
10641
- [S.Alt]: n.getAttribute(S.Alt),
10642
- [S.Height]: n.getAttribute(S.Height),
10643
- [S.Loading]: n.getAttribute(S.Loading),
10644
- [S.ObjectFit]: n.getAttribute("data-image-object-fit") || "contain",
10645
- [S.Src]: n.getAttribute(S.Src),
10646
- [S.Title]: n.getAttribute(S.Title),
10647
- [S.Width]: n.getAttribute(S.Width)
10648
- }),
10649
- tag: "img[src]"
10650
- }],
10766
+ parseDOM: [
10767
+ {
10768
+ getAttrs: (n) => ({
10769
+ [S.Alt]: n.getAttribute(S.Alt),
10770
+ [S.Height]: n.getAttribute(S.Height),
10771
+ [S.Loading]: n.getAttribute(S.Loading),
10772
+ [S.ObjectFit]: n.getAttribute("data-image-object-fit") || "contain",
10773
+ [S.Src]: n.getAttribute(S.Src),
10774
+ [S.Title]: n.getAttribute(S.Title),
10775
+ [S.Width]: n.getAttribute(S.Width)
10776
+ }),
10777
+ tag: "img[src]"
10778
+ }
10779
+ ],
10651
10780
  toDOM: (n) => {
10652
10781
  const e = document.createElement("img");
10653
10782
  for (const [t, r] of Object.entries(n.attrs))
@@ -10664,7 +10793,7 @@ const He = "image", S = { Alt: "alt", Height: "height", Loading: "loading", Obje
10664
10793
  [S.Title]: n.attrGet(S.Title) || null,
10665
10794
  [S.Width]: n.attrGet(S.Width) || null
10666
10795
  }),
10667
- node: He
10796
+ node: _e
10668
10797
  }, xh = (n, e) => {
10669
10798
  const { attrs: t } = e;
10670
10799
  let r = `![${t[S.Alt] ? n.esc(t[S.Alt]) : ""}](${t[S.Src] ? n.esc(t[S.Src]) : ""}`;
@@ -10680,13 +10809,15 @@ function Sh(n) {
10680
10809
  if (r === t.children.length - 1) continue;
10681
10810
  const o = t.children[r + 1];
10682
10811
  if (i?.type !== "image" || o?.type !== "text") continue;
10683
- const s = o.content.match(/^\{width=(\d+%?)(?:\s+height=(\d+))?(?:\s+object-fit=(contain|cover|fill|none|scale-down))?\}/);
10812
+ const s = o.content.match(
10813
+ /^\{width=(\d+%?)(?:\s+height=(\d+))?(?:\s+object-fit=(contain|cover|fill|none|scale-down))?\}/
10814
+ );
10684
10815
  s !== null && (i.attrSet(S.Width, s[1] ?? ""), s[2] !== void 0 && i.attrSet(S.Height, s[2]), s[3] !== void 0 && i.attrSet(S.ObjectFit, s[3]), o.content = o.content.slice(s[0].length));
10685
10816
  }
10686
10817
  }), n;
10687
10818
  }
10688
10819
  const rg = (n) => (e, t) => {
10689
- if (!(e.selection instanceof w) || e.selection.node.type.name !== He) return !1;
10820
+ if (!(e.selection instanceof w) || e.selection.node.type.name !== _e) return !1;
10690
10821
  const r = {
10691
10822
  ...e.selection.node.attrs,
10692
10823
  ...n.height === void 0 ? {} : { [S.Height]: n.height },
@@ -10696,16 +10827,18 @@ const rg = (n) => (e, t) => {
10696
10827
  return t?.(i.setSelection(w.create(i.doc, e.selection.from))), !0;
10697
10828
  }, ig = (n) => (e, t) => !e.selection.empty || n.src.length === 0 ? !1 : (t?.(e.tr.insert(e.selection.from, ta(e.schema).create(n)).scrollIntoView()), !0);
10698
10829
  function ta(n) {
10699
- const e = n.nodes[He];
10830
+ const e = n.nodes[_e];
10700
10831
  if (e === void 0) throw new Error("Image extension requires an image node");
10701
10832
  return e;
10702
10833
  }
10703
10834
  const og = (n) => {
10704
- n.addNodeSpec(He, () => bh).configureMd(Sh).addMarkdownTokenParserSpec(He, () => kh).addNodeSerializerSpec(He, () => xh).addPlugin(() => new P({
10705
- props: {
10706
- handlePaste: (e, t) => wh(e.state, e.dispatch, t)
10707
- }
10708
- }));
10835
+ n.addNodeSpec(_e, () => bh).configureMd(Sh).addMarkdownTokenParserSpec(_e, () => kh).addNodeSerializerSpec(_e, () => xh).addPlugin(
10836
+ () => new P({
10837
+ props: {
10838
+ handlePaste: (e, t) => wh(e.state, e.dispatch, t)
10839
+ }
10840
+ })
10841
+ );
10709
10842
  };
10710
10843
  function wh(n, e, t) {
10711
10844
  const r = t.clipboardData?.getData("text/plain").trim() ?? "";
@@ -10747,7 +10880,9 @@ const sg = (n, e, t) => ee(On(n.schema))(n, e, t), lg = (n, e) => {
10747
10880
  Je({ close: "*", ignoreBetween: "*", open: "*" }, On(t)),
10748
10881
  Je({ close: "_", ignoreBetween: "_", open: "_" }, On(t))
10749
10882
  ]
10750
- })), e?.italicKey !== null && e?.italicKey !== void 0 && n.addKeymap(({ schema: t }) => ({ [e.italicKey]: ee(On(t)) }));
10883
+ })), e?.italicKey !== null && e?.italicKey !== void 0 && n.addKeymap(({ schema: t }) => ({
10884
+ [e.italicKey]: ee(On(t))
10885
+ }));
10751
10886
  };
10752
10887
  function Te(n) {
10753
10888
  const e = n.marks[Wa];
@@ -10757,24 +10892,31 @@ function Te(n) {
10757
10892
  const ag = (n, e, t) => {
10758
10893
  const r = Te(n.schema);
10759
10894
  return r.isInSet(n.selection.$from.marks()) === void 0 ? !1 : ee(r)(n, e, t);
10760
- }, cg = (n, e) => (t, r, i) => ee(Te(t.schema), { [fe.Href]: n, [fe.Title]: e ?? null })(t, r, i), fg = (n, e, t, r = !1) => (i, o) => {
10761
- const s = Te(i.schema), l = Ei(i, s), a = l?.from ?? i.selection.from, c = l?.to ?? i.selection.to, f = t ?? (i.doc.textBetween(a, c) || n);
10895
+ }, cg = (n, e) => (t, r, i) => ee(Te(t.schema), {
10896
+ [fe.Href]: n,
10897
+ [fe.Title]: e ?? null
10898
+ })(t, r, i), fg = (n, e, t, r = !1) => (i, o) => {
10899
+ const s = Te(i.schema), l = Di(i, s), a = l?.from ?? i.selection.from, c = l?.to ?? i.selection.to, f = t ?? (i.doc.textBetween(a, c) || n);
10762
10900
  if (f.length === 0) return !1;
10763
10901
  let d = i.tr;
10764
10902
  (l === void 0 && i.selection.empty || t !== void 0 && t !== i.doc.textBetween(a, c)) && (d = d.insertText(f, a, c));
10765
10903
  const u = a + f.length;
10766
- return d = d.removeMark(a, u, s).addMark(a, u, s.create({
10767
- [fe.Href]: n,
10768
- [fe.Rel]: r ? "noopener noreferrer" : null,
10769
- [fe.Target]: r ? "_blank" : null,
10770
- [fe.Title]: e ?? null
10771
- })), o?.(d.scrollIntoView()), !0;
10904
+ return d = d.removeMark(a, u, s).addMark(
10905
+ a,
10906
+ u,
10907
+ s.create({
10908
+ [fe.Href]: n,
10909
+ [fe.Rel]: r ? "noopener noreferrer" : null,
10910
+ [fe.Target]: r ? "_blank" : null,
10911
+ [fe.Title]: e ?? null
10912
+ })
10913
+ ), o?.(d.scrollIntoView()), !0;
10772
10914
  }, dg = (n, e) => {
10773
- const t = Ei(n, Te(n.schema));
10915
+ const t = Di(n, Te(n.schema));
10774
10916
  return t === void 0 ? !1 : (e?.(n.tr.removeMark(t.from, t.to, Te(n.schema)).scrollIntoView()), !0);
10775
10917
  };
10776
10918
  function ug(n) {
10777
- const e = Ei(n, Te(n.schema));
10919
+ const e = Di(n, Te(n.schema));
10778
10920
  if (e !== void 0)
10779
10921
  return {
10780
10922
  href: e.mark.attrs[fe.Href],
@@ -10784,11 +10926,17 @@ function ug(n) {
10784
10926
  };
10785
10927
  }
10786
10928
  const hg = (n, e) => {
10787
- n.use(Fa), e?.linkKey !== null && e?.linkKey !== void 0 && n.addKeymap(({ schema: t }) => ({ [e.linkKey]: ee(Te(t)) })), n.addInputRules(({ schema: t }) => ({ rules: [Nh(Te(t))] })).addPlugin(() => new P({
10788
- props: {
10789
- handlePaste: (t, r) => Oh(t.state, t.dispatch, r)
10790
- }
10791
- }));
10929
+ n.use(Fa), e?.linkKey !== null && e?.linkKey !== void 0 && n.addKeymap(({ schema: t }) => ({
10930
+ [e.linkKey]: ee(Te(t))
10931
+ })), n.addInputRules(({ schema: t }) => ({
10932
+ rules: [Nh(Te(t))]
10933
+ })).addPlugin(
10934
+ () => new P({
10935
+ props: {
10936
+ handlePaste: (t, r) => Oh(t.state, t.dispatch, r)
10937
+ }
10938
+ })
10939
+ );
10792
10940
  };
10793
10941
  function Oh(n, e, t) {
10794
10942
  const r = t.clipboardData?.getData("text/plain").trim() ?? "";
@@ -10805,12 +10953,14 @@ function Th(n) {
10805
10953
  return !1;
10806
10954
  }
10807
10955
  }
10808
- function Ei(n, e) {
10956
+ function Di(n, e) {
10809
10957
  const { $from: t } = n.selection, r = e.isInSet(t.marks()) ?? e.isInSet(t.nodeBefore?.marks ?? []) ?? e.isInSet(t.nodeAfter?.marks ?? []);
10810
10958
  if (r === void 0) return;
10811
10959
  const i = t.start(), o = [];
10812
10960
  t.parent.forEach((u, h) => o.push({ marks: u.marks, nodeSize: u.nodeSize, offset: h }));
10813
- const s = (u) => u.some((h) => h.eq(r)), l = n.selection.from, a = o.findIndex(({ marks: u, nodeSize: h, offset: p }) => i + p <= l && l <= i + p + h && s(u)), c = a === -1 ? o.findIndex(({ marks: u }) => s(u)) : a;
10961
+ const s = (u) => u.some((h) => h.eq(r)), l = n.selection.from, a = o.findIndex(
10962
+ ({ marks: u, nodeSize: h, offset: p }) => i + p <= l && l <= i + p + h && s(u)
10963
+ ), c = a === -1 ? o.findIndex(({ marks: u }) => s(u)) : a;
10814
10964
  if (c === -1) return;
10815
10965
  let f = c, d = c;
10816
10966
  for (; f > 0 && s(o[f - 1]?.marks ?? []); ) f -= 1;
@@ -10826,54 +10976,94 @@ function Nh(n) {
10826
10976
  const o = t;
10827
10977
  if (o.index !== void 0 && o.index > 0 && o.input?.[o.index - 1] !== " ") return null;
10828
10978
  const s = o[1], l = o[2], a = e.schema.marks.code;
10829
- return s === void 0 || l === void 0 || a !== void 0 && e.doc.rangeHasMark(r, i, a) ? null : e.tr.replaceWith(r, i, n.schema.text(s)).addMark(
10830
- r,
10831
- r + s.length,
10832
- n.create({ [fe.Href]: l })
10833
- );
10979
+ return s === void 0 || l === void 0 || a !== void 0 && e.doc.rangeHasMark(r, i, a) ? null : e.tr.replaceWith(r, i, n.schema.text(s)).addMark(r, r + s.length, n.create({ [fe.Href]: l }));
10834
10980
  });
10835
10981
  }
10836
- const jt = "mark", Dh = { parseDOM: [{ tag: "mark" }], toDOM: () => ["mark", 0] }, Eh = { mark: jt }, Ah = { close: "==", expelEnclosingWhitespace: !0, mixable: !0, open: "==" };
10982
+ const jt = "mark", Dh = {
10983
+ parseDOM: [{ tag: "mark" }],
10984
+ toDOM: () => ["mark", 0]
10985
+ }, Eh = { mark: jt }, Ah = {
10986
+ close: "==",
10987
+ expelEnclosingWhitespace: !0,
10988
+ mixable: !0,
10989
+ open: "=="
10990
+ };
10837
10991
  function na(n) {
10838
10992
  const e = n.marks[jt];
10839
10993
  if (e === void 0) throw new Error("Mark extension requires a mark mark");
10840
10994
  return e;
10841
10995
  }
10842
10996
  const pg = (n, e, t) => ee(na(n.schema))(n, e, t), mg = (n) => {
10843
- n.configureMd((e) => e.use(qa)).addMarkSpec(jt, () => Dh).addMarkdownTokenParserSpec(jt, () => Eh).addMarkSerializerSpec(jt, () => Ah).addInputRules(({ schema: e }) => ({ rules: [Je({ close: "==", ignoreBetween: "=", open: "==" }, na(e))] }));
10844
- }, Wn = "strike", Ih = { parseDOM: [{ tag: "strike" }, { tag: "s" }], toDOM: () => ["strike", 0] }, vh = { mark: Wn }, Rh = { close: "~~", expelEnclosingWhitespace: !0, mixable: !0, open: "~~" };
10997
+ n.configureMd((e) => e.use(qa)).addMarkSpec(jt, () => Dh).addMarkdownTokenParserSpec(jt, () => Eh).addMarkSerializerSpec(jt, () => Ah).addInputRules(({ schema: e }) => ({
10998
+ rules: [Je({ close: "==", ignoreBetween: "=", open: "==" }, na(e))]
10999
+ }));
11000
+ }, Wn = "strike", Ih = {
11001
+ parseDOM: [{ tag: "strike" }, { tag: "s" }],
11002
+ toDOM: () => ["strike", 0]
11003
+ }, vh = { mark: Wn }, Rh = {
11004
+ close: "~~",
11005
+ expelEnclosingWhitespace: !0,
11006
+ mixable: !0,
11007
+ open: "~~"
11008
+ };
10845
11009
  function ra(n) {
10846
11010
  const e = n.marks[Wn];
10847
11011
  if (e === void 0) throw new Error("Strike extension requires a strike mark");
10848
11012
  return e;
10849
11013
  }
10850
- const gg = (n, e, t) => ee(ra(n.schema))(n, e, t), yg = (n) => n.configureMd((e) => e.enable("strikethrough")).addMarkSpec(Wn, () => Ih).addMarkdownTokenParserSpec("s", () => vh).addMarkSerializerSpec(Wn, () => Rh).addInputRules(({ schema: e }) => ({ rules: [Je({ close: "~~", ignoreBetween: "~", open: "~~" }, ra(e))] })), Tn = "sub", Ph = { excludes: "_", parseDOM: [{ tag: "sub" }], toDOM: () => ["sub", 0] }, Bh = { mark: Tn }, zh = { close: (n) => (n.escapeWhitespace = !1, "~"), expelEnclosingWhitespace: !0, mixable: !1, open: (n) => (n.escapeWhitespace = !0, "~") };
11014
+ const gg = (n, e, t) => ee(ra(n.schema))(n, e, t), yg = (n) => n.configureMd((e) => e.enable("strikethrough")).addMarkSpec(Wn, () => Ih).addMarkdownTokenParserSpec("s", () => vh).addMarkSerializerSpec(Wn, () => Rh).addInputRules(({ schema: e }) => ({
11015
+ rules: [Je({ close: "~~", ignoreBetween: "~", open: "~~" }, ra(e))]
11016
+ })), Tn = "sub", Ph = {
11017
+ excludes: "_",
11018
+ parseDOM: [{ tag: "sub" }],
11019
+ toDOM: () => ["sub", 0]
11020
+ }, Bh = { mark: Tn }, zh = {
11021
+ close: (n) => (n.escapeWhitespace = !1, "~"),
11022
+ expelEnclosingWhitespace: !0,
11023
+ mixable: !1,
11024
+ open: (n) => (n.escapeWhitespace = !0, "~")
11025
+ };
10851
11026
  function ia(n) {
10852
11027
  const e = n.marks.sub;
10853
11028
  if (!e) throw new Error("Subscript requires sub mark");
10854
11029
  return e;
10855
11030
  }
10856
- const bg = (n, e, t) => ee(ia(n.schema))(n, e, t), kg = (n) => n.configureMd((e) => e.use(Ja)).addMarkSpec(Tn, () => Ph).addMarkdownTokenParserSpec(Tn, () => Bh).addMarkSerializerSpec(Tn, () => zh).addInputRules(({ schema: e }) => ({ rules: [Je({ close: "~", ignoreBetween: "~", open: "~" }, ia(e))] })), Nn = "ins", Lh = { parseDOM: [{ tag: "ins" }, { tag: "u" }], toDOM: () => ["ins", 0] }, $h = { mark: Nn }, Vh = { close: "++", expelEnclosingWhitespace: !0, mixable: !0, open: "++" };
11031
+ const bg = (n, e, t) => ee(ia(n.schema))(n, e, t), kg = (n) => n.configureMd((e) => e.use(Ja)).addMarkSpec(Tn, () => Ph).addMarkdownTokenParserSpec(Tn, () => Bh).addMarkSerializerSpec(Tn, () => zh).addInputRules(({ schema: e }) => ({
11032
+ rules: [Je({ close: "~", ignoreBetween: "~", open: "~" }, ia(e))]
11033
+ })), Nn = "ins", Lh = {
11034
+ parseDOM: [{ tag: "ins" }, { tag: "u" }],
11035
+ toDOM: () => ["ins", 0]
11036
+ }, $h = { mark: Nn }, Vh = {
11037
+ close: "++",
11038
+ expelEnclosingWhitespace: !0,
11039
+ mixable: !0,
11040
+ open: "++"
11041
+ };
10857
11042
  function oa(n) {
10858
11043
  const e = n.marks.ins;
10859
11044
  if (!e) throw new Error("Underline requires ins mark");
10860
11045
  return e;
10861
11046
  }
10862
- const xg = (n, e, t) => ee(oa(n.schema))(n, e, t), Sg = (n) => n.configureMd((e) => e.use(ja)).addMarkSpec(Nn, () => Lh).addMarkdownTokenParserSpec(Nn, () => $h).addMarkSerializerSpec(Nn, () => Vh).addInputRules(({ schema: e }) => ({ rules: [Je({ close: "++", ignoreBetween: "+", open: "++" }, oa(e))] }));
11047
+ const xg = (n, e, t) => ee(oa(n.schema))(n, e, t), Sg = (n) => n.configureMd((e) => e.use(ja)).addMarkSpec(Nn, () => Lh).addMarkdownTokenParserSpec(Nn, () => $h).addMarkSerializerSpec(Nn, () => Vh).addInputRules(({ schema: e }) => ({
11048
+ rules: [Je({ close: "++", ignoreBetween: "+", open: "++" }, oa(e))]
11049
+ }));
10863
11050
  function Pe(n, e) {
10864
11051
  const t = n.nodes[e];
10865
11052
  if (t === void 0) throw new Error(`Table extension requires a ${e} node`);
10866
11053
  return t;
10867
11054
  }
10868
- function li(n, e) {
11055
+ function si(n, e) {
10869
11056
  return Pe(n.schema, z.Row).create(
10870
11057
  null,
10871
- Array.from({ length: e }, () => n.create({ [ui.CellAlign]: xs.Left }))
11058
+ Array.from({ length: e }, () => n.create({ [di.CellAlign]: xs.Left }))
10872
11059
  );
10873
11060
  }
10874
11061
  function Fh(n, e = 3, t = 3) {
10875
11062
  if (e < 2 || t < 1) throw new Error("A table requires at least two rows and one column");
10876
- const r = Pe(n, z.Body), i = Pe(n, z.DataCell), o = Pe(n, z.Head), s = Pe(n, z.HeaderCell), l = Pe(n, z.Table), a = o.create(null, li(s, t)), c = r.create(null, Array.from({ length: e - 1 }, () => li(i, t)));
11063
+ const r = Pe(n, z.Body), i = Pe(n, z.DataCell), o = Pe(n, z.Head), s = Pe(n, z.HeaderCell), l = Pe(n, z.Table), a = o.create(null, si(s, t)), c = r.create(
11064
+ null,
11065
+ Array.from({ length: e - 1 }, () => si(i, t))
11066
+ );
10877
11067
  return l.create(null, [a, c]);
10878
11068
  }
10879
11069
  const wg = (n = 3, e = 3) => (t, r) => (r !== void 0 && r(t.tr.replaceSelectionWith(Fh(t.schema, n, e)).scrollIntoView()), !0);
@@ -10917,19 +11107,25 @@ function Ue(n) {
10917
11107
  };
10918
11108
  }
10919
11109
  function sa(n, e) {
10920
- return li(Pe(n, z.DataCell), e);
11110
+ return si(Pe(n, z.DataCell), e);
10921
11111
  }
10922
11112
  const Cg = (n, e) => {
10923
11113
  const t = Ue(n);
10924
11114
  if (t === void 0) return !1;
10925
11115
  const r = t.inBody ? t.rowPosition + t.row.nodeSize : t.bodyPosition + t.body.nodeSize - 1;
10926
- return e?.(n.tr.insert(r, sa(n.schema, t.body.firstChild?.childCount ?? 1)).scrollIntoView()), !0;
11116
+ return e?.(
11117
+ n.tr.insert(r, sa(n.schema, t.body.firstChild?.childCount ?? 1)).scrollIntoView()
11118
+ ), !0;
10927
11119
  }, Mg = (n, e) => {
10928
11120
  const t = Ue(n);
10929
- return t === void 0 || !t.inBody ? !1 : (t.body.childCount === 1 ? e?.(n.tr.delete(t.tablePosition, t.tablePosition + t.table.nodeSize).scrollIntoView()) : e?.(n.tr.delete(t.rowPosition, t.rowPosition + t.row.nodeSize).scrollIntoView()), !0);
11121
+ return t === void 0 || !t.inBody ? !1 : (t.body.childCount === 1 ? e?.(
11122
+ n.tr.delete(t.tablePosition, t.tablePosition + t.table.nodeSize).scrollIntoView()
11123
+ ) : e?.(n.tr.delete(t.rowPosition, t.rowPosition + t.row.nodeSize).scrollIntoView()), !0);
10930
11124
  }, Og = (n, e) => {
10931
11125
  const t = Ue(n);
10932
- return t === void 0 ? !1 : (e?.(n.tr.delete(t.tablePosition, t.tablePosition + t.table.nodeSize).scrollIntoView()), !0);
11126
+ return t === void 0 ? !1 : (e?.(
11127
+ n.tr.delete(t.tablePosition, t.tablePosition + t.table.nodeSize).scrollIntoView()
11128
+ ), !0);
10933
11129
  };
10934
11130
  function rr(n) {
10935
11131
  const e = [];
@@ -10942,15 +11138,23 @@ const Tg = (n, e) => {
10942
11138
  if (t === void 0) return !1;
10943
11139
  const r = n.tr;
10944
11140
  for (const i of rr(t).reverse()) {
10945
- const o = Pe(n.schema, i.node.firstChild?.type.name === z.HeaderCell ? z.HeaderCell : z.DataCell);
10946
- r.insert(i.position + i.node.nodeSize - 1, o.create({ [ui.CellAlign]: xs.Left }));
11141
+ const o = Pe(
11142
+ n.schema,
11143
+ i.node.firstChild?.type.name === z.HeaderCell ? z.HeaderCell : z.DataCell
11144
+ );
11145
+ r.insert(
11146
+ i.position + i.node.nodeSize - 1,
11147
+ o.create({ [di.CellAlign]: xs.Left })
11148
+ );
10947
11149
  }
10948
11150
  return e?.(r.scrollIntoView()), !0;
10949
11151
  }, Ng = (n, e) => {
10950
11152
  const t = Ue(n);
10951
11153
  if (t === void 0) return !1;
10952
11154
  if (t.row.childCount === 1)
10953
- return e?.(n.tr.delete(t.tablePosition, t.tablePosition + t.table.nodeSize).scrollIntoView()), !0;
11155
+ return e?.(
11156
+ n.tr.delete(t.tablePosition, t.tablePosition + t.table.nodeSize).scrollIntoView()
11157
+ ), !0;
10954
11158
  const r = n.tr;
10955
11159
  for (const i of rr(t).reverse()) {
10956
11160
  let o = 0;
@@ -10969,7 +11173,7 @@ const Tg = (n, e) => {
10969
11173
  const l = o.node.child(r.cellIndex);
10970
11174
  i.setNodeMarkup(o.position + 1 + s, void 0, {
10971
11175
  ...l.attrs,
10972
- [ui.CellAlign]: n
11176
+ [di.CellAlign]: n
10973
11177
  });
10974
11178
  }
10975
11179
  return t?.(i.scrollIntoView()), !0;
@@ -10980,7 +11184,7 @@ function Wh(n) {
10980
11184
  (t.type.name === z.HeaderCell || t.type.name === z.DataCell) && e.push({ node: t, position: n.tablePosition + 1 + r });
10981
11185
  }), e;
10982
11186
  }
10983
- const rs = (n) => (e, t) => {
11187
+ const ns = (n) => (e, t) => {
10984
11188
  const r = Ue(e);
10985
11189
  if (r === void 0) return !1;
10986
11190
  const i = Wh(r), o = i.findIndex((c) => c.position === r.cellPosition), s = i[o + (n === "next" ? 1 : -1)];
@@ -10989,7 +11193,7 @@ const rs = (n) => (e, t) => {
10989
11193
  if (n === "prev") return !1;
10990
11194
  const l = r.bodyPosition + r.body.nodeSize - 1, a = e.tr.insert(l, sa(e.schema, r.row.childCount));
10991
11195
  return a.setSelection(k.create(a.doc, l + 2)), t?.(a.scrollIntoView()), !0;
10992
- }, is = (n, e) => {
11196
+ }, rs = (n, e) => {
10993
11197
  const t = Ue(n);
10994
11198
  if (t === void 0) return !1;
10995
11199
  const r = rr(t), i = r.findIndex((f) => f.position === t.rowPosition), o = r[i + 1];
@@ -11004,18 +11208,18 @@ const rs = (n) => (e, t) => {
11004
11208
  return c.setSelection(k.create(c.doc, a + 1)), e?.(c.scrollIntoView()), !0;
11005
11209
  }, Eg = (n) => {
11006
11210
  n.configureMd((e) => e.enable("table")).use(Ka).addKeymap(() => ({
11007
- Enter: is,
11008
- "Shift-Enter": is,
11009
- "Shift-Tab": rs("prev"),
11010
- Tab: rs("next")
11211
+ Enter: rs,
11212
+ "Shift-Enter": rs,
11213
+ "Shift-Tab": ns("prev"),
11214
+ Tab: ns("next")
11011
11215
  }));
11012
11216
  }, Kh = 100;
11013
- function Hh(n) {
11217
+ function _h(n) {
11014
11218
  const e = n.nodes.list_item;
11015
11219
  if (e === void 0) throw new Error("The editor schema must contain list_item");
11016
11220
  return e;
11017
11221
  }
11018
- function _e(n) {
11222
+ function He(n) {
11019
11223
  const { schema: e } = n.type;
11020
11224
  return n.type === e.nodes.bullet_list || n.type === e.nodes.ordered_list;
11021
11225
  }
@@ -11025,25 +11229,25 @@ function la(n) {
11025
11229
  function Kn(n) {
11026
11230
  const { $from: e } = n.selection;
11027
11231
  for (let t = e.depth; t > 0; t -= 1)
11028
- if (_e(e.node(t))) return !0;
11232
+ if (He(e.node(t))) return !0;
11029
11233
  return !1;
11030
11234
  }
11031
11235
  function aa(n) {
11032
11236
  const { selection: e } = n;
11033
11237
  return e instanceof k && e.$cursor !== null && e.$cursor.parentOffset === 0 ? e.$cursor : null;
11034
11238
  }
11035
- function Hn(n) {
11239
+ function _n(n) {
11036
11240
  return (e, t) => {
11037
11241
  const { $from: r } = e.selection;
11038
11242
  for (let i = r.depth; i > 0; i -= 1) {
11039
11243
  const o = r.node(i);
11040
- if (_e(o))
11244
+ if (He(o))
11041
11245
  return o.type === n || t !== void 0 && t(e.tr.setNodeMarkup(r.before(i), n)), !0;
11042
11246
  }
11043
11247
  return gf(n)(e, t);
11044
11248
  };
11045
11249
  }
11046
- function _h(n) {
11250
+ function Hh(n) {
11047
11251
  return (e, t) => {
11048
11252
  const r = aa(e);
11049
11253
  return r === null || r.parent.content.size !== 0 || r.node(-1).type !== n || r.node(-1).childCount !== 1 ? !1 : ol(e, t);
@@ -11053,7 +11257,7 @@ const qh = (n, e) => {
11053
11257
  const t = aa(n);
11054
11258
  if (t === null) return !1;
11055
11259
  const r = t.index(-1), i = t.node(-1).maybeChild(r - 1);
11056
- if (i === null || !_e(i)) return !1;
11260
+ if (i === null || !He(i)) return !1;
11057
11261
  const o = t.parent, s = n.schema.topNodeType.create(null, o), l = o.childCount === 0;
11058
11262
  let a = i, c = t.before() - i.nodeSize;
11059
11263
  for (; a.lastChild !== null; ) {
@@ -11062,7 +11266,7 @@ const qh = (n, e) => {
11062
11266
  const u = c + d + f.nodeSize, h = n.tr.delete(t.before(), t.after());
11063
11267
  return h.insert(u, o.content), h.setSelection(k.create(h.doc, u)), e?.(h.scrollIntoView()), !0;
11064
11268
  }
11065
- if (!_e(f) && f.canAppend(s)) {
11269
+ if (!He(f) && f.canAppend(s)) {
11066
11270
  const u = c + d + f.nodeSize, h = n.tr.delete(t.before(), t.after());
11067
11271
  return h.insert(u, o), h.setSelection(k.create(h.doc, u + 1)), e?.(h.scrollIntoView()), !0;
11068
11272
  }
@@ -11070,7 +11274,7 @@ const qh = (n, e) => {
11070
11274
  const u = n.tr;
11071
11275
  if (l)
11072
11276
  u.delete(t.before(), t.after()), u.setSelection(w.create(u.doc, c + d + 1));
11073
- else if (!_e(a) && a.canAppend(s)) {
11277
+ else if (!He(a) && a.canAppend(s)) {
11074
11278
  const h = c + a.nodeSize - 1;
11075
11279
  u.insert(h, o), u.setSelection(k.create(u.doc, h));
11076
11280
  } else
@@ -11087,16 +11291,11 @@ function Jh(n, e, t) {
11087
11291
  a ? 3 : 1,
11088
11292
  0
11089
11293
  );
11090
- return n.step(
11091
- new _(r - (a ? 3 : 1), i, r, i, f, 1, !0)
11092
- ), !0;
11294
+ return n.step(new H(r - (a ? 3 : 1), i, r, i, f, 1, !0)), !0;
11093
11295
  }
11094
11296
  function ln(n) {
11095
11297
  return ({ tr: e, selection: t }, r) => {
11096
- const { $from: i, $to: o } = t, s = i.blockRange(
11097
- o,
11098
- (u) => u.childCount > 0 && u.firstChild?.type === n
11099
- );
11298
+ const { $from: i, $to: o } = t, s = i.blockRange(o, (u) => u.childCount > 0 && u.firstChild?.type === n);
11100
11299
  if (s === null || s.startIndex === 0) return !1;
11101
11300
  const { end: l, parent: a, start: c, startIndex: f } = s;
11102
11301
  if (a.child(f - 1).type !== n) return !1;
@@ -11106,7 +11305,7 @@ function ln(n) {
11106
11305
  const u = e.mapping.map(o.pos), h = e.doc.resolve(d), p = h.before(h.depth), g = e.doc.resolve(p).blockRange(h);
11107
11306
  if (g?.start !== void 0) {
11108
11307
  const y = e.doc.resolve(g.start);
11109
- if (g.start > u && _e(y.parent)) {
11308
+ if (g.start > u && He(y.parent)) {
11110
11309
  d = g.start;
11111
11310
  const C = Bt(g);
11112
11311
  C !== null && e.lift(g, C);
@@ -11118,11 +11317,11 @@ function ln(n) {
11118
11317
  };
11119
11318
  }
11120
11319
  function Ag(n) {
11121
- const e = Hh(n);
11320
+ const e = _h(n);
11122
11321
  return {
11123
11322
  "Mod-[": tn(e),
11124
11323
  "Mod-]": ln(e),
11125
- Backspace: _h(e),
11324
+ Backspace: Hh(e),
11126
11325
  Enter: dl(e),
11127
11326
  "Shift-Tab": tn(e),
11128
11327
  Tab: ln(e)
@@ -11134,7 +11333,9 @@ function jh(n) {
11134
11333
  throw new Error("The editor schema must contain bullet_list and ordered_list");
11135
11334
  return su({
11136
11335
  rules: [
11137
- Fn(/^\s*([-+*])\s$/, e, (r) => ({ markup: r[1] })),
11336
+ Fn(/^\s*([-+*])\s$/, e, (r) => ({
11337
+ markup: r[1]
11338
+ })),
11138
11339
  Fn(
11139
11340
  /^(\d+)([.)])\s$/,
11140
11341
  t,
@@ -11149,12 +11350,12 @@ const Uh = () => new P({
11149
11350
  if (!n.some((o) => o.docChanged) || !Kn(e) && !Kn(t))
11150
11351
  return null;
11151
11352
  const { tr: r } = t, i = /* @__PURE__ */ new Map();
11152
- return r.doc.descendants((o, s) => (_e(o) && (i.get(s)?.type === o.type && r.join(r.mapping.map(s)), i.set(s + o.nodeSize, o)), !0)), r.docChanged ? r : null;
11353
+ return r.doc.descendants((o, s) => (He(o) && (i.get(s)?.type === o.type && r.join(r.mapping.map(s)), i.set(s + o.nodeSize, o)), !0)), r.docChanged ? r : null;
11153
11354
  }
11154
11355
  });
11155
11356
  function ca(n, e) {
11156
11357
  const t = n.firstChild;
11157
- if (t === null || !_e(t) || e >= Kh) return null;
11358
+ if (t === null || !He(t) || e >= Kh) return null;
11158
11359
  let r = b.empty;
11159
11360
  t.forEach((o) => {
11160
11361
  const s = la(o) ? ca(o, e + 1) : null;
@@ -11172,7 +11373,11 @@ const Gh = () => new P({
11172
11373
  r.doc.descendants((l, a) => {
11173
11374
  if (a < o || l.isTextblock || !la(l)) return !l.isTextblock;
11174
11375
  const c = ca(l, 0);
11175
- return c === null ? !0 : (i.push({ content: c, from: a, to: a + l.nodeSize }), o = a + l.nodeSize, !1);
11376
+ return c === null ? !0 : (i.push({
11377
+ content: c,
11378
+ from: a,
11379
+ to: a + l.nodeSize
11380
+ }), o = a + l.nodeSize, !1);
11176
11381
  });
11177
11382
  for (const { content: l, from: a, to: c } of i.reverse()) r.replaceWith(a, c, l);
11178
11383
  const s = i.at(0);
@@ -11182,8 +11387,8 @@ const Gh = () => new P({
11182
11387
  }
11183
11388
  return r.docChanged ? r : null;
11184
11389
  }
11185
- }), ss = new zt("folding-heading"), Yh = 24;
11186
- function Ai(n) {
11390
+ }), is = new zt("folding-heading"), Yh = 24;
11391
+ function Ei(n) {
11187
11392
  return n.type.name === "heading" && typeof n.attrs.folding == "boolean";
11188
11393
  }
11189
11394
  function fa(n) {
@@ -11191,7 +11396,7 @@ function fa(n) {
11191
11396
  }
11192
11397
  function da(n, e, t) {
11193
11398
  const r = n.doc.resolve(e + 1), i = r.node(-1).maybeChild(r.indexAfter(-1));
11194
- return i === null || Ai(i) && fa(i) <= t;
11399
+ return i === null || Ei(i) && fa(i) <= t;
11195
11400
  }
11196
11401
  function Xh(n, e, t) {
11197
11402
  const r = n.schema.nodes.paragraph;
@@ -11203,18 +11408,30 @@ const vr = (n, e) => {
11203
11408
  const { $from: t } = n.selection;
11204
11409
  if (t.parent.type.name !== "heading") return !1;
11205
11410
  if (e !== void 0) {
11206
- const r = t.before(), i = t.parent.attrs.folding, o = i === null ? Xh(n, r, fa(t.parent)).setNodeMarkup(r, void 0, { ...t.parent.attrs, folding: !1 }) : n.tr.setNodeMarkup(r, void 0, { ...t.parent.attrs, folding: !i });
11411
+ const r = t.before(), i = t.parent.attrs.folding, o = i === null ? Xh(n, r, fa(t.parent)).setNodeMarkup(r, void 0, {
11412
+ ...t.parent.attrs,
11413
+ folding: !1
11414
+ }) : n.tr.setNodeMarkup(r, void 0, {
11415
+ ...t.parent.attrs,
11416
+ folding: !i
11417
+ });
11207
11418
  e(o.scrollIntoView());
11208
11419
  }
11209
11420
  return !0;
11210
11421
  }, Qh = (n, e) => {
11211
11422
  if (!(n.selection instanceof k)) return !1;
11212
11423
  const t = n.selection.$cursor;
11213
- return t === null || t.parentOffset !== 0 || t.parent.type.name !== "heading" || t.parent.attrs.folding === null ? !1 : (e?.(n.tr.setNodeMarkup(t.before(), void 0, { ...t.parent.attrs, folding: null }).scrollIntoView()), !0);
11424
+ return t === null || t.parentOffset !== 0 || t.parent.type.name !== "heading" || t.parent.attrs.folding === null ? !1 : (e?.(
11425
+ n.tr.setNodeMarkup(t.before(), void 0, {
11426
+ ...t.parent.attrs,
11427
+ folding: null
11428
+ }).scrollIntoView()
11429
+ ), !0);
11214
11430
  }, Zh = (n, e) => {
11215
11431
  if (!(n.selection instanceof k)) return !1;
11216
11432
  const t = n.selection.$cursor;
11217
- if (t === null || t.parent.type.name !== "heading" || t.parent.attrs.folding === null || t.parentOffset !== t.parent.content.size) return !1;
11433
+ if (t === null || t.parent.type.name !== "heading" || t.parent.attrs.folding === null || t.parentOffset !== t.parent.content.size)
11434
+ return !1;
11218
11435
  const r = t.node(1).maybeChild(t.indexAfter(1));
11219
11436
  if (r !== null && r.type.name !== "heading") return !1;
11220
11437
  const i = n.schema.nodes.paragraph;
@@ -11222,19 +11439,27 @@ const vr = (n, e) => {
11222
11439
  const o = t.after(), s = n.tr.insert(o, i.create());
11223
11440
  return s.setSelection(k.create(s.doc, o + 1)), e?.(s.scrollIntoView()), !0;
11224
11441
  };
11225
- function ls(n) {
11442
+ function ss(n) {
11226
11443
  const e = [];
11227
11444
  let t, r;
11228
11445
  return n.forEach((i, o) => {
11229
11446
  if (i.type.name === "heading") {
11230
11447
  const s = Number(i.attrs.level);
11231
- t !== void 0 && s <= t && (t = void 0), i.attrs.folding === !0 && (t = s), Ai(i) && i.attrs.folding === !1 && (r = s), i.attrs.folding !== null && e.push(I.node(o, o + i.nodeSize, {
11232
- class: i.attrs.folding === !0 ? "markdown-editor__folding-heading markdown-editor__folding-heading--folded" : "markdown-editor__folding-heading"
11233
- }));
11234
- } else t !== void 0 ? e.push(I.node(o, o + i.nodeSize, { class: "markdown-editor__folded-content" })) : r !== void 0 && e.push(I.node(o, o + i.nodeSize, {
11235
- class: "markdown-editor__folding-content",
11236
- "data-folding-level": `h${r}`
11237
- }));
11448
+ t !== void 0 && s <= t && (t = void 0), i.attrs.folding === !0 && (t = s), Ei(i) && i.attrs.folding === !1 && (r = s), i.attrs.folding !== null && e.push(
11449
+ I.node(o, o + i.nodeSize, {
11450
+ class: i.attrs.folding === !0 ? "markdown-editor__folding-heading markdown-editor__folding-heading--folded" : "markdown-editor__folding-heading"
11451
+ })
11452
+ );
11453
+ } else t !== void 0 ? e.push(
11454
+ I.node(o, o + i.nodeSize, {
11455
+ class: "markdown-editor__folded-content"
11456
+ })
11457
+ ) : r !== void 0 && e.push(
11458
+ I.node(o, o + i.nodeSize, {
11459
+ class: "markdown-editor__folding-content",
11460
+ "data-folding-level": `h${r}`
11461
+ })
11462
+ );
11238
11463
  }), D.create(n, e);
11239
11464
  }
11240
11465
  function ep(n, e, t, r) {
@@ -11243,7 +11468,11 @@ function ep(n, e, t, r) {
11243
11468
  const o = n.doc.resolve(t);
11244
11469
  if (!o.node(-1).canReplaceWith(o.index(-1), o.indexAfter(-1), i)) return null;
11245
11470
  const s = e[1]?.length ?? 1, l = o.before(), a = n.tr.delete(t, r);
11246
- if (o.parent.type !== i && a.setNodeMarkup(l, i), a.setNodeMarkup(l, void 0, { ...o.parent.attrs, folding: !1, level: s }), da(n, l, s)) {
11471
+ if (o.parent.type !== i && a.setNodeMarkup(l, i), a.setNodeMarkup(l, void 0, {
11472
+ ...o.parent.attrs,
11473
+ folding: !1,
11474
+ level: s
11475
+ }), da(n, l, s)) {
11247
11476
  const c = a.doc.resolve(a.mapping.map(l) + 1), f = n.schema.nodes.paragraph;
11248
11477
  f !== void 0 && a.insert(c.after(), f.create());
11249
11478
  }
@@ -11258,42 +11487,55 @@ const Ig = (n) => {
11258
11487
  run: (e) => {
11259
11488
  Rr(e) && vr(e.state, e.dispatch);
11260
11489
  }
11261
- })).addInputRules(() => ({ rules: [new te(/^(#{1,6})\+\s$/, ep)] })).addKeymap(() => ({ Backspace: Qh, Enter: Zh }), n.Priority.High).addPlugin(() => new P({
11262
- key: ss,
11263
- props: {
11264
- decorations: (e) => ss.getState(e) ?? D.empty,
11265
- handleClickOn: (e, t, r, i, o) => {
11266
- if (!Ai(r)) return !1;
11267
- const s = e.nodeDOM(i);
11268
- if (!(s instanceof HTMLElement) || o.clientX - s.getBoundingClientRect().left >= Yh) return !1;
11269
- const l = e.state.apply(e.state.tr.setSelection(k.create(e.state.doc, i + 1)));
11270
- return vr(l, e.dispatch);
11490
+ })).addInputRules(() => ({
11491
+ rules: [new te(/^(#{1,6})\+\s$/, ep)]
11492
+ })).addKeymap(
11493
+ () => ({
11494
+ Backspace: Qh,
11495
+ Enter: Zh
11496
+ }),
11497
+ n.Priority.High
11498
+ ).addPlugin(
11499
+ () => new P({
11500
+ key: is,
11501
+ props: {
11502
+ decorations: (e) => is.getState(e) ?? D.empty,
11503
+ handleClickOn: (e, t, r, i, o) => {
11504
+ if (!Ei(r)) return !1;
11505
+ const s = e.nodeDOM(i);
11506
+ if (!(s instanceof HTMLElement) || o.clientX - s.getBoundingClientRect().left >= Yh)
11507
+ return !1;
11508
+ const l = e.state.apply(
11509
+ e.state.tr.setSelection(k.create(e.state.doc, i + 1))
11510
+ );
11511
+ return vr(l, e.dispatch);
11512
+ }
11513
+ },
11514
+ state: {
11515
+ apply: (e, t) => e.docChanged ? ss(e.doc) : t.map(e.mapping, e.doc),
11516
+ init: (e, t) => ss(t.doc)
11271
11517
  }
11272
- },
11273
- state: {
11274
- apply: (e, t) => e.docChanged ? ls(e.doc) : t.map(e.mapping, e.doc),
11275
- init: (e, t) => ls(t.doc)
11276
- }
11277
- }));
11518
+ })
11519
+ );
11278
11520
  };
11279
11521
  function Rr(n) {
11280
11522
  return typeof n == "object" && n !== null && "state" in n && n.state instanceof pe;
11281
11523
  }
11282
11524
  const tp = "addEmptyDefaultTextblockToStartOfDocument", np = "addEmptyDefaultTextblockToEndOfDocument";
11283
- function Ii(n) {
11525
+ function Ai(n) {
11284
11526
  return n.schema.nodes.paragraph;
11285
11527
  }
11286
11528
  function ua(n, e, t) {
11287
- const r = Ii(e);
11529
+ const r = Ai(e);
11288
11530
  if (t === void 0 || r === void 0) return;
11289
11531
  const i = e.tr.insert(n, r.create());
11290
11532
  i.setSelection(k.create(i.doc, n + 1)), t(i.scrollIntoView());
11291
11533
  }
11292
- const Pr = (n, e) => {
11293
- const t = Ii(n);
11534
+ const ls = (n, e) => {
11535
+ const t = Ai(n);
11294
11536
  return t === void 0 ? !1 : n.doc.firstChild?.type === t ? (e?.(n.tr.setSelection(k.create(n.doc, 1)).scrollIntoView()), !0) : (ua(0, n, e), !0);
11295
- }, Br = (n, e) => {
11296
- const t = Ii(n), { lastChild: r } = n.doc;
11537
+ }, Pr = (n, e) => {
11538
+ const t = Ai(n), { lastChild: r } = n.doc;
11297
11539
  return t === void 0 || r === null ? !1 : r.type === t && r.nodeSize === 2 ? (e?.(n.tr.setSelection(k.create(n.doc, n.doc.nodeSize - 3)).scrollIntoView()), !0) : (ua(n.doc.nodeSize - 2, n, e), !0);
11298
11540
  };
11299
11541
  function kn(n) {
@@ -11302,50 +11544,55 @@ function kn(n) {
11302
11544
  const vg = (n) => {
11303
11545
  n.addAction(tp, () => ({
11304
11546
  isActive: () => !1,
11305
- isEnabled: (e) => kn(e) && Pr(e.state),
11547
+ isEnabled: (e) => kn(e) && ls(e.state),
11306
11548
  metadata: () => {
11307
11549
  },
11308
11550
  run: (e) => {
11309
- kn(e) && Pr(e.state, e.dispatch);
11551
+ kn(e) && ls(e.state, e.dispatch);
11310
11552
  }
11311
11553
  })).addAction(np, () => ({
11312
11554
  isActive: () => !1,
11313
- isEnabled: (e) => kn(e) && Br(e.state),
11555
+ isEnabled: (e) => kn(e) && Pr(e.state),
11314
11556
  metadata: () => {
11315
11557
  },
11316
11558
  run: (e) => {
11317
- kn(e) && Br(e.state, e.dispatch);
11559
+ kn(e) && Pr(e.state, e.dispatch);
11318
11560
  }
11319
- })).addPlugin(() => new P({
11320
- props: {
11321
- handleClick: (e, t, r) => {
11322
- if (r.target !== e.dom) return !1;
11323
- const { firstChild: i, lastChild: o } = e.dom;
11324
- if (!(i instanceof Element) || !(o instanceof Element)) return !1;
11325
- const s = e.dom.getBoundingClientRect(), l = i.getBoundingClientRect().top - s.y, a = o.getBoundingClientRect().bottom - s.y;
11326
- return r.offsetY < l ? Pr(e.state, e.dispatch) : r.offsetY > a ? Br(e.state, e.dispatch) : !1;
11561
+ })).addPlugin(
11562
+ () => new P({
11563
+ props: {
11564
+ handleClick: (e, t, r) => {
11565
+ if (r.target !== e.dom) return !1;
11566
+ const { lastChild: i } = e.dom;
11567
+ if (!(i instanceof Element)) return !1;
11568
+ const o = e.dom.getBoundingClientRect(), s = i.getBoundingClientRect().bottom - o.y;
11569
+ return r.offsetY > s ? Pr(e.state, e.dispatch) : !1;
11570
+ }
11327
11571
  }
11328
- }
11329
- }));
11572
+ })
11573
+ );
11330
11574
  };
11331
11575
  function rp(n) {
11332
11576
  return n.selection.$from.parent.type.spec.code ? !0 : (n.selection.empty ? n.storedMarks ?? n.selection.$from.marks() : n.selection.$from.marks()).some((t) => t.type.spec.code);
11333
11577
  }
11334
11578
  const Rg = (n) => {
11335
- n.addPlugin(() => new P({
11336
- props: {
11337
- handleDOMEvents: {
11338
- paste(e, t) {
11339
- if (!rp(e.state) || t.clipboardData === null) return !1;
11340
- const r = Array.from(t.clipboardData.files), i = r.length > 0 ? r.map((l) => l.name).join(" ") : t.clipboardData.getData("text/plain"), o = e.state.selection.$from.parent.type.spec.code ? i : i.replaceAll(`
11579
+ n.addPlugin(
11580
+ () => new P({
11581
+ props: {
11582
+ handleDOMEvents: {
11583
+ paste(e, t) {
11584
+ if (!rp(e.state) || t.clipboardData === null) return !1;
11585
+ const r = Array.from(t.clipboardData.files), i = r.length > 0 ? r.map((l) => l.name).join(" ") : t.clipboardData.getData("text/plain"), o = e.state.selection.$from.parent.type.spec.code ? i : i.replaceAll(`
11341
11586
  `, "↵");
11342
- t.preventDefault();
11343
- const s = o.length > 0 ? e.state.tr.replaceSelectionWith(e.state.schema.text(o), !0) : e.state.tr.replaceWith(e.state.selection.from, e.state.selection.to, b.empty);
11344
- return e.dispatch(s.scrollIntoView()), !0;
11587
+ t.preventDefault();
11588
+ const s = o.length > 0 ? e.state.tr.replaceSelectionWith(e.state.schema.text(o), !0) : e.state.tr.replaceWith(e.state.selection.from, e.state.selection.to, b.empty);
11589
+ return e.dispatch(s.scrollIntoView()), !0;
11590
+ }
11345
11591
  }
11346
11592
  }
11347
- }
11348
- }), n.Priority.Highest);
11593
+ }),
11594
+ n.Priority.Highest
11595
+ );
11349
11596
  };
11350
11597
  function ip(n = {}) {
11351
11598
  return new P({
@@ -11485,7 +11732,12 @@ function sp() {
11485
11732
  const r = n.state.tr.replaceSelectionWith(t);
11486
11733
  return r.setSelection(k.create(r.doc, e.pos + 1)), n.dispatch(r.scrollIntoView()), !1;
11487
11734
  },
11488
- decorations: ({ doc: n, selection: e }) => Nt(e) ? D.create(n, [I.widget(e.head, lp, { key: "gapcursor", side: -1 })]) : null
11735
+ decorations: ({ doc: n, selection: e }) => Nt(e) ? D.create(n, [
11736
+ I.widget(e.head, lp, {
11737
+ key: "gapcursor",
11738
+ side: -1
11739
+ })
11740
+ ]) : null
11489
11741
  }
11490
11742
  });
11491
11743
  }
@@ -11497,7 +11749,7 @@ function lp(n, e) {
11497
11749
  }
11498
11750
  const Pg = (n, e) => {
11499
11751
  n.addPlugin(() => sp(), n.Priority.Highest), n.addPlugin(() => ip(e?.dropOptions));
11500
- }, ap = "0.1.0-alpha.0", Bg = (n, e) => {
11752
+ }, ap = "0.1.7", Bg = (n, e) => {
11501
11753
  n.addKeymap(() => {
11502
11754
  const t = {
11503
11755
  "Mod-Alt-]": () => (console.info(`YFM-Editor Debug info
@@ -11509,10 +11761,10 @@ Version: ${ap}`), !0)
11509
11761
  n.Priority.Lowest
11510
11762
  );
11511
11763
  };
11512
- var _n = 200, V = function() {
11764
+ var Hn = 200, V = function() {
11513
11765
  };
11514
11766
  V.prototype.append = function(e) {
11515
- return e.length ? (e = V.from(e), !this.length && e || e.length < _n && this.leafAppend(e) || this.length < _n && e.leafPrepend(this) || this.appendInner(e)) : this;
11767
+ return e.length ? (e = V.from(e), !this.length && e || e.length < Hn && this.leafAppend(e) || this.length < Hn && e.leafPrepend(this) || this.appendInner(e)) : this;
11516
11768
  };
11517
11769
  V.prototype.prepend = function(e) {
11518
11770
  return e.length ? V.from(e).append(this) : this;
@@ -11561,10 +11813,10 @@ var pa = /* @__PURE__ */ (function(n) {
11561
11813
  if (i(this.values[a], l + a) === !1)
11562
11814
  return !1;
11563
11815
  }, e.prototype.leafAppend = function(i) {
11564
- if (this.length + i.length <= _n)
11816
+ if (this.length + i.length <= Hn)
11565
11817
  return new e(this.values.concat(i.flatten()));
11566
11818
  }, e.prototype.leafPrepend = function(i) {
11567
- if (this.length + i.length <= _n)
11819
+ if (this.length + i.length <= Hn)
11568
11820
  return new e(i.flatten().concat(this.values));
11569
11821
  }, t.length.get = function() {
11570
11822
  return this.values.length;
@@ -11756,9 +12008,9 @@ function hp(n, e, t, r) {
11756
12008
  if (s && s.getMeta(at))
11757
12009
  return s.getMeta(at).redo ? new ve(n.done.addTransform(t, void 0, r, Dn(e)), n.undone, cs(t.mapping.maps), n.prevTime, n.prevComposition) : new ve(n.done, n.undone.addTransform(t, void 0, r, Dn(e)), null, n.prevTime, n.prevComposition);
11758
12010
  if (t.getMeta("addToHistory") !== !1 && !(s && s.getMeta("addToHistory") === !1)) {
11759
- let l = t.getMeta("composition"), a = n.prevTime == 0 || !s && n.prevComposition != l && (n.prevTime < (t.time || 0) - r.newGroupDelay || !pp(t, n.prevRanges)), c = s ? zr(n.prevRanges, t.mapping) : cs(t.mapping.maps);
12011
+ let l = t.getMeta("composition"), a = n.prevTime == 0 || !s && n.prevComposition != l && (n.prevTime < (t.time || 0) - r.newGroupDelay || !pp(t, n.prevRanges)), c = s ? Br(n.prevRanges, t.mapping) : cs(t.mapping.maps);
11760
12012
  return new ve(n.done.addTransform(t, a ? e.selection.getBookmark() : void 0, r, Dn(e)), ce.empty, c, t.time, l ?? n.prevComposition);
11761
- } else return (o = t.getMeta("rebased")) ? new ve(n.done.rebased(t, o), n.undone.rebased(t, o), zr(n.prevRanges, t.mapping), n.prevTime, n.prevComposition) : new ve(n.done.addMaps(t.mapping.maps), n.undone.addMaps(t.mapping.maps), zr(n.prevRanges, t.mapping), n.prevTime, n.prevComposition);
12013
+ } else return (o = t.getMeta("rebased")) ? new ve(n.done.rebased(t, o), n.undone.rebased(t, o), Br(n.prevRanges, t.mapping), n.prevTime, n.prevComposition) : new ve(n.done.addMaps(t.mapping.maps), n.undone.addMaps(t.mapping.maps), Br(n.prevRanges, t.mapping), n.prevTime, n.prevComposition);
11762
12014
  }
11763
12015
  function pp(n, e) {
11764
12016
  if (!e)
@@ -11777,7 +12029,7 @@ function cs(n) {
11777
12029
  n[t].forEach((r, i, o, s) => e.push(o, s));
11778
12030
  return e;
11779
12031
  }
11780
- function zr(n, e) {
12032
+ function Br(n, e) {
11781
12033
  if (!n)
11782
12034
  return null;
11783
12035
  let t = [];
@@ -11794,18 +12046,18 @@ function mp(n, e, t) {
11794
12046
  let s = o.selection.resolve(o.transform.doc), l = (t ? n.done : n.undone).addTransform(o.transform, e.selection.getBookmark(), i, r), a = new ve(t ? l : o.remaining, t ? o.remaining : l, null, 0, -1);
11795
12047
  return o.transform.setSelection(s).setMeta(at, { redo: t, historyState: a });
11796
12048
  }
11797
- let Lr = !1, fs = null;
12049
+ let zr = !1, fs = null;
11798
12050
  function Dn(n) {
11799
12051
  let e = n.plugins;
11800
12052
  if (fs != e) {
11801
- Lr = !1, fs = e;
12053
+ zr = !1, fs = e;
11802
12054
  for (let t = 0; t < e.length; t++)
11803
12055
  if (e[t].spec.historyPreserveItems) {
11804
- Lr = !0;
12056
+ zr = !0;
11805
12057
  break;
11806
12058
  }
11807
12059
  }
11808
- return Lr;
12060
+ return zr;
11809
12061
  }
11810
12062
  const at = new zt("history"), gp = new zt("closeHistory");
11811
12063
  function yp(n = {}) {
@@ -11826,7 +12078,7 @@ function yp(n = {}) {
11826
12078
  props: {
11827
12079
  handleDOMEvents: {
11828
12080
  beforeinput(e, t) {
11829
- let r = t.inputType, i = r == "historyUndo" ? vi : r == "historyRedo" ? Ri : null;
12081
+ let r = t.inputType, i = r == "historyUndo" ? Ii : r == "historyRedo" ? vi : null;
11830
12082
  return !i || !e.editable ? !1 : (t.preventDefault(), i(e.state, e.dispatch));
11831
12083
  }
11832
12084
  }
@@ -11845,30 +12097,35 @@ function ma(n, e) {
11845
12097
  return !0;
11846
12098
  };
11847
12099
  }
11848
- const vi = ma(!1, !0), Ri = ma(!0, !0);
12100
+ const Ii = ma(!1, !0), vi = ma(!0, !0);
11849
12101
  var bp = /* @__PURE__ */ ((n) => (n.Redo = "redo", n.Undo = "undo", n))(bp || {});
11850
12102
  function zg() {
11851
- return { redo: Ri, undo: vi };
12103
+ return { redo: vi, undo: Ii };
11852
12104
  }
11853
12105
  const Lg = (n, e) => {
11854
12106
  n.addPlugin(() => yp(e?.config)), n.addKeymap(() => {
11855
12107
  const t = {};
11856
- return e?.undoKey !== void 0 && e.undoKey !== null && (t[e.undoKey] = vi), e?.redoKey !== void 0 && e.redoKey !== null && (t[e.redoKey] = Ri), t;
12108
+ return e?.undoKey !== void 0 && e.undoKey !== null && (t[e.undoKey] = Ii), e?.redoKey !== void 0 && e.redoKey !== null && (t[e.redoKey] = vi), t;
11857
12109
  });
11858
12110
  }, $g = (n, e) => {
11859
- n.addPlugin(() => new P({
11860
- props: {
11861
- attributes: () => e?.content === void 0 || e.content.length === 0 ? {} : { "data-placeholder": e.content }
11862
- }
11863
- }), n.Priority.VeryHigh);
12111
+ n.addPlugin(
12112
+ () => new P({
12113
+ props: {
12114
+ attributes: () => e?.content === void 0 || e.content.length === 0 ? {} : { "data-placeholder": e.content }
12115
+ }
12116
+ }),
12117
+ n.Priority.VeryHigh
12118
+ );
11864
12119
  }, ds = 40, Vg = (n) => {
11865
- n.addPlugin(() => new P({
11866
- props: {
11867
- decorations: (e) => !(e.selection instanceof w) || e.selection.node.type.name !== He ? D.empty : D.create(e.doc, [
11868
- I.widget(e.selection.to, (t) => kp(t), { side: -1 })
11869
- ])
11870
- }
11871
- }));
12120
+ n.addPlugin(
12121
+ () => new P({
12122
+ props: {
12123
+ decorations: (e) => !(e.selection instanceof w) || e.selection.node.type.name !== _e ? D.empty : D.create(e.doc, [
12124
+ I.widget(e.selection.to, (t) => kp(t), { side: -1 })
12125
+ ])
12126
+ }
12127
+ })
12128
+ );
11872
12129
  };
11873
12130
  function kp(n) {
11874
12131
  const e = document.createElement("button");
@@ -11882,7 +12139,8 @@ function kp(n) {
11882
12139
  }
11883
12140
  }
11884
12141
  return e.addEventListener("pointerdown", (r) => {
11885
- if (!(n.state.selection instanceof w) || n.state.selection.node.type.name !== He) return;
12142
+ if (!(n.state.selection instanceof w) || n.state.selection.node.type.name !== _e)
12143
+ return;
11886
12144
  r.preventDefault();
11887
12145
  const i = n.state.selection, o = n.nodeDOM(i.from);
11888
12146
  if (!(o instanceof HTMLImageElement)) return;
@@ -11893,7 +12151,11 @@ function kp(n) {
11893
12151
  o.style.width = `${p}px`, o.style.height = `${Math.round(p / c)}px`;
11894
12152
  }, u = (h) => {
11895
12153
  e.removeEventListener("pointermove", d), e.removeEventListener("pointerup", u);
11896
- const p = Math.max(ds, Math.round(l + h.clientX - f)), m = { ...i.node.attrs, [S.Height]: Math.round(p / c), [S.Width]: p }, g = n.state.tr.setNodeMarkup(i.from, void 0, m);
12154
+ const p = Math.max(ds, Math.round(l + h.clientX - f)), m = {
12155
+ ...i.node.attrs,
12156
+ [S.Height]: Math.round(p / c),
12157
+ [S.Width]: p
12158
+ }, g = n.state.tr.setNodeMarkup(i.from, void 0, m);
11897
12159
  n.dispatch(g.setSelection(w.create(g.doc, i.from)));
11898
12160
  };
11899
12161
  e.addEventListener("pointermove", d), e.addEventListener("pointerup", u, { once: !0 });
@@ -11947,7 +12209,8 @@ const ir = (n) => (e, t, r) => {
11947
12209
  let s = null;
11948
12210
  if (Nt(o)) {
11949
12211
  if (o.meta?.direction !== i) return !1;
11950
- if (n === "up" && o.pos === 0 || n === "down" && o.pos === e.doc.nodeSize - 2) return !0;
12212
+ if (n === "up" && o.pos === 0 || n === "down" && o.pos === e.doc.nodeSize - 2)
12213
+ return !0;
11951
12214
  s = Sp(o, i);
11952
12215
  } else o instanceof w ? s = wp(o, i) : o instanceof k && r?.endOfTextblock(n) && (s = Mp(o, i));
11953
12216
  return s === null ? !1 : (t?.(Op(e.tr, s, i).scrollIntoView()), !0);
@@ -11972,25 +12235,27 @@ const vp = (n, e) => {
11972
12235
  }
11973
12236
  return !1;
11974
12237
  }, Fg = (n) => {
11975
- n.addPlugin(() => new P({
11976
- props: {
11977
- handleKeyDown: fl({
11978
- ArrowDown: Ep,
11979
- ArrowLeft: Tp,
11980
- ArrowRight: Np,
11981
- ArrowUp: Dp,
11982
- Backspace: Ap,
11983
- "Mod-a": vp
11984
- }),
11985
- decorations: (e) => Rp(e.selection, e.doc),
11986
- handleClickOn: (e, t, r, i, o, s) => !s || r.type.spec.allowSelection !== !0 ? !1 : (e.dispatch(e.state.tr.setSelection(new w(e.state.doc.resolve(i)))), !0)
11987
- },
11988
- view: (e) => (us(e.state, e.dispatch), {
11989
- update: (t) => {
11990
- us(t.state, t.dispatch);
11991
- }
12238
+ n.addPlugin(
12239
+ () => new P({
12240
+ props: {
12241
+ handleKeyDown: fl({
12242
+ ArrowDown: Ep,
12243
+ ArrowLeft: Tp,
12244
+ ArrowRight: Np,
12245
+ ArrowUp: Dp,
12246
+ Backspace: Ap,
12247
+ "Mod-a": vp
12248
+ }),
12249
+ decorations: (e) => Rp(e.selection, e.doc),
12250
+ handleClickOn: (e, t, r, i, o, s) => !s || r.type.spec.allowSelection !== !0 ? !1 : (e.dispatch(e.state.tr.setSelection(new w(e.state.doc.resolve(i)))), !0)
12251
+ },
12252
+ view: (e) => (us(e.state, e.dispatch), {
12253
+ update: (t) => {
12254
+ us(t.state, t.dispatch);
12255
+ }
12256
+ })
11992
12257
  })
11993
- }));
12258
+ );
11994
12259
  };
11995
12260
  function us(n, e) {
11996
12261
  return !(n.selection instanceof w) || n.selection.node.type.spec.selectable !== !1 ? !1 : sl(n, e);
@@ -11998,7 +12263,9 @@ function us(n, e) {
11998
12263
  function Rp(n, e) {
11999
12264
  if (n instanceof w)
12000
12265
  return D.create(e, [
12001
- I.node(n.from, n.to, { class: "pm-node-selected" })
12266
+ I.node(n.from, n.to, {
12267
+ class: "pm-node-selected"
12268
+ })
12002
12269
  ]);
12003
12270
  if (n instanceof k || n instanceof Y) {
12004
12271
  const t = Pp(n, e).map(
@@ -12057,9 +12324,9 @@ function Lp(n, e, t) {
12057
12324
  }
12058
12325
  function $p(n) {
12059
12326
  const e = jn(n);
12060
- return [ai(n), e, ai(e)];
12327
+ return [li(n), e, li(e)];
12061
12328
  }
12062
- function ai(n) {
12329
+ function li(n) {
12063
12330
  return n.includes("start") ? n.replace("start", "end") : n.replace("end", "start");
12064
12331
  }
12065
12332
  const hs = ["left", "right"], ps = ["right", "left"], Vp = ["top", "bottom"], Fp = ["bottom", "top"];
@@ -12078,13 +12345,13 @@ function Wp(n, e, t) {
12078
12345
  function Kp(n, e, t, r) {
12079
12346
  const i = sr(n);
12080
12347
  let o = Wp(Pt(n), t === "start", r);
12081
- return i && (o = o.map((s) => s + "-" + i), e && (o = o.concat(o.map(ai)))), o;
12348
+ return i && (o = o.map((s) => s + "-" + i), e && (o = o.concat(o.map(li)))), o;
12082
12349
  }
12083
12350
  function jn(n) {
12084
12351
  const e = Pt(n);
12085
12352
  return Bp[e] + n.slice(e.length);
12086
12353
  }
12087
- function Hp(n) {
12354
+ function _p(n) {
12088
12355
  var e, t, r, i;
12089
12356
  return {
12090
12357
  top: (e = n.top) != null ? e : 0,
@@ -12093,8 +12360,8 @@ function Hp(n) {
12093
12360
  left: (i = n.left) != null ? i : 0
12094
12361
  };
12095
12362
  }
12096
- function _p(n) {
12097
- return typeof n != "number" ? Hp(n) : {
12363
+ function Hp(n) {
12364
+ return typeof n != "number" ? _p(n) : {
12098
12365
  top: n,
12099
12366
  right: n,
12100
12367
  bottom: n,
@@ -12176,7 +12443,7 @@ async function qp(n, e) {
12176
12443
  elementContext: d = "floating",
12177
12444
  altBoundary: u = !1,
12178
12445
  padding: h = 0
12179
- } = or(e, n), p = _p(h), g = l[u ? d === "floating" ? "reference" : "floating" : d], y = Un(await o.getClippingRect({
12446
+ } = or(e, n), p = Hp(h), g = l[u ? d === "floating" ? "reference" : "floating" : d], y = Un(await o.getClippingRect({
12180
12447
  element: (t = await (o.isElement == null ? void 0 : o.isElement(g))) == null || t ? g : g.contextElement || await (o.getDocumentElement == null ? void 0 : o.getDocumentElement(l.floating)),
12181
12448
  boundary: c,
12182
12449
  rootBoundary: f,
@@ -12302,8 +12569,8 @@ const Jp = 50, jp = async (n, e, t) => {
12302
12569
  placement: i,
12303
12570
  overflows: R
12304
12571
  }], !R.every((Ye) => Ye <= 0)) {
12305
- var $i, Vi;
12306
- const Ye = ((($i = o.flip) == null ? void 0 : $i.index) || 0) + 1, ur = O[Ye];
12572
+ var Li, $i;
12573
+ const Ye = (((Li = o.flip) == null ? void 0 : Li.index) || 0) + 1, ur = O[Ye];
12307
12574
  if (ur && (!(d === "alignment" ? C !== Le(ur) : !1) || // We leave the current main axis only if every placement on that axis
12308
12575
  // overflows the main axis.
12309
12576
  ne.every((le) => Le(le.placement) === C ? le.overflows[0] > 0 : !0)))
@@ -12316,12 +12583,12 @@ const Jp = 50, jp = async (n, e, t) => {
12316
12583
  placement: ur
12317
12584
  }
12318
12585
  };
12319
- let $t = (Vi = ne.filter((Xe) => Xe.overflows[0] <= 0).sort((Xe, le) => Xe.overflows[1] - le.overflows[1])[0]) == null ? void 0 : Vi.placement;
12586
+ let $t = ($i = ne.filter((Xe) => Xe.overflows[0] <= 0).sort((Xe, le) => Xe.overflows[1] - le.overflows[1])[0]) == null ? void 0 : $i.placement;
12320
12587
  if (!$t)
12321
12588
  switch (h) {
12322
12589
  case "bestFit": {
12323
- var Fi;
12324
- const Xe = (Fi = ne.filter((le) => {
12590
+ var Vi;
12591
+ const Xe = (Vi = ne.filter((le) => {
12325
12592
  if (L) {
12326
12593
  const De = Le(le.placement);
12327
12594
  return De === C || // Create a bias to the `y` side axis due to horizontal
@@ -12329,7 +12596,7 @@ const Jp = 50, jp = async (n, e, t) => {
12329
12596
  De === "y";
12330
12597
  }
12331
12598
  return !0;
12332
- }).map((le) => [le.placement, le.overflows.filter((De) => De > 0).reduce((De, Na) => De + Na, 0)]).sort((le, De) => le[1] - De[1])[0]) == null ? void 0 : Fi[0];
12599
+ }).map((le) => [le.placement, le.overflows.filter((De) => De > 0).reduce((De, Na) => De + Na, 0)]).sort((le, De) => le[1] - De[1])[0]) == null ? void 0 : Vi[0];
12333
12600
  Xe && ($t = Xe);
12334
12601
  break;
12335
12602
  }
@@ -12500,15 +12767,15 @@ function cr(n) {
12500
12767
  }
12501
12768
  }
12502
12769
  const em = /transform|translate|scale|rotate|perspective|filter/, tm = /paint|layout|strict|content/, Qe = (n) => !!n && n !== "none";
12503
- let $r;
12504
- function Pi(n) {
12770
+ let Lr;
12771
+ function Ri(n) {
12505
12772
  const e = ge(n) ? ye(n) : n;
12506
- return Qe(e.transform) || Qe(e.translate) || Qe(e.scale) || Qe(e.rotate) || Qe(e.perspective) || !Bi() && (Qe(e.backdropFilter) || Qe(e.filter)) || em.test(e.willChange || "") || tm.test(e.contain || "");
12773
+ return Qe(e.transform) || Qe(e.translate) || Qe(e.scale) || Qe(e.rotate) || Qe(e.perspective) || !Pi() && (Qe(e.backdropFilter) || Qe(e.filter)) || em.test(e.willChange || "") || tm.test(e.contain || "");
12507
12774
  }
12508
12775
  function nm(n) {
12509
12776
  let e = mt(n);
12510
12777
  for (; Ge(e) && !an(e); ) {
12511
- if (Pi(e))
12778
+ if (Ri(e))
12512
12779
  return e;
12513
12780
  if (cr(e))
12514
12781
  return null;
@@ -12516,8 +12783,8 @@ function nm(n) {
12516
12783
  }
12517
12784
  return null;
12518
12785
  }
12519
- function Bi() {
12520
- return $r == null && ($r = typeof CSS < "u" && CSS.supports && CSS.supports("-webkit-backdrop-filter", "none")), $r;
12786
+ function Pi() {
12787
+ return Lr == null && (Lr = typeof CSS < "u" && CSS.supports && CSS.supports("-webkit-backdrop-filter", "none")), Lr;
12521
12788
  }
12522
12789
  function an(n) {
12523
12790
  return /^(html|body|#document)$/.test(Lt(n));
@@ -12555,12 +12822,12 @@ function cn(n, e, t) {
12555
12822
  e === void 0 && (e = []), t === void 0 && (t = !0);
12556
12823
  const i = Sa(n), o = i === ((r = n.ownerDocument) == null ? void 0 : r.body), s = Q(i);
12557
12824
  if (o) {
12558
- const l = ci(s);
12825
+ const l = ai(s);
12559
12826
  return e.concat(s, s.visualViewport || [], ar(i) ? i : [], l && t ? cn(l) : []);
12560
12827
  } else
12561
12828
  return e.concat(i, cn(i, [], t));
12562
12829
  }
12563
- function ci(n) {
12830
+ function ai(n) {
12564
12831
  return n.parent && Object.getPrototypeOf(n.parent) ? n.frameElement : null;
12565
12832
  }
12566
12833
  function wa(n) {
@@ -12573,11 +12840,11 @@ function wa(n) {
12573
12840
  $: l
12574
12841
  };
12575
12842
  }
12576
- function zi(n) {
12843
+ function Bi(n) {
12577
12844
  return ge(n) ? n : n.contextElement;
12578
12845
  }
12579
12846
  function Dt(n) {
12580
- const e = zi(n);
12847
+ const e = Bi(n);
12581
12848
  if (!Ge(e))
12582
12849
  return Oe(1);
12583
12850
  const t = e.getBoundingClientRect(), {
@@ -12594,7 +12861,7 @@ function Dt(n) {
12594
12861
  const rm = /* @__PURE__ */ Oe(0);
12595
12862
  function Ca(n) {
12596
12863
  const e = Q(n);
12597
- return !Bi() || !e.visualViewport ? rm : {
12864
+ return !Pi() || !e.visualViewport ? rm : {
12598
12865
  x: e.visualViewport.offsetLeft,
12599
12866
  y: e.visualViewport.offsetTop
12600
12867
  };
@@ -12604,17 +12871,17 @@ function im(n, e, t) {
12604
12871
  }
12605
12872
  function gt(n, e, t, r) {
12606
12873
  e === void 0 && (e = !1), t === void 0 && (t = !1);
12607
- const i = n.getBoundingClientRect(), o = zi(n);
12874
+ const i = n.getBoundingClientRect(), o = Bi(n);
12608
12875
  let s = Oe(1);
12609
12876
  e && (r ? ge(r) && (s = Dt(r)) : s = Dt(n));
12610
12877
  const l = im(o, t, r) ? Ca(o) : Oe(0);
12611
12878
  let a = (i.left + l.x) / s.x, c = (i.top + l.y) / s.y, f = i.width / s.x, d = i.height / s.y;
12612
12879
  if (o && r) {
12613
12880
  const u = Q(o), h = ge(r) ? Q(r) : r;
12614
- let p = u, m = ci(p);
12881
+ let p = u, m = ai(p);
12615
12882
  for (; m && h !== p; ) {
12616
12883
  const g = Dt(m), y = m.getBoundingClientRect(), C = ye(m), M = y.left + (m.clientLeft + parseFloat(C.paddingLeft)) * g.x, N = y.top + (m.clientTop + parseFloat(C.paddingTop)) * g.y;
12617
- a *= g.x, c *= g.y, f *= g.x, d *= g.y, a += M, c += N, p = Q(m), m = ci(p);
12884
+ a *= g.x, c *= g.y, f *= g.x, d *= g.y, a += M, c += N, p = Q(m), m = ai(p);
12618
12885
  }
12619
12886
  }
12620
12887
  return Un({
@@ -12682,7 +12949,7 @@ function cm(n, e, t) {
12682
12949
  const r = t === "layoutViewport", i = Q(n), o = Ne(n), s = i.visualViewport;
12683
12950
  let l = o.clientWidth, a = o.clientHeight, c = 0, f = 0;
12684
12951
  if (s) {
12685
- const u = !Bi() || e === "fixed";
12952
+ const u = !Pi() || e === "fixed";
12686
12953
  r ? u || (c = -s.offsetLeft, f = -s.offsetTop) : (l = s.width, a = s.height, u && (c = s.offsetLeft, f = s.offsetTop));
12687
12954
  }
12688
12955
  if (dr(o) <= 0) {
@@ -12732,7 +12999,7 @@ function dm(n, e) {
12732
12999
  const o = ye(n).position === "fixed";
12733
13000
  let s = o ? mt(n) : n;
12734
13001
  for (; ge(s) && !an(s); ) {
12735
- const l = ye(s), a = Pi(s), c = i ? i.position : o ? "fixed" : "";
13002
+ const l = ye(s), a = Ri(s), c = i ? i.position : o ? "fixed" : "";
12736
13003
  !a && (c === "fixed" || c === "absolute" && l.position === "static") ? r = r.filter((d) => d !== s) : i = l, s = mt(s);
12737
13004
  }
12738
13005
  return e.set(n, r), r;
@@ -12787,7 +13054,7 @@ function pm(n, e, t) {
12787
13054
  height: s.height
12788
13055
  };
12789
13056
  }
12790
- function Vr(n) {
13057
+ function $r(n) {
12791
13058
  return ye(n).position === "static";
12792
13059
  }
12793
13060
  function bs(n, e) {
@@ -12805,16 +13072,16 @@ function Oa(n, e) {
12805
13072
  if (!Ge(n)) {
12806
13073
  let i = mt(n);
12807
13074
  for (; i && !an(i); ) {
12808
- if (ge(i) && !Vr(i))
13075
+ if (ge(i) && !$r(i))
12809
13076
  return i;
12810
13077
  i = mt(i);
12811
13078
  }
12812
13079
  return t;
12813
13080
  }
12814
13081
  let r = bs(n, e);
12815
- for (; r && Zp(r) && Vr(r); )
13082
+ for (; r && Zp(r) && $r(r); )
12816
13083
  r = bs(r, e);
12817
- return r && an(r) && Vr(r) && !Pi(r) ? t : r || nm(n) || t;
13084
+ return r && an(r) && $r(r) && !Ri(r) ? t : r || nm(n) || t;
12818
13085
  }
12819
13086
  const mm = async function(n) {
12820
13087
  const e = this.getOffsetParent || Oa, t = this.getDimensions, r = await t(n.floating);
@@ -12905,7 +13172,7 @@ function km(n, e, t, r) {
12905
13172
  elementResize: s = typeof ResizeObserver == "function",
12906
13173
  layoutShift: l = typeof IntersectionObserver == "function",
12907
13174
  animationFrame: a = !1
12908
- } = r, c = zi(n), f = i || o ? [...c ? cn(c) : [], ...e ? cn(e) : []] : [];
13175
+ } = r, c = Bi(n), f = i || o ? [...c ? cn(c) : [], ...e ? cn(e) : []] : [];
12909
13176
  f.forEach((y) => {
12910
13177
  i && y.addEventListener("scroll", t), o && y.addEventListener("resize", t);
12911
13178
  });
@@ -12942,15 +13209,15 @@ const xm = Xp, Sm = Qp, wm = Up, Cm = (n, e, t) => {
12942
13209
  platform: o
12943
13210
  });
12944
13211
  };
12945
- function Li(n, e, t, r) {
12946
- const i = Ki({ render: () => Ki(n, e) });
12947
- return i.appContext = r ?? null, Hi(i, t), () => Hi(null, t);
13212
+ function zi(n, e, t, r) {
13213
+ const i = Wi({ render: () => Wi(n, e) });
13214
+ return i.appContext = r ?? null, Ki(i, t), () => Ki(null, t);
12948
13215
  }
12949
13216
  function Wg(n, e = {}) {
12950
13217
  return (t, r, i) => {
12951
13218
  const o = document.createElement(e.element ?? "div"), s = document.createElement("div"), l = Ss({ getPos: i, node: t, selected: !1 });
12952
13219
  o.append(s);
12953
- const a = Li(n, l, s, e.appContext), c = e.contentDOM ? document.createElement("div") : void 0;
13220
+ const a = zi(n, l, s, e.appContext), c = e.contentDOM ? document.createElement("div") : void 0;
12954
13221
  return c !== void 0 && o.append(c), {
12955
13222
  contentDOM: c,
12956
13223
  deselectNode: () => {
@@ -12974,7 +13241,7 @@ function Kg(n, e, t = {}, r = {}) {
12974
13241
  n,
12975
13242
  () => {
12976
13243
  const o = document.createElement("span");
12977
- return i = Li(e, t, o, r.appContext), o;
13244
+ return i = zi(e, t, o, r.appContext), o;
12978
13245
  },
12979
13246
  {
12980
13247
  destroy: () => {
@@ -12999,16 +13266,20 @@ function Mm(n, e = {}) {
12999
13266
  visible: !1
13000
13267
  });
13001
13268
  document.body.append(r);
13002
- const o = Li(n, i, r, e.appContext), s = async () => {
13269
+ const o = zi(n, i, r, e.appContext), s = async () => {
13003
13270
  if (typeof document.createRange().getClientRects != "function")
13004
13271
  return;
13005
- const c = t.coordsAtPos(t.state.selection.from), { x: f, y: d } = await Cm({
13006
- getBoundingClientRect: () => new DOMRect(c.left, c.bottom, 0, 0)
13007
- }, r, {
13008
- middleware: [xm(6), wm({ padding: 8 }), Sm({ padding: 8 })],
13009
- placement: "bottom-start",
13010
- strategy: "fixed"
13011
- });
13272
+ const c = t.coordsAtPos(t.state.selection.from), { x: f, y: d } = await Cm(
13273
+ {
13274
+ getBoundingClientRect: () => new DOMRect(c.left, c.bottom, 0, 0)
13275
+ },
13276
+ r,
13277
+ {
13278
+ middleware: [xm(6), wm({ padding: 8 }), Sm({ padding: 8 })],
13279
+ placement: "bottom-start",
13280
+ strategy: "fixed"
13281
+ }
13282
+ );
13012
13283
  r.style.left = `${f}px`, r.style.top = `${d}px`;
13013
13284
  }, l = km(t.dom, r, s), a = () => {
13014
13285
  const { from: c, to: f, empty: d } = t.state.selection;
@@ -13028,30 +13299,32 @@ function Mm(n, e = {}) {
13028
13299
  }
13029
13300
  });
13030
13301
  }
13031
- const Hg = (n, e) => {
13032
- e?.component !== void 0 && n.addPlugin(() => Mm(e.component, {
13033
- ...e,
13034
- shouldShow: (t) => t.selection instanceof k && (e.shouldShow?.(t) ?? !0)
13035
- }));
13302
+ const _g = (n, e) => {
13303
+ e?.component !== void 0 && n.addPlugin(
13304
+ () => Mm(e.component, {
13305
+ ...e,
13306
+ shouldShow: (t) => t.selection instanceof k && (e.shouldShow?.(t) ?? !0)
13307
+ })
13308
+ );
13036
13309
  };
13037
13310
  function Ut(n) {
13038
- const e = n.nodes[_a];
13311
+ const e = n.nodes[Ha];
13039
13312
  if (e === void 0) throw new Error("Heading extension requires a heading node");
13040
13313
  return e;
13041
13314
  }
13042
13315
  const St = (n) => (e, t, r) => {
13043
13316
  const i = e.selection.$from.parent;
13044
- if (i.type === Ut(e.schema) && i.attrs[Fr] === n) {
13317
+ if (i.type === Ut(e.schema) && i.attrs[Vr] === n) {
13045
13318
  const s = e.schema.nodes.paragraph;
13046
13319
  return s === void 0 ? !1 : It(s)(e, t, r);
13047
13320
  }
13048
13321
  const o = i.type === Ut(e.schema) ? { ...i.attrs } : {};
13049
- return o[Fr] = n, It(Ut(e.schema), o)(e, t, r);
13322
+ return o[Vr] = n, It(Ut(e.schema), o)(e, t, r);
13050
13323
  }, Om = (n, e, t) => {
13051
13324
  const r = n.schema.nodes.paragraph;
13052
13325
  return !n.selection.empty || r === void 0 || n.selection.$from.parent.type !== Ut(n.schema) ? !1 : t?.endOfTextblock("backward", n) === !0 ? It(r)(n, e, t) : !1;
13053
- }, _g = (n, e) => {
13054
- n.use(Ha), n.addKeymap(() => ({
13326
+ }, Hg = (n, e) => {
13327
+ n.use(_a), n.addKeymap(() => ({
13055
13328
  Backspace: Om,
13056
13329
  ...e?.h1Key === void 0 || e.h1Key === null ? {} : { [e.h1Key]: St(1) },
13057
13330
  ...e?.h2Key === void 0 || e.h2Key === null ? {} : { [e.h2Key]: St(2) },
@@ -13060,7 +13333,11 @@ const St = (n) => (e, t, r) => {
13060
13333
  ...e?.h5Key === void 0 || e.h5Key === null ? {} : { [e.h5Key]: St(5) },
13061
13334
  ...e?.h6Key === void 0 || e.h6Key === null ? {} : { [e.h6Key]: St(6) }
13062
13335
  })).addInputRules(({ schema: t }) => ({
13063
- rules: [Ul(/^(#{1,6})\s$/, Ut(t), (r) => ({ [Fr]: r[1]?.length }))]
13336
+ rules: [
13337
+ Ul(/^(#{1,6})\s$/, Ut(t), (r) => ({
13338
+ [Vr]: r[1]?.length
13339
+ }))
13340
+ ]
13064
13341
  }));
13065
13342
  };
13066
13343
  function qg(n) {
@@ -13070,8 +13347,8 @@ function qg(n) {
13070
13347
  return {
13071
13348
  liftListItem: tn(e),
13072
13349
  sinkListItem: ln(e),
13073
- toBulletList: Hn(t),
13074
- toOrderedList: Hn(r)
13350
+ toBulletList: _n(t),
13351
+ toOrderedList: _n(r)
13075
13352
  };
13076
13353
  }
13077
13354
  const Jg = (n, e) => {
@@ -13080,21 +13357,18 @@ const Jg = (n, e) => {
13080
13357
  if (r === void 0 || i === void 0 || o === void 0)
13081
13358
  throw new Error("Lists extension requires list_item, bullet_list and ordered_list nodes");
13082
13359
  const s = {};
13083
- return e?.ulKey !== null && e?.ulKey !== void 0 && (s[e.ulKey] = Hn(i)), e?.olKey !== null && e?.olKey !== void 0 && (s[e.olKey] = Hn(o)), {
13360
+ return e?.ulKey !== null && e?.ulKey !== void 0 && (s[e.ulKey] = _n(i)), e?.olKey !== null && e?.olKey !== void 0 && (s[e.olKey] = _n(o)), {
13084
13361
  "Mod-[": tn(r),
13085
13362
  "Mod-]": ln(r),
13086
13363
  "Shift-Tab": tn(r),
13087
13364
  Tab: ln(r),
13088
13365
  ...s
13089
13366
  };
13090
- }, n.Priority.High), n.addKeymap(
13091
- ({ schema: t }) => {
13092
- const r = t.nodes.list_item;
13093
- if (r === void 0) throw new Error("Lists extension requires list_item node");
13094
- return { Backspace: qh, Enter: dl(r) };
13095
- },
13096
- n.Priority.Low
13097
- ), n.addPlugin(({ schema: t }) => jh(t)), n.addPlugin(Uh), n.addPlugin(Gh);
13367
+ }, n.Priority.High), n.addKeymap(({ schema: t }) => {
13368
+ const r = t.nodes.list_item;
13369
+ if (r === void 0) throw new Error("Lists extension requires list_item node");
13370
+ return { Backspace: qh, Enter: dl(r) };
13371
+ }, n.Priority.Low), n.addPlugin(({ schema: t }) => jh(t)), n.addPlugin(Uh), n.addPlugin(Gh);
13098
13372
  }, jg = (n, e) => {
13099
13373
  n.addNodeSpec("doc", () => ({ content: "block+" })), n.addNodeSpec("text", () => ({ group: "inline" })), n.addNodeSpec("paragraph", () => ({
13100
13374
  attrs: { "data-line": { default: null } },
@@ -13105,7 +13379,14 @@ const Jg = (n, e) => {
13105
13379
  ...e?.paragraphPlaceholder === void 0 ? {} : { placeholder: { content: e.paragraphPlaceholder } }
13106
13380
  }));
13107
13381
  }, Ug = (n) => {
13108
- n.addKeymap(() => ({ Backspace: lu, "Alt-Shift-Escape": sl, "Mod-BracketLeft": Zn }), n.Priority.Lowest).addKeymap(() => af, n.Priority.Lowest);
13382
+ n.addKeymap(
13383
+ () => ({
13384
+ Backspace: lu,
13385
+ "Alt-Shift-Escape": sl,
13386
+ "Mod-BracketLeft": Zn
13387
+ }),
13388
+ n.Priority.Lowest
13389
+ ).addKeymap(() => af, n.Priority.Lowest);
13109
13390
  }, Gg = (n) => {
13110
13391
  n.addInputRules(() => ({ rules: [au] }));
13111
13392
  };
@@ -13118,7 +13399,7 @@ export {
13118
13399
  Bg as E,
13119
13400
  Ig as F,
13120
13401
  ha as G,
13121
- _g as H,
13402
+ Hg as H,
13122
13403
  og as I,
13123
13404
  lg as J,
13124
13405
  Jg as K,
@@ -13131,7 +13412,7 @@ export {
13131
13412
  Lm as R,
13132
13413
  Vg as S,
13133
13414
  Fg as T,
13134
- Hg as U,
13415
+ _g as U,
13135
13416
  yg as V,
13136
13417
  kg as W,
13137
13418
  Eg as X,
@@ -13143,8 +13424,8 @@ export {
13143
13424
  tp as a0,
13144
13425
  eg as a1,
13145
13426
  ig as a2,
13146
- Br as a3,
13147
- Pr as a4,
13427
+ Pr as a3,
13428
+ ls as a4,
13148
13429
  Tg as a5,
13149
13430
  Cg as a6,
13150
13431
  Sh as a7,
@@ -13154,25 +13435,25 @@ export {
13154
13435
  On as aB,
13155
13436
  Te as aC,
13156
13437
  na as aD,
13157
- Ho as aE,
13438
+ Ko as aE,
13158
13439
  Xl as aF,
13159
13440
  ra as aG,
13160
13441
  ia as aH,
13161
13442
  oa as aI,
13162
- rs as aJ,
13443
+ ns as aJ,
13163
13444
  hh as aK,
13164
13445
  mh as aL,
13165
13446
  ph as aM,
13166
- He as aN,
13447
+ _e as aN,
13167
13448
  bh as aO,
13168
13449
  ng as aP,
13169
13450
  kh as aQ,
13170
13451
  _o as aR,
13171
13452
  Rm as aS,
13172
- Uo as aT,
13453
+ jo as aT,
13173
13454
  wg as aU,
13174
- Xo as aV,
13175
- Zo as aW,
13455
+ Yo as aV,
13456
+ Qo as aW,
13176
13457
  Nt as aX,
13177
13458
  rp as aY,
13178
13459
  gu as aZ,
@@ -13189,13 +13470,13 @@ export {
13189
13470
  Bm as aj,
13190
13471
  Fh as ak,
13191
13472
  $m as al,
13192
- Di as am,
13473
+ Ni as am,
13193
13474
  Tu as an,
13194
13475
  Ar as ao,
13195
13476
  Og as ap,
13196
13477
  Ng as aq,
13197
13478
  Mg as ar,
13198
- oi as as,
13479
+ ii as as,
13199
13480
  Cn as at,
13200
13481
  sn as au,
13201
13482
  Mn as av,
@@ -13209,7 +13490,7 @@ export {
13209
13490
  Eh as b1,
13210
13491
  fu as b2,
13211
13492
  cu as b3,
13212
- ii as b4,
13493
+ ri as b4,
13213
13494
  mu as b5,
13214
13495
  pu as b6,
13215
13496
  Ou as b7,
@@ -13227,7 +13508,7 @@ export {
13227
13508
  Ph as bJ,
13228
13509
  Bh as bK,
13229
13510
  St as bL,
13230
- qo as bM,
13511
+ Ho as bM,
13231
13512
  Km as bN,
13232
13513
  qm as bO,
13233
13514
  vr as bP,
@@ -13235,7 +13516,7 @@ export {
13235
13516
  sg as bR,
13236
13517
  cg as bS,
13237
13518
  Fm as bT,
13238
- Yo as bU,
13519
+ Go as bU,
13239
13520
  gg as bV,
13240
13521
  bg as bW,
13241
13522
  xg as bX,
@@ -13245,7 +13526,7 @@ export {
13245
13526
  Du as ba,
13246
13527
  xu as bb,
13247
13528
  Su as bc,
13248
- is as bd,
13529
+ rs as bd,
13249
13530
  Xc as be,
13250
13531
  Zh as bf,
13251
13532
  yu as bg,
@@ -13279,17 +13560,13 @@ export {
13279
13560
  wm as c7,
13280
13561
  Sm as c8,
13281
13562
  ap as c9,
13282
- w as cA,
13283
- D as cB,
13284
- I as cC,
13285
- tn as cD,
13286
- Y as cE,
13287
- ee as cF,
13288
- dl as cG,
13289
- It as cH,
13290
- pe as cI,
13291
- er as cJ,
13292
- tu as cK,
13563
+ k as cA,
13564
+ ee as cB,
13565
+ dl as cC,
13566
+ It as cD,
13567
+ pe as cE,
13568
+ er as cF,
13569
+ tu as cG,
13293
13570
  Ep as ca,
13294
13571
  Tp as cb,
13295
13572
  Np as cc,
@@ -13301,21 +13578,21 @@ export {
13301
13578
  Mp as ci,
13302
13579
  Ap as cj,
13303
13580
  vp as ck,
13304
- zt as cl,
13305
- T as cm,
13306
- fl as cn,
13307
- Wc as co,
13308
- k as cp,
13309
- b as cq,
13310
- x as cr,
13311
- Em as cs,
13312
- E as ct,
13313
- Im as cu,
13314
- su as cv,
13315
- df as cw,
13316
- qe as cx,
13317
- Pn as cy,
13318
- P as cz,
13581
+ Em as cl,
13582
+ E as cm,
13583
+ Im as cn,
13584
+ su as co,
13585
+ df as cp,
13586
+ qe as cq,
13587
+ Pn as cr,
13588
+ zt as cs,
13589
+ P as ct,
13590
+ w as cu,
13591
+ D as cv,
13592
+ I as cw,
13593
+ tn as cx,
13594
+ Y as cy,
13595
+ x as cz,
13319
13596
  Mm as d,
13320
13597
  Wg as e,
13321
13598
  Kg as f,
@@ -13323,16 +13600,16 @@ export {
13323
13600
  jg as h,
13324
13601
  Wm as i,
13325
13602
  qh as j,
13326
- Hm as k,
13327
- _h as l,
13603
+ _m as k,
13604
+ Hh as l,
13328
13605
  Uh as m,
13329
- _m as n,
13606
+ Hm as n,
13330
13607
  Rg as o,
13331
13608
  Jm as p,
13332
13609
  Ym as q,
13333
13610
  Pg as r,
13334
13611
  ln as s,
13335
- Hn as t,
13612
+ _n as t,
13336
13613
  Lg as u,
13337
13614
  bp as v,
13338
13615
  tg as w,