@uva-glass/component-library 1.64.0 → 1.64.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/dist/Lexical.prod-DSqOWcE1.js +4072 -0
  2. package/dist/Lexical.prod-DSqOWcE1.js.map +1 -0
  3. package/dist/{LexicalClipboard.prod-C6LsK5E6.js → LexicalClipboard.prod-DP0us-xV.js} +107 -107
  4. package/dist/{LexicalClipboard.prod-C6LsK5E6.js.map → LexicalClipboard.prod-DP0us-xV.js.map} +1 -1
  5. package/dist/LexicalLink.prod-DWrTW8iE.js +208 -0
  6. package/dist/LexicalLink.prod-DWrTW8iE.js.map +1 -0
  7. package/dist/LexicalList.prod-Cg8npow-.js +564 -0
  8. package/dist/LexicalList.prod-Cg8npow-.js.map +1 -0
  9. package/dist/LexicalTable.prod-DEA4KRzX.js +1221 -0
  10. package/dist/LexicalTable.prod-DEA4KRzX.js.map +1 -0
  11. package/dist/{LexicalUtils.prod-BTFNWAMw.js → LexicalUtils.prod-CicP_X7u.js} +44 -35
  12. package/dist/{LexicalUtils.prod-BTFNWAMw.js.map → LexicalUtils.prod-CicP_X7u.js.map} +1 -1
  13. package/dist/RteEditor.module-BeUn7GiA.js +32 -0
  14. package/dist/RteEditor.module-BeUn7GiA.js.map +1 -0
  15. package/dist/{TablePlugin-BLzR0g93.js → TablePlugin-aDKhmuu7.js} +57 -59
  16. package/dist/{TablePlugin-BLzR0g93.js.map → TablePlugin-aDKhmuu7.js.map} +1 -1
  17. package/dist/assets/RteEditor.css +1 -1
  18. package/dist/components/CheckboxTree/CheckboxTree.js +18 -21
  19. package/dist/components/CheckboxTree/CheckboxTree.js.map +1 -1
  20. package/dist/components/FormInput/FormInput.js +12 -15
  21. package/dist/components/FormInput/FormInput.js.map +1 -1
  22. package/dist/components/InputField/InputField.stories.js +13 -16
  23. package/dist/components/InputField/InputField.stories.js.map +1 -1
  24. package/dist/components/MultiSelect/MultiSelect.js +1 -1
  25. package/dist/components/MultiSelect/MultiSelect.stories.js +1 -1
  26. package/dist/components/MultiSelect/components/MultiSelectHeader.js +3 -6
  27. package/dist/components/MultiSelect/components/MultiSelectHeader.js.map +1 -1
  28. package/dist/components/MultiSelect/index.js +1 -1
  29. package/dist/components/PeriodSelector/PeriodSelector.js +19 -22
  30. package/dist/components/PeriodSelector/PeriodSelector.js.map +1 -1
  31. package/dist/components/ProgrammeCard/ProgrammeCard.stories.js +17 -20
  32. package/dist/components/ProgrammeCard/ProgrammeCard.stories.js.map +1 -1
  33. package/dist/components/RteEditor/EditorHeader/EditorHeader.js +4 -7
  34. package/dist/components/RteEditor/EditorHeader/EditorHeader.js.map +1 -1
  35. package/dist/components/RteEditor/Plugins/BlockFormatPlugin/BlockFormatPlugin.js +16 -16
  36. package/dist/components/RteEditor/Plugins/HistoryPlugin/HistoryPlugin.js +27 -29
  37. package/dist/components/RteEditor/Plugins/HistoryPlugin/HistoryPlugin.js.map +1 -1
  38. package/dist/components/RteEditor/Plugins/LinkPlugin/AddLinkForm/AddLinkFrom.js +4 -7
  39. package/dist/components/RteEditor/Plugins/LinkPlugin/AddLinkForm/AddLinkFrom.js.map +1 -1
  40. package/dist/components/RteEditor/Plugins/LinkPlugin/LinkContextMenu/LinkContextMenu.js +1 -1
  41. package/dist/components/RteEditor/Plugins/LinkPlugin/LinkPlugin.js +100 -101
  42. package/dist/components/RteEditor/Plugins/LinkPlugin/LinkPlugin.js.map +1 -1
  43. package/dist/components/RteEditor/Plugins/LinkPlugin/helpers.js +1 -1
  44. package/dist/components/RteEditor/Plugins/ListPlugin/ListPlugin.js +35 -35
  45. package/dist/components/RteEditor/Plugins/ListPlugin/ListPlugin.js.map +1 -1
  46. package/dist/components/RteEditor/Plugins/PasteHandlerPlugin/PasteHandlerPlugin.js +15 -15
  47. package/dist/components/RteEditor/Plugins/PasteHandlerPlugin/PasteHandlerPlugin.js.map +1 -1
  48. package/dist/components/RteEditor/Plugins/TablePlugin/AddTableFrom.js +3 -6
  49. package/dist/components/RteEditor/Plugins/TablePlugin/AddTableFrom.js.map +1 -1
  50. package/dist/components/RteEditor/Plugins/TablePlugin/TablePlugin.js +6 -8
  51. package/dist/components/RteEditor/Plugins/TablePlugin/TablePlugin.js.map +1 -1
  52. package/dist/components/RteEditor/Plugins/TablePlugin/helpers.js +12 -12
  53. package/dist/components/RteEditor/Plugins/TablePlugin/index.js +1 -1
  54. package/dist/components/RteEditor/Plugins/ToolbarPlugin/ToolbarPlugin.js +34 -34
  55. package/dist/components/RteEditor/Plugins/index.js +1 -1
  56. package/dist/components/RteEditor/RteEditor.js +354 -354
  57. package/dist/components/RteEditor/RteEditor.js.map +1 -1
  58. package/dist/components/RteEditor/UvaTheme/UvaTheme.js +13 -12
  59. package/dist/components/RteEditor/UvaTheme/UvaTheme.js.map +1 -1
  60. package/dist/components/RteEditor/helpers.js +27 -27
  61. package/dist/components/index.js +1 -1
  62. package/dist/helpers-BuSJOvGF.js +168 -0
  63. package/dist/{helpers-B-pdj8pq.js.map → helpers-BuSJOvGF.js.map} +1 -1
  64. package/dist/index-DPQ9bZx5.js +231 -0
  65. package/dist/index-DPQ9bZx5.js.map +1 -0
  66. package/dist/index.js +1 -1
  67. package/package.json +18 -16
  68. package/dist/LexicalTable.prod-DqzrJuYr.js +0 -1221
  69. package/dist/LexicalTable.prod-DqzrJuYr.js.map +0 -1
  70. package/dist/RteEditor.module-DcvGRx3a.js +0 -21
  71. package/dist/RteEditor.module-DcvGRx3a.js.map +0 -1
  72. package/dist/helpers-B-pdj8pq.js +0 -168
