@milkdown/preset-gfm 6.5.0 → 6.5.3

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 (94) hide show
  1. package/lib/footnote/definition.d.ts +1 -1
  2. package/lib/footnote/definition.d.ts.map +1 -1
  3. package/lib/footnote/index.d.ts.map +1 -1
  4. package/lib/footnote/reference.d.ts +1 -1
  5. package/lib/footnote/reference.d.ts.map +1 -1
  6. package/lib/footnote/utils.d.ts.map +1 -1
  7. package/lib/index.d.ts +1 -1
  8. package/lib/index.d.ts.map +1 -1
  9. package/lib/index.es.js +1007 -863
  10. package/lib/index.es.js.map +1 -1
  11. package/lib/strike-through.d.ts +1 -1
  12. package/lib/strike-through.d.ts.map +1 -1
  13. package/lib/supported-keys.d.ts +1 -1
  14. package/lib/supported-keys.d.ts.map +1 -1
  15. package/lib/table/command.d.ts +2 -2
  16. package/lib/table/command.d.ts.map +1 -1
  17. package/lib/table/index.d.ts +1 -1
  18. package/lib/table/index.d.ts.map +1 -1
  19. package/lib/table/nodes/index.d.ts +1 -1
  20. package/lib/table/nodes/index.d.ts.map +1 -1
  21. package/lib/table/operator-plugin/actions.d.ts +5 -5
  22. package/lib/table/operator-plugin/actions.d.ts.map +1 -1
  23. package/lib/table/operator-plugin/calc-pos.d.ts +1 -1
  24. package/lib/table/operator-plugin/calc-pos.d.ts.map +1 -1
  25. package/lib/table/operator-plugin/constant.d.ts.map +1 -1
  26. package/lib/table/operator-plugin/helper.d.ts +3 -3
  27. package/lib/table/operator-plugin/helper.d.ts.map +1 -1
  28. package/lib/table/operator-plugin/index.d.ts +2 -2
  29. package/lib/table/operator-plugin/index.d.ts.map +1 -1
  30. package/lib/table/operator-plugin/style.d.ts +1 -1
  31. package/lib/table/operator-plugin/style.d.ts.map +1 -1
  32. package/lib/table/operator-plugin/widget.d.ts +2 -2
  33. package/lib/table/operator-plugin/widget.d.ts.map +1 -1
  34. package/lib/table/plugin/auto-insert-zero-space.d.ts.map +1 -1
  35. package/lib/table/plugin/cell-selection.d.ts +5 -3
  36. package/lib/table/plugin/cell-selection.d.ts.map +1 -1
  37. package/lib/table/plugin/column-resizing.d.ts +2 -1
  38. package/lib/table/plugin/column-resizing.d.ts.map +1 -1
  39. package/lib/table/plugin/commands.d.ts +2 -2
  40. package/lib/table/plugin/commands.d.ts.map +1 -1
  41. package/lib/table/plugin/copy-paste.d.ts +6 -5
  42. package/lib/table/plugin/copy-paste.d.ts.map +1 -1
  43. package/lib/table/plugin/fix-tables.d.ts +3 -2
  44. package/lib/table/plugin/fix-tables.d.ts.map +1 -1
  45. package/lib/table/plugin/index.d.ts.map +1 -1
  46. package/lib/table/plugin/schema.d.ts +1 -1
  47. package/lib/table/plugin/schema.d.ts.map +1 -1
  48. package/lib/table/plugin/table-editing.d.ts +1 -1
  49. package/lib/table/plugin/table-editing.d.ts.map +1 -1
  50. package/lib/table/plugin/table-map.d.ts +2 -2
  51. package/lib/table/plugin/table-map.d.ts.map +1 -1
  52. package/lib/table/plugin/table-view.d.ts +2 -2
  53. package/lib/table/plugin/table-view.d.ts.map +1 -1
  54. package/lib/table/plugin/types.d.ts +2 -2
  55. package/lib/table/plugin/types.d.ts.map +1 -1
  56. package/lib/table/plugin/util.d.ts +2 -2
  57. package/lib/table/plugin/util.d.ts.map +1 -1
  58. package/lib/table/utils.d.ts +5 -5
  59. package/lib/table/utils.d.ts.map +1 -1
  60. package/lib/task-list-item.d.ts +2 -2
  61. package/lib/task-list-item.d.ts.map +1 -1
  62. package/package.json +17 -17
  63. package/src/footnote/definition.ts +172 -166
  64. package/src/footnote/index.ts +2 -2
  65. package/src/footnote/reference.ts +166 -162
  66. package/src/footnote/utils.ts +2 -2
  67. package/src/index.ts +83 -83
  68. package/src/strike-through.ts +36 -36
  69. package/src/supported-keys.ts +9 -8
  70. package/src/table/command.ts +17 -16
  71. package/src/table/index.ts +9 -9
  72. package/src/table/nodes/index.ts +177 -174
  73. package/src/table/operator-plugin/actions.ts +103 -102
  74. package/src/table/operator-plugin/calc-pos.ts +31 -24
  75. package/src/table/operator-plugin/constant.ts +3 -3
  76. package/src/table/operator-plugin/helper.ts +31 -32
  77. package/src/table/operator-plugin/index.ts +104 -95
  78. package/src/table/operator-plugin/style.ts +10 -9
  79. package/src/table/operator-plugin/widget.ts +47 -45
  80. package/src/table/plugin/auto-insert-zero-space.ts +41 -41
  81. package/src/table/plugin/cell-selection.ts +325 -296
  82. package/src/table/plugin/column-resizing.ts +226 -198
  83. package/src/table/plugin/commands.ts +464 -421
  84. package/src/table/plugin/copy-paste.ts +256 -240
  85. package/src/table/plugin/fix-tables.ts +103 -88
  86. package/src/table/plugin/index.ts +3 -3
  87. package/src/table/plugin/schema.ts +100 -94
  88. package/src/table/plugin/table-editing.ts +324 -230
  89. package/src/table/plugin/table-map.ts +294 -229
  90. package/src/table/plugin/table-view.ts +66 -62
  91. package/src/table/plugin/types.ts +8 -8
  92. package/src/table/plugin/util.ts +78 -66
  93. package/src/table/utils.ts +141 -138
  94. package/src/task-list-item.ts +151 -146
