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