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