package/lib/index.es.js CHANGED
@@ -1,19 +1,22 @@
1
- import { SupportedKeys as lt, commonmark as st, commands as rt } from "@milkdown/preset-commonmark";
2
- import { InsertHardbreak as io, InsertHr as co, InsertImage as ao, LiftListItem as fo, ModifyImage as uo, ModifyLink as po, SinkListItem as ho, SplitListItem as mo, ToggleBold as go, ToggleInlineCode as wo, ToggleItalic as bo, ToggleLink as Co, TurnIntoCodeFence as yo, TurnIntoHeading as ko, TurnIntoText as Ao, WrapInBlockquote as Mo, WrapInBulletList as No, WrapInOrderedList as So, blockquote as xo, bulletList as Ro, codeFence as To, codeInline as Lo, commonmark as vo, commonmarkNodes as Eo, commonmarkPlugins as Io, doc as $o, em as Do, HardbreakFilterPluginKey as Oo, heading as _o, hr as zo, image as Fo, link as Bo, listItem as Po, orderedList as Wo, paragraph as Ho, strong as jo, text as Ko } from "@milkdown/preset-commonmark";
3
- import { createNode as ye, createPlugin as it, createShortcut as D, createMark as ct, AtomList as at, $remark as dt } from "@milkdown/utils";
4
- import ft from "remark-gfm";
5
- import { createCmdKey as R, editorViewCtx as te, createCmd as S, commandsCtx as Ue, themeManagerCtx as L, ThemeIcon as v, getPalette as ut, ThemeSize as Re, ThemeBorder as pt, ThemeShadow as ht, schemaCtx as V } from "@milkdown/core";
6
- import { expectDomTypeError as ke, missingRootElement as mt } from "@milkdown/exception";
7
- import { findSelectedNodeOfType as B, findParentNode as gt, cloneTr as Ve, calculateNodePosition as wt, browser as Te } from "@milkdown/prose";
8
- import { wrappingInputRule as Ge, InputRule as fe } from "@milkdown/prose/inputrules";
9
- import { PluginKey as F, NodeSelection as ne, Plugin as W, Selection as N, SelectionRange as bt, TextSelection as E } from "@milkdown/prose/state";
10
- import { toggleMark as Ct, wrapIn as yt } from "@milkdown/prose/commands";
11
- import { Fragment as I, Slice as O } from "@milkdown/prose/model";
12
- import { Decoration as Ae, DecorationSet as Me } from "@milkdown/prose/view";
13
- import { keydownHandler as kt } from "@milkdown/prose/keymap";
14
- import { Transform as At } from "@milkdown/prose/transform";
15
- import { splitListItem as Mt, sinkListItem as Nt, liftListItem as St } from "@milkdown/prose/schema-list";
16
- const Je = (o) => `footnote-ref-${o}`, Ye = (o) => `footnote-def-${o}`, xt = new F("MILKDOWN_FOOTNOTE_DEF_INPUT"), Le = R("ModifyFootnoteDef"), Rt = ye((o) => {
1
+ var lt = Object.defineProperty;
2
+ var rt = (o, e, t) => e in o ? lt(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
3
+ var I = (o, e, t) => (rt(o, typeof e != "symbol" ? e + "" : e, t), t);
4
+ import { SupportedKeys as it, commonmark as ct, commands as at } from "@milkdown/preset-commonmark";
5
+ import { InsertHardbreak as uo, InsertHr as po, InsertImage as ho, LiftListItem as mo, ModifyImage as go, ModifyLink as wo, SinkListItem as bo, SplitListItem as Co, ToggleBold as yo, ToggleInlineCode as ko, ToggleItalic as Ao, ToggleLink as Mo, TurnIntoCodeFence as So, TurnIntoHeading as No, TurnIntoText as xo, WrapInBlockquote as Ro, WrapInBulletList as To, WrapInOrderedList as Lo, blockquote as vo, bulletList as Eo, codeFence as $o, codeInline as Io, commonmark as Do, commonmarkNodes as Oo, commonmarkPlugins as _o, doc as zo, em as Fo, HardbreakFilterPluginKey as Bo, heading as Wo, hr as Po, image as Ho, link as jo, listItem as Ko, orderedList as qo, paragraph as Xo, strong as Uo, text as Vo } from "@milkdown/preset-commonmark";
6
+ import { createNode as ke, createPlugin as dt, createShortcut as O, createMark as ft, AtomList as ut, $remark as pt } from "@milkdown/utils";
7
+ import ht from "remark-gfm";
8
+ import { createCmdKey as R, editorViewCtx as U, createCmd as N, commandsCtx as Ve, themeManagerCtx as L, ThemeIcon as v, getPalette as mt, ThemeSize as Te, ThemeBorder as gt, ThemeShadow as wt, schemaCtx as J } from "@milkdown/core";
9
+ import { expectDomTypeError as Ae, missingRootElement as bt } from "@milkdown/exception";
10
+ import { findSelectedNodeOfType as W, findParentNode as Ct, cloneTr as Ge, calculateNodePosition as yt, browser as Le } from "@milkdown/prose";
11
+ import { wrappingInputRule as Je, InputRule as ue } from "@milkdown/prose/inputrules";
12
+ import { PluginKey as B, NodeSelection as oe, Plugin as H, Selection as S, SelectionRange as kt, TextSelection as E } from "@milkdown/prose/state";
13
+ import { toggleMark as At, wrapIn as Mt } from "@milkdown/prose/commands";
14
+ import { Fragment as $, Slice as _ } from "@milkdown/prose/model";
15
+ import { Decoration as Me, DecorationSet as Se } from "@milkdown/prose/view";
16
+ import { keydownHandler as St } from "@milkdown/prose/keymap";
17
+ import { Transform as Nt } from "@milkdown/prose/transform";
18
+ import { splitListItem as xt, sinkListItem as Rt, liftListItem as Tt } from "@milkdown/prose/schema-list";
19
+ const Ye = (o) => `footnote-ref-${o}`, Ze = (o) => `footnote-def-${o}`, Lt = new B("MILKDOWN_FOOTNOTE_DEF_INPUT"), ve = R("ModifyFootnoteDef"), vt = ke((o) => {
17
20
  const e = "footnote_definition", t = "footnoteDefinition";
18
21
  return {
19
22
  id: e,
@@ -29,95 +32,100 @@ const Je = (o) => `footnote-ref-${o}`, Ye = (o) => `footnote-def-${o}`, xt = new
29
32
  parseDOM: [
30
33
  {
31
34
  tag: `div[data-type="${e}"]`,
32
- getAttrs: (l) => {
33
- if (!(l instanceof HTMLElement))
34
- throw ke(l);
35
+ getAttrs: (s) => {
36
+ if (!(s instanceof HTMLElement))
37
+ throw Ae(s);
35
38
  return {
36
- label: l.dataset.label
39
+ label: s.dataset.label
37
40
  };
38
41
  },
39
42
  contentElement: "dd"
40
43
  }
41
44
  ],
42
- toDOM: (l) => {
43
- const s = l.attrs.label, r = o.getClassName(l.attrs, "footnote-definition"), a = document.createElement("dt");
44
- a.textContent = `[${s}]:`, a.onclick = () => {
45
- const c = n.get(te), d = ne.create(c.state.doc, c.state.selection.from - 2);
45
+ toDOM: (s) => {
46
+ const l = s.attrs.label, r = o.getClassName(s.attrs, "footnote-definition"), a = document.createElement("dt");
47
+ a.textContent = `[${l}]:`, a.onclick = () => {
48
+ const c = n.get(U), d = oe.create(c.state.doc, c.state.selection.from - 2);
46
49
  c.dispatch(c.state.tr.setSelection(d));
47
50
  };
48
51
  const i = document.createElement("a");
49
- return i.href = `#${Je(s)}`, i.contentEditable = "false", i.textContent = "\u21A9", i.onmousedown = (c) => {
52
+ return i.href = `#${Ye(l)}`, i.contentEditable = "false", i.textContent = "\u21A9", i.onmousedown = (c) => {
50
53
  c.preventDefault();
51
54
  }, [
52
55
  "div",
53
56
  {
54
57
  class: r,
55
- "data-label": s,
58
+ "data-label": l,
56
59
  "data-type": e,
57
- id: Ye(s)
60
+ id: Ze(l)
58
61
  },
59
62
  ["div", { class: "footnote-definition_content" }, a, ["dd", 0]],
60
63
  ["div", { class: "footnote-definition_anchor" }, i]
61
64
  ];
62
65
  },
63
66
  parseMarkdown: {
64
- match: ({ type: l }) => l === t,
65
- runner: (l, s, r) => {
66
- l.openNode(r, {
67
- label: s.label
68
- }).next(s.children).closeNode();
67
+ match: ({ type: s }) => s === t,
68
+ runner: (s, l, r) => {
69
+ s.openNode(r, {
70
+ label: l.label
71
+ }).next(l.children).closeNode();
69
72
  }
70
73
  },
71
74
  toMarkdown: {
72
- match: (l) => l.type.name === e,
73
- runner: (l, s) => {
74
- l.openNode(t, void 0, {
75
- label: s.attrs.label,
76
- identifier: s.attrs.label
77
- }).next(s.content).closeNode();
75
+ match: (s) => s.type.name === e,
76
+ runner: (s, l) => {
77
+ s.openNode(t, void 0, {
78
+ label: l.attrs.label,
79
+ identifier: l.attrs.label
80
+ }).next(l.content).closeNode();
78
81
  }
79
82
  }
80
83
  }),
81
84
  commands: (n) => [
82
- S(Le, (l = "") => (s, r) => {
83
- const a = B(s.selection, n);
85
+ N(ve, (s = "") => (l, r) => {
86
+ const a = W(l.selection, n);
84
87
  if (!a)
85
88
  return !1;
86
- const { tr: i } = s, c = i.setNodeMarkup(a.pos, void 0, { ...a.node.attrs, label: l });
87
- return r == null || r(c.setSelection(ne.create(c.doc, a.pos))), !0;
89
+ const { tr: i } = l, c = i.setNodeMarkup(a.pos, void 0, { ...a.node.attrs, label: s });
90
+ return r == null || r(c.setSelection(oe.create(c.doc, a.pos))), !0;
88
91
  })
89
92
  ],
90
93
  inputRules: (n) => [
91
- Ge(/(?:\[\^)([^:]+)(?::)$/, n, (l) => {
92
- var r;
93
- return {
94
- label: (r = l[1]) != null ? r : "footnote"
95
- };
96
- }, () => !1)
94
+ Je(
95
+ /(?:\[\^)([^:]+)(?::)$/,
96
+ n,
97
+ (s) => {
98
+ var r;
99
+ return {
100
+ label: (r = s[1]) != null ? r : "footnote"
101
+ };
102
+ },
103
+ () => !1
104
+ )
97
105
  ],
98
- prosePlugins: (n, l) => [
99
- new W({
100
- key: xt,
101
- view: (s) => {
106
+ prosePlugins: (n, s) => [
107
+ new H({
108
+ key: Lt,
109
+ view: (l) => {
102
110
  const r = o.themeManager.get("input-chip", {
103
111
  width: "12em",
104
112
  placeholder: "Input Footnote Label",
105
113
  onUpdate: (d) => {
106
- l.get(Ue).call(Le, d);
114
+ s.get(Ve).call(ve, d);
107
115
  },
108
116
  isBindMode: !0
109
117
  });
110
118
  if (!r)
111
119
  return {};
112
- const a = (d) => Boolean(n && B(d.state.selection, n)), i = (d) => {
113
- const f = B(d.state.selection, n);
120
+ const a = (d) => Boolean(n && W(d.state.selection, n)), i = (d) => {
121
+ const f = W(d.state.selection, n);
114
122
  return f ? f.node.attrs.label : void 0;
115
123
  }, c = (d) => {
116
124
  if (!d.editable)
117
125
  return;
118
126
  a(d) ? (r.show(d), r.update(i(d))) : r.hide();
119
127
  };
120
- return r.init(s), c(s), {
128
+ return r.init(l), c(l), {
121
129
  update: (d, f) => {
122
130
  (f == null ? void 0 : f.doc.eq(d.state.doc)) && f.selection.eq(d.state.selection) || c(d);
123
131
  },
@@ -129,7 +137,7 @@ const Je = (o) => `footnote-ref-${o}`, Ye = (o) => `footnote-def-${o}`, xt = new
129
137
  })
130
138
  ]
131
139
  };
132
- }), ve = R("ModifyFootnoteRef"), Tt = new F("MILKDOWN_FOOTNOTE_REF_INPUT"), Lt = ye((o) => {
140
+ }), Ee = R("ModifyFootnoteRef"), Et = new B("MILKDOWN_FOOTNOTE_REF_INPUT"), $t = ke((o) => {
133
141
  const e = "footnote_reference";
134
142
  return {
135
143
  id: e,
@@ -147,7 +155,7 @@ const Je = (o) => `footnote-ref-${o}`, Ye = (o) => `footnote-def-${o}`, xt = new
147
155
  tag: `sup[data-type="${e}"]`,
148
156
  getAttrs: (n) => {
149
157
  if (!(n instanceof HTMLElement))
150
- throw ke(n);
158
+ throw Ae(n);
151
159
  return {
152
160
  label: n.dataset.label
153
161
  };
@@ -155,254 +163,276 @@ const Je = (o) => `footnote-ref-${o}`, Ye = (o) => `footnote-def-${o}`, xt = new
155
163
  }
156
164
  ],
157
165
  toDOM: (n) => {
158
- const l = n.attrs.label, s = document.createElement("a"), r = `#${Ye(l)}`;
159
- return s.href = r, s.textContent = `[${l}]`, s.onclick = (a) => {
160
- t.get(te).editable && a.preventDefault();
161
- }, s.ondblclick = () => {
162
- t.get(te).editable && (window.location.href = r);
166
+ const s = n.attrs.label, l = document.createElement("a"), r = `#${Ze(s)}`;
167
+ return l.href = r, l.textContent = `[${s}]`, l.onclick = (a) => {
168
+ t.get(U).editable && a.preventDefault();
169
+ }, l.ondblclick = () => {
170
+ t.get(U).editable && (window.location.href = r);
163
171
  }, [
164
172
  "sup",
165
173
  {
166
- "data-label": l,
174
+ "data-label": s,
167
175
  "data-type": e,
168
- id: Je(l)
176
+ id: Ye(s)
169
177
  },
170
- s
178
+ l
171
179
  ];
172
180
  },
173
181
  parseMarkdown: {
174
182
  match: ({ type: n }) => n === "footnoteReference",
175
- runner: (n, l, s) => {
176
- n.addNode(s, {
177
- label: l.label
183
+ runner: (n, s, l) => {
184
+ n.addNode(l, {
185
+ label: s.label
178
186
  });
179
187
  }
180
188
  },
181
189
  toMarkdown: {
182
190
  match: (n) => n.type.name === e,
183
- runner: (n, l) => {
191
+ runner: (n, s) => {
184
192
  n.addNode("footnoteReference", void 0, void 0, {
185
- label: l.attrs.label,
186
- identifier: l.attrs.label
193
+ label: s.attrs.label,
194
+ identifier: s.attrs.label
187
195
  });
188
196
  }
189
197
  }
190
198
  }),
191
199
  commands: (t) => [
192
- S(ve, (n = "") => (l, s) => {
193
- const r = B(l.selection, t);
200
+ N(Ee, (n = "") => (s, l) => {
201
+ const r = W(s.selection, t);
194
202
  if (!r)
195
203
  return !1;
196
- const { tr: a } = l, i = a.setNodeMarkup(r.pos, void 0, { ...r.node.attrs, label: n });
197
- return s == null || s(i.setSelection(ne.create(i.doc, r.pos))), !0;
204
+ const { tr: a } = s, i = a.setNodeMarkup(r.pos, void 0, { ...r.node.attrs, label: n });
205
+ return l == null || l(i.setSelection(oe.create(i.doc, r.pos))), !0;
198
206
  })
199
207
  ],
200
208
  inputRules: (t) => [
201
- new fe(/(?:\[\^)([^\]]+)(?:\])$/, (n, l, s, r) => {
202
- const a = n.doc.resolve(s), i = a.index(), c = n.doc.resolve(r);
209
+ new ue(/(?:\[\^)([^\]]+)(?:\])$/, (n, s, l, r) => {
210
+ const a = n.doc.resolve(l), i = a.index(), c = n.doc.resolve(r);
203
211
  if (!a.parent.canReplaceWith(i, c.index(), t))
204
212
  return null;
205
- const d = l[1];
206
- return n.tr.replaceRangeWith(s, r, t.create({
207
- label: d
208
- }));
213
+ const d = s[1];
214
+ return n.tr.replaceRangeWith(
215
+ l,
216
+ r,
217
+ t.create({
218
+ label: d
219
+ })
220
+ );
209
221
  })
210
222
  ],
211
223
  prosePlugins: (t, n) => {
212
- const l = o.themeManager.get("input-chip", {
224
+ const s = o.themeManager.get("input-chip", {
213
225
  width: "12em",
214
226
  placeholder: "Input Footnote Label",
215
227
  onUpdate: (i) => {
216
- n.get(Ue).call(ve, i);
228
+ n.get(Ve).call(Ee, i);
217
229
  },
218
230
  isBindMode: !0
219
231
  });
220
- if (!l)
232
+ if (!s)
221
233
  return [];
222
- const s = (i) => Boolean(t && B(i.state.selection, t)), r = (i) => {
223
- const c = B(i.state.selection, t);
234
+ const l = (i) => Boolean(t && W(i.state.selection, t)), r = (i) => {
235
+ const c = W(i.state.selection, t);
224
236
  return c ? c.node.attrs.label : void 0;
225
237
  }, a = (i) => {
226
238
  if (!i.editable)
227
239
  return;
228
- s(i) ? (l.show(i), l.update(r(i))) : l.hide();
240
+ l(i) ? (s.show(i), s.update(r(i))) : s.hide();
229
241
  };
230
242
  return [
231
- new W({
232
- key: Tt,
233
- view: (i) => (l.init(i), a(i), {
243
+ new H({
244
+ key: Et,
245
+ view: (i) => (s.init(i), a(i), {
234
246
  update: (c, d) => {
235
247
  (d == null ? void 0 : d.doc.eq(c.state.doc)) && d.selection.eq(c.state.selection) || a(c);
236
248
  },
237
249
  destroy: () => {
238
- l.destroy();
250
+ s.destroy();
239
251
  }
240
252
  })
241
253
  })
242
254
  ];
243
255
  }
244
256
  };
245
- }), Ze = /* @__PURE__ */ new WeakMap(), vt = (o) => Ze.get(o), Et = (o, e) => (Ze.set(o, e), e);
246
- class Ee {
247
- constructor(e, t, n, l) {
248
- this.left = e, this.top = t, this.right = n, this.bottom = l;
257
+ }), Qe = /* @__PURE__ */ new WeakMap(), It = (o) => Qe.get(o), Dt = (o, e) => (Qe.set(o, e), e);
258
+ class $e {
259
+ constructor(e, t, n, s) {
260
+ I(this, "tableStart");
261
+ I(this, "map");
262
+ I(this, "table");
263
+ this.left = e, this.top = t, this.right = n, this.bottom = s;
249
264
  }
250
265
  }
251
266
  class g {
252
- constructor(e, t, n, l) {
253
- this.width = e, this.height = t, this.map = n, this.problems = l, this.width = e, this.height = t, this.map = n, this.problems = l;
267
+ constructor(e, t, n, s) {
268
+ this.width = e, this.height = t, this.map = n, this.problems = s, this.width = e, this.height = t, this.map = n, this.problems = s;
254
269
  }
255
270
  findCell(e) {
256
271
  for (let t = 0; t < this.map.length; t++) {
257
272
  const n = this.map[t];
258
273
  if (n != e)
259
274
  continue;
260
- const l = t % this.width, s = t / this.width | 0;
261
- let r = l + 1, a = s + 1;
275
+ const s = t % this.width, l = t / this.width | 0;
276
+ let r = s + 1, a = l + 1;
262
277
  for (let i = 1; r < this.width && this.map[t + i] == n; i++)
263
278
  r++;
264
279
  for (let i = 1; a < this.height && this.map[t + this.width * i] == n; i++)
265
280
  a++;
266
- return new Ee(l, s, r, a);
281
+ return new $e(s, l, r, a);
267
282
  }
268
- throw new RangeError("No cell with offset " + e + " found");
283
+ throw new RangeError(`No cell with offset ${e} found`);
269
284
  }
270
285
  colCount(e) {
271
286
  for (let t = 0; t < this.map.length; t++)
272
287
  if (this.map[t] == e)
273
288
  return t % this.width;
274
- throw new RangeError("No cell with offset " + e + " found");
289
+ throw new RangeError(`No cell with offset ${e} found`);
275
290
  }
276
291
  nextCell(e, t, n) {
277
- const { left: l, right: s, top: r, bottom: a } = this.findCell(e);
278
- return t == "horiz" ? (n < 0 ? l == 0 : s == this.width) ? void 0 : this.map[r * this.width + (n < 0 ? l - 1 : s)] : (n < 0 ? r == 0 : a == this.height) ? void 0 : this.map[l + this.width * (n < 0 ? r - 1 : a)];
292
+ const { left: s, right: l, top: r, bottom: a } = this.findCell(e);
293
+ return t == "horiz" ? (n < 0 ? s == 0 : l == this.width) ? void 0 : this.map[r * this.width + (n < 0 ? s - 1 : l)] : (n < 0 ? r == 0 : a == this.height) ? void 0 : this.map[s + this.width * (n < 0 ? r - 1 : a)];
279
294
  }
280
295
  rectBetween(e, t) {
281
- const { left: n, right: l, top: s, bottom: r } = this.findCell(e), { left: a, right: i, top: c, bottom: d } = this.findCell(t);
282
- return new Ee(Math.min(n, a), Math.min(s, c), Math.max(l, i), Math.max(r, d));
296
+ const {
297
+ left: n,
298
+ right: s,
299
+ top: l,
300
+ bottom: r
301
+ } = this.findCell(e), {
302
+ left: a,
303
+ right: i,
304
+ top: c,
305
+ bottom: d
306
+ } = this.findCell(t);
307
+ return new $e(
308
+ Math.min(n, a),
309
+ Math.min(l, c),
310
+ Math.max(s, i),
311
+ Math.max(r, d)
312
+ );
283
313
  }
284
314
  cellsInRect(e) {
285
315
  const t = [], n = {};
286
- for (let l = e.top; l < e.bottom; l++)
287
- for (let s = e.left; s < e.right; s++) {
288
- const r = l * this.width + s, a = this.map[r];
289
- n[a] || (n[a] = !0, (s != e.left || !s || this.map[r - 1] != a) && (l != e.top || !l || this.map[r - this.width] != a) && t.push(a));
316
+ for (let s = e.top; s < e.bottom; s++)
317
+ for (let l = e.left; l < e.right; l++) {
318
+ const r = s * this.width + l, a = this.map[r];
319
+ n[a] || (n[a] = !0, (l != e.left || !l || this.map[r - 1] != a) && (s != e.top || !s || this.map[r - this.width] != a) && t.push(a));
290
320
  }
291
321
  return t;
292
322
  }
293
323
  positionAt(e, t, n) {
294
- for (let l = 0, s = 0; ; l++) {
295
- const r = s + n.child(l).nodeSize;
296
- if (l == e) {
324
+ for (let s = 0, l = 0; ; s++) {
325
+ const r = l + n.child(s).nodeSize;
326
+ if (s == e) {
297
327
  let a = t + e * this.width;
298
328
  const i = (e + 1) * this.width;
299
- for (; a < i && this.map[a] < s; )
329
+ for (; a < i && this.map[a] < l; )
300
330
  a++;
301
331
  return a == i ? r - 1 : this.map[a];
302
332
  }
303
- s = r;
333
+ l = r;
304
334
  }
305
335
  }
306
336
  static get(e) {
307
- return vt(e) || Et(e, It(e));
337
+ return It(e) || Dt(e, Ot(e));
308
338
  }
309
339
  }
310
- function It(o) {
340
+ function Ot(o) {
311
341
  if (o.type.spec.tableRole != "table")
312
- throw new RangeError("Not a table node: " + o.type.name);
313
- const e = $t(o), t = o.childCount, n = [], l = [];
314
- let s = 0, r;
342
+ throw new RangeError(`Not a table node: ${o.type.name}`);
343
+ const e = _t(o), t = o.childCount, n = [], s = [];
344
+ let l = 0, r;
315
345
  for (let c = 0, d = e * t; c < d; c++)
316
346
  n[c] = 0;
317
347
  for (let c = 0, d = 0; c < t; c++) {
318
348
  const f = o.child(c);
319
349
  d++;
320
350
  for (let h = 0; ; h++) {
321
- for (; s < n.length && n[s] != 0; )
322
- s++;
351
+ for (; l < n.length && n[l] != 0; )
352
+ l++;
323
353
  if (h == f.childCount)
324
354
  break;
325
- const b = f.child(h), { colspan: w, rowspan: C, colwidth: xe } = b.attrs;
326
- for (let H = 0; H < C; H++) {
327
- if (H + c >= t) {
355
+ const b = f.child(h), { colspan: w, rowspan: C, colwidth: Re } = b.attrs;
356
+ for (let j = 0; j < C; j++) {
357
+ if (j + c >= t) {
328
358
  (r || (r = [])).push({
329
359
  type: "overlong_rowspan",
330
360
  pos: d,
331
- n: C - H
361
+ n: C - j
332
362
  });
333
363
  break;
334
364
  }
335
- const se = s + H * e;
336
- for (let _ = 0; _ < w; _++) {
337
- n[se + _] == 0 ? n[se + _] = d : (r || (r = [])).push({
365
+ const re = l + j * e;
366
+ for (let z = 0; z < w; z++) {
367
+ n[re + z] == 0 ? n[re + z] = d : (r || (r = [])).push({
338
368
  type: "collision",
339
369
  row: c,
340
370
  pos: d,
341
- n: w - _
371
+ n: w - z
342
372
  });
343
- const U = xe && xe[_];
344
- if (U) {
345
- const j = (se + _) % e * 2, re = l[j];
346
- re == null || re != U && l[j + 1] == 1 ? (l[j] = U, l[j + 1] = 1) : re == U && l[j + 1]++;
373
+ const G = Re && Re[z];
374
+ if (G) {
375
+ const K = (re + z) % e * 2, ie = s[K];
376
+ ie == null || ie != G && s[K + 1] == 1 ? (s[K] = G, s[K + 1] = 1) : ie == G && s[K + 1]++;
347
377
  }
348
378
  }
349
379
  }
350
- s += w, d += b.nodeSize;
380
+ l += w, d += b.nodeSize;
351
381
  }
352
382
  const u = (c + 1) * e;
353
383
  let p = 0;
354
- for (; s < u; )
355
- n[s++] == 0 && p++;
384
+ for (; l < u; )
385
+ n[l++] == 0 && p++;
356
386
  p && (r || (r = [])).push({ type: "missing", row: c, n: p }), d++;
357
387
  }
358
388
  const a = new g(e, t, n, r);
359
389
  let i = !1;
360
- for (let c = 0; !i && c < l.length; c += 2)
361
- l[c] != null && l[c + 1] < t && (i = !0);
362
- return i && Dt(a, l, o), a;
390
+ for (let c = 0; !i && c < s.length; c += 2)
391
+ s[c] != null && s[c + 1] < t && (i = !0);
392
+ return i && zt(a, s, o), a;
363
393
  }
364
- function $t(o) {
394
+ function _t(o) {
365
395
  let e = -1, t = !1;
366
396
  for (let n = 0; n < o.childCount; n++) {
367
- const l = o.child(n);
368
- let s = 0;
397
+ const s = o.child(n);
398
+ let l = 0;
369
399
  if (t)
370
400
  for (let r = 0; r < n; r++) {
371
401
  const a = o.child(r);
372
402
  for (let i = 0; i < a.childCount; i++) {
373
403
  const c = a.child(i);
374
- r + c.attrs.rowspan > n && (s += c.attrs.colspan);
404
+ r + c.attrs.rowspan > n && (l += c.attrs.colspan);
375
405
  }
376
406
  }
377
- for (let r = 0; r < l.childCount; r++) {
378
- const a = l.child(r);
379
- s += a.attrs.colspan, a.attrs.rowspan > 1 && (t = !0);
407
+ for (let r = 0; r < s.childCount; r++) {
408
+ const a = s.child(r);
409
+ l += a.attrs.colspan, a.attrs.rowspan > 1 && (t = !0);
380
410
  }
381
- e == -1 ? e = s : e != s && (e = Math.max(e, s));
411
+ e == -1 ? e = l : e != l && (e = Math.max(e, l));
382
412
  }
383
413
  return e;
384
414
  }
385
- function Dt(o, e, t) {
415
+ function zt(o, e, t) {
386
416
  o.problems || (o.problems = []);
387
- for (let n = 0, l = {}; n < o.map.length; n++) {
388
- const s = o.map[n];
389
- if (l[s])
417
+ for (let n = 0, s = {}; n < o.map.length; n++) {
418
+ const l = o.map[n];
419
+ if (s[l])
390
420
  continue;
391
- l[s] = !0;
392
- const r = t.nodeAt(s);
421
+ s[l] = !0;
422
+ const r = t.nodeAt(l);
393
423
  let a = null;
394
424
  for (let i = 0; i < r.attrs.colspan; i++) {
395
425
  const c = (n + i) % o.width, d = e[c * 2];
396
- d != null && (!r.attrs.colwidth || r.attrs.colwidth[i] != d) && ((a || (a = Ot(r.attrs)))[i] = d);
426
+ d != null && (!r.attrs.colwidth || r.attrs.colwidth[i] != d) && ((a || (a = Ft(r.attrs)))[i] = d);
397
427
  }
398
428
  a && o.problems.unshift({
399
429
  type: "colwidth mismatch",
400
- pos: s,
430
+ pos: l,
401
431
  colwidth: a
402
432
  });
403
433
  }
404
434
  }
405
- function Ot(o) {
435
+ function Ft(o) {
406
436
  if (o.colwidth)
407
437
  return o.colwidth.slice();
408
438
  const e = [];
@@ -410,127 +440,131 @@ function Ot(o) {
410
440
  e.push(0);
411
441
  return e;
412
442
  }
413
- class m extends N {
443
+ class m extends S {
414
444
  constructor(e, t = e) {
415
- const n = e.node(-1), l = g.get(n), s = e.start(-1), r = l.rectBetween(e.pos - s, t.pos - s), a = e.node(0), i = l.cellsInRect(r).filter((d) => d != t.pos - s);
416
- i.unshift(t.pos - s);
445
+ const n = e.node(-1), s = g.get(n), l = e.start(-1), r = s.rectBetween(e.pos - l, t.pos - l), a = e.node(0), i = s.cellsInRect(r).filter((d) => d != t.pos - l);
446
+ i.unshift(t.pos - l);
417
447
  const c = i.map((d) => {
418
- const f = n.nodeAt(d), u = d + s + 1;
419
- return new bt(a.resolve(u), a.resolve(u + f.content.size));
448
+ const f = n.nodeAt(d), u = d + l + 1;
449
+ return new kt(a.resolve(u), a.resolve(u + f.content.size));
420
450
  });
421
451
  super(c[0].$from, c[0].$to, c), this.$anchorCell = e, this.$headCell = t, this.$anchorCell = e, this.$headCell = t;
422
452
  }
423
453
  map(e, t) {
424
- const n = e.resolve(t.map(this.$anchorCell.pos)), l = e.resolve(t.map(this.$headCell.pos));
425
- if (ue(n) && ue(l) && Se(n, l)) {
426
- const s = this.$anchorCell.node(-1) != n.node(-1);
427
- return s && this.isRowSelection() ? m.rowSelection(n, l) : s && this.isColSelection() ? m.colSelection(n, l) : new m(n, l);
454
+ const n = e.resolve(t.map(this.$anchorCell.pos)), s = e.resolve(t.map(this.$headCell.pos));
455
+ if (pe(n) && pe(s) && xe(n, s)) {
456
+ const l = this.$anchorCell.node(-1) != n.node(-1);
457
+ return l && this.isRowSelection() ? m.rowSelection(n, s) : l && this.isColSelection() ? m.colSelection(n, s) : new m(n, s);
428
458
  }
429
- return E.between(n, l);
459
+ return E.between(n, s);
430
460
  }
431
461
  content() {
432
- const e = this.$anchorCell.node(-1), t = g.get(e), n = this.$anchorCell.start(-1), l = t.rectBetween(this.$anchorCell.pos - n, this.$headCell.pos - n), s = {}, r = [];
433
- for (let i = l.top; i < l.bottom; i++) {
462
+ const e = this.$anchorCell.node(-1), t = g.get(e), n = this.$anchorCell.start(-1), s = t.rectBetween(this.$anchorCell.pos - n, this.$headCell.pos - n), l = {}, r = [];
463
+ for (let i = s.top; i < s.bottom; i++) {
434
464
  const c = [];
435
- for (let d = i * t.width + l.left, f = l.left; f < l.right; f++, d++) {
465
+ for (let d = i * t.width + s.left, f = s.left; f < s.right; f++, d++) {
436
466
  const u = t.map[d];
437
- if (!s[u]) {
438
- s[u] = !0;
467
+ if (!l[u]) {
468
+ l[u] = !0;
439
469
  const p = t.findCell(u);
440
470
  let h = e.nodeAt(u);
441
- const b = l.left - p.left, w = p.right - l.right;
471
+ const b = s.left - p.left, w = p.right - s.right;
442
472
  if (b > 0 || w > 0) {
443
473
  let C = h.attrs;
444
- b > 0 && (C = z(C, 0, b)), w > 0 && (C = z(C, C.colspan - w, w)), p.left < l.left ? h = h.type.createAndFill(C) : h = h.type.create(C, h.content);
474
+ b > 0 && (C = F(C, 0, b)), w > 0 && (C = F(C, C.colspan - w, w)), p.left < s.left ? h = h.type.createAndFill(C) : h = h.type.create(C, h.content);
445
475
  }
446
- if (p.top < l.top || p.bottom > l.bottom) {
447
- const C = y(h.attrs, "rowspan", Math.min(p.bottom, l.bottom) - Math.max(p.top, l.top));
448
- p.top < l.top ? h = h.type.createAndFill(C) : h = h.type.create(C, h.content);
476
+ if (p.top < s.top || p.bottom > s.bottom) {
477
+ const C = y(
478
+ h.attrs,
479
+ "rowspan",
480
+ Math.min(p.bottom, s.bottom) - Math.max(p.top, s.top)
481
+ );
482
+ p.top < s.top ? h = h.type.createAndFill(C) : h = h.type.create(C, h.content);
449
483
  }
450
484
  c.push(h);
451
485
  }
452
486
  }
453
- r.push(e.child(i).copy(I.from(c)));
487
+ r.push(e.child(i).copy($.from(c)));
454
488
  }
455
489
  const a = this.isColSelection() && this.isRowSelection() ? e : r;
456
- return new O(I.from(a), 1, 1);
490
+ return new _($.from(a), 1, 1);
457
491
  }
458
- replace(e, t = O.empty) {
459
- const n = e.steps.length, l = this.ranges;
460
- for (let r = 0; r < l.length; r++) {
461
- const { $from: a, $to: i } = l[r], c = e.mapping.slice(n);
462
- e.replace(c.map(a.pos), c.map(i.pos), r ? O.empty : t);
492
+ replace(e, t = _.empty) {
493
+ const n = e.steps.length, s = this.ranges;
494
+ for (let r = 0; r < s.length; r++) {
495
+ const { $from: a, $to: i } = s[r], c = e.mapping.slice(n);
496
+ e.replace(c.map(a.pos), c.map(i.pos), r ? _.empty : t);
463
497
  }
464
- const s = N.findFrom(e.doc.resolve(e.mapping.slice(n).map(this.to)), -1);
465
- s && e.setSelection(s);
498
+ const l = S.findFrom(e.doc.resolve(e.mapping.slice(n).map(this.to)), -1);
499
+ l && e.setSelection(l);
466
500
  }
467
501
  replaceWith(e, t) {
468
- this.replace(e, new O(I.from(t), 0, 0));
502
+ this.replace(e, new _($.from(t), 0, 0));
469
503
  }
470
504
  forEachCell(e) {
471
- const t = this.$anchorCell.node(-1), n = g.get(t), l = this.$anchorCell.start(-1), s = n.cellsInRect(n.rectBetween(this.$anchorCell.pos - l, this.$headCell.pos - l));
472
- for (let r = 0; r < s.length; r++)
473
- e(t.nodeAt(s[r]), l + s[r]);
505
+ const t = this.$anchorCell.node(-1), n = g.get(t), s = this.$anchorCell.start(-1), l = n.cellsInRect(n.rectBetween(this.$anchorCell.pos - s, this.$headCell.pos - s));
506
+ for (let r = 0; r < l.length; r++)
507
+ e(t.nodeAt(l[r]), s + l[r]);
474
508
  }
475
509
  isColSelection() {
476
510
  const e = this.$anchorCell.index(-1), t = this.$headCell.index(-1);
477
511
  if (Math.min(e, t) > 0)
478
512
  return !1;
479
- const n = e + this.$anchorCell.nodeAfter.attrs.rowspan, l = t + this.$headCell.nodeAfter.attrs.rowspan;
480
- return Math.max(n, l) == this.$headCell.node(-1).childCount;
513
+ const n = e + this.$anchorCell.nodeAfter.attrs.rowspan, s = t + this.$headCell.nodeAfter.attrs.rowspan;
514
+ return Math.max(n, s) == this.$headCell.node(-1).childCount;
481
515
  }
482
516
  static colSelection(e, t = e) {
483
- const n = g.get(e.node(-1)), l = e.start(-1), s = n.findCell(e.pos - l), r = n.findCell(t.pos - l), a = e.node(0);
484
- if (s.top <= r.top) {
485
- if (s.top > 0) {
486
- const i = n.map[s.left];
487
- e = a.resolve(l + i);
517
+ const n = g.get(e.node(-1)), s = e.start(-1), l = n.findCell(e.pos - s), r = n.findCell(t.pos - s), a = e.node(0);
518
+ if (l.top <= r.top) {
519
+ if (l.top > 0) {
520
+ const i = n.map[l.left];
521
+ e = a.resolve(s + i);
488
522
  }
489
523
  if (r.bottom < n.height) {
490
524
  const i = n.map[n.width * (n.height - 1) + r.right - 1];
491
- t = a.resolve(l + i);
525
+ t = a.resolve(s + i);
492
526
  }
493
527
  } else {
494
528
  if (r.top > 0) {
495
- const i = n.map[s.left];
496
- t = a.resolve(l + i);
529
+ const i = n.map[l.left];
530
+ t = a.resolve(s + i);
497
531
  }
498
- if (s.bottom < n.height) {
499
- const i = n.map[n.width * (n.height - 1) + s.right - 1];
500
- e = a.resolve(l + i);
532
+ if (l.bottom < n.height) {
533
+ const i = n.map[n.width * (n.height - 1) + l.right - 1];
534
+ e = a.resolve(s + i);
501
535
  }
502
536
  }
503
537
  return new m(e, t);
504
538
  }
505
539
  isRowSelection() {
506
- const e = g.get(this.$anchorCell.node(-1)), t = this.$anchorCell.start(-1), n = e.colCount(this.$anchorCell.pos - t), l = e.colCount(this.$headCell.pos - t);
507
- if (Math.min(n, l) > 0)
540
+ const e = g.get(this.$anchorCell.node(-1)), t = this.$anchorCell.start(-1), n = e.colCount(this.$anchorCell.pos - t), s = e.colCount(this.$headCell.pos - t);
541
+ if (Math.min(n, s) > 0)
508
542
  return !1;
509
- const s = n + this.$anchorCell.nodeAfter.attrs.colspan, r = l + this.$headCell.nodeAfter.attrs.colspan;
510
- return Math.max(s, r) == e.width;
543
+ const l = n + this.$anchorCell.nodeAfter.attrs.colspan, r = s + this.$headCell.nodeAfter.attrs.colspan;
544
+ return Math.max(l, r) == e.width;
511
545
  }
512
546
  eq(e) {
513
547
  return e instanceof m && e.$anchorCell.pos == this.$anchorCell.pos && e.$headCell.pos == this.$headCell.pos;
514
548
  }
515
549
  static rowSelection(e, t = e) {
516
- const n = g.get(e.node(-1)), l = e.start(-1), s = n.findCell(e.pos - l), r = n.findCell(t.pos - l), a = e.node(0);
517
- if (s.left <= r.left) {
518
- if (s.left > 0) {
519
- const i = n.map[s.top * n.width];
520
- e = a.resolve(l + i);
550
+ const n = g.get(e.node(-1)), s = e.start(-1), l = n.findCell(e.pos - s), r = n.findCell(t.pos - s), a = e.node(0);
551
+ if (l.left <= r.left) {
552
+ if (l.left > 0) {
553
+ const i = n.map[l.top * n.width];
554
+ e = a.resolve(s + i);
521
555
  }
522
556
  if (r.right < n.width) {
523
557
  const i = n.map[n.width * (r.top + 1) - 1];
524
- t = a.resolve(l + i);
558
+ t = a.resolve(s + i);
525
559
  }
526
560
  } else {
527
561
  if (r.left > 0) {
528
562
  const i = n.map[r.top * n.width];
529
- t = a.resolve(l + i);
563
+ t = a.resolve(s + i);
530
564
  }
531
- if (s.right < n.width) {
532
- const i = n.map[n.width * (s.top + 1) - 1];
533
- e = a.resolve(l + i);
565
+ if (l.right < n.width) {
566
+ const i = n.map[n.width * (l.top + 1) - 1];
567
+ e = a.resolve(s + i);
534
568
  }
535
569
  }
536
570
  return new m(e, t);
@@ -553,7 +587,7 @@ class m extends N {
553
587
  }
554
588
  }
555
589
  m.prototype.visible = !1;
556
- N.jsonID("cell", m);
590
+ S.jsonID("cell", m);
557
591
  class Ne {
558
592
  constructor(e, t) {
559
593
  this.anchor = e, this.head = t, this.anchor = e, this.head = t;
@@ -563,91 +597,91 @@ class Ne {
563
597
  }
564
598
  resolve(e) {
565
599
  const t = e.resolve(this.anchor), n = e.resolve(this.head);
566
- return t.parent.type.spec.tableRole == "row" && n.parent.type.spec.tableRole == "row" && t.index() < t.parent.childCount && n.index() < n.parent.childCount && Se(t, n) ? new m(t, n) : N.near(n, 1);
600
+ return t.parent.type.spec.tableRole == "row" && n.parent.type.spec.tableRole == "row" && t.index() < t.parent.childCount && n.index() < n.parent.childCount && xe(t, n) ? new m(t, n) : S.near(n, 1);
567
601
  }
568
602
  }
569
- function _t(o) {
603
+ function Bt(o) {
570
604
  if (!(o.selection instanceof m))
571
605
  return null;
572
606
  const e = [];
573
607
  return o.selection.forEachCell((t, n) => {
574
- e.push(Ae.node(n, n + t.nodeSize, { class: "selectedCell" }));
575
- }), Me.create(o.doc, e);
608
+ e.push(Me.node(n, n + t.nodeSize, { class: "selectedCell" }));
609
+ }), Se.create(o.doc, e);
576
610
  }
577
- function zt({ $from: o, $to: e }) {
611
+ function Wt({ $from: o, $to: e }) {
578
612
  if (o.pos == e.pos || o.pos < o.pos - 6)
579
613
  return !1;
580
- let t = o.pos, n = e.pos, l = o.depth;
581
- for (; l >= 0 && !(o.after(l + 1) < o.end(l)); l--, t++)
614
+ let t = o.pos, n = e.pos, s = o.depth;
615
+ for (; s >= 0 && !(o.after(s + 1) < o.end(s)); s--, t++)
582
616
  ;
583
- for (let s = e.depth; s >= 0 && !(e.before(s + 1) > e.start(s)); s--, n--)
617
+ for (let l = e.depth; l >= 0 && !(e.before(l + 1) > e.start(l)); l--, n--)
584
618
  ;
585
- return t == n && /row|table/.test(o.node(l).type.spec.tableRole);
619
+ return t == n && /row|table/.test(o.node(s).type.spec.tableRole);
586
620
  }
587
- function Ft({ $from: o, $to: e }) {
621
+ function Pt({ $from: o, $to: e }) {
588
622
  let t, n;
589
- for (let l = o.depth; l > 0; l--) {
590
- const s = o.node(l);
591
- if (s.type.spec.tableRole === "cell" || s.type.spec.tableRole === "header_cell") {
592
- t = s;
623
+ for (let s = o.depth; s > 0; s--) {
624
+ const l = o.node(s);
625
+ if (l.type.spec.tableRole === "cell" || l.type.spec.tableRole === "header_cell") {
626
+ t = l;
593
627
  break;
594
628
  }
595
629
  }
596
- for (let l = e.depth; l > 0; l--) {
597
- const s = e.node(l);
598
- if (s.type.spec.tableRole === "cell" || s.type.spec.tableRole === "header_cell") {
599
- n = s;
630
+ for (let s = e.depth; s > 0; s--) {
631
+ const l = e.node(s);
632
+ if (l.type.spec.tableRole === "cell" || l.type.spec.tableRole === "header_cell") {
633
+ n = l;
600
634
  break;
601
635
  }
602
636
  }
603
637
  return t !== n && e.parentOffset === 0;
604
638
  }
605
- function Bt(o, e, t) {
606
- const n = (e || o).selection, l = (e || o).doc;
607
- let s, r;
608
- if (n instanceof ne && (r = n.node.type.spec.tableRole)) {
639
+ function Ht(o, e, t) {
640
+ const n = (e || o).selection, s = (e || o).doc;
641
+ let l, r;
642
+ if (n instanceof oe && (r = n.node.type.spec.tableRole)) {
609
643
  if (r == "cell" || r == "header_cell")
610
- s = m.create(l, n.from);
644
+ l = m.create(s, n.from);
611
645
  else if (r == "row") {
612
- const a = l.resolve(n.from + 1);
613
- s = m.rowSelection(a, a);
646
+ const a = s.resolve(n.from + 1);
647
+ l = m.rowSelection(a, a);
614
648
  } else if (!t) {
615
649
  const a = g.get(n.node), i = n.from + 1, c = a.map[a.width * a.height - 1], d = i + c;
616
- s = m.create(l, i + 1, d);
650
+ l = m.create(s, i + 1, d);
617
651
  }
618
652
  } else
619
- n instanceof E && zt(n) ? s = E.create(l, n.from) : n instanceof E && Ft(n) && (s = E.create(l, n.$from.start(), n.$from.end()));
620
- return s && (e || (e = o.tr)).setSelection(s), e;
653
+ n instanceof E && Wt(n) ? l = E.create(s, n.from) : n instanceof E && Pt(n) && (l = E.create(s, n.$from.start(), n.$from.end()));
654
+ return l && (e || (e = o.tr)).setSelection(l), e;
621
655
  }
622
656
  function Ie(o, e) {
623
- const t = o.getAttribute("data-colwidth"), n = t && /^\d+(,\d+)*$/.test(t) ? t.split(",").map((r) => Number(r)) : null, l = Number(o.getAttribute("colspan") || 1), s = {
624
- colspan: l,
657
+ const t = o.getAttribute("data-colwidth"), n = t && /^\d+(,\d+)*$/.test(t) ? t.split(",").map((r) => Number(r)) : null, s = Number(o.getAttribute("colspan") || 1), l = {
658
+ colspan: s,
625
659
  rowspan: Number(o.getAttribute("rowspan") || 1),
626
- colwidth: n && n.length == l ? n : null
660
+ colwidth: n && n.length == s ? n : null
627
661
  };
628
662
  for (const r in e) {
629
663
  const a = e[r].getFromDOM, i = a && a(o);
630
- i != null && (s[r] = i);
664
+ i != null && (l[r] = i);
631
665
  }
632
- return s;
666
+ return l;
633
667
  }
634
- function $e(o, e) {
668
+ function De(o, e) {
635
669
  const t = {};
636
670
  o.attrs.colspan != 1 && (t.colspan = o.attrs.colspan), o.attrs.rowspan != 1 && (t.rowspan = o.attrs.rowspan), o.attrs.colwidth && (t["data-colwidth"] = o.attrs.colwidth.join(","));
637
671
  for (const n in e) {
638
- const l = e[n].setDOMAttr;
639
- l && l(o.attrs[n], t);
672
+ const s = e[n].setDOMAttr;
673
+ s && s(o.attrs[n], t);
640
674
  }
641
675
  return t;
642
676
  }
643
- function Pt(o) {
677
+ function jt(o) {
644
678
  const e = o.cellAttributes || {}, t = {
645
679
  colspan: { default: 1 },
646
680
  rowspan: { default: 1 },
647
681
  colwidth: { default: null }
648
682
  };
649
- for (const s in e)
650
- t[s] = { default: e[s].default };
683
+ for (const l in e)
684
+ t[l] = { default: e[l].default };
651
685
  const n = t;
652
686
  return {
653
687
  table: {
@@ -673,9 +707,9 @@ function Pt(o) {
673
707
  attrs: n,
674
708
  tableRole: "cell",
675
709
  isolating: !0,
676
- parseDOM: [{ tag: "td", getAttrs: (s) => Ie(s, e) }],
677
- toDOM(s) {
678
- return ["td", $e(s, e), 0];
710
+ parseDOM: [{ tag: "td", getAttrs: (l) => Ie(l, e) }],
711
+ toDOM(l) {
712
+ return ["td", De(l, e), 0];
679
713
  }
680
714
  },
681
715
  table_header: {
@@ -683,9 +717,9 @@ function Pt(o) {
683
717
  attrs: n,
684
718
  tableRole: "header_cell",
685
719
  isolating: !0,
686
- parseDOM: [{ tag: "th", getAttrs: (s) => Ie(s, e) }],
687
- toDOM(s) {
688
- return ["th", $e(s, e), 0];
720
+ parseDOM: [{ tag: "th", getAttrs: (l) => Ie(l, e) }],
721
+ toDOM(l) {
722
+ return ["th", De(l, e), 0];
689
723
  }
690
724
  }
691
725
  };
@@ -695,13 +729,13 @@ function A(o) {
695
729
  if (!e) {
696
730
  e = o.cached.tableNodeTypes = {};
697
731
  for (const t in o.nodes) {
698
- const n = o.nodes[t], l = n == null ? void 0 : n.spec.tableRole;
699
- l && (e[l] = n);
732
+ const n = o.nodes[t], s = n == null ? void 0 : n.spec.tableRole;
733
+ s && (e[s] = n);
700
734
  }
701
735
  }
702
736
  return e;
703
737
  }
704
- const G = Pt({
738
+ const Y = jt({
705
739
  tableGroup: "block",
706
740
  cellContent: "paragraph",
707
741
  cellAttributes: {
@@ -714,35 +748,35 @@ const G = Pt({
714
748
  }
715
749
  }
716
750
  });
717
- function X(o) {
751
+ function V(o) {
718
752
  for (let e = o.depth - 1; e > 0; e--)
719
753
  if (o.node(e).type.spec.tableRole == "row")
720
754
  return o.node(0).resolve(o.before(e + 1));
721
755
  }
722
- function ue(o) {
756
+ function pe(o) {
723
757
  return o.parent.type.spec.tableRole == "row" ? o.nodeAfter : null;
724
758
  }
725
- function Wt(o) {
759
+ function Kt(o) {
726
760
  return o.node(0).resolve(o.pos + o.nodeAfter.nodeSize);
727
761
  }
728
- function Se(o, e) {
762
+ function xe(o, e) {
729
763
  return o.depth == e.depth && o.pos >= e.start(-1) && o.pos <= e.end(-1);
730
764
  }
731
- function Qe(o, e, t) {
732
- const n = o.start(-1), s = g.get(o.node(-1)).nextCell(o.pos - n, e, t);
733
- return s == null ? null : o.node(0).resolve(n + s);
765
+ function et(o, e, t) {
766
+ const n = o.start(-1), l = g.get(o.node(-1)).nextCell(o.pos - n, e, t);
767
+ return l == null ? null : o.node(0).resolve(n + l);
734
768
  }
735
769
  function y(o, e, t) {
736
770
  const n = {};
737
- for (const l in o)
738
- n[l] = o[l];
771
+ for (const s in o)
772
+ n[s] = o[s];
739
773
  return n[e] = t, n;
740
774
  }
741
- function z(o, e, t = 1) {
775
+ function F(o, e, t = 1) {
742
776
  const n = y(o, "colspan", o.colspan - t);
743
777
  if (n.colwidth) {
744
- const l = n.colwidth;
745
- n.colwidth = l.slice(), l.splice(e, t), l.some((s) => s > 0) || (n.colwidth = null);
778
+ const s = n.colwidth;
779
+ n.colwidth = s.slice(), s.splice(e, t), s.some((l) => l > 0) || (n.colwidth = null);
746
780
  }
747
781
  return n;
748
782
  }
@@ -753,11 +787,11 @@ function M(o) {
753
787
  return !0;
754
788
  return !1;
755
789
  }
756
- function oe(o) {
790
+ function se(o) {
757
791
  const e = o.selection;
758
- return e instanceof m ? e.$anchorCell.pos > e.$headCell.pos ? e.$anchorCell : e.$headCell : e.node && e.node.type.spec.tableRole == "cell" ? e.$anchor : X(e.$head) || Ht(e.$head);
792
+ return e instanceof m ? e.$anchorCell.pos > e.$headCell.pos ? e.$anchorCell : e.$headCell : e.node && e.node.type.spec.tableRole == "cell" ? e.$anchor : V(e.$head) || qt(e.$head);
759
793
  }
760
- function Ht(o) {
794
+ function qt(o) {
761
795
  for (let e = o.nodeAfter, t = o.pos; e; e = e.firstChild, t++) {
762
796
  const n = e.type.spec.tableRole;
763
797
  if (n == "cell" || n == "header_cell")
@@ -769,234 +803,246 @@ function Ht(o) {
769
803
  return o.doc.resolve(t - e.nodeSize);
770
804
  }
771
805
  }
772
- function jt(o, e, t = 1) {
806
+ function Xt(o, e, t = 1) {
773
807
  const n = y(o, "colspan", o.colspan + t);
774
808
  if (n.colwidth) {
775
- const l = n.colwidth;
776
- n.colwidth = l.slice();
777
- for (let s = 0; s < t; s++)
778
- l.splice(e, 0, 0);
809
+ const s = n.colwidth;
810
+ n.colwidth = s.slice();
811
+ for (let l = 0; l < t; l++)
812
+ s.splice(e, 0, 0);
779
813
  }
780
814
  return n;
781
815
  }
782
- function Kt(o, e, t) {
816
+ function Ut(o, e, t) {
783
817
  const n = A(e.type.schema).header_cell;
784
- for (let l = 0; l < o.height; l++) {
785
- const s = o.map[t + l * o.width];
786
- if (e.nodeAt(s).type != n)
818
+ for (let s = 0; s < o.height; s++) {
819
+ const l = o.map[t + s * o.width];
820
+ if (e.nodeAt(l).type != n)
787
821
  return !1;
788
822
  }
789
823
  return !0;
790
824
  }
791
- const qt = (o) => (e, t) => {
825
+ const Vt = (o) => (e, t) => {
792
826
  if (!M(e))
793
827
  return !1;
794
- const { $head: n } = e.selection, l = n.after(), s = e.tr.replaceWith(l, l, o.createAndFill());
795
- return s.setSelection(N.near(s.doc.resolve(l), 1)), t == null || t(s.scrollIntoView()), !0;
828
+ const { $head: n } = e.selection, s = n.after(), l = e.tr.replaceWith(s, s, o.createAndFill());
829
+ return l.setSelection(S.near(l.doc.resolve(s), 1)), t == null || t(l.scrollIntoView()), !0;
796
830
  };
797
831
  function P(o) {
798
- const e = o.selection, t = oe(o), n = t.node(-1), l = t.start(-1), s = g.get(n);
832
+ const e = o.selection, t = se(o), n = t.node(-1), s = t.start(-1), l = g.get(n);
799
833
  let r;
800
- return e instanceof m ? r = s.rectBetween(e.$anchorCell.pos - l, e.$headCell.pos - l) : r = s.findCell(t.pos - l), r.tableStart = l, r.map = s, r.table = n, r;
834
+ return e instanceof m ? r = l.rectBetween(e.$anchorCell.pos - s, e.$headCell.pos - s) : r = l.findCell(t.pos - s), r.tableStart = s, r.map = l, r.table = n, r;
801
835
  }
802
- function et(o, { map: e, tableStart: t, table: n }, l) {
836
+ function tt(o, { map: e, tableStart: t, table: n }, s) {
803
837
  e = e, n = n, t = t;
804
- let s = l > 0 ? -1 : 0;
805
- Kt(e, n, l + s) && (s = l == 0 || l == e.width ? null : 0);
838
+ let l = s > 0 ? -1 : 0;
839
+ Ut(e, n, s + l) && (l = s == 0 || s == e.width ? null : 0);
806
840
  for (let r = 0; r < e.height; r++) {
807
- const a = r * e.width + l;
808
- if (l > 0 && l < e.width && e.map[a - 1] == e.map[a]) {
841
+ const a = r * e.width + s;
842
+ if (s > 0 && s < e.width && e.map[a - 1] == e.map[a]) {
809
843
  const i = e.map[a], c = n.nodeAt(i);
810
- o.setNodeMarkup(o.mapping.map(t + i), null, jt(c.attrs, l - e.colCount(i))), r += c.attrs.rowspan - 1;
844
+ o.setNodeMarkup(o.mapping.map(t + i), null, Xt(c.attrs, s - e.colCount(i))), r += c.attrs.rowspan - 1;
811
845
  } else {
812
- const i = e.map[a + s], c = s == null ? A(n.type.schema).cell : n.nodeAt(i).type, d = e.positionAt(r, l, n);
846
+ const i = e.map[a + l], c = l == null ? A(n.type.schema).cell : n.nodeAt(i).type, d = e.positionAt(r, s, n);
813
847
  o.insert(o.mapping.map(t + d), c.createAndFill());
814
848
  }
815
849
  }
816
850
  return o;
817
851
  }
818
- const Xt = (o, e) => {
852
+ const Gt = (o, e) => {
819
853
  if (!M(o))
820
854
  return !1;
821
855
  if (e) {
822
856
  const t = P(o);
823
- e(et(o.tr, t, t.left));
857
+ e(tt(o.tr, t, t.left));
824
858
  }
825
859
  return !0;
826
- }, Ut = (o, e) => {
860
+ }, Jt = (o, e) => {
827
861
  if (!M(o))
828
862
  return !1;
829
863
  if (e) {
830
864
  const t = P(o);
831
- e(et(o.tr, t, t.right));
865
+ e(tt(o.tr, t, t.right));
832
866
  }
833
867
  return !0;
834
868
  };
835
- function Vt(o, { map: e, table: t, tableStart: n }, l) {
869
+ function Yt(o, { map: e, table: t, tableStart: n }, s) {
836
870
  e = e, t = t, n = n;
837
- const s = o.mapping.maps.length;
871
+ const l = o.mapping.maps.length;
838
872
  for (let r = 0; r < e.height; ) {
839
- const a = r * e.width + l, i = e.map[a], c = t.nodeAt(i);
840
- if (l > 0 && e.map[a - 1] == i || l < e.width - 1 && e.map[a + 1] == i)
841
- o.setNodeMarkup(o.mapping.slice(s).map(n + i), null, z(c.attrs, l - e.colCount(i)));
873
+ const a = r * e.width + s, i = e.map[a], c = t.nodeAt(i);
874
+ if (s > 0 && e.map[a - 1] == i || s < e.width - 1 && e.map[a + 1] == i)
875
+ o.setNodeMarkup(
876
+ o.mapping.slice(l).map(n + i),
877
+ null,
878
+ F(c.attrs, s - e.colCount(i))
879
+ );
842
880
  else {
843
- const d = o.mapping.slice(s).map(n + i);
881
+ const d = o.mapping.slice(l).map(n + i);
844
882
  o.delete(d, d + c.nodeSize);
845
883
  }
846
884
  r += c.attrs.rowspan;
847
885
  }
848
886
  }
849
- const Gt = (o, e) => {
887
+ const Zt = (o, e) => {
850
888
  if (!M(o))
851
889
  return !1;
852
890
  if (e) {
853
891
  const t = P(o), n = o.tr;
854
892
  if (t.left == 0 && t.right == t.map.width)
855
893
  return !1;
856
- for (let l = t.right - 1; Vt(n, t, l), l != t.left; l--)
894
+ for (let s = t.right - 1; Yt(n, t, s), s != t.left; s--)
857
895
  t.table = t.tableStart ? n.doc.nodeAt(t.tableStart - 1) : n.doc, t.map = g.get(t.table);
858
896
  e(n);
859
897
  }
860
898
  return !0;
861
899
  };
862
- function Jt(o, { map: e, tableStart: t, table: n }, l) {
900
+ function Qt(o, { map: e, tableStart: t, table: n }, s) {
863
901
  e = e, n = n, t = t;
864
- let s = 0;
865
- for (let i = 0; i < l; i++)
866
- s += n.child(i).nodeSize;
867
- const r = s + n.child(l).nodeSize, a = o.mapping.maps.length;
868
- o.delete(s + t, r + t);
869
- for (let i = 0, c = l * e.width; i < e.width; i++, c++) {
902
+ let l = 0;
903
+ for (let i = 0; i < s; i++)
904
+ l += n.child(i).nodeSize;
905
+ const r = l + n.child(s).nodeSize, a = o.mapping.maps.length;
906
+ o.delete(l + t, r + t);
907
+ for (let i = 0, c = s * e.width; i < e.width; i++, c++) {
870
908
  const d = e.map[c];
871
- if (l > 0 && d == e.map[c - e.width]) {
909
+ if (s > 0 && d == e.map[c - e.width]) {
872
910
  const f = n.nodeAt(d).attrs;
873
- o.setNodeMarkup(o.mapping.slice(a).map(d + t), null, y(f, "rowspan", f.rowspan - 1)), i += f.colspan - 1;
874
- } else if (l < e.width && d == e.map[c + e.width]) {
875
- const f = n.nodeAt(d), u = f.type.create(y(f.attrs, "rowspan", f.attrs.rowspan - 1), f.content), p = e.positionAt(l + 1, i, n);
911
+ o.setNodeMarkup(
912
+ o.mapping.slice(a).map(d + t),
913
+ null,
914
+ y(f, "rowspan", f.rowspan - 1)
915
+ ), i += f.colspan - 1;
916
+ } else if (s < e.width && d == e.map[c + e.width]) {
917
+ const f = n.nodeAt(d), u = f.type.create(y(f.attrs, "rowspan", f.attrs.rowspan - 1), f.content), p = e.positionAt(s + 1, i, n);
876
918
  o.insert(o.mapping.slice(a).map(t + p), u), i += f.attrs.colspan - 1;
877
919
  }
878
920
  }
879
921
  }
880
- const Yt = (o, e) => {
922
+ const en = (o, e) => {
881
923
  if (!M(o))
882
924
  return !1;
883
925
  if (e) {
884
926
  const t = P(o), n = o.tr;
885
927
  if (t.top == 0 && t.bottom == t.map.height)
886
928
  return !1;
887
- for (let l = t.bottom - 1; Jt(n, t, l), l != t.top; l--)
929
+ for (let s = t.bottom - 1; Qt(n, t, s), s != t.top; s--)
888
930
  t.table = t.tableStart ? n.doc.nodeAt(t.tableStart - 1) : n.doc, t.map = g.get(t.table);
889
931
  e(n);
890
932
  }
891
933
  return !0;
892
934
  };
893
- function ie(o, e) {
935
+ function ce(o, e) {
894
936
  return (t, n) => {
895
937
  if (!M(t))
896
938
  return !1;
897
- const l = oe(t);
898
- if (l.nodeAfter.attrs[o] === e)
939
+ const s = se(t);
940
+ if (s.nodeAfter.attrs[o] === e)
899
941
  return !1;
900
942
  if (n) {
901
- const s = t.tr;
943
+ const l = t.tr;
902
944
  t.selection instanceof m ? t.selection.forEachCell((r, a) => {
903
- r.attrs[o] !== e && s.setNodeMarkup(a, null, y(r.attrs, o, e));
904
- }) : s.setNodeMarkup(l.pos, null, y(l.nodeAfter.attrs, o, e)), n(s);
945
+ r.attrs[o] !== e && l.setNodeMarkup(a, null, y(r.attrs, o, e));
946
+ }) : l.setNodeMarkup(s.pos, null, y(s.nodeAfter.attrs, o, e)), n(l);
905
947
  }
906
948
  return !0;
907
949
  };
908
950
  }
909
- function Zt(o, e) {
951
+ function tn(o, e) {
910
952
  if (e < 0) {
911
953
  const t = o.nodeBefore;
912
954
  if (t)
913
955
  return o.pos - t.nodeSize;
914
- for (let n = o.index(-1) - 1, l = o.before(); n >= 0; n--) {
915
- const s = o.node(-1).child(n);
916
- if (s.childCount)
917
- return l - 1 - s.lastChild.nodeSize;
918
- l -= s.nodeSize;
956
+ for (let n = o.index(-1) - 1, s = o.before(); n >= 0; n--) {
957
+ const l = o.node(-1).child(n);
958
+ if (l.childCount)
959
+ return s - 1 - l.lastChild.nodeSize;
960
+ s -= l.nodeSize;
919
961
  }
920
962
  } else {
921
963
  if (o.index() < o.parent.childCount - 1)
922
964
  return o.pos + o.nodeAfter.nodeSize;
923
965
  const t = o.node(-1);
924
- for (let n = o.indexAfter(-1), l = o.after(); n < t.childCount; n++) {
925
- const s = t.child(n);
926
- if (s.childCount)
927
- return l + 1;
928
- l += s.nodeSize;
966
+ for (let n = o.indexAfter(-1), s = o.after(); n < t.childCount; n++) {
967
+ const l = t.child(n);
968
+ if (l.childCount)
969
+ return s + 1;
970
+ s += l.nodeSize;
929
971
  }
930
972
  }
931
973
  }
932
- function De(o) {
974
+ function Oe(o) {
933
975
  return (e, t) => {
934
976
  if (!M(e))
935
977
  return !1;
936
- const n = Zt(oe(e), o);
978
+ const n = tn(se(e), o);
937
979
  if (n == null)
938
980
  return !1;
939
981
  if (t) {
940
- const l = e.doc.resolve(n);
941
- t(e.tr.setSelection(E.between(l, Wt(l))).scrollIntoView());
982
+ const s = e.doc.resolve(n);
983
+ t(e.tr.setSelection(E.between(s, Kt(s))).scrollIntoView());
942
984
  }
943
985
  return !0;
944
986
  };
945
987
  }
946
- const Qt = (o, e) => {
988
+ const nn = (o, e) => {
947
989
  const t = o.selection.$anchor;
948
990
  for (let n = t.depth; n > 0; n--)
949
991
  if (t.node(n).type.spec.tableRole == "table")
950
992
  return e && e(o.tr.delete(t.before(n), t.after(n)).scrollIntoView()), !0;
951
993
  return !1;
952
- }, le = (o) => gt((e) => e.type.spec.tableRole === "table")(o), en = (o) => (e) => {
994
+ }, le = (o) => Ct((e) => e.type.spec.tableRole === "table")(o), on = (o) => (e) => {
953
995
  const t = le(e);
954
996
  if (!t)
955
997
  return;
956
998
  const n = g.get(t.node);
957
999
  if (!(o < 0 || o >= n.width))
958
- return n.cellsInRect({ left: o, right: o + 1, top: 0, bottom: n.height }).map((l) => {
959
- const s = t.node.nodeAt(l);
960
- if (!s)
1000
+ return n.cellsInRect({ left: o, right: o + 1, top: 0, bottom: n.height }).map((s) => {
1001
+ const l = t.node.nodeAt(s);
1002
+ if (!l)
961
1003
  return;
962
- const r = l + t.start;
1004
+ const r = s + t.start;
963
1005
  return {
964
1006
  pos: r,
965
1007
  start: r + 1,
966
- node: s
1008
+ node: l
967
1009
  };
968
- }).filter((l) => l != null);
969
- }, tn = (o) => (e) => {
1010
+ }).filter((s) => s != null);
1011
+ }, sn = (o) => (e) => {
970
1012
  const t = le(e);
971
1013
  if (!t)
972
1014
  return;
973
1015
  const n = g.get(t.node);
974
1016
  if (!(o < 0 || o >= n.height))
975
- return n.cellsInRect({ left: 0, right: n.width, top: o, bottom: o + 1 }).map((l) => {
976
- const s = t.node.nodeAt(l);
977
- if (!s)
1017
+ return n.cellsInRect({ left: 0, right: n.width, top: o, bottom: o + 1 }).map((s) => {
1018
+ const l = t.node.nodeAt(s);
1019
+ if (!l)
978
1020
  return;
979
- const r = l + t.start;
1021
+ const r = s + t.start;
980
1022
  return {
981
1023
  pos: r,
982
1024
  start: r + 1,
983
- node: s
1025
+ node: l
984
1026
  };
985
- }).filter((l) => l != null);
986
- }, ce = (o, e = 3, t = 3) => {
987
- const { cell: n, header_cell: l, row: s, table: r } = A(o), a = Array(t).fill(0).map(() => n.createAndFill(null)), i = Array(t).fill(0).map(() => l.createAndFill(null)), c = Array(e).fill(0).map((d, f) => s.create(null, f === 0 ? i : a));
1027
+ }).filter((s) => s != null);
1028
+ }, ae = (o, e = 3, t = 3) => {
1029
+ const { cell: n, header_cell: s, row: l, table: r } = A(o), a = Array(t).fill(0).map(() => n.createAndFill(null)), i = Array(t).fill(0).map(() => s.createAndFill(null)), c = Array(e).fill(0).map((d, f) => l.create(null, f === 0 ? i : a));
988
1030
  return r.create(null, c);
989
- }, Oe = (o) => (e) => (t) => {
990
- const n = le(t.selection), l = o === "row";
1031
+ }, _e = (o) => (e) => (t) => {
1032
+ const n = le(t.selection), s = o === "row";
991
1033
  if (n) {
992
- const s = g.get(n.node);
993
- if (e >= 0 && e < (l ? s.height : s.width)) {
994
- const r = s.positionAt(l ? e : s.height - 1, l ? s.width - 1 : e, n.node), a = t.doc.resolve(n.start + r), i = l ? m.rowSelection : m.colSelection, c = s.positionAt(l ? e : 0, l ? 0 : e, n.node), d = t.doc.resolve(n.start + c);
995
- return Ve(t.setSelection(i(a, d)));
1034
+ const l = g.get(n.node);
1035
+ if (e >= 0 && e < (s ? l.height : l.width)) {
1036
+ const r = l.positionAt(
1037
+ s ? e : l.height - 1,
1038
+ s ? l.width - 1 : e,
1039
+ n.node
1040
+ ), a = t.doc.resolve(n.start + r), i = s ? m.rowSelection : m.colSelection, c = l.positionAt(s ? e : 0, s ? 0 : e, n.node), d = t.doc.resolve(n.start + c);
1041
+ return Ge(t.setSelection(i(a, d)));
996
1042
  }
997
1043
  }
998
1044
  return t;
999
- }, nn = (o) => {
1045
+ }, ln = (o) => {
1000
1046
  const e = le(o);
1001
1047
  if (!e)
1002
1048
  return;
@@ -1006,59 +1052,61 @@ const Qt = (o, e) => {
1006
1052
  right: t.width,
1007
1053
  top: 0,
1008
1054
  bottom: t.height
1009
- }).map((l) => {
1010
- const s = e.node.nodeAt(l), r = l + e.start;
1011
- return { pos: r, start: r + 1, node: s };
1055
+ }).map((s) => {
1056
+ const l = e.node.nodeAt(s), r = s + e.start;
1057
+ return { pos: r, start: r + 1, node: l };
1012
1058
  });
1013
- }, on = (o) => {
1014
- const e = nn(o.selection);
1059
+ }, rn = (o) => {
1060
+ const e = ln(o.selection);
1015
1061
  if (e && e[0]) {
1016
1062
  const t = o.doc.resolve(e[0].pos), n = e[e.length - 1];
1017
1063
  if (n) {
1018
- const l = o.doc.resolve(n.pos);
1019
- return Ve(o.setSelection(new m(l, t)));
1064
+ const s = o.doc.resolve(n.pos);
1065
+ return Ge(o.setSelection(new m(s, t)));
1020
1066
  }
1021
1067
  }
1022
1068
  return o;
1023
1069
  };
1024
- function _e(o, { map: e, tableStart: t, table: n }, l) {
1025
- const s = Array(l).fill(0).reduce((c, d, f) => c + n.child(f).nodeSize, t), { cell: r, row: a } = A(n.type.schema), i = Array(e.width).fill(0).map((c, d) => {
1070
+ function ze(o, { map: e, tableStart: t, table: n }, s) {
1071
+ const l = Array(s).fill(0).reduce((c, d, f) => c + n.child(f).nodeSize, t), { cell: r, row: a } = A(n.type.schema), i = Array(e.width).fill(0).map((c, d) => {
1026
1072
  const f = n.nodeAt(e.map[d]);
1027
1073
  return r.createAndFill({ alignment: f == null ? void 0 : f.attrs.alignment });
1028
1074
  });
1029
- return o.insert(s, a.create(null, i)), o;
1075
+ return o.insert(l, a.create(null, i)), o;
1030
1076
  }
1031
- const T = (o) => o.state.selection, ln = (o) => {
1077
+ const T = (o) => o.state.selection, cn = (o) => {
1032
1078
  const e = g.get(o.$anchorCell.node(-1)), t = o.$anchorCell.start(-1), n = e.cellsInRect({
1033
1079
  left: 0,
1034
1080
  right: e.width,
1035
1081
  top: 0,
1036
1082
  bottom: 1
1037
- }), l = e.cellsInRect(e.rectBetween(o.$anchorCell.pos - t, o.$headCell.pos - t));
1038
- for (let s = 0, r = n.length; s < r; s++)
1039
- if (l.indexOf(n[s]) === -1)
1083
+ }), s = e.cellsInRect(
1084
+ e.rectBetween(o.$anchorCell.pos - t, o.$headCell.pos - t)
1085
+ );
1086
+ for (let l = 0, r = n.length; l < r; l++)
1087
+ if (!s.includes(n[l]))
1040
1088
  return !1;
1041
1089
  return !0;
1042
- }, sn = (o, e) => {
1090
+ }, an = (o, e) => {
1043
1091
  Object.values(o).forEach((t) => {
1044
- var l;
1045
- if ((l = t.disable) == null ? void 0 : l.call(t, e)) {
1092
+ var s;
1093
+ if ((s = t.disable) == null ? void 0 : s.call(t, e)) {
1046
1094
  t.$.classList.add("hide");
1047
1095
  return;
1048
1096
  }
1049
1097
  t.$.classList.remove("hide");
1050
1098
  });
1051
- }, rn = (o) => {
1052
- var e, t, n, l, s, r, a, i;
1099
+ }, dn = (o) => {
1100
+ var e, t, n, s, l, r, a, i;
1053
1101
  return {
1054
1102
  [0]: {
1055
1103
  $: (e = o.get(L).get(v, "leftArrow")) == null ? void 0 : e.dom,
1056
- command: () => Xt,
1104
+ command: () => Gt,
1057
1105
  disable: (c) => !T(c).isColSelection()
1058
1106
  },
1059
1107
  [1]: {
1060
1108
  $: (t = o.get(L).get(v, "rightArrow")) == null ? void 0 : t.dom,
1061
- command: () => Ut,
1109
+ command: () => Jt,
1062
1110
  disable: (c) => !T(c).isColSelection()
1063
1111
  },
1064
1112
  [2]: {
@@ -1068,66 +1116,67 @@ const T = (o) => o.state.selection, ln = (o) => {
1068
1116
  return !1;
1069
1117
  if (d) {
1070
1118
  const f = P(c);
1071
- d(_e(c.tr, f, f.top));
1119
+ d(ze(c.tr, f, f.top));
1072
1120
  }
1073
1121
  return !0;
1074
1122
  },
1075
1123
  disable: (c) => !T(c).isRowSelection() || T(c).$head.parent.type.name === "table_header"
1076
1124
  },
1077
1125
  [3]: {
1078
- $: (l = o.get(L).get(v, "downArrow")) == null ? void 0 : l.dom,
1126
+ $: (s = o.get(L).get(v, "downArrow")) == null ? void 0 : s.dom,
1079
1127
  command: () => (c, d) => {
1080
1128
  if (!M(c))
1081
1129
  return !1;
1082
1130
  if (d) {
1083
1131
  const f = P(c);
1084
- d(_e(c.tr, f, f.bottom));
1132
+ d(ze(c.tr, f, f.bottom));
1085
1133
  }
1086
1134
  return !0;
1087
1135
  },
1088
1136
  disable: (c) => !T(c).isRowSelection()
1089
1137
  },
1090
1138
  [4]: {
1091
- $: (s = o.get(L).get(v, "alignLeft")) == null ? void 0 : s.dom,
1092
- command: () => ie("alignment", "left"),
1139
+ $: (l = o.get(L).get(v, "alignLeft")) == null ? void 0 : l.dom,
1140
+ command: () => ce("alignment", "left"),
1093
1141
  disable: (c) => !T(c).isColSelection()
1094
1142
  },
1095
1143
  [5]: {
1096
1144
  $: (r = o.get(L).get(v, "alignCenter")) == null ? void 0 : r.dom,
1097
- command: () => ie("alignment", "center"),
1145
+ command: () => ce("alignment", "center"),
1098
1146
  disable: (c) => !T(c).isColSelection()
1099
1147
  },
1100
1148
  [6]: {
1101
1149
  $: (a = o.get(L).get(v, "alignRight")) == null ? void 0 : a.dom,
1102
- command: () => ie("alignment", "right"),
1150
+ command: () => ce("alignment", "right"),
1103
1151
  disable: (c) => !T(c).isColSelection()
1104
1152
  },
1105
1153
  [7]: {
1106
1154
  $: (i = o.get(L).get(v, "delete")) == null ? void 0 : i.dom,
1107
1155
  command: (c, d) => {
1108
1156
  const f = T(d), u = f.isColSelection(), p = f.isRowSelection();
1109
- return u && p ? Qt : u ? Gt : Yt;
1157
+ return u && p ? nn : u ? Zt : en;
1110
1158
  },
1111
1159
  disable: (c) => {
1112
1160
  const d = T(c);
1113
- return d.isRowSelection() ? d.isColSelection() ? !1 : ln(d) : !1;
1161
+ return d.isRowSelection() ? d.isColSelection() ? !1 : cn(d) : !1;
1114
1162
  }
1115
1163
  }
1116
1164
  };
1117
- }, cn = (o, e) => {
1118
- const { selection: t } = o.state, n = t.isColSelection(), l = t.isRowSelection();
1119
- wt(o, e, (s, r, a) => {
1165
+ }, fn = (o, e) => {
1166
+ const { selection: t } = o.state, n = t.isColSelection(), s = t.isRowSelection();
1167
+ yt(o, e, (l, r, a) => {
1120
1168
  const i = e.parentElement;
1121
1169
  if (!i)
1122
- throw mt();
1123
- let c = l ? s.left - a.left - r.width / 2 - 8 : s.left - a.left + (s.width - r.width) / 2;
1124
- const d = s.top - a.top - r.height - (n ? 14 : 0) - 14 + i.scrollTop;
1125
- return c < 0 && (c = 0), [d, c];
1170
+ throw bt();
1171
+ let c = s ? l.left - a.left - r.width / 2 - 8 : l.left - a.left + (l.width - r.width) / 2, d = l.top - a.top - r.height - (n ? 14 : 0) - 14 + i.scrollTop;
1172
+ c < 0 && (c = 0);
1173
+ const f = i.clientWidth - (r.width + 4);
1174
+ return c > f && (c = f), d < i.scrollTop && (d = l.top - a.top + 14 + i.scrollTop), [d, c];
1126
1175
  });
1127
1176
  };
1128
1177
  var x = /* @__PURE__ */ ((o) => (o.Left = "Left", o.Top = "Top", o.Point = "Point", o))(x || {});
1129
- const an = (o, { css: e, injectGlobal: t }) => {
1130
- const n = ut(o), l = o.get(Re, "radius"), s = o.get(Re, "lineWidth");
1178
+ const un = (o, { css: e, injectGlobal: t }) => {
1179
+ const n = mt(o), s = o.get(Te, "radius"), l = o.get(Te, "lineWidth");
1131
1180
  return t`
1132
1181
  .milkdown {
1133
1182
  .tableWrapper {
@@ -1198,10 +1247,10 @@ const an = (o, { css: e, injectGlobal: t }) => {
1198
1247
 
1199
1248
  position: absolute;
1200
1249
 
1201
- border-radius: ${l};
1250
+ border-radius: ${s};
1202
1251
 
1203
- ${o.get(pt, void 0)};
1204
- ${o.get(ht, void 0)};
1252
+ ${o.get(gt, void 0)};
1253
+ ${o.get(wt, void 0)};
1205
1254
 
1206
1255
  overflow: hidden;
1207
1256
  background: ${n("surface")};
@@ -1228,7 +1277,7 @@ const an = (o, { css: e, injectGlobal: t }) => {
1228
1277
  position: absolute;
1229
1278
  right: 0;
1230
1279
  top: 0;
1231
- width: ${s};
1280
+ width: ${l};
1232
1281
  bottom: 0;
1233
1282
  background: ${n("line")};
1234
1283
  }
@@ -1239,7 +1288,7 @@ const an = (o, { css: e, injectGlobal: t }) => {
1239
1288
  display: none;
1240
1289
  }
1241
1290
  `;
1242
- }, dn = (o) => {
1291
+ }, pn = (o) => {
1243
1292
  switch (o) {
1244
1293
  case x.Left:
1245
1294
  return "milkdown-cell-left";
@@ -1250,62 +1299,62 @@ const an = (o, { css: e, injectGlobal: t }) => {
1250
1299
  return "milkdown-cell-point";
1251
1300
  }
1252
1301
  };
1253
- function ae(o, e, t, n = 0) {
1254
- return Ae.widget(e.pos + 1, (l) => {
1302
+ function de(o, e, t, n = 0) {
1303
+ return Me.widget(e.pos + 1, (s) => {
1255
1304
  var r;
1256
- const s = document.createElement("div");
1257
- return s.classList.add(dn(t)), t === x.Point && s.appendChild((r = o.get(L).get(v, "select")) == null ? void 0 : r.dom), s.addEventListener("mousedown", (a) => {
1258
- if (!!l)
1305
+ const l = document.createElement("div");
1306
+ return l.classList.add(pn(t)), t === x.Point && l.appendChild((r = o.get(L).get(v, "select")) == null ? void 0 : r.dom), l.addEventListener("mousedown", (a) => {
1307
+ if (!!s)
1259
1308
  switch (a.preventDefault(), t) {
1260
1309
  case x.Point: {
1261
- l.dispatch(on(l.state.tr));
1310
+ s.dispatch(rn(s.state.tr));
1262
1311
  return;
1263
1312
  }
1264
1313
  case x.Left: {
1265
- l.dispatch(Oe("row")(n)(l.state.tr));
1266
- return;
1267
- }
1268
- case x.Top: {
1269
- l.dispatch(Oe("col")(n)(l.state.tr));
1314
+ s.dispatch(_e("row")(n)(s.state.tr));
1270
1315
  return;
1271
1316
  }
1317
+ case x.Top:
1318
+ s.dispatch(_e("col")(n)(s.state.tr));
1272
1319
  }
1273
- }), s;
1320
+ }), l;
1274
1321
  });
1275
1322
  }
1276
- const fn = (o, e) => new W({
1277
- key: new F("MILKDOWN_TABLE_OP"),
1323
+ const hn = (o, e) => new H({
1324
+ key: new B("MILKDOWN_TABLE_OP"),
1278
1325
  props: {
1279
1326
  decorations: (t) => {
1280
- const n = [], l = en(0)(t.selection);
1327
+ if (!o.get(U).editable)
1328
+ return null;
1329
+ const s = [], l = on(0)(t.selection);
1281
1330
  if (!l)
1282
1331
  return null;
1283
- const s = tn(0)(t.selection);
1284
- if (!s)
1332
+ const r = sn(0)(t.selection);
1333
+ if (!r)
1285
1334
  return null;
1286
- const [r] = l;
1287
- return n.push(ae(o, r, x.Point)), l.forEach((a, i) => {
1288
- n.push(ae(o, a, x.Left, i));
1289
- }), s.forEach((a, i) => {
1290
- n.push(ae(o, a, x.Top, i));
1291
- }), Me.create(t.doc, n);
1335
+ const [a] = l;
1336
+ return s.push(de(o, a, x.Point)), l.forEach((i, c) => {
1337
+ s.push(de(o, i, x.Left, c));
1338
+ }), r.forEach((i, c) => {
1339
+ s.push(de(o, i, x.Top, c));
1340
+ }), Se.create(t.doc, s);
1292
1341
  }
1293
1342
  },
1294
1343
  view: (t) => {
1295
1344
  var a;
1296
- const n = Object.fromEntries(Object.entries(rn(o)).filter(([, i]) => i.$ != null)), l = document.createElement("div");
1345
+ const n = Object.fromEntries(Object.entries(dn(o)).filter(([, i]) => i.$ != null)), s = document.createElement("div");
1297
1346
  e.themeManager.onFlush(() => {
1298
- const i = e.getStyle((c) => an(e.themeManager, c));
1299
- i && l.classList.add(i);
1300
- }), l.classList.add("table-tooltip", "hide"), Object.values(n).forEach(({ $: i }) => l.appendChild(i)), (a = t.dom.parentNode) == null || a.appendChild(l);
1301
- const s = (i) => {
1347
+ const i = e.getStyle((c) => un(e.themeManager, c));
1348
+ i && s.classList.add(i);
1349
+ }), s.classList.add("table-tooltip", "hide"), Object.values(n).forEach(({ $: i }) => s.appendChild(i)), (a = t.dom.parentNode) == null || a.appendChild(s);
1350
+ const l = (i) => {
1302
1351
  !t || (i.stopPropagation(), i.preventDefault(), Object.values(n).forEach(({ $: c, command: d }) => {
1303
1352
  c.contains(i.target) && d(i, t)(t.state, t.dispatch, t);
1304
1353
  }));
1305
1354
  }, r = () => {
1306
- l.classList.add("hide");
1355
+ s.classList.add("hide");
1307
1356
  };
1308
- return l.addEventListener("mousedown", s), {
1357
+ return s.addEventListener("mousedown", l), {
1309
1358
  update: (i, c) => {
1310
1359
  const d = i.state;
1311
1360
  if ((c == null ? void 0 : c.doc.eq(d.doc)) && c.selection.eq(d.selection))
@@ -1314,51 +1363,55 @@ const fn = (o, e) => new W({
1314
1363
  r();
1315
1364
  return;
1316
1365
  }
1317
- if (sn(n, i), Object.values(n).every(({ $: u }) => u.classList.contains("hide"))) {
1366
+ if (an(n, i), Object.values(n).every(({ $: u }) => u.classList.contains("hide"))) {
1318
1367
  r();
1319
1368
  return;
1320
1369
  }
1321
- l.classList.remove("hide"), cn(i, l);
1370
+ s.classList.remove("hide"), fn(i, s);
1322
1371
  },
1323
1372
  destroy: () => {
1324
- l.removeEventListener("mousedown", s), l.remove();
1373
+ s.removeEventListener("mousedown", l), s.remove();
1325
1374
  }
1326
1375
  };
1327
1376
  }
1328
- }), un = (o) => o.type.name === "paragraph" && o.nodeSize === 2, pn = (o) => o.type.name === "paragraph", hn = new F("plugin_autoInsertZeroSpace"), mn = () => new W({
1329
- key: hn,
1377
+ }), mn = (o) => o.type.name === "paragraph" && o.nodeSize === 2, gn = (o) => o.type.name === "paragraph", wn = new B("plugin_autoInsertZeroSpace"), bn = () => new H({
1378
+ key: wn,
1330
1379
  props: {
1331
1380
  handleDOMEvents: {
1332
1381
  compositionstart(o) {
1333
- const { state: e, dispatch: t } = o, { tr: n, selection: l } = e, { $from: s } = l;
1334
- return Te.safari && M(e) && l.empty && un(s.parent) && t(n.insertText("\u2060", s.start())), !1;
1382
+ const { state: e, dispatch: t } = o, { tr: n, selection: s } = e, { $from: l } = s;
1383
+ return Le.safari && M(e) && s.empty && mn(l.parent) && t(n.insertText("\u2060", l.start())), !1;
1335
1384
  },
1336
1385
  compositionend(o) {
1337
- const { state: e, dispatch: t } = o, { tr: n, selection: l } = e, { $from: s } = l;
1338
- return Te.safari && M(e) && l.empty && pn(s.parent) && s.parent.textContent.startsWith("\u2060") && t(n.delete(s.start(), s.start() + 1)), !1;
1386
+ const { state: e, dispatch: t } = o, { tr: n, selection: s } = e, { $from: l } = s;
1387
+ return Le.safari && M(e) && s.empty && gn(l.parent) && l.parent.textContent.startsWith("\u2060") && t(n.delete(l.start(), l.start() + 1)), !1;
1339
1388
  }
1340
1389
  }
1341
1390
  }
1342
1391
  });
1343
- class gn {
1392
+ class Cn {
1344
1393
  constructor(e, t) {
1345
- this.node = e, this.cellMinWidth = t, this.node = e, this.cellMinWidth = t, this.dom = document.createElement("div"), this.dom.className = "tableWrapper", this.table = this.dom.appendChild(document.createElement("table")), this.colgroup = this.table.appendChild(document.createElement("colgroup")), pe(e, this.colgroup, this.table, t), this.contentDOM = this.table.appendChild(document.createElement("tbody"));
1394
+ I(this, "dom");
1395
+ I(this, "contentDOM");
1396
+ I(this, "table");
1397
+ I(this, "colgroup");
1398
+ this.node = e, this.cellMinWidth = t, this.node = e, this.cellMinWidth = t, this.dom = document.createElement("div"), this.dom.className = "tableWrapper", this.table = this.dom.appendChild(document.createElement("table")), this.colgroup = this.table.appendChild(document.createElement("colgroup")), he(e, this.colgroup, this.table, t), this.contentDOM = this.table.appendChild(document.createElement("tbody"));
1346
1399
  }
1347
1400
  update(e) {
1348
- return e.type != this.node.type ? !1 : (this.node = e, pe(e, this.colgroup, this.table, this.cellMinWidth), !0);
1401
+ return e.type != this.node.type ? !1 : (this.node = e, he(e, this.colgroup, this.table, this.cellMinWidth), !0);
1349
1402
  }
1350
1403
  ignoreMutation(e) {
1351
1404
  return e.type == "attributes" && (e.target == this.table || this.colgroup.contains(e.target));
1352
1405
  }
1353
1406
  }
1354
- function pe(o, e, t, n, l, s) {
1407
+ function he(o, e, t, n, s, l) {
1355
1408
  var d;
1356
1409
  let r = 0, a = !0, i = e.firstChild;
1357
1410
  const c = o.firstChild;
1358
1411
  for (let f = 0, u = 0; f < c.childCount; f++) {
1359
1412
  const { colspan: p, colwidth: h } = c.child(f).attrs;
1360
1413
  for (let b = 0; b < p; b++, u++) {
1361
- const w = l == u ? s : h && h[b], C = w ? w + "px" : "";
1414
+ const w = s == u ? l : h && h[b], C = w ? `${w}px` : "";
1362
1415
  r += w || n, w || (a = !1), i ? (i.style.width != C && (i.style.width = C), i = i.nextSibling) : e.appendChild(document.createElement("col")).style.width = C;
1363
1416
  }
1364
1417
  }
@@ -1366,49 +1419,49 @@ function pe(o, e, t, n, l, s) {
1366
1419
  const f = i.nextSibling;
1367
1420
  (d = i.parentNode) == null || d.removeChild(i), i = f;
1368
1421
  }
1369
- a ? (t.style.width = r + "px", t.style.minWidth = "") : (t.style.width = "", t.style.minWidth = r + "px");
1422
+ a ? (t.style.width = `${r}px`, t.style.minWidth = "") : (t.style.width = "", t.style.minWidth = `${r}px`);
1370
1423
  }
1371
- const k = new F("tableColumnResizing");
1372
- function wn({
1424
+ const k = new B("tableColumnResizing");
1425
+ function yn({
1373
1426
  handleWidth: o = 5,
1374
1427
  cellMinWidth: e = 25,
1375
- View: t = gn,
1428
+ View: t = Cn,
1376
1429
  lastColumnResizable: n = !0
1377
1430
  } = {}) {
1378
- return new W({
1431
+ return new H({
1379
1432
  key: k,
1380
1433
  state: {
1381
- init(s, r) {
1382
- return this.spec.props.nodeViews[A(r.schema).table.name] = (a) => new t(a, e), new q(-1, !1);
1434
+ init(l, r) {
1435
+ return this.spec.props.nodeViews[A(r.schema).table.name] = (a) => new t(a, e), new X(-1, !1);
1383
1436
  },
1384
- apply(s, r) {
1385
- return r.apply(s);
1437
+ apply(l, r) {
1438
+ return r.apply(l);
1386
1439
  }
1387
1440
  },
1388
1441
  props: {
1389
- attributes(s) {
1390
- return k.getState(s).activeHandle > -1 ? { class: "resize-cursor" } : void 0;
1442
+ attributes(l) {
1443
+ return k.getState(l).activeHandle > -1 ? { class: "resize-cursor" } : void 0;
1391
1444
  },
1392
1445
  handleDOMEvents: {
1393
- mousemove(s, r) {
1394
- bn(s, r, o, n);
1446
+ mousemove(l, r) {
1447
+ !l.editable || kn(l, r, o, n);
1395
1448
  },
1396
- mouseleave(s) {
1397
- Cn(s);
1449
+ mouseleave(l) {
1450
+ !l.editable || An(l);
1398
1451
  },
1399
- mousedown(s, r) {
1400
- yn(s, r, e);
1452
+ mousedown(l, r) {
1453
+ !l.editable || Mn(l, r, e);
1401
1454
  }
1402
1455
  },
1403
- decorations(s) {
1404
- const r = k.getState(s);
1405
- return r.activeHandle > -1 ? xn(s, r.activeHandle) : null;
1456
+ decorations(l) {
1457
+ const r = k.getState(l);
1458
+ return r.activeHandle > -1 ? Ln(l, r.activeHandle) : null;
1406
1459
  },
1407
1460
  nodeViews: {}
1408
1461
  }
1409
1462
  });
1410
1463
  }
1411
- class q {
1464
+ class X {
1412
1465
  constructor(e, t) {
1413
1466
  this.activeHandle = e, this.dragging = t, this.activeHandle = e, this.dragging = t;
1414
1467
  }
@@ -1416,327 +1469,374 @@ class q {
1416
1469
  let t = this;
1417
1470
  const n = e.getMeta(k);
1418
1471
  if (n && n.setHandle != null)
1419
- return new q(n.setHandle, null);
1472
+ return new X(n.setHandle, null);
1420
1473
  if (n && n.setDragging !== void 0)
1421
- return new q(t.activeHandle, n.setDragging);
1474
+ return new X(t.activeHandle, n.setDragging);
1422
1475
  if (t.activeHandle > -1 && e.docChanged) {
1423
- let l = e.mapping.map(t.activeHandle, -1);
1424
- ue(e.doc.resolve(l)) || (l = 0), t = new q(l, t.dragging);
1476
+ let s = e.mapping.map(t.activeHandle, -1);
1477
+ pe(e.doc.resolve(s)) || (s = 0), t = new X(s, t.dragging);
1425
1478
  }
1426
1479
  return t;
1427
1480
  }
1428
1481
  }
1429
- function bn(o, e, t, n) {
1430
- const l = k.getState(o.state);
1431
- if (!l.dragging) {
1432
- const s = An(e.target);
1482
+ function kn(o, e, t, n) {
1483
+ const s = k.getState(o.state);
1484
+ if (!s.dragging) {
1485
+ const l = Nn(e.target);
1433
1486
  let r = -1;
1434
- if (s) {
1435
- const { left: a, right: i } = s.getBoundingClientRect();
1436
- e.clientX - a <= t ? r = ze(o, e, "left") : i - e.clientX <= t && (r = ze(o, e, "right"));
1487
+ if (l) {
1488
+ const { left: a, right: i } = l.getBoundingClientRect();
1489
+ i - e.clientX <= t || e.clientX === Math.floor(a) ? r = Fe(o, e, "right") : e.clientX - a <= t && (r = Fe(o, e, "left"));
1437
1490
  }
1438
- if (r != l.activeHandle) {
1491
+ if (r != s.activeHandle) {
1439
1492
  if (!n && r !== -1) {
1440
1493
  const a = o.state.doc.resolve(r), i = a.node(-1), c = g.get(i), d = a.start(-1);
1441
1494
  if (c.colCount(a.pos - d) + a.nodeAfter.attrs.colspan - 1 == c.width - 1)
1442
1495
  return;
1443
1496
  }
1444
- tt(o, r);
1497
+ nt(o, r);
1445
1498
  }
1446
1499
  }
1447
1500
  }
1448
- function Cn(o) {
1501
+ function An(o) {
1449
1502
  const e = k.getState(o.state);
1450
- e.activeHandle > -1 && !e.dragging && tt(o, -1);
1503
+ e.activeHandle > -1 && !e.dragging && nt(o, -1);
1451
1504
  }
1452
- function yn(o, e, t) {
1505
+ function Mn(o, e, t) {
1453
1506
  const n = k.getState(o.state);
1454
1507
  if (n.activeHandle == -1 || n.dragging)
1455
1508
  return !1;
1456
- const l = o.state.doc.nodeAt(n.activeHandle), s = kn(o, n.activeHandle, l.attrs);
1457
- o.dispatch(o.state.tr.setMeta(k, {
1458
- setDragging: { startX: e.clientX, startWidth: s }
1459
- }));
1509
+ const s = o.state.doc.nodeAt(n.activeHandle), l = Sn(o, n.activeHandle, s.attrs);
1510
+ o.dispatch(
1511
+ o.state.tr.setMeta(k, {
1512
+ setDragging: { startX: e.clientX, startWidth: l }
1513
+ })
1514
+ );
1460
1515
  function r(i) {
1461
1516
  window.removeEventListener("mouseup", r), window.removeEventListener("mousemove", a);
1462
1517
  const c = k.getState(o.state);
1463
- c.dragging && (Mn(o, c.activeHandle, Fe(c.dragging, i, t)), o.dispatch(o.state.tr.setMeta(k, { setDragging: null })));
1518
+ c.dragging && (xn(o, c.activeHandle, Be(c.dragging, i, t)), o.dispatch(o.state.tr.setMeta(k, { setDragging: null })));
1464
1519
  }
1465
1520
  function a(i) {
1466
1521
  if (!i.which)
1467
1522
  return r(i);
1468
- const c = k.getState(o.state), d = Fe(c.dragging, i, t);
1469
- Nn(o, c.activeHandle, d, t);
1523
+ const c = k.getState(o.state), d = Be(c.dragging, i, t);
1524
+ Rn(o, c.activeHandle, d, t);
1470
1525
  }
1471
1526
  return window.addEventListener("mouseup", r), window.addEventListener("mousemove", a), e.preventDefault(), !0;
1472
1527
  }
1473
- function kn(o, e, { colspan: t, colwidth: n }) {
1474
- const l = n && n[n.length - 1];
1475
- if (l)
1476
- return l;
1477
- const s = o.domAtPos(e);
1478
- let a = s.node.childNodes[s.offset].offsetWidth, i = t;
1528
+ function Sn(o, e, { colspan: t, colwidth: n }) {
1529
+ const s = n && n[n.length - 1];
1530
+ if (s)
1531
+ return s;
1532
+ const l = o.domAtPos(e);
1533
+ let a = l.node.childNodes[l.offset].offsetWidth, i = t;
1479
1534
  if (n)
1480
1535
  for (let c = 0; c < t; c++)
1481
1536
  n[c] && (a -= n[c], i--);
1482
1537
  return a / i;
1483
1538
  }
1484
- function An(o) {
1539
+ function Nn(o) {
1485
1540
  for (; o && o.nodeName != "TD" && o.nodeName != "TH"; )
1486
1541
  o = o.classList.contains("ProseMirror") ? null : o.parentNode;
1487
1542
  return o;
1488
1543
  }
1489
- function ze(o, e, t) {
1544
+ function Fe(o, e, t) {
1490
1545
  const n = o.posAtCoords({ left: e.clientX, top: e.clientY });
1491
1546
  if (!n)
1492
1547
  return -1;
1493
- const { pos: l } = n, s = X(o.state.doc.resolve(l));
1494
- if (!s)
1548
+ const { pos: s } = n, l = V(o.state.doc.resolve(s));
1549
+ if (!l)
1495
1550
  return -1;
1496
1551
  if (t == "right")
1497
- return s.pos;
1498
- const r = g.get(s.node(-1)), a = s.start(-1), i = r.map.indexOf(s.pos - a);
1552
+ return l.pos;
1553
+ const r = g.get(l.node(-1)), a = l.start(-1), i = r.map.indexOf(l.pos - a);
1499
1554
  return i % r.width == 0 ? -1 : a + r.map[i - 1];
1500
1555
  }
1501
- function Fe(o, e, t) {
1556
+ function Be(o, e, t) {
1502
1557
  const n = e.clientX - o.startX;
1503
1558
  return Math.max(t, o.startWidth + n);
1504
1559
  }
1505
- function tt(o, e) {
1560
+ function nt(o, e) {
1506
1561
  o.dispatch(o.state.tr.setMeta(k, { setHandle: e }));
1507
1562
  }
1508
- function Mn(o, e, t) {
1509
- const n = o.state.doc.resolve(e), l = n.node(-1), s = g.get(l), r = n.start(-1), a = s.colCount(n.pos - r) + n.nodeAfter.attrs.colspan - 1, i = o.state.tr;
1510
- for (let c = 0; c < s.height; c++) {
1511
- const d = c * s.width + a;
1512
- if (c && s.map[d] == s.map[d - s.width])
1563
+ function xn(o, e, t) {
1564
+ const n = o.state.doc.resolve(e), s = n.node(-1), l = g.get(s), r = n.start(-1), a = l.colCount(n.pos - r) + n.nodeAfter.attrs.colspan - 1, i = o.state.tr;
1565
+ for (let c = 0; c < l.height; c++) {
1566
+ const d = c * l.width + a;
1567
+ if (c && l.map[d] == l.map[d - l.width])
1513
1568
  continue;
1514
- const f = s.map[d], { attrs: u } = l.nodeAt(f), p = u.colspan == 1 ? 0 : a - s.colCount(f);
1569
+ const f = l.map[d], { attrs: u } = s.nodeAt(f), p = u.colspan == 1 ? 0 : a - l.colCount(f);
1515
1570
  if (u.colwidth && u.colwidth[p] == t)
1516
1571
  continue;
1517
- const h = u.colwidth ? u.colwidth.slice() : Sn(u.colspan);
1572
+ const h = u.colwidth ? u.colwidth.slice() : Tn(u.colspan);
1518
1573
  h[p] = t, i.setNodeMarkup(r + f, null, y(u, "colwidth", h));
1519
1574
  }
1520
1575
  i.docChanged && o.dispatch(i);
1521
1576
  }
1522
- function Nn(o, e, t, n) {
1523
- const l = o.state.doc.resolve(e), s = l.node(-1), r = l.start(-1), a = g.get(s).colCount(l.pos - r) + l.nodeAfter.attrs.colspan - 1;
1524
- let i = o.domAtPos(l.start(-1)).node;
1577
+ function Rn(o, e, t, n) {
1578
+ const s = o.state.doc.resolve(e), l = s.node(-1), r = s.start(-1), a = g.get(l).colCount(s.pos - r) + s.nodeAfter.attrs.colspan - 1;
1579
+ let i = o.domAtPos(s.start(-1)).node;
1525
1580
  for (; i.nodeName != "TABLE"; )
1526
1581
  i = i.parentNode;
1527
- pe(s, i.firstChild, i, n, a, t);
1582
+ he(l, i.firstChild, i, n, a, t);
1528
1583
  }
1529
- function Sn(o) {
1584
+ function Tn(o) {
1530
1585
  const e = [];
1531
1586
  for (let t = 0; t < o; t++)
1532
1587
  e.push(0);
1533
1588
  return e;
1534
1589
  }
1535
- function xn(o, e) {
1536
- const t = [], n = o.doc.resolve(e), l = n.node(-1), s = g.get(l), r = n.start(-1), a = s.colCount(n.pos - r) + n.nodeAfter.attrs.colspan;
1537
- for (let i = 0; i < s.height; i++) {
1538
- const c = a + i * s.width - 1;
1539
- if ((a == s.width || s.map[c] != s.map[c + 1]) && (i == 0 || s.map[c - 1] != s.map[c - 1 - s.width])) {
1540
- const d = s.map[c], f = r + d + l.nodeAt(d).nodeSize - 1, u = document.createElement("div");
1541
- u.className = "column-resize-handle", t.push(Ae.widget(f, u));
1590
+ function Ln(o, e) {
1591
+ const t = [], n = o.doc.resolve(e), s = n.node(-1), l = g.get(s), r = n.start(-1), a = l.colCount(n.pos - r) + n.nodeAfter.attrs.colspan;
1592
+ for (let i = 0; i < l.height; i++) {
1593
+ const c = a + i * l.width - 1;
1594
+ if ((a == l.width || l.map[c] != l.map[c + 1]) && (i == 0 || l.map[c - 1] != l.map[c - 1 - l.width])) {
1595
+ const d = l.map[c], f = r + d + s.nodeAt(d).nodeSize - 1, u = document.createElement("div");
1596
+ u.className = "column-resize-handle", t.push(Me.widget(f, u));
1542
1597
  }
1543
1598
  }
1544
- return Me.create(o.doc, t);
1599
+ return Se.create(o.doc, t);
1545
1600
  }
1546
- function Rn(o) {
1601
+ function vn(o) {
1547
1602
  if (!o.size)
1548
1603
  return null;
1549
1604
  let { content: e, openStart: t, openEnd: n } = o;
1550
1605
  for (; e.childCount == 1 && (t > 0 && n > 0 || e.firstChild.type.spec.tableRole == "table"); )
1551
1606
  t--, n--, e = e.firstChild.content;
1552
- const l = e.firstChild, s = l.type.spec.tableRole, r = l.type.schema, a = [];
1553
- if (s == "row")
1607
+ const s = e.firstChild, l = s.type.spec.tableRole, r = s.type.schema, a = [];
1608
+ if (l == "row")
1554
1609
  for (let i = 0; i < e.childCount; i++) {
1555
1610
  let c = e.child(i).content;
1556
1611
  const d = i ? 0 : Math.max(0, t - 1), f = i < e.childCount - 1 ? 0 : Math.max(0, n - 1);
1557
- (d || f) && (c = he(A(r).row, new O(c, d, f)).content), a.push(c);
1612
+ (d || f) && (c = me(A(r).row, new _(c, d, f)).content), a.push(c);
1558
1613
  }
1559
- else if (s == "cell" || s == "header_cell")
1560
- a.push(t || n ? he(A(r).row, new O(e, t, n)).content : e);
1614
+ else if (l == "cell" || l == "header_cell")
1615
+ a.push(
1616
+ t || n ? me(A(r).row, new _(e, t, n)).content : e
1617
+ );
1561
1618
  else
1562
1619
  return null;
1563
- return Tn(r, a);
1620
+ return En(r, a);
1564
1621
  }
1565
- function Tn(o, e) {
1622
+ function En(o, e) {
1566
1623
  const t = [];
1567
- for (let l = 0; l < e.length; l++) {
1568
- const s = e[l];
1569
- for (let r = s.childCount - 1; r >= 0; r--) {
1570
- const { rowspan: a, colspan: i } = s.child(r).attrs;
1571
- for (let c = l; c < l + a; c++)
1624
+ for (let s = 0; s < e.length; s++) {
1625
+ const l = e[s];
1626
+ for (let r = l.childCount - 1; r >= 0; r--) {
1627
+ const { rowspan: a, colspan: i } = l.child(r).attrs;
1628
+ for (let c = s; c < s + a; c++)
1572
1629
  t[c] = (t[c] || 0) + i;
1573
1630
  }
1574
1631
  }
1575
1632
  let n = 0;
1576
- for (let l = 0; l < t.length; l++)
1577
- n = Math.max(n, t[l]);
1578
- for (let l = 0; l < t.length; l++)
1579
- if (l >= e.length && e.push(I.empty), t[l] < n) {
1580
- const s = A(o).cell.createAndFill(), r = [];
1581
- for (let a = t[l]; a < n; a++)
1582
- r.push(s);
1583
- e[l] = e[l].append(I.from(r));
1633
+ for (let s = 0; s < t.length; s++)
1634
+ n = Math.max(n, t[s]);
1635
+ for (let s = 0; s < t.length; s++)
1636
+ if (s >= e.length && e.push($.empty), t[s] < n) {
1637
+ const l = A(o).cell.createAndFill(), r = [];
1638
+ for (let a = t[s]; a < n; a++)
1639
+ r.push(l);
1640
+ e[s] = e[s].append($.from(r));
1584
1641
  }
1585
1642
  return { height: e.length, width: n, rows: e };
1586
1643
  }
1587
- function he(o, e) {
1644
+ function me(o, e) {
1588
1645
  const t = o.createAndFill();
1589
- return new At(t).replace(0, t.content.size, e).doc;
1646
+ return new Nt(t).replace(0, t.content.size, e).doc;
1590
1647
  }
1591
- function Ln({ width: o, height: e, rows: t }, n, l) {
1648
+ function $n({ width: o, height: e, rows: t }, n, s) {
1592
1649
  if (o != n) {
1593
- const s = [], r = [];
1650
+ const l = [], r = [];
1594
1651
  for (let a = 0; a < t.length; a++) {
1595
1652
  const i = t[a], c = [];
1596
- for (let d = s[a] || 0, f = 0; d < n; f++) {
1653
+ for (let d = l[a] || 0, f = 0; d < n; f++) {
1597
1654
  let u = i.child(f % i.childCount);
1598
- d + u.attrs.colspan > n && (u = u.type.create(z(u.attrs, u.attrs.colspan, d + u.attrs.colspan - n), u.content)), c.push(u), d += u.attrs.colspan;
1655
+ d + u.attrs.colspan > n && (u = u.type.create(
1656
+ F(u.attrs, u.attrs.colspan, d + u.attrs.colspan - n),
1657
+ u.content
1658
+ )), c.push(u), d += u.attrs.colspan;
1599
1659
  for (let p = 1; p < u.attrs.rowspan; p++)
1600
- s[a + p] = (s[a + p] || 0) + u.attrs.colspan;
1660
+ l[a + p] = (l[a + p] || 0) + u.attrs.colspan;
1601
1661
  }
1602
- r.push(I.from(c));
1662
+ r.push($.from(c));
1603
1663
  }
1604
1664
  t = r, o = n;
1605
1665
  }
1606
- if (e != l) {
1607
- const s = [];
1608
- for (let r = 0, a = 0; r < l; r++, a++) {
1666
+ if (e != s) {
1667
+ const l = [];
1668
+ for (let r = 0, a = 0; r < s; r++, a++) {
1609
1669
  const i = [], c = t[a % e];
1610
1670
  for (let d = 0; d < c.childCount; d++) {
1611
1671
  let f = c.child(d);
1612
- r + f.attrs.rowspan > l && (f = f.type.create(y(f.attrs, "rowspan", Math.max(1, l - f.attrs.rowspan)), f.content)), i.push(f);
1672
+ r + f.attrs.rowspan > s && (f = f.type.create(
1673
+ y(f.attrs, "rowspan", Math.max(1, s - f.attrs.rowspan)),
1674
+ f.content
1675
+ )), i.push(f);
1613
1676
  }
1614
- s.push(I.from(i));
1677
+ l.push($.from(i));
1615
1678
  }
1616
- t = s, e = l;
1679
+ t = l, e = s;
1617
1680
  }
1618
1681
  return { width: o, height: e, rows: t };
1619
1682
  }
1620
- function vn(o, e, t, n, l, s, r) {
1683
+ function In(o, e, t, n, s, l, r) {
1621
1684
  const a = o.doc.type.schema, i = A(a);
1622
1685
  let c, d;
1623
- if (l > e.width)
1686
+ if (s > e.width)
1624
1687
  for (let f = 0, u = 0; f < e.height; f++) {
1625
1688
  const p = t.child(f);
1626
1689
  u += p.nodeSize;
1627
1690
  const h = [];
1628
1691
  let b;
1629
1692
  p.lastChild == null || p.lastChild.type == i.cell ? b = c || (c = i.cell.createAndFill()) : b = d || (d = i.header_cell.createAndFill());
1630
- for (let w = e.width; w < l; w++)
1693
+ for (let w = e.width; w < s; w++)
1631
1694
  h.push(b);
1632
1695
  o.insert(o.mapping.slice(r).map(u - 1 + n), h);
1633
1696
  }
1634
- if (s > e.height) {
1697
+ if (l > e.height) {
1635
1698
  const f = [];
1636
- for (let h = 0, b = (e.height - 1) * e.width; h < Math.max(e.width, l); h++) {
1699
+ for (let h = 0, b = (e.height - 1) * e.width; h < Math.max(e.width, s); h++) {
1637
1700
  const w = h >= e.width ? !1 : t.nodeAt(e.map[b + h]).type == i.header_cell;
1638
- f.push(w ? d || (d = i.header_cell.createAndFill()) : c || (c = i.cell.createAndFill()));
1701
+ f.push(
1702
+ w ? d || (d = i.header_cell.createAndFill()) : c || (c = i.cell.createAndFill())
1703
+ );
1639
1704
  }
1640
- const u = i.row.create(null, I.from(f)), p = [];
1641
- for (let h = e.height; h < s; h++)
1705
+ const u = i.row.create(null, $.from(f)), p = [];
1706
+ for (let h = e.height; h < l; h++)
1642
1707
  p.push(u);
1643
1708
  o.insert(o.mapping.slice(r).map(n + t.nodeSize - 2), p);
1644
1709
  }
1645
1710
  return !!(c || d);
1646
1711
  }
1647
- function Be(o, e, t, n, l, s, r, a) {
1712
+ function We(o, e, t, n, s, l, r, a) {
1648
1713
  if (r == 0 || r == e.height)
1649
1714
  return !1;
1650
1715
  let i = !1;
1651
- for (let c = l; c < s; c++) {
1716
+ for (let c = s; c < l; c++) {
1652
1717
  const d = r * e.width + c, f = e.map[d];
1653
1718
  if (e.map[d - e.width] == f) {
1654
1719
  i = !0;
1655
1720
  const u = t.nodeAt(f), { top: p, left: h } = e.findCell(f);
1656
- o.setNodeMarkup(o.mapping.slice(a).map(f + n), null, y(u.attrs, "rowspan", r - p)), o.insert(o.mapping.slice(a).map(e.positionAt(r, h, t)), u.type.createAndFill(y(u.attrs, "rowspan", p + u.attrs.rowspan - r))), c += u.attrs.colspan - 1;
1721
+ o.setNodeMarkup(
1722
+ o.mapping.slice(a).map(f + n),
1723
+ null,
1724
+ y(u.attrs, "rowspan", r - p)
1725
+ ), o.insert(
1726
+ o.mapping.slice(a).map(e.positionAt(r, h, t)),
1727
+ u.type.createAndFill(y(u.attrs, "rowspan", p + u.attrs.rowspan - r))
1728
+ ), c += u.attrs.colspan - 1;
1657
1729
  }
1658
1730
  }
1659
1731
  return i;
1660
1732
  }
1661
- function Pe(o, e, t, n, l, s, r, a) {
1733
+ function Pe(o, e, t, n, s, l, r, a) {
1662
1734
  if (r == 0 || r == e.width)
1663
1735
  return !1;
1664
1736
  let i = !1;
1665
- for (let c = l; c < s; c++) {
1737
+ for (let c = s; c < l; c++) {
1666
1738
  const d = c * e.width + r, f = e.map[d];
1667
1739
  if (e.map[d - 1] == f) {
1668
1740
  i = !0;
1669
1741
  const u = t.nodeAt(f), p = e.colCount(f), h = o.mapping.slice(a).map(f + n);
1670
- o.setNodeMarkup(h, null, z(u.attrs, r - p, u.attrs.colspan - (r - p))), o.insert(h + u.nodeSize, u.type.createAndFill(z(u.attrs, 0, r - p))), c += u.attrs.rowspan - 1;
1742
+ o.setNodeMarkup(
1743
+ h,
1744
+ null,
1745
+ F(u.attrs, r - p, u.attrs.colspan - (r - p))
1746
+ ), o.insert(
1747
+ h + u.nodeSize,
1748
+ u.type.createAndFill(F(u.attrs, 0, r - p))
1749
+ ), c += u.attrs.rowspan - 1;
1671
1750
  }
1672
1751
  }
1673
1752
  return i;
1674
1753
  }
1675
- function We(o, e, t, n, l) {
1676
- let s = t ? o.doc.nodeAt(t - 1) : o.doc, r = g.get(s);
1677
- const { top: a, left: i } = n, c = i + l.width, d = a + l.height, f = o.tr;
1754
+ function He(o, e, t, n, s) {
1755
+ let l = t ? o.doc.nodeAt(t - 1) : o.doc, r = g.get(l);
1756
+ const { top: a, left: i } = n, c = i + s.width, d = a + s.height, f = o.tr;
1678
1757
  let u = 0;
1679
1758
  function p() {
1680
- s = t ? f.doc.nodeAt(t - 1) : f.doc, r = g.get(s), u = f.mapping.maps.length;
1759
+ l = t ? f.doc.nodeAt(t - 1) : f.doc, r = g.get(l), u = f.mapping.maps.length;
1681
1760
  }
1682
- vn(f, r, s, t, c, d, u) && p(), Be(f, r, s, t, i, c, a, u) && p(), Be(f, r, s, t, i, c, d, u) && p(), Pe(f, r, s, t, a, d, i, u) && p(), Pe(f, r, s, t, a, d, c, u) && p();
1761
+ In(f, r, l, t, c, d, u) && p(), We(f, r, l, t, i, c, a, u) && p(), We(f, r, l, t, i, c, d, u) && p(), Pe(f, r, l, t, a, d, i, u) && p(), Pe(f, r, l, t, a, d, c, u) && p();
1683
1762
  for (let h = a; h < d; h++) {
1684
- const b = r.positionAt(h, i, s), w = r.positionAt(h, c, s);
1685
- f.replace(f.mapping.slice(u).map(b + t), f.mapping.slice(u).map(w + t), new O(l.rows[h - a], 0, 0));
1686
- }
1687
- p(), f.setSelection(new m(f.doc.resolve(t + r.positionAt(a, i, s)), f.doc.resolve(t + r.positionAt(d - 1, c - 1, s)))), e(f);
1688
- }
1689
- const En = new F("fix-tables");
1690
- function nt(o, e, t, n) {
1691
- const l = o.childCount, s = e.childCount;
1763
+ const b = r.positionAt(h, i, l), w = r.positionAt(h, c, l);
1764
+ f.replace(
1765
+ f.mapping.slice(u).map(b + t),
1766
+ f.mapping.slice(u).map(w + t),
1767
+ new _(s.rows[h - a], 0, 0)
1768
+ );
1769
+ }
1770
+ p(), f.setSelection(
1771
+ new m(
1772
+ f.doc.resolve(t + r.positionAt(a, i, l)),
1773
+ f.doc.resolve(t + r.positionAt(d - 1, c - 1, l))
1774
+ )
1775
+ ), e(f);
1776
+ }
1777
+ const Dn = new B("fix-tables");
1778
+ function ot(o, e, t, n) {
1779
+ const s = o.childCount, l = e.childCount;
1692
1780
  e:
1693
- for (let r = 0, a = 0; r < s; r++) {
1781
+ for (let r = 0, a = 0; r < l; r++) {
1694
1782
  const i = e.child(r);
1695
- for (let c = a, d = Math.min(l, r + 3); c < d; c++)
1783
+ for (let c = a, d = Math.min(s, r + 3); c < d; c++)
1696
1784
  if (o.child(c) == i) {
1697
1785
  a = c + 1, t += i.nodeSize;
1698
1786
  continue e;
1699
1787
  }
1700
- n(i, t), a < l && o.child(a).sameMarkup(i) ? nt(o.child(a), i, t + 1, n) : i.nodesBetween(0, i.content.size, n, t + 1), t += i.nodeSize;
1788
+ n(i, t), a < s && o.child(a).sameMarkup(i) ? ot(o.child(a), i, t + 1, n) : i.nodesBetween(0, i.content.size, n, t + 1), t += i.nodeSize;
1701
1789
  }
1702
1790
  }
1703
- function In(o, e) {
1791
+ function On(o, e) {
1704
1792
  let t;
1705
- const n = (l, s) => {
1706
- l.type.spec.tableRole == "table" && (t = $n(o, l, s, t));
1793
+ const n = (s, l) => {
1794
+ s.type.spec.tableRole == "table" && (t = _n(o, s, l, t));
1707
1795
  };
1708
- return e ? e.doc != o.doc && nt(e.doc, o.doc, 0, n) : o.doc.descendants(n), t;
1796
+ return e ? e.doc != o.doc && ot(e.doc, o.doc, 0, n) : o.doc.descendants(n), t;
1709
1797
  }
1710
- function $n(o, e, t, n) {
1711
- const l = g.get(e);
1712
- if (!l.problems)
1798
+ function _n(o, e, t, n) {
1799
+ const s = g.get(e);
1800
+ if (!s.problems)
1713
1801
  return n;
1714
1802
  n || (n = o.tr);
1715
- const s = [];
1716
- for (let i = 0; i < l.height; i++)
1717
- s.push(0);
1718
- for (let i = 0; i < l.problems.length; i++) {
1719
- const c = l.problems[i];
1803
+ const l = [];
1804
+ for (let i = 0; i < s.height; i++)
1805
+ l.push(0);
1806
+ for (let i = 0; i < s.problems.length; i++) {
1807
+ const c = s.problems[i];
1720
1808
  if (c.type == "collision") {
1721
1809
  const d = e.nodeAt(c.pos);
1722
1810
  for (let f = 0; f < d.attrs.rowspan; f++)
1723
- s[c.row + f] += c.n;
1724
- n.setNodeMarkup(n.mapping.map(t + 1 + c.pos), null, z(d.attrs, d.attrs.colspan - c.n, c.n));
1811
+ l[c.row + f] += c.n;
1812
+ n.setNodeMarkup(
1813
+ n.mapping.map(t + 1 + c.pos),
1814
+ null,
1815
+ F(d.attrs, d.attrs.colspan - c.n, c.n)
1816
+ );
1725
1817
  } else if (c.type == "missing")
1726
- s[c.row] += c.n;
1818
+ l[c.row] += c.n;
1727
1819
  else if (c.type == "overlong_rowspan") {
1728
1820
  const d = e.nodeAt(c.pos);
1729
- n.setNodeMarkup(n.mapping.map(t + 1 + c.pos), null, y(d.attrs, "rowspan", d.attrs.rowspan - c.n));
1821
+ n.setNodeMarkup(
1822
+ n.mapping.map(t + 1 + c.pos),
1823
+ null,
1824
+ y(d.attrs, "rowspan", d.attrs.rowspan - c.n)
1825
+ );
1730
1826
  } else if (c.type == "colwidth mismatch") {
1731
1827
  const d = e.nodeAt(c.pos);
1732
- n.setNodeMarkup(n.mapping.map(t + 1 + c.pos), null, y(d.attrs, "colwidth", c.colwidth));
1828
+ n.setNodeMarkup(
1829
+ n.mapping.map(t + 1 + c.pos),
1830
+ null,
1831
+ y(d.attrs, "colwidth", c.colwidth)
1832
+ );
1733
1833
  }
1734
1834
  }
1735
1835
  let r, a;
1736
- for (let i = 0; i < s.length; i++)
1737
- s[i] && (r == null && (r = i), a = i);
1738
- for (let i = 0, c = t + 1; i < l.height; i++) {
1739
- const d = e.child(i), f = c + d.nodeSize, u = s[i];
1836
+ for (let i = 0; i < l.length; i++)
1837
+ l[i] && (r == null && (r = i), a = i);
1838
+ for (let i = 0, c = t + 1; i < s.height; i++) {
1839
+ const d = e.child(i), f = c + d.nodeSize, u = l[i];
1740
1840
  if (u > 0) {
1741
1841
  let p = "cell";
1742
1842
  d.firstChild && (p = d.firstChild.type.spec.tableRole);
@@ -1748,34 +1848,37 @@ function $n(o, e, t, n) {
1748
1848
  }
1749
1849
  c = f;
1750
1850
  }
1751
- return n.setMeta(En, { fixTables: !0 });
1851
+ return n.setMeta(Dn, { fixTables: !0 });
1752
1852
  }
1753
- const $ = new F("selectingCells");
1754
- function He(o, e) {
1853
+ const D = new B("selectingCells");
1854
+ function je(o, e) {
1755
1855
  for (; e && e != o.dom; e = e.parentNode)
1756
1856
  if (e.nodeName == "TD" || e.nodeName == "TH")
1757
1857
  return e;
1758
1858
  }
1759
- function de(o, e) {
1760
- const t = o.posAtCoords({ left: e.clientX, top: e.clientY });
1761
- return t && t ? X(o.state.doc.resolve(t.pos)) : null;
1859
+ function fe(o, e) {
1860
+ const t = o.posAtCoords({
1861
+ left: e.clientX,
1862
+ top: e.clientY
1863
+ });
1864
+ return t && t ? V(o.state.doc.resolve(t.pos)) : null;
1762
1865
  }
1763
- function Dn(o, e) {
1866
+ function zn(o, e) {
1764
1867
  const t = e;
1765
1868
  if (t.ctrlKey || t.metaKey)
1766
1869
  return;
1767
- const n = He(o, t.target);
1768
- let l;
1870
+ const n = je(o, t.target);
1871
+ let s;
1769
1872
  if (t.shiftKey && o.state.selection instanceof m)
1770
- s(o.state.selection.$anchorCell, t), t.preventDefault();
1771
- else if (t.shiftKey && n && (l = X(o.state.selection.$anchor)) != null && de(o, t).pos != l.pos)
1772
- s(l, t), t.preventDefault();
1873
+ l(o.state.selection.$anchorCell, t), t.preventDefault();
1874
+ else if (t.shiftKey && n && (s = V(o.state.selection.$anchor)) != null && fe(o, t).pos != s.pos)
1875
+ l(s, t), t.preventDefault();
1773
1876
  else if (!n)
1774
1877
  return;
1775
- function s(i, c) {
1776
- let d = de(o, c);
1777
- const f = $.getState(o.state) == null;
1778
- if (!d || !Se(i, d))
1878
+ function l(i, c) {
1879
+ let d = fe(o, c);
1880
+ const f = D.getState(o.state) == null;
1881
+ if (!d || !xe(i, d))
1779
1882
  if (f)
1780
1883
  d = i;
1781
1884
  else
@@ -1783,201 +1886,234 @@ function Dn(o, e) {
1783
1886
  const u = new m(i, d);
1784
1887
  if (f || !o.state.selection.eq(u)) {
1785
1888
  const p = o.state.tr.setSelection(u);
1786
- f && p.setMeta($, i.pos), o.dispatch(p);
1889
+ f && p.setMeta(D, i.pos), o.dispatch(p);
1787
1890
  }
1788
1891
  }
1789
1892
  function r() {
1790
- o.root.removeEventListener("mouseup", r), o.root.removeEventListener("dragstart", r), o.root.removeEventListener("mousemove", a), $.getState(o.state) != null && o.dispatch(o.state.tr.setMeta($, -1));
1893
+ o.root.removeEventListener("mouseup", r), o.root.removeEventListener("dragstart", r), o.root.removeEventListener("mousemove", a), D.getState(o.state) != null && o.dispatch(o.state.tr.setMeta(D, -1));
1791
1894
  }
1792
1895
  function a(i) {
1793
- const c = $.getState(o.state);
1896
+ const c = D.getState(o.state);
1794
1897
  let d;
1795
1898
  if (c != null)
1796
1899
  d = o.state.doc.resolve(c);
1797
- else if (He(o, i.target) != n && (d = de(o, t), !d))
1900
+ else if (je(o, i.target) != n && (d = fe(o, t), !d))
1798
1901
  return r();
1799
- d && s(d, i);
1902
+ d && l(d, i);
1800
1903
  }
1801
1904
  o.root.addEventListener("mouseup", r), o.root.addEventListener("dragstart", r), o.root.addEventListener("mousemove", a);
1802
1905
  }
1803
- function On(o, e) {
1804
- const t = o.state.doc, n = X(t.resolve(e));
1906
+ function Fn(o, e) {
1907
+ const t = o.state.doc, n = V(t.resolve(e));
1805
1908
  return n ? (o.dispatch(o.state.tr.setSelection(new m(n))), !0) : !1;
1806
1909
  }
1807
- function Q(o, e, t) {
1910
+ function te(o, e, t) {
1808
1911
  return t.eq(o.selection) ? !1 : (e && e(o.tr.setSelection(t).scrollIntoView()), !0);
1809
1912
  }
1810
- function ot(o, e, t) {
1913
+ function st(o, e, t) {
1811
1914
  if (!(o.state.selection instanceof E))
1812
1915
  return null;
1813
1916
  const { $head: n } = o.state.selection;
1814
- for (let l = n.depth - 1; l >= 0; l--) {
1815
- const s = n.node(l);
1816
- if ((t < 0 ? n.index(l) : n.indexAfter(l)) != (t < 0 ? 0 : s.childCount))
1917
+ for (let s = n.depth - 1; s >= 0; s--) {
1918
+ const l = n.node(s);
1919
+ if ((t < 0 ? n.index(s) : n.indexAfter(s)) != (t < 0 ? 0 : l.childCount))
1817
1920
  return null;
1818
- if (s.type.spec.tableRole == "cell" || s.type.spec.tableRole == "header_cell") {
1819
- const a = n.before(l), i = e == "vert" ? t > 0 ? "down" : "up" : t > 0 ? "right" : "left";
1921
+ if (l.type.spec.tableRole == "cell" || l.type.spec.tableRole == "header_cell") {
1922
+ const a = n.before(s), i = e == "vert" ? t > 0 ? "down" : "up" : t > 0 ? "right" : "left";
1820
1923
  return o.endOfTextblock(i) ? a : null;
1821
1924
  }
1822
1925
  }
1823
1926
  return null;
1824
1927
  }
1825
- function J(o, e) {
1826
- return (t, n, l) => {
1827
- const s = t.selection;
1828
- if (s instanceof m)
1829
- return Q(t, n, N.near(s.$headCell, e));
1830
- if (o != "horiz" && !s.empty)
1928
+ function Z(o, e) {
1929
+ return (t, n, s) => {
1930
+ const l = t.selection;
1931
+ if (l instanceof m)
1932
+ return te(
1933
+ t,
1934
+ n,
1935
+ S.near(l.$headCell, e)
1936
+ );
1937
+ if (o != "horiz" && !l.empty)
1831
1938
  return !1;
1832
- const r = ot(l, o, e);
1939
+ const r = st(s, o, e);
1833
1940
  if (r == null)
1834
1941
  return !1;
1835
1942
  if (o == "horiz")
1836
- return Q(t, n, N.near(t.doc.resolve(s.head + e), e));
1943
+ return te(
1944
+ t,
1945
+ n,
1946
+ S.near(t.doc.resolve(l.head + e), e)
1947
+ );
1837
1948
  {
1838
- const a = t.doc.resolve(r), i = Qe(a, o, e);
1949
+ const a = t.doc.resolve(r), i = et(a, o, e);
1839
1950
  let c;
1840
- return i ? c = N.near(i, 1) : e < 0 ? c = N.near(t.doc.resolve(a.before(-1)), -1) : c = N.near(t.doc.resolve(a.after(-1)), 1), Q(t, n, c);
1951
+ return i ? c = S.near(i, 1) : e < 0 ? c = S.near(t.doc.resolve(a.before(-1)), -1) : c = S.near(t.doc.resolve(a.after(-1)), 1), te(t, n, c);
1841
1952
  }
1842
1953
  };
1843
1954
  }
1844
- function Y(o, e) {
1845
- return (t, n, l) => {
1846
- let s = t.selection;
1847
- if (!(s instanceof m)) {
1848
- const a = ot(l, o, e);
1955
+ function Q(o, e) {
1956
+ return (t, n, s) => {
1957
+ let l = t.selection;
1958
+ if (!(l instanceof m)) {
1959
+ const a = st(s, o, e);
1849
1960
  if (a == null)
1850
1961
  return !1;
1851
- s = new m(t.doc.resolve(a));
1962
+ l = new m(t.doc.resolve(a));
1852
1963
  }
1853
- const r = Qe(s.$headCell, o, e);
1854
- return r ? Q(t, n, new m(s.$anchorCell, r)) : !1;
1964
+ const r = et(l.$headCell, o, e);
1965
+ return r ? te(
1966
+ t,
1967
+ n,
1968
+ new m(l.$anchorCell, r)
1969
+ ) : !1;
1855
1970
  };
1856
1971
  }
1857
- function Z(o, e) {
1972
+ function ee(o, e) {
1858
1973
  const t = o.selection;
1859
1974
  if (!(t instanceof m))
1860
1975
  return !1;
1861
1976
  if (e) {
1862
- const n = o.tr, l = A(o.schema).cell.createAndFill().content;
1863
- t.forEachCell((s, r) => {
1864
- s.content.eq(l) || n.replace(n.mapping.map(r + 1), n.mapping.map(r + s.nodeSize - 1), new O(l, 0, 0));
1977
+ const n = o.tr, s = A(o.schema).cell.createAndFill().content;
1978
+ t.forEachCell((l, r) => {
1979
+ l.content.eq(s) || n.replace(
1980
+ n.mapping.map(r + 1),
1981
+ n.mapping.map(r + l.nodeSize - 1),
1982
+ new _(s, 0, 0)
1983
+ );
1865
1984
  }), n.docChanged && e(n);
1866
1985
  }
1867
1986
  return !0;
1868
1987
  }
1869
- const _n = kt({
1870
- ArrowLeft: J("horiz", -1),
1871
- ArrowRight: J("horiz", 1),
1872
- ArrowUp: J("vert", -1),
1873
- ArrowDown: J("vert", 1),
1874
- "Shift-ArrowLeft": Y("horiz", -1),
1875
- "Shift-ArrowRight": Y("horiz", 1),
1876
- "Shift-ArrowUp": Y("vert", -1),
1877
- "Shift-ArrowDown": Y("vert", 1),
1878
- Backspace: Z,
1879
- "Mod-Backspace": Z,
1880
- Delete: Z,
1881
- "Mod-Delete": Z
1988
+ const Bn = St({
1989
+ ArrowLeft: Z("horiz", -1),
1990
+ ArrowRight: Z("horiz", 1),
1991
+ ArrowUp: Z("vert", -1),
1992
+ ArrowDown: Z("vert", 1),
1993
+ "Shift-ArrowLeft": Q("horiz", -1),
1994
+ "Shift-ArrowRight": Q("horiz", 1),
1995
+ "Shift-ArrowUp": Q("vert", -1),
1996
+ "Shift-ArrowDown": Q("vert", 1),
1997
+ Backspace: ee,
1998
+ "Mod-Backspace": ee,
1999
+ Delete: ee,
2000
+ "Mod-Delete": ee
1882
2001
  });
1883
- function zn(o, e, t) {
2002
+ function Wn(o, e, t) {
1884
2003
  if (!M(o.state))
1885
2004
  return !1;
1886
- let n = Rn(t);
1887
- const l = o.state.selection;
1888
- if (l instanceof m) {
2005
+ let n = vn(t);
2006
+ const s = o.state.selection;
2007
+ if (s instanceof m) {
1889
2008
  n || (n = {
1890
2009
  width: 1,
1891
2010
  height: 1,
1892
- rows: [I.from(he(A(o.state.schema).cell, t))]
2011
+ rows: [
2012
+ $.from(
2013
+ me(A(o.state.schema).cell, t)
2014
+ )
2015
+ ]
1893
2016
  });
1894
- const s = l.$anchorCell.node(-1), r = l.$anchorCell.start(-1), a = g.get(s).rectBetween(l.$anchorCell.pos - r, l.$headCell.pos - r);
1895
- return n = Ln(n, a.right - a.left, a.bottom - a.top), We(o.state, o.dispatch, r, a, n), !0;
2017
+ const l = s.$anchorCell.node(-1), r = s.$anchorCell.start(-1), a = g.get(l).rectBetween(
2018
+ s.$anchorCell.pos - r,
2019
+ s.$headCell.pos - r
2020
+ );
2021
+ return n = $n(n, a.right - a.left, a.bottom - a.top), He(o.state, o.dispatch, r, a, n), !0;
1896
2022
  } else if (n) {
1897
- const s = oe(o.state), r = s.start(-1);
1898
- return We(o.state, o.dispatch, r, g.get(s.node(-1)).findCell(s.pos - r), n), !0;
2023
+ const l = se(o.state), r = l.start(-1);
2024
+ return He(
2025
+ o.state,
2026
+ o.dispatch,
2027
+ r,
2028
+ g.get(l.node(-1)).findCell(l.pos - r),
2029
+ n
2030
+ ), !0;
1899
2031
  } else
1900
2032
  return !1;
1901
2033
  }
1902
- function Fn({ allowTableNodeSelection: o = !1 } = {}) {
1903
- return new W({
1904
- key: $,
2034
+ function Pn({ allowTableNodeSelection: o = !1 } = {}) {
2035
+ return new H({
2036
+ key: D,
1905
2037
  state: {
1906
2038
  init() {
1907
2039
  return null;
1908
2040
  },
1909
2041
  apply(e, t) {
1910
- const n = e.getMeta($);
2042
+ const n = e.getMeta(D);
1911
2043
  if (n != null)
1912
2044
  return n == -1 ? null : n;
1913
2045
  if (t == null || !e.docChanged)
1914
2046
  return t;
1915
- const { deleted: l, pos: s } = e.mapping.mapResult(t);
1916
- return l ? null : s;
2047
+ const { deleted: s, pos: l } = e.mapping.mapResult(t);
2048
+ return s ? null : l;
1917
2049
  }
1918
2050
  },
1919
2051
  props: {
1920
- decorations: _t,
2052
+ decorations: Bt,
1921
2053
  handleDOMEvents: {
1922
- mousedown: Dn
2054
+ mousedown: zn
1923
2055
  },
1924
2056
  createSelectionBetween(e) {
1925
- return $.getState(e.state) != null ? e.state.selection : null;
2057
+ return D.getState(e.state) != null ? e.state.selection : null;
1926
2058
  },
1927
- handleTripleClick: On,
1928
- handleKeyDown: _n,
1929
- handlePaste: zn
2059
+ handleTripleClick: Fn,
2060
+ handleKeyDown: Bn,
2061
+ handlePaste: Wn
1930
2062
  },
1931
2063
  appendTransaction(e, t, n) {
1932
- return Bt(n, In(n, t), o);
2064
+ return Ht(
2065
+ n,
2066
+ On(n, t),
2067
+ o
2068
+ );
1933
2069
  }
1934
2070
  });
1935
2071
  }
1936
- const ee = {
2072
+ const ne = {
1937
2073
  NextCell: "NextCell",
1938
2074
  PrevCell: "PrevCell",
1939
2075
  ExitTable: "ExitTable"
1940
- }, je = R("PrevCell"), Ke = R("NextCell"), qe = R("BreakTable"), Bn = R("InsertTable"), Pn = it((o) => ({
2076
+ }, Ke = R("PrevCell"), qe = R("NextCell"), Xe = R("BreakTable"), Hn = R("InsertTable"), jn = dt((o) => ({
1941
2077
  schema: () => ({
1942
2078
  node: {
1943
2079
  table: {
1944
- ...G.table,
2080
+ ...Y.table,
1945
2081
  parseMarkdown: {
1946
2082
  match: (e) => e.type === "table",
1947
2083
  runner: (e, t, n) => {
1948
- const l = t.align, s = t.children.map((r, a) => ({
2084
+ const s = t.align, l = t.children.map((r, a) => ({
1949
2085
  ...r,
1950
- align: l,
2086
+ align: s,
1951
2087
  isHeader: a === 0
1952
2088
  }));
1953
- e.openNode(n), e.next(s), e.closeNode();
2089
+ e.openNode(n), e.next(l), e.closeNode();
1954
2090
  }
1955
2091
  },
1956
2092
  toMarkdown: {
1957
2093
  match: (e) => e.type.name === "table",
1958
2094
  runner: (e, t) => {
1959
- var s;
1960
- const n = (s = t.content.firstChild) == null ? void 0 : s.content;
2095
+ var l;
2096
+ const n = (l = t.content.firstChild) == null ? void 0 : l.content;
1961
2097
  if (!n)
1962
2098
  return;
1963
- const l = [];
2099
+ const s = [];
1964
2100
  n.forEach((r) => {
1965
- l.push(r.attrs.alignment);
1966
- }), e.openNode("table", void 0, { align: l }), e.next(t.content), e.closeNode();
2101
+ s.push(r.attrs.alignment);
2102
+ }), e.openNode("table", void 0, { align: s }), e.next(t.content), e.closeNode();
1967
2103
  }
1968
2104
  }
1969
2105
  },
1970
2106
  table_row: {
1971
- ...G.table_row,
2107
+ ...Y.table_row,
1972
2108
  parseMarkdown: {
1973
2109
  match: (e) => e.type === "tableRow",
1974
2110
  runner: (e, t, n) => {
1975
- const l = t.align, s = t.children.map((r, a) => ({
2111
+ const s = t.align, l = t.children.map((r, a) => ({
1976
2112
  ...r,
1977
- align: l[a],
2113
+ align: s[a],
1978
2114
  isHeader: t.isHeader
1979
2115
  }));
1980
- e.openNode(n), e.next(s), e.closeNode();
2116
+ e.openNode(n), e.next(l), e.closeNode();
1981
2117
  }
1982
2118
  },
1983
2119
  toMarkdown: {
@@ -1988,12 +2124,12 @@ const ee = {
1988
2124
  }
1989
2125
  },
1990
2126
  table_cell: {
1991
- ...G.table_cell,
2127
+ ...Y.table_cell,
1992
2128
  parseMarkdown: {
1993
2129
  match: (e) => e.type === "tableCell" && !e.isHeader,
1994
2130
  runner: (e, t, n) => {
1995
- const l = t.align;
1996
- e.openNode(n, { alignment: l }).openNode(e.schema.nodes.paragraph).next(t.children).closeNode().closeNode();
2131
+ const s = t.align;
2132
+ e.openNode(n, { alignment: s }).openNode(e.schema.nodes.paragraph).next(t.children).closeNode().closeNode();
1997
2133
  }
1998
2134
  },
1999
2135
  toMarkdown: {
@@ -2004,12 +2140,12 @@ const ee = {
2004
2140
  }
2005
2141
  },
2006
2142
  table_header: {
2007
- ...G.table_header,
2143
+ ...Y.table_header,
2008
2144
  parseMarkdown: {
2009
2145
  match: (e) => e.type === "tableCell" && !!e.isHeader,
2010
2146
  runner: (e, t, n) => {
2011
- const l = t.align;
2012
- e.openNode(n, { alignment: l }), e.openNode(e.schema.nodes.paragraph), e.next(t.children), e.closeNode(), e.closeNode();
2147
+ const s = t.align;
2148
+ e.openNode(n, { alignment: s }), e.openNode(e.schema.nodes.paragraph), e.next(t.children), e.closeNode(), e.closeNode();
2013
2149
  }
2014
2150
  },
2015
2151
  toMarkdown: {
@@ -2022,44 +2158,48 @@ const ee = {
2022
2158
  }
2023
2159
  }),
2024
2160
  inputRules: (e, t) => [
2025
- new fe(/^\|\|\s$/, (n, l, s, r) => {
2026
- const a = n.doc.resolve(s);
2161
+ new ue(/^\|\|\s$/, (n, s, l, r) => {
2162
+ const a = n.doc.resolve(l);
2027
2163
  if (!a.node(-1).canReplaceWith(a.index(-1), a.indexAfter(-1), e.table))
2028
2164
  return null;
2029
- const i = ce(t.get(V)), c = n.tr.replaceRangeWith(s, r, i).scrollIntoView();
2030
- return c.setSelection(E.create(c.doc, s + 3));
2165
+ const i = ae(t.get(J)), c = n.tr.replaceRangeWith(l, r, i).scrollIntoView();
2166
+ return c.setSelection(E.create(c.doc, l + 3));
2031
2167
  }),
2032
- new fe(/^\|(?<col>\d+)[xX](?<row>\d+)\|\s$/, (n, l, s, r) => {
2168
+ new ue(/^\|(?<col>\d+)[xX](?<row>\d+)\|\s$/, (n, s, l, r) => {
2033
2169
  var d, f;
2034
- const a = n.doc.resolve(s);
2170
+ const a = n.doc.resolve(l);
2035
2171
  if (!a.node(-1).canReplaceWith(a.index(-1), a.indexAfter(-1), e.table))
2036
2172
  return null;
2037
- const i = ce(t.get(V), Number((d = l.groups) == null ? void 0 : d.row), Number((f = l.groups) == null ? void 0 : f.col)), c = n.tr.replaceRangeWith(s, r, i).scrollIntoView();
2038
- return c.setSelection(E.create(c.doc, s + 3));
2173
+ const i = ae(
2174
+ t.get(J),
2175
+ Number((d = s.groups) == null ? void 0 : d.row),
2176
+ Number((f = s.groups) == null ? void 0 : f.col)
2177
+ ), c = n.tr.replaceRangeWith(l, r, i).scrollIntoView();
2178
+ return c.setSelection(E.create(c.doc, l + 3));
2039
2179
  })
2040
2180
  ],
2041
2181
  commands: (e, t) => [
2042
- S(je, () => De(-1)),
2043
- S(Ke, () => De(1)),
2044
- S(qe, () => qt(t.get(V).nodes.paragraph)),
2045
- S(Bn, () => (n, l) => {
2046
- const { selection: s, tr: r } = n, { from: a } = s, i = ce(t.get(V)), c = r.replaceSelectionWith(i), d = N.findFrom(c.doc.resolve(a), 1, !0);
2047
- return d && (l == null || l(c.setSelection(d))), !0;
2182
+ N(Ke, () => Oe(-1)),
2183
+ N(qe, () => Oe(1)),
2184
+ N(Xe, () => Vt(t.get(J).nodes.paragraph)),
2185
+ N(Hn, () => (n, s) => {
2186
+ const { selection: l, tr: r } = n, { from: a } = l, i = ae(t.get(J)), c = r.replaceSelectionWith(i), d = S.findFrom(c.doc.resolve(a), 1, !0);
2187
+ return d && (s == null || s(c.setSelection(d))), !0;
2048
2188
  })
2049
2189
  ],
2050
2190
  shortcuts: {
2051
- [ee.NextCell]: D(Ke, "Mod-]"),
2052
- [ee.PrevCell]: D(je, "Mod-["),
2053
- [ee.ExitTable]: D(qe, "Mod-Enter")
2191
+ [ne.NextCell]: O(qe, "Mod-]"),
2192
+ [ne.PrevCell]: O(Ke, "Mod-["),
2193
+ [ne.ExitTable]: O(Xe, "Mod-Enter")
2054
2194
  },
2055
- prosePlugins: (e, t) => [fn(t, o), mn(), wn(), Fn()]
2056
- })), K = {
2057
- ...lt,
2058
- ...ee,
2195
+ prosePlugins: (e, t) => [hn(t, o), bn(), yn(), Pn()]
2196
+ })), q = {
2197
+ ...it,
2198
+ ...ne,
2059
2199
  StrikeThrough: "StrikeThrough",
2060
2200
  TaskList: "TaskList"
2061
- }, me = R("ToggleStrikeThrough"), Xe = "strike_through", Wn = ct((o) => ({
2062
- id: Xe,
2201
+ }, ge = R("ToggleStrikeThrough"), Ue = "strike_through", Kn = ft((o) => ({
2202
+ id: Ue,
2063
2203
  schema: () => ({
2064
2204
  inclusive: !1,
2065
2205
  parseDOM: [
@@ -2074,17 +2214,17 @@ const ee = {
2074
2214
  }
2075
2215
  },
2076
2216
  toMarkdown: {
2077
- match: (e) => e.type.name === Xe,
2217
+ match: (e) => e.type.name === Ue,
2078
2218
  runner: (e, t) => {
2079
2219
  e.withMark(t, "delete");
2080
2220
  }
2081
2221
  }
2082
2222
  }),
2083
- commands: (e) => [S(me, () => Ct(e))],
2223
+ commands: (e) => [N(ge, () => At(e))],
2084
2224
  shortcuts: {
2085
- [K.StrikeThrough]: D(me, "Mod-Alt-x")
2225
+ [q.StrikeThrough]: O(ge, "Mod-Alt-x")
2086
2226
  }
2087
- })), ge = R("SplitTaskListItem"), we = R("SinkTaskListItem"), be = R("LiftTaskListItem"), Ce = R("TurnIntoTaskList"), Hn = ye((o) => {
2227
+ })), we = R("SplitTaskListItem"), be = R("SinkTaskListItem"), Ce = R("LiftTaskListItem"), ye = R("TurnIntoTaskList"), qn = ke((o) => {
2088
2228
  const e = "task_list_item";
2089
2229
  return {
2090
2230
  id: e,
@@ -2103,29 +2243,31 @@ const ee = {
2103
2243
  tag: 'li[data-type="task-item"]',
2104
2244
  getAttrs: (n) => {
2105
2245
  if (!(n instanceof HTMLElement))
2106
- throw ke(n);
2246
+ throw Ae(n);
2107
2247
  return { checked: n.dataset.checked === "true" };
2108
2248
  }
2109
2249
  }
2110
2250
  ],
2111
2251
  toDOM: (n) => {
2112
- const l = document.createElement("input");
2113
- return l.type = "checkbox", l.checked = n.attrs.checked, l.className = o.getClassName(n.attrs, "task-list-item_checkbox"), l.onchange = (s) => {
2114
- const r = s.target;
2252
+ const s = document.createElement("input");
2253
+ return s.type = "checkbox", s.checked = n.attrs.checked, s.className = o.getClassName(n.attrs, "task-list-item_checkbox"), s.onchange = (l) => {
2254
+ const r = l.target;
2115
2255
  if (!(r instanceof HTMLInputElement))
2116
2256
  return;
2117
- const a = t.get(te);
2257
+ const a = t.get(U);
2118
2258
  if (!a.editable) {
2119
- l.checked = !l.checked;
2259
+ s.checked = !s.checked;
2120
2260
  return;
2121
2261
  }
2122
2262
  const { top: i, left: c } = r.getBoundingClientRect(), d = a.posAtCoords({ top: i, left: c });
2123
2263
  if (!d)
2124
2264
  return;
2125
2265
  const { tr: f } = a.state;
2126
- a.dispatch(f.setNodeMarkup(d.inside, void 0, {
2127
- checked: r.checked
2128
- }));
2266
+ a.dispatch(
2267
+ f.setNodeMarkup(d.inside, void 0, {
2268
+ checked: r.checked
2269
+ })
2270
+ );
2129
2271
  }, [
2130
2272
  "li",
2131
2273
  {
@@ -2133,134 +2275,136 @@ const ee = {
2133
2275
  "data-checked": n.attrs.checked ? "true" : "false",
2134
2276
  class: o.getClassName(n.attrs, "task-list-item")
2135
2277
  },
2136
- l,
2278
+ s,
2137
2279
  ["span", { class: o.getClassName(n.attrs, "task-list-item_body") }, 0]
2138
2280
  ];
2139
2281
  },
2140
2282
  parseMarkdown: {
2141
- match: ({ type: n, checked: l }) => n === "listItem" && l !== null,
2142
- runner: (n, l, s) => {
2143
- n.openNode(s, { checked: l.checked }), n.next(l.children), n.closeNode();
2283
+ match: ({ type: n, checked: s }) => n === "listItem" && s !== null,
2284
+ runner: (n, s, l) => {
2285
+ n.openNode(l, { checked: s.checked }), n.next(s.children), n.closeNode();
2144
2286
  }
2145
2287
  },
2146
2288
  toMarkdown: {
2147
2289
  match: (n) => n.type.name === e,
2148
- runner: (n, l) => {
2149
- n.openNode("listItem", void 0, { checked: l.attrs.checked }), n.next(l.content), n.closeNode();
2290
+ runner: (n, s) => {
2291
+ n.openNode("listItem", void 0, { checked: s.attrs.checked }), n.next(s.content), n.closeNode();
2150
2292
  }
2151
2293
  }
2152
2294
  }),
2153
2295
  inputRules: (t) => [
2154
- Ge(/^\s*(\[([ |x])\])\s$/, t, (n) => ({
2296
+ Je(/^\s*(\[([ |x])\])\s$/, t, (n) => ({
2155
2297
  checked: n[n.length - 1] === "x"
2156
2298
  }))
2157
2299
  ],
2158
2300
  commands: (t) => [
2159
- S(ge, () => Mt(t)),
2160
- S(we, () => Nt(t)),
2161
- S(be, () => St(t)),
2162
- S(Ce, () => yt(t))
2301
+ N(we, () => xt(t)),
2302
+ N(be, () => Rt(t)),
2303
+ N(Ce, () => Tt(t)),
2304
+ N(ye, () => Mt(t))
2163
2305
  ],
2164
2306
  shortcuts: {
2165
- [K.NextListItem]: D(ge, "Enter"),
2166
- [K.SinkListItem]: D(we, "Mod-]"),
2167
- [K.LiftListItem]: D(be, "Mod-["),
2168
- [K.TaskList]: D(Ce, "Mod-Alt-9")
2307
+ [q.NextListItem]: O(we, "Enter"),
2308
+ [q.SinkListItem]: O(be, "Mod-]"),
2309
+ [q.LiftListItem]: O(Ce, "Mod-["),
2310
+ [q.TaskList]: O(ye, "Mod-Alt-9")
2169
2311
  },
2170
- view: () => (t, n, l) => {
2171
- let s = t;
2312
+ view: () => (t, n, s) => {
2313
+ let l = t;
2172
2314
  const r = o.themeManager.get("task-list-item", {
2173
2315
  editable: () => n.editable,
2174
2316
  onChange: (d) => {
2175
2317
  const { tr: f } = n.state;
2176
- n.dispatch(f.setNodeMarkup(l(), void 0, {
2177
- checked: d
2178
- }));
2318
+ n.dispatch(
2319
+ f.setNodeMarkup(s(), void 0, {
2320
+ checked: d
2321
+ })
2322
+ );
2179
2323
  }
2180
2324
  });
2181
2325
  if (!r)
2182
2326
  return {};
2183
2327
  const { dom: a, contentDOM: i, onUpdate: c } = r;
2184
- return c(s), {
2328
+ return c(l), {
2185
2329
  dom: a,
2186
2330
  contentDOM: i,
2187
- update: (d) => d.type.name !== e ? !1 : (s = d, c(s), !0)
2331
+ update: (d) => d.type.name !== e ? !1 : (l = d, c(l), !0)
2188
2332
  };
2189
2333
  }
2190
2334
  };
2191
- }), oo = at.create([
2192
- ...st,
2193
- dt(() => ft),
2194
- Pn(),
2195
- Wn(),
2196
- Hn(),
2197
- Lt(),
2198
- Rt()
2199
- ]), lo = {
2200
- ...rt,
2201
- ToggleStrikeThrough: me,
2202
- TurnIntoTaskList: Ce,
2203
- SinkTaskListItem: we,
2204
- LiftTaskListItem: be,
2205
- SplitTaskListItem: ge
2335
+ }), io = ut.create([
2336
+ ...ct,
2337
+ pt(() => ht),
2338
+ jn(),
2339
+ Kn(),
2340
+ qn(),
2341
+ $t(),
2342
+ vt()
2343
+ ]), co = {
2344
+ ...at,
2345
+ ToggleStrikeThrough: ge,
2346
+ TurnIntoTaskList: ye,
2347
+ SinkTaskListItem: be,
2348
+ LiftTaskListItem: Ce,
2349
+ SplitTaskListItem: we
2206
2350
  };
2207
2351
  export {
2208
- qe as BreakTable,
2209
- io as InsertHardbreak,
2210
- co as InsertHr,
2211
- ao as InsertImage,
2212
- Bn as InsertTable,
2213
- fo as LiftListItem,
2214
- be as LiftTaskListItem,
2215
- Le as ModifyFootnoteDef,
2216
- ve as ModifyFootnoteRef,
2217
- uo as ModifyImage,
2218
- po as ModifyLink,
2219
- Ke as NextCell,
2220
- je as PrevCell,
2221
- ho as SinkListItem,
2222
- we as SinkTaskListItem,
2223
- mo as SplitListItem,
2224
- ge as SplitTaskListItem,
2225
- K as SupportedKeys,
2226
- go as ToggleBold,
2227
- wo as ToggleInlineCode,
2228
- bo as ToggleItalic,
2229
- Co as ToggleLink,
2230
- me as ToggleStrikeThrough,
2231
- yo as TurnIntoCodeFence,
2232
- ko as TurnIntoHeading,
2233
- Ce as TurnIntoTaskList,
2234
- Ao as TurnIntoText,
2235
- Mo as WrapInBlockquote,
2236
- No as WrapInBulletList,
2237
- So as WrapInOrderedList,
2238
- xo as blockquote,
2239
- Ro as bulletList,
2240
- To as codeFence,
2241
- Lo as codeInline,
2242
- lo as commands,
2243
- vo as commonmark,
2244
- Eo as commonmarkNodes,
2245
- Io as commonmarkPlugins,
2246
- ce as createTable,
2247
- $o as doc,
2248
- Do as em,
2249
- Rt as footnoteDefinition,
2250
- Lt as footnoteReference,
2251
- oo as gfm,
2252
- Oo as hardbreak,
2253
- _o as heading,
2254
- zo as hr,
2255
- Fo as image,
2256
- Bo as link,
2257
- Po as listItem,
2258
- Wo as orderedList,
2259
- Ho as paragraph,
2260
- Wn as strikeThrough,
2261
- jo as strong,
2262
- Pn as table,
2263
- Hn as taskListItem,
2264
- Ko as text
2352
+ Xe as BreakTable,
2353
+ uo as InsertHardbreak,
2354
+ po as InsertHr,
2355
+ ho as InsertImage,
2356
+ Hn as InsertTable,
2357
+ mo as LiftListItem,
2358
+ Ce as LiftTaskListItem,
2359
+ ve as ModifyFootnoteDef,
2360
+ Ee as ModifyFootnoteRef,
2361
+ go as ModifyImage,
2362
+ wo as ModifyLink,
2363
+ qe as NextCell,
2364
+ Ke as PrevCell,
2365
+ bo as SinkListItem,
2366
+ be as SinkTaskListItem,
2367
+ Co as SplitListItem,
2368
+ we as SplitTaskListItem,
2369
+ q as SupportedKeys,
2370
+ yo as ToggleBold,
2371
+ ko as ToggleInlineCode,
2372
+ Ao as ToggleItalic,
2373
+ Mo as ToggleLink,
2374
+ ge as ToggleStrikeThrough,
2375
+ So as TurnIntoCodeFence,
2376
+ No as TurnIntoHeading,
2377
+ ye as TurnIntoTaskList,
2378
+ xo as TurnIntoText,
2379
+ Ro as WrapInBlockquote,
2380
+ To as WrapInBulletList,
2381
+ Lo as WrapInOrderedList,
2382
+ vo as blockquote,
2383
+ Eo as bulletList,
2384
+ $o as codeFence,
2385
+ Io as codeInline,
2386
+ co as commands,
2387
+ Do as commonmark,
2388
+ Oo as commonmarkNodes,
2389
+ _o as commonmarkPlugins,
2390
+ ae as createTable,
2391
+ zo as doc,
2392
+ Fo as em,
2393
+ vt as footnoteDefinition,
2394
+ $t as footnoteReference,
2395
+ io as gfm,
2396
+ Bo as hardbreak,
2397
+ Wo as heading,
2398
+ Po as hr,
2399
+ Ho as image,
2400
+ jo as link,
2401
+ Ko as listItem,
2402
+ qo as orderedList,
2403
+ Xo as paragraph,
2404
+ Kn as strikeThrough,
2405
+ Uo as strong,
2406
+ jn as table,
2407
+ qn as taskListItem,
2408
+ Vo as text
2265
2409
  };
2266
2410
  //# sourceMappingURL=index.es.js.map