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