@uva-glass/component-library 3.41.1 → 3.42.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. package/dist/{Lexical.prod-7x3WP3vd.js → Lexical.prod-C1B_JvcI.js} +100 -99
  2. package/dist/Lexical.prod-C1B_JvcI.js.map +1 -0
  3. package/dist/{LexicalClipboard.prod-BMLLh6JL.js → LexicalClipboard.prod-Dd64YQH0.js} +10 -10
  4. package/dist/{LexicalClipboard.prod-BMLLh6JL.js.map → LexicalClipboard.prod-Dd64YQH0.js.map} +1 -1
  5. package/dist/{LexicalLink.prod-Dr6L083o.js → LexicalLink.prod-ldhpNY9X.js} +3 -3
  6. package/dist/{LexicalLink.prod-Dr6L083o.js.map → LexicalLink.prod-ldhpNY9X.js.map} +1 -1
  7. package/dist/{LexicalList.prod-nl__pKjG.js → LexicalList.prod-7DmvPZ_J.js} +4 -4
  8. package/dist/{LexicalList.prod-nl__pKjG.js.map → LexicalList.prod-7DmvPZ_J.js.map} +1 -1
  9. package/dist/{LexicalSelection.prod-CB_xP0pP.js → LexicalSelection.prod-Dmiwka3x.js} +5 -5
  10. package/dist/{LexicalSelection.prod-CB_xP0pP.js.map → LexicalSelection.prod-Dmiwka3x.js.map} +1 -1
  11. package/dist/{LexicalTable.prod-CwkGGOke.js → LexicalTable.prod-iqHmKv_G.js} +666 -625
  12. package/dist/LexicalTable.prod-iqHmKv_G.js.map +1 -0
  13. package/dist/LexicalUtils.prod-w0fZ_Z8S.js +123 -0
  14. package/dist/{LexicalUtils.prod-CtYaCJNB.js.map → LexicalUtils.prod-w0fZ_Z8S.js.map} +1 -1
  15. package/dist/RteEditor.module-dE9wQTC9.js +42 -0
  16. package/dist/RteEditor.module-dE9wQTC9.js.map +1 -0
  17. package/dist/TableCellResizerPlugin-D6jjhYoD.js +239 -0
  18. package/dist/TableCellResizerPlugin-D6jjhYoD.js.map +1 -0
  19. package/dist/TablePlugin-cMMBdz-x.js +306 -0
  20. package/dist/TablePlugin-cMMBdz-x.js.map +1 -0
  21. package/dist/assets/RteEditor.css +1 -1
  22. package/dist/assets/TableCellResizerPlugin.css +1 -0
  23. package/dist/components/CheckboxTree/CheckboxTree.js +9 -8
  24. package/dist/components/CheckboxTree/CheckboxTree.js.map +1 -1
  25. package/dist/components/FormInput/FormInput.js +4 -3
  26. package/dist/components/FormInput/FormInput.js.map +1 -1
  27. package/dist/components/InputField/InputField.stories.js +4 -3
  28. package/dist/components/InputField/InputField.stories.js.map +1 -1
  29. package/dist/components/MultiSelect/MultiSelect.js +1 -1
  30. package/dist/components/MultiSelect/MultiSelect.stories.js +1 -1
  31. package/dist/components/MultiSelect/components/MultiSelectHeader.js +3 -2
  32. package/dist/components/MultiSelect/components/MultiSelectHeader.js.map +1 -1
  33. package/dist/components/MultiSelect/index.js +1 -1
  34. package/dist/components/PeriodSelector/PeriodSelector.js +4 -3
  35. package/dist/components/PeriodSelector/PeriodSelector.js.map +1 -1
  36. package/dist/components/ProgrammeCard/ProgrammeCard.stories.js +4 -3
  37. package/dist/components/ProgrammeCard/ProgrammeCard.stories.js.map +1 -1
  38. package/dist/components/RadioTabSelector/RadioTabSelector.js +4 -3
  39. package/dist/components/RadioTabSelector/RadioTabSelector.js.map +1 -1
  40. package/dist/components/RteEditor/EditorHeader/EditorHeader.js +4 -3
  41. package/dist/components/RteEditor/EditorHeader/EditorHeader.js.map +1 -1
  42. package/dist/components/RteEditor/Plugins/BlockFormatPlugin/BlockFormatPlugin.js +2 -2
  43. package/dist/components/RteEditor/Plugins/HistoryPlugin/HistoryPlugin.js +14 -13
  44. package/dist/components/RteEditor/Plugins/HistoryPlugin/HistoryPlugin.js.map +1 -1
  45. package/dist/components/RteEditor/Plugins/LinkPlugin/AddLinkForm/AddLinkFrom.js +5 -4
  46. package/dist/components/RteEditor/Plugins/LinkPlugin/AddLinkForm/AddLinkFrom.js.map +1 -1
  47. package/dist/components/RteEditor/Plugins/LinkPlugin/LinkContextMenu/LinkContextMenu.js +1 -1
  48. package/dist/components/RteEditor/Plugins/LinkPlugin/LinkPlugin.js +26 -25
  49. package/dist/components/RteEditor/Plugins/LinkPlugin/LinkPlugin.js.map +1 -1
  50. package/dist/components/RteEditor/Plugins/LinkPlugin/helpers.js +1 -1
  51. package/dist/components/RteEditor/Plugins/ListPlugin/ListPlugin.js +6 -6
  52. package/dist/components/RteEditor/Plugins/PasteHandlerPlugin/PasteHandlerPlugin.js +3 -3
  53. package/dist/components/RteEditor/Plugins/TableCellResizerPlugin/TableCellResizerPlugin.d.ts +2 -0
  54. package/dist/components/RteEditor/Plugins/TableCellResizerPlugin/TableCellResizerPlugin.js +13 -0
  55. package/dist/components/RteEditor/Plugins/TableCellResizerPlugin/TableCellResizerPlugin.js.map +1 -0
  56. package/dist/components/RteEditor/Plugins/TableCellResizerPlugin/index.d.ts +1 -0
  57. package/dist/components/RteEditor/Plugins/TableCellResizerPlugin/index.js +5 -0
  58. package/dist/components/RteEditor/Plugins/TableCellResizerPlugin/index.js.map +1 -0
  59. package/dist/components/RteEditor/Plugins/TablePlugin/AddTableFrom.js +4 -3
  60. package/dist/components/RteEditor/Plugins/TablePlugin/AddTableFrom.js.map +1 -1
  61. package/dist/components/RteEditor/Plugins/TablePlugin/TablePlugin.js +9 -6
  62. package/dist/components/RteEditor/Plugins/TablePlugin/TablePlugin.js.map +1 -1
  63. package/dist/components/RteEditor/Plugins/TablePlugin/helpers.d.ts +9 -1
  64. package/dist/components/RteEditor/Plugins/TablePlugin/helpers.js +73 -56
  65. package/dist/components/RteEditor/Plugins/TablePlugin/helpers.js.map +1 -1
  66. package/dist/components/RteEditor/Plugins/TablePlugin/index.js +1 -1
  67. package/dist/components/RteEditor/Plugins/ToolbarPlugin/ToolbarPlugin.js +11 -9
  68. package/dist/components/RteEditor/Plugins/ToolbarPlugin/ToolbarPlugin.js.map +1 -1
  69. package/dist/components/RteEditor/Plugins/index.d.ts +2 -0
  70. package/dist/components/RteEditor/Plugins/index.js +13 -9
  71. package/dist/components/RteEditor/Plugins/index.js.map +1 -1
  72. package/dist/components/RteEditor/RteEditor.js +275 -287
  73. package/dist/components/RteEditor/RteEditor.js.map +1 -1
  74. package/dist/components/RteEditor/UvaTheme/UvaTheme.d.ts +1 -0
  75. package/dist/components/RteEditor/UvaTheme/UvaTheme.js +2 -1
  76. package/dist/components/RteEditor/UvaTheme/UvaTheme.js.map +1 -1
  77. package/dist/components/RteEditor/helpers.js +4 -4
  78. package/dist/components/RteEditor/nodes/TableWrapperNode/TableWrapperNode.d.ts +15 -0
  79. package/dist/components/RteEditor/nodes/TableWrapperNode/TableWrapperNode.js +69 -0
  80. package/dist/components/RteEditor/nodes/TableWrapperNode/TableWrapperNode.js.map +1 -0
  81. package/dist/components/RteEditor/nodes/TableWrapperNode/index.d.ts +1 -0
  82. package/dist/components/RteEditor/nodes/TableWrapperNode/index.js +10 -0
  83. package/dist/components/RteEditor/nodes/TableWrapperNode/index.js.map +1 -0
  84. package/dist/components/RteEditor/nodes/index.d.ts +1 -0
  85. package/dist/components/RteEditor/nodes/index.js +10 -0
  86. package/dist/components/RteEditor/nodes/index.js.map +1 -0
  87. package/dist/components/index.js +1 -1
  88. package/dist/{helpers-B0VCD9f3.js → helpers-BO6Gg9y6.js} +4 -4
  89. package/dist/{helpers-B0VCD9f3.js.map → helpers-BO6Gg9y6.js.map} +1 -1
  90. package/dist/index.js +1 -1
  91. package/package.json +1 -1
  92. package/dist/Lexical.prod-7x3WP3vd.js.map +0 -1
  93. package/dist/LexicalTable.prod-CwkGGOke.js.map +0 -1
  94. package/dist/LexicalUtils.prod-CtYaCJNB.js +0 -107
  95. package/dist/RteEditor.module-B_3uFnFu.js +0 -41
  96. package/dist/RteEditor.module-B_3uFnFu.js.map +0 -1
  97. package/dist/TablePlugin-DNGtPPjq.js +0 -301
  98. package/dist/TablePlugin-DNGtPPjq.js.map +0 -1