@@ -0,0 +1,4072 @@
1
+ function qi(n) {
2
+ return {};
3
+ }
4
+ const wn = {}, Qi = {}, Ls = {}, yt = {}, gt = {}, Yn = {}, He = {}, Wr = {}, Zn = {}, mt = {}, xt = {}, we = {}, Br = {}, Rr = {}, Os = {}, Is = {}, As = {}, Ms = {}, zs = {}, Ws = {}, Bs = {}, dn = {}, Rs = {}, Ks = {}, $s = {}, Js = {}, Us = {}, Xi = {}, Yi = {}, Zi = {}, Vs = {}, Gi = {}, js = {}, Hs = {}, qs = {}, Kr = {}, $r = {}, Gn = {}, eo = {}, to = {}, no = {}, ro = {}, Qs = {}, Xs = {}, Ys = {}, ne = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0, Zs = ne && "documentMode" in document ? document.documentMode : null, G = ne && /Mac|iPod|iPhone|iPad/.test(navigator.platform), xe = ne && /^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent), vt = !(!ne || !("InputEvent" in window) || Zs) && "getTargetRanges" in new window.InputEvent("input"), Nn = ne && /Version\/[\d.]+.*Safari/.test(navigator.userAgent), It = ne && /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream, Gs = ne && /Android/.test(navigator.userAgent), Jr = ne && /^(?=.*Chrome).*/i.test(navigator.userAgent), ei = ne && Gs && Jr, En = ne && /AppleWebKit\/[\d.]+/.test(navigator.userAgent) && !Jr, rt = 1, Te = 3, Ee = 0, Ur = 1, Me = 2, ti = 0, ni = 1, ri = 2, St = 4, Tt = 8, Pn = 128, si = 112 | (3 | St | Tt) | Pn, Fn = 1, Dn = 2, Ln = 3, On = 4, In = 5, An = 6, At = Nn || It || En ? " " : "​", ae = `
5
+
6
+ `, ii = xe ? " " : At, Vr = "֑-߿יִ-﷽ﹰ-ﻼ", jr = "A-Za-zÀ-ÖØ-öø-ʸ̀-֐ࠀ-῿‎Ⰰ-﬜︀-﹯﻽-￿", oi = new RegExp("^[^" + jr + "]*[" + Vr + "]"), li = new RegExp("^[^" + Vr + "]*[" + jr + "]"), ce = { bold: 1, code: 16, highlight: Pn, italic: 2, strikethrough: St, subscript: 32, superscript: 64, underline: Tt }, ci = { directionless: 1, unmergeable: 2 }, er = { center: Dn, end: An, justify: On, left: Fn, right: Ln, start: In }, ai = { [Dn]: "center", [An]: "end", [On]: "justify", [Fn]: "left", [Ln]: "right", [In]: "start" }, ui = { normal: 0, segmented: 2, token: 1 }, fi = { [ti]: "normal", [ri]: "segmented", [ni]: "token" };
7
+ function di(n) {
8
+ return n && n.__esModule && Object.prototype.hasOwnProperty.call(n, "default") ? n.default : n;
9
+ }
10
+ var b = di(function(n) {
11
+ const e = new URLSearchParams();
12
+ e.append("code", n);
13
+ for (let t = 1; t < arguments.length; t++) e.append("v", arguments[t]);
14
+ throw Error(`Minified Lexical error #${n}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`);
15
+ });
16
+ function Ct(...n) {
17
+ const e = [];
18
+ for (const t of n) if (t && typeof t == "string") for (const [r] of t.matchAll(/\S+/g)) e.push(r);
19
+ return e;
20
+ }
21
+ const hi = 100;
22
+ let hn = !1, Mn = 0;
23
+ function gi(n) {
24
+ Mn = n.timeStamp;
25
+ }
26
+ function tn(n, e, t) {
27
+ return e.__lexicalLineBreak === n || n[`__lexicalKey_${t._key}`] !== void 0;
28
+ }
29
+ function _i(n, e, t) {
30
+ const r = se(t._window);
31
+ let s = null, i = null;
32
+ r !== null && r.anchorNode === n && (s = r.anchorOffset, i = r.focusOffset);
33
+ const o = n.nodeValue;
34
+ o !== null && Rn(e, o, s, i, !1);
35
+ }
36
+ function pi(n, e, t) {
37
+ if (F(n)) {
38
+ const r = n.anchor.getNode();
39
+ if (r.is(t) && n.format !== r.getFormat()) return !1;
40
+ }
41
+ return e.nodeType === Te && t.isAttached();
42
+ }
43
+ function Hr(n, e, t) {
44
+ hn = !0;
45
+ const r = performance.now() - Mn > hi;
46
+ try {
47
+ X(n, () => {
48
+ const s = I() || function(f) {
49
+ return f.getEditorState().read(() => {
50
+ const d = I();
51
+ return d !== null ? d.clone() : null;
52
+ });
53
+ }(n), i = /* @__PURE__ */ new Map(), o = n.getRootElement(), l = n._editorState, c = n._blockCursorElement;
54
+ let a = !1, u = "";
55
+ for (let f = 0; f < e.length; f++) {
56
+ const d = e[f], g = d.type, p = d.target;
57
+ let _ = Wt(p, l);
58
+ if (!(_ === null && p !== o || A(_))) {
59
+ if (g === "characterData") r && N(_) && pi(s, p, _) && _i(p, _, n);
60
+ else if (g === "childList") {
61
+ a = !0;
62
+ const m = d.addedNodes;
63
+ for (let k = 0; k < m.length; k++) {
64
+ const T = m[k], x = Gr(T), P = T.parentNode;
65
+ if (P != null && T !== c && x === null && (T.nodeName !== "BR" || !tn(T, P, n))) {
66
+ if (xe) {
67
+ const C = T.innerText || T.nodeValue;
68
+ C && (u += C);
69
+ }
70
+ P.removeChild(T);
71
+ }
72
+ }
73
+ const y = d.removedNodes, S = y.length;
74
+ if (S > 0) {
75
+ let k = 0;
76
+ for (let T = 0; T < S; T++) {
77
+ const x = y[T];
78
+ (x.nodeName === "BR" && tn(x, p, n) || c === x) && (p.appendChild(x), k++);
79
+ }
80
+ S !== k && (p === o && (_ = ts(l)), i.set(p, _));
81
+ }
82
+ }
83
+ }
84
+ }
85
+ if (i.size > 0) for (const [f, d] of i) if (v(d)) {
86
+ const g = d.getChildrenKeys();
87
+ let p = f.firstChild;
88
+ for (let _ = 0; _ < g.length; _++) {
89
+ const m = g[_], y = n.getElementByKey(m);
90
+ y !== null && (p == null ? (f.appendChild(y), p = y) : p !== y && f.replaceChild(y, p), p = p.nextSibling);
91
+ }
92
+ } else N(d) && d.markDirty();
93
+ const h = t.takeRecords();
94
+ if (h.length > 0) {
95
+ for (let f = 0; f < h.length; f++) {
96
+ const d = h[f], g = d.addedNodes, p = d.target;
97
+ for (let _ = 0; _ < g.length; _++) {
98
+ const m = g[_], y = m.parentNode;
99
+ y == null || m.nodeName !== "BR" || tn(m, p, n) || y.removeChild(m);
100
+ }
101
+ }
102
+ t.takeRecords();
103
+ }
104
+ s !== null && (a && (s.dirty = !0, ue(s)), xe && is(n) && s.insertRawText(u));
105
+ });
106
+ } finally {
107
+ hn = !1;
108
+ }
109
+ }
110
+ function qr(n) {
111
+ const e = n._observer;
112
+ e !== null && Hr(n, e.takeRecords(), e);
113
+ }
114
+ function Qr(n) {
115
+ (function(e) {
116
+ Mn === 0 && Kt(e).addEventListener("textInput", gi, !0);
117
+ })(n), n._observer = new MutationObserver((e, t) => {
118
+ Hr(n, e, t);
119
+ });
120
+ }
121
+ function tr(n, e) {
122
+ const t = n.__mode, r = n.__format, s = n.__style, i = e.__mode, o = e.__format, l = e.__style;
123
+ return !(t !== null && t !== i || r !== null && r !== o || s !== null && s !== l);
124
+ }
125
+ function nr(n, e) {
126
+ const t = n.mergeWithSibling(e), r = M()._normalizedNodes;
127
+ return r.add(n.__key), r.add(e.__key), t;
128
+ }
129
+ function rr(n) {
130
+ let e, t, r = n;
131
+ if (r.__text !== "" || !r.isSimpleText() || r.isUnmergeable()) {
132
+ for (; (e = r.getPreviousSibling()) !== null && N(e) && e.isSimpleText() && !e.isUnmergeable(); ) {
133
+ if (e.__text !== "") {
134
+ if (tr(e, r)) {
135
+ r = nr(e, r);
136
+ break;
137
+ }
138
+ break;
139
+ }
140
+ e.remove();
141
+ }
142
+ for (; (t = r.getNextSibling()) !== null && N(t) && t.isSimpleText() && !t.isUnmergeable(); ) {
143
+ if (t.__text !== "") {
144
+ if (tr(r, t)) {
145
+ r = nr(r, t);
146
+ break;
147
+ }
148
+ break;
149
+ }
150
+ t.remove();
151
+ }
152
+ } else r.remove();
153
+ }
154
+ function yi(n) {
155
+ return sr(n.anchor), sr(n.focus), n;
156
+ }
157
+ function sr(n) {
158
+ for (; n.type === "element"; ) {
159
+ const e = n.getNode(), t = n.offset;
160
+ let r, s;
161
+ if (t === e.getChildrenSize() ? (r = e.getChildAtIndex(t - 1), s = !0) : (r = e.getChildAtIndex(t), s = !1), N(r)) {
162
+ n.set(r.__key, s ? r.getTextContentSize() : 0, "text");
163
+ break;
164
+ }
165
+ if (!v(r)) break;
166
+ n.set(r.__key, s ? r.getChildrenSize() : 0, "element");
167
+ }
168
+ }
169
+ let mi = 1;
170
+ const xi = typeof queueMicrotask == "function" ? queueMicrotask : (n) => {
171
+ Promise.resolve().then(n);
172
+ };
173
+ function Xr(n) {
174
+ const e = document.activeElement;
175
+ if (e === null) return !1;
176
+ const t = e.nodeName;
177
+ return A(Wt(n)) && (t === "INPUT" || t === "TEXTAREA" || e.contentEditable === "true" && zt(e) == null);
178
+ }
179
+ function Mt(n, e, t) {
180
+ const r = n.getRootElement();
181
+ try {
182
+ return r !== null && r.contains(e) && r.contains(t) && e !== null && !Xr(e) && Yr(e) === n;
183
+ } catch {
184
+ return !1;
185
+ }
186
+ }
187
+ function zn(n) {
188
+ return n instanceof Yt;
189
+ }
190
+ function Yr(n) {
191
+ let e = n;
192
+ for (; e != null; ) {
193
+ const t = zt(e);
194
+ if (zn(t)) return t;
195
+ e = Rt(e);
196
+ }
197
+ return null;
198
+ }
199
+ function zt(n) {
200
+ return n ? n.__lexicalEditor : null;
201
+ }
202
+ function be(n) {
203
+ return n.isToken() || n.isSegmented();
204
+ }
205
+ function vi(n) {
206
+ return n.nodeType === Te;
207
+ }
208
+ function kt(n) {
209
+ let e = n;
210
+ for (; e != null; ) {
211
+ if (vi(e)) return e;
212
+ e = e.firstChild;
213
+ }
214
+ return null;
215
+ }
216
+ function bt(n, e, t) {
217
+ const r = ce[e];
218
+ if (t !== null && (n & r) == (t & r)) return n;
219
+ let s = n ^ r;
220
+ return e === "subscript" ? s &= ~ce.superscript : e === "superscript" && (s &= ~ce.subscript), s;
221
+ }
222
+ function so(n) {
223
+ return N(n) || Ae(n) || A(n);
224
+ }
225
+ function Zr(n, e) {
226
+ if (e != null) return void (n.__key = e);
227
+ q(), bs();
228
+ const t = M(), r = fe(), s = "" + mi++;
229
+ r._nodeMap.set(s, n), v(n) ? t._dirtyElements.set(s, !0) : t._dirtyLeaves.add(s), t._cloneNotNeeded.add(s), t._dirtyType = Ur, n.__key = s;
230
+ }
231
+ function Ne(n) {
232
+ const e = n.getParent();
233
+ if (e !== null) {
234
+ const t = n.getWritable(), r = e.getWritable(), s = n.getPreviousSibling(), i = n.getNextSibling();
235
+ if (s === null) if (i !== null) {
236
+ const o = i.getWritable();
237
+ r.__first = i.__key, o.__prev = null;
238
+ } else r.__first = null;
239
+ else {
240
+ const o = s.getWritable();
241
+ if (i !== null) {
242
+ const l = i.getWritable();
243
+ l.__prev = o.__key, o.__next = l.__key;
244
+ } else o.__next = null;
245
+ t.__prev = null;
246
+ }
247
+ if (i === null) if (s !== null) {
248
+ const o = s.getWritable();
249
+ r.__last = s.__key, o.__next = null;
250
+ } else r.__last = null;
251
+ else {
252
+ const o = i.getWritable();
253
+ if (s !== null) {
254
+ const l = s.getWritable();
255
+ l.__next = o.__key, o.__prev = l.__key;
256
+ } else o.__prev = null;
257
+ t.__next = null;
258
+ }
259
+ r.__size--, t.__parent = null;
260
+ }
261
+ }
262
+ function wt(n) {
263
+ bs();
264
+ const e = n.getLatest(), t = e.__parent, r = fe(), s = M(), i = r._nodeMap, o = s._dirtyElements;
265
+ t !== null && function(c, a, u) {
266
+ let h = c;
267
+ for (; h !== null; ) {
268
+ if (u.has(h)) return;
269
+ const f = a.get(h);
270
+ if (f === void 0) break;
271
+ u.set(h, !1), h = f.__parent;
272
+ }
273
+ }(t, i, o);
274
+ const l = e.__key;
275
+ s._dirtyType = Ur, v(n) ? o.set(l, !0) : s._dirtyLeaves.add(l);
276
+ }
277
+ function J(n) {
278
+ q();
279
+ const e = M(), t = e._compositionKey;
280
+ if (n !== t) {
281
+ if (e._compositionKey = n, t !== null) {
282
+ const r = V(t);
283
+ r !== null && r.getWritable();
284
+ }
285
+ if (n !== null) {
286
+ const r = V(n);
287
+ r !== null && r.getWritable();
288
+ }
289
+ }
290
+ }
291
+ function ye() {
292
+ return lt() ? null : M()._compositionKey;
293
+ }
294
+ function V(n, e) {
295
+ const t = (e || fe())._nodeMap.get(n);
296
+ return t === void 0 ? null : t;
297
+ }
298
+ function Gr(n, e) {
299
+ const t = n[`__lexicalKey_${M()._key}`];
300
+ return t !== void 0 ? V(t, e) : null;
301
+ }
302
+ function Wt(n, e) {
303
+ let t = n;
304
+ for (; t != null; ) {
305
+ const r = Gr(t, e);
306
+ if (r !== null) return r;
307
+ t = Rt(t);
308
+ }
309
+ return null;
310
+ }
311
+ function es(n) {
312
+ const e = n._decorators, t = Object.assign({}, e);
313
+ return n._pendingDecorators = t, t;
314
+ }
315
+ function ir(n) {
316
+ return n.read(() => Z().getTextContent());
317
+ }
318
+ function Z() {
319
+ return ts(fe());
320
+ }
321
+ function ts(n) {
322
+ return n._nodeMap.get("root");
323
+ }
324
+ function ue(n) {
325
+ q();
326
+ const e = fe();
327
+ n !== null && (n.dirty = !0, n.setCachedNodes(null)), e._selection = n;
328
+ }
329
+ function Oe(n) {
330
+ const e = M(), t = function(r, s) {
331
+ let i = r;
332
+ for (; i != null; ) {
333
+ const o = i[`__lexicalKey_${s._key}`];
334
+ if (o !== void 0) return o;
335
+ i = Rt(i);
336
+ }
337
+ return null;
338
+ }(n, e);
339
+ return t === null ? n === e.getRootElement() ? V("root") : null : V(t);
340
+ }
341
+ function or(n, e) {
342
+ return e ? n.getTextContentSize() : 0;
343
+ }
344
+ function ns(n) {
345
+ return /[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(n);
346
+ }
347
+ function Wn(n) {
348
+ const e = [];
349
+ let t = n;
350
+ for (; t !== null; ) e.push(t), t = t._parentEditor;
351
+ return e;
352
+ }
353
+ function rs() {
354
+ return Math.random().toString(36).replace(/[^a-z]+/g, "").substr(0, 5);
355
+ }
356
+ function ss(n) {
357
+ return n.nodeType === Te ? n.nodeValue : null;
358
+ }
359
+ function Bn(n, e, t) {
360
+ const r = se(e._window);
361
+ if (r === null) return;
362
+ const s = r.anchorNode;
363
+ let { anchorOffset: i, focusOffset: o } = r;
364
+ if (s !== null) {
365
+ let l = ss(s);
366
+ const c = Wt(s);
367
+ if (l !== null && N(c)) {
368
+ if (l === At && t) {
369
+ const a = t.length;
370
+ l = t, i = a, o = a;
371
+ }
372
+ l !== null && Rn(c, l, i, o, n);
373
+ }
374
+ }
375
+ }
376
+ function Rn(n, e, t, r, s) {
377
+ let i = n;
378
+ if (i.isAttached() && (s || !i.isDirty())) {
379
+ const o = i.isComposing();
380
+ let l = e;
381
+ (o || s) && e[e.length - 1] === At && (l = e.slice(0, -1));
382
+ const c = i.getTextContent();
383
+ if (s || l !== c) {
384
+ if (l === "") {
385
+ if (J(null), Nn || It || En) i.remove();
386
+ else {
387
+ const p = M();
388
+ setTimeout(() => {
389
+ p.update(() => {
390
+ i.isAttached() && i.remove();
391
+ });
392
+ }, 20);
393
+ }
394
+ return;
395
+ }
396
+ const a = i.getParent(), u = ot(), h = i.getTextContentSize(), f = ye(), d = i.getKey();
397
+ if (i.isToken() || f !== null && d === f && !o || F(u) && (a !== null && !a.canInsertTextBefore() && u.anchor.offset === 0 || u.anchor.key === n.__key && u.anchor.offset === 0 && !i.canInsertTextBefore() && !o || u.focus.key === n.__key && u.focus.offset === h && !i.canInsertTextAfter() && !o)) return void i.markDirty();
398
+ const g = I();
399
+ if (!F(g) || t === null || r === null) return void i.setTextContent(l);
400
+ if (g.setTextNodeRange(i, t, i, r), i.isSegmented()) {
401
+ const p = $(i.getTextContent());
402
+ i.replace(p), i = p;
403
+ }
404
+ i.setTextContent(l);
405
+ }
406
+ }
407
+ }
408
+ function Si(n, e) {
409
+ if (e.isSegmented()) return !0;
410
+ if (!n.isCollapsed()) return !1;
411
+ const t = n.anchor.offset, r = e.getParentOrThrow(), s = e.isToken();
412
+ return t === 0 ? !e.canInsertTextBefore() || !r.canInsertTextBefore() && !e.isComposing() || s || function(i) {
413
+ const o = i.getPreviousSibling();
414
+ return (N(o) || v(o) && o.isInline()) && !o.canInsertTextAfter();
415
+ }(e) : t === e.getTextContentSize() && (!e.canInsertTextAfter() || !r.canInsertTextAfter() && !e.isComposing() || s);
416
+ }
417
+ function lr(n) {
418
+ return n === "ArrowLeft";
419
+ }
420
+ function cr(n) {
421
+ return n === "ArrowRight";
422
+ }
423
+ function Ve(n, e) {
424
+ return G ? n : e;
425
+ }
426
+ function ar(n) {
427
+ return n === "Enter";
428
+ }
429
+ function Ke(n) {
430
+ return n === "Backspace";
431
+ }
432
+ function $e(n) {
433
+ return n === "Delete";
434
+ }
435
+ function ur(n, e, t) {
436
+ return n.toLowerCase() === "a" && Ve(e, t);
437
+ }
438
+ function io() {
439
+ const n = Z();
440
+ ue(yi(n.select(0, n.getChildrenSize())));
441
+ }
442
+ function qe(n, e) {
443
+ n.__lexicalClassNameCache === void 0 && (n.__lexicalClassNameCache = {});
444
+ const t = n.__lexicalClassNameCache, r = t[e];
445
+ if (r !== void 0) return r;
446
+ const s = n[e];
447
+ if (typeof s == "string") {
448
+ const i = Ct(s);
449
+ return t[e] = i, i;
450
+ }
451
+ return s;
452
+ }
453
+ function Kn(n, e, t, r, s) {
454
+ if (t.size === 0) return;
455
+ const i = r.__type, o = r.__key, l = e.get(i);
456
+ l === void 0 && b(33, i);
457
+ const c = l.klass;
458
+ let a = n.get(c);
459
+ a === void 0 && (a = /* @__PURE__ */ new Map(), n.set(c, a));
460
+ const u = a.get(o), h = u === "destroyed" && s === "created";
461
+ (u === void 0 || h) && a.set(o, h ? "updated" : s);
462
+ }
463
+ function fr(n, e, t) {
464
+ const r = n.getParent();
465
+ let s = t, i = n;
466
+ return r !== null && (e && t === 0 ? (s = i.getIndexWithinParent(), i = r) : e || t !== i.getChildrenSize() || (s = i.getIndexWithinParent() + 1, i = r)), i.getChildAtIndex(e ? s - 1 : s);
467
+ }
468
+ function dr(n, e) {
469
+ const t = n.offset;
470
+ if (n.type === "element")
471
+ return fr(n.getNode(), e, t);
472
+ {
473
+ const r = n.getNode();
474
+ if (e && t === 0 || !e && t === r.getTextContentSize()) {
475
+ const s = e ? r.getPreviousSibling() : r.getNextSibling();
476
+ return s === null ? fr(r.getParentOrThrow(), e, r.getIndexWithinParent() + (e ? 0 : 1)) : s;
477
+ }
478
+ }
479
+ return null;
480
+ }
481
+ function is(n) {
482
+ const e = Kt(n).event, t = e && e.inputType;
483
+ return t === "insertFromPaste" || t === "insertFromPasteAsQuotation";
484
+ }
485
+ function w(n, e, t) {
486
+ return Es(n, e, t);
487
+ }
488
+ function Bt(n) {
489
+ return !Y(n) && !n.isLastChild() && !n.isInline();
490
+ }
491
+ function Nt(n, e) {
492
+ const t = n._keyToDOMMap.get(e);
493
+ return t === void 0 && b(75, e), t;
494
+ }
495
+ function Rt(n) {
496
+ const e = n.assignedSlot || n.parentElement;
497
+ return e !== null && e.nodeType === 11 ? e.host : e;
498
+ }
499
+ function Qe(n, e) {
500
+ let t = n.getParent();
501
+ for (; t !== null; ) {
502
+ if (t.is(e)) return !0;
503
+ t = t.getParent();
504
+ }
505
+ return !1;
506
+ }
507
+ function Kt(n) {
508
+ const e = n._window;
509
+ return e === null && b(78), e;
510
+ }
511
+ function Ti(n) {
512
+ let e = n.getParentOrThrow();
513
+ for (; e !== null; ) {
514
+ if (Pe(e)) return e;
515
+ e = e.getParentOrThrow();
516
+ }
517
+ return e;
518
+ }
519
+ function Pe(n) {
520
+ return Y(n) || v(n) && n.isShadowRoot();
521
+ }
522
+ function Ci(n) {
523
+ const e = n.constructor.clone(n);
524
+ return Zr(e, null), e;
525
+ }
526
+ function $t(n) {
527
+ const e = M(), t = n.constructor.getType(), r = e._nodes.get(t);
528
+ r === void 0 && b(200, n.constructor.name, t);
529
+ const { replace: s, replaceWithKlass: i } = r;
530
+ if (s !== null) {
531
+ const o = s(n), l = o.constructor;
532
+ return i !== null ? o instanceof i || b(201, i.name, i.getType(), l.name, l.getType(), n.constructor.name, t) : o instanceof n.constructor && l !== n.constructor || b(202, l.name, l.getType(), n.constructor.name, t), o.__key === n.__key && b(203, n.constructor.name, t, l.name, l.getType()), o;
533
+ }
534
+ return n;
535
+ }
536
+ function nn(n, e) {
537
+ !Y(n.getParent()) || v(e) || A(e) || b(99);
538
+ }
539
+ function rn(n) {
540
+ return (A(n) || v(n) && !n.canBeEmpty()) && !n.isInline();
541
+ }
542
+ function $n(n, e, t) {
543
+ t.style.removeProperty("caret-color"), e._blockCursorElement = null;
544
+ const r = n.parentElement;
545
+ r !== null && r.removeChild(n);
546
+ }
547
+ function ki(n, e, t) {
548
+ let r = n._blockCursorElement;
549
+ if (F(t) && t.isCollapsed() && t.anchor.type === "element" && e.contains(document.activeElement)) {
550
+ const s = t.anchor, i = s.getNode(), o = s.offset;
551
+ let l = !1, c = null;
552
+ if (o === i.getChildrenSize())
553
+ rn(i.getChildAtIndex(o - 1)) && (l = !0);
554
+ else {
555
+ const a = i.getChildAtIndex(o);
556
+ if (rn(a)) {
557
+ const u = a.getPreviousSibling();
558
+ (u === null || rn(u)) && (l = !0, c = n.getElementByKey(a.__key));
559
+ }
560
+ }
561
+ if (l) {
562
+ const a = n.getElementByKey(i.__key);
563
+ return r === null && (n._blockCursorElement = r = function(u) {
564
+ const h = u.theme, f = document.createElement("div");
565
+ f.contentEditable = "false", f.setAttribute("data-lexical-cursor", "true");
566
+ let d = h.blockCursor;
567
+ if (d !== void 0) {
568
+ if (typeof d == "string") {
569
+ const g = Ct(d);
570
+ d = h.blockCursor = g;
571
+ }
572
+ d !== void 0 && f.classList.add(...d);
573
+ }
574
+ return f;
575
+ }(n._config)), e.style.caretColor = "transparent", void (c === null ? a.appendChild(r) : a.insertBefore(r, c));
576
+ }
577
+ }
578
+ r !== null && $n(r, n, e);
579
+ }
580
+ function se(n) {
581
+ return ne ? (n || window).getSelection() : null;
582
+ }
583
+ function oo(n, e) {
584
+ let t = n.getChildAtIndex(e);
585
+ t == null && (t = n), Pe(n) && b(102);
586
+ const r = (o) => {
587
+ const l = o.getParentOrThrow(), c = Pe(l), a = o !== t || c ? Ci(o) : o;
588
+ if (c) return v(o) && v(a) || b(133), o.insertAfter(a), [o, a, a];
589
+ {
590
+ const [u, h, f] = r(l), d = o.getNextSiblings();
591
+ return f.append(a, ...d), [u, h, a];
592
+ }
593
+ }, [s, i] = r(t);
594
+ return [s, i];
595
+ }
596
+ function lo(n) {
597
+ return Jt(n) && n.tagName === "A";
598
+ }
599
+ function Jt(n) {
600
+ return n.nodeType === 1;
601
+ }
602
+ function co(n) {
603
+ return n.nodeType === 11;
604
+ }
605
+ function bi(n) {
606
+ const e = new RegExp(/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var|#text)$/, "i");
607
+ return n.nodeName.match(e) !== null;
608
+ }
609
+ function hr(n) {
610
+ const e = new RegExp(/^(address|article|aside|blockquote|canvas|dd|div|dl|dt|fieldset|figcaption|figure|footer|form|h1|h2|h3|h4|h5|h6|header|hr|li|main|nav|noscript|ol|p|pre|section|table|td|tfoot|ul|video)$/, "i");
611
+ return n.nodeName.match(e) !== null;
612
+ }
613
+ function _e(n) {
614
+ if (A(n) && !n.isInline()) return !0;
615
+ if (!v(n) || Pe(n)) return !1;
616
+ const e = n.getFirstChild(), t = e === null || Ae(e) || N(e) || e.isInline();
617
+ return !n.isInline() && n.canBeEmpty() !== !1 && t;
618
+ }
619
+ function Je(n, e) {
620
+ let t = n;
621
+ for (; t !== null && t.getParent() !== null && !e(t); ) t = t.getParentOrThrow();
622
+ return e(t) ? t : null;
623
+ }
624
+ function ao() {
625
+ return M();
626
+ }
627
+ const gr = /* @__PURE__ */ new WeakMap(), wi = /* @__PURE__ */ new Map();
628
+ function Ni(n) {
629
+ if (!n._readOnly && n.isEmpty()) return wi;
630
+ n._readOnly || b(192);
631
+ let e = gr.get(n);
632
+ if (!e) {
633
+ e = /* @__PURE__ */ new Map(), gr.set(n, e);
634
+ for (const [t, r] of n._nodeMap) {
635
+ const s = r.__type;
636
+ let i = e.get(s);
637
+ i || (i = /* @__PURE__ */ new Map(), e.set(s, i)), i.set(t, r);
638
+ }
639
+ }
640
+ return e;
641
+ }
642
+ function Ei(n) {
643
+ const e = n.constructor.clone(n);
644
+ return e.afterCloneFrom(n), e;
645
+ }
646
+ function Pi(n, e) {
647
+ const t = (parseInt(n.style.paddingInlineStart, 10) || 0) / 40;
648
+ e.setIndent(t);
649
+ }
650
+ function os(n, e, t, r, s, i) {
651
+ let o = n.getFirstChild();
652
+ for (; o !== null; ) {
653
+ const l = o.__key;
654
+ o.__parent === e && (v(o) && os(o, l, t, r, s, i), t.has(l) || i.delete(l), s.push(l)), o = o.getNextSibling();
655
+ }
656
+ }
657
+ let Se, H, Ge, Ut, gn, _n, Fe, te, pn, et, B = "", j = "", re = null, ee = "", le = "", ls = !1, tt = !1, _t = null;
658
+ function Et(n, e) {
659
+ const t = Fe.get(n);
660
+ if (e !== null) {
661
+ const r = xn(n);
662
+ r.parentNode === e && e.removeChild(r);
663
+ }
664
+ if (te.has(n) || H._keyToDOMMap.delete(n), v(t)) {
665
+ const r = Ft(t, Fe);
666
+ yn(r, 0, r.length - 1, null);
667
+ }
668
+ t !== void 0 && Kn(et, Ge, Ut, t, "destroyed");
669
+ }
670
+ function yn(n, e, t, r) {
671
+ let s = e;
672
+ for (; s <= t; ++s) {
673
+ const i = n[s];
674
+ i !== void 0 && Et(i, r);
675
+ }
676
+ }
677
+ function ke(n, e) {
678
+ n.setProperty("text-align", e);
679
+ }
680
+ const Fi = "40px";
681
+ function cs(n, e) {
682
+ const t = Se.theme.indent;
683
+ if (typeof t == "string") {
684
+ const s = n.classList.contains(t);
685
+ e > 0 && !s ? n.classList.add(t) : e < 1 && s && n.classList.remove(t);
686
+ }
687
+ const r = getComputedStyle(n).getPropertyValue("--lexical-indent-base-value") || Fi;
688
+ n.style.setProperty("padding-inline-start", e === 0 ? "" : `calc(${e} * ${r})`);
689
+ }
690
+ function as(n, e) {
691
+ const t = n.style;
692
+ e === 0 ? ke(t, "") : e === Fn ? ke(t, "left") : e === Dn ? ke(t, "center") : e === Ln ? ke(t, "right") : e === On ? ke(t, "justify") : e === In ? ke(t, "start") : e === An && ke(t, "end");
693
+ }
694
+ function Pt(n, e, t) {
695
+ const r = te.get(n);
696
+ r === void 0 && b(60);
697
+ const s = r.createDOM(Se, H);
698
+ if (function(i, o, l) {
699
+ const c = l._keyToDOMMap;
700
+ o["__lexicalKey_" + l._key] = i, c.set(i, o);
701
+ }(n, s, H), N(r) ? s.setAttribute("data-lexical-text", "true") : A(r) && s.setAttribute("data-lexical-decorator", "true"), v(r)) {
702
+ const i = r.__indent, o = r.__size;
703
+ if (i !== 0 && cs(s, i), o !== 0) {
704
+ const c = o - 1;
705
+ (function(a, u, h, f) {
706
+ const d = j;
707
+ j = "", mn(a, h, 0, u, f, null), fs(h, f), j = d;
708
+ })(Ft(r, te), c, r, s);
709
+ }
710
+ const l = r.__format;
711
+ l !== 0 && as(s, l), r.isInline() || us(null, r, s), Bt(r) && (B += ae, le += ae);
712
+ } else {
713
+ const i = r.getTextContent();
714
+ if (A(r)) {
715
+ const o = r.decorate(H, Se);
716
+ o !== null && ds(n, o), s.contentEditable = "false";
717
+ } else N(r) && (r.isDirectionless() || (j += i));
718
+ B += i, le += i;
719
+ }
720
+ if (e !== null) if (t != null) e.insertBefore(s, t);
721
+ else {
722
+ const i = e.__lexicalLineBreak;
723
+ i != null ? e.insertBefore(s, i) : e.appendChild(s);
724
+ }
725
+ return Kn(et, Ge, Ut, r, "created"), s;
726
+ }
727
+ function mn(n, e, t, r, s, i) {
728
+ const o = B;
729
+ B = "";
730
+ let l = t;
731
+ for (; l <= r; ++l) {
732
+ Pt(n[l], s, i);
733
+ const c = te.get(n[l]);
734
+ c !== null && N(c) && (re === null && (re = c.getFormat()), ee === "" && (ee = c.getStyle()));
735
+ }
736
+ Bt(e) && (B += ae), s.__lexicalTextContent = B, B = o + B;
737
+ }
738
+ function _r(n, e) {
739
+ const t = e.get(n);
740
+ return Ae(t) || A(t) && t.isInline();
741
+ }
742
+ function us(n, e, t) {
743
+ const r = n !== null && (n.__size === 0 || _r(n.__last, Fe)), s = e.__size === 0 || _r(e.__last, te);
744
+ if (r) {
745
+ if (!s) {
746
+ const i = t.__lexicalLineBreak;
747
+ if (i != null) try {
748
+ t.removeChild(i);
749
+ } catch (o) {
750
+ if (typeof o == "object" && o != null) {
751
+ const l = `${o.toString()} Parent: ${t.tagName}, child: ${i.tagName}.`;
752
+ throw new Error(l);
753
+ }
754
+ throw o;
755
+ }
756
+ t.__lexicalLineBreak = null;
757
+ }
758
+ } else if (s) {
759
+ const i = document.createElement("br");
760
+ t.__lexicalLineBreak = i, t.appendChild(i);
761
+ }
762
+ }
763
+ function fs(n, e) {
764
+ const t = e.__lexicalDirTextContent, r = e.__lexicalDir;
765
+ if (t !== j || r !== _t) {
766
+ const i = j === "", o = i ? _t : (s = j, oi.test(s) ? "rtl" : li.test(s) ? "ltr" : null);
767
+ if (o !== r) {
768
+ const l = e.classList, c = Se.theme;
769
+ let a = r !== null ? c[r] : void 0, u = o !== null ? c[o] : void 0;
770
+ if (a !== void 0) {
771
+ if (typeof a == "string") {
772
+ const h = Ct(a);
773
+ a = c[r] = h;
774
+ }
775
+ l.remove(...a);
776
+ }
777
+ if (o === null || i && o === "ltr") e.removeAttribute("dir");
778
+ else {
779
+ if (u !== void 0) {
780
+ if (typeof u == "string") {
781
+ const h = Ct(u);
782
+ u = c[o] = h;
783
+ }
784
+ u !== void 0 && l.add(...u);
785
+ }
786
+ e.dir = o;
787
+ }
788
+ tt || (n.getWritable().__dir = o);
789
+ }
790
+ _t = o, e.__lexicalDirTextContent = j, e.__lexicalDir = o;
791
+ }
792
+ var s;
793
+ }
794
+ function Di(n, e, t) {
795
+ const r = j;
796
+ var s;
797
+ j = "", re = null, ee = "", function(i, o, l) {
798
+ const c = B, a = i.__size, u = o.__size;
799
+ if (B = "", a === 1 && u === 1) {
800
+ const h = i.__first, f = o.__first;
801
+ if (h === f) je(h, l);
802
+ else {
803
+ const g = xn(h), p = Pt(f, null, null);
804
+ try {
805
+ l.replaceChild(p, g);
806
+ } catch (_) {
807
+ if (typeof _ == "object" && _ != null) {
808
+ const m = `${_.toString()} Parent: ${l.tagName}, new child: {tag: ${p.tagName} key: ${f}}, old child: {tag: ${g.tagName}, key: ${h}}.`;
809
+ throw new Error(m);
810
+ }
811
+ throw _;
812
+ }
813
+ Et(h, null);
814
+ }
815
+ const d = te.get(f);
816
+ N(d) && (re === null && (re = d.getFormat()), ee === "" && (ee = d.getStyle()));
817
+ } else {
818
+ const h = Ft(i, Fe), f = Ft(o, te);
819
+ if (a === 0) u !== 0 && mn(f, o, 0, u - 1, l, null);
820
+ else if (u === 0) {
821
+ if (a !== 0) {
822
+ const d = l.__lexicalLineBreak == null;
823
+ yn(h, 0, a - 1, d ? null : l), d && (l.textContent = "");
824
+ }
825
+ } else (function(d, g, p, _, m, y) {
826
+ const S = _ - 1, k = m - 1;
827
+ let T, x, P = (D = y, D.firstChild), C = 0, E = 0;
828
+ for (var D; C <= S && E <= k; ) {
829
+ const L = g[C], U = p[E];
830
+ if (L === U) P = sn(je(U, y)), C++, E++;
831
+ else {
832
+ T === void 0 && (T = new Set(g)), x === void 0 && (x = new Set(p));
833
+ const de = x.has(L), De = T.has(U);
834
+ if (de) if (De) {
835
+ const Be = Nt(H, U);
836
+ Be === P ? P = sn(je(U, y)) : (P != null ? y.insertBefore(Be, P) : y.appendChild(Be), je(U, y)), C++, E++;
837
+ } else Pt(U, y, P), E++;
838
+ else P = sn(xn(L)), Et(L, y), C++;
839
+ }
840
+ const W = te.get(U);
841
+ W !== null && N(W) && (re === null && (re = W.getFormat()), ee === "" && (ee = W.getStyle()));
842
+ }
843
+ const O = C > S, z = E > k;
844
+ if (O && !z) {
845
+ const L = p[k + 1];
846
+ mn(p, d, E, k, y, L === void 0 ? null : H.getElementByKey(L));
847
+ } else z && !O && yn(g, C, S, y);
848
+ })(o, h, f, a, u, l);
849
+ }
850
+ Bt(o) && (B += ae), l.__lexicalTextContent = B, B = c + B;
851
+ }(n, e, t), fs(e, t), bn(s = e) && re != null && re !== s.__textFormat && !tt && (s.setTextFormat(re), s.setTextStyle(ee)), function(i) {
852
+ bn(i) && ee !== "" && ee !== i.__textStyle && !tt && i.setTextStyle(ee);
853
+ }(e), j = r;
854
+ }
855
+ function Ft(n, e) {
856
+ const t = [];
857
+ let r = n.__first;
858
+ for (; r !== null; ) {
859
+ const s = e.get(r);
860
+ s === void 0 && b(101), t.push(r), r = s.__next;
861
+ }
862
+ return t;
863
+ }
864
+ function je(n, e) {
865
+ const t = Fe.get(n);
866
+ let r = te.get(n);
867
+ t !== void 0 && r !== void 0 || b(61);
868
+ const s = ls || _n.has(n) || gn.has(n), i = Nt(H, n);
869
+ if (t === r && !s) {
870
+ if (v(t)) {
871
+ const o = i.__lexicalTextContent;
872
+ o !== void 0 && (B += o, le += o);
873
+ const l = i.__lexicalDirTextContent;
874
+ l !== void 0 && (j += l);
875
+ } else {
876
+ const o = t.getTextContent();
877
+ N(t) && !t.isDirectionless() && (j += o), le += o, B += o;
878
+ }
879
+ return i;
880
+ }
881
+ if (t !== r && s && Kn(et, Ge, Ut, r, "updated"), r.updateDOM(t, i, Se)) {
882
+ const o = Pt(n, null, null);
883
+ return e === null && b(62), e.replaceChild(o, i), Et(n, null), o;
884
+ }
885
+ if (v(t) && v(r)) {
886
+ const o = r.__indent;
887
+ o !== t.__indent && cs(i, o);
888
+ const l = r.__format;
889
+ l !== t.__format && as(i, l), s && (Di(t, r, i), Y(r) || r.isInline() || us(t, r, i)), Bt(r) && (B += ae, le += ae);
890
+ } else {
891
+ const o = r.getTextContent();
892
+ if (A(r)) {
893
+ const l = r.decorate(H, Se);
894
+ l !== null && ds(n, l);
895
+ } else N(r) && !r.isDirectionless() && (j += o);
896
+ B += o, le += o;
897
+ }
898
+ if (!tt && Y(r) && r.__cachedText !== le) {
899
+ const o = r.getWritable();
900
+ o.__cachedText = le, r = o;
901
+ }
902
+ return i;
903
+ }
904
+ function ds(n, e) {
905
+ let t = H._pendingDecorators;
906
+ const r = H._decorators;
907
+ if (t === null) {
908
+ if (r[n] === e) return;
909
+ t = es(H);
910
+ }
911
+ t[n] = e;
912
+ }
913
+ function sn(n) {
914
+ let e = n.nextSibling;
915
+ return e !== null && e === H._blockCursorElement && (e = e.nextSibling), e;
916
+ }
917
+ function Li(n, e, t, r, s, i) {
918
+ B = "", le = "", j = "", ls = r === Me, _t = null, H = t, Se = t._config, Ge = t._nodes, Ut = H._listeners.mutation, gn = s, _n = i, Fe = n._nodeMap, te = e._nodeMap, tt = e._readOnly, pn = new Map(t._keyToDOMMap);
919
+ const o = /* @__PURE__ */ new Map();
920
+ return et = o, je("root", null), H = void 0, Ge = void 0, gn = void 0, _n = void 0, Fe = void 0, te = void 0, Se = void 0, pn = void 0, et = void 0, o;
921
+ }
922
+ function xn(n) {
923
+ const e = pn.get(n);
924
+ return e === void 0 && b(75, n), e;
925
+ }
926
+ const oe = Object.freeze({}), vn = 30, Sn = [["keydown", function(n, e) {
927
+ if (Xe = n.timeStamp, hs = n.key, e.isComposing()) return;
928
+ const { key: t, shiftKey: r, ctrlKey: s, metaKey: i, altKey: o } = n;
929
+ w(e, Os, n) || t != null && (function(l, c, a, u) {
930
+ return cr(l) && !c && !u && !a;
931
+ }(t, s, o, i) ? w(e, Is, n) : function(l, c, a, u, h) {
932
+ return cr(l) && !u && !a && (c || h);
933
+ }(t, s, r, o, i) ? w(e, As, n) : function(l, c, a, u) {
934
+ return lr(l) && !c && !u && !a;
935
+ }(t, s, o, i) ? w(e, Ms, n) : function(l, c, a, u, h) {
936
+ return lr(l) && !u && !a && (c || h);
937
+ }(t, s, r, o, i) ? w(e, zs, n) : /* @__PURE__ */ function(l, c, a) {
938
+ return /* @__PURE__ */ function(u) {
939
+ return u === "ArrowUp";
940
+ }(l) && !c && !a;
941
+ }(t, s, i) ? w(e, Ws, n) : /* @__PURE__ */ function(l, c, a) {
942
+ return /* @__PURE__ */ function(u) {
943
+ return u === "ArrowDown";
944
+ }(l) && !c && !a;
945
+ }(t, s, i) ? w(e, Bs, n) : function(l, c) {
946
+ return ar(l) && c;
947
+ }(t, r) ? (Ye = !0, w(e, dn, n)) : /* @__PURE__ */ function(l) {
948
+ return l === " ";
949
+ }(t) ? w(e, Rs, n) : function(l, c) {
950
+ return G && c && l.toLowerCase() === "o";
951
+ }(t, s) ? (n.preventDefault(), Ye = !0, w(e, gt, !0)) : function(l, c) {
952
+ return ar(l) && !c;
953
+ }(t, r) ? (Ye = !1, w(e, dn, n)) : function(l, c, a, u) {
954
+ return G ? !c && !a && (Ke(l) || l.toLowerCase() === "h" && u) : !(u || c || a) && Ke(l);
955
+ }(t, o, i, s) ? Ke(t) ? w(e, Ks, n) : (n.preventDefault(), w(e, yt, !0)) : /* @__PURE__ */ function(l) {
956
+ return l === "Escape";
957
+ }(t) ? w(e, $s, n) : function(l, c, a, u, h) {
958
+ return G ? !(a || u || h) && ($e(l) || l.toLowerCase() === "d" && c) : !(c || u || h) && $e(l);
959
+ }(t, s, r, o, i) ? $e(t) ? w(e, Js, n) : (n.preventDefault(), w(e, yt, !1)) : function(l, c, a) {
960
+ return Ke(l) && (G ? c : a);
961
+ }(t, o, s) ? (n.preventDefault(), w(e, mt, !0)) : function(l, c, a) {
962
+ return $e(l) && (G ? c : a);
963
+ }(t, o, s) ? (n.preventDefault(), w(e, mt, !1)) : function(l, c) {
964
+ return G && c && Ke(l);
965
+ }(t, i) ? (n.preventDefault(), w(e, xt, !0)) : function(l, c) {
966
+ return G && c && $e(l);
967
+ }(t, i) ? (n.preventDefault(), w(e, xt, !1)) : function(l, c, a, u) {
968
+ return l.toLowerCase() === "b" && !c && Ve(a, u);
969
+ }(t, o, i, s) ? (n.preventDefault(), w(e, we, "bold")) : function(l, c, a, u) {
970
+ return l.toLowerCase() === "u" && !c && Ve(a, u);
971
+ }(t, o, i, s) ? (n.preventDefault(), w(e, we, "underline")) : function(l, c, a, u) {
972
+ return l.toLowerCase() === "i" && !c && Ve(a, u);
973
+ }(t, o, i, s) ? (n.preventDefault(), w(e, we, "italic")) : /* @__PURE__ */ function(l, c, a, u) {
974
+ return l === "Tab" && !c && !a && !u;
975
+ }(t, o, s, i) ? w(e, Us, n) : function(l, c, a, u) {
976
+ return l.toLowerCase() === "z" && !c && Ve(a, u);
977
+ }(t, r, i, s) ? (n.preventDefault(), w(e, Br, void 0)) : function(l, c, a, u) {
978
+ return G ? l.toLowerCase() === "z" && a && c : l.toLowerCase() === "y" && u || l.toLowerCase() === "z" && u && c;
979
+ }(t, r, i, s) ? (n.preventDefault(), w(e, Rr, void 0)) : Ht(e._editorState._selection) ? function(l, c, a, u) {
980
+ return !c && l.toLowerCase() === "c" && (G ? a : u);
981
+ }(t, r, i, s) ? (n.preventDefault(), w(e, Kr, n)) : function(l, c, a, u) {
982
+ return !c && l.toLowerCase() === "x" && (G ? a : u);
983
+ }(t, r, i, s) ? (n.preventDefault(), w(e, $r, n)) : ur(t, i, s) && (n.preventDefault(), w(e, Gn, n)) : !xe && ur(t, i, s) && (n.preventDefault(), w(e, Gn, n)), /* @__PURE__ */ function(l, c, a, u) {
984
+ return l || c || a || u;
985
+ }(s, r, o, i) && w(e, Ys, n));
986
+ }], ["pointerdown", function(n, e) {
987
+ const t = n.target, r = n.pointerType;
988
+ t instanceof Node && r !== "touch" && X(e, () => {
989
+ A(Wt(t)) || (Cn = !0);
990
+ });
991
+ }], ["compositionstart", function(n, e) {
992
+ X(e, () => {
993
+ const t = I();
994
+ if (F(t) && !e.isComposing()) {
995
+ const r = t.anchor, s = t.anchor.getNode();
996
+ J(r.key), (n.timeStamp < Xe + vn || r.type === "element" || !t.isCollapsed() || s.getFormat() !== t.format || N(s) && s.getStyle() !== t.style) && w(e, He, ii);
997
+ }
998
+ });
999
+ }], ["compositionend", function(n, e) {
1000
+ xe ? Ue = !0 : X(e, () => {
1001
+ on(e, n.data);
1002
+ });
1003
+ }], ["input", function(n, e) {
1004
+ n.stopPropagation(), X(e, () => {
1005
+ const t = I(), r = n.data, s = ys(n);
1006
+ if (r != null && F(t) && ps(t, s, r, n.timeStamp, !1)) {
1007
+ Ue && (on(e, r), Ue = !1);
1008
+ const i = t.anchor.getNode(), o = se(e._window);
1009
+ if (o === null) return;
1010
+ const l = t.isBackward(), c = l ? t.anchor.offset : t.focus.offset, a = l ? t.focus.offset : t.anchor.offset;
1011
+ vt && !t.isCollapsed() && N(i) && o.anchorNode !== null && i.getTextContent().slice(0, c) + r + i.getTextContent().slice(c + a) === ss(o.anchorNode) || w(e, He, r);
1012
+ const u = r.length;
1013
+ xe && u > 1 && n.inputType === "insertCompositionText" && !e.isComposing() && (t.anchor.offset -= u), Nn || It || En || !e.isComposing() || (Xe = 0, J(null));
1014
+ } else
1015
+ Bn(!1, e, r !== null ? r : void 0), Ue && (on(e, r || void 0), Ue = !1);
1016
+ q(), qr(M());
1017
+ }), Le = null;
1018
+ }], ["click", function(n, e) {
1019
+ X(e, () => {
1020
+ const t = I(), r = se(e._window), s = ot();
1021
+ if (r) {
1022
+ if (F(t)) {
1023
+ const i = t.anchor, o = i.getNode();
1024
+ i.type === "element" && i.offset === 0 && t.isCollapsed() && !Y(o) && Z().getChildrenSize() === 1 && o.getTopLevelElementOrThrow().isEmpty() && s !== null && t.is(s) ? (r.removeAllRanges(), t.dirty = !0) : n.detail === 3 && !t.isCollapsed() && o !== t.focus.getNode() && (v(o) ? o.select(0) : o.getParentOrThrow().select(0));
1025
+ } else if (n.pointerType === "touch") {
1026
+ const i = r.anchorNode;
1027
+ if (i !== null) {
1028
+ const o = i.nodeType;
1029
+ (o === rt || o === Te) && ue(qt(s, r, e, n));
1030
+ }
1031
+ }
1032
+ }
1033
+ w(e, Ls, n);
1034
+ });
1035
+ }], ["cut", oe], ["copy", oe], ["dragstart", oe], ["dragover", oe], ["dragend", oe], ["paste", oe], ["focus", oe], ["blur", oe], ["drop", oe]];
1036
+ vt && Sn.push(["beforeinput", (n, e) => function(t, r) {
1037
+ const s = t.inputType, i = ys(t);
1038
+ s === "deleteCompositionText" || xe && is(r) || s !== "insertCompositionText" && X(r, () => {
1039
+ const o = I();
1040
+ if (s === "deleteContentBackward") {
1041
+ if (o === null) {
1042
+ const d = ot();
1043
+ if (!F(d)) return;
1044
+ ue(d.clone());
1045
+ }
1046
+ if (F(o)) {
1047
+ const d = o.anchor.key === o.focus.key;
1048
+ if (l = t.timeStamp, hs === "MediaLast" && l < Xe + vn && r.isComposing() && d) {
1049
+ if (J(null), Xe = 0, setTimeout(() => {
1050
+ X(r, () => {
1051
+ J(null);
1052
+ });
1053
+ }, vn), F(o)) {
1054
+ const g = o.anchor.getNode();
1055
+ g.markDirty(), o.format = g.getFormat(), N(g) || b(142), o.style = g.getStyle();
1056
+ }
1057
+ } else {
1058
+ J(null), t.preventDefault();
1059
+ const g = o.anchor.getNode().getTextContent(), p = o.anchor.offset === 0 && o.focus.offset === g.length;
1060
+ ei && d && !p || w(r, yt, !0);
1061
+ }
1062
+ return;
1063
+ }
1064
+ }
1065
+ var l;
1066
+ if (!F(o)) return;
1067
+ const c = t.data;
1068
+ Le !== null && Bn(!1, r, Le), o.dirty && Le === null || !o.isCollapsed() || Y(o.anchor.getNode()) || i === null || o.applyDOMRange(i), Le = null;
1069
+ const a = o.anchor, u = o.focus, h = a.getNode(), f = u.getNode();
1070
+ if (s !== "insertText" && s !== "insertTranspose") switch (t.preventDefault(), s) {
1071
+ case "insertFromYank":
1072
+ case "insertFromDrop":
1073
+ case "insertReplacementText":
1074
+ w(r, He, t);
1075
+ break;
1076
+ case "insertFromComposition":
1077
+ J(null), w(r, He, t);
1078
+ break;
1079
+ case "insertLineBreak":
1080
+ J(null), w(r, gt, !1);
1081
+ break;
1082
+ case "insertParagraph":
1083
+ J(null), Ye && !It ? (Ye = !1, w(r, gt, !1)) : w(r, Yn, void 0);
1084
+ break;
1085
+ case "insertFromPaste":
1086
+ case "insertFromPasteAsQuotation":
1087
+ w(r, Wr, t);
1088
+ break;
1089
+ case "deleteByComposition":
1090
+ (function(d, g) {
1091
+ return d !== g || v(d) || v(g) || !d.isToken() || !g.isToken();
1092
+ })(h, f) && w(r, Zn, t);
1093
+ break;
1094
+ case "deleteByDrag":
1095
+ case "deleteByCut":
1096
+ w(r, Zn, t);
1097
+ break;
1098
+ case "deleteContent":
1099
+ w(r, yt, !1);
1100
+ break;
1101
+ case "deleteWordBackward":
1102
+ w(r, mt, !0);
1103
+ break;
1104
+ case "deleteWordForward":
1105
+ w(r, mt, !1);
1106
+ break;
1107
+ case "deleteHardLineBackward":
1108
+ case "deleteSoftLineBackward":
1109
+ w(r, xt, !0);
1110
+ break;
1111
+ case "deleteContentForward":
1112
+ case "deleteHardLineForward":
1113
+ case "deleteSoftLineForward":
1114
+ w(r, xt, !1);
1115
+ break;
1116
+ case "formatStrikeThrough":
1117
+ w(r, we, "strikethrough");
1118
+ break;
1119
+ case "formatBold":
1120
+ w(r, we, "bold");
1121
+ break;
1122
+ case "formatItalic":
1123
+ w(r, we, "italic");
1124
+ break;
1125
+ case "formatUnderline":
1126
+ w(r, we, "underline");
1127
+ break;
1128
+ case "historyUndo":
1129
+ w(r, Br, void 0);
1130
+ break;
1131
+ case "historyRedo":
1132
+ w(r, Rr, void 0);
1133
+ }
1134
+ else {
1135
+ if (c === `
1136
+ `) t.preventDefault(), w(r, gt, !1);
1137
+ else if (c === ae) t.preventDefault(), w(r, Yn, void 0);
1138
+ else if (c == null && t.dataTransfer) {
1139
+ const d = t.dataTransfer.getData("text/plain");
1140
+ t.preventDefault(), o.insertRawText(d);
1141
+ } else c != null && ps(o, i, c, t.timeStamp, !0) ? (t.preventDefault(), w(r, He, c)) : Le = c;
1142
+ gs = t.timeStamp;
1143
+ }
1144
+ });
1145
+ }(n, e)]);
1146
+ let Xe = 0, hs = null, gs = 0, Le = null;
1147
+ const Dt = /* @__PURE__ */ new WeakMap();
1148
+ let Tn = !1, Cn = !1, Ye = !1, Ue = !1, _s = [0, "", 0, "root", 0];
1149
+ function ps(n, e, t, r, s) {
1150
+ const i = n.anchor, o = n.focus, l = i.getNode(), c = M(), a = se(c._window), u = a !== null ? a.anchorNode : null, h = i.key, f = c.getElementByKey(h), d = t.length;
1151
+ return h !== o.key || !N(l) || (!s && (!vt || gs < r + 50) || l.isDirty() && d < 2 || ns(t)) && i.offset !== o.offset && !l.isComposing() || be(l) || l.isDirty() && d > 1 || (s || !vt) && f !== null && !l.isComposing() && u !== kt(f) || a !== null && e !== null && (!e.collapsed || e.startContainer !== a.anchorNode || e.startOffset !== a.anchorOffset) || l.getFormat() !== n.format || l.getStyle() !== n.style || Si(n, l);
1152
+ }
1153
+ function pr(n, e) {
1154
+ return n !== null && n.nodeValue !== null && n.nodeType === Te && e !== 0 && e !== n.nodeValue.length;
1155
+ }
1156
+ function yr(n, e, t) {
1157
+ const { anchorNode: r, anchorOffset: s, focusNode: i, focusOffset: o } = n;
1158
+ Tn && (Tn = !1, pr(r, s) && pr(i, o)) || X(e, () => {
1159
+ if (!t) return void ue(null);
1160
+ if (!Mt(e, r, i)) return;
1161
+ const l = I();
1162
+ if (F(l)) {
1163
+ const c = l.anchor, a = c.getNode();
1164
+ if (l.isCollapsed()) {
1165
+ n.type === "Range" && n.anchorNode === n.focusNode && (l.dirty = !0);
1166
+ const u = Kt(e).event, h = u ? u.timeStamp : performance.now(), [f, d, g, p, _] = _s, m = Z(), y = e.isComposing() === !1 && m.getTextContent() === "";
1167
+ if (h < _ + 200 && c.offset === g && c.key === p) l.format = f, l.style = d;
1168
+ else if (c.type === "text") N(a) || b(141), l.format = a.getFormat(), l.style = a.getStyle();
1169
+ else if (c.type === "element" && !y) {
1170
+ const S = c.getNode();
1171
+ l.style = "", S instanceof We && S.getChildrenSize() === 0 ? (l.format = S.getTextFormat(), l.style = S.getTextStyle()) : l.format = 0;
1172
+ }
1173
+ } else {
1174
+ const u = c.key, h = l.focus.key, f = l.getNodes(), d = f.length, g = l.isBackward(), p = g ? o : s, _ = g ? s : o, m = g ? h : u, y = g ? u : h;
1175
+ let S = si, k = !1;
1176
+ for (let T = 0; T < d; T++) {
1177
+ const x = f[T], P = x.getTextContentSize();
1178
+ if (N(x) && P !== 0 && !(T === 0 && x.__key === m && p === P || T === d - 1 && x.__key === y && _ === 0) && (k = !0, S &= x.getFormat(), S === 0)) break;
1179
+ }
1180
+ l.format = k ? S : 0;
1181
+ }
1182
+ }
1183
+ w(e, wn, void 0);
1184
+ });
1185
+ }
1186
+ function ys(n) {
1187
+ if (!n.getTargetRanges) return null;
1188
+ const e = n.getTargetRanges();
1189
+ return e.length === 0 ? null : e[0];
1190
+ }
1191
+ function on(n, e) {
1192
+ const t = n._compositionKey;
1193
+ if (J(null), t !== null && e != null) {
1194
+ if (e === "") {
1195
+ const r = V(t), s = kt(n.getElementByKey(t));
1196
+ return void (s !== null && s.nodeValue !== null && N(r) && Rn(r, s.nodeValue, null, null, !0));
1197
+ }
1198
+ if (e[e.length - 1] === `
1199
+ `) {
1200
+ const r = I();
1201
+ if (F(r)) {
1202
+ const s = r.focus;
1203
+ return r.anchor.set(s.key, s.offset, s.type), void w(n, dn, null);
1204
+ }
1205
+ }
1206
+ }
1207
+ Bn(!0, n, e);
1208
+ }
1209
+ function ms(n) {
1210
+ let e = n.__lexicalEventHandles;
1211
+ return e === void 0 && (e = [], n.__lexicalEventHandles = e), e;
1212
+ }
1213
+ const Ie = /* @__PURE__ */ new Map();
1214
+ function xs(n) {
1215
+ const e = n.target, t = se(e == null ? null : e.nodeType === 9 ? e.defaultView : e.ownerDocument.defaultView);
1216
+ if (t === null) return;
1217
+ const r = Yr(t.anchorNode);
1218
+ if (r === null) return;
1219
+ Cn && (Cn = !1, X(r, () => {
1220
+ const a = ot(), u = t.anchorNode;
1221
+ if (u === null) return;
1222
+ const h = u.nodeType;
1223
+ h !== rt && h !== Te || ue(qt(a, t, r, n));
1224
+ }));
1225
+ const s = Wn(r), i = s[s.length - 1], o = i._key, l = Ie.get(o), c = l || i;
1226
+ c !== r && yr(t, c, !1), yr(t, r, !0), r !== i ? Ie.set(o, r) : l && Ie.delete(o);
1227
+ }
1228
+ function mr(n) {
1229
+ n._lexicalHandled = !0;
1230
+ }
1231
+ function xr(n) {
1232
+ return n._lexicalHandled === !0;
1233
+ }
1234
+ function Oi(n) {
1235
+ const e = n.ownerDocument, t = Dt.get(e);
1236
+ t === void 0 && b(162);
1237
+ const r = t - 1;
1238
+ r >= 0 || b(164), Dt.set(e, r), r === 0 && e.removeEventListener("selectionchange", xs);
1239
+ const s = zt(n);
1240
+ zn(s) ? (function(o) {
1241
+ if (o._parentEditor !== null) {
1242
+ const l = Wn(o), c = l[l.length - 1]._key;
1243
+ Ie.get(c) === o && Ie.delete(c);
1244
+ } else Ie.delete(o._key);
1245
+ }(s), n.__lexicalEditor = null) : s && b(198);
1246
+ const i = ms(n);
1247
+ for (let o = 0; o < i.length; o++) i[o]();
1248
+ n.__lexicalEventHandles = [];
1249
+ }
1250
+ function kn(n, e, t) {
1251
+ q();
1252
+ const r = n.__key, s = n.getParent();
1253
+ if (s === null) return;
1254
+ const i = function(l) {
1255
+ const c = I();
1256
+ if (!F(c) || !v(l)) return c;
1257
+ const { anchor: a, focus: u } = c, h = a.getNode(), f = u.getNode();
1258
+ return Qe(h, l) && a.set(l.__key, 0, "element"), Qe(f, l) && u.set(l.__key, 0, "element"), c;
1259
+ }(n);
1260
+ let o = !1;
1261
+ if (F(i) && e) {
1262
+ const l = i.anchor, c = i.focus;
1263
+ l.key === r && (Ot(l, n, s, n.getPreviousSibling(), n.getNextSibling()), o = !0), c.key === r && (Ot(c, n, s, n.getPreviousSibling(), n.getNextSibling()), o = !0);
1264
+ } else Ht(i) && e && n.isSelected() && n.selectPrevious();
1265
+ if (F(i) && e && !o) {
1266
+ const l = n.getIndexWithinParent();
1267
+ Ne(n), Lt(i, s, l, -1);
1268
+ } else Ne(n);
1269
+ t || Pe(s) || s.canBeEmpty() || !s.isEmpty() || kn(s, e), e && Y(s) && s.isEmpty() && s.selectEnd();
1270
+ }
1271
+ class Vt {
1272
+ static getType() {
1273
+ b(64, this.name);
1274
+ }
1275
+ static clone(e) {
1276
+ b(65, this.name);
1277
+ }
1278
+ afterCloneFrom(e) {
1279
+ this.__parent = e.__parent, this.__next = e.__next, this.__prev = e.__prev;
1280
+ }
1281
+ constructor(e) {
1282
+ this.__type = this.constructor.getType(), this.__parent = null, this.__prev = null, this.__next = null, Zr(this, e);
1283
+ }
1284
+ getType() {
1285
+ return this.__type;
1286
+ }
1287
+ isInline() {
1288
+ b(137, this.constructor.name);
1289
+ }
1290
+ isAttached() {
1291
+ let e = this.__key;
1292
+ for (; e !== null; ) {
1293
+ if (e === "root") return !0;
1294
+ const t = V(e);
1295
+ if (t === null) break;
1296
+ e = t.__parent;
1297
+ }
1298
+ return !1;
1299
+ }
1300
+ isSelected(e) {
1301
+ const t = e || I();
1302
+ if (t == null) return !1;
1303
+ const r = t.getNodes().some((s) => s.__key === this.__key);
1304
+ if (N(this)) return r;
1305
+ if (F(t) && t.anchor.type === "element" && t.focus.type === "element") {
1306
+ if (t.isCollapsed()) return !1;
1307
+ const s = this.getParent();
1308
+ if (A(this) && this.isInline() && s) {
1309
+ const i = t.isBackward() ? t.focus : t.anchor, o = i.getNode();
1310
+ if (i.offset === o.getChildrenSize() && o.is(s) && o.getLastChildOrThrow().is(this)) return !1;
1311
+ }
1312
+ }
1313
+ return r;
1314
+ }
1315
+ getKey() {
1316
+ return this.__key;
1317
+ }
1318
+ getIndexWithinParent() {
1319
+ const e = this.getParent();
1320
+ if (e === null) return -1;
1321
+ let t = e.getFirstChild(), r = 0;
1322
+ for (; t !== null; ) {
1323
+ if (this.is(t)) return r;
1324
+ r++, t = t.getNextSibling();
1325
+ }
1326
+ return -1;
1327
+ }
1328
+ getParent() {
1329
+ const e = this.getLatest().__parent;
1330
+ return e === null ? null : V(e);
1331
+ }
1332
+ getParentOrThrow() {
1333
+ const e = this.getParent();
1334
+ return e === null && b(66, this.__key), e;
1335
+ }
1336
+ getTopLevelElement() {
1337
+ let e = this;
1338
+ for (; e !== null; ) {
1339
+ const t = e.getParent();
1340
+ if (Pe(t)) return v(e) || e === this && A(e) || b(194), e;
1341
+ e = t;
1342
+ }
1343
+ return null;
1344
+ }
1345
+ getTopLevelElementOrThrow() {
1346
+ const e = this.getTopLevelElement();
1347
+ return e === null && b(67, this.__key), e;
1348
+ }
1349
+ getParents() {
1350
+ const e = [];
1351
+ let t = this.getParent();
1352
+ for (; t !== null; ) e.push(t), t = t.getParent();
1353
+ return e;
1354
+ }
1355
+ getParentKeys() {
1356
+ const e = [];
1357
+ let t = this.getParent();
1358
+ for (; t !== null; ) e.push(t.__key), t = t.getParent();
1359
+ return e;
1360
+ }
1361
+ getPreviousSibling() {
1362
+ const e = this.getLatest().__prev;
1363
+ return e === null ? null : V(e);
1364
+ }
1365
+ getPreviousSiblings() {
1366
+ const e = [], t = this.getParent();
1367
+ if (t === null) return e;
1368
+ let r = t.getFirstChild();
1369
+ for (; r !== null && !r.is(this); ) e.push(r), r = r.getNextSibling();
1370
+ return e;
1371
+ }
1372
+ getNextSibling() {
1373
+ const e = this.getLatest().__next;
1374
+ return e === null ? null : V(e);
1375
+ }
1376
+ getNextSiblings() {
1377
+ const e = [];
1378
+ let t = this.getNextSibling();
1379
+ for (; t !== null; ) e.push(t), t = t.getNextSibling();
1380
+ return e;
1381
+ }
1382
+ getCommonAncestor(e) {
1383
+ const t = this.getParents(), r = e.getParents();
1384
+ v(this) && t.unshift(this), v(e) && r.unshift(e);
1385
+ const s = t.length, i = r.length;
1386
+ if (s === 0 || i === 0 || t[s - 1] !== r[i - 1]) return null;
1387
+ const o = new Set(r);
1388
+ for (let l = 0; l < s; l++) {
1389
+ const c = t[l];
1390
+ if (o.has(c)) return c;
1391
+ }
1392
+ return null;
1393
+ }
1394
+ is(e) {
1395
+ return e != null && this.__key === e.__key;
1396
+ }
1397
+ isBefore(e) {
1398
+ if (this === e) return !1;
1399
+ if (e.isParentOf(this)) return !0;
1400
+ if (this.isParentOf(e)) return !1;
1401
+ const t = this.getCommonAncestor(e);
1402
+ let r = 0, s = 0, i = this;
1403
+ for (; ; ) {
1404
+ const o = i.getParentOrThrow();
1405
+ if (o === t) {
1406
+ r = i.getIndexWithinParent();
1407
+ break;
1408
+ }
1409
+ i = o;
1410
+ }
1411
+ for (i = e; ; ) {
1412
+ const o = i.getParentOrThrow();
1413
+ if (o === t) {
1414
+ s = i.getIndexWithinParent();
1415
+ break;
1416
+ }
1417
+ i = o;
1418
+ }
1419
+ return r < s;
1420
+ }
1421
+ isParentOf(e) {
1422
+ const t = this.__key;
1423
+ if (t === e.__key) return !1;
1424
+ let r = e;
1425
+ for (; r !== null; ) {
1426
+ if (r.__key === t) return !0;
1427
+ r = r.getParent();
1428
+ }
1429
+ return !1;
1430
+ }
1431
+ getNodesBetween(e) {
1432
+ const t = this.isBefore(e), r = [], s = /* @__PURE__ */ new Set();
1433
+ let i = this;
1434
+ for (; i !== null; ) {
1435
+ const o = i.__key;
1436
+ if (s.has(o) || (s.add(o), r.push(i)), i === e) break;
1437
+ const l = v(i) ? t ? i.getFirstChild() : i.getLastChild() : null;
1438
+ if (l !== null) {
1439
+ i = l;
1440
+ continue;
1441
+ }
1442
+ const c = t ? i.getNextSibling() : i.getPreviousSibling();
1443
+ if (c !== null) {
1444
+ i = c;
1445
+ continue;
1446
+ }
1447
+ const a = i.getParentOrThrow();
1448
+ if (s.has(a.__key) || r.push(a), a === e) break;
1449
+ let u = null, h = a;
1450
+ do {
1451
+ if (h === null && b(68), u = t ? h.getNextSibling() : h.getPreviousSibling(), h = h.getParent(), h === null) break;
1452
+ u !== null || s.has(h.__key) || r.push(h);
1453
+ } while (u === null);
1454
+ i = u;
1455
+ }
1456
+ return t || r.reverse(), r;
1457
+ }
1458
+ isDirty() {
1459
+ const e = M()._dirtyLeaves;
1460
+ return e !== null && e.has(this.__key);
1461
+ }
1462
+ getLatest() {
1463
+ const e = V(this.__key);
1464
+ return e === null && b(113), e;
1465
+ }
1466
+ getWritable() {
1467
+ q();
1468
+ const e = fe(), t = M(), r = e._nodeMap, s = this.__key, i = this.getLatest(), o = t._cloneNotNeeded, l = I();
1469
+ if (l !== null && l.setCachedNodes(null), o.has(s)) return wt(i), i;
1470
+ const c = Ei(i);
1471
+ return o.add(s), wt(c), r.set(s, c), c;
1472
+ }
1473
+ getTextContent() {
1474
+ return "";
1475
+ }
1476
+ getTextContentSize() {
1477
+ return this.getTextContent().length;
1478
+ }
1479
+ createDOM(e, t) {
1480
+ b(70);
1481
+ }
1482
+ updateDOM(e, t, r) {
1483
+ b(71);
1484
+ }
1485
+ exportDOM(e) {
1486
+ return { element: this.createDOM(e._config, e) };
1487
+ }
1488
+ exportJSON() {
1489
+ b(72);
1490
+ }
1491
+ static importJSON(e) {
1492
+ b(18, this.name);
1493
+ }
1494
+ static transform() {
1495
+ return null;
1496
+ }
1497
+ remove(e) {
1498
+ kn(this, !0, e);
1499
+ }
1500
+ replace(e, t) {
1501
+ q();
1502
+ let r = I();
1503
+ r !== null && (r = r.clone()), nn(this, e);
1504
+ const s = this.getLatest(), i = this.__key, o = e.__key, l = e.getWritable(), c = this.getParentOrThrow().getWritable(), a = c.__size;
1505
+ Ne(l);
1506
+ const u = s.getPreviousSibling(), h = s.getNextSibling(), f = s.__prev, d = s.__next, g = s.__parent;
1507
+ if (kn(s, !1, !0), u === null ? c.__first = o : u.getWritable().__next = o, l.__prev = f, h === null ? c.__last = o : h.getWritable().__prev = o, l.__next = d, l.__parent = g, c.__size = a, t && (v(this) && v(l) || b(139), this.getChildren().forEach((p) => {
1508
+ l.append(p);
1509
+ })), F(r)) {
1510
+ ue(r);
1511
+ const p = r.anchor, _ = r.focus;
1512
+ p.key === i && Cr(p, l), _.key === i && Cr(_, l);
1513
+ }
1514
+ return ye() === i && J(o), l;
1515
+ }
1516
+ insertAfter(e, t = !0) {
1517
+ q(), nn(this, e);
1518
+ const r = this.getWritable(), s = e.getWritable(), i = s.getParent(), o = I();
1519
+ let l = !1, c = !1;
1520
+ if (i !== null) {
1521
+ const d = e.getIndexWithinParent();
1522
+ if (Ne(s), F(o)) {
1523
+ const g = i.__key, p = o.anchor, _ = o.focus;
1524
+ l = p.type === "element" && p.key === g && p.offset === d + 1, c = _.type === "element" && _.key === g && _.offset === d + 1;
1525
+ }
1526
+ }
1527
+ const a = this.getNextSibling(), u = this.getParentOrThrow().getWritable(), h = s.__key, f = r.__next;
1528
+ if (a === null ? u.__last = h : a.getWritable().__prev = h, u.__size++, r.__next = h, s.__next = f, s.__prev = r.__key, s.__parent = r.__parent, t && F(o)) {
1529
+ const d = this.getIndexWithinParent();
1530
+ Lt(o, u, d + 1);
1531
+ const g = u.__key;
1532
+ l && o.anchor.set(g, d + 2, "element"), c && o.focus.set(g, d + 2, "element");
1533
+ }
1534
+ return e;
1535
+ }
1536
+ insertBefore(e, t = !0) {
1537
+ q(), nn(this, e);
1538
+ const r = this.getWritable(), s = e.getWritable(), i = s.__key;
1539
+ Ne(s);
1540
+ const o = this.getPreviousSibling(), l = this.getParentOrThrow().getWritable(), c = r.__prev, a = this.getIndexWithinParent();
1541
+ o === null ? l.__first = i : o.getWritable().__next = i, l.__size++, r.__prev = i, s.__prev = c, s.__next = r.__key, s.__parent = r.__parent;
1542
+ const u = I();
1543
+ return t && F(u) && Lt(u, this.getParentOrThrow(), a), e;
1544
+ }
1545
+ isParentRequired() {
1546
+ return !1;
1547
+ }
1548
+ createParentElementNode() {
1549
+ return ve();
1550
+ }
1551
+ selectStart() {
1552
+ return this.selectPrevious();
1553
+ }
1554
+ selectEnd() {
1555
+ return this.selectNext(0, 0);
1556
+ }
1557
+ selectPrevious(e, t) {
1558
+ q();
1559
+ const r = this.getPreviousSibling(), s = this.getParentOrThrow();
1560
+ if (r === null) return s.select(0, 0);
1561
+ if (v(r)) return r.select();
1562
+ if (!N(r)) {
1563
+ const i = r.getIndexWithinParent() + 1;
1564
+ return s.select(i, i);
1565
+ }
1566
+ return r.select(e, t);
1567
+ }
1568
+ selectNext(e, t) {
1569
+ q();
1570
+ const r = this.getNextSibling(), s = this.getParentOrThrow();
1571
+ if (r === null) return s.select();
1572
+ if (v(r)) return r.select(0, 0);
1573
+ if (!N(r)) {
1574
+ const i = r.getIndexWithinParent();
1575
+ return s.select(i, i);
1576
+ }
1577
+ return r.select(e, t);
1578
+ }
1579
+ markDirty() {
1580
+ this.getWritable();
1581
+ }
1582
+ }
1583
+ class st extends Vt {
1584
+ static getType() {
1585
+ return "linebreak";
1586
+ }
1587
+ static clone(e) {
1588
+ return new st(e.__key);
1589
+ }
1590
+ constructor(e) {
1591
+ super(e);
1592
+ }
1593
+ getTextContent() {
1594
+ return `
1595
+ `;
1596
+ }
1597
+ createDOM() {
1598
+ return document.createElement("br");
1599
+ }
1600
+ updateDOM() {
1601
+ return !1;
1602
+ }
1603
+ static importDOM() {
1604
+ return { br: (e) => function(t) {
1605
+ const r = t.parentElement;
1606
+ if (r !== null && hr(r)) {
1607
+ const s = r.firstChild;
1608
+ if (s === t || s.nextSibling === t && dt(s)) {
1609
+ const i = r.lastChild;
1610
+ if (i === t || i.previousSibling === t && dt(i)) return !0;
1611
+ }
1612
+ }
1613
+ return !1;
1614
+ }(e) || function(t) {
1615
+ const r = t.parentElement;
1616
+ if (r !== null && hr(r)) {
1617
+ const s = r.firstChild;
1618
+ if (s === t || s.nextSibling === t && dt(s)) return !1;
1619
+ const i = r.lastChild;
1620
+ if (i === t || i.previousSibling === t && dt(i)) return !0;
1621
+ }
1622
+ return !1;
1623
+ }(e) ? null : { conversion: Ii, priority: 0 } };
1624
+ }
1625
+ static importJSON(e) {
1626
+ return nt();
1627
+ }
1628
+ exportJSON() {
1629
+ return { type: "linebreak", version: 1 };
1630
+ }
1631
+ }
1632
+ function Ii(n) {
1633
+ return { node: nt() };
1634
+ }
1635
+ function nt() {
1636
+ return $t(new st());
1637
+ }
1638
+ function Ae(n) {
1639
+ return n instanceof st;
1640
+ }
1641
+ function dt(n) {
1642
+ return n.nodeType === Te && /^( |\t|\r?\n)+$/.test(n.textContent || "");
1643
+ }
1644
+ function ln(n, e) {
1645
+ return 16 & e ? "code" : e & Pn ? "mark" : 32 & e ? "sub" : 64 & e ? "sup" : null;
1646
+ }
1647
+ function cn(n, e) {
1648
+ return 1 & e ? "strong" : 2 & e ? "em" : "span";
1649
+ }
1650
+ function vs(n, e, t, r, s) {
1651
+ const i = r.classList;
1652
+ let o = qe(s, "base");
1653
+ o !== void 0 && i.add(...o), o = qe(s, "underlineStrikethrough");
1654
+ let l = !1;
1655
+ const c = e & Tt && e & St;
1656
+ o !== void 0 && (t & Tt && t & St ? (l = !0, c || i.add(...o)) : c && i.remove(...o));
1657
+ for (const a in ce) {
1658
+ const u = ce[a];
1659
+ if (o = qe(s, a), o !== void 0) if (t & u) {
1660
+ if (l && (a === "underline" || a === "strikethrough")) {
1661
+ e & u && i.remove(...o);
1662
+ continue;
1663
+ }
1664
+ e & u && (!c || a !== "underline") && a !== "strikethrough" || i.add(...o);
1665
+ } else e & u && i.remove(...o);
1666
+ }
1667
+ }
1668
+ function Ss(n, e, t) {
1669
+ const r = e.firstChild, s = t.isComposing(), i = n + (s ? At : "");
1670
+ if (r == null) e.textContent = i;
1671
+ else {
1672
+ const o = r.nodeValue;
1673
+ if (o !== i) if (s || xe) {
1674
+ const [l, c, a] = function(u, h) {
1675
+ const f = u.length, d = h.length;
1676
+ let g = 0, p = 0;
1677
+ for (; g < f && g < d && u[g] === h[g]; ) g++;
1678
+ for (; p + g < f && p + g < d && u[f - p - 1] === h[d - p - 1]; ) p++;
1679
+ return [g, f - g - p, h.slice(g, d - p)];
1680
+ }(o, i);
1681
+ c !== 0 && r.deleteData(l, c), r.insertData(l, a);
1682
+ } else r.nodeValue = i;
1683
+ }
1684
+ }
1685
+ function vr(n, e, t, r, s, i) {
1686
+ Ss(s, n, e);
1687
+ const o = i.theme.text;
1688
+ o !== void 0 && vs(0, 0, r, n, o);
1689
+ }
1690
+ function ht(n, e) {
1691
+ const t = document.createElement(e);
1692
+ return t.appendChild(n), t;
1693
+ }
1694
+ class ze extends Vt {
1695
+ static getType() {
1696
+ return "text";
1697
+ }
1698
+ static clone(e) {
1699
+ return new ze(e.__text, e.__key);
1700
+ }
1701
+ afterCloneFrom(e) {
1702
+ super.afterCloneFrom(e), this.__format = e.__format, this.__style = e.__style, this.__mode = e.__mode, this.__detail = e.__detail;
1703
+ }
1704
+ constructor(e, t) {
1705
+ super(t), this.__text = e, this.__format = 0, this.__style = "", this.__mode = 0, this.__detail = 0;
1706
+ }
1707
+ getFormat() {
1708
+ return this.getLatest().__format;
1709
+ }
1710
+ getDetail() {
1711
+ return this.getLatest().__detail;
1712
+ }
1713
+ getMode() {
1714
+ const e = this.getLatest();
1715
+ return fi[e.__mode];
1716
+ }
1717
+ getStyle() {
1718
+ return this.getLatest().__style;
1719
+ }
1720
+ isToken() {
1721
+ return this.getLatest().__mode === 1;
1722
+ }
1723
+ isComposing() {
1724
+ return this.__key === ye();
1725
+ }
1726
+ isSegmented() {
1727
+ return this.getLatest().__mode === 2;
1728
+ }
1729
+ isDirectionless() {
1730
+ return !!(1 & this.getLatest().__detail);
1731
+ }
1732
+ isUnmergeable() {
1733
+ return !!(2 & this.getLatest().__detail);
1734
+ }
1735
+ hasFormat(e) {
1736
+ const t = ce[e];
1737
+ return !!(this.getFormat() & t);
1738
+ }
1739
+ isSimpleText() {
1740
+ return this.__type === "text" && this.__mode === 0;
1741
+ }
1742
+ getTextContent() {
1743
+ return this.getLatest().__text;
1744
+ }
1745
+ getFormatFlags(e, t) {
1746
+ return bt(this.getLatest().__format, e, t);
1747
+ }
1748
+ canHaveFormat() {
1749
+ return !0;
1750
+ }
1751
+ createDOM(e, t) {
1752
+ const r = this.__format, s = ln(0, r), i = cn(0, r), o = s === null ? i : s, l = document.createElement(o);
1753
+ let c = l;
1754
+ this.hasFormat("code") && l.setAttribute("spellcheck", "false"), s !== null && (c = document.createElement(i), l.appendChild(c)), vr(c, this, 0, r, this.__text, e);
1755
+ const a = this.__style;
1756
+ return a !== "" && (l.style.cssText = a), l;
1757
+ }
1758
+ updateDOM(e, t, r) {
1759
+ const s = this.__text, i = e.__format, o = this.__format, l = ln(0, i), c = ln(0, o), a = cn(0, i), u = cn(0, o);
1760
+ if ((l === null ? a : l) !== (c === null ? u : c)) return !0;
1761
+ if (l === c && a !== u) {
1762
+ const p = t.firstChild;
1763
+ p == null && b(48);
1764
+ const _ = document.createElement(u);
1765
+ return vr(_, this, 0, o, s, r), t.replaceChild(_, p), !1;
1766
+ }
1767
+ let h = t;
1768
+ c !== null && l !== null && (h = t.firstChild, h == null && b(49)), Ss(s, h, this);
1769
+ const f = r.theme.text;
1770
+ f !== void 0 && i !== o && vs(0, i, o, h, f);
1771
+ const d = e.__style, g = this.__style;
1772
+ return d !== g && (t.style.cssText = g), !1;
1773
+ }
1774
+ static importDOM() {
1775
+ return { "#text": () => ({ conversion: Wi, priority: 0 }), b: () => ({ conversion: Mi, priority: 0 }), code: () => ({ conversion: ge, priority: 0 }), em: () => ({ conversion: ge, priority: 0 }), i: () => ({ conversion: ge, priority: 0 }), s: () => ({ conversion: ge, priority: 0 }), span: () => ({ conversion: Ai, priority: 0 }), strong: () => ({ conversion: ge, priority: 0 }), sub: () => ({ conversion: ge, priority: 0 }), sup: () => ({ conversion: ge, priority: 0 }), u: () => ({ conversion: ge, priority: 0 }) };
1776
+ }
1777
+ static importJSON(e) {
1778
+ const t = $(e.text);
1779
+ return t.setFormat(e.format), t.setDetail(e.detail), t.setMode(e.mode), t.setStyle(e.style), t;
1780
+ }
1781
+ exportDOM(e) {
1782
+ let { element: t } = super.exportDOM(e);
1783
+ return t !== null && Jt(t) || b(132), t.style.whiteSpace = "pre-wrap", this.hasFormat("bold") && (t = ht(t, "b")), this.hasFormat("italic") && (t = ht(t, "i")), this.hasFormat("strikethrough") && (t = ht(t, "s")), this.hasFormat("underline") && (t = ht(t, "u")), { element: t };
1784
+ }
1785
+ exportJSON() {
1786
+ return { detail: this.getDetail(), format: this.getFormat(), mode: this.getMode(), style: this.getStyle(), text: this.getTextContent(), type: "text", version: 1 };
1787
+ }
1788
+ selectionTransform(e, t) {
1789
+ }
1790
+ setFormat(e) {
1791
+ const t = this.getWritable();
1792
+ return t.__format = typeof e == "string" ? ce[e] : e, t;
1793
+ }
1794
+ setDetail(e) {
1795
+ const t = this.getWritable();
1796
+ return t.__detail = typeof e == "string" ? ci[e] : e, t;
1797
+ }
1798
+ setStyle(e) {
1799
+ const t = this.getWritable();
1800
+ return t.__style = e, t;
1801
+ }
1802
+ toggleFormat(e) {
1803
+ const t = bt(this.getFormat(), e, null);
1804
+ return this.setFormat(t);
1805
+ }
1806
+ toggleDirectionless() {
1807
+ const e = this.getWritable();
1808
+ return e.__detail ^= 1, e;
1809
+ }
1810
+ toggleUnmergeable() {
1811
+ const e = this.getWritable();
1812
+ return e.__detail ^= 2, e;
1813
+ }
1814
+ setMode(e) {
1815
+ const t = ui[e];
1816
+ if (this.__mode === t) return this;
1817
+ const r = this.getWritable();
1818
+ return r.__mode = t, r;
1819
+ }
1820
+ setTextContent(e) {
1821
+ if (this.__text === e) return this;
1822
+ const t = this.getWritable();
1823
+ return t.__text = e, t;
1824
+ }
1825
+ select(e, t) {
1826
+ q();
1827
+ let r = e, s = t;
1828
+ const i = I(), o = this.getTextContent(), l = this.__key;
1829
+ if (typeof o == "string") {
1830
+ const c = o.length;
1831
+ r === void 0 && (r = c), s === void 0 && (s = c);
1832
+ } else r = 0, s = 0;
1833
+ if (!F(i)) return ks(l, r, l, s, "text", "text");
1834
+ {
1835
+ const c = ye();
1836
+ c !== i.anchor.key && c !== i.focus.key || J(l), i.setTextNodeRange(this, r, this, s);
1837
+ }
1838
+ return i;
1839
+ }
1840
+ selectStart() {
1841
+ return this.select(0, 0);
1842
+ }
1843
+ selectEnd() {
1844
+ const e = this.getTextContentSize();
1845
+ return this.select(e, e);
1846
+ }
1847
+ spliceText(e, t, r, s) {
1848
+ const i = this.getWritable(), o = i.__text, l = r.length;
1849
+ let c = e;
1850
+ c < 0 && (c = l + c, c < 0 && (c = 0));
1851
+ const a = I();
1852
+ if (s && F(a)) {
1853
+ const h = e + l;
1854
+ a.setTextNodeRange(i, h, i, h);
1855
+ }
1856
+ const u = o.slice(0, c) + r + o.slice(c + t);
1857
+ return i.__text = u, i;
1858
+ }
1859
+ canInsertTextBefore() {
1860
+ return !0;
1861
+ }
1862
+ canInsertTextAfter() {
1863
+ return !0;
1864
+ }
1865
+ splitText(...e) {
1866
+ q();
1867
+ const t = this.getLatest(), r = t.getTextContent(), s = t.__key, i = ye(), o = new Set(e), l = [], c = r.length;
1868
+ let a = "";
1869
+ for (let T = 0; T < c; T++) a !== "" && o.has(T) && (l.push(a), a = ""), a += r[T];
1870
+ a !== "" && l.push(a);
1871
+ const u = l.length;
1872
+ if (u === 0) return [];
1873
+ if (l[0] === r) return [t];
1874
+ const h = l[0], f = t.getParent();
1875
+ let d;
1876
+ const g = t.getFormat(), p = t.getStyle(), _ = t.__detail;
1877
+ let m = !1;
1878
+ t.isSegmented() ? (d = $(h), d.__format = g, d.__style = p, d.__detail = _, m = !0) : (d = t.getWritable(), d.__text = h);
1879
+ const y = I(), S = [d];
1880
+ let k = h.length;
1881
+ for (let T = 1; T < u; T++) {
1882
+ const x = l[T], P = x.length, C = $(x).getWritable();
1883
+ C.__format = g, C.__style = p, C.__detail = _;
1884
+ const E = C.__key, D = k + P;
1885
+ if (F(y)) {
1886
+ const O = y.anchor, z = y.focus;
1887
+ O.key === s && O.type === "text" && O.offset > k && O.offset <= D && (O.key = E, O.offset -= k, y.dirty = !0), z.key === s && z.type === "text" && z.offset > k && z.offset <= D && (z.key = E, z.offset -= k, y.dirty = !0);
1888
+ }
1889
+ i === s && J(E), k = D, S.push(C);
1890
+ }
1891
+ if (f !== null) {
1892
+ (function(P) {
1893
+ const C = P.getPreviousSibling(), E = P.getNextSibling();
1894
+ C !== null && wt(C), E !== null && wt(E);
1895
+ })(this);
1896
+ const T = f.getWritable(), x = this.getIndexWithinParent();
1897
+ m ? (T.splice(x, 0, S), this.remove()) : T.splice(x, 1, S), F(y) && Lt(y, f, x, u - 1);
1898
+ }
1899
+ return S;
1900
+ }
1901
+ mergeWithSibling(e) {
1902
+ const t = e === this.getPreviousSibling();
1903
+ t || e === this.getNextSibling() || b(50);
1904
+ const r = this.__key, s = e.__key, i = this.__text, o = i.length;
1905
+ ye() === s && J(r);
1906
+ const l = I();
1907
+ if (F(l)) {
1908
+ const h = l.anchor, f = l.focus;
1909
+ h !== null && h.key === s && (Dr(h, t, r, e, o), l.dirty = !0), f !== null && f.key === s && (Dr(f, t, r, e, o), l.dirty = !0);
1910
+ }
1911
+ const c = e.__text, a = t ? c + i : i + c;
1912
+ this.setTextContent(a);
1913
+ const u = this.getWritable();
1914
+ return e.remove(), u;
1915
+ }
1916
+ isTextEntity() {
1917
+ return !1;
1918
+ }
1919
+ }
1920
+ function Ai(n) {
1921
+ return { forChild: Jn(n.style), node: null };
1922
+ }
1923
+ function Mi(n) {
1924
+ const e = n, t = e.style.fontWeight === "normal";
1925
+ return { forChild: Jn(e.style, t ? void 0 : "bold"), node: null };
1926
+ }
1927
+ const Sr = /* @__PURE__ */ new WeakMap();
1928
+ function zi(n) {
1929
+ return n.nodeName === "PRE" || n.nodeType === rt && n.style !== void 0 && n.style.whiteSpace !== void 0 && n.style.whiteSpace.startsWith("pre");
1930
+ }
1931
+ function Wi(n) {
1932
+ const e = n;
1933
+ n.parentElement === null && b(129);
1934
+ let t = e.textContent || "";
1935
+ if (function(r) {
1936
+ let s, i = r.parentNode;
1937
+ const o = [r];
1938
+ for (; i !== null && (s = Sr.get(i)) === void 0 && !zi(i); ) o.push(i), i = i.parentNode;
1939
+ const l = s === void 0 ? i : s;
1940
+ for (let c = 0; c < o.length; c++) Sr.set(o[c], l);
1941
+ return l;
1942
+ }(e) !== null) {
1943
+ const r = t.split(/(\r?\n|\t)/), s = [], i = r.length;
1944
+ for (let o = 0; o < i; o++) {
1945
+ const l = r[o];
1946
+ l === `
1947
+ ` || l === `\r
1948
+ ` ? s.push(nt()) : l === " " ? s.push(Un()) : l !== "" && s.push($(l));
1949
+ }
1950
+ return { node: s };
1951
+ }
1952
+ if (t = t.replace(/\r/g, "").replace(/[ \t\n]+/g, " "), t === "") return { node: null };
1953
+ if (t[0] === " ") {
1954
+ let r = e, s = !0;
1955
+ for (; r !== null && (r = Tr(r, !1)) !== null; ) {
1956
+ const i = r.textContent || "";
1957
+ if (i.length > 0) {
1958
+ /[ \t\n]$/.test(i) && (t = t.slice(1)), s = !1;
1959
+ break;
1960
+ }
1961
+ }
1962
+ s && (t = t.slice(1));
1963
+ }
1964
+ if (t[t.length - 1] === " ") {
1965
+ let r = e, s = !0;
1966
+ for (; r !== null && (r = Tr(r, !0)) !== null; )
1967
+ if ((r.textContent || "").replace(/^( |\t|\r?\n)+/, "").length > 0) {
1968
+ s = !1;
1969
+ break;
1970
+ }
1971
+ s && (t = t.slice(0, t.length - 1));
1972
+ }
1973
+ return t === "" ? { node: null } : { node: $(t) };
1974
+ }
1975
+ function Tr(n, e) {
1976
+ let t = n;
1977
+ for (; ; ) {
1978
+ let r;
1979
+ for (; (r = e ? t.nextSibling : t.previousSibling) === null; ) {
1980
+ const i = t.parentElement;
1981
+ if (i === null) return null;
1982
+ t = i;
1983
+ }
1984
+ if (t = r, t.nodeType === rt) {
1985
+ const i = t.style.display;
1986
+ if (i === "" && !bi(t) || i !== "" && !i.startsWith("inline")) return null;
1987
+ }
1988
+ let s = t;
1989
+ for (; (s = e ? t.firstChild : t.lastChild) !== null; ) t = s;
1990
+ if (t.nodeType === Te) return t;
1991
+ if (t.nodeName === "BR") return null;
1992
+ }
1993
+ }
1994
+ const Bi = { code: "code", em: "italic", i: "italic", s: "strikethrough", strong: "bold", sub: "subscript", sup: "superscript", u: "underline" };
1995
+ function ge(n) {
1996
+ const e = Bi[n.nodeName.toLowerCase()];
1997
+ return e === void 0 ? { node: null } : { forChild: Jn(n.style, e), node: null };
1998
+ }
1999
+ function $(n = "") {
2000
+ return $t(new ze(n));
2001
+ }
2002
+ function N(n) {
2003
+ return n instanceof ze;
2004
+ }
2005
+ function Jn(n, e) {
2006
+ const t = n.fontWeight, r = n.textDecoration.split(" "), s = t === "700" || t === "bold", i = r.includes("line-through"), o = n.fontStyle === "italic", l = r.includes("underline"), c = n.verticalAlign;
2007
+ return (a) => (N(a) && (s && !a.hasFormat("bold") && a.toggleFormat("bold"), i && !a.hasFormat("strikethrough") && a.toggleFormat("strikethrough"), o && !a.hasFormat("italic") && a.toggleFormat("italic"), l && !a.hasFormat("underline") && a.toggleFormat("underline"), c !== "sub" || a.hasFormat("subscript") || a.toggleFormat("subscript"), c !== "super" || a.hasFormat("superscript") || a.toggleFormat("superscript"), e && !a.hasFormat(e) && a.toggleFormat(e)), a);
2008
+ }
2009
+ class it extends ze {
2010
+ static getType() {
2011
+ return "tab";
2012
+ }
2013
+ static clone(e) {
2014
+ return new it(e.__key);
2015
+ }
2016
+ afterCloneFrom(e) {
2017
+ super.afterCloneFrom(e), this.__text = e.__text;
2018
+ }
2019
+ constructor(e) {
2020
+ super(" ", e), this.__detail = 2;
2021
+ }
2022
+ static importDOM() {
2023
+ return null;
2024
+ }
2025
+ static importJSON(e) {
2026
+ const t = Un();
2027
+ return t.setFormat(e.format), t.setStyle(e.style), t;
2028
+ }
2029
+ exportJSON() {
2030
+ return { ...super.exportJSON(), type: "tab", version: 1 };
2031
+ }
2032
+ setTextContent(e) {
2033
+ b(126);
2034
+ }
2035
+ setDetail(e) {
2036
+ b(127);
2037
+ }
2038
+ setMode(e) {
2039
+ b(128);
2040
+ }
2041
+ canInsertTextBefore() {
2042
+ return !1;
2043
+ }
2044
+ canInsertTextAfter() {
2045
+ return !1;
2046
+ }
2047
+ }
2048
+ function Un() {
2049
+ return $t(new it());
2050
+ }
2051
+ function Ri(n) {
2052
+ return n instanceof it;
2053
+ }
2054
+ class Ki {
2055
+ constructor(e, t, r) {
2056
+ this._selection = null, this.key = e, this.offset = t, this.type = r;
2057
+ }
2058
+ is(e) {
2059
+ return this.key === e.key && this.offset === e.offset && this.type === e.type;
2060
+ }
2061
+ isBefore(e) {
2062
+ let t = this.getNode(), r = e.getNode();
2063
+ const s = this.offset, i = e.offset;
2064
+ if (v(t)) {
2065
+ const o = t.getDescendantByIndex(s);
2066
+ t = o ?? t;
2067
+ }
2068
+ if (v(r)) {
2069
+ const o = r.getDescendantByIndex(i);
2070
+ r = o ?? r;
2071
+ }
2072
+ return t === r ? s < i : t.isBefore(r);
2073
+ }
2074
+ getNode() {
2075
+ const e = V(this.key);
2076
+ return e === null && b(20), e;
2077
+ }
2078
+ set(e, t, r) {
2079
+ const s = this._selection, i = this.key;
2080
+ this.key = e, this.offset = t, this.type = r, lt() || (ye() === i && J(e), s !== null && (s.setCachedNodes(null), s.dirty = !0));
2081
+ }
2082
+ }
2083
+ function ie(n, e, t) {
2084
+ return new Ki(n, e, t);
2085
+ }
2086
+ function an(n, e) {
2087
+ let t = e.__key, r = n.offset, s = "element";
2088
+ if (N(e)) {
2089
+ s = "text";
2090
+ const i = e.getTextContentSize();
2091
+ r > i && (r = i);
2092
+ } else if (!v(e)) {
2093
+ const i = e.getNextSibling();
2094
+ if (N(i)) t = i.__key, r = 0, s = "text";
2095
+ else {
2096
+ const o = e.getParent();
2097
+ o && (t = o.__key, r = e.getIndexWithinParent() + 1);
2098
+ }
2099
+ }
2100
+ n.set(t, r, s);
2101
+ }
2102
+ function Cr(n, e) {
2103
+ if (v(e)) {
2104
+ const t = e.getLastDescendant();
2105
+ v(t) || N(t) ? an(n, t) : an(n, e);
2106
+ } else an(n, e);
2107
+ }
2108
+ function pe(n, e, t, r) {
2109
+ n.key = e, n.offset = t, n.type = r;
2110
+ }
2111
+ class jt {
2112
+ constructor(e) {
2113
+ this._cachedNodes = null, this._nodes = e, this.dirty = !1;
2114
+ }
2115
+ getCachedNodes() {
2116
+ return this._cachedNodes;
2117
+ }
2118
+ setCachedNodes(e) {
2119
+ this._cachedNodes = e;
2120
+ }
2121
+ is(e) {
2122
+ if (!Ht(e)) return !1;
2123
+ const t = this._nodes, r = e._nodes;
2124
+ return t.size === r.size && Array.from(t).every((s) => r.has(s));
2125
+ }
2126
+ isCollapsed() {
2127
+ return !1;
2128
+ }
2129
+ isBackward() {
2130
+ return !1;
2131
+ }
2132
+ getStartEndPoints() {
2133
+ return null;
2134
+ }
2135
+ add(e) {
2136
+ this.dirty = !0, this._nodes.add(e), this._cachedNodes = null;
2137
+ }
2138
+ delete(e) {
2139
+ this.dirty = !0, this._nodes.delete(e), this._cachedNodes = null;
2140
+ }
2141
+ clear() {
2142
+ this.dirty = !0, this._nodes.clear(), this._cachedNodes = null;
2143
+ }
2144
+ has(e) {
2145
+ return this._nodes.has(e);
2146
+ }
2147
+ clone() {
2148
+ return new jt(new Set(this._nodes));
2149
+ }
2150
+ extract() {
2151
+ return this.getNodes();
2152
+ }
2153
+ insertRawText(e) {
2154
+ }
2155
+ insertText() {
2156
+ }
2157
+ insertNodes(e) {
2158
+ const t = this.getNodes(), r = t.length, s = t[r - 1];
2159
+ let i;
2160
+ if (N(s)) i = s.select();
2161
+ else {
2162
+ const o = s.getIndexWithinParent() + 1;
2163
+ i = s.getParentOrThrow().select(o, o);
2164
+ }
2165
+ i.insertNodes(e);
2166
+ for (let o = 0; o < r; o++) t[o].remove();
2167
+ }
2168
+ getNodes() {
2169
+ const e = this._cachedNodes;
2170
+ if (e !== null) return e;
2171
+ const t = this._nodes, r = [];
2172
+ for (const s of t) {
2173
+ const i = V(s);
2174
+ i !== null && r.push(i);
2175
+ }
2176
+ return lt() || (this._cachedNodes = r), r;
2177
+ }
2178
+ getTextContent() {
2179
+ const e = this.getNodes();
2180
+ let t = "";
2181
+ for (let r = 0; r < e.length; r++) t += e[r].getTextContent();
2182
+ return t;
2183
+ }
2184
+ }
2185
+ function F(n) {
2186
+ return n instanceof Ce;
2187
+ }
2188
+ class Ce {
2189
+ constructor(e, t, r, s) {
2190
+ this.anchor = e, this.focus = t, e._selection = this, t._selection = this, this._cachedNodes = null, this.format = r, this.style = s, this.dirty = !1;
2191
+ }
2192
+ getCachedNodes() {
2193
+ return this._cachedNodes;
2194
+ }
2195
+ setCachedNodes(e) {
2196
+ this._cachedNodes = e;
2197
+ }
2198
+ is(e) {
2199
+ return !!F(e) && this.anchor.is(e.anchor) && this.focus.is(e.focus) && this.format === e.format && this.style === e.style;
2200
+ }
2201
+ isCollapsed() {
2202
+ return this.anchor.is(this.focus);
2203
+ }
2204
+ getNodes() {
2205
+ const e = this._cachedNodes;
2206
+ if (e !== null) return e;
2207
+ const t = this.anchor, r = this.focus, s = t.isBefore(r), i = s ? t : r, o = s ? r : t;
2208
+ let l = i.getNode(), c = o.getNode();
2209
+ const a = i.offset, u = o.offset;
2210
+ if (v(l)) {
2211
+ const f = l.getDescendantByIndex(a);
2212
+ l = f ?? l;
2213
+ }
2214
+ if (v(c)) {
2215
+ let f = c.getDescendantByIndex(u);
2216
+ f !== null && f !== l && c.getChildAtIndex(u) === f && (f = f.getPreviousSibling()), c = f ?? c;
2217
+ }
2218
+ let h;
2219
+ return h = l.is(c) ? v(l) && l.getChildrenSize() > 0 ? [] : [l] : l.getNodesBetween(c), lt() || (this._cachedNodes = h), h;
2220
+ }
2221
+ setTextNodeRange(e, t, r, s) {
2222
+ pe(this.anchor, e.__key, t, "text"), pe(this.focus, r.__key, s, "text"), this._cachedNodes = null, this.dirty = !0;
2223
+ }
2224
+ getTextContent() {
2225
+ const e = this.getNodes();
2226
+ if (e.length === 0) return "";
2227
+ const t = e[0], r = e[e.length - 1], s = this.anchor, i = this.focus, o = s.isBefore(i), [l, c] = br(this);
2228
+ let a = "", u = !0;
2229
+ for (let h = 0; h < e.length; h++) {
2230
+ const f = e[h];
2231
+ if (v(f) && !f.isInline()) u || (a += `
2232
+ `), u = !f.isEmpty();
2233
+ else if (u = !1, N(f)) {
2234
+ let d = f.getTextContent();
2235
+ f === t ? f === r ? s.type === "element" && i.type === "element" && i.offset !== s.offset || (d = l < c ? d.slice(l, c) : d.slice(c, l)) : d = o ? d.slice(l) : d.slice(c) : f === r && (d = o ? d.slice(0, c) : d.slice(0, l)), a += d;
2236
+ } else !A(f) && !Ae(f) || f === r && this.isCollapsed() || (a += f.getTextContent());
2237
+ }
2238
+ return a;
2239
+ }
2240
+ applyDOMRange(e) {
2241
+ const t = M(), r = t.getEditorState()._selection, s = Cs(e.startContainer, e.startOffset, e.endContainer, e.endOffset, t, r);
2242
+ if (s === null) return;
2243
+ const [i, o] = s;
2244
+ pe(this.anchor, i.key, i.offset, i.type), pe(this.focus, o.key, o.offset, o.type), this._cachedNodes = null;
2245
+ }
2246
+ clone() {
2247
+ const e = this.anchor, t = this.focus;
2248
+ return new Ce(ie(e.key, e.offset, e.type), ie(t.key, t.offset, t.type), this.format, this.style);
2249
+ }
2250
+ toggleFormat(e) {
2251
+ this.format = bt(this.format, e, null), this.dirty = !0;
2252
+ }
2253
+ setStyle(e) {
2254
+ this.style = e, this.dirty = !0;
2255
+ }
2256
+ hasFormat(e) {
2257
+ const t = ce[e];
2258
+ return !!(this.format & t);
2259
+ }
2260
+ insertRawText(e) {
2261
+ const t = e.split(/(\r?\n|\t)/), r = [], s = t.length;
2262
+ for (let i = 0; i < s; i++) {
2263
+ const o = t[i];
2264
+ o === `
2265
+ ` || o === `\r
2266
+ ` ? r.push(nt()) : o === " " ? r.push(Un()) : r.push($(o));
2267
+ }
2268
+ this.insertNodes(r);
2269
+ }
2270
+ insertText(e) {
2271
+ const t = this.anchor, r = this.focus, s = this.format, i = this.style;
2272
+ let o = t, l = r;
2273
+ !this.isCollapsed() && r.isBefore(t) && (o = r, l = t), o.type === "element" && function(_, m, y, S) {
2274
+ const k = _.getNode(), T = k.getChildAtIndex(_.offset), x = $(), P = Y(k) ? ve().append(x) : x;
2275
+ x.setFormat(y), x.setStyle(S), T === null ? k.append(P) : T.insertBefore(P), _.is(m) && m.set(x.__key, 0, "text"), _.set(x.__key, 0, "text");
2276
+ }(o, l, s, i);
2277
+ const c = o.offset;
2278
+ let a = l.offset;
2279
+ const u = this.getNodes(), h = u.length;
2280
+ let f = u[0];
2281
+ N(f) || b(26);
2282
+ const d = f.getTextContent().length, g = f.getParentOrThrow();
2283
+ let p = u[h - 1];
2284
+ if (h === 1 && l.type === "element" && (a = d, l.set(o.key, a, "text")), this.isCollapsed() && c === d && (f.isSegmented() || f.isToken() || !f.canInsertTextAfter() || !g.canInsertTextAfter() && f.getNextSibling() === null)) {
2285
+ let _ = f.getNextSibling();
2286
+ if (N(_) && _.canInsertTextBefore() && !be(_) || (_ = $(), _.setFormat(s), _.setStyle(i), g.canInsertTextAfter() ? f.insertAfter(_) : g.insertAfter(_)), _.select(0, 0), f = _, e !== "") return void this.insertText(e);
2287
+ } else if (this.isCollapsed() && c === 0 && (f.isSegmented() || f.isToken() || !f.canInsertTextBefore() || !g.canInsertTextBefore() && f.getPreviousSibling() === null)) {
2288
+ let _ = f.getPreviousSibling();
2289
+ if (N(_) && !be(_) || (_ = $(), _.setFormat(s), g.canInsertTextBefore() ? f.insertBefore(_) : g.insertBefore(_)), _.select(), f = _, e !== "") return void this.insertText(e);
2290
+ } else if (f.isSegmented() && c !== d) {
2291
+ const _ = $(f.getTextContent());
2292
+ _.setFormat(s), f.replace(_), f = _;
2293
+ } else if (!this.isCollapsed() && e !== "") {
2294
+ const _ = p.getParent();
2295
+ if (!g.canInsertTextBefore() || !g.canInsertTextAfter() || v(_) && (!_.canInsertTextBefore() || !_.canInsertTextAfter())) return this.insertText(""), Ts(this.anchor, this.focus, null), void this.insertText(e);
2296
+ }
2297
+ if (h === 1) {
2298
+ if (f.isToken()) {
2299
+ const S = $(e);
2300
+ return S.select(), void f.replace(S);
2301
+ }
2302
+ const _ = f.getFormat(), m = f.getStyle();
2303
+ if (c !== a || _ === s && m === i) {
2304
+ if (Ri(f)) {
2305
+ const S = $(e);
2306
+ return S.setFormat(s), S.setStyle(i), S.select(), void f.replace(S);
2307
+ }
2308
+ } else {
2309
+ if (f.getTextContent() !== "") {
2310
+ const S = $(e);
2311
+ if (S.setFormat(s), S.setStyle(i), S.select(), c === 0) f.insertBefore(S, !1);
2312
+ else {
2313
+ const [k] = f.splitText(c);
2314
+ k.insertAfter(S, !1);
2315
+ }
2316
+ return void (S.isComposing() && this.anchor.type === "text" && (this.anchor.offset -= e.length));
2317
+ }
2318
+ f.setFormat(s), f.setStyle(i);
2319
+ }
2320
+ const y = a - c;
2321
+ f = f.spliceText(c, y, e, !0), f.getTextContent() === "" ? f.remove() : this.anchor.type === "text" && (f.isComposing() ? this.anchor.offset -= e.length : (this.format = _, this.style = m));
2322
+ } else {
2323
+ const _ = /* @__PURE__ */ new Set([...f.getParentKeys(), ...p.getParentKeys()]), m = v(f) ? f : f.getParentOrThrow();
2324
+ let y = v(p) ? p : p.getParentOrThrow(), S = p;
2325
+ if (!m.is(y) && y.isInline()) do
2326
+ S = y, y = y.getParentOrThrow();
2327
+ while (y.isInline());
2328
+ if (l.type === "text" && (a !== 0 || p.getTextContent() === "") || l.type === "element" && p.getIndexWithinParent() < a) if (N(p) && !p.isToken() && a !== p.getTextContentSize()) {
2329
+ if (p.isSegmented()) {
2330
+ const C = $(p.getTextContent());
2331
+ p.replace(C), p = C;
2332
+ }
2333
+ Y(l.getNode()) || l.type !== "text" || (p = p.spliceText(0, a, "")), _.add(p.__key);
2334
+ } else {
2335
+ const C = p.getParentOrThrow();
2336
+ C.canBeEmpty() || C.getChildrenSize() !== 1 ? p.remove() : C.remove();
2337
+ }
2338
+ else _.add(p.__key);
2339
+ const k = y.getChildren(), T = new Set(u), x = m.is(y), P = m.isInline() && f.getNextSibling() === null ? m : f;
2340
+ for (let C = k.length - 1; C >= 0; C--) {
2341
+ const E = k[C];
2342
+ if (E.is(f) || v(E) && E.isParentOf(f)) break;
2343
+ E.isAttached() && (!T.has(E) || E.is(S) ? x || P.insertAfter(E, !1) : E.remove());
2344
+ }
2345
+ if (!x) {
2346
+ let C = y, E = null;
2347
+ for (; C !== null; ) {
2348
+ const D = C.getChildren(), O = D.length;
2349
+ (O === 0 || D[O - 1].is(E)) && (_.delete(C.__key), E = C), C = C.getParent();
2350
+ }
2351
+ }
2352
+ if (f.isToken()) if (c === d) f.select();
2353
+ else {
2354
+ const C = $(e);
2355
+ C.select(), f.replace(C);
2356
+ }
2357
+ else f = f.spliceText(c, d - c, e, !0), f.getTextContent() === "" ? f.remove() : f.isComposing() && this.anchor.type === "text" && (this.anchor.offset -= e.length);
2358
+ for (let C = 1; C < h; C++) {
2359
+ const E = u[C], D = E.__key;
2360
+ _.has(D) || E.remove();
2361
+ }
2362
+ }
2363
+ }
2364
+ removeText() {
2365
+ if (this.isCollapsed()) return;
2366
+ const { anchor: e, focus: t } = this, r = this.getNodes(), s = this.isBackward() ? t : e, i = this.isBackward() ? e : t;
2367
+ let o = s.getNode(), l = i.getNode();
2368
+ const c = Je(o, _e), a = Je(l, _e);
2369
+ N(o) && o.isToken() && s.offset < o.getTextContentSize() && (s.offset = 0), i.offset > 0 && N(l) && l.isToken() && (i.offset = l.getTextContentSize()), r.forEach((h) => {
2370
+ Qe(o, h) || Qe(l, h) || h.getKey() === o.getKey() || h.getKey() === l.getKey() || h.remove();
2371
+ });
2372
+ const u = (h, f) => {
2373
+ if (h.getTextContent() === "") h.remove();
2374
+ else if (f !== 0 && be(h)) {
2375
+ const d = $(h.getTextContent());
2376
+ return d.setFormat(h.getFormat()), d.setStyle(h.getStyle()), h.replace(d);
2377
+ }
2378
+ };
2379
+ if (o === l && N(o)) {
2380
+ const h = Math.abs(t.offset - e.offset);
2381
+ return o.spliceText(s.offset, h, "", !0), void u(o, h);
2382
+ }
2383
+ if (N(o)) {
2384
+ const h = o.getTextContentSize() - s.offset;
2385
+ o.spliceText(s.offset, h, ""), o = u(o, h) || o;
2386
+ }
2387
+ N(l) && (l.spliceText(0, i.offset, ""), l = u(l, i.offset) || l), o.isAttached() && N(o) ? o.selectEnd() : l.isAttached() && N(l) && l.selectStart(), v(c) && v(a) && c !== a && (c.append(...a.getChildren()), a.remove(), i.set(s.key, s.offset, s.type));
2388
+ }
2389
+ formatText(e, t = null) {
2390
+ if (this.isCollapsed()) return this.toggleFormat(e), void J(null);
2391
+ const r = this.getNodes(), s = [];
2392
+ for (const k of r) N(k) && s.push(k);
2393
+ const i = (k) => {
2394
+ r.forEach((T) => {
2395
+ if (bn(T)) {
2396
+ const x = T.getFormatFlags(e, k);
2397
+ T.setTextFormat(x);
2398
+ }
2399
+ });
2400
+ }, o = s.length;
2401
+ if (o === 0) return this.toggleFormat(e), J(null), void i(t);
2402
+ const l = this.anchor, c = this.focus, a = this.isBackward(), u = a ? c : l, h = a ? l : c;
2403
+ let f = 0, d = s[0], g = u.type === "element" ? 0 : u.offset;
2404
+ if (u.type === "text" && g === d.getTextContentSize() && (f = 1, d = s[1], g = 0), d == null) return;
2405
+ const p = d.getFormatFlags(e, t);
2406
+ i(p);
2407
+ const _ = o - 1;
2408
+ let m = s[_];
2409
+ const y = h.type === "text" ? h.offset : m.getTextContentSize();
2410
+ if (d.is(m)) {
2411
+ if (g === y) return;
2412
+ if (be(d) || g === 0 && y === d.getTextContentSize()) d.setFormat(p);
2413
+ else {
2414
+ const k = d.splitText(g, y), T = g === 0 ? k[0] : k[1];
2415
+ T.setFormat(p), u.type === "text" && u.set(T.__key, 0, "text"), h.type === "text" && h.set(T.__key, y - g, "text");
2416
+ }
2417
+ return void (this.format = p);
2418
+ }
2419
+ g === 0 || be(d) || ([, d] = d.splitText(g), g = 0), d.setFormat(p);
2420
+ const S = m.getFormatFlags(e, p);
2421
+ y > 0 && (y === m.getTextContentSize() || be(m) || ([m] = m.splitText(y)), m.setFormat(S));
2422
+ for (let k = f + 1; k < _; k++) {
2423
+ const T = s[k], x = T.getFormatFlags(e, S);
2424
+ T.setFormat(x);
2425
+ }
2426
+ u.type === "text" && u.set(d.__key, g, "text"), h.type === "text" && h.set(m.__key, y, "text"), this.format = p | S;
2427
+ }
2428
+ insertNodes(e) {
2429
+ if (e.length === 0) return;
2430
+ if (this.anchor.key === "root") {
2431
+ this.insertParagraph();
2432
+ const g = I();
2433
+ return F(g) || b(134), g.insertNodes(e);
2434
+ }
2435
+ const t = (this.isBackward() ? this.focus : this.anchor).getNode(), r = Je(t, _e), s = e[e.length - 1];
2436
+ if (v(r) && "__language" in r) {
2437
+ if ("__language" in e[0]) this.insertText(e[0].getTextContent());
2438
+ else {
2439
+ const g = un(this);
2440
+ r.splice(g, 0, e), s.selectEnd();
2441
+ }
2442
+ return;
2443
+ }
2444
+ if (!e.some((g) => (v(g) || A(g)) && !g.isInline())) {
2445
+ v(r) || b(211, t.constructor.name, t.getType());
2446
+ const g = un(this);
2447
+ return r.splice(g, 0, e), void s.selectEnd();
2448
+ }
2449
+ const i = function(g) {
2450
+ const p = ve();
2451
+ let _ = null;
2452
+ for (let m = 0; m < g.length; m++) {
2453
+ const y = g[m], S = Ae(y);
2454
+ if (S || A(y) && y.isInline() || v(y) && y.isInline() || N(y) || y.isParentRequired()) {
2455
+ if (_ === null && (_ = y.createParentElementNode(), p.append(_), S)) continue;
2456
+ _ !== null && _.append(y);
2457
+ } else p.append(y), _ = null;
2458
+ }
2459
+ return p;
2460
+ }(e), o = i.getLastDescendant(), l = i.getChildren(), c = !v(r) || !r.isEmpty() ? this.insertParagraph() : null, a = l[l.length - 1];
2461
+ let u = l[0];
2462
+ var h;
2463
+ v(h = u) && _e(h) && !h.isEmpty() && v(r) && (!r.isEmpty() || r.canMergeWhenEmpty()) && (v(r) || b(211, t.constructor.name, t.getType()), r.append(...u.getChildren()), u = l[1]), u && (r === null && b(212, t.constructor.name, t.getType()), function(g, p, _) {
2464
+ const m = p.getParentOrThrow().getLastChild();
2465
+ let y = p;
2466
+ const S = [p];
2467
+ for (; y !== m; ) y.getNextSibling() || b(140), y = y.getNextSibling(), S.push(y);
2468
+ let k = g;
2469
+ for (const T of S) k = k.insertAfter(T);
2470
+ }(r, u));
2471
+ const f = Je(o, _e);
2472
+ c && v(f) && (c.canMergeWhenEmpty() || _e(a)) && (f.append(...c.getChildren()), c.remove()), v(r) && r.isEmpty() && r.remove(), o.selectEnd();
2473
+ const d = v(r) ? r.getLastChild() : null;
2474
+ Ae(d) && f !== r && d.remove();
2475
+ }
2476
+ insertParagraph() {
2477
+ if (this.anchor.key === "root") {
2478
+ const o = ve();
2479
+ return Z().splice(this.anchor.offset, 0, [o]), o.select(), o;
2480
+ }
2481
+ const e = un(this), t = Je(this.anchor.getNode(), _e);
2482
+ v(t) || b(213);
2483
+ const r = t.getChildAtIndex(e), s = r ? [r, ...r.getNextSiblings()] : [], i = t.insertNewAfter(this, !1);
2484
+ return i ? (i.append(...s), i.selectStart(), i) : null;
2485
+ }
2486
+ insertLineBreak(e) {
2487
+ const t = nt();
2488
+ if (this.insertNodes([t]), e) {
2489
+ const r = t.getParentOrThrow(), s = t.getIndexWithinParent();
2490
+ r.select(s, s);
2491
+ }
2492
+ }
2493
+ extract() {
2494
+ const e = this.getNodes(), t = e.length, r = t - 1, s = this.anchor, i = this.focus;
2495
+ let o = e[0], l = e[r];
2496
+ const [c, a] = br(this);
2497
+ if (t === 0) return [];
2498
+ if (t === 1) {
2499
+ if (N(o) && !this.isCollapsed()) {
2500
+ const h = c > a ? a : c, f = c > a ? c : a, d = o.splitText(h, f), g = h === 0 ? d[0] : d[1];
2501
+ return g != null ? [g] : [];
2502
+ }
2503
+ return [o];
2504
+ }
2505
+ const u = s.isBefore(i);
2506
+ if (N(o)) {
2507
+ const h = u ? c : a;
2508
+ h === o.getTextContentSize() ? e.shift() : h !== 0 && ([, o] = o.splitText(h), e[0] = o);
2509
+ }
2510
+ if (N(l)) {
2511
+ const h = l.getTextContent().length, f = u ? a : c;
2512
+ f === 0 ? e.pop() : f !== h && ([l] = l.splitText(f), e[r] = l);
2513
+ }
2514
+ return e;
2515
+ }
2516
+ modify(e, t, r) {
2517
+ const s = this.focus, i = this.anchor, o = e === "move", l = dr(s, t);
2518
+ if (A(l) && !l.isIsolated()) {
2519
+ if (o && l.isKeyboardSelectable()) {
2520
+ const d = Pr();
2521
+ return d.add(l.__key), void ue(d);
2522
+ }
2523
+ const f = t ? l.getPreviousSibling() : l.getNextSibling();
2524
+ if (N(f)) {
2525
+ const d = f.__key, g = t ? f.getTextContent().length : 0;
2526
+ return s.set(d, g, "text"), void (o && i.set(d, g, "text"));
2527
+ }
2528
+ {
2529
+ const d = l.getParentOrThrow();
2530
+ let g, p;
2531
+ return v(f) ? (p = f.__key, g = t ? f.getChildrenSize() : 0) : (g = l.getIndexWithinParent(), p = d.__key, t || g++), s.set(p, g, "element"), void (o && i.set(p, g, "element"));
2532
+ }
2533
+ }
2534
+ const c = M(), a = se(c._window);
2535
+ if (!a) return;
2536
+ const u = c._blockCursorElement, h = c._rootElement;
2537
+ if (h === null || u === null || !v(l) || l.isInline() || l.canBeEmpty() || $n(u, c, h), function(f, d, g, p) {
2538
+ f.modify(d, g, p);
2539
+ }(a, e, t ? "backward" : "forward", r), a.rangeCount > 0) {
2540
+ const f = a.getRangeAt(0), d = this.anchor.getNode(), g = Y(d) ? d : Ti(d);
2541
+ if (this.applyDOMRange(f), this.dirty = !0, !o) {
2542
+ const p = this.getNodes(), _ = [];
2543
+ let m = !1;
2544
+ for (let y = 0; y < p.length; y++) {
2545
+ const S = p[y];
2546
+ Qe(S, g) ? _.push(S) : m = !0;
2547
+ }
2548
+ if (m && _.length > 0) if (t) {
2549
+ const y = _[0];
2550
+ v(y) ? y.selectStart() : y.getParentOrThrow().selectStart();
2551
+ } else {
2552
+ const y = _[_.length - 1];
2553
+ v(y) ? y.selectEnd() : y.getParentOrThrow().selectEnd();
2554
+ }
2555
+ a.anchorNode === f.startContainer && a.anchorOffset === f.startOffset || function(y) {
2556
+ const S = y.focus, k = y.anchor, T = k.key, x = k.offset, P = k.type;
2557
+ pe(k, S.key, S.offset, S.type), pe(S, T, x, P), y._cachedNodes = null;
2558
+ }(this);
2559
+ }
2560
+ }
2561
+ }
2562
+ forwardDeletion(e, t, r) {
2563
+ if (!r && (e.type === "element" && v(t) && e.offset === t.getChildrenSize() || e.type === "text" && e.offset === t.getTextContentSize())) {
2564
+ const s = t.getParent(), i = t.getNextSibling() || (s === null ? null : s.getNextSibling());
2565
+ if (v(i) && i.isShadowRoot()) return !0;
2566
+ }
2567
+ return !1;
2568
+ }
2569
+ deleteCharacter(e) {
2570
+ const t = this.isCollapsed();
2571
+ if (this.isCollapsed()) {
2572
+ const r = this.anchor;
2573
+ let s = r.getNode();
2574
+ if (this.forwardDeletion(r, s, e)) return;
2575
+ const i = this.focus, o = dr(i, e);
2576
+ if (A(o) && !o.isIsolated()) {
2577
+ if (o.isKeyboardSelectable() && v(s) && s.getChildrenSize() === 0) {
2578
+ s.remove();
2579
+ const l = Pr();
2580
+ l.add(o.__key), ue(l);
2581
+ } else
2582
+ o.remove(), M().dispatchCommand(wn, void 0);
2583
+ return;
2584
+ }
2585
+ if (!e && v(o) && v(s) && s.isEmpty()) return s.remove(), void o.selectStart();
2586
+ if (this.modify("extend", e, "character"), this.isCollapsed()) {
2587
+ if (e && r.offset === 0 && (r.type === "element" ? r.getNode() : r.getNode().getParentOrThrow()).collapseAtStart(this))
2588
+ return;
2589
+ } else {
2590
+ const l = i.type === "text" ? i.getNode() : null;
2591
+ if (s = r.type === "text" ? r.getNode() : null, l !== null && l.isSegmented()) {
2592
+ const c = i.offset, a = l.getTextContentSize();
2593
+ if (l.is(s) || e && c !== a || !e && c !== 0) return void wr(l, e, c);
2594
+ } else if (s !== null && s.isSegmented()) {
2595
+ const c = r.offset, a = s.getTextContentSize();
2596
+ if (s.is(l) || e && c !== 0 || !e && c !== a) return void wr(s, e, c);
2597
+ }
2598
+ (function(c, a) {
2599
+ const u = c.anchor, h = c.focus, f = u.getNode(), d = h.getNode();
2600
+ if (f === d && u.type === "text" && h.type === "text") {
2601
+ const g = u.offset, p = h.offset, _ = g < p, m = _ ? g : p, y = _ ? p : g, S = y - 1;
2602
+ m !== S && (ns(f.getTextContent().slice(m, y)) || (a ? h.offset = S : u.offset = S));
2603
+ }
2604
+ })(this, e);
2605
+ }
2606
+ }
2607
+ if (this.removeText(), e && !t && this.isCollapsed() && this.anchor.type === "element" && this.anchor.offset === 0) {
2608
+ const r = this.anchor.getNode();
2609
+ r.isEmpty() && Y(r.getParent()) && r.getIndexWithinParent() === 0 && r.collapseAtStart(this);
2610
+ }
2611
+ }
2612
+ deleteLine(e) {
2613
+ if (this.isCollapsed()) {
2614
+ const t = this.anchor.type === "element";
2615
+ if (t && this.insertText(" "), this.modify("extend", e, "lineboundary"), this.isCollapsed() && this.anchor.offset === 0 && this.modify("extend", e, "character"), t) {
2616
+ const r = e ? this.anchor : this.focus;
2617
+ r.set(r.key, r.offset + 1, r.type);
2618
+ }
2619
+ }
2620
+ this.removeText();
2621
+ }
2622
+ deleteWord(e) {
2623
+ if (this.isCollapsed()) {
2624
+ const t = this.anchor, r = t.getNode();
2625
+ if (this.forwardDeletion(t, r, e)) return;
2626
+ this.modify("extend", e, "word");
2627
+ }
2628
+ this.removeText();
2629
+ }
2630
+ isBackward() {
2631
+ return this.focus.isBefore(this.anchor);
2632
+ }
2633
+ getStartEndPoints() {
2634
+ return [this.anchor, this.focus];
2635
+ }
2636
+ }
2637
+ function Ht(n) {
2638
+ return n instanceof jt;
2639
+ }
2640
+ function kr(n) {
2641
+ const e = n.offset;
2642
+ if (n.type === "text") return e;
2643
+ const t = n.getNode();
2644
+ return e === t.getChildrenSize() ? t.getTextContent().length : 0;
2645
+ }
2646
+ function br(n) {
2647
+ const e = n.getStartEndPoints();
2648
+ if (e === null) return [0, 0];
2649
+ const [t, r] = e;
2650
+ return t.type === "element" && r.type === "element" && t.key === r.key && t.offset === r.offset ? [0, 0] : [kr(t), kr(r)];
2651
+ }
2652
+ function wr(n, e, t) {
2653
+ const r = n, s = r.getTextContent().split(/(?=\s)/g), i = s.length;
2654
+ let o = 0, l = 0;
2655
+ for (let a = 0; a < i; a++) {
2656
+ const u = a === i - 1;
2657
+ if (l = o, o += s[a].length, e && o === t || o > t || u) {
2658
+ s.splice(a, 1), u && (l = void 0);
2659
+ break;
2660
+ }
2661
+ }
2662
+ const c = s.join("").trim();
2663
+ c === "" ? r.remove() : (r.setTextContent(c), r.select(l, l));
2664
+ }
2665
+ function Nr(n, e, t, r) {
2666
+ let s, i = e;
2667
+ if (n.nodeType === rt) {
2668
+ let o = !1;
2669
+ const l = n.childNodes, c = l.length, a = r._blockCursorElement;
2670
+ i === c && (o = !0, i = c - 1);
2671
+ let u = l[i], h = !1;
2672
+ if (u === a) u = l[i + 1], h = !0;
2673
+ else if (a !== null) {
2674
+ const f = a.parentNode;
2675
+ n === f && e > Array.prototype.indexOf.call(f.children, a) && i--;
2676
+ }
2677
+ if (s = Oe(u), N(s)) i = or(s, o);
2678
+ else {
2679
+ let f = Oe(n);
2680
+ if (f === null) return null;
2681
+ if (v(f)) {
2682
+ i = Math.min(f.getChildrenSize(), i);
2683
+ let d = f.getChildAtIndex(i);
2684
+ if (v(d) && function(g, p, _) {
2685
+ const m = g.getParent();
2686
+ return _ === null || m === null || !m.canBeEmpty() || m !== _.getNode();
2687
+ }(d, 0, t)) {
2688
+ const g = o ? d.getLastDescendant() : d.getFirstDescendant();
2689
+ g === null ? f = d : (d = g, f = v(d) ? d : d.getParentOrThrow()), i = 0;
2690
+ }
2691
+ N(d) ? (s = d, f = null, i = or(d, o)) : d !== f && o && !h && i++;
2692
+ } else {
2693
+ const d = f.getIndexWithinParent();
2694
+ i = e === 0 && A(f) && Oe(n) === f ? d : d + 1, f = f.getParentOrThrow();
2695
+ }
2696
+ if (v(f)) return ie(f.__key, i, "element");
2697
+ }
2698
+ } else s = Oe(n);
2699
+ return N(s) ? ie(s.__key, i, "text") : null;
2700
+ }
2701
+ function Er(n, e, t) {
2702
+ const r = n.offset, s = n.getNode();
2703
+ if (r === 0) {
2704
+ const i = s.getPreviousSibling(), o = s.getParent();
2705
+ if (e) {
2706
+ if ((t || !e) && i === null && v(o) && o.isInline()) {
2707
+ const l = o.getPreviousSibling();
2708
+ N(l) && (n.key = l.__key, n.offset = l.getTextContent().length);
2709
+ }
2710
+ } else v(i) && !t && i.isInline() ? (n.key = i.__key, n.offset = i.getChildrenSize(), n.type = "element") : N(i) && (n.key = i.__key, n.offset = i.getTextContent().length);
2711
+ } else if (r === s.getTextContent().length) {
2712
+ const i = s.getNextSibling(), o = s.getParent();
2713
+ if (e && v(i) && i.isInline()) n.key = i.__key, n.offset = 0, n.type = "element";
2714
+ else if ((t || e) && i === null && v(o) && o.isInline() && !o.canInsertTextAfter()) {
2715
+ const l = o.getNextSibling();
2716
+ N(l) && (n.key = l.__key, n.offset = 0);
2717
+ }
2718
+ }
2719
+ }
2720
+ function Ts(n, e, t) {
2721
+ if (n.type === "text" && e.type === "text") {
2722
+ const r = n.isBefore(e), s = n.is(e);
2723
+ Er(n, r, s), Er(e, !r, s), s && (e.key = n.key, e.offset = n.offset, e.type = n.type);
2724
+ const i = M();
2725
+ if (i.isComposing() && i._compositionKey !== n.key && F(t)) {
2726
+ const o = t.anchor, l = t.focus;
2727
+ pe(n, o.key, o.offset, o.type), pe(e, l.key, l.offset, l.type);
2728
+ }
2729
+ }
2730
+ }
2731
+ function Cs(n, e, t, r, s, i) {
2732
+ if (n === null || t === null || !Mt(s, n, t)) return null;
2733
+ const o = Nr(n, e, F(i) ? i.anchor : null, s);
2734
+ if (o === null) return null;
2735
+ const l = Nr(t, r, F(i) ? i.focus : null, s);
2736
+ if (l === null) return null;
2737
+ if (o.type === "element" && l.type === "element") {
2738
+ const c = Oe(n), a = Oe(t);
2739
+ if (A(c) && A(a)) return null;
2740
+ }
2741
+ return Ts(o, l, i), [o, l];
2742
+ }
2743
+ function uo(n) {
2744
+ return v(n) && !n.isInline();
2745
+ }
2746
+ function ks(n, e, t, r, s, i) {
2747
+ const o = fe(), l = new Ce(ie(n, e, s), ie(t, r, i), 0, "");
2748
+ return l.dirty = !0, o._selection = l, l;
2749
+ }
2750
+ function fo() {
2751
+ const n = ie("root", 0, "element"), e = ie("root", 0, "element");
2752
+ return new Ce(n, e, 0, "");
2753
+ }
2754
+ function Pr() {
2755
+ return new jt(/* @__PURE__ */ new Set());
2756
+ }
2757
+ function ho(n, e) {
2758
+ return qt(null, n, e, null);
2759
+ }
2760
+ function qt(n, e, t, r) {
2761
+ const s = t._window;
2762
+ if (s === null) return null;
2763
+ const i = r || s.event, o = i ? i.type : void 0, l = o === "selectionchange", c = !hn && (l || o === "beforeinput" || o === "compositionstart" || o === "compositionend" || o === "click" && i && i.detail === 3 || o === "drop" || o === void 0);
2764
+ let a, u, h, f;
2765
+ if (F(n) && !c) return n.clone();
2766
+ if (e === null) return null;
2767
+ if (a = e.anchorNode, u = e.focusNode, h = e.anchorOffset, f = e.focusOffset, l && F(n) && !Mt(t, a, u)) return n.clone();
2768
+ const d = Cs(a, h, u, f, t, n);
2769
+ if (d === null) return null;
2770
+ const [g, p] = d;
2771
+ return new Ce(g, p, F(n) ? n.format : 0, F(n) ? n.style : "");
2772
+ }
2773
+ function I() {
2774
+ return fe()._selection;
2775
+ }
2776
+ function ot() {
2777
+ return M()._editorState._selection;
2778
+ }
2779
+ function Lt(n, e, t, r = 1) {
2780
+ const s = n.anchor, i = n.focus, o = s.getNode(), l = i.getNode();
2781
+ if (!e.is(o) && !e.is(l)) return;
2782
+ const c = e.__key;
2783
+ if (n.isCollapsed()) {
2784
+ const a = s.offset;
2785
+ if (t <= a && r > 0 || t < a && r < 0) {
2786
+ const u = Math.max(0, a + r);
2787
+ s.set(c, u, "element"), i.set(c, u, "element"), Fr(n);
2788
+ }
2789
+ } else {
2790
+ const a = n.isBackward(), u = a ? i : s, h = u.getNode(), f = a ? s : i, d = f.getNode();
2791
+ if (e.is(h)) {
2792
+ const g = u.offset;
2793
+ (t <= g && r > 0 || t < g && r < 0) && u.set(c, Math.max(0, g + r), "element");
2794
+ }
2795
+ if (e.is(d)) {
2796
+ const g = f.offset;
2797
+ (t <= g && r > 0 || t < g && r < 0) && f.set(c, Math.max(0, g + r), "element");
2798
+ }
2799
+ }
2800
+ Fr(n);
2801
+ }
2802
+ function Fr(n) {
2803
+ const e = n.anchor, t = e.offset, r = n.focus, s = r.offset, i = e.getNode(), o = r.getNode();
2804
+ if (n.isCollapsed()) {
2805
+ if (!v(i)) return;
2806
+ const l = i.getChildrenSize(), c = t >= l, a = c ? i.getChildAtIndex(l - 1) : i.getChildAtIndex(t);
2807
+ if (N(a)) {
2808
+ let u = 0;
2809
+ c && (u = a.getTextContentSize()), e.set(a.__key, u, "text"), r.set(a.__key, u, "text");
2810
+ }
2811
+ } else {
2812
+ if (v(i)) {
2813
+ const l = i.getChildrenSize(), c = t >= l, a = c ? i.getChildAtIndex(l - 1) : i.getChildAtIndex(t);
2814
+ if (N(a)) {
2815
+ let u = 0;
2816
+ c && (u = a.getTextContentSize()), e.set(a.__key, u, "text");
2817
+ }
2818
+ }
2819
+ if (v(o)) {
2820
+ const l = o.getChildrenSize(), c = s >= l, a = c ? o.getChildAtIndex(l - 1) : o.getChildAtIndex(s);
2821
+ if (N(a)) {
2822
+ let u = 0;
2823
+ c && (u = a.getTextContentSize()), r.set(a.__key, u, "text");
2824
+ }
2825
+ }
2826
+ }
2827
+ }
2828
+ function Ot(n, e, t, r, s) {
2829
+ let i = null, o = 0, l = null;
2830
+ r !== null ? (i = r.__key, N(r) ? (o = r.getTextContentSize(), l = "text") : v(r) && (o = r.getChildrenSize(), l = "element")) : s !== null && (i = s.__key, N(s) ? l = "text" : v(s) && (l = "element")), i !== null && l !== null ? n.set(i, o, l) : (o = e.getIndexWithinParent(), o === -1 && (o = t.getChildrenSize()), n.set(t.__key, o, "element"));
2831
+ }
2832
+ function Dr(n, e, t, r, s) {
2833
+ n.type === "text" ? (n.key = t, e || (n.offset += s)) : n.offset > r.getIndexWithinParent() && (n.offset -= 1);
2834
+ }
2835
+ function $i(n, e, t, r, s, i, o) {
2836
+ const l = r.anchorNode, c = r.focusNode, a = r.anchorOffset, u = r.focusOffset, h = document.activeElement;
2837
+ if (s.has("collaboration") && h !== i || h !== null && Xr(h)) return;
2838
+ if (!F(e)) return void (n !== null && Mt(t, l, c) && r.removeAllRanges());
2839
+ const f = e.anchor, d = e.focus, g = f.key, p = d.key, _ = Nt(t, g), m = Nt(t, p), y = f.offset, S = d.offset, k = e.format, T = e.style, x = e.isCollapsed();
2840
+ let P = _, C = m, E = !1;
2841
+ if (f.type === "text") {
2842
+ P = kt(_);
2843
+ const W = f.getNode();
2844
+ E = W.getFormat() !== k || W.getStyle() !== T;
2845
+ } else F(n) && n.anchor.type === "text" && (E = !0);
2846
+ var D, O, z, L, U;
2847
+ if (d.type === "text" && (C = kt(m)), P !== null && C !== null && (x && (n === null || E || F(n) && (n.format !== k || n.style !== T)) && (D = k, O = T, z = y, L = g, U = performance.now(), _s = [D, O, z, L, U]), a !== y || u !== S || l !== P || c !== C || r.type === "Range" && x || (h !== null && i.contains(h) || i.focus({ preventScroll: !0 }), f.type === "element"))) {
2848
+ try {
2849
+ r.setBaseAndExtent(P, y, C, S);
2850
+ } catch {
2851
+ }
2852
+ if (!s.has("skip-scroll-into-view") && e.isCollapsed() && i !== null && i === document.activeElement) {
2853
+ const W = e instanceof Ce && e.anchor.type === "element" ? P.childNodes[y] || null : r.rangeCount > 0 ? r.getRangeAt(0) : null;
2854
+ if (W !== null) {
2855
+ let de;
2856
+ if (W instanceof Text) {
2857
+ const De = document.createRange();
2858
+ De.selectNode(W), de = De.getBoundingClientRect();
2859
+ } else de = W.getBoundingClientRect();
2860
+ (function(De, Be, Hn) {
2861
+ const qn = Hn.ownerDocument, Qn = qn.defaultView;
2862
+ if (Qn === null) return;
2863
+ let { top: Zt, bottom: Gt } = Be, at = 0, ut = 0, he = Hn;
2864
+ for (; he !== null; ) {
2865
+ const en = he === qn.body;
2866
+ if (en) at = 0, ut = Kt(De).innerHeight;
2867
+ else {
2868
+ const ft = he.getBoundingClientRect();
2869
+ at = ft.top, ut = ft.bottom;
2870
+ }
2871
+ let Re = 0;
2872
+ if (Zt < at ? Re = -(at - Zt) : Gt > ut && (Re = Gt - ut), Re !== 0) if (en) Qn.scrollBy(0, Re);
2873
+ else {
2874
+ const ft = he.scrollTop;
2875
+ he.scrollTop += Re;
2876
+ const Xn = he.scrollTop - ft;
2877
+ Zt -= Xn, Gt -= Xn;
2878
+ }
2879
+ if (en) break;
2880
+ he = Rt(he);
2881
+ }
2882
+ })(t, de, i);
2883
+ }
2884
+ }
2885
+ Tn = !0;
2886
+ }
2887
+ }
2888
+ function go(n) {
2889
+ let e = I() || ot();
2890
+ e === null && (e = Z().selectEnd()), e.insertNodes(n);
2891
+ }
2892
+ function un(n) {
2893
+ let e = n;
2894
+ n.isCollapsed() || e.removeText();
2895
+ const t = I();
2896
+ F(t) && (e = t), F(e) || b(161);
2897
+ const r = e.anchor;
2898
+ let s = r.getNode(), i = r.offset;
2899
+ for (; !_e(s); ) [s, i] = Ji(s, i);
2900
+ return i;
2901
+ }
2902
+ function Ji(n, e) {
2903
+ const t = n.getParent();
2904
+ if (!t) {
2905
+ const s = ve();
2906
+ return Z().append(s), s.select(), [Z(), 0];
2907
+ }
2908
+ if (N(n)) {
2909
+ const s = n.splitText(e);
2910
+ if (s.length === 0) return [t, n.getIndexWithinParent()];
2911
+ const i = e === 0 ? 0 : 1;
2912
+ return [t, s[0].getIndexWithinParent() + i];
2913
+ }
2914
+ if (!v(n) || e === 0) return [t, n.getIndexWithinParent()];
2915
+ const r = n.getChildAtIndex(e);
2916
+ if (r) {
2917
+ const s = new Ce(ie(n.__key, e, "element"), ie(n.__key, e, "element"), 0, ""), i = n.insertNewAfter(s);
2918
+ i && i.append(r, ...r.getNextSiblings());
2919
+ }
2920
+ return [t, n.getIndexWithinParent() + 1];
2921
+ }
2922
+ let R = null, K = null, Q = !1, fn = !1, pt = 0;
2923
+ const Lr = { characterData: !0, childList: !0, subtree: !0 };
2924
+ function lt() {
2925
+ return Q || R !== null && R._readOnly;
2926
+ }
2927
+ function q() {
2928
+ Q && b(13);
2929
+ }
2930
+ function bs() {
2931
+ pt > 99 && b(14);
2932
+ }
2933
+ function fe() {
2934
+ return R === null && b(195, ws()), R;
2935
+ }
2936
+ function M() {
2937
+ return K === null && b(196, ws()), K;
2938
+ }
2939
+ function ws() {
2940
+ let n = 0;
2941
+ const e = /* @__PURE__ */ new Set(), t = Yt.version;
2942
+ if (typeof window < "u") for (const s of document.querySelectorAll("[contenteditable]")) {
2943
+ const i = zt(s);
2944
+ if (zn(i)) n++;
2945
+ else if (i) {
2946
+ let o = String(i.constructor.version || "<0.17.1");
2947
+ o === t && (o += " (separately built, likely a bundler configuration issue)"), e.add(o);
2948
+ }
2949
+ }
2950
+ let r = ` Detected on the page: ${n} compatible editor(s) with version ${t}`;
2951
+ return e.size && (r += ` and incompatible editors with versions ${Array.from(e).join(", ")}`), r;
2952
+ }
2953
+ function Ui() {
2954
+ return K;
2955
+ }
2956
+ function Or(n, e, t) {
2957
+ const r = e.__type, s = function(l, c) {
2958
+ const a = l._nodes.get(c);
2959
+ return a === void 0 && b(30, c), a;
2960
+ }(n, r);
2961
+ let i = t.get(r);
2962
+ i === void 0 && (i = Array.from(s.transforms), t.set(r, i));
2963
+ const o = i.length;
2964
+ for (let l = 0; l < o && (i[l](e), e.isAttached()); l++) ;
2965
+ }
2966
+ function Ir(n, e) {
2967
+ return n !== void 0 && n.__key !== e && n.isAttached();
2968
+ }
2969
+ function Ns(n, e) {
2970
+ if (!e) return;
2971
+ const t = n._updateTags;
2972
+ let r = e;
2973
+ Array.isArray(e) || (r = [e]);
2974
+ for (const s of r) t.add(s);
2975
+ }
2976
+ function _o(n) {
2977
+ return Vn(n, M()._nodes);
2978
+ }
2979
+ function Vn(n, e) {
2980
+ const t = n.type, r = e.get(t);
2981
+ r === void 0 && b(17, t);
2982
+ const s = r.klass;
2983
+ n.type !== s.getType() && b(18, s.name);
2984
+ const i = s.importJSON(n), o = n.children;
2985
+ if (v(i) && Array.isArray(o)) for (let l = 0; l < o.length; l++) {
2986
+ const c = Vn(o[l], e);
2987
+ i.append(c);
2988
+ }
2989
+ return i;
2990
+ }
2991
+ function Ar(n, e, t) {
2992
+ const r = R, s = Q, i = K;
2993
+ R = e, Q = !0, K = n;
2994
+ try {
2995
+ return t();
2996
+ } finally {
2997
+ R = r, Q = s, K = i;
2998
+ }
2999
+ }
3000
+ function me(n, e) {
3001
+ const t = n._pendingEditorState, r = n._rootElement, s = n._headless || r === null;
3002
+ if (t === null) return;
3003
+ const i = n._editorState, o = i._selection, l = t._selection, c = n._dirtyType !== Ee, a = R, u = Q, h = K, f = n._updating, d = n._observer;
3004
+ let g = null;
3005
+ if (n._pendingEditorState = null, n._editorState = t, !s && c && d !== null) {
3006
+ K = n, R = t, Q = !1, n._updating = !0;
3007
+ try {
3008
+ const x = n._dirtyType, P = n._dirtyElements, C = n._dirtyLeaves;
3009
+ d.disconnect(), g = Li(i, t, n, x, P, C);
3010
+ } catch (x) {
3011
+ if (x instanceof Error && n._onError(x), fn) throw x;
3012
+ return Ds(n, null, r, t), Qr(n), n._dirtyType = Me, fn = !0, me(n, i), void (fn = !1);
3013
+ } finally {
3014
+ d.observe(r, Lr), n._updating = f, R = a, Q = u, K = h;
3015
+ }
3016
+ }
3017
+ t._readOnly || (t._readOnly = !0);
3018
+ const p = n._dirtyLeaves, _ = n._dirtyElements, m = n._normalizedNodes, y = n._updateTags, S = n._deferred;
3019
+ c && (n._dirtyType = Ee, n._cloneNotNeeded.clear(), n._dirtyLeaves = /* @__PURE__ */ new Set(), n._dirtyElements = /* @__PURE__ */ new Map(), n._normalizedNodes = /* @__PURE__ */ new Set(), n._updateTags = /* @__PURE__ */ new Set()), function(x, P) {
3020
+ const C = x._decorators;
3021
+ let E = x._pendingDecorators || C;
3022
+ const D = P._nodeMap;
3023
+ let O;
3024
+ for (O in E) D.has(O) || (E === C && (E = es(x)), delete E[O]);
3025
+ }(n, t);
3026
+ const k = s ? null : se(n._window);
3027
+ if (n._editable && k !== null && (c || l === null || l.dirty)) {
3028
+ K = n, R = t;
3029
+ try {
3030
+ if (d !== null && d.disconnect(), c || l === null || l.dirty) {
3031
+ const x = n._blockCursorElement;
3032
+ x !== null && $n(x, n, r), $i(o, l, n, k, y, r);
3033
+ }
3034
+ ki(n, r, l), d !== null && d.observe(r, Lr);
3035
+ } finally {
3036
+ K = h, R = a;
3037
+ }
3038
+ }
3039
+ g !== null && function(x, P, C, E, D) {
3040
+ const O = Array.from(x._listeners.mutation), z = O.length;
3041
+ for (let L = 0; L < z; L++) {
3042
+ const [U, W] = O[L], de = P.get(W);
3043
+ de !== void 0 && U(de, { dirtyLeaves: E, prevEditorState: D, updateTags: C });
3044
+ }
3045
+ }(n, g, y, p, i), F(l) || l === null || o !== null && o.is(l) || n.dispatchCommand(wn, void 0);
3046
+ const T = n._pendingDecorators;
3047
+ T !== null && (n._decorators = T, n._pendingDecorators = null, Ze("decorator", n, !0, T)), function(x, P, C) {
3048
+ const E = ir(P), D = ir(C);
3049
+ E !== D && Ze("textcontent", x, !0, D);
3050
+ }(n, e || i, t), Ze("update", n, !0, { dirtyElements: _, dirtyLeaves: p, editorState: t, normalizedNodes: m, prevEditorState: e || i, tags: y }), function(x, P) {
3051
+ if (x._deferred = [], P.length !== 0) {
3052
+ const C = x._updating;
3053
+ x._updating = !0;
3054
+ try {
3055
+ for (let E = 0; E < P.length; E++) P[E]();
3056
+ } finally {
3057
+ x._updating = C;
3058
+ }
3059
+ }
3060
+ }(n, S), function(x) {
3061
+ const P = x._updates;
3062
+ if (P.length !== 0) {
3063
+ const C = P.shift();
3064
+ if (C) {
3065
+ const [E, D] = C;
3066
+ Ps(x, E, D);
3067
+ }
3068
+ }
3069
+ }(n);
3070
+ }
3071
+ function Ze(n, e, t, ...r) {
3072
+ const s = e._updating;
3073
+ e._updating = t;
3074
+ try {
3075
+ const i = Array.from(e._listeners[n]);
3076
+ for (let o = 0; o < i.length; o++) i[o].apply(null, r);
3077
+ } finally {
3078
+ e._updating = s;
3079
+ }
3080
+ }
3081
+ function Es(n, e, t) {
3082
+ if (n._updating === !1 || K !== n) {
3083
+ let s = !1;
3084
+ return n.update(() => {
3085
+ s = Es(n, e, t);
3086
+ }), s;
3087
+ }
3088
+ const r = Wn(n);
3089
+ for (let s = 4; s >= 0; s--) for (let i = 0; i < r.length; i++) {
3090
+ const o = r[i]._commands.get(e);
3091
+ if (o !== void 0) {
3092
+ const l = o[s];
3093
+ if (l !== void 0) {
3094
+ const c = Array.from(l), a = c.length;
3095
+ for (let u = 0; u < a; u++) if (c[u](t, n) === !0) return !0;
3096
+ }
3097
+ }
3098
+ }
3099
+ return !1;
3100
+ }
3101
+ function Mr(n, e) {
3102
+ const t = n._updates;
3103
+ let r = e || !1;
3104
+ for (; t.length !== 0; ) {
3105
+ const s = t.shift();
3106
+ if (s) {
3107
+ const [i, o] = s;
3108
+ let l;
3109
+ if (o !== void 0) {
3110
+ if (l = o.onUpdate, o.skipTransforms && (r = !0), o.discrete) {
3111
+ const c = n._pendingEditorState;
3112
+ c === null && b(191), c._flushSync = !0;
3113
+ }
3114
+ l && n._deferred.push(l), Ns(n, o.tag);
3115
+ }
3116
+ i();
3117
+ }
3118
+ }
3119
+ return r;
3120
+ }
3121
+ function Ps(n, e, t) {
3122
+ const r = n._updateTags;
3123
+ let s, i = !1, o = !1;
3124
+ t !== void 0 && (s = t.onUpdate, Ns(n, t.tag), i = t.skipTransforms || !1, o = t.discrete || !1), s && n._deferred.push(s);
3125
+ const l = n._editorState;
3126
+ let c = n._pendingEditorState, a = !1;
3127
+ (c === null || c._readOnly) && (c = n._pendingEditorState = new Xt(new Map((c || l)._nodeMap)), a = !0), c._flushSync = o;
3128
+ const u = R, h = Q, f = K, d = n._updating;
3129
+ R = c, Q = !1, n._updating = !0, K = n;
3130
+ try {
3131
+ a && (n._headless ? l._selection !== null && (c._selection = l._selection.clone()) : c._selection = function(m) {
3132
+ const y = m.getEditorState()._selection, S = se(m._window);
3133
+ return F(y) || y == null ? qt(y, S, m, null) : y.clone();
3134
+ }(n));
3135
+ const p = n._compositionKey;
3136
+ e(), i = Mr(n, i), function(m, y) {
3137
+ const S = y.getEditorState()._selection, k = m._selection;
3138
+ if (F(k)) {
3139
+ const T = k.anchor, x = k.focus;
3140
+ let P;
3141
+ if (T.type === "text" && (P = T.getNode(), P.selectionTransform(S, k)), x.type === "text") {
3142
+ const C = x.getNode();
3143
+ P !== C && C.selectionTransform(S, k);
3144
+ }
3145
+ }
3146
+ }(c, n), n._dirtyType !== Ee && (i ? function(m, y) {
3147
+ const S = y._dirtyLeaves, k = m._nodeMap;
3148
+ for (const T of S) {
3149
+ const x = k.get(T);
3150
+ N(x) && x.isAttached() && x.isSimpleText() && !x.isUnmergeable() && rr(x);
3151
+ }
3152
+ }(c, n) : function(m, y) {
3153
+ const S = y._dirtyLeaves, k = y._dirtyElements, T = m._nodeMap, x = ye(), P = /* @__PURE__ */ new Map();
3154
+ let C = S, E = C.size, D = k, O = D.size;
3155
+ for (; E > 0 || O > 0; ) {
3156
+ if (E > 0) {
3157
+ y._dirtyLeaves = /* @__PURE__ */ new Set();
3158
+ for (const z of C) {
3159
+ const L = T.get(z);
3160
+ N(L) && L.isAttached() && L.isSimpleText() && !L.isUnmergeable() && rr(L), L !== void 0 && Ir(L, x) && Or(y, L, P), S.add(z);
3161
+ }
3162
+ if (C = y._dirtyLeaves, E = C.size, E > 0) {
3163
+ pt++;
3164
+ continue;
3165
+ }
3166
+ }
3167
+ y._dirtyLeaves = /* @__PURE__ */ new Set(), y._dirtyElements = /* @__PURE__ */ new Map();
3168
+ for (const z of D) {
3169
+ const L = z[0], U = z[1];
3170
+ if (L !== "root" && !U) continue;
3171
+ const W = T.get(L);
3172
+ W !== void 0 && Ir(W, x) && Or(y, W, P), k.set(L, U);
3173
+ }
3174
+ C = y._dirtyLeaves, E = C.size, D = y._dirtyElements, O = D.size, pt++;
3175
+ }
3176
+ y._dirtyLeaves = S, y._dirtyElements = k;
3177
+ }(c, n), Mr(n), function(m, y, S, k) {
3178
+ const T = m._nodeMap, x = y._nodeMap, P = [];
3179
+ for (const [C] of k) {
3180
+ const E = x.get(C);
3181
+ E !== void 0 && (E.isAttached() || (v(E) && os(E, C, T, x, P, k), T.has(C) || k.delete(C), P.push(C)));
3182
+ }
3183
+ for (const C of P) x.delete(C);
3184
+ for (const C of S) {
3185
+ const E = x.get(C);
3186
+ E === void 0 || E.isAttached() || (T.has(C) || S.delete(C), x.delete(C));
3187
+ }
3188
+ }(l, c, n._dirtyLeaves, n._dirtyElements)), p !== n._compositionKey && (c._flushSync = !0);
3189
+ const _ = c._selection;
3190
+ if (F(_)) {
3191
+ const m = c._nodeMap, y = _.anchor.key, S = _.focus.key;
3192
+ m.get(y) !== void 0 && m.get(S) !== void 0 || b(19);
3193
+ } else Ht(_) && _._nodes.size === 0 && (c._selection = null);
3194
+ } catch (p) {
3195
+ return p instanceof Error && n._onError(p), n._pendingEditorState = l, n._dirtyType = Me, n._cloneNotNeeded.clear(), n._dirtyLeaves = /* @__PURE__ */ new Set(), n._dirtyElements.clear(), void me(n);
3196
+ } finally {
3197
+ R = u, Q = h, K = f, n._updating = d, pt = 0;
3198
+ }
3199
+ n._dirtyType !== Ee || function(p, _) {
3200
+ const m = _.getEditorState()._selection, y = p._selection;
3201
+ if (y !== null) {
3202
+ if (y.dirty || !y.is(m)) return !0;
3203
+ } else if (m !== null) return !0;
3204
+ return !1;
3205
+ }(c, n) ? c._flushSync ? (c._flushSync = !1, me(n)) : a && xi(() => {
3206
+ me(n);
3207
+ }) : (c._flushSync = !1, a && (r.clear(), n._deferred = [], n._pendingEditorState = null));
3208
+ }
3209
+ function X(n, e, t) {
3210
+ n._updating ? n._updates.push([e, t]) : Ps(n, e, t);
3211
+ }
3212
+ class Qt extends Vt {
3213
+ constructor(e) {
3214
+ super(e), this.__first = null, this.__last = null, this.__size = 0, this.__format = 0, this.__style = "", this.__indent = 0, this.__dir = null;
3215
+ }
3216
+ afterCloneFrom(e) {
3217
+ super.afterCloneFrom(e), this.__first = e.__first, this.__last = e.__last, this.__size = e.__size, this.__indent = e.__indent, this.__format = e.__format, this.__style = e.__style, this.__dir = e.__dir;
3218
+ }
3219
+ getFormat() {
3220
+ return this.getLatest().__format;
3221
+ }
3222
+ getFormatType() {
3223
+ const e = this.getFormat();
3224
+ return ai[e] || "";
3225
+ }
3226
+ getStyle() {
3227
+ return this.getLatest().__style;
3228
+ }
3229
+ getIndent() {
3230
+ return this.getLatest().__indent;
3231
+ }
3232
+ getChildren() {
3233
+ const e = [];
3234
+ let t = this.getFirstChild();
3235
+ for (; t !== null; ) e.push(t), t = t.getNextSibling();
3236
+ return e;
3237
+ }
3238
+ getChildrenKeys() {
3239
+ const e = [];
3240
+ let t = this.getFirstChild();
3241
+ for (; t !== null; ) e.push(t.__key), t = t.getNextSibling();
3242
+ return e;
3243
+ }
3244
+ getChildrenSize() {
3245
+ return this.getLatest().__size;
3246
+ }
3247
+ isEmpty() {
3248
+ return this.getChildrenSize() === 0;
3249
+ }
3250
+ isDirty() {
3251
+ const e = M()._dirtyElements;
3252
+ return e !== null && e.has(this.__key);
3253
+ }
3254
+ isLastChild() {
3255
+ const e = this.getLatest(), t = this.getParentOrThrow().getLastChild();
3256
+ return t !== null && t.is(e);
3257
+ }
3258
+ getAllTextNodes() {
3259
+ const e = [];
3260
+ let t = this.getFirstChild();
3261
+ for (; t !== null; ) {
3262
+ if (N(t) && e.push(t), v(t)) {
3263
+ const r = t.getAllTextNodes();
3264
+ e.push(...r);
3265
+ }
3266
+ t = t.getNextSibling();
3267
+ }
3268
+ return e;
3269
+ }
3270
+ getFirstDescendant() {
3271
+ let e = this.getFirstChild();
3272
+ for (; v(e); ) {
3273
+ const t = e.getFirstChild();
3274
+ if (t === null) break;
3275
+ e = t;
3276
+ }
3277
+ return e;
3278
+ }
3279
+ getLastDescendant() {
3280
+ let e = this.getLastChild();
3281
+ for (; v(e); ) {
3282
+ const t = e.getLastChild();
3283
+ if (t === null) break;
3284
+ e = t;
3285
+ }
3286
+ return e;
3287
+ }
3288
+ getDescendantByIndex(e) {
3289
+ const t = this.getChildren(), r = t.length;
3290
+ if (e >= r) {
3291
+ const i = t[r - 1];
3292
+ return v(i) && i.getLastDescendant() || i || null;
3293
+ }
3294
+ const s = t[e];
3295
+ return v(s) && s.getFirstDescendant() || s || null;
3296
+ }
3297
+ getFirstChild() {
3298
+ const e = this.getLatest().__first;
3299
+ return e === null ? null : V(e);
3300
+ }
3301
+ getFirstChildOrThrow() {
3302
+ const e = this.getFirstChild();
3303
+ return e === null && b(45, this.__key), e;
3304
+ }
3305
+ getLastChild() {
3306
+ const e = this.getLatest().__last;
3307
+ return e === null ? null : V(e);
3308
+ }
3309
+ getLastChildOrThrow() {
3310
+ const e = this.getLastChild();
3311
+ return e === null && b(96, this.__key), e;
3312
+ }
3313
+ getChildAtIndex(e) {
3314
+ const t = this.getChildrenSize();
3315
+ let r, s;
3316
+ if (e < t / 2) {
3317
+ for (r = this.getFirstChild(), s = 0; r !== null && s <= e; ) {
3318
+ if (s === e) return r;
3319
+ r = r.getNextSibling(), s++;
3320
+ }
3321
+ return null;
3322
+ }
3323
+ for (r = this.getLastChild(), s = t - 1; r !== null && s >= e; ) {
3324
+ if (s === e) return r;
3325
+ r = r.getPreviousSibling(), s--;
3326
+ }
3327
+ return null;
3328
+ }
3329
+ getTextContent() {
3330
+ let e = "";
3331
+ const t = this.getChildren(), r = t.length;
3332
+ for (let s = 0; s < r; s++) {
3333
+ const i = t[s];
3334
+ e += i.getTextContent(), v(i) && s !== r - 1 && !i.isInline() && (e += ae);
3335
+ }
3336
+ return e;
3337
+ }
3338
+ getTextContentSize() {
3339
+ let e = 0;
3340
+ const t = this.getChildren(), r = t.length;
3341
+ for (let s = 0; s < r; s++) {
3342
+ const i = t[s];
3343
+ e += i.getTextContentSize(), v(i) && s !== r - 1 && !i.isInline() && (e += ae.length);
3344
+ }
3345
+ return e;
3346
+ }
3347
+ getDirection() {
3348
+ return this.getLatest().__dir;
3349
+ }
3350
+ hasFormat(e) {
3351
+ if (e !== "") {
3352
+ const t = er[e];
3353
+ return !!(this.getFormat() & t);
3354
+ }
3355
+ return !1;
3356
+ }
3357
+ select(e, t) {
3358
+ q();
3359
+ const r = I();
3360
+ let s = e, i = t;
3361
+ const o = this.getChildrenSize();
3362
+ if (!this.canBeEmpty()) {
3363
+ if (e === 0 && t === 0) {
3364
+ const c = this.getFirstChild();
3365
+ if (N(c) || v(c)) return c.select(0, 0);
3366
+ } else if (!(e !== void 0 && e !== o || t !== void 0 && t !== o)) {
3367
+ const c = this.getLastChild();
3368
+ if (N(c) || v(c)) return c.select();
3369
+ }
3370
+ }
3371
+ s === void 0 && (s = o), i === void 0 && (i = o);
3372
+ const l = this.__key;
3373
+ return F(r) ? (r.anchor.set(l, s, "element"), r.focus.set(l, i, "element"), r.dirty = !0, r) : ks(l, s, l, i, "element", "element");
3374
+ }
3375
+ selectStart() {
3376
+ const e = this.getFirstDescendant();
3377
+ return e ? e.selectStart() : this.select();
3378
+ }
3379
+ selectEnd() {
3380
+ const e = this.getLastDescendant();
3381
+ return e ? e.selectEnd() : this.select();
3382
+ }
3383
+ clear() {
3384
+ const e = this.getWritable();
3385
+ return this.getChildren().forEach((t) => t.remove()), e;
3386
+ }
3387
+ append(...e) {
3388
+ return this.splice(this.getChildrenSize(), 0, e);
3389
+ }
3390
+ setDirection(e) {
3391
+ const t = this.getWritable();
3392
+ return t.__dir = e, t;
3393
+ }
3394
+ setFormat(e) {
3395
+ return this.getWritable().__format = e !== "" ? er[e] : 0, this;
3396
+ }
3397
+ setStyle(e) {
3398
+ return this.getWritable().__style = e || "", this;
3399
+ }
3400
+ setIndent(e) {
3401
+ return this.getWritable().__indent = e, this;
3402
+ }
3403
+ splice(e, t, r) {
3404
+ const s = r.length, i = this.getChildrenSize(), o = this.getWritable(), l = o.__key, c = [], a = [], u = this.getChildAtIndex(e + t);
3405
+ let h = null, f = i - t + s;
3406
+ if (e !== 0) if (e === i) h = this.getLastChild();
3407
+ else {
3408
+ const g = this.getChildAtIndex(e);
3409
+ g !== null && (h = g.getPreviousSibling());
3410
+ }
3411
+ if (t > 0) {
3412
+ let g = h === null ? this.getFirstChild() : h.getNextSibling();
3413
+ for (let p = 0; p < t; p++) {
3414
+ g === null && b(100);
3415
+ const _ = g.getNextSibling(), m = g.__key;
3416
+ Ne(g.getWritable()), a.push(m), g = _;
3417
+ }
3418
+ }
3419
+ let d = h;
3420
+ for (let g = 0; g < s; g++) {
3421
+ const p = r[g];
3422
+ d !== null && p.is(d) && (h = d = d.getPreviousSibling());
3423
+ const _ = p.getWritable();
3424
+ _.__parent === l && f--, Ne(_);
3425
+ const m = p.__key;
3426
+ if (d === null) o.__first = m, _.__prev = null;
3427
+ else {
3428
+ const y = d.getWritable();
3429
+ y.__next = m, _.__prev = y.__key;
3430
+ }
3431
+ p.__key === l && b(76), _.__parent = l, c.push(m), d = p;
3432
+ }
3433
+ if (e + t === i)
3434
+ d !== null && (d.getWritable().__next = null, o.__last = d.__key);
3435
+ else if (u !== null) {
3436
+ const g = u.getWritable();
3437
+ if (d !== null) {
3438
+ const p = d.getWritable();
3439
+ g.__prev = d.__key, p.__next = u.__key;
3440
+ } else g.__prev = null;
3441
+ }
3442
+ if (o.__size = f, a.length) {
3443
+ const g = I();
3444
+ if (F(g)) {
3445
+ const p = new Set(a), _ = new Set(c), { anchor: m, focus: y } = g;
3446
+ zr(m, p, _) && Ot(m, m.getNode(), this, h, u), zr(y, p, _) && Ot(y, y.getNode(), this, h, u), f !== 0 || this.canBeEmpty() || Pe(this) || this.remove();
3447
+ }
3448
+ }
3449
+ return o;
3450
+ }
3451
+ exportDOM(e) {
3452
+ const { element: t } = super.exportDOM(e);
3453
+ if (t && Jt(t)) {
3454
+ const r = this.getIndent();
3455
+ r > 0 && (t.style.paddingInlineStart = 40 * r + "px");
3456
+ }
3457
+ return { element: t };
3458
+ }
3459
+ exportJSON() {
3460
+ return { children: [], direction: this.getDirection(), format: this.getFormatType(), indent: this.getIndent(), type: "element", version: 1 };
3461
+ }
3462
+ insertNewAfter(e, t) {
3463
+ return null;
3464
+ }
3465
+ canIndent() {
3466
+ return !0;
3467
+ }
3468
+ collapseAtStart(e) {
3469
+ return !1;
3470
+ }
3471
+ excludeFromCopy(e) {
3472
+ return !1;
3473
+ }
3474
+ canReplaceWith(e) {
3475
+ return !0;
3476
+ }
3477
+ canInsertAfter(e) {
3478
+ return !0;
3479
+ }
3480
+ canBeEmpty() {
3481
+ return !0;
3482
+ }
3483
+ canInsertTextBefore() {
3484
+ return !0;
3485
+ }
3486
+ canInsertTextAfter() {
3487
+ return !0;
3488
+ }
3489
+ isInline() {
3490
+ return !1;
3491
+ }
3492
+ isShadowRoot() {
3493
+ return !1;
3494
+ }
3495
+ canMergeWith(e) {
3496
+ return !1;
3497
+ }
3498
+ extractWithChild(e, t, r) {
3499
+ return !1;
3500
+ }
3501
+ canMergeWhenEmpty() {
3502
+ return !1;
3503
+ }
3504
+ }
3505
+ function v(n) {
3506
+ return n instanceof Qt;
3507
+ }
3508
+ function zr(n, e, t) {
3509
+ let r = n.getNode();
3510
+ for (; r; ) {
3511
+ const s = r.__key;
3512
+ if (e.has(s) && !t.has(s)) return !0;
3513
+ r = r.getParent();
3514
+ }
3515
+ return !1;
3516
+ }
3517
+ class Vi extends Vt {
3518
+ constructor(e) {
3519
+ super(e);
3520
+ }
3521
+ decorate(e, t) {
3522
+ b(47);
3523
+ }
3524
+ isIsolated() {
3525
+ return !1;
3526
+ }
3527
+ isInline() {
3528
+ return !0;
3529
+ }
3530
+ isKeyboardSelectable() {
3531
+ return !0;
3532
+ }
3533
+ }
3534
+ function A(n) {
3535
+ return n instanceof Vi;
3536
+ }
3537
+ class ct extends Qt {
3538
+ static getType() {
3539
+ return "root";
3540
+ }
3541
+ static clone() {
3542
+ return new ct();
3543
+ }
3544
+ constructor() {
3545
+ super("root"), this.__cachedText = null;
3546
+ }
3547
+ getTopLevelElementOrThrow() {
3548
+ b(51);
3549
+ }
3550
+ getTextContent() {
3551
+ const e = this.__cachedText;
3552
+ return !lt() && M()._dirtyType !== Ee || e === null ? super.getTextContent() : e;
3553
+ }
3554
+ remove() {
3555
+ b(52);
3556
+ }
3557
+ replace(e) {
3558
+ b(53);
3559
+ }
3560
+ insertBefore(e) {
3561
+ b(54);
3562
+ }
3563
+ insertAfter(e) {
3564
+ b(55);
3565
+ }
3566
+ updateDOM(e, t) {
3567
+ return !1;
3568
+ }
3569
+ append(...e) {
3570
+ for (let t = 0; t < e.length; t++) {
3571
+ const r = e[t];
3572
+ v(r) || A(r) || b(56);
3573
+ }
3574
+ return super.append(...e);
3575
+ }
3576
+ static importJSON(e) {
3577
+ const t = Z();
3578
+ return t.setFormat(e.format), t.setIndent(e.indent), t.setDirection(e.direction), t;
3579
+ }
3580
+ exportJSON() {
3581
+ return { children: [], direction: this.getDirection(), format: this.getFormatType(), indent: this.getIndent(), type: "root", version: 1 };
3582
+ }
3583
+ collapseAtStart() {
3584
+ return !0;
3585
+ }
3586
+ }
3587
+ function Y(n) {
3588
+ return n instanceof ct;
3589
+ }
3590
+ function jn() {
3591
+ return new Xt(/* @__PURE__ */ new Map([["root", new ct()]]));
3592
+ }
3593
+ function Fs(n) {
3594
+ const e = n.exportJSON(), t = n.constructor;
3595
+ if (e.type !== t.getType() && b(130, t.name), v(n)) {
3596
+ const r = e.children;
3597
+ Array.isArray(r) || b(59, t.name);
3598
+ const s = n.getChildren();
3599
+ for (let i = 0; i < s.length; i++) {
3600
+ const o = Fs(s[i]);
3601
+ r.push(o);
3602
+ }
3603
+ }
3604
+ return e;
3605
+ }
3606
+ class Xt {
3607
+ constructor(e, t) {
3608
+ this._nodeMap = e, this._selection = t || null, this._flushSync = !1, this._readOnly = !1;
3609
+ }
3610
+ isEmpty() {
3611
+ return this._nodeMap.size === 1 && this._selection === null;
3612
+ }
3613
+ read(e, t) {
3614
+ return Ar(t && t.editor || null, this, e);
3615
+ }
3616
+ clone(e) {
3617
+ const t = new Xt(this._nodeMap, e === void 0 ? this._selection : e);
3618
+ return t._readOnly = !0, t;
3619
+ }
3620
+ toJSON() {
3621
+ return Ar(null, this, () => ({ root: Fs(Z()) }));
3622
+ }
3623
+ }
3624
+ class ji extends Qt {
3625
+ static getType() {
3626
+ return "artificial";
3627
+ }
3628
+ createDOM(e) {
3629
+ return document.createElement("div");
3630
+ }
3631
+ }
3632
+ class We extends Qt {
3633
+ constructor(e) {
3634
+ super(e), this.__textFormat = 0, this.__textStyle = "";
3635
+ }
3636
+ static getType() {
3637
+ return "paragraph";
3638
+ }
3639
+ getTextFormat() {
3640
+ return this.getLatest().__textFormat;
3641
+ }
3642
+ setTextFormat(e) {
3643
+ const t = this.getWritable();
3644
+ return t.__textFormat = e, t;
3645
+ }
3646
+ hasTextFormat(e) {
3647
+ const t = ce[e];
3648
+ return !!(this.getTextFormat() & t);
3649
+ }
3650
+ getFormatFlags(e, t) {
3651
+ return bt(this.getLatest().__textFormat, e, t);
3652
+ }
3653
+ getTextStyle() {
3654
+ return this.getLatest().__textStyle;
3655
+ }
3656
+ setTextStyle(e) {
3657
+ const t = this.getWritable();
3658
+ return t.__textStyle = e, t;
3659
+ }
3660
+ static clone(e) {
3661
+ return new We(e.__key);
3662
+ }
3663
+ afterCloneFrom(e) {
3664
+ super.afterCloneFrom(e), this.__textFormat = e.__textFormat, this.__textStyle = e.__textStyle;
3665
+ }
3666
+ createDOM(e) {
3667
+ const t = document.createElement("p"), r = qe(e.theme, "paragraph");
3668
+ return r !== void 0 && t.classList.add(...r), t;
3669
+ }
3670
+ updateDOM(e, t, r) {
3671
+ return !1;
3672
+ }
3673
+ static importDOM() {
3674
+ return { p: (e) => ({ conversion: Hi, priority: 0 }) };
3675
+ }
3676
+ exportDOM(e) {
3677
+ const { element: t } = super.exportDOM(e);
3678
+ if (t && Jt(t)) {
3679
+ this.isEmpty() && t.append(document.createElement("br"));
3680
+ const r = this.getFormatType();
3681
+ t.style.textAlign = r;
3682
+ const s = this.getDirection();
3683
+ s && (t.dir = s);
3684
+ }
3685
+ return { element: t };
3686
+ }
3687
+ static importJSON(e) {
3688
+ const t = ve();
3689
+ return t.setFormat(e.format), t.setIndent(e.indent), t.setDirection(e.direction), t.setTextFormat(e.textFormat), t;
3690
+ }
3691
+ exportJSON() {
3692
+ return { ...super.exportJSON(), textFormat: this.getTextFormat(), textStyle: this.getTextStyle(), type: "paragraph", version: 1 };
3693
+ }
3694
+ insertNewAfter(e, t) {
3695
+ const r = ve();
3696
+ r.setTextFormat(e.format), r.setTextStyle(e.style);
3697
+ const s = this.getDirection();
3698
+ return r.setDirection(s), r.setFormat(this.getFormatType()), r.setStyle(this.getTextStyle()), this.insertAfter(r, t), r;
3699
+ }
3700
+ collapseAtStart() {
3701
+ const e = this.getChildren();
3702
+ if (e.length === 0 || N(e[0]) && e[0].getTextContent().trim() === "") {
3703
+ if (this.getNextSibling() !== null) return this.selectNext(), this.remove(), !0;
3704
+ if (this.getPreviousSibling() !== null) return this.selectPrevious(), this.remove(), !0;
3705
+ }
3706
+ return !1;
3707
+ }
3708
+ }
3709
+ function Hi(n) {
3710
+ const e = ve();
3711
+ return n.style && (e.setFormat(n.style.textAlign), Pi(n, e)), { node: e };
3712
+ }
3713
+ function ve() {
3714
+ return $t(new We());
3715
+ }
3716
+ function bn(n) {
3717
+ return n instanceof We;
3718
+ }
3719
+ const po = 0, yo = 1, mo = 3, xo = 4;
3720
+ function Ds(n, e, t, r) {
3721
+ const s = n._keyToDOMMap;
3722
+ s.clear(), n._editorState = jn(), n._pendingEditorState = r, n._compositionKey = null, n._dirtyType = Ee, n._cloneNotNeeded.clear(), n._dirtyLeaves = /* @__PURE__ */ new Set(), n._dirtyElements.clear(), n._normalizedNodes = /* @__PURE__ */ new Set(), n._updateTags = /* @__PURE__ */ new Set(), n._updates = [], n._blockCursorElement = null;
3723
+ const i = n._observer;
3724
+ i !== null && (i.disconnect(), n._observer = null), e !== null && (e.textContent = ""), t !== null && (t.textContent = "", s.set("root", t));
3725
+ }
3726
+ function vo(n) {
3727
+ const e = n || {}, t = Ui(), r = e.theme || {}, s = n === void 0 ? t : e.parentEditor || null, i = e.disableEvents || !1, o = jn(), l = e.namespace || (s !== null ? s._config.namespace : rs()), c = e.editorState, a = [ct, ze, st, it, We, ji, ...e.nodes || []], { onError: u, html: h } = e, f = e.editable === void 0 || e.editable;
3728
+ let d;
3729
+ if (n === void 0 && t !== null) d = t._nodes;
3730
+ else {
3731
+ d = /* @__PURE__ */ new Map();
3732
+ for (let p = 0; p < a.length; p++) {
3733
+ let _ = a[p], m = null, y = null;
3734
+ if (typeof _ != "function") {
3735
+ const x = _;
3736
+ _ = x.replace, m = x.with, y = x.withKlass || null;
3737
+ }
3738
+ const S = _.getType(), k = _.transform(), T = /* @__PURE__ */ new Set();
3739
+ k !== null && T.add(k), d.set(S, { exportDOM: h && h.export ? h.export.get(_) : void 0, klass: _, replace: m, replaceWithKlass: y, transforms: T });
3740
+ }
3741
+ }
3742
+ const g = new Yt(o, s, d, { disableEvents: i, namespace: l, theme: r }, u || console.error, function(p, _) {
3743
+ const m = /* @__PURE__ */ new Map(), y = /* @__PURE__ */ new Set(), S = (k) => {
3744
+ Object.keys(k).forEach((T) => {
3745
+ let x = m.get(T);
3746
+ x === void 0 && (x = [], m.set(T, x)), x.push(k[T]);
3747
+ });
3748
+ };
3749
+ return p.forEach((k) => {
3750
+ const T = k.klass.importDOM;
3751
+ if (T == null || y.has(T)) return;
3752
+ y.add(T);
3753
+ const x = T.call(k.klass);
3754
+ x !== null && S(x);
3755
+ }), _ && S(_), m;
3756
+ }(d, h ? h.import : void 0), f);
3757
+ return c !== void 0 && (g._pendingEditorState = c, g._dirtyType = Me), g;
3758
+ }
3759
+ class Yt {
3760
+ constructor(e, t, r, s, i, o, l) {
3761
+ this._parentEditor = t, this._rootElement = null, this._editorState = e, this._pendingEditorState = null, this._compositionKey = null, this._deferred = [], this._keyToDOMMap = /* @__PURE__ */ new Map(), this._updates = [], this._updating = !1, this._listeners = { decorator: /* @__PURE__ */ new Set(), editable: /* @__PURE__ */ new Set(), mutation: /* @__PURE__ */ new Map(), root: /* @__PURE__ */ new Set(), textcontent: /* @__PURE__ */ new Set(), update: /* @__PURE__ */ new Set() }, this._commands = /* @__PURE__ */ new Map(), this._config = s, this._nodes = r, this._decorators = {}, this._pendingDecorators = null, this._dirtyType = Ee, this._cloneNotNeeded = /* @__PURE__ */ new Set(), this._dirtyLeaves = /* @__PURE__ */ new Set(), this._dirtyElements = /* @__PURE__ */ new Map(), this._normalizedNodes = /* @__PURE__ */ new Set(), this._updateTags = /* @__PURE__ */ new Set(), this._observer = null, this._key = rs(), this._onError = i, this._htmlConversions = o, this._editable = l, this._headless = t !== null && t._headless, this._window = null, this._blockCursorElement = null;
3762
+ }
3763
+ isComposing() {
3764
+ return this._compositionKey != null;
3765
+ }
3766
+ registerUpdateListener(e) {
3767
+ const t = this._listeners.update;
3768
+ return t.add(e), () => {
3769
+ t.delete(e);
3770
+ };
3771
+ }
3772
+ registerEditableListener(e) {
3773
+ const t = this._listeners.editable;
3774
+ return t.add(e), () => {
3775
+ t.delete(e);
3776
+ };
3777
+ }
3778
+ registerDecoratorListener(e) {
3779
+ const t = this._listeners.decorator;
3780
+ return t.add(e), () => {
3781
+ t.delete(e);
3782
+ };
3783
+ }
3784
+ registerTextContentListener(e) {
3785
+ const t = this._listeners.textcontent;
3786
+ return t.add(e), () => {
3787
+ t.delete(e);
3788
+ };
3789
+ }
3790
+ registerRootListener(e) {
3791
+ const t = this._listeners.root;
3792
+ return e(this._rootElement, null), t.add(e), () => {
3793
+ e(null, this._rootElement), t.delete(e);
3794
+ };
3795
+ }
3796
+ registerCommand(e, t, r) {
3797
+ r === void 0 && b(35);
3798
+ const s = this._commands;
3799
+ s.has(e) || s.set(e, [/* @__PURE__ */ new Set(), /* @__PURE__ */ new Set(), /* @__PURE__ */ new Set(), /* @__PURE__ */ new Set(), /* @__PURE__ */ new Set()]);
3800
+ const i = s.get(e);
3801
+ i === void 0 && b(36, String(e));
3802
+ const o = i[r];
3803
+ return o.add(t), () => {
3804
+ o.delete(t), i.every((l) => l.size === 0) && s.delete(e);
3805
+ };
3806
+ }
3807
+ registerMutationListener(e, t, r) {
3808
+ const s = this.resolveRegisteredNodeAfterReplacements(this.getRegisteredNode(e)).klass, i = this._listeners.mutation;
3809
+ i.set(t, s);
3810
+ const o = r && r.skipInitialization;
3811
+ return o === void 0 || o || this.initializeMutationListener(t, s), () => {
3812
+ i.delete(t);
3813
+ };
3814
+ }
3815
+ getRegisteredNode(e) {
3816
+ const t = this._nodes.get(e.getType());
3817
+ return t === void 0 && b(37, e.name), t;
3818
+ }
3819
+ resolveRegisteredNodeAfterReplacements(e) {
3820
+ for (; e.replaceWithKlass; ) e = this.getRegisteredNode(e.replaceWithKlass);
3821
+ return e;
3822
+ }
3823
+ initializeMutationListener(e, t) {
3824
+ const r = this._editorState, s = Ni(r).get(t.getType());
3825
+ if (!s) return;
3826
+ const i = /* @__PURE__ */ new Map();
3827
+ for (const o of s.keys()) i.set(o, "created");
3828
+ i.size > 0 && e(i, { dirtyLeaves: /* @__PURE__ */ new Set(), prevEditorState: r, updateTags: /* @__PURE__ */ new Set(["registerMutationListener"]) });
3829
+ }
3830
+ registerNodeTransformToKlass(e, t) {
3831
+ const r = this.getRegisteredNode(e);
3832
+ return r.transforms.add(t), r;
3833
+ }
3834
+ registerNodeTransform(e, t) {
3835
+ const r = this.registerNodeTransformToKlass(e, t), s = [r], i = r.replaceWithKlass;
3836
+ if (i != null) {
3837
+ const c = this.registerNodeTransformToKlass(i, t);
3838
+ s.push(c);
3839
+ }
3840
+ var o, l;
3841
+ return o = this, l = e.getType(), X(o, () => {
3842
+ const c = fe();
3843
+ if (c.isEmpty()) return;
3844
+ if (l === "root") return void Z().markDirty();
3845
+ const a = c._nodeMap;
3846
+ for (const [, u] of a) u.markDirty();
3847
+ }, o._pendingEditorState === null ? { tag: "history-merge" } : void 0), () => {
3848
+ s.forEach((c) => c.transforms.delete(t));
3849
+ };
3850
+ }
3851
+ hasNode(e) {
3852
+ return this._nodes.has(e.getType());
3853
+ }
3854
+ hasNodes(e) {
3855
+ return e.every(this.hasNode.bind(this));
3856
+ }
3857
+ dispatchCommand(e, t) {
3858
+ return w(this, e, t);
3859
+ }
3860
+ getDecorators() {
3861
+ return this._decorators;
3862
+ }
3863
+ getRootElement() {
3864
+ return this._rootElement;
3865
+ }
3866
+ getKey() {
3867
+ return this._key;
3868
+ }
3869
+ setRootElement(e) {
3870
+ const t = this._rootElement;
3871
+ if (e !== t) {
3872
+ const r = qe(this._config.theme, "root"), s = this._pendingEditorState || this._editorState;
3873
+ if (this._rootElement = e, Ds(this, t, e, s), t !== null && (this._config.disableEvents || Oi(t), r != null && t.classList.remove(...r)), e !== null) {
3874
+ const i = function(l) {
3875
+ const c = l.ownerDocument;
3876
+ return c && c.defaultView || null;
3877
+ }(e), o = e.style;
3878
+ o.userSelect = "text", o.whiteSpace = "pre-wrap", o.wordBreak = "break-word", e.setAttribute("data-lexical-editor", "true"), this._window = i, this._dirtyType = Me, Qr(this), this._updateTags.add("history-merge"), me(this), this._config.disableEvents || function(l, c) {
3879
+ const a = l.ownerDocument, u = Dt.get(a);
3880
+ (u === void 0 || u < 1) && a.addEventListener("selectionchange", xs), Dt.set(a, (u || 0) + 1), l.__lexicalEditor = c;
3881
+ const h = ms(l);
3882
+ for (let f = 0; f < Sn.length; f++) {
3883
+ const [d, g] = Sn[f], p = typeof g == "function" ? (_) => {
3884
+ xr(_) || (mr(_), (c.isEditable() || d === "click") && g(_, c));
3885
+ } : (_) => {
3886
+ if (xr(_)) return;
3887
+ mr(_);
3888
+ const m = c.isEditable();
3889
+ switch (d) {
3890
+ case "cut":
3891
+ return m && w(c, $r, _);
3892
+ case "copy":
3893
+ return w(c, Kr, _);
3894
+ case "paste":
3895
+ return m && w(c, Wr, _);
3896
+ case "dragstart":
3897
+ return m && w(c, js, _);
3898
+ case "dragover":
3899
+ return m && w(c, Hs, _);
3900
+ case "dragend":
3901
+ return m && w(c, qs, _);
3902
+ case "focus":
3903
+ return m && w(c, Qs, _);
3904
+ case "blur":
3905
+ return m && w(c, Xs, _);
3906
+ case "drop":
3907
+ return m && w(c, Vs, _);
3908
+ }
3909
+ };
3910
+ l.addEventListener(d, p), h.push(() => {
3911
+ l.removeEventListener(d, p);
3912
+ });
3913
+ }
3914
+ }(e, this), r != null && e.classList.add(...r);
3915
+ } else this._editorState = s, this._pendingEditorState = null, this._window = null;
3916
+ Ze("root", this, !1, e, t);
3917
+ }
3918
+ }
3919
+ getElementByKey(e) {
3920
+ return this._keyToDOMMap.get(e) || null;
3921
+ }
3922
+ getEditorState() {
3923
+ return this._editorState;
3924
+ }
3925
+ setEditorState(e, t) {
3926
+ e.isEmpty() && b(38), qr(this);
3927
+ const r = this._pendingEditorState, s = this._updateTags, i = t !== void 0 ? t.tag : null;
3928
+ r === null || r.isEmpty() || (i != null && s.add(i), me(this)), this._pendingEditorState = e, this._dirtyType = Me, this._dirtyElements.set("root", !1), this._compositionKey = null, i != null && s.add(i), me(this);
3929
+ }
3930
+ parseEditorState(e, t) {
3931
+ return function(r, s, i) {
3932
+ const o = jn(), l = R, c = Q, a = K, u = s._dirtyElements, h = s._dirtyLeaves, f = s._cloneNotNeeded, d = s._dirtyType;
3933
+ s._dirtyElements = /* @__PURE__ */ new Map(), s._dirtyLeaves = /* @__PURE__ */ new Set(), s._cloneNotNeeded = /* @__PURE__ */ new Set(), s._dirtyType = 0, R = o, Q = !1, K = s;
3934
+ try {
3935
+ const g = s._nodes;
3936
+ Vn(r.root, g), i && i(), o._readOnly = !0;
3937
+ } catch (g) {
3938
+ g instanceof Error && s._onError(g);
3939
+ } finally {
3940
+ s._dirtyElements = u, s._dirtyLeaves = h, s._cloneNotNeeded = f, s._dirtyType = d, R = l, Q = c, K = a;
3941
+ }
3942
+ return o;
3943
+ }(typeof e == "string" ? JSON.parse(e) : e, this, t);
3944
+ }
3945
+ read(e) {
3946
+ return me(this), this.getEditorState().read(e, { editor: this });
3947
+ }
3948
+ update(e, t) {
3949
+ X(this, e, t);
3950
+ }
3951
+ focus(e, t = {}) {
3952
+ const r = this._rootElement;
3953
+ r !== null && (r.setAttribute("autocapitalize", "off"), X(this, () => {
3954
+ const s = I(), i = Z();
3955
+ s !== null ? s.dirty = !0 : i.getChildrenSize() !== 0 && (t.defaultSelection === "rootStart" ? i.selectStart() : i.selectEnd());
3956
+ }, { onUpdate: () => {
3957
+ r.removeAttribute("autocapitalize"), e && e();
3958
+ }, tag: "focus" }), this._pendingEditorState === null && r.removeAttribute("autocapitalize"));
3959
+ }
3960
+ blur() {
3961
+ const e = this._rootElement;
3962
+ e !== null && e.blur();
3963
+ const t = se(this._window);
3964
+ t !== null && t.removeAllRanges();
3965
+ }
3966
+ isEditable() {
3967
+ return this._editable;
3968
+ }
3969
+ setEditable(e) {
3970
+ this._editable !== e && (this._editable = e, Ze("editable", this, !0, e));
3971
+ }
3972
+ toJSON() {
3973
+ return { editorState: this._editorState.toJSON() };
3974
+ }
3975
+ }
3976
+ Yt.version = "0.20.0+prod.esm";
3977
+ export {
3978
+ Os as $,
3979
+ Qi as A,
3980
+ wn as B,
3981
+ Wt as C,
3982
+ ve as D,
3983
+ ot as E,
3984
+ ue as F,
3985
+ ho as G,
3986
+ V as H,
3987
+ yo as I,
3988
+ Qs as J,
3989
+ fo as K,
3990
+ bn as L,
3991
+ I as M,
3992
+ Us as N,
3993
+ Z as O,
3994
+ yi as P,
3995
+ lt as Q,
3996
+ ce as R,
3997
+ Jt as S,
3998
+ A as T,
3999
+ ie as U,
4000
+ Ae as V,
4001
+ We as W,
4002
+ ze as X,
4003
+ Wr as Y,
4004
+ oo as Z,
4005
+ so as _,
4006
+ lo as a,
4007
+ po as a0,
4008
+ Ls as a1,
4009
+ ro as a2,
4010
+ no as a3,
4011
+ Br as a4,
4012
+ Rr as a5,
4013
+ Ht as a6,
4014
+ br as a7,
4015
+ dr as a8,
4016
+ Y as a9,
4017
+ Yr as aA,
4018
+ to as aB,
4019
+ eo as aC,
4020
+ ji as aa,
4021
+ nt as ab,
4022
+ Ei as ac,
4023
+ co as ad,
4024
+ uo as ae,
4025
+ hr as af,
4026
+ bi as ag,
4027
+ Un as ah,
4028
+ _o as ai,
4029
+ Kr as aj,
4030
+ Mt as ak,
4031
+ ao as al,
4032
+ vo as am,
4033
+ Xr as an,
4034
+ Gn as ao,
4035
+ io as ap,
4036
+ Hs as aq,
4037
+ js as ar,
4038
+ Vs as as,
4039
+ dn as at,
4040
+ gt as au,
4041
+ Zi as av,
4042
+ Yi as aw,
4043
+ Xi as ax,
4044
+ go as ay,
4045
+ Zn as az,
4046
+ N as b,
4047
+ $ as c,
4048
+ $t as d,
4049
+ Bs as e,
4050
+ mo as f,
4051
+ Ws as g,
4052
+ Ms as h,
4053
+ $s as i,
4054
+ mt as j,
4055
+ xt as k,
4056
+ Ks as l,
4057
+ Qt as m,
4058
+ $r as n,
4059
+ Yn as o,
4060
+ Is as p,
4061
+ we as q,
4062
+ Gi as r,
4063
+ yt as s,
4064
+ qi as t,
4065
+ Pe as u,
4066
+ F as v,
4067
+ Js as w,
4068
+ v as x,
4069
+ He as y,
4070
+ xo as z
4071
+ };
4072
+ //# sourceMappingURL=Lexical.prod-DSqOWcE1.js.map