@uva-glass/component-library 3.0.7 → 3.0.9

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