@@ -1,8 +1,8 @@
1
- import { w as T, r as Q, i as ge, _ as xt, j as Xt, b as Yt, T as vt, S as qt, L as jt } from "./LexicalUtils.prod-CtYaCJNB.js";
2
- import { m as Ze, k as Ne, g as Ge, e as Vt, s as Ce, h as ct, B as I, i as et, j as Qt, l as Tt, T as re, n as Zt, J as De, p as Rt, _ as z, d as Gt, r as ye, x as D, P as B, F as Ue, S as Ae, t as en, D as tn, u as nn, w as on, U as Ie, K as rn, z as ln, A as Ft, C as sn, V as j, G as an, H as cn, L as un, N as hn, Q as dn, R as fn, X as gn, Y as mn, Z as fe, M as ne, a0 as Me, a1 as pn, a as Ot, a2 as Cn, W as tt, a3 as _n, f as Sn, a4 as Ee, a5 as wn, a6 as bn, a7 as ut, a8 as yn, a9 as ht, o as Nn, aa as dt, O as ft, v as Re, ab as xn, E as vn, ac as Tn, ad as Rn } from "./Lexical.prod-7x3WP3vd.js";
3
- import { F as Fn, J as On } from "./LexicalClipboard.prod-BMLLh6JL.js";
4
- const nt = /^(\d+(?:\.\d+)?)px$/, L = { BOTH: 3, COLUMN: 2, NO_STATUS: 0, ROW: 1 };
5
- class ce extends Ze {
1
+ import { w as T, r as G, i as ge, _ as Rt, j as Vt, b as jt, T as Ft, S as Qt, L as Gt } from "./LexicalUtils.prod-w0fZ_Z8S.js";
2
+ import { m as tt, k as Ne, P as L, _ as M, g as nt, e as Zt, s as _e, h as dt, B as U, i as ot, j as en, l as Ot, T as re, n as Ee, W as rt, x as D, E as tn, Q as nn, U as on, p as rn, J as De, r as Kt, d as ln, t as ye, F as Ue, S as Ae, u as sn, D as an, w as cn, z as un, A as Ie, K as hn, C as dn, G as At, H as fn, V as j, L as gn, N as mn, R as pn, X as _n, Y as Cn, Z as Sn, a0 as wn, a1 as bn, a2 as fe, M as ne, a3 as Me, a4 as yn, a as Et, a5 as Nn, a6 as vn, f as xn, a7 as Tn, a8 as Rn, a9 as ft, aa as Fn, ab as gt, o as On, ac as mt, O as pt, v as Re, ad as Kn } from "./Lexical.prod-C1B_JvcI.js";
3
+ import { F as An, J as En } from "./LexicalClipboard.prod-Dd64YQH0.js";
4
+ const lt = /^(\d+(?:\.\d+)?)px$/, W = { BOTH: 3, COLUMN: 2, NO_STATUS: 0, ROW: 1 };
5
+ class ce extends tt {
6
6
  static getType() {
7
7
  return "tablecell";
8
8
  }
@@ -13,7 +13,7 @@ class ce extends Ze {
13
13
  super.afterCloneFrom(e), this.__rowSpan = e.__rowSpan, this.__backgroundColor = e.__backgroundColor, this.__verticalAlign = e.__verticalAlign;
14
14
  }
15
15
  static importDOM() {
16
- return { td: (e) => ({ conversion: gt, priority: 0 }), th: (e) => ({ conversion: gt, priority: 0 }) };
16
+ return { td: (e) => ({ conversion: _t, priority: 0 }), th: (e) => ({ conversion: _t, priority: 0 }) };
17
17
  }
18
18
  static importJSON(e) {
19
19
  return X().updateFromJSON(e);
@@ -21,12 +21,12 @@ class ce extends Ze {
21
21
  updateFromJSON(e) {
22
22
  return super.updateFromJSON(e).setHeaderStyles(e.headerState).setColSpan(e.colSpan || 1).setRowSpan(e.rowSpan || 1).setWidth(e.width || void 0).setBackgroundColor(e.backgroundColor || null).setVerticalAlign(e.verticalAlign || void 0);
23
23
  }
24
- constructor(e = L.NO_STATUS, t = 1, o, r) {
24
+ constructor(e = W.NO_STATUS, t = 1, o, r) {
25
25
  super(r), this.__colSpan = t, this.__rowSpan = 1, this.__headerState = e, this.__width = o, this.__backgroundColor = null, this.__verticalAlign = void 0;
26
26
  }
27
27
  createDOM(e) {
28
28
  const t = document.createElement(this.getTag());
29
- return this.__width && (t.style.width = `${this.__width}px`), this.__colSpan > 1 && (t.colSpan = this.__colSpan), this.__rowSpan > 1 && (t.rowSpan = this.__rowSpan), this.__backgroundColor !== null && (t.style.backgroundColor = this.__backgroundColor), Xe(this.__verticalAlign) && (t.style.verticalAlign = this.__verticalAlign), Q(t, e.theme.tableCell, this.hasHeader() && e.theme.tableCellHeader), t;
29
+ return this.__width && (t.style.width = `${this.__width}px`), this.__colSpan > 1 && (t.colSpan = this.__colSpan), this.__rowSpan > 1 && (t.rowSpan = this.__rowSpan), this.__backgroundColor !== null && (t.style.backgroundColor = this.__backgroundColor), Ye(this.__verticalAlign) && (t.style.verticalAlign = this.__verticalAlign), G(t, e.theme.tableCell, this.hasHeader() && e.theme.tableCellHeader), t;
30
30
  }
31
31
  exportDOM(e) {
32
32
  const t = super.exportDOM(e);
@@ -37,7 +37,7 @@ class ce extends Ze {
37
37
  return t;
38
38
  }
39
39
  exportJSON() {
40
- return { ...super.exportJSON(), ...Xe(this.__verticalAlign) && { verticalAlign: this.__verticalAlign }, backgroundColor: this.getBackgroundColor(), colSpan: this.__colSpan, headerState: this.__headerState, rowSpan: this.__rowSpan, width: this.getWidth() };
40
+ return { ...super.exportJSON(), ...Ye(this.__verticalAlign) && { verticalAlign: this.__verticalAlign }, backgroundColor: this.getBackgroundColor(), colSpan: this.__colSpan, headerState: this.__headerState, rowSpan: this.__rowSpan, width: this.getWidth() };
41
41
  }
42
42
  getColSpan() {
43
43
  return this.getLatest().__colSpan;
@@ -56,7 +56,7 @@ class ce extends Ze {
56
56
  getTag() {
57
57
  return this.hasHeader() ? "th" : "td";
58
58
  }
59
- setHeaderStyles(e, t = L.BOTH) {
59
+ setHeaderStyles(e, t = W.BOTH) {
60
60
  const o = this.getWritable();
61
61
  return o.__headerState = e & t | o.__headerState & ~t, o;
62
62
  }
@@ -92,7 +92,7 @@ class ce extends Ze {
92
92
  return (this.getHeaderStyles() & e) === e;
93
93
  }
94
94
  hasHeader() {
95
- return this.getLatest().__headerState !== L.NO_STATUS;
95
+ return this.getLatest().__headerState !== W.NO_STATUS;
96
96
  }
97
97
  updateDOM(e) {
98
98
  return e.__headerState !== this.__headerState || e.__width !== this.__width || e.__colSpan !== this.__colSpan || e.__rowSpan !== this.__rowSpan || e.__backgroundColor !== this.__backgroundColor || e.__verticalAlign !== this.__verticalAlign;
@@ -110,47 +110,47 @@ class ce extends Ze {
110
110
  return !1;
111
111
  }
112
112
  }
113
- function Xe(n) {
113
+ function Ye(n) {
114
114
  return n === "middle" || n === "bottom";
115
115
  }
116
- function gt(n) {
116
+ function _t(n) {
117
117
  const e = n, t = n.nodeName.toLowerCase();
118
118
  let o;
119
- nt.test(e.style.width) && (o = parseFloat(e.style.width));
120
- const r = X(t === "th" ? L.ROW : L.NO_STATUS, e.colSpan, o);
119
+ lt.test(e.style.width) && (o = parseFloat(e.style.width));
120
+ const r = X(t === "th" ? W.ROW : W.NO_STATUS, e.colSpan, o);
121
121
  r.__rowSpan = e.rowSpan;
122
122
  const s = e.style.backgroundColor;
123
123
  s !== "" && (r.__backgroundColor = s);
124
124
  const l = e.style.verticalAlign;
125
- Xe(l) && (r.__verticalAlign = l);
126
- const i = e.style, u = (i && i.textDecoration || "").split(" "), m = i.fontWeight === "700" || i.fontWeight === "bold", h = u.includes("line-through"), p = i.fontStyle === "italic", C = u.includes("underline");
125
+ Ye(l) && (r.__verticalAlign = l);
126
+ const i = e.style, u = (i && i.textDecoration || "").split(" "), f = i.fontWeight === "700" || i.fontWeight === "bold", h = u.includes("line-through"), p = i.fontStyle === "italic", _ = u.includes("underline");
127
127
  return { after: (a) => {
128
128
  const c = [];
129
- let f = null;
129
+ let g = null;
130
130
  const d = () => {
131
- if (f) {
132
- const g = f.getFirstChild();
133
- ct(g) && f.getChildrenSize() === 1 && g.remove();
131
+ if (g) {
132
+ const m = g.getFirstChild();
133
+ dt(m) && g.getChildrenSize() === 1 && m.remove();
134
134
  }
135
135
  };
136
- for (const g of a) Vt(g) || Ce(g) || ct(g) ? (Ce(g) && (m && g.toggleFormat("bold"), h && g.toggleFormat("strikethrough"), p && g.toggleFormat("italic"), C && g.toggleFormat("underline")), f ? f.append(g) : (f = I().append(g), c.push(f))) : (c.push(g), d(), f = null);
137
- return d(), c.length === 0 && c.push(I()), c;
136
+ for (const m of a) Zt(m) || _e(m) || dt(m) ? (_e(m) && (f && m.toggleFormat("bold"), h && m.toggleFormat("strikethrough"), p && m.toggleFormat("italic"), _ && m.toggleFormat("underline")), g ? g.append(m) : (g = U().append(m), c.push(g))) : (c.push(m), d(), g = null);
137
+ return d(), c.length === 0 && c.push(U()), c;
138
138
  }, node: r };
139
139
  }
140
- function X(n = L.NO_STATUS, e = 1, t) {
141
- return Ge(new ce(n, e, t));
140
+ function X(n = W.NO_STATUS, e = 1, t) {
141
+ return nt(new ce(n, e, t));
142
142
  }
143
- function w(n) {
143
+ function b(n) {
144
144
  return n instanceof ce;
145
145
  }
146
- const Kn = Gt("INSERT_TABLE_COMMAND");
147
- function b(n, ...e) {
146
+ const kn = ln("INSERT_TABLE_COMMAND");
147
+ function w(n, ...e) {
148
148
  const t = new URL("https://lexical.dev/docs/error"), o = new URLSearchParams();
149
149
  o.append("code", n);
150
150
  for (const r of e) o.append("v", r);
151
151
  throw t.search = o.toString(), Error(`Minified Lexical error #${n}; visit ${t.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`);
152
152
  }
153
- class Te extends Ze {
153
+ class Te extends tt {
154
154
  static getType() {
155
155
  return "tablerow";
156
156
  }
@@ -158,10 +158,10 @@ class Te extends Ze {
158
158
  return new Te(e.__height, e.__key);
159
159
  }
160
160
  static importDOM() {
161
- return { tr: (e) => ({ conversion: An, priority: 0 }) };
161
+ return { tr: (e) => ({ conversion: $n, priority: 0 }) };
162
162
  }
163
163
  static importJSON(e) {
164
- return ve().updateFromJSON(e);
164
+ return xe().updateFromJSON(e);
165
165
  }
166
166
  updateFromJSON(e) {
167
167
  return super.updateFromJSON(e).setHeight(e.height);
@@ -175,7 +175,7 @@ class Te extends Ze {
175
175
  }
176
176
  createDOM(e) {
177
177
  const t = document.createElement("tr");
178
- return this.__height && (t.style.height = `${this.__height}px`), Q(t, e.theme.tableRow), t;
178
+ return this.__height && (t.style.height = `${this.__height}px`), G(t, e.theme.tableRow), t;
179
179
  }
180
180
  extractWithChild(e, t, o) {
181
181
  return o === "html";
@@ -200,296 +200,330 @@ class Te extends Ze {
200
200
  return !1;
201
201
  }
202
202
  }
203
- function An(n) {
203
+ function $n(n) {
204
204
  const e = n;
205
205
  let t;
206
- return nt.test(e.style.height) && (t = parseFloat(e.style.height)), { after: (o) => xt(o, w), node: ve(t) };
206
+ return lt.test(e.style.height) && (t = parseFloat(e.style.height)), { after: (o) => Rt(o, b), node: xe(t) };
207
207
  }
208
- function ve(n) {
209
- return Ge(new Te(n));
208
+ function xe(n) {
209
+ return nt(new Te(n));
210
210
  }
211
- function A(n) {
211
+ function k(n) {
212
212
  return n instanceof Te;
213
213
  }
214
- const ot = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0, En = ot && "documentMode" in document ? document.documentMode : null, mt = ot && /^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent);
215
- function kn(n, e, t = !0) {
216
- const o = st();
214
+ const st = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0, Mn = st && "documentMode" in document ? document.documentMode : null, Ct = st && /^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent);
215
+ function zn(n, e, t = !0) {
216
+ const o = ct();
217
217
  for (let r = 0; r < n; r++) {
218
- const s = ve();
218
+ const s = xe();
219
219
  for (let l = 0; l < e; l++) {
220
- let i = L.NO_STATUS;
221
- typeof t == "object" ? (r === 0 && t.rows && (i |= L.ROW), l === 0 && t.columns && (i |= L.COLUMN)) : t && (r === 0 && (i |= L.ROW), l === 0 && (i |= L.COLUMN));
222
- const u = X(i), m = I();
223
- m.append(et()), u.append(m), s.append(u);
220
+ let i = W.NO_STATUS;
221
+ typeof t == "object" ? (r === 0 && t.rows && (i |= W.ROW), l === 0 && t.columns && (i |= W.COLUMN)) : t && (r === 0 && (i |= W.ROW), l === 0 && (i |= W.COLUMN));
222
+ const u = X(i), f = U();
223
+ f.append(ot()), u.append(f), s.append(u);
224
224
  }
225
225
  o.append(s);
226
226
  }
227
227
  return o;
228
228
  }
229
229
  function io(n) {
230
- const e = T(n, (t) => w(t));
231
- return w(e) ? e : null;
230
+ const e = T(n, (t) => b(t));
231
+ return b(e) ? e : null;
232
232
  }
233
- function Kt(n) {
234
- const e = T(n, (t) => A(t));
235
- if (A(e)) return e;
233
+ function kt(n) {
234
+ const e = T(n, (t) => k(t));
235
+ if (k(e)) return e;
236
236
  throw new Error("Expected table cell to be inside of table row.");
237
237
  }
238
- function At(n) {
238
+ function $t(n) {
239
239
  const e = T(n, (t) => $(t));
240
240
  if ($(e)) return e;
241
241
  throw new Error("Expected table cell to be inside of table.");
242
242
  }
243
243
  function ao(n) {
244
- const e = Kt(n);
245
- return At(e).getChildren().findIndex((t) => t.is(e));
244
+ const e = kt(n);
245
+ return $t(e).getChildren().findIndex((t) => t.is(e));
246
246
  }
247
247
  function co(n) {
248
- return Kt(n).getChildren().findIndex((e) => e.is(n));
249
- }
250
- ot && "InputEvent" in window && !En && new window.InputEvent("input");
251
- const Ye = (n, e) => n === L.BOTH || n === e ? e : L.NO_STATUS;
252
- function $n(n, e = !0) {
253
- const [, , t] = Z(n), [o, r] = U(t, n, n), s = o[0].length, { startRow: l } = r;
248
+ return kt(n).getChildren().findIndex((e) => e.is(n));
249
+ }
250
+ st && "InputEvent" in window && !Mn && new window.InputEvent("input");
251
+ const Xe = (n, e) => n === W.BOTH || n === e ? e : W.NO_STATUS;
252
+ function uo(n = !0) {
253
+ const e = L();
254
+ M(e) || O(e) || w(188);
255
+ const t = e.anchor.getNode(), o = e.focus.getNode(), [r] = I(t), [s, , l] = I(o), [, i, u] = J(l, s, r), { startRow: f } = u, { startRow: h } = i;
256
+ return n ? qe(f + r.__rowSpan > h + s.__rowSpan ? r : s, !0) : qe(h < f ? s : r, !1);
257
+ }
258
+ function qe(n, e = !0) {
259
+ const [, , t] = I(n), [o, r] = J(t, n, n), s = o[0].length, { startRow: l } = r;
254
260
  let i = null;
255
261
  if (e) {
256
- const u = l + n.__rowSpan - 1, m = o[u], h = ve();
257
- for (let C = 0; C < s; C++) {
258
- const { cell: a, startRow: c } = m[C];
262
+ const u = l + n.__rowSpan - 1, f = o[u], h = xe();
263
+ for (let _ = 0; _ < s; _++) {
264
+ const { cell: a, startRow: c } = f[_];
259
265
  if (c + a.__rowSpan - 1 <= u) {
260
- const f = m[C].cell.__headerState, d = Ye(f, L.COLUMN);
261
- h.append(X(d).append(I()));
266
+ const g = f[_].cell.__headerState, d = Xe(g, W.COLUMN);
267
+ h.append(X(d).append(U()));
262
268
  } else a.setRowSpan(a.__rowSpan + 1);
263
269
  }
264
270
  const p = t.getChildAtIndex(u);
265
- A(p) || b(256), p.insertAfter(h), i = h;
271
+ k(p) || w(256), p.insertAfter(h), i = h;
266
272
  } else {
267
- const u = l, m = o[u], h = ve();
268
- for (let C = 0; C < s; C++) {
269
- const { cell: a, startRow: c } = m[C];
273
+ const u = l, f = o[u], h = xe();
274
+ for (let _ = 0; _ < s; _++) {
275
+ const { cell: a, startRow: c } = f[_];
270
276
  if (c === u) {
271
- const f = m[C].cell.__headerState, d = Ye(f, L.COLUMN);
272
- h.append(X(d).append(I()));
277
+ const g = f[_].cell.__headerState, d = Xe(g, W.COLUMN);
278
+ h.append(X(d).append(U()));
273
279
  } else a.setRowSpan(a.__rowSpan + 1);
274
280
  }
275
281
  const p = t.getChildAtIndex(u);
276
- A(p) || b(257), p.insertBefore(h), i = h;
282
+ k(p) || w(257), p.insertBefore(h), i = h;
277
283
  }
278
284
  return i;
279
285
  }
280
- function Mn(n, e = !0, t = !0) {
281
- const [, , o] = Z(n), [r, s] = U(o, n, n), l = r.length, { startColumn: i } = s, u = e ? i + n.__colSpan - 1 : i - 1, m = o.getFirstChild();
282
- A(m) || b(120);
286
+ function ho(n = !0) {
287
+ const e = L();
288
+ M(e) || O(e) || w(188);
289
+ const t = e.anchor.getNode(), o = e.focus.getNode(), [r] = I(t), [s, , l] = I(o), [, i, u] = J(l, s, r), { startColumn: f } = u, { startColumn: h } = i;
290
+ return n ? Ve(f + r.__colSpan > h + s.__colSpan ? r : s, !0) : Ve(h < f ? s : r, !1);
291
+ }
292
+ function Ve(n, e = !0, t = !0) {
293
+ const [, , o] = I(n), [r, s] = J(o, n, n), l = r.length, { startColumn: i } = s, u = e ? i + n.__colSpan - 1 : i - 1, f = o.getFirstChild();
294
+ k(f) || w(120);
283
295
  let h = null;
284
- function p(c = L.NO_STATUS) {
285
- const f = X(c).append(I());
286
- return h === null && (h = f), f;
296
+ function p(c = W.NO_STATUS) {
297
+ const g = X(c).append(U());
298
+ return h === null && (h = g), g;
287
299
  }
288
- let C = m;
300
+ let _ = f;
289
301
  e: for (let c = 0; c < l; c++) {
290
302
  if (c !== 0) {
291
- const y = C.getNextSibling();
292
- A(y) || b(121), C = y;
303
+ const y = _.getNextSibling();
304
+ k(y) || w(121), _ = y;
293
305
  }
294
- const f = r[c], d = f[u < 0 ? 0 : u].cell.__headerState, g = Ye(d, L.ROW);
306
+ const g = r[c], d = g[u < 0 ? 0 : u].cell.__headerState, m = Xe(d, W.ROW);
295
307
  if (u < 0) {
296
- Et(C, p(g));
308
+ Mt(_, p(m));
297
309
  continue;
298
310
  }
299
- const { cell: _, startColumn: S, startRow: N } = f[u];
300
- if (S + _.__colSpan - 1 <= u) {
301
- let y = _, v = N, E = u;
311
+ const { cell: C, startColumn: S, startRow: N } = g[u];
312
+ if (S + C.__colSpan - 1 <= u) {
313
+ let y = C, v = N, R = u;
302
314
  for (; v !== c && y.__rowSpan > 1; ) {
303
- if (E -= _.__colSpan, !(E >= 0)) {
304
- C.append(p(g));
315
+ if (R -= C.__colSpan, !(R >= 0)) {
316
+ _.append(p(m));
305
317
  continue e;
306
318
  }
307
319
  {
308
- const { cell: k, startRow: O } = f[E];
309
- y = k, v = O;
320
+ const { cell: E, startRow: A } = g[R];
321
+ y = E, v = A;
310
322
  }
311
323
  }
312
- y.insertAfter(p(g));
313
- } else _.setColSpan(_.__colSpan + 1);
324
+ y.insertAfter(p(m));
325
+ } else C.setColSpan(C.__colSpan + 1);
314
326
  }
315
- h !== null && t && zn(h);
327
+ h !== null && t && je(h);
316
328
  const a = o.getColWidths();
317
329
  if (a) {
318
- const c = [...a], f = u < 0 ? 0 : u, d = c[f];
319
- c.splice(f, 0, d), o.setColWidths(c);
330
+ const c = [...a], g = u < 0 ? 0 : u, d = c[g];
331
+ c.splice(g, 0, d), o.setColWidths(c);
320
332
  }
321
333
  return h;
322
334
  }
323
- function uo(n, e) {
324
- const t = n.getChildren();
325
- for (let o = 0; o < t.length; o++) {
326
- const r = t[o];
327
- if (A(r)) {
328
- const s = r.getChildren();
329
- if (e >= s.length || e < 0) throw new Error("Table column target index out of range");
330
- s[e].remove();
331
- }
335
+ function fo() {
336
+ const n = L();
337
+ M(n) || O(n) || w(188);
338
+ const e = n.anchor.getNode(), t = n.focus.getNode(), [o, , r] = I(e), [s] = I(t), [l, i, u] = J(r, o, s), { startColumn: f } = i, { startRow: h, startColumn: p } = u, _ = Math.min(f, p), a = Math.max(f + o.__colSpan - 1, p + s.__colSpan - 1), c = a - _ + 1;
339
+ if (l[0].length === a - _ + 1) return r.selectPrevious(), void r.remove();
340
+ const g = l.length;
341
+ for (let S = 0; S < g; S++) for (let N = _; N <= a; N++) {
342
+ const { cell: y, startColumn: v } = l[S][N];
343
+ if (v < _) {
344
+ if (N === _) {
345
+ const R = _ - v;
346
+ y.setColSpan(y.__colSpan - Math.min(c, y.__colSpan - R));
347
+ }
348
+ } else if (v + y.__colSpan - 1 > a) {
349
+ if (N === a) {
350
+ const R = a - v + 1;
351
+ y.setColSpan(y.__colSpan - R);
352
+ }
353
+ } else y.remove();
354
+ }
355
+ const d = l[h], m = f > p ? d[f + o.__colSpan] : d[p + s.__colSpan];
356
+ if (m !== void 0) {
357
+ const { cell: S } = m;
358
+ je(S);
359
+ } else {
360
+ const S = p < f ? d[p - 1] : d[f - 1], { cell: N } = S;
361
+ je(N);
362
+ }
363
+ const C = r.getColWidths();
364
+ if (C) {
365
+ const S = [...C];
366
+ S.splice(_, c), r.setColWidths(S);
332
367
  }
333
- return n;
334
368
  }
335
- function zn(n) {
369
+ function je(n) {
336
370
  const e = n.getFirstDescendant();
337
371
  e == null ? n.selectStart() : e.getParentOrThrow().selectStart();
338
372
  }
339
- function Et(n, e) {
373
+ function Mt(n, e) {
340
374
  const t = n.getFirstChild();
341
375
  t !== null ? t.insertBefore(e) : n.append(e);
342
376
  }
343
377
  function Ln(n) {
344
378
  if (n.length === 0) return null;
345
- const e = At(n[0]), [t] = oe(e, null, null);
379
+ const e = $t(n[0]), [t] = oe(e, null, null);
346
380
  let o = 1 / 0, r = -1 / 0, s = 1 / 0, l = -1 / 0;
347
381
  const i = /* @__PURE__ */ new Set();
348
382
  for (const a of t) for (const c of a) {
349
383
  if (!c || !c.cell) continue;
350
- const f = c.cell.getKey();
351
- if (!i.has(f) && n.some((d) => d.is(c.cell))) {
352
- i.add(f);
353
- const d = c.startRow, g = c.startColumn, _ = c.cell.__rowSpan || 1, S = c.cell.__colSpan || 1;
354
- o = Math.min(o, d), r = Math.max(r, d + _ - 1), s = Math.min(s, g), l = Math.max(l, g + S - 1);
384
+ const g = c.cell.getKey();
385
+ if (!i.has(g) && n.some((d) => d.is(c.cell))) {
386
+ i.add(g);
387
+ const d = c.startRow, m = c.startColumn, C = c.cell.__rowSpan || 1, S = c.cell.__colSpan || 1;
388
+ o = Math.min(o, d), r = Math.max(r, d + C - 1), s = Math.min(s, m), l = Math.max(l, m + S - 1);
355
389
  }
356
390
  }
357
391
  if (o === 1 / 0 || s === 1 / 0) return null;
358
- const u = r - o + 1, m = l - s + 1, h = t[o][s];
392
+ const u = r - o + 1, f = l - s + 1, h = t[o][s];
359
393
  if (!h.cell) return null;
360
394
  const p = h.cell;
361
- p.setColSpan(m), p.setRowSpan(u);
362
- const C = /* @__PURE__ */ new Set([p.getKey()]);
395
+ p.setColSpan(f), p.setRowSpan(u);
396
+ const _ = /* @__PURE__ */ new Set([p.getKey()]);
363
397
  for (let a = o; a <= r; a++) for (let c = s; c <= l; c++) {
364
- const f = t[a][c];
365
- if (!f.cell) continue;
366
- const d = f.cell, g = d.getKey();
367
- C.has(g) || (C.add(g), Wn(d) || p.append(...d.getChildren()), d.remove());
398
+ const g = t[a][c];
399
+ if (!g.cell) continue;
400
+ const d = g.cell, m = d.getKey();
401
+ _.has(m) || (_.add(m), Wn(d) || p.append(...d.getChildren()), d.remove());
368
402
  }
369
- return p.getChildrenSize() === 0 && p.append(I()), p;
403
+ return p.getChildrenSize() === 0 && p.append(U()), p;
370
404
  }
371
405
  function Wn(n) {
372
406
  if (n.getChildrenSize() !== 1) return !1;
373
407
  const e = n.getFirstChildOrThrow();
374
- return !(!tt(e) || !e.isEmpty());
408
+ return !(!rt(e) || !e.isEmpty());
375
409
  }
376
410
  function Pn(n) {
377
- const [e, t, o] = Z(n), r = e.__colSpan, s = e.__rowSpan;
411
+ const [e, t, o] = I(n), r = e.__colSpan, s = e.__rowSpan;
378
412
  if (r === 1 && s === 1) return;
379
- const [l, i] = U(o, e, e), { startColumn: u, startRow: m } = i, h = e.__headerState & L.COLUMN, p = Array.from({ length: r }, (c, f) => {
413
+ const [l, i] = J(o, e, e), { startColumn: u, startRow: f } = i, h = e.__headerState & W.COLUMN, p = Array.from({ length: r }, (c, g) => {
380
414
  let d = h;
381
- for (let g = 0; d !== 0 && g < l.length; g++) d &= l[g][f + u].cell.__headerState;
415
+ for (let m = 0; d !== 0 && m < l.length; m++) d &= l[m][g + u].cell.__headerState;
382
416
  return d;
383
- }), C = e.__headerState & L.ROW, a = Array.from({ length: s }, (c, f) => {
384
- let d = C;
385
- for (let g = 0; d !== 0 && g < l[0].length; g++) d &= l[f + m][g].cell.__headerState;
417
+ }), _ = e.__headerState & W.ROW, a = Array.from({ length: s }, (c, g) => {
418
+ let d = _;
419
+ for (let m = 0; d !== 0 && m < l[0].length; m++) d &= l[g + f][m].cell.__headerState;
386
420
  return d;
387
421
  });
388
422
  if (r > 1) {
389
- for (let c = 1; c < r; c++) e.insertAfter(X(p[c] | a[0]).append(I()));
423
+ for (let c = 1; c < r; c++) e.insertAfter(X(p[c] | a[0]).append(U()));
390
424
  e.setColSpan(1);
391
425
  }
392
426
  if (s > 1) {
393
427
  let c;
394
- for (let f = 1; f < s; f++) {
395
- const d = m + f, g = l[d];
396
- c = (c || t).getNextSibling(), A(c) || b(125);
397
- let _ = null;
428
+ for (let g = 1; g < s; g++) {
429
+ const d = f + g, m = l[d];
430
+ c = (c || t).getNextSibling(), k(c) || w(125);
431
+ let C = null;
398
432
  for (let S = 0; S < u; S++) {
399
- const N = g[S], y = N.cell;
400
- N.startRow === d && (_ = y), y.__colSpan > 1 && (S += y.__colSpan - 1);
433
+ const N = m[S], y = N.cell;
434
+ N.startRow === d && (C = y), y.__colSpan > 1 && (S += y.__colSpan - 1);
401
435
  }
402
- if (_ === null) for (let S = r - 1; S >= 0; S--) Et(c, X(p[S] | a[f]).append(I()));
403
- else for (let S = r - 1; S >= 0; S--) _.insertAfter(X(p[S] | a[f]).append(I()));
436
+ if (C === null) for (let S = r - 1; S >= 0; S--) Mt(c, X(p[S] | a[g]).append(U()));
437
+ else for (let S = r - 1; S >= 0; S--) C.insertAfter(X(p[S] | a[g]).append(U()));
404
438
  }
405
439
  e.setRowSpan(1);
406
440
  }
407
441
  }
408
- function U(n, e, t) {
442
+ function J(n, e, t) {
409
443
  const [o, r, s] = oe(n, e, t);
410
- return r === null && b(207), s === null && b(208), [o, r, s];
444
+ return r === null && w(207), s === null && w(208), [o, r, s];
411
445
  }
412
446
  function oe(n, e, t) {
413
447
  const o = [];
414
448
  let r = null, s = null;
415
449
  function l(u) {
416
- let m = o[u];
417
- return m === void 0 && (o[u] = m = []), m;
450
+ let f = o[u];
451
+ return f === void 0 && (o[u] = f = []), f;
418
452
  }
419
453
  const i = n.getChildren();
420
454
  for (let u = 0; u < i.length; u++) {
421
- const m = i[u];
422
- A(m) || b(209);
455
+ const f = i[u];
456
+ k(f) || w(209);
423
457
  const h = l(u);
424
- for (let p = m.getFirstChild(), C = 0; p != null; p = p.getNextSibling()) {
425
- for (w(p) || b(147); h[C] !== void 0; ) C++;
426
- const a = { cell: p, startColumn: C, startRow: u }, { __rowSpan: c, __colSpan: f } = p;
458
+ for (let p = f.getFirstChild(), _ = 0; p != null; p = p.getNextSibling()) {
459
+ for (b(p) || w(147); h[_] !== void 0; ) _++;
460
+ const a = { cell: p, startColumn: _, startRow: u }, { __rowSpan: c, __colSpan: g } = p;
427
461
  for (let d = 0; d < c && !(u + d >= i.length); d++) {
428
- const g = l(u + d);
429
- for (let _ = 0; _ < f; _++) g[C + _] = a;
462
+ const m = l(u + d);
463
+ for (let C = 0; C < g; C++) m[_ + C] = a;
430
464
  }
431
465
  e !== null && r === null && e.is(p) && (r = a), t !== null && s === null && t.is(p) && (s = a);
432
466
  }
433
467
  }
434
468
  return [o, r, s];
435
469
  }
436
- function Z(n) {
470
+ function I(n) {
437
471
  let e;
438
472
  if (n instanceof ce) e = n;
439
473
  else if ("__type" in n) {
440
- const r = T(n, w);
441
- w(r) || b(148), e = r;
474
+ const r = T(n, b);
475
+ b(r) || w(148), e = r;
442
476
  } else {
443
- const r = T(n.getNode(), w);
444
- w(r) || b(148), e = r;
477
+ const r = T(n.getNode(), b);
478
+ b(r) || w(148), e = r;
445
479
  }
446
480
  const t = e.getParent();
447
- A(t) || b(149);
481
+ k(t) || w(149);
448
482
  const o = t.getParent();
449
- return $(o) || b(210), [e, t, o];
483
+ return $(o) || w(210), [e, t, o];
450
484
  }
451
485
  function ke(n, e, t) {
452
486
  let o, r = Math.min(e.startColumn, t.startColumn), s = Math.min(e.startRow, t.startRow), l = Math.max(e.startColumn + e.cell.__colSpan - 1, t.startColumn + t.cell.__colSpan - 1), i = Math.max(e.startRow + e.cell.__rowSpan - 1, t.startRow + t.cell.__rowSpan - 1);
453
487
  do {
454
488
  o = !1;
455
- for (let u = 0; u < n.length; u++) for (let m = 0; m < n[0].length; m++) {
456
- const h = n[u][m];
489
+ for (let u = 0; u < n.length; u++) for (let f = 0; f < n[0].length; f++) {
490
+ const h = n[u][f];
457
491
  if (!h) continue;
458
- const p = h.startColumn + h.cell.__colSpan - 1, C = h.startRow + h.cell.__rowSpan - 1, a = h.startColumn <= l && p >= r, c = h.startRow <= i && C >= s;
492
+ const p = h.startColumn + h.cell.__colSpan - 1, _ = h.startRow + h.cell.__rowSpan - 1, a = h.startColumn <= l && p >= r, c = h.startRow <= i && _ >= s;
459
493
  if (a && c) {
460
- const f = Math.min(r, h.startColumn), d = Math.max(l, p), g = Math.min(s, h.startRow), _ = Math.max(i, C);
461
- f === r && d === l && g === s && _ === i || (r = f, l = d, s = g, i = _, o = !0);
494
+ const g = Math.min(r, h.startColumn), d = Math.max(l, p), m = Math.min(s, h.startRow), C = Math.max(i, _);
495
+ g === r && d === l && m === s && C === i || (r = g, l = d, s = m, i = C, o = !0);
462
496
  }
463
497
  }
464
498
  } while (o);
465
499
  return { maxColumn: l, maxRow: i, minColumn: r, minRow: s };
466
500
  }
467
- function pt(n) {
468
- const [e, , t] = Z(n), o = t.getChildren(), r = o.length, s = o[0].getChildren().length, l = new Array(r);
501
+ function St(n) {
502
+ const [e, , t] = I(n), o = t.getChildren(), r = o.length, s = o[0].getChildren().length, l = new Array(r);
469
503
  for (let i = 0; i < r; i++) l[i] = new Array(s);
470
504
  for (let i = 0; i < r; i++) {
471
505
  const u = o[i].getChildren();
472
- let m = 0;
506
+ let f = 0;
473
507
  for (let h = 0; h < u.length; h++) {
474
- for (; l[i][m]; ) m++;
475
- const p = u[h], C = p.__rowSpan || 1, a = p.__colSpan || 1;
476
- for (let c = 0; c < C; c++) for (let f = 0; f < a; f++) l[i + c][m + f] = p;
477
- if (e === p) return { colSpan: a, columnIndex: m, rowIndex: i, rowSpan: C };
478
- m += a;
508
+ for (; l[i][f]; ) f++;
509
+ const p = u[h], _ = p.__rowSpan || 1, a = p.__colSpan || 1;
510
+ for (let c = 0; c < _; c++) for (let g = 0; g < a; g++) l[i + c][f + g] = p;
511
+ if (e === p) return { colSpan: a, columnIndex: f, rowIndex: i, rowSpan: _ };
512
+ f += a;
479
513
  }
480
514
  }
481
515
  return null;
482
516
  }
483
- function Ct(n) {
484
- const [[e, t, o, r], [s, l, i, u]] = ["anchor", "focus"].map((m) => {
485
- const h = n[m].getNode(), p = T(h, w);
486
- w(p) || b(238, m, h.getKey(), h.getType());
487
- const C = p.getParent();
488
- A(C) || b(239, m);
489
- const a = C.getParent();
490
- return $(a) || b(240, m), [h, p, C, a];
517
+ function wt(n) {
518
+ const [[e, t, o, r], [s, l, i, u]] = ["anchor", "focus"].map((f) => {
519
+ const h = n[f].getNode(), p = T(h, b);
520
+ b(p) || w(238, f, h.getKey(), h.getType());
521
+ const _ = p.getParent();
522
+ k(_) || w(239, f);
523
+ const a = _.getParent();
524
+ return $(a) || w(240, f), [h, p, _, a];
491
525
  });
492
- return r.is(u) || b(241), { anchorCell: t, anchorNode: e, anchorRow: o, anchorTable: r, focusCell: l, focusNode: s, focusRow: i, focusTable: u };
526
+ return r.is(u) || w(241), { anchorCell: t, anchorNode: e, anchorRow: o, anchorTable: r, focusCell: l, focusNode: s, focusRow: i, focusTable: u };
493
527
  }
494
528
  class ze {
495
529
  constructor(e, t, o) {
@@ -511,7 +545,7 @@ class ze {
511
545
  this._cachedNodes = e;
512
546
  }
513
547
  is(e) {
514
- return K(e) && this.tableKey === e.tableKey && this.anchor.is(e.anchor) && this.focus.is(e.focus);
548
+ return O(e) && this.tableKey === e.tableKey && this.anchor.is(e.anchor) && this.focus.is(e.focus);
515
549
  }
516
550
  set(e, t, o) {
517
551
  this.dirty = this.dirty || e !== this.tableKey || t !== this.anchor.key || o !== this.focus.key, this.tableKey = e, this.anchor.key = t, this.focus.key = o, this._cachedNodes = null;
@@ -531,22 +565,22 @@ class ze {
531
565
  }
532
566
  hasFormat(e) {
533
567
  let t = 0;
534
- this.getNodes().filter(w).forEach((r) => {
568
+ this.getNodes().filter(b).forEach((r) => {
535
569
  const s = r.getFirstChild();
536
- tt(s) && (t |= s.getTextFormat());
570
+ rt(s) && (t |= s.getTextFormat());
537
571
  });
538
- const o = Rn[e];
572
+ const o = on[e];
539
573
  return !!(t & o);
540
574
  }
541
575
  insertNodes(e) {
542
576
  const t = this.focus.getNode();
543
- D(t) || b(151), vn(t.select(0, t.getChildrenSize())).insertNodes(e);
577
+ D(t) || w(151), tn(t.select(0, t.getChildrenSize())).insertNodes(e);
544
578
  }
545
579
  getShape() {
546
- const { anchorCell: e, focusCell: t } = Ct(this), o = pt(e);
547
- o === null && b(153);
548
- const r = pt(t);
549
- r === null && b(155);
580
+ const { anchorCell: e, focusCell: t } = wt(this), o = St(e);
581
+ o === null && w(153);
582
+ const r = St(t);
583
+ r === null && w(155);
550
584
  const s = Math.min(o.columnIndex, r.columnIndex), l = Math.max(o.columnIndex + o.colSpan - 1, r.columnIndex + r.colSpan - 1), i = Math.min(o.rowIndex, r.rowIndex), u = Math.max(o.rowIndex + o.rowSpan - 1, r.rowIndex + r.rowSpan - 1);
551
585
  return { fromX: Math.min(s, l), fromY: Math.min(i, u), toX: Math.max(s, l), toY: Math.max(i, u) };
552
586
  }
@@ -554,30 +588,30 @@ class ze {
554
588
  if (!this.isValid()) return [];
555
589
  const e = this._cachedNodes;
556
590
  if (e !== null) return e;
557
- const { anchorTable: t, anchorCell: o, focusCell: r } = Ct(this), s = r.getParents()[1];
591
+ const { anchorTable: t, anchorCell: o, focusCell: r } = wt(this), s = r.getParents()[1];
558
592
  if (s !== t) {
559
593
  if (t.isParentOf(r)) {
560
594
  const d = s.getParent();
561
- d == null && b(159), this.set(this.tableKey, r.getKey(), d.getKey());
595
+ d == null && w(159), this.set(this.tableKey, r.getKey(), d.getKey());
562
596
  } else {
563
597
  const d = t.getParent();
564
- d == null && b(158), this.set(this.tableKey, d.getKey(), r.getKey());
598
+ d == null && w(158), this.set(this.tableKey, d.getKey(), r.getKey());
565
599
  }
566
600
  return this.getNodes();
567
601
  }
568
- const [l, i, u] = U(t, o, r), { minColumn: m, maxColumn: h, minRow: p, maxRow: C } = ke(l, i, u), a = /* @__PURE__ */ new Map([[t.getKey(), t]]);
602
+ const [l, i, u] = J(t, o, r), { minColumn: f, maxColumn: h, minRow: p, maxRow: _ } = ke(l, i, u), a = /* @__PURE__ */ new Map([[t.getKey(), t]]);
569
603
  let c = null;
570
- for (let d = p; d <= C; d++) for (let g = m; g <= h; g++) {
571
- const { cell: _ } = l[d][g], S = _.getParent();
572
- A(S) || b(160), S !== c && (a.set(S.getKey(), S), c = S), a.has(_.getKey()) || Bn(_, (N) => {
604
+ for (let d = p; d <= _; d++) for (let m = f; m <= h; m++) {
605
+ const { cell: C } = l[d][m], S = C.getParent();
606
+ k(S) || w(160), S !== c && (a.set(S.getKey(), S), c = S), a.has(C.getKey()) || Bn(C, (N) => {
573
607
  a.set(N.getKey(), N);
574
608
  });
575
609
  }
576
- const f = Array.from(a.values());
577
- return Tn() || (this._cachedNodes = f), f;
610
+ const g = Array.from(a.values());
611
+ return nn() || (this._cachedNodes = g), g;
578
612
  }
579
613
  getTextContent() {
580
- const e = this.getNodes().filter((o) => w(o));
614
+ const e = this.getNodes().filter((o) => b(o));
581
615
  let t = "";
582
616
  for (let o = 0; o < e.length; o++) {
583
617
  const r = e[o], s = r.__parent, l = (e[o + 1] || {}).__parent;
@@ -587,16 +621,16 @@ class ze {
587
621
  return t;
588
622
  }
589
623
  }
590
- function K(n) {
624
+ function O(n) {
591
625
  return n instanceof ze;
592
626
  }
593
- function kt() {
627
+ function zt() {
594
628
  const n = Ee("root", 0, "element"), e = Ee("root", 0, "element");
595
629
  return new ze("root", n, e);
596
630
  }
597
631
  function Hn(n, e, t) {
598
632
  n.getKey(), e.getKey(), t.getKey();
599
- const o = B(), r = K(o) ? o.clone() : kt();
633
+ const o = L(), r = O(o) ? o.clone() : zt();
600
634
  return r.set(n.getKey(), e.getKey(), t.getKey()), r;
601
635
  }
602
636
  function Bn(n, e) {
@@ -606,11 +640,11 @@ function Bn(n, e) {
606
640
  r === void 0 ? t.pop() : e(r) !== !1 && D(r) && t.push(r.getChildren());
607
641
  }
608
642
  }
609
- function $t(n, e = Tt()) {
643
+ function Lt(n, e = Ot()) {
610
644
  const t = Ae(n);
611
- $(t) || b(231, n);
645
+ $(t) || w(231, n);
612
646
  const o = ie(t, e.getElementByKey(n));
613
- return o === null && b(232, n), { tableElement: o, tableNode: t };
647
+ return o === null && w(232, n), { tableElement: o, tableNode: t };
614
648
  }
615
649
  class Dn {
616
650
  constructor(e, t) {
@@ -623,7 +657,7 @@ class Dn {
623
657
  this.abortController.abort("removeListeners"), Array.from(this.listenersToRemove).forEach((e) => e()), this.listenersToRemove.clear();
624
658
  }
625
659
  $lookup() {
626
- return $t(this.tableNodeKey, this.editor);
660
+ return Lt(this.tableNodeKey, this.editor);
627
661
  }
628
662
  trackTable() {
629
663
  const e = new MutationObserver((t) => {
@@ -650,7 +684,7 @@ class Dn {
650
684
  const e = this.editor;
651
685
  this.isHighlightingCells = !1, this.anchorX = -1, this.anchorY = -1, this.focusX = -1, this.focusY = -1, this.tableSelection = null, this.anchorCellNodeKey = null, this.focusCellNodeKey = null, this.anchorCell = null, this.focusCell = null, this.hasHijackedSelectionStyles = !1, this.$enableHighlightStyle();
652
686
  const { tableNode: t, tableElement: o } = this.$lookup();
653
- Fe(e, me(t, o), null), B() !== null && (ne(null), e.dispatchCommand(fe, void 0));
687
+ Fe(e, me(t, o), null), L() !== null && (ne(null), e.dispatchCommand(fe, void 0));
654
688
  }
655
689
  $enableHighlightStyle() {
656
690
  const e = this.editor, { tableElement: t } = this.$lookup();
@@ -658,11 +692,11 @@ class Dn {
658
692
  }
659
693
  $disableHighlightStyle() {
660
694
  const { tableElement: e } = this.$lookup();
661
- Q(e, this.editor._config.theme.tableSelection), this.hasHijackedSelectionStyles = !0;
695
+ G(e, this.editor._config.theme.tableSelection), this.hasHijackedSelectionStyles = !0;
662
696
  }
663
697
  $updateTableTableSelection(e) {
664
698
  if (e !== null) {
665
- e.tableKey !== this.tableNodeKey && b(233, e.tableKey, this.tableNodeKey);
699
+ e.tableKey !== this.tableNodeKey && w(233, e.tableKey, this.tableNodeKey);
666
700
  const t = this.editor;
667
701
  this.tableSelection = e, this.isHighlightingCells = !0, this.$disableHighlightStyle(), this.updateDOMSelection(), Fe(t, this.table, this.tableSelection);
668
702
  } else this.$clearHighlight();
@@ -692,7 +726,7 @@ class Dn {
692
726
  if (s === this.focusX && l === this.focusY) return !1;
693
727
  } else this.isHighlightingCells = !0, this.$disableHighlightStyle();
694
728
  if (this.focusX = s, this.focusY = l, this.isHighlightingCells) {
695
- const i = je(r, e.elem);
729
+ const i = Ge(r, e.elem);
696
730
  if (this.tableSelection != null && this.anchorCellNodeKey != null && i !== null) return this.focusCellNodeKey = i.getKey(), this.tableSelection = Hn(r, this.$getAnchorTableCellOrThrow(), i), ne(this.tableSelection), o.dispatchCommand(fe, void 0), Fe(o, this.table, this.tableSelection), !0;
697
731
  }
698
732
  return !1;
@@ -702,339 +736,339 @@ class Dn {
702
736
  }
703
737
  $getAnchorTableCellOrThrow() {
704
738
  const e = this.$getAnchorTableCell();
705
- return e === null && b(234), e;
739
+ return e === null && w(234), e;
706
740
  }
707
741
  $getFocusTableCell() {
708
742
  return this.focusCellNodeKey ? Ae(this.focusCellNodeKey) : null;
709
743
  }
710
744
  $getFocusTableCellOrThrow() {
711
745
  const e = this.$getFocusTableCell();
712
- return e === null && b(235), e;
746
+ return e === null && w(235), e;
713
747
  }
714
748
  $setAnchorCellForSelection(e) {
715
749
  this.isHighlightingCells = !1, this.anchorCell = e, this.anchorX = e.x, this.anchorY = e.y;
716
- const { tableNode: t } = this.$lookup(), o = je(t, e.elem);
750
+ const { tableNode: t } = this.$lookup(), o = Ge(t, e.elem);
717
751
  if (o !== null) {
718
752
  const r = o.getKey();
719
- this.tableSelection = this.tableSelection != null ? this.tableSelection.clone() : kt(), this.anchorCellNodeKey = r;
753
+ this.tableSelection = this.tableSelection != null ? this.tableSelection.clone() : zt(), this.anchorCellNodeKey = r;
720
754
  }
721
755
  }
722
756
  $formatCells(e) {
723
- const t = B();
724
- K(t) || b(236);
725
- const o = Cn(), r = o.anchor, s = o.focus, l = t.getNodes().filter(w);
726
- l.length > 0 || b(237);
727
- const i = l[0].getFirstChild(), u = tt(i) ? i.getFormatFlags(e, null) : null;
728
- l.forEach((m) => {
729
- r.set(m.getKey(), 0, "element"), s.set(m.getKey(), m.getChildrenSize(), "element"), o.formatText(e, u);
757
+ const t = L();
758
+ O(t) || w(236);
759
+ const o = Nn(), r = o.anchor, s = o.focus, l = t.getNodes().filter(b);
760
+ l.length > 0 || w(237);
761
+ const i = l[0].getFirstChild(), u = rt(i) ? i.getFormatFlags(e, null) : null;
762
+ l.forEach((f) => {
763
+ r.set(f.getKey(), 0, "element"), s.set(f.getKey(), f.getChildrenSize(), "element"), o.formatText(e, u);
730
764
  }), ne(t), this.editor.dispatchCommand(fe, void 0);
731
765
  }
732
766
  $clearText() {
733
767
  const { editor: e } = this, t = Ae(this.tableNodeKey);
734
768
  if (!$(t)) throw new Error("Expected TableNode.");
735
- const o = B();
736
- K(o) || b(253);
737
- const r = o.getNodes().filter(w), s = t.getFirstChild(), l = t.getLastChild();
738
- if (r.length > 0 && s !== null && l !== null && A(s) && A(l) && r[0] === s.getFirstChild() && r[r.length - 1] === l.getLastChild()) {
769
+ const o = L();
770
+ O(o) || w(253);
771
+ const r = o.getNodes().filter(b), s = t.getFirstChild(), l = t.getLastChild();
772
+ if (r.length > 0 && s !== null && l !== null && k(s) && k(l) && r[0] === s.getFirstChild() && r[r.length - 1] === l.getLastChild()) {
739
773
  t.selectPrevious();
740
774
  const i = t.getParent();
741
- return t.remove(), void (_n(i) && i.isEmpty() && e.dispatchCommand(Ot, void 0));
775
+ return t.remove(), void (vn(i) && i.isEmpty() && e.dispatchCommand(Et, void 0));
742
776
  }
743
777
  r.forEach((i) => {
744
778
  if (D(i)) {
745
- const u = I(), m = et();
746
- u.append(m), i.append(u), i.getChildren().forEach((h) => {
779
+ const u = U(), f = ot();
780
+ u.append(f), i.append(u), i.getChildren().forEach((h) => {
747
781
  h !== u && h.remove();
748
782
  });
749
783
  }
750
784
  }), Fe(e, this.table, null), ne(null), e.dispatchCommand(fe, void 0);
751
785
  }
752
786
  }
753
- const qe = "__lexicalTableSelection", In = (n) => !(1 & ~n.buttons);
787
+ const Qe = "__lexicalTableSelection", In = (n) => !(1 & ~n.buttons);
754
788
  function de(n) {
755
789
  return Ne(n) && n.nodeName === "TABLE";
756
790
  }
757
791
  function ie(n, e) {
758
792
  if (!e) return e;
759
793
  const t = de(e) ? e : n.getDOMSlot(e).element;
760
- return t.nodeName !== "TABLE" && b(245, e.nodeName), t;
794
+ return t.nodeName !== "TABLE" && w(245, e.nodeName), t;
761
795
  }
762
- function rt(n) {
796
+ function it(n) {
763
797
  return n._window;
764
798
  }
765
- function xe(n, e) {
799
+ function ve(n, e) {
766
800
  for (let t = e, o = null; t !== null; t = t.getParent()) {
767
801
  if (n.is(t)) return o;
768
- w(t) && (o = t);
802
+ b(t) && (o = t);
769
803
  }
770
804
  return null;
771
805
  }
772
- const Jn = [[en, "down"], [tn, "up"], [nn, "backward"], [on, "forward"]], Un = [ln, Ft, sn], Xn = [an, cn];
773
- function Yn(n, e, t, o) {
774
- const r = t.getRootElement(), s = rt(t);
775
- r !== null && s !== null || b(246);
806
+ const Jn = [[sn, "down"], [an, "up"], [cn, "backward"], [un, "forward"]], Un = [dn, At, fn], Yn = [gn, mn];
807
+ function Xn(n, e, t, o) {
808
+ const r = t.getRootElement(), s = it(t);
809
+ r !== null && s !== null || w(246);
776
810
  const l = new Dn(t, n.getKey()), i = ie(n, e);
777
811
  (function(a, c) {
778
- _t(a) !== null && b(205), a[qe] = c;
812
+ bt(a) !== null && w(205), a[Qe] = c;
779
813
  })(i, l), l.listenersToRemove.add(() => function(a, c) {
780
- _t(a) === c && delete a[qe];
814
+ bt(a) === c && delete a[Qe];
781
815
  }(i, l));
782
816
  const u = (a) => {
783
817
  if (l.pointerType = a.pointerType, a.button !== 0 || !ye(a.target) || !s) return;
784
818
  const c = $e(a.target);
785
819
  c !== null && t.update(() => {
786
- const f = Ue();
787
- if (mt && a.shiftKey && V(f, n) && (z(f) || K(f))) {
788
- const d = f.anchor.getNode(), g = xe(n, f.anchor.getNode());
789
- g ? (l.$setAnchorCellForSelection(se(l, g)), l.$setFocusCellForSelection(c), ee(a)) : (n.isBefore(d) ? n.selectStart() : n.selectEnd()).anchor.set(f.anchor.key, f.anchor.offset, f.anchor.type);
820
+ const g = Ue();
821
+ if (Ct && a.shiftKey && Q(g, n) && (M(g) || O(g))) {
822
+ const d = g.anchor.getNode(), m = ve(n, g.anchor.getNode());
823
+ m ? (l.$setAnchorCellForSelection(se(l, m)), l.$setFocusCellForSelection(c), ee(a)) : (n.isBefore(d) ? n.selectStart() : n.selectEnd()).anchor.set(g.anchor.key, g.anchor.offset, g.anchor.type);
790
824
  } else a.pointerType !== "touch" && l.$setAnchorCellForSelection(c);
791
825
  }), (() => {
792
826
  if (l.isSelecting) return;
793
- const f = () => {
794
- l.isSelecting = !1, s.removeEventListener("pointerup", f), s.removeEventListener("pointermove", d);
795
- }, d = (g) => {
796
- if (!In(g) && l.isSelecting) return l.isSelecting = !1, s.removeEventListener("pointerup", f), void s.removeEventListener("pointermove", d);
797
- if (!ye(g.target)) return;
798
- let _ = null;
799
- const S = !(mt || i.contains(g.target));
800
- if (S) _ = St(i, g.target);
801
- else for (const N of document.elementsFromPoint(g.clientX, g.clientY)) if (_ = St(i, N), _) break;
802
- !_ || l.focusCell !== null && _.elem === l.focusCell.elem || (l.setNextFocus({ focusCell: _, override: S }), t.dispatchCommand(fe, void 0));
827
+ const g = () => {
828
+ l.isSelecting = !1, s.removeEventListener("pointerup", g), s.removeEventListener("pointermove", d);
829
+ }, d = (m) => {
830
+ if (!In(m) && l.isSelecting) return l.isSelecting = !1, s.removeEventListener("pointerup", g), void s.removeEventListener("pointermove", d);
831
+ if (!ye(m.target)) return;
832
+ let C = null;
833
+ const S = !(Ct || i.contains(m.target));
834
+ if (S) C = yt(i, m.target);
835
+ else for (const N of document.elementsFromPoint(m.clientX, m.clientY)) if (C = yt(i, N), C) break;
836
+ !C || l.focusCell !== null && C.elem === l.focusCell.elem || (l.setNextFocus({ focusCell: C, override: S }), t.dispatchCommand(fe, void 0));
803
837
  };
804
- l.isSelecting = !0, s.addEventListener("pointerup", f, l.listenerOptions), s.addEventListener("pointermove", d, l.listenerOptions);
838
+ l.isSelecting = !0, s.addEventListener("pointerup", g, l.listenerOptions), s.addEventListener("pointermove", d, l.listenerOptions);
805
839
  })();
806
840
  };
807
841
  i.addEventListener("pointerdown", u, l.listenerOptions), l.listenersToRemove.add(() => {
808
842
  i.removeEventListener("pointerdown", u);
809
843
  });
810
- const m = (a) => {
844
+ const f = (a) => {
811
845
  a.detail >= 3 && ye(a.target) && $e(a.target) !== null && a.preventDefault();
812
846
  };
813
- i.addEventListener("mousedown", m, l.listenerOptions), l.listenersToRemove.add(() => {
814
- i.removeEventListener("mousedown", m);
847
+ i.addEventListener("mousedown", f, l.listenerOptions), l.listenersToRemove.add(() => {
848
+ i.removeEventListener("mousedown", f);
815
849
  });
816
850
  const h = (a) => {
817
851
  const c = a.target;
818
852
  a.button === 0 && ye(c) && t.update(() => {
819
- const f = B();
820
- K(f) && f.tableKey === l.tableNodeKey && r.contains(c) && l.$clearHighlight();
853
+ const g = L();
854
+ O(g) && g.tableKey === l.tableNodeKey && r.contains(c) && l.$clearHighlight();
821
855
  });
822
856
  };
823
857
  s.addEventListener("pointerdown", h, l.listenerOptions), l.listenersToRemove.add(() => {
824
858
  s.removeEventListener("pointerdown", h);
825
859
  });
826
- for (const [a, c] of Jn) l.listenersToRemove.add(t.registerCommand(a, (f) => Lt(t, f, c, n, l), Ie));
827
- l.listenersToRemove.add(t.registerCommand(rn, (a) => {
828
- const c = B();
829
- if (K(c)) {
830
- const f = xe(n, c.focus.getNode());
831
- if (f !== null) return ee(a), f.selectEnd(), !0;
860
+ for (const [a, c] of Jn) l.listenersToRemove.add(t.registerCommand(a, (g) => Ht(t, g, c, n, l), Ie));
861
+ l.listenersToRemove.add(t.registerCommand(hn, (a) => {
862
+ const c = L();
863
+ if (O(c)) {
864
+ const g = ve(n, c.focus.getNode());
865
+ if (g !== null) return ee(a), g.selectEnd(), !0;
832
866
  }
833
867
  return !1;
834
868
  }, Ie));
835
869
  const p = (a) => () => {
836
- const c = B();
837
- if (!V(c, n)) return !1;
838
- if (K(c)) return l.$clearText(), !0;
839
- if (z(c)) {
840
- if (!w(xe(n, c.anchor.getNode()))) return !1;
841
- const f = c.anchor.getNode(), d = c.focus.getNode(), g = n.isParentOf(f), _ = n.isParentOf(d);
842
- if (g && !_ || _ && !g) return l.$clearText(), !0;
843
- const S = T(c.anchor.getNode(), (y) => D(y)), N = S && T(S, (y) => D(y) && w(y.getParent()));
870
+ const c = L();
871
+ if (!Q(c, n)) return !1;
872
+ if (O(c)) return l.$clearText(), !0;
873
+ if (M(c)) {
874
+ if (!b(ve(n, c.anchor.getNode()))) return !1;
875
+ const g = c.anchor.getNode(), d = c.focus.getNode(), m = n.isParentOf(g), C = n.isParentOf(d);
876
+ if (m && !C || C && !m) return l.$clearText(), !0;
877
+ const S = T(c.anchor.getNode(), (y) => D(y)), N = S && T(S, (y) => D(y) && b(y.getParent()));
844
878
  if (!D(N) || !D(S)) return !1;
845
- if (a === Ft && N.getPreviousSibling() === null) return !0;
879
+ if (a === At && N.getPreviousSibling() === null) return !0;
846
880
  }
847
881
  return !1;
848
882
  };
849
883
  for (const a of Un) l.listenersToRemove.add(t.registerCommand(a, p(a), j));
850
- const C = (a) => {
851
- const c = B();
852
- if (!K(c) && !z(c)) return !1;
853
- const f = n.isParentOf(c.anchor.getNode());
854
- if (f !== n.isParentOf(c.focus.getNode())) {
855
- const d = f ? "anchor" : "focus", g = f ? "focus" : "anchor", { key: _, offset: S, type: N } = c[g];
856
- return n[c[d].isBefore(c[g]) ? "selectPrevious" : "selectNext"]()[g].set(_, S, N), !1;
884
+ const _ = (a) => {
885
+ const c = L();
886
+ if (!O(c) && !M(c)) return !1;
887
+ const g = n.isParentOf(c.anchor.getNode());
888
+ if (g !== n.isParentOf(c.focus.getNode())) {
889
+ const d = g ? "anchor" : "focus", m = g ? "focus" : "anchor", { key: C, offset: S, type: N } = c[m];
890
+ return n[c[d].isBefore(c[m]) ? "selectPrevious" : "selectNext"]()[m].set(C, S, N), !1;
857
891
  }
858
- return !!V(c, n) && !!K(c) && (a && (a.preventDefault(), a.stopPropagation()), l.$clearText(), !0);
892
+ return !!Q(c, n) && !!O(c) && (a && (a.preventDefault(), a.stopPropagation()), l.$clearText(), !0);
859
893
  };
860
- for (const a of Xn) l.listenersToRemove.add(t.registerCommand(a, C, j));
861
- return l.listenersToRemove.add(t.registerCommand(un, (a) => {
862
- const c = B();
894
+ for (const a of Yn) l.listenersToRemove.add(t.registerCommand(a, _, j));
895
+ return l.listenersToRemove.add(t.registerCommand(pn, (a) => {
896
+ const c = L();
863
897
  if (c) {
864
- if (!K(c) && !z(c)) return !1;
865
- Fn(t, jt(a, ClipboardEvent) ? a : null, On(c));
866
- const f = C(a);
867
- return z(c) ? (c.removeText(), !0) : f;
898
+ if (!O(c) && !M(c)) return !1;
899
+ An(t, Gt(a, ClipboardEvent) ? a : null, En(c));
900
+ const g = _(a);
901
+ return M(c) ? (c.removeText(), !0) : g;
868
902
  }
869
903
  return !1;
870
- }, j)), l.listenersToRemove.add(t.registerCommand(hn, (a) => {
871
- const c = B();
872
- if (!V(c, n)) return !1;
873
- if (K(c)) return l.$formatCells(a), !0;
874
- if (z(c)) {
875
- const f = T(c.anchor.getNode(), (d) => w(d));
876
- if (!w(f)) return !1;
904
+ }, j)), l.listenersToRemove.add(t.registerCommand(_n, (a) => {
905
+ const c = L();
906
+ if (!Q(c, n)) return !1;
907
+ if (O(c)) return l.$formatCells(a), !0;
908
+ if (M(c)) {
909
+ const g = T(c.anchor.getNode(), (d) => b(d));
910
+ if (!b(g)) return !1;
877
911
  }
878
912
  return !1;
879
- }, j)), l.listenersToRemove.add(t.registerCommand(dn, (a) => {
880
- const c = B();
881
- if (!K(c) || !V(c, n)) return !1;
882
- const f = c.anchor.getNode(), d = c.focus.getNode();
883
- if (!w(f) || !w(d)) return !1;
884
- if (function(O, M) {
885
- if (K(O)) {
886
- const R = O.anchor.getNode(), F = O.focus.getNode();
887
- if (M && R && F) {
888
- const [W] = U(M, R, F);
889
- return R.getKey() === W[0][0].cell.getKey() && F.getKey() === W[W.length - 1].at(-1).cell.getKey();
913
+ }, j)), l.listenersToRemove.add(t.registerCommand(Cn, (a) => {
914
+ const c = L();
915
+ if (!O(c) || !Q(c, n)) return !1;
916
+ const g = c.anchor.getNode(), d = c.focus.getNode();
917
+ if (!b(g) || !b(d)) return !1;
918
+ if (function(A, z) {
919
+ if (O(A)) {
920
+ const F = A.anchor.getNode(), K = A.focus.getNode();
921
+ if (z && F && K) {
922
+ const [P] = J(z, F, K);
923
+ return F.getKey() === P[0][0].cell.getKey() && K.getKey() === P[P.length - 1].at(-1).cell.getKey();
890
924
  }
891
925
  }
892
926
  return !1;
893
927
  }(c, n)) return n.setFormat(a), !0;
894
- const [g, _, S] = U(n, f, d), N = Math.max(_.startRow + _.cell.__rowSpan - 1, S.startRow + S.cell.__rowSpan - 1), y = Math.max(_.startColumn + _.cell.__colSpan - 1, S.startColumn + S.cell.__colSpan - 1), v = Math.min(_.startRow, S.startRow), E = Math.min(_.startColumn, S.startColumn), k = /* @__PURE__ */ new Set();
895
- for (let O = v; O <= N; O++) for (let M = E; M <= y; M++) {
896
- const R = g[O][M].cell;
897
- if (k.has(R)) continue;
898
- k.add(R), R.setFormat(a);
899
- const F = R.getChildren();
900
- for (let W = 0; W < F.length; W++) {
901
- const H = F[W];
902
- D(H) && !H.isInline() && H.setFormat(a);
928
+ const [m, C, S] = J(n, g, d), N = Math.max(C.startRow + C.cell.__rowSpan - 1, S.startRow + S.cell.__rowSpan - 1), y = Math.max(C.startColumn + C.cell.__colSpan - 1, S.startColumn + S.cell.__colSpan - 1), v = Math.min(C.startRow, S.startRow), R = Math.min(C.startColumn, S.startColumn), E = /* @__PURE__ */ new Set();
929
+ for (let A = v; A <= N; A++) for (let z = R; z <= y; z++) {
930
+ const F = m[A][z].cell;
931
+ if (E.has(F)) continue;
932
+ E.add(F), F.setFormat(a);
933
+ const K = F.getChildren();
934
+ for (let P = 0; P < K.length; P++) {
935
+ const B = K[P];
936
+ D(B) && !B.isInline() && B.setFormat(a);
903
937
  }
904
938
  }
905
939
  return !0;
906
- }, j)), l.listenersToRemove.add(t.registerCommand(fn, (a) => {
907
- const c = B();
908
- if (!V(c, n)) return !1;
909
- if (K(c)) return l.$clearHighlight(), !1;
910
- if (z(c)) {
911
- const f = T(c.anchor.getNode(), (d) => w(d));
912
- if (!w(f)) return !1;
940
+ }, j)), l.listenersToRemove.add(t.registerCommand(Sn, (a) => {
941
+ const c = L();
942
+ if (!Q(c, n)) return !1;
943
+ if (O(c)) return l.$clearHighlight(), !1;
944
+ if (M(c)) {
945
+ const g = T(c.anchor.getNode(), (d) => b(d));
946
+ if (!b(g)) return !1;
913
947
  if (typeof a == "string") {
914
- const d = yt(t, c, n);
915
- if (d) return bt(d, n, [et(a)]), !0;
948
+ const d = xt(t, c, n);
949
+ if (d) return vt(d, n, [ot(a)]), !0;
916
950
  }
917
951
  }
918
952
  return !1;
919
- }, j)), o && l.listenersToRemove.add(t.registerCommand(gn, (a) => {
920
- const c = B();
921
- if (!z(c) || !c.isCollapsed() || !V(c, n)) return !1;
922
- const f = be(c.anchor.getNode());
923
- return !(f === null || !n.is(pe(f))) && (ee(a), function(d, g) {
924
- const _ = g === "next" ? "getNextSibling" : "getPreviousSibling", S = g === "next" ? "getFirstChild" : "getLastChild", N = d[_]();
953
+ }, j)), o && l.listenersToRemove.add(t.registerCommand(wn, (a) => {
954
+ const c = L();
955
+ if (!M(c) || !c.isCollapsed() || !Q(c, n)) return !1;
956
+ const g = be(c.anchor.getNode());
957
+ return !(g === null || !n.is(pe(g))) && (ee(a), function(d, m) {
958
+ const C = m === "next" ? "getNextSibling" : "getPreviousSibling", S = m === "next" ? "getFirstChild" : "getLastChild", N = d[C]();
925
959
  if (D(N)) return N.selectEnd();
926
- const y = T(d, A);
927
- y === null && b(247);
928
- for (let E = y[_](); A(E); E = E[_]()) {
929
- const k = E[S]();
930
- if (D(k)) return k.selectEnd();
960
+ const y = T(d, k);
961
+ y === null && w(247);
962
+ for (let R = y[C](); k(R); R = R[C]()) {
963
+ const E = R[S]();
964
+ if (D(E)) return E.selectEnd();
931
965
  }
932
966
  const v = T(y, $);
933
- v === null && b(248), g === "next" ? v.selectNext() : v.selectPrevious();
934
- }(f, a.shiftKey ? "previous" : "next"), !0);
935
- }, j)), l.listenersToRemove.add(t.registerCommand(mn, (a) => n.isSelected(), Ie)), l.listenersToRemove.add(t.registerCommand(Rt, (a, c) => {
967
+ v === null && w(248), m === "next" ? v.selectNext() : v.selectPrevious();
968
+ }(g, a.shiftKey ? "previous" : "next"), !0);
969
+ }, j)), l.listenersToRemove.add(t.registerCommand(bn, (a) => n.isSelected(), Ie)), l.listenersToRemove.add(t.registerCommand(Kt, (a, c) => {
936
970
  if (t !== c) return !1;
937
- const { nodes: f, selection: d } = a, g = d.getStartEndPoints(), _ = K(d), S = z(d) && T(d.anchor.getNode(), (x) => w(x)) !== null && T(d.focus.getNode(), (x) => w(x)) !== null || _;
938
- if (f.length !== 1 || !$(f[0]) || !S || g === null) return !1;
939
- const [N, y] = g, [v, E, k] = Z(N), O = T(y.getNode(), (x) => w(x));
940
- if (!(w(v) && w(O) && A(E) && $(k))) return !1;
941
- const M = f[0], [R, F, W] = U(k, v, O), [H] = oe(M, null, null), te = R.length, _e = te > 0 ? R[0].length : 0;
942
- let Y = F.startRow, P = F.startColumn, le = H.length, ue = le > 0 ? H[0].length : 0;
943
- if (_) {
944
- const x = ke(R, F, W), J = x.maxRow - x.minRow + 1, q = x.maxColumn - x.minColumn + 1;
945
- Y = x.minRow, P = x.minColumn, le = Math.min(le, J), ue = Math.min(ue, q);
971
+ const { nodes: g, selection: d } = a, m = d.getStartEndPoints(), C = O(d), S = M(d) && T(d.anchor.getNode(), (x) => b(x)) !== null && T(d.focus.getNode(), (x) => b(x)) !== null || C;
972
+ if (g.length !== 1 || !$(g[0]) || !S || m === null) return !1;
973
+ const [N, y] = m, [v, R, E] = I(N), A = T(y.getNode(), (x) => b(x));
974
+ if (!(b(v) && b(A) && k(R) && $(E))) return !1;
975
+ const z = g[0], [F, K, P] = J(E, v, A), [B] = oe(z, null, null), te = F.length, Ce = te > 0 ? F[0].length : 0;
976
+ let q = K.startRow, H = K.startColumn, le = B.length, ue = le > 0 ? B[0].length : 0;
977
+ if (C) {
978
+ const x = ke(F, K, P), Y = x.maxRow - x.minRow + 1, V = x.maxColumn - x.minColumn + 1;
979
+ q = x.minRow, H = x.minColumn, le = Math.min(le, Y), ue = Math.min(ue, V);
946
980
  }
947
981
  let Le = !1;
948
- const Wt = Math.min(te, Y + le) - 1, Pt = Math.min(_e, P + ue) - 1, it = /* @__PURE__ */ new Set();
949
- for (let x = Y; x <= Wt; x++) for (let J = P; J <= Pt; J++) {
950
- const q = R[x][J];
951
- it.has(q.cell.getKey()) || q.cell.__rowSpan === 1 && q.cell.__colSpan === 1 || (Pn(q.cell), it.add(q.cell.getKey()), Le = !0);
982
+ const Bt = Math.min(te, q + le) - 1, Dt = Math.min(Ce, H + ue) - 1, ut = /* @__PURE__ */ new Set();
983
+ for (let x = q; x <= Bt; x++) for (let Y = H; Y <= Dt; Y++) {
984
+ const V = F[x][Y];
985
+ ut.has(V.cell.getKey()) || V.cell.__rowSpan === 1 && V.cell.__colSpan === 1 || (Pn(V.cell), ut.add(V.cell.getKey()), Le = !0);
952
986
  }
953
- let [Se] = oe(k.getWritable(), null, null);
954
- const Ht = le - te + Y;
955
- for (let x = 0; x < Ht; x++)
956
- $n(Se[te - 1][0].cell);
957
- const Bt = ue - _e + P;
958
- for (let x = 0; x < Bt; x++)
959
- Mn(Se[0][_e - 1].cell, !0, !1);
960
- [Se] = oe(k.getWritable(), null, null);
961
- for (let x = Y; x < Y + le; x++) for (let J = P; J < P + ue; J++) {
962
- const q = x - Y, at = J - P, We = H[q][at];
963
- if (We.startRow !== q || We.startColumn !== at) continue;
987
+ let [Se] = oe(E.getWritable(), null, null);
988
+ const It = le - te + q;
989
+ for (let x = 0; x < It; x++)
990
+ qe(Se[te - 1][0].cell);
991
+ const Jt = ue - Ce + H;
992
+ for (let x = 0; x < Jt; x++)
993
+ Ve(Se[0][Ce - 1].cell, !0, !1);
994
+ [Se] = oe(E.getWritable(), null, null);
995
+ for (let x = q; x < q + le; x++) for (let Y = H; Y < H + ue; Y++) {
996
+ const V = x - q, ht = Y - H, We = B[V][ht];
997
+ if (We.startRow !== V || We.startColumn !== ht) continue;
964
998
  const we = We.cell;
965
999
  if (we.__rowSpan !== 1 || we.__colSpan !== 1) {
966
- const G = [], It = Math.min(x + we.__rowSpan, Y + le) - 1, Jt = Math.min(J + we.__colSpan, P + ue) - 1;
967
- for (let He = x; He <= It; He++) for (let Be = J; Be <= Jt; Be++) {
968
- const Ut = Se[He][Be];
969
- G.push(Ut.cell);
1000
+ const Z = [], Yt = Math.min(x + we.__rowSpan, q + le) - 1, Xt = Math.min(Y + we.__colSpan, H + ue) - 1;
1001
+ for (let He = x; He <= Yt; He++) for (let Be = Y; Be <= Xt; Be++) {
1002
+ const qt = Se[He][Be];
1003
+ Z.push(qt.cell);
970
1004
  }
971
- Ln(G), Le = !0;
1005
+ Ln(Z), Le = !0;
972
1006
  }
973
- const { cell: Pe } = Se[x][J], Dt = Pe.getChildren();
974
- we.getChildren().forEach((G) => {
975
- Ce(G) && I().append(G), Pe.append(G);
976
- }), Dt.forEach((G) => G.remove());
1007
+ const { cell: Pe } = Se[x][Y], Ut = Pe.getChildren();
1008
+ we.getChildren().forEach((Z) => {
1009
+ _e(Z) && U().append(Z), Pe.append(Z);
1010
+ }), Ut.forEach((Z) => Z.remove());
977
1011
  }
978
- if (_ && Le) {
979
- const [x] = oe(k.getWritable(), null, null);
980
- x[F.startRow][F.startColumn].cell.selectEnd();
1012
+ if (C && Le) {
1013
+ const [x] = oe(E.getWritable(), null, null);
1014
+ x[K.startRow][K.startColumn].cell.selectEnd();
981
1015
  }
982
1016
  return !0;
983
1017
  }, j)), l.listenersToRemove.add(t.registerCommand(fe, () => {
984
- const a = B(), c = Ue(), f = l.getAndClearNextFocus();
985
- if (f !== null) {
986
- const { focusCell: d } = f;
987
- if (K(a) && a.tableKey === l.tableNodeKey) return (d.x !== l.focusX || d.y !== l.focusY) && (l.$setFocusCellForSelection(d), !0);
988
- if (d !== l.anchorCell && V(a, n)) return l.$setFocusCellForSelection(d), !0;
1018
+ const a = L(), c = Ue(), g = l.getAndClearNextFocus();
1019
+ if (g !== null) {
1020
+ const { focusCell: d } = g;
1021
+ if (O(a) && a.tableKey === l.tableNodeKey) return (d.x !== l.focusX || d.y !== l.focusY) && (l.$setFocusCellForSelection(d), !0);
1022
+ if (d !== l.anchorCell && Q(a, n)) return l.$setFocusCellForSelection(d), !0;
989
1023
  }
990
- if (l.getAndClearShouldCheckSelection() && z(c) && z(a) && a.isCollapsed()) {
991
- const d = a.anchor.getNode(), g = n.getFirstChild(), _ = be(d);
992
- if (_ !== null && A(g)) {
993
- const S = g.getFirstChild();
994
- if (w(S) && n.is(T(_, (N) => N.is(n) || N.is(S)))) return S.selectStart(), !0;
1024
+ if (l.getAndClearShouldCheckSelection() && M(c) && M(a) && a.isCollapsed()) {
1025
+ const d = a.anchor.getNode(), m = n.getFirstChild(), C = be(d);
1026
+ if (C !== null && k(m)) {
1027
+ const S = m.getFirstChild();
1028
+ if (b(S) && n.is(T(C, (N) => N.is(n) || N.is(S)))) return S.selectStart(), !0;
995
1029
  }
996
1030
  }
997
- if (z(a)) {
998
- const { anchor: d, focus: g } = a, _ = d.getNode(), S = g.getNode(), N = be(_), y = be(S), v = !(!N || !n.is(pe(N))), E = !(!y || !n.is(pe(y))), k = v !== E, O = v && E, M = a.isBackward();
999
- if (k) {
1000
- const R = a.clone();
1001
- if (E) {
1002
- const [F] = U(n, y, y), W = F[0][0].cell, H = F[F.length - 1].at(-1).cell;
1003
- R.focus.set(M ? W.getKey() : H.getKey(), M ? W.getChildrenSize() : H.getChildrenSize(), "element");
1031
+ if (M(a)) {
1032
+ const { anchor: d, focus: m } = a, C = d.getNode(), S = m.getNode(), N = be(C), y = be(S), v = !(!N || !n.is(pe(N))), R = !(!y || !n.is(pe(y))), E = v !== R, A = v && R, z = a.isBackward();
1033
+ if (E) {
1034
+ const F = a.clone();
1035
+ if (R) {
1036
+ const [K] = J(n, y, y), P = K[0][0].cell, B = K[K.length - 1].at(-1).cell;
1037
+ F.focus.set(z ? P.getKey() : B.getKey(), z ? P.getChildrenSize() : B.getChildrenSize(), "element");
1004
1038
  } else if (v) {
1005
- const [F] = U(n, N, N), W = F[0][0].cell, H = F[F.length - 1].at(-1).cell;
1006
- R.anchor.set(M ? H.getKey() : W.getKey(), M ? H.getChildrenSize() : 0, "element");
1039
+ const [K] = J(n, N, N), P = K[0][0].cell, B = K[K.length - 1].at(-1).cell;
1040
+ F.anchor.set(z ? B.getKey() : P.getKey(), z ? B.getChildrenSize() : 0, "element");
1007
1041
  }
1008
- ne(R), wt(t, l);
1009
- } else if (O && (N.is(y) || (l.$setAnchorCellForSelection(se(l, N)), l.$setFocusCellForSelection(se(l, y), !0)), l.pointerType === "touch" && l.isSelecting && a.isCollapsed() && z(c) && c.isCollapsed())) {
1010
- const R = be(c.anchor.getNode());
1011
- R && !R.is(y) && (l.$setAnchorCellForSelection(se(l, R)), l.$setFocusCellForSelection(se(l, y), !0), l.pointerType = null);
1042
+ ne(F), Nt(t, l);
1043
+ } else if (A && (N.is(y) || (l.$setAnchorCellForSelection(se(l, N)), l.$setFocusCellForSelection(se(l, y), !0)), l.pointerType === "touch" && l.isSelecting && a.isCollapsed() && M(c) && c.isCollapsed())) {
1044
+ const F = be(c.anchor.getNode());
1045
+ F && !F.is(y) && (l.$setAnchorCellForSelection(se(l, F)), l.$setFocusCellForSelection(se(l, y), !0), l.pointerType = null);
1012
1046
  }
1013
- } else if (a && K(a) && a.is(c) && a.tableKey === n.getKey()) {
1047
+ } else if (a && O(a) && a.is(c) && a.tableKey === n.getKey()) {
1014
1048
  const d = Me(s);
1015
1049
  if (d && d.anchorNode && d.focusNode) {
1016
- const g = re(d.focusNode), _ = g && !n.isParentOf(g), S = re(d.anchorNode), N = S && n.isParentOf(S);
1017
- if (_ && N && d.rangeCount > 0) {
1018
- const y = pn(d, t);
1050
+ const m = re(d.focusNode), C = m && !n.isParentOf(m), S = re(d.anchorNode), N = S && n.isParentOf(S);
1051
+ if (C && N && d.rangeCount > 0) {
1052
+ const y = yn(d, t);
1019
1053
  y && (y.anchor.set(n.getKey(), a.isBackward() ? n.getChildrenSize() : 0, "element"), d.removeAllRanges(), ne(y));
1020
1054
  }
1021
1055
  }
1022
1056
  }
1023
- return a && !a.is(c) && (K(a) || K(c)) && l.tableSelection && !l.tableSelection.is(c) ? (K(a) && a.tableKey === l.tableNodeKey ? l.$updateTableTableSelection(a) : !K(a) && K(c) && c.tableKey === l.tableNodeKey && l.$updateTableTableSelection(null), !1) : (l.hasHijackedSelectionStyles && !n.isSelected() ? function(d, g) {
1024
- g.$enableHighlightStyle(), lt(g.table, (_) => {
1025
- const S = _.elem;
1026
- _.highlighted = !1, zt(d, _), S.getAttribute("style") || S.removeAttribute("style");
1057
+ return a && !a.is(c) && (O(a) || O(c)) && l.tableSelection && !l.tableSelection.is(c) ? (O(a) && a.tableKey === l.tableNodeKey ? l.$updateTableTableSelection(a) : !O(a) && O(c) && c.tableKey === l.tableNodeKey && l.$updateTableTableSelection(null), !1) : (l.hasHijackedSelectionStyles && !n.isSelected() ? function(d, m) {
1058
+ m.$enableHighlightStyle(), at(m.table, (C) => {
1059
+ const S = C.elem;
1060
+ C.highlighted = !1, Pt(d, C), S.getAttribute("style") || S.removeAttribute("style");
1027
1061
  });
1028
- }(t, l) : !l.hasHijackedSelectionStyles && n.isSelected() && wt(t, l), !1);
1029
- }, j)), l.listenersToRemove.add(t.registerCommand(Ot, () => {
1030
- const a = B();
1031
- if (!z(a) || !a.isCollapsed() || !V(a, n)) return !1;
1032
- const c = yt(t, a, n);
1033
- return !!c && (bt(c, n), !0);
1062
+ }(t, l) : !l.hasHijackedSelectionStyles && n.isSelected() && Nt(t, l), !1);
1063
+ }, j)), l.listenersToRemove.add(t.registerCommand(Et, () => {
1064
+ const a = L();
1065
+ if (!M(a) || !a.isCollapsed() || !Q(a, n)) return !1;
1066
+ const c = xt(t, a, n);
1067
+ return !!c && (vt(c, n), !0);
1034
1068
  }, j)), l;
1035
1069
  }
1036
- function _t(n) {
1037
- return n[qe] || null;
1070
+ function bt(n) {
1071
+ return n[Qe] || null;
1038
1072
  }
1039
1073
  function $e(n) {
1040
1074
  let e = n;
@@ -1048,7 +1082,7 @@ function $e(n) {
1048
1082
  }
1049
1083
  return null;
1050
1084
  }
1051
- function St(n, e) {
1085
+ function yt(n, e) {
1052
1086
  if (!n.contains(e)) return null;
1053
1087
  let t = null;
1054
1088
  for (let o = e; o != null; o = o.parentNode) {
@@ -1080,9 +1114,9 @@ function me(n, e) {
1080
1114
  s++, r = u;
1081
1115
  continue;
1082
1116
  }
1083
- const m = r.parentNode;
1084
- if (m != null) {
1085
- const h = m.nextSibling;
1117
+ const f = r.parentNode;
1118
+ if (f != null) {
1119
+ const h = f.nextSibling;
1086
1120
  if (h == null) break;
1087
1121
  l++, s = 0, r = h;
1088
1122
  }
@@ -1091,12 +1125,12 @@ function me(n, e) {
1091
1125
  }
1092
1126
  function Fe(n, e, t) {
1093
1127
  const o = new Set(t ? t.getNodes() : []);
1094
- lt(e, (r, s) => {
1128
+ at(e, (r, s) => {
1095
1129
  const l = r.elem;
1096
- o.has(s) ? (r.highlighted = !0, Mt(n, r)) : (r.highlighted = !1, zt(n, r), l.getAttribute("style") || l.removeAttribute("style"));
1130
+ o.has(s) ? (r.highlighted = !0, Wt(n, r)) : (r.highlighted = !1, Pt(n, r), l.getAttribute("style") || l.removeAttribute("style"));
1097
1131
  });
1098
1132
  }
1099
- function lt(n, e) {
1133
+ function at(n, e) {
1100
1134
  const { domRows: t } = n;
1101
1135
  for (let o = 0; o < t.length; o++) {
1102
1136
  const r = t[o];
@@ -1108,9 +1142,9 @@ function lt(n, e) {
1108
1142
  }
1109
1143
  }
1110
1144
  }
1111
- function wt(n, e) {
1112
- e.$disableHighlightStyle(), lt(e.table, (t) => {
1113
- t.highlighted = !0, Mt(n, t);
1145
+ function Nt(n, e) {
1146
+ e.$disableHighlightStyle(), at(e.table, (t) => {
1147
+ t.highlighted = !0, Wt(n, t);
1114
1148
  });
1115
1149
  }
1116
1150
  const qn = (n, e, t, o, r) => {
@@ -1146,40 +1180,40 @@ function Oe([n, e]) {
1146
1180
  }
1147
1181
  function he(n, e, [t, o]) {
1148
1182
  const r = e[o], s = n[r];
1149
- s === void 0 && b(250, o, String(r));
1183
+ s === void 0 && w(250, o, String(r));
1150
1184
  const l = e[t], i = s[l];
1151
- return i === void 0 && b(250, t, String(l)), i;
1152
- }
1153
- function jn(n, e, t, o, r) {
1154
- const s = ke(e, t, o), l = function(v, E) {
1155
- const { minColumn: k, maxColumn: O, minRow: M, maxRow: R } = E;
1156
- let F = 1, W = 1, H = 1, te = 1;
1157
- const _e = v[M], Y = v[R];
1158
- for (let P = k; P <= O; P++) F = Math.max(F, _e[P].cell.__rowSpan), te = Math.max(te, Y[P].cell.__rowSpan);
1159
- for (let P = M; P <= R; P++) W = Math.max(W, v[P][k].cell.__colSpan), H = Math.max(H, v[P][O].cell.__colSpan);
1160
- return { bottomSpan: te, leftSpan: W, rightSpan: H, topSpan: F };
1161
- }(e, s), { topSpan: i, leftSpan: u, bottomSpan: m, rightSpan: h } = l, p = function(v, E) {
1162
- const k = Je(v, E);
1163
- return k === null && b(249, E.cell.getKey()), k;
1164
- }(s, t), [C, a] = Oe(p);
1165
- let c = s[C], f = s[a];
1166
- r === "forward" ? c += C === "maxColumn" ? 1 : u : r === "backward" ? c -= C === "minColumn" ? 1 : h : r === "down" ? f += a === "maxRow" ? 1 : i : r === "up" && (f -= a === "minRow" ? 1 : m);
1167
- const d = e[f];
1185
+ return i === void 0 && w(250, t, String(l)), i;
1186
+ }
1187
+ function Vn(n, e, t, o, r) {
1188
+ const s = ke(e, t, o), l = function(v, R) {
1189
+ const { minColumn: E, maxColumn: A, minRow: z, maxRow: F } = R;
1190
+ let K = 1, P = 1, B = 1, te = 1;
1191
+ const Ce = v[z], q = v[F];
1192
+ for (let H = E; H <= A; H++) K = Math.max(K, Ce[H].cell.__rowSpan), te = Math.max(te, q[H].cell.__rowSpan);
1193
+ for (let H = z; H <= F; H++) P = Math.max(P, v[H][E].cell.__colSpan), B = Math.max(B, v[H][A].cell.__colSpan);
1194
+ return { bottomSpan: te, leftSpan: P, rightSpan: B, topSpan: K };
1195
+ }(e, s), { topSpan: i, leftSpan: u, bottomSpan: f, rightSpan: h } = l, p = function(v, R) {
1196
+ const E = Je(v, R);
1197
+ return E === null && w(249, R.cell.getKey()), E;
1198
+ }(s, t), [_, a] = Oe(p);
1199
+ let c = s[_], g = s[a];
1200
+ r === "forward" ? c += _ === "maxColumn" ? 1 : u : r === "backward" ? c -= _ === "minColumn" ? 1 : h : r === "down" ? g += a === "maxRow" ? 1 : i : r === "up" && (g -= a === "minRow" ? 1 : f);
1201
+ const d = e[g];
1168
1202
  if (d === void 0) return !1;
1169
- const g = d[c];
1170
- if (g === void 0) return !1;
1171
- const [_, S] = function(v, E, k) {
1172
- const O = ke(v, E, k), M = Je(O, E);
1173
- if (M) return [he(v, O, M), he(v, O, Oe(M))];
1174
- const R = Je(O, k);
1175
- if (R) return [he(v, O, Oe(R)), he(v, O, R)];
1176
- const F = ["minColumn", "minRow"];
1177
- return [he(v, O, F), he(v, O, Oe(F))];
1178
- }(e, t, g), N = se(n, _.cell), y = se(n, S.cell);
1203
+ const m = d[c];
1204
+ if (m === void 0) return !1;
1205
+ const [C, S] = function(v, R, E) {
1206
+ const A = ke(v, R, E), z = Je(A, R);
1207
+ if (z) return [he(v, A, z), he(v, A, Oe(z))];
1208
+ const F = Je(A, E);
1209
+ if (F) return [he(v, A, Oe(F)), he(v, A, F)];
1210
+ const K = ["minColumn", "minRow"];
1211
+ return [he(v, A, K), he(v, A, Oe(K))];
1212
+ }(e, t, m), N = se(n, C.cell), y = se(n, S.cell);
1179
1213
  return n.$setAnchorCellForSelection(N), n.$setFocusCellForSelection(y, !0), !0;
1180
1214
  }
1181
- function V(n, e) {
1182
- if (z(n) || K(n)) {
1215
+ function Q(n, e) {
1216
+ if (M(n) || O(n)) {
1183
1217
  const t = e.isParentOf(n.anchor.getNode()), o = e.isParentOf(n.focus.getNode());
1184
1218
  return t && o;
1185
1219
  }
@@ -1188,78 +1222,78 @@ function V(n, e) {
1188
1222
  function Ke(n, e) {
1189
1223
  e ? n.selectStart() : n.selectEnd();
1190
1224
  }
1191
- function Mt(n, e) {
1225
+ function Wt(n, e) {
1192
1226
  const t = e.elem, o = n._config.theme;
1193
- w(re(t)) || b(131), Q(t, o.tableCellSelected);
1227
+ b(re(t)) || w(131), G(t, o.tableCellSelected);
1194
1228
  }
1195
- function zt(n, e) {
1229
+ function Pt(n, e) {
1196
1230
  const t = e.elem;
1197
- w(re(t)) || b(131);
1231
+ b(re(t)) || w(131);
1198
1232
  const o = n._config.theme;
1199
1233
  ge(t, o.tableCellSelected);
1200
1234
  }
1201
1235
  function be(n) {
1202
- const e = T(n, w);
1203
- return w(e) ? e : null;
1236
+ const e = T(n, b);
1237
+ return b(e) ? e : null;
1204
1238
  }
1205
1239
  function pe(n) {
1206
1240
  const e = T(n, $);
1207
1241
  return $(e) ? e : null;
1208
1242
  }
1209
- function Vn(n, e, t, o, r, s, l) {
1210
- const i = wn(t.focus, r ? "previous" : "next");
1211
- if (bn(i)) return !1;
1243
+ function jn(n, e, t, o, r, s, l) {
1244
+ const i = Tn(t.focus, r ? "previous" : "next");
1245
+ if (Rn(i)) return !1;
1212
1246
  let u = i;
1213
- for (const d of ut(i).iterNodeCarets("shadowRoot")) {
1214
- if (!yn(d) || !D(d.origin)) return !1;
1247
+ for (const d of ft(i).iterNodeCarets("shadowRoot")) {
1248
+ if (!Fn(d) || !D(d.origin)) return !1;
1215
1249
  u = d;
1216
1250
  }
1217
- const m = u.getParentAtCaret();
1218
- if (!w(m)) return !1;
1219
- const h = m, p = function(d) {
1220
- for (const g of ut(d).iterNodeCarets("root")) {
1221
- const { origin: _ } = g;
1222
- if (w(_)) {
1223
- if (ht(g)) return Nn(_, d.direction);
1224
- } else if (!A(_)) break;
1251
+ const f = u.getParentAtCaret();
1252
+ if (!b(f)) return !1;
1253
+ const h = f, p = function(d) {
1254
+ for (const m of ft(d).iterNodeCarets("root")) {
1255
+ const { origin: C } = m;
1256
+ if (b(C)) {
1257
+ if (gt(m)) return On(C, d.direction);
1258
+ } else if (!k(C)) break;
1225
1259
  }
1226
1260
  return null;
1227
- }(dt(h, u.direction)), C = T(h, $);
1228
- if (!C || !C.is(s)) return !1;
1261
+ }(mt(h, u.direction)), _ = T(h, $);
1262
+ if (!_ || !_.is(s)) return !1;
1229
1263
  const a = n.getElementByKey(h.getKey()), c = $e(a);
1230
1264
  if (!a || !c) return !1;
1231
- const f = Qn(n, C);
1232
- if (l.table = f, p) if (o === "extend") {
1265
+ const g = Qn(n, _);
1266
+ if (l.table = g, p) if (o === "extend") {
1233
1267
  const d = $e(n.getElementByKey(p.origin.getKey()));
1234
1268
  if (!d) return !1;
1235
1269
  l.$setAnchorCellForSelection(c), l.$setFocusCellForSelection(d, !0);
1236
1270
  } else {
1237
- const d = ft(p);
1271
+ const d = pt(p);
1238
1272
  Re(t.anchor, d), Re(t.focus, d);
1239
1273
  }
1240
1274
  else if (o === "extend") l.$setAnchorCellForSelection(c), l.$setFocusCellForSelection(c, !0);
1241
1275
  else {
1242
- const d = function(g) {
1243
- const _ = xn(g);
1244
- return ht(_) ? ft(_) : g;
1245
- }(dt(C, i.direction));
1276
+ const d = function(m) {
1277
+ const C = Kn(m);
1278
+ return gt(C) ? pt(C) : m;
1279
+ }(mt(_, i.direction));
1246
1280
  Re(t.anchor, d), Re(t.focus, d);
1247
1281
  }
1248
1282
  return ee(e), !0;
1249
1283
  }
1250
- function Lt(n, e, t, o, r) {
1284
+ function Ht(n, e, t, o, r) {
1251
1285
  if ((t === "up" || t === "down") && function(l) {
1252
1286
  const i = l.getRootElement();
1253
1287
  return i ? i.hasAttribute("aria-controls") && i.getAttribute("aria-controls") === "typeahead-menu" : !1;
1254
1288
  }(n)) return !1;
1255
- const s = B();
1256
- if (!V(s, o)) {
1257
- if (z(s)) {
1289
+ const s = L();
1290
+ if (!Q(s, o)) {
1291
+ if (M(s)) {
1258
1292
  if (t === "backward") {
1259
1293
  if (s.focus.offset > 0) return !1;
1260
1294
  const l = function(u) {
1261
- for (let m = u, h = u; h !== null; m = h, h = h.getParent()) if (D(h)) {
1262
- if (h !== m && h.getFirstChild() !== m) return null;
1295
+ for (let f = u, h = u; h !== null; f = h, h = h.getParent()) if (D(h)) {
1296
+ if (h !== f && h.getFirstChild() !== f) return null;
1263
1297
  if (!h.isInline()) return h;
1264
1298
  }
1265
1299
  return null;
@@ -1271,138 +1305,138 @@ function Lt(n, e, t, o, r) {
1271
1305
  if (e.shiftKey && (t === "up" || t === "down")) {
1272
1306
  const l = s.focus.getNode();
1273
1307
  if (!s.isCollapsed() && (t === "up" && !s.isBackward() || t === "down" && s.isBackward())) {
1274
- let i = T(l, (C) => $(C));
1275
- if (w(i) && (i = T(i, $)), i !== o || !i) return !1;
1308
+ let i = T(l, (_) => $(_));
1309
+ if (b(i) && (i = T(i, $)), i !== o || !i) return !1;
1276
1310
  const u = t === "down" ? i.getNextSibling() : i.getPreviousSibling();
1277
1311
  if (!u) return !1;
1278
- let m = 0;
1279
- t === "up" && D(u) && (m = u.getChildrenSize());
1312
+ let f = 0;
1313
+ t === "up" && D(u) && (f = u.getChildrenSize());
1280
1314
  let h = u;
1281
- t === "up" && D(u) && (h = u.getLastChild() || u, m = Ce(h) ? h.getTextContentSize() : 0);
1315
+ t === "up" && D(u) && (h = u.getLastChild() || u, f = _e(h) ? h.getTextContentSize() : 0);
1282
1316
  const p = s.clone();
1283
- return p.focus.set(h.getKey(), m, Ce(h) ? "text" : "element"), ne(p), ee(e), !0;
1317
+ return p.focus.set(h.getKey(), f, _e(h) ? "text" : "element"), ne(p), ee(e), !0;
1284
1318
  }
1285
- if (Sn(l)) {
1319
+ if (xn(l)) {
1286
1320
  const i = t === "up" ? s.getNodes()[s.getNodes().length - 1] : s.getNodes()[0];
1287
- if (i && xe(o, i) !== null) {
1288
- const u = o.getFirstDescendant(), m = o.getLastDescendant();
1289
- if (!u || !m) return !1;
1290
- const [h] = Z(u), [p] = Z(m), C = o.getCordsFromCellNode(h, r.table), a = o.getCordsFromCellNode(p, r.table), c = o.getDOMCellFromCordsOrThrow(C.x, C.y, r.table), f = o.getDOMCellFromCordsOrThrow(a.x, a.y, r.table);
1291
- return r.$setAnchorCellForSelection(c), r.$setFocusCellForSelection(f, !0), !0;
1321
+ if (i && ve(o, i) !== null) {
1322
+ const u = o.getFirstDescendant(), f = o.getLastDescendant();
1323
+ if (!u || !f) return !1;
1324
+ const [h] = I(u), [p] = I(f), _ = o.getCordsFromCellNode(h, r.table), a = o.getCordsFromCellNode(p, r.table), c = o.getDOMCellFromCordsOrThrow(_.x, _.y, r.table), g = o.getDOMCellFromCordsOrThrow(a.x, a.y, r.table);
1325
+ return r.$setAnchorCellForSelection(c), r.$setFocusCellForSelection(g, !0), !0;
1292
1326
  }
1293
1327
  return !1;
1294
1328
  }
1295
1329
  {
1296
- let i = T(l, (m) => D(m) && !m.isInline());
1297
- if (w(i) && (i = T(i, $)), !i) return !1;
1330
+ let i = T(l, (f) => D(f) && !f.isInline());
1331
+ if (b(i) && (i = T(i, $)), !i) return !1;
1298
1332
  const u = t === "down" ? i.getNextSibling() : i.getPreviousSibling();
1299
1333
  if ($(u) && r.tableNodeKey === u.getKey()) {
1300
- const m = u.getFirstDescendant(), h = u.getLastDescendant();
1301
- if (!m || !h) return !1;
1302
- const [p] = Z(m), [C] = Z(h), a = s.clone();
1303
- return a.focus.set((t === "up" ? p : C).getKey(), t === "up" ? 0 : C.getChildrenSize(), "element"), ee(e), ne(a), !0;
1334
+ const f = u.getFirstDescendant(), h = u.getLastDescendant();
1335
+ if (!f || !h) return !1;
1336
+ const [p] = I(f), [_] = I(h), a = s.clone();
1337
+ return a.focus.set((t === "up" ? p : _).getKey(), t === "up" ? 0 : _.getChildrenSize(), "element"), ee(e), ne(a), !0;
1304
1338
  }
1305
1339
  }
1306
1340
  }
1307
1341
  }
1308
- return t === "down" && Qe(n) && r.setShouldCheckSelection(), !1;
1342
+ return t === "down" && et(n) && r.setShouldCheckSelection(), !1;
1309
1343
  }
1310
- if (z(s)) {
1344
+ if (M(s)) {
1311
1345
  if (t === "backward" || t === "forward")
1312
- return Vn(n, e, s, e.shiftKey ? "extend" : "move", t === "backward", o, r);
1346
+ return jn(n, e, s, e.shiftKey ? "extend" : "move", t === "backward", o, r);
1313
1347
  if (s.isCollapsed()) {
1314
- const { anchor: l, focus: i } = s, u = T(l.getNode(), w), m = T(i.getNode(), w);
1315
- if (!w(u) || !u.is(m)) return !1;
1348
+ const { anchor: l, focus: i } = s, u = T(l.getNode(), b), f = T(i.getNode(), b);
1349
+ if (!b(u) || !u.is(f)) return !1;
1316
1350
  const h = pe(u);
1317
1351
  if (h !== o && h != null) {
1318
- const g = ie(h, n.getElementByKey(h.getKey()));
1319
- if (g != null) return r.table = me(h, g), Lt(n, e, t, h, r);
1352
+ const m = ie(h, n.getElementByKey(h.getKey()));
1353
+ if (m != null) return r.table = me(h, m), Ht(n, e, t, h, r);
1320
1354
  }
1321
- const p = n.getElementByKey(u.__key), C = n.getElementByKey(l.key);
1322
- if (C == null || p == null) return !1;
1355
+ const p = n.getElementByKey(u.__key), _ = n.getElementByKey(l.key);
1356
+ if (_ == null || p == null) return !1;
1323
1357
  let a;
1324
- if (l.type === "element") a = C.getBoundingClientRect();
1358
+ if (l.type === "element") a = _.getBoundingClientRect();
1325
1359
  else {
1326
- const g = Me(rt(n));
1327
- if (g === null || g.rangeCount === 0) return !1;
1328
- a = g.getRangeAt(0).getBoundingClientRect();
1360
+ const m = Me(it(n));
1361
+ if (m === null || m.rangeCount === 0) return !1;
1362
+ a = m.getRangeAt(0).getBoundingClientRect();
1329
1363
  }
1330
1364
  const c = t === "up" ? u.getFirstChild() : u.getLastChild();
1331
1365
  if (c == null) return !1;
1332
- const f = n.getElementByKey(c.__key);
1333
- if (f == null) return !1;
1334
- const d = f.getBoundingClientRect();
1366
+ const g = n.getElementByKey(c.__key);
1367
+ if (g == null) return !1;
1368
+ const d = g.getBoundingClientRect();
1335
1369
  if (t === "up" ? d.top > a.top - a.height : a.bottom + a.height > d.bottom) {
1336
1370
  ee(e);
1337
- const g = o.getCordsFromCellNode(u, r.table);
1338
- if (!e.shiftKey) return qn(r, o, g.x, g.y, t);
1371
+ const m = o.getCordsFromCellNode(u, r.table);
1372
+ if (!e.shiftKey) return qn(r, o, m.x, m.y, t);
1339
1373
  {
1340
- const _ = o.getDOMCellFromCordsOrThrow(g.x, g.y, r.table);
1341
- r.$setAnchorCellForSelection(_), r.$setFocusCellForSelection(_, !0);
1374
+ const C = o.getDOMCellFromCordsOrThrow(m.x, m.y, r.table);
1375
+ r.$setAnchorCellForSelection(C), r.$setFocusCellForSelection(C, !0);
1342
1376
  }
1343
1377
  return !0;
1344
1378
  }
1345
1379
  }
1346
- } else if (K(s)) {
1347
- const { anchor: l, focus: i } = s, u = T(l.getNode(), w), m = T(i.getNode(), w), [h] = s.getNodes();
1348
- $(h) || b(251);
1380
+ } else if (O(s)) {
1381
+ const { anchor: l, focus: i } = s, u = T(l.getNode(), b), f = T(i.getNode(), b), [h] = s.getNodes();
1382
+ $(h) || w(251);
1349
1383
  const p = ie(h, n.getElementByKey(h.getKey()));
1350
- if (!w(u) || !w(m) || !$(h) || p == null) return !1;
1384
+ if (!b(u) || !b(f) || !$(h) || p == null) return !1;
1351
1385
  r.$updateTableTableSelection(s);
1352
- const C = me(h, p), a = o.getCordsFromCellNode(u, C), c = o.getDOMCellFromCordsOrThrow(a.x, a.y, C);
1386
+ const _ = me(h, p), a = o.getCordsFromCellNode(u, _), c = o.getDOMCellFromCordsOrThrow(a.x, a.y, _);
1353
1387
  if (r.$setAnchorCellForSelection(c), ee(e), e.shiftKey) {
1354
- const [f, d, g] = U(o, u, m);
1355
- return jn(r, f, d, g, t);
1388
+ const [g, d, m] = J(o, u, f);
1389
+ return Vn(r, g, d, m, t);
1356
1390
  }
1357
- return m.selectEnd(), !0;
1391
+ return f.selectEnd(), !0;
1358
1392
  }
1359
1393
  return !1;
1360
1394
  }
1361
1395
  function ee(n) {
1362
1396
  n.preventDefault(), n.stopImmediatePropagation(), n.stopPropagation();
1363
1397
  }
1364
- function bt(n, e, t) {
1365
- const o = I();
1398
+ function vt(n, e, t) {
1399
+ const o = U();
1366
1400
  n === "first" ? e.insertBefore(o) : e.insertAfter(o), o.append(...t || []), o.selectEnd();
1367
1401
  }
1368
- function yt(n, e, t) {
1402
+ function xt(n, e, t) {
1369
1403
  const o = t.getParent();
1370
1404
  if (!o) return;
1371
- const r = Me(rt(n));
1405
+ const r = Me(it(n));
1372
1406
  if (!r) return;
1373
1407
  const s = r.anchorNode, l = n.getElementByKey(o.getKey()), i = ie(t, n.getElementByKey(t.getKey()));
1374
1408
  if (!s || !l || !i || !l.contains(s) || i.contains(s)) return;
1375
- const u = T(e.anchor.getNode(), (_) => w(_));
1409
+ const u = T(e.anchor.getNode(), (C) => b(C));
1376
1410
  if (!u) return;
1377
- const m = T(u, (_) => $(_));
1378
- if (!$(m) || !m.is(t)) return;
1379
- const [h, p] = U(t, u, u), C = h[0][0], a = h[h.length - 1][h[0].length - 1], { startRow: c, startColumn: f } = p, d = c === C.startRow && f === C.startColumn, g = c === a.startRow && f === a.startColumn;
1380
- return d ? "first" : g ? "last" : void 0;
1411
+ const f = T(u, (C) => $(C));
1412
+ if (!$(f) || !f.is(t)) return;
1413
+ const [h, p] = J(t, u, u), _ = h[0][0], a = h[h.length - 1][h[0].length - 1], { startRow: c, startColumn: g } = p, d = c === _.startRow && g === _.startColumn, m = c === a.startRow && g === a.startColumn;
1414
+ return d ? "first" : m ? "last" : void 0;
1381
1415
  }
1382
1416
  function se(n, e) {
1383
1417
  const { tableNode: t } = n.$lookup(), o = t.getCordsFromCellNode(e, n.table);
1384
1418
  return t.getDOMCellFromCordsOrThrow(o.x, o.y, n.table);
1385
1419
  }
1386
- function je(n, e, t) {
1387
- return xe(n, re(e, t));
1420
+ function Ge(n, e, t) {
1421
+ return ve(n, re(e, t));
1388
1422
  }
1389
- function Nt(n, e, t) {
1423
+ function Tt(n, e, t) {
1390
1424
  if (!e.theme.tableAlignment) return;
1391
1425
  const o = [], r = [];
1392
1426
  for (const s of ["center", "right"]) {
1393
1427
  const l = e.theme.tableAlignment[s];
1394
1428
  l && (s === t ? r : o).push(l);
1395
1429
  }
1396
- ge(n, ...o), Q(n, ...r);
1430
+ ge(n, ...o), G(n, ...r);
1397
1431
  }
1398
- const Ve = /* @__PURE__ */ new WeakSet();
1399
- function Qe(n = Tt()) {
1400
- return Ve.has(n);
1432
+ const Ze = /* @__PURE__ */ new WeakSet();
1433
+ function et(n = Ot()) {
1434
+ return Ze.has(n);
1401
1435
  }
1402
- function ho(n, e) {
1403
- e ? Ve.add(n) : Ve.delete(n);
1436
+ function go(n, e) {
1437
+ e ? Ze.add(n) : Ze.delete(n);
1404
1438
  }
1405
- class ae extends Ze {
1439
+ class ae extends tt {
1406
1440
  static getType() {
1407
1441
  return "table";
1408
1442
  }
@@ -1420,10 +1454,10 @@ class ae extends Ze {
1420
1454
  super.afterCloneFrom(e), this.__colWidths = e.__colWidths, this.__rowStriping = e.__rowStriping, this.__frozenColumnCount = e.__frozenColumnCount, this.__frozenRowCount = e.__frozenRowCount;
1421
1455
  }
1422
1456
  static importDOM() {
1423
- return { table: (e) => ({ conversion: Zn, priority: 1 }) };
1457
+ return { table: (e) => ({ conversion: Gn, priority: 1 }) };
1424
1458
  }
1425
1459
  static importJSON(e) {
1426
- return st().updateFromJSON(e);
1460
+ return ct().updateFromJSON(e);
1427
1461
  }
1428
1462
  updateFromJSON(e) {
1429
1463
  return super.updateFromJSON(e).setRowStriping(e.rowStriping || !1).setFrozenColumns(e.frozenColumnCount || 0).setFrozenRows(e.frozenRowCount || 0).setColWidths(e.colWidths);
@@ -1439,74 +1473,74 @@ class ae extends Ze {
1439
1473
  }
1440
1474
  getDOMSlot(e) {
1441
1475
  const t = de(e) ? e : e.querySelector("table");
1442
- return de(t) || b(229), super.getDOMSlot(e).withElement(t).withAfter(t.querySelector("colgroup"));
1476
+ return de(t) || w(229), super.getDOMSlot(e).withElement(t).withAfter(t.querySelector("colgroup"));
1443
1477
  }
1444
1478
  createDOM(e, t) {
1445
1479
  const o = document.createElement("table");
1446
1480
  this.__style && (o.style.cssText = this.__style);
1447
1481
  const r = document.createElement("colgroup");
1448
- if (o.appendChild(r), Qt(r), Q(o, e.theme.table), this.updateTableElement(null, o, e), Qe(t)) {
1482
+ if (o.appendChild(r), en(r), G(o, e.theme.table), this.updateTableElement(null, o, e), et(t)) {
1449
1483
  const s = document.createElement("div"), l = e.theme.tableScrollableWrapper;
1450
- return l ? Q(s, l) : s.style.cssText = "overflow-x: auto;", s.appendChild(o), this.updateTableWrapper(null, s, o, e), s;
1484
+ return l ? G(s, l) : s.style.cssText = "overflow-x: auto;", s.appendChild(o), this.updateTableWrapper(null, s, o, e), s;
1451
1485
  }
1452
1486
  return o;
1453
1487
  }
1454
1488
  updateTableWrapper(e, t, o, r) {
1455
1489
  this.__frozenColumnCount !== (e ? e.__frozenColumnCount : 0) && function(s, l, i, u) {
1456
- u > 0 ? (Q(s, i.theme.tableFrozenColumn), l.setAttribute("data-lexical-frozen-column", "true")) : (ge(s, i.theme.tableFrozenColumn), l.removeAttribute("data-lexical-frozen-column"));
1490
+ u > 0 ? (G(s, i.theme.tableFrozenColumn), l.setAttribute("data-lexical-frozen-column", "true")) : (ge(s, i.theme.tableFrozenColumn), l.removeAttribute("data-lexical-frozen-column"));
1457
1491
  }(t, o, r, this.__frozenColumnCount), this.__frozenRowCount !== (e ? e.__frozenRowCount : 0) && function(s, l, i, u) {
1458
- u > 0 ? (Q(s, i.theme.tableFrozenRow), l.setAttribute("data-lexical-frozen-row", "true")) : (ge(s, i.theme.tableFrozenRow), l.removeAttribute("data-lexical-frozen-row"));
1492
+ u > 0 ? (G(s, i.theme.tableFrozenRow), l.setAttribute("data-lexical-frozen-row", "true")) : (ge(s, i.theme.tableFrozenRow), l.removeAttribute("data-lexical-frozen-row"));
1459
1493
  }(t, o, r, this.__frozenRowCount);
1460
1494
  }
1461
1495
  updateTableElement(e, t, o) {
1462
1496
  this.__style !== (e ? e.__style : "") && (t.style.cssText = this.__style), this.__rowStriping !== (!!e && e.__rowStriping) && function(r, s, l) {
1463
- l ? (Q(r, s.theme.tableRowStriping), r.setAttribute("data-lexical-row-striping", "true")) : (ge(r, s.theme.tableRowStriping), r.removeAttribute("data-lexical-row-striping"));
1497
+ l ? (G(r, s.theme.tableRowStriping), r.setAttribute("data-lexical-row-striping", "true")) : (ge(r, s.theme.tableRowStriping), r.removeAttribute("data-lexical-row-striping"));
1464
1498
  }(t, o, this.__rowStriping), function(r, s, l, i) {
1465
1499
  const u = r.querySelector("colgroup");
1466
1500
  if (!u) return;
1467
- const m = [];
1501
+ const f = [];
1468
1502
  for (let h = 0; h < l; h++) {
1469
- const p = document.createElement("col"), C = i && i[h];
1470
- C && (p.style.width = `${C}px`), m.push(p);
1503
+ const p = document.createElement("col"), _ = i && i[h];
1504
+ _ && (p.style.width = `${_}px`), f.push(p);
1471
1505
  }
1472
- u.replaceChildren(...m);
1473
- }(t, 0, this.getColumnCount(), this.getColWidths()), Nt(t, o, this.getFormatType());
1506
+ u.replaceChildren(...f);
1507
+ }(t, 0, this.getColumnCount(), this.getColWidths()), Tt(t, o, this.getFormatType());
1474
1508
  }
1475
1509
  updateDOM(e, t, o) {
1476
1510
  const r = this.getDOMSlot(t).element;
1477
- return t === r === Qe() || (Ne(s = t) && s.nodeName === "DIV" && this.updateTableWrapper(e, t, r, o), this.updateTableElement(e, r, o), !1);
1511
+ return t === r === et() || (Ne(s = t) && s.nodeName === "DIV" && this.updateTableWrapper(e, t, r, o), this.updateTableElement(e, r, o), !1);
1478
1512
  var s;
1479
1513
  }
1480
1514
  exportDOM(e) {
1481
1515
  const t = super.exportDOM(e), { element: o } = t;
1482
1516
  return { after: (r) => {
1483
1517
  if (t.after && (r = t.after(r)), !de(r) && Ne(r) && (r = r.querySelector("table")), !de(r)) return null;
1484
- Nt(r, e._config, this.getFormatType());
1518
+ Tt(r, e._config, this.getFormatType());
1485
1519
  const [s] = oe(this, null, null), l = /* @__PURE__ */ new Map();
1486
1520
  for (const h of s) for (const p of h) {
1487
- const C = p.cell.getKey();
1488
- l.has(C) || l.set(C, { colSpan: p.cell.getColSpan(), startColumn: p.startColumn });
1521
+ const _ = p.cell.getKey();
1522
+ l.has(_) || l.set(_, { colSpan: p.cell.getColSpan(), startColumn: p.startColumn });
1489
1523
  }
1490
1524
  const i = /* @__PURE__ */ new Set();
1491
1525
  for (const h of r.querySelectorAll(":scope > tr > [data-temporary-table-cell-lexical-key]")) {
1492
1526
  const p = h.getAttribute("data-temporary-table-cell-lexical-key");
1493
1527
  if (p) {
1494
- const C = l.get(p);
1495
- if (h.removeAttribute("data-temporary-table-cell-lexical-key"), C) {
1528
+ const _ = l.get(p);
1529
+ if (h.removeAttribute("data-temporary-table-cell-lexical-key"), _) {
1496
1530
  l.delete(p);
1497
- for (let a = 0; a < C.colSpan; a++) i.add(a + C.startColumn);
1531
+ for (let a = 0; a < _.colSpan; a++) i.add(a + _.startColumn);
1498
1532
  }
1499
1533
  }
1500
1534
  }
1501
1535
  const u = r.querySelector(":scope > colgroup");
1502
1536
  if (u) {
1503
- const h = Array.from(r.querySelectorAll(":scope > colgroup > col")).filter((p, C) => i.has(C));
1537
+ const h = Array.from(r.querySelectorAll(":scope > colgroup > col")).filter((p, _) => i.has(_));
1504
1538
  u.replaceChildren(...h);
1505
1539
  }
1506
- const m = r.querySelectorAll(":scope > tr");
1507
- if (m.length > 0) {
1540
+ const f = r.querySelectorAll(":scope > tr");
1541
+ if (f.length > 0) {
1508
1542
  const h = document.createElement("tbody");
1509
- for (const p of m) h.appendChild(p);
1543
+ for (const p of f) h.appendChild(p);
1510
1544
  r.append(h);
1511
1545
  }
1512
1546
  return r;
@@ -1525,7 +1559,7 @@ class ae extends Ze {
1525
1559
  if (l != null) for (let i = 0; i < l.length; i++) {
1526
1560
  const u = l[i];
1527
1561
  if (u == null) continue;
1528
- const { elem: m } = u, h = je(this, m);
1562
+ const { elem: f } = u, h = Ge(this, f);
1529
1563
  if (h !== null && e.is(h)) return { x: i, y: s };
1530
1564
  }
1531
1565
  }
@@ -1546,7 +1580,7 @@ class ae extends Ze {
1546
1580
  const r = this.getDOMCellFromCords(e, t, o);
1547
1581
  if (r == null) return null;
1548
1582
  const s = re(r.elem);
1549
- return w(s) ? s : null;
1583
+ return b(s) ? s : null;
1550
1584
  }
1551
1585
  getCellNodeFromCordsOrThrow(e, t, o) {
1552
1586
  const r = this.getCellNodeFromCords(e, t, o);
@@ -1585,23 +1619,23 @@ class ae extends Ze {
1585
1619
  if (!e) return 0;
1586
1620
  let t = 0;
1587
1621
  return e.getChildren().forEach((o) => {
1588
- w(o) && (t += o.getColSpan());
1622
+ b(o) && (t += o.getColSpan());
1589
1623
  }), t;
1590
1624
  }
1591
1625
  }
1592
1626
  function Qn(n, e) {
1593
1627
  const t = n.getElementByKey(e.getKey());
1594
- return t === null && b(230), me(e, t);
1628
+ return t === null && w(230), me(e, t);
1595
1629
  }
1596
- function Zn(n) {
1597
- const e = st();
1630
+ function Gn(n) {
1631
+ const e = ct();
1598
1632
  n.hasAttribute("data-lexical-row-striping") && e.setRowStriping(!0), n.hasAttribute("data-lexical-frozen-column") && e.setFrozenColumns(1), n.hasAttribute("data-lexical-frozen-row") && e.setFrozenRows(1);
1599
1633
  const t = n.querySelector(":scope > colgroup");
1600
1634
  if (t) {
1601
1635
  let o = [];
1602
1636
  for (const r of t.querySelectorAll(":scope > col")) {
1603
1637
  let s = r.style.width || "";
1604
- if (!nt.test(s) && (s = r.getAttribute("width") || "", !/^\d+$/.test(s))) {
1638
+ if (!lt.test(s) && (s = r.getAttribute("width") || "", !/^\d+$/.test(s))) {
1605
1639
  o = void 0;
1606
1640
  break;
1607
1641
  }
@@ -1609,39 +1643,39 @@ function Zn(n) {
1609
1643
  }
1610
1644
  o && e.setColWidths(o);
1611
1645
  }
1612
- return { after: (o) => xt(o, A), node: e };
1646
+ return { after: (o) => Rt(o, k), node: e };
1613
1647
  }
1614
- function st() {
1615
- return Ge(new ae());
1648
+ function ct() {
1649
+ return nt(new ae());
1616
1650
  }
1617
1651
  function $(n) {
1618
1652
  return n instanceof ae;
1619
1653
  }
1620
- function Gn({ rows: n, columns: e, includeHeaders: t }) {
1621
- const o = B() || Ue();
1622
- if (!o || !z(o) || pe(o.anchor.getNode())) return !1;
1623
- const r = kn(Number(n), Number(e), t);
1624
- qt(r);
1654
+ function Zn({ rows: n, columns: e, includeHeaders: t }) {
1655
+ const o = L() || Ue();
1656
+ if (!o || !M(o) || pe(o.anchor.getNode())) return !1;
1657
+ const r = zn(Number(n), Number(e), t);
1658
+ Qt(r);
1625
1659
  const s = r.getFirstDescendant();
1626
- return Ce(s) && s.select(), !0;
1660
+ return _e(s) && s.select(), !0;
1627
1661
  }
1628
1662
  function eo(n) {
1629
- A(n.getParent()) ? n.isEmpty() && n.append(I()) : n.remove();
1663
+ k(n.getParent()) ? n.isEmpty() && n.append(U()) : n.remove();
1630
1664
  }
1631
1665
  function to(n) {
1632
- $(n.getParent()) ? vt(n, w) : n.remove();
1666
+ $(n.getParent()) ? Ft(n, b) : n.remove();
1633
1667
  }
1634
1668
  function no(n) {
1635
- vt(n, A);
1669
+ Ft(n, k);
1636
1670
  const [e] = oe(n, null, null), t = e.reduce((r, s) => Math.max(r, s.length), 0), o = n.getChildren();
1637
1671
  for (let r = 0; r < e.length; ++r) {
1638
1672
  const s = o[r];
1639
1673
  if (!s) continue;
1640
- A(s) || b(254, s.constructor.name, s.getType());
1674
+ k(s) || w(254, s.constructor.name, s.getType());
1641
1675
  const l = e[r].reduce((i, u) => u ? 1 + i : i, 0);
1642
1676
  if (l !== t) for (let i = l; i < t; ++i) {
1643
1677
  const u = X();
1644
- u.append(I()), s.append(u);
1678
+ u.append(U()), s.append(u);
1645
1679
  }
1646
1680
  }
1647
1681
  }
@@ -1650,25 +1684,25 @@ function oo(n) {
1650
1684
  const e = re(n.target);
1651
1685
  if (e === null) return !1;
1652
1686
  const t = T(e, (o) => D(o) && !o.isInline());
1653
- return t === null ? !1 : !!w(t.getParent()) && (t.select(0), !0);
1687
+ return t === null ? !1 : !!b(t.getParent()) && (t.select(0), !0);
1654
1688
  }
1655
- function fo(n) {
1689
+ function mo(n) {
1656
1690
  return n.registerNodeTransform(ce, (e) => {
1657
1691
  if (e.getColSpan() > 1 || e.getRowSpan() > 1) {
1658
- const [, , t] = Z(e), [o] = U(t, e, e), r = o.length, s = o[0].length;
1692
+ const [, , t] = I(e), [o] = J(t, e, e), r = o.length, s = o[0].length;
1659
1693
  let l = t.getFirstChild();
1660
- A(l) || b(175);
1694
+ k(l) || w(175);
1661
1695
  const i = [];
1662
1696
  for (let u = 0; u < r; u++) {
1663
- u !== 0 && (l = l.getNextSibling(), A(l) || b(175));
1664
- let m = null;
1697
+ u !== 0 && (l = l.getNextSibling(), k(l) || w(175));
1698
+ let f = null;
1665
1699
  for (let h = 0; h < s; h++) {
1666
- const p = o[u][h], C = p.cell;
1667
- if (p.startRow === u && p.startColumn === h) m = C, i.push(C);
1668
- else if (C.getColSpan() > 1 || C.getRowSpan() > 1) {
1669
- w(C) || b(176);
1670
- const a = X(C.__headerState);
1671
- m !== null ? m.insertAfter(a) : Yt(l, a);
1700
+ const p = o[u][h], _ = p.cell;
1701
+ if (p.startRow === u && p.startColumn === h) f = _, i.push(_);
1702
+ else if (_.getColSpan() > 1 || _.getRowSpan() > 1) {
1703
+ b(_) || w(176);
1704
+ const a = X(_.__headerState);
1705
+ f !== null ? f.insertAfter(a) : jt(l, a);
1672
1706
  }
1673
1707
  }
1674
1708
  }
@@ -1676,17 +1710,17 @@ function fo(n) {
1676
1710
  }
1677
1711
  });
1678
1712
  }
1679
- function go(n, e = !0) {
1713
+ function po(n, e = !0) {
1680
1714
  const t = /* @__PURE__ */ new Map(), o = (s, l, i) => {
1681
- const u = ie(s, i), m = Yn(s, u, n, e);
1682
- t.set(l, [m, u]);
1715
+ const u = ie(s, i), f = Xn(s, u, n, e);
1716
+ t.set(l, [f, u]);
1683
1717
  }, r = n.registerMutationListener(ae, (s) => {
1684
1718
  n.getEditorState().read(() => {
1685
1719
  for (const [l, i] of s) {
1686
1720
  const u = t.get(l);
1687
1721
  if (i === "created" || i === "updated") {
1688
- const { tableNode: m, tableElement: h } = $t(l);
1689
- u === void 0 ? o(m, l, h) : h !== u[1] && (u[0].removeListeners(), t.delete(l), o(m, l, h));
1722
+ const { tableNode: f, tableElement: h } = Lt(l);
1723
+ u === void 0 ? o(f, l, h) : h !== u[1] && (u[0].removeListeners(), t.delete(l), o(f, l, h));
1690
1724
  } else i === "destroyed" && u !== void 0 && (u[0].removeListeners(), t.delete(l));
1691
1725
  }
1692
1726
  }, { editor: n });
@@ -1696,27 +1730,34 @@ function go(n, e = !0) {
1696
1730
  for (const [, [s]] of t) s.removeListeners();
1697
1731
  };
1698
1732
  }
1699
- function mo(n) {
1700
- return n.hasNodes([ae]) || b(255), Xt(n.registerCommand(Kn, Gn, De), n.registerCommand(Rt, ({ nodes: e, selection: t }, o) => n !== o || !z(t) ? !1 : pe(t.anchor.getNode()) !== null && e.some($), De), n.registerCommand(Zt, oo, De), n.registerNodeTransform(ae, no), n.registerNodeTransform(Te, to), n.registerNodeTransform(ce, eo));
1733
+ function _o(n) {
1734
+ return n.hasNodes([ae]) || w(255), Vt(n.registerCommand(kn, Zn, De), n.registerCommand(Kt, ({ nodes: e, selection: t }, o) => n !== o || !M(t) ? !1 : pe(t.anchor.getNode()) !== null && e.some($), De), n.registerCommand(rn, oo, De), n.registerNodeTransform(ae, no), n.registerNodeTransform(Te, to), n.registerNodeTransform(ce, eo));
1701
1735
  }
1702
1736
  export {
1703
1737
  co as B,
1704
- At as H,
1705
- ve as K,
1706
- kn as L,
1738
+ k as E,
1739
+ $t as H,
1740
+ xe as K,
1741
+ zn as L,
1742
+ $e as M,
1707
1743
  Te as O,
1708
1744
  ao as P,
1709
- w as R,
1710
- fo as S,
1745
+ b as R,
1746
+ mo as S,
1747
+ pe as V,
1711
1748
  io as W,
1712
- uo as Z,
1749
+ uo as Y,
1713
1750
  ae as a,
1714
- mo as b,
1715
- ho as c,
1716
- Qe as s,
1751
+ ho as b,
1752
+ ie as c,
1753
+ go as d,
1754
+ _o as e,
1755
+ oe as h,
1756
+ fo as n,
1757
+ et as s,
1717
1758
  X as v,
1718
- go as w,
1759
+ po as w,
1719
1760
  ce as y,
1720
- Kt as z
1761
+ kt as z
1721
1762
  };
1722
- //# sourceMappingURL=LexicalTable.prod-CwkGGOke.js.map
1763
+ //# sourceMappingURL=LexicalTable.prod-iqHmKv_G.js.map