@arkitektbedriftene/fe-lib 0.3.7 → 0.3.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{Popover-e50ca73e.js → Popover-2318823a.js} +75 -83
- package/dist/lib/rich-text/Editor.d.ts +2 -3
- package/dist/lib/rich-text/editorContext.d.ts +18 -0
- package/dist/lib/rich-text/rich-text.d.ts +1 -0
- package/dist/lib/ui/components/Spinner.d.ts +1 -1
- package/dist/rich-text.es.js +134 -1438
- package/dist/ui.es.js +2 -2
- package/package.json +1 -1
- package/src/lib/rich-text/Editor.tsx +7 -8
- package/src/lib/rich-text/{editorFocus.ts → editorContext.ts} +6 -4
- package/src/lib/rich-text/rich-text.ts +2 -1
- package/vite.config.ts +1 -7
- package/dist/lib/rich-text/editorFocus.d.ts +0 -12
package/dist/rich-text.es.js
CHANGED
|
@@ -1,1430 +1,124 @@
|
|
|
1
|
-
import { createHeadlessEditor as
|
|
2
|
-
import { $generateHtmlFromNodes as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import { AutoLinkNode as
|
|
6
|
-
import { ListNode as
|
|
7
|
-
import
|
|
8
|
-
import { TableNode as
|
|
9
|
-
import { j as
|
|
10
|
-
import {
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
1
|
+
import { createHeadlessEditor as C } from "@lexical/headless";
|
|
2
|
+
import { $generateHtmlFromNodes as N } from "@lexical/html";
|
|
3
|
+
import { $getRoot as p, ParagraphNode as T, $createParagraphNode as y, $createTextNode as $ } from "lexical";
|
|
4
|
+
import { trimTextContentFromAnchor as S } from "@lexical/selection";
|
|
5
|
+
import { AutoLinkNode as E, LinkNode as v } from "@lexical/link";
|
|
6
|
+
import { ListNode as w, ListItemNode as j } from "@lexical/list";
|
|
7
|
+
import { HeadingNode as F, QuoteNode as L } from "@lexical/rich-text";
|
|
8
|
+
import { TableNode as R, TableRowNode as H, TableCellNode as k } from "@lexical/table";
|
|
9
|
+
import { j as i } from "./jsx-runtime-d0aa4c5b.js";
|
|
10
|
+
import { createContext as P, useState as B, useRef as h, useCallback as u, useContext as I, useMemo as M } from "react";
|
|
11
|
+
import { c as m, s as f, B as x, S as z } from "./Popover-2318823a.js";
|
|
12
|
+
import { LexicalComposer as q } from "@lexical/react/LexicalComposer";
|
|
13
|
+
import { RichTextPlugin as A } from "@lexical/react/LexicalRichTextPlugin";
|
|
14
|
+
import { ContentEditable as D } from "@lexical/react/LexicalContentEditable";
|
|
15
|
+
import V from "@lexical/react/LexicalErrorBoundary";
|
|
16
|
+
import "react-dom";
|
|
17
|
+
const W = ({
|
|
18
|
+
text: e,
|
|
19
|
+
maxChars: a,
|
|
20
|
+
maxLines: n
|
|
17
21
|
}) => {
|
|
18
|
-
if (
|
|
22
|
+
if (e.length === 0)
|
|
19
23
|
return 0;
|
|
20
|
-
const
|
|
21
|
-
if (!
|
|
22
|
-
return
|
|
23
|
-
let
|
|
24
|
-
for (;
|
|
25
|
-
|
|
26
|
-
` &&
|
|
27
|
-
return
|
|
28
|
-
},
|
|
29
|
-
editor:
|
|
30
|
-
maxChars:
|
|
31
|
-
maxLines:
|
|
24
|
+
const r = typeof n == "number", o = typeof a == "number";
|
|
25
|
+
if (!r && !o)
|
|
26
|
+
return e.length;
|
|
27
|
+
let s = 0, t = 0;
|
|
28
|
+
for (; t < e.length && (!r || s < n) && (!o || t < a); )
|
|
29
|
+
e[t] === `
|
|
30
|
+
` && s++, t++;
|
|
31
|
+
return e.slice(0, t).length;
|
|
32
|
+
}, J = ({
|
|
33
|
+
editor: e,
|
|
34
|
+
maxChars: a,
|
|
35
|
+
maxLines: n
|
|
32
36
|
}) => {
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
const
|
|
36
|
-
return
|
|
37
|
-
},
|
|
38
|
-
let
|
|
39
|
-
const
|
|
40
|
-
nodes:
|
|
37
|
+
const r = p(), o = r.getTextContent(), s = W({ text: o, maxChars: a, maxLines: n }), t = o.length - s, l = r.select().anchor;
|
|
38
|
+
S(e, l, t);
|
|
39
|
+
const d = r.getLastChild();
|
|
40
|
+
return d instanceof T && d.getChildrenSize() === 0 && d.remove(), t;
|
|
41
|
+
}, O = (e) => e[0] === "{", ge = (e, a, n) => {
|
|
42
|
+
let r = 0;
|
|
43
|
+
const o = C({
|
|
44
|
+
nodes: a,
|
|
41
45
|
editable: !1
|
|
42
46
|
});
|
|
43
|
-
if (
|
|
47
|
+
if (e)
|
|
44
48
|
try {
|
|
45
|
-
if (typeof
|
|
46
|
-
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
+
if (typeof e == "string" && !O(e))
|
|
50
|
+
o.update(() => {
|
|
51
|
+
const t = p(), c = y();
|
|
52
|
+
c.append($(e.trim())), t.append(c);
|
|
49
53
|
});
|
|
50
54
|
else {
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
editor:
|
|
54
|
-
maxLines:
|
|
55
|
+
const t = o.parseEditorState(e, () => {
|
|
56
|
+
r = J({
|
|
57
|
+
editor: o,
|
|
58
|
+
maxLines: n == null ? void 0 : n.maxLines
|
|
55
59
|
});
|
|
56
60
|
});
|
|
57
|
-
|
|
58
|
-
}
|
|
59
|
-
} catch (e) {
|
|
60
|
-
console.error(e);
|
|
61
|
-
}
|
|
62
|
-
let p = "";
|
|
63
|
-
return d.update(() => {
|
|
64
|
-
p = Ve(d);
|
|
65
|
-
}), { html: p, trimCount: C };
|
|
66
|
-
}, lr = [
|
|
67
|
-
Xe,
|
|
68
|
-
Ze,
|
|
69
|
-
Ye,
|
|
70
|
-
Qe,
|
|
71
|
-
Ge,
|
|
72
|
-
Je,
|
|
73
|
-
et,
|
|
74
|
-
tt,
|
|
75
|
-
rt
|
|
76
|
-
];
|
|
77
|
-
var z = {}, B = {}, ce;
|
|
78
|
-
function dt() {
|
|
79
|
-
if (ce)
|
|
80
|
-
return B;
|
|
81
|
-
ce = 1;
|
|
82
|
-
var l = q;
|
|
83
|
-
const s = /* @__PURE__ */ l.createContext(null);
|
|
84
|
-
function g(d, p) {
|
|
85
|
-
let e = null;
|
|
86
|
-
d != null && (e = d[1]);
|
|
87
|
-
function t() {
|
|
88
|
-
return p ?? (e != null ? e.getTheme() : null);
|
|
89
|
-
}
|
|
90
|
-
return {
|
|
91
|
-
getTheme: t
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
function C() {
|
|
95
|
-
const d = l.useContext(s);
|
|
96
|
-
if (d == null)
|
|
97
|
-
throw Error("LexicalComposerContext.useLexicalComposerContext: cannot find a LexicalComposerContext");
|
|
98
|
-
return d;
|
|
99
|
-
}
|
|
100
|
-
return B.LexicalComposerContext = s, B.createLexicalComposerContext = g, B.useLexicalComposerContext = C, B;
|
|
101
|
-
}
|
|
102
|
-
var I = {}, ue;
|
|
103
|
-
function ft() {
|
|
104
|
-
if (ue)
|
|
105
|
-
return I;
|
|
106
|
-
ue = 1;
|
|
107
|
-
var l = q;
|
|
108
|
-
function s(C) {
|
|
109
|
-
let d = new URLSearchParams();
|
|
110
|
-
d.append("code", C);
|
|
111
|
-
for (let p = 1; p < arguments.length; p++)
|
|
112
|
-
d.append("v", arguments[p]);
|
|
113
|
-
throw Error(`Minified Lexical error #${C}; visit https://lexical.dev/docs/error?${d} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`);
|
|
114
|
-
}
|
|
115
|
-
let g = l.createContext(null);
|
|
116
|
-
return I.LexicalComposerContext = g, I.createLexicalComposerContext = function(C, d) {
|
|
117
|
-
let p = null;
|
|
118
|
-
return C != null && (p = C[1]), { getTheme: function() {
|
|
119
|
-
return d ?? (p != null ? p.getTheme() : null);
|
|
120
|
-
} };
|
|
121
|
-
}, I.useLexicalComposerContext = function() {
|
|
122
|
-
let C = l.useContext(g);
|
|
123
|
-
return C == null && s(8), C;
|
|
124
|
-
}, I;
|
|
125
|
-
}
|
|
126
|
-
var H, de;
|
|
127
|
-
function M() {
|
|
128
|
-
return de || (de = 1, H = process.env.NODE_ENV === "development" ? dt() : ft()), H;
|
|
129
|
-
}
|
|
130
|
-
var fe;
|
|
131
|
-
function pt() {
|
|
132
|
-
if (fe)
|
|
133
|
-
return z;
|
|
134
|
-
fe = 1;
|
|
135
|
-
var l = M(), s = A, g = q;
|
|
136
|
-
const C = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u";
|
|
137
|
-
var p = C ? g.useLayoutEffect : g.useEffect;
|
|
138
|
-
const e = {
|
|
139
|
-
tag: "history-merge"
|
|
140
|
-
};
|
|
141
|
-
function t({
|
|
142
|
-
initialConfig: o,
|
|
143
|
-
children: r
|
|
144
|
-
}) {
|
|
145
|
-
const i = g.useMemo(
|
|
146
|
-
() => {
|
|
147
|
-
const {
|
|
148
|
-
theme: u,
|
|
149
|
-
namespace: f,
|
|
150
|
-
editor__DEPRECATED: a,
|
|
151
|
-
nodes: h,
|
|
152
|
-
onError: v,
|
|
153
|
-
editorState: E
|
|
154
|
-
} = o, $ = l.createLexicalComposerContext(null, u);
|
|
155
|
-
let c = a || null;
|
|
156
|
-
if (c === null) {
|
|
157
|
-
const m = s.createEditor({
|
|
158
|
-
editable: o.editable,
|
|
159
|
-
namespace: f,
|
|
160
|
-
nodes: h,
|
|
161
|
-
onError: (x) => v(x, m),
|
|
162
|
-
theme: u
|
|
163
|
-
});
|
|
164
|
-
n(m, E), c = m;
|
|
165
|
-
}
|
|
166
|
-
return [c, $];
|
|
167
|
-
},
|
|
168
|
-
// We only do this for init
|
|
169
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
170
|
-
[]
|
|
171
|
-
);
|
|
172
|
-
return p(() => {
|
|
173
|
-
const u = o.editable, [f] = i;
|
|
174
|
-
f.setEditable(u !== void 0 ? u : !0);
|
|
175
|
-
}, []), /* @__PURE__ */ g.createElement(l.LexicalComposerContext.Provider, {
|
|
176
|
-
value: i
|
|
177
|
-
}, r);
|
|
178
|
-
}
|
|
179
|
-
function n(o, r) {
|
|
180
|
-
if (r !== null) {
|
|
181
|
-
if (r === void 0)
|
|
182
|
-
o.update(() => {
|
|
183
|
-
const i = s.$getRoot();
|
|
184
|
-
if (i.isEmpty()) {
|
|
185
|
-
const u = s.$createParagraphNode();
|
|
186
|
-
i.append(u);
|
|
187
|
-
const f = C ? document.activeElement : null;
|
|
188
|
-
(s.$getSelection() !== null || f !== null && f === o.getRootElement()) && u.select();
|
|
189
|
-
}
|
|
190
|
-
}, e);
|
|
191
|
-
else if (r !== null)
|
|
192
|
-
switch (typeof r) {
|
|
193
|
-
case "string": {
|
|
194
|
-
const i = o.parseEditorState(r);
|
|
195
|
-
o.setEditorState(i, e);
|
|
196
|
-
break;
|
|
197
|
-
}
|
|
198
|
-
case "object": {
|
|
199
|
-
o.setEditorState(r, e);
|
|
200
|
-
break;
|
|
201
|
-
}
|
|
202
|
-
case "function": {
|
|
203
|
-
o.update(() => {
|
|
204
|
-
s.$getRoot().isEmpty() && r(o);
|
|
205
|
-
}, e);
|
|
206
|
-
break;
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
return z.LexicalComposer = t, z;
|
|
212
|
-
}
|
|
213
|
-
var K = {}, pe;
|
|
214
|
-
function mt() {
|
|
215
|
-
if (pe)
|
|
216
|
-
return K;
|
|
217
|
-
pe = 1;
|
|
218
|
-
var l = M(), s = A, g = q;
|
|
219
|
-
let C = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u";
|
|
220
|
-
var d = C ? g.useLayoutEffect : g.useEffect;
|
|
221
|
-
let p = { tag: "history-merge" };
|
|
222
|
-
function e(t, n) {
|
|
223
|
-
if (n !== null) {
|
|
224
|
-
if (n === void 0)
|
|
225
|
-
t.update(() => {
|
|
226
|
-
var o = s.$getRoot();
|
|
227
|
-
if (o.isEmpty()) {
|
|
228
|
-
let r = s.$createParagraphNode();
|
|
229
|
-
o.append(r), o = C ? document.activeElement : null, (s.$getSelection() !== null || o !== null && o === t.getRootElement()) && r.select();
|
|
230
|
-
}
|
|
231
|
-
}, p);
|
|
232
|
-
else if (n !== null)
|
|
233
|
-
switch (typeof n) {
|
|
234
|
-
case "string":
|
|
235
|
-
let o = t.parseEditorState(n);
|
|
236
|
-
t.setEditorState(o, p);
|
|
237
|
-
break;
|
|
238
|
-
case "object":
|
|
239
|
-
t.setEditorState(n, p);
|
|
240
|
-
break;
|
|
241
|
-
case "function":
|
|
242
|
-
t.update(() => {
|
|
243
|
-
s.$getRoot().isEmpty() && n(t);
|
|
244
|
-
}, p);
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
return K.LexicalComposer = function({ initialConfig: t, children: n }) {
|
|
249
|
-
let o = g.useMemo(() => {
|
|
250
|
-
const { theme: r, namespace: i, editor__DEPRECATED: u, nodes: f, onError: a, editorState: h } = t, v = l.createLexicalComposerContext(null, r);
|
|
251
|
-
let E = u || null;
|
|
252
|
-
if (E === null) {
|
|
253
|
-
const $ = s.createEditor({ editable: t.editable, namespace: i, nodes: f, onError: (c) => a(c, $), theme: r });
|
|
254
|
-
e($, h), E = $;
|
|
255
|
-
}
|
|
256
|
-
return [E, v];
|
|
257
|
-
}, []);
|
|
258
|
-
return d(() => {
|
|
259
|
-
let r = t.editable, [i] = o;
|
|
260
|
-
i.setEditable(r !== void 0 ? r : !0);
|
|
261
|
-
}, []), g.createElement(l.LexicalComposerContext.Provider, { value: o }, n);
|
|
262
|
-
}, K;
|
|
263
|
-
}
|
|
264
|
-
const gt = process.env.NODE_ENV === "development" ? pt() : mt();
|
|
265
|
-
var xt = gt, W = {}, G, me;
|
|
266
|
-
function ht() {
|
|
267
|
-
if (me)
|
|
268
|
-
return G;
|
|
269
|
-
me = 1;
|
|
270
|
-
var l = M(), s = q, d = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u" ? s.useLayoutEffect : s.useEffect;
|
|
271
|
-
function p(n) {
|
|
272
|
-
const [o] = l.useLexicalComposerContext(), r = s.useMemo(() => n(o), [o, n]), i = s.useRef(r.initialValueFn()), [u, f] = s.useState(i.current);
|
|
273
|
-
return d(() => {
|
|
274
|
-
const {
|
|
275
|
-
initialValueFn: a,
|
|
276
|
-
subscribe: h
|
|
277
|
-
} = r, v = a();
|
|
278
|
-
return i.current !== v && (i.current = v, f(v)), h((E) => {
|
|
279
|
-
i.current = E, f(E);
|
|
280
|
-
});
|
|
281
|
-
}, [r, n]), u;
|
|
282
|
-
}
|
|
283
|
-
function e(n) {
|
|
284
|
-
return {
|
|
285
|
-
initialValueFn: () => n.isEditable(),
|
|
286
|
-
subscribe: (o) => n.registerEditableListener(o)
|
|
287
|
-
};
|
|
288
|
-
}
|
|
289
|
-
function t() {
|
|
290
|
-
return p(e);
|
|
291
|
-
}
|
|
292
|
-
return G = t, G;
|
|
293
|
-
}
|
|
294
|
-
var J, ge;
|
|
295
|
-
function Et() {
|
|
296
|
-
if (ge)
|
|
297
|
-
return J;
|
|
298
|
-
ge = 1;
|
|
299
|
-
var l = M(), s = q, g = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u" ? s.useLayoutEffect : s.useEffect;
|
|
300
|
-
function C(p) {
|
|
301
|
-
let [e] = l.useLexicalComposerContext(), t = s.useMemo(() => p(e), [e, p]), n = s.useRef(t.initialValueFn()), [o, r] = s.useState(n.current);
|
|
302
|
-
return g(() => {
|
|
303
|
-
let { initialValueFn: i, subscribe: u } = t, f = i();
|
|
304
|
-
return n.current !== f && (n.current = f, r(f)), u((a) => {
|
|
305
|
-
n.current = a, r(a);
|
|
306
|
-
});
|
|
307
|
-
}, [t, p]), o;
|
|
308
|
-
}
|
|
309
|
-
function d(p) {
|
|
310
|
-
return { initialValueFn: () => p.isEditable(), subscribe: (e) => p.registerEditableListener(e) };
|
|
311
|
-
}
|
|
312
|
-
return J = function() {
|
|
313
|
-
return C(d);
|
|
314
|
-
}, J;
|
|
315
|
-
}
|
|
316
|
-
var Y, xe;
|
|
317
|
-
function Me() {
|
|
318
|
-
return xe || (xe = 1, Y = process.env.NODE_ENV === "development" ? ht() : Et()), Y;
|
|
319
|
-
}
|
|
320
|
-
var F = {}, he;
|
|
321
|
-
function vt() {
|
|
322
|
-
if (he)
|
|
323
|
-
return F;
|
|
324
|
-
he = 1;
|
|
325
|
-
var l = A;
|
|
326
|
-
function s(n, o) {
|
|
327
|
-
let r = n.getFirstChild(), i = 0;
|
|
328
|
-
e:
|
|
329
|
-
for (; r !== null; ) {
|
|
330
|
-
if (l.$isElementNode(r)) {
|
|
331
|
-
const a = r.getFirstChild();
|
|
332
|
-
if (a !== null) {
|
|
333
|
-
r = a;
|
|
334
|
-
continue;
|
|
335
|
-
}
|
|
336
|
-
} else if (l.$isTextNode(r)) {
|
|
337
|
-
const a = r.getTextContentSize();
|
|
338
|
-
if (i + a > o)
|
|
339
|
-
return {
|
|
340
|
-
node: r,
|
|
341
|
-
offset: o - i
|
|
342
|
-
};
|
|
343
|
-
i += a;
|
|
344
|
-
}
|
|
345
|
-
const u = r.getNextSibling();
|
|
346
|
-
if (u !== null) {
|
|
347
|
-
r = u;
|
|
348
|
-
continue;
|
|
349
|
-
}
|
|
350
|
-
let f = r.getParent();
|
|
351
|
-
for (; f !== null; ) {
|
|
352
|
-
const a = f.getNextSibling();
|
|
353
|
-
if (a !== null) {
|
|
354
|
-
r = a;
|
|
355
|
-
continue e;
|
|
356
|
-
}
|
|
357
|
-
f = f.getParent();
|
|
358
|
-
}
|
|
359
|
-
break;
|
|
360
|
-
}
|
|
361
|
-
return null;
|
|
362
|
-
}
|
|
363
|
-
function g(n, o = !0) {
|
|
364
|
-
if (n)
|
|
365
|
-
return !1;
|
|
366
|
-
let r = d();
|
|
367
|
-
return o && (r = r.trim()), r === "";
|
|
368
|
-
}
|
|
369
|
-
function C(n, o) {
|
|
370
|
-
return () => g(n, o);
|
|
371
|
-
}
|
|
372
|
-
function d() {
|
|
373
|
-
return l.$getRoot().getTextContent();
|
|
374
|
-
}
|
|
375
|
-
function p(n) {
|
|
376
|
-
if (!g(n, !1))
|
|
377
|
-
return !1;
|
|
378
|
-
const r = l.$getRoot().getChildren(), i = r.length;
|
|
379
|
-
if (i > 1)
|
|
380
|
-
return !1;
|
|
381
|
-
for (let u = 0; u < i; u++) {
|
|
382
|
-
const f = r[u];
|
|
383
|
-
if (l.$isDecoratorNode(f))
|
|
384
|
-
return !1;
|
|
385
|
-
if (l.$isElementNode(f)) {
|
|
386
|
-
if (!l.$isParagraphNode(f) || f.__indent !== 0)
|
|
387
|
-
return !1;
|
|
388
|
-
const a = f.getChildren(), h = a.length;
|
|
389
|
-
for (let v = 0; v < h; v++) {
|
|
390
|
-
const E = a[u];
|
|
391
|
-
if (!l.$isTextNode(E))
|
|
392
|
-
return !1;
|
|
393
|
-
}
|
|
394
|
-
}
|
|
395
|
-
}
|
|
396
|
-
return !0;
|
|
397
|
-
}
|
|
398
|
-
function e(n) {
|
|
399
|
-
return () => p(n);
|
|
400
|
-
}
|
|
401
|
-
function t(n, o, r, i) {
|
|
402
|
-
const u = (c) => c instanceof r, f = (c) => {
|
|
403
|
-
const m = l.$createTextNode(c.getTextContent());
|
|
404
|
-
m.setFormat(c.getFormat()), c.replace(m);
|
|
405
|
-
}, a = (c) => c.getLatest().__mode, h = (c) => {
|
|
406
|
-
if (!c.isSimpleText())
|
|
407
|
-
return;
|
|
408
|
-
const m = c.getPreviousSibling();
|
|
409
|
-
let x = c.getTextContent(), y = c, T;
|
|
410
|
-
if (l.$isTextNode(m)) {
|
|
411
|
-
const L = m.getTextContent(), w = L + x, b = o(w);
|
|
412
|
-
if (u(m))
|
|
413
|
-
if (b === null || a(m) !== 0) {
|
|
414
|
-
f(m);
|
|
415
|
-
return;
|
|
416
|
-
} else {
|
|
417
|
-
const N = b.end - L.length;
|
|
418
|
-
if (N > 0) {
|
|
419
|
-
const S = x.slice(0, N), P = L + S;
|
|
420
|
-
if (m.select(), m.setTextContent(P), N === x.length)
|
|
421
|
-
c.remove();
|
|
422
|
-
else {
|
|
423
|
-
const D = x.slice(N);
|
|
424
|
-
c.setTextContent(D);
|
|
425
|
-
}
|
|
426
|
-
return;
|
|
427
|
-
}
|
|
428
|
-
}
|
|
429
|
-
else if (b === null || b.start < L.length)
|
|
430
|
-
return;
|
|
431
|
-
}
|
|
432
|
-
for (; ; ) {
|
|
433
|
-
T = o(x);
|
|
434
|
-
let L = T === null ? "" : x.slice(T.end);
|
|
435
|
-
if (x = L, L === "") {
|
|
436
|
-
const N = y.getNextSibling();
|
|
437
|
-
if (l.$isTextNode(N)) {
|
|
438
|
-
L = y.getTextContent() + N.getTextContent();
|
|
439
|
-
const S = o(L);
|
|
440
|
-
if (S === null) {
|
|
441
|
-
u(N) ? f(N) : N.markDirty();
|
|
442
|
-
return;
|
|
443
|
-
} else if (S.start !== 0)
|
|
444
|
-
return;
|
|
445
|
-
}
|
|
446
|
-
} else {
|
|
447
|
-
const N = o(L);
|
|
448
|
-
if (N !== null && N.start === 0)
|
|
449
|
-
return;
|
|
450
|
-
}
|
|
451
|
-
if (T === null)
|
|
452
|
-
return;
|
|
453
|
-
if (T.start === 0 && l.$isTextNode(m) && m.isTextEntity())
|
|
454
|
-
continue;
|
|
455
|
-
let w;
|
|
456
|
-
T.start === 0 ? [w, y] = y.splitText(T.end) : [, w, y] = y.splitText(T.start, T.end);
|
|
457
|
-
const b = i(w);
|
|
458
|
-
if (b.setFormat(w.getFormat()), w.replace(b), y == null)
|
|
459
|
-
return;
|
|
460
|
-
}
|
|
461
|
-
}, v = (c) => {
|
|
462
|
-
const m = c.getTextContent(), x = o(m);
|
|
463
|
-
if (x === null || x.start !== 0) {
|
|
464
|
-
f(c);
|
|
465
|
-
return;
|
|
466
|
-
}
|
|
467
|
-
if (m.length > x.end) {
|
|
468
|
-
c.splitText(x.end);
|
|
469
|
-
return;
|
|
470
|
-
}
|
|
471
|
-
const y = c.getPreviousSibling();
|
|
472
|
-
l.$isTextNode(y) && y.isTextEntity() && (f(y), f(c));
|
|
473
|
-
const T = c.getNextSibling();
|
|
474
|
-
l.$isTextNode(T) && T.isTextEntity() && (f(T), u(c) && f(c));
|
|
475
|
-
}, E = n.registerNodeTransform(l.TextNode, h), $ = n.registerNodeTransform(r, v);
|
|
476
|
-
return [E, $];
|
|
477
|
-
}
|
|
478
|
-
return F.$canShowPlaceholder = p, F.$canShowPlaceholderCurry = e, F.$findTextIntersectionFromCharacters = s, F.$isRootTextContentEmpty = g, F.$isRootTextContentEmptyCurry = C, F.$rootTextContent = d, F.registerLexicalTextEntity = t, F;
|
|
479
|
-
}
|
|
480
|
-
var k = {}, Ee;
|
|
481
|
-
function Ct() {
|
|
482
|
-
if (Ee)
|
|
483
|
-
return k;
|
|
484
|
-
Ee = 1;
|
|
485
|
-
var l = A;
|
|
486
|
-
function s(d, p = !0) {
|
|
487
|
-
return d ? !1 : (d = g(), p && (d = d.trim()), d === "");
|
|
488
|
-
}
|
|
489
|
-
function g() {
|
|
490
|
-
return l.$getRoot().getTextContent();
|
|
491
|
-
}
|
|
492
|
-
function C(d) {
|
|
493
|
-
if (!s(d, !1))
|
|
494
|
-
return !1;
|
|
495
|
-
d = l.$getRoot().getChildren();
|
|
496
|
-
let p = d.length;
|
|
497
|
-
if (1 < p)
|
|
498
|
-
return !1;
|
|
499
|
-
for (let t = 0; t < p; t++) {
|
|
500
|
-
var e = d[t];
|
|
501
|
-
if (l.$isDecoratorNode(e))
|
|
502
|
-
return !1;
|
|
503
|
-
if (l.$isElementNode(e)) {
|
|
504
|
-
if (!l.$isParagraphNode(e) || e.__indent !== 0)
|
|
505
|
-
return !1;
|
|
506
|
-
e = e.getChildren();
|
|
507
|
-
let n = e.length;
|
|
508
|
-
for (let o = 0; o < n; o++)
|
|
509
|
-
if (!l.$isTextNode(e[t]))
|
|
510
|
-
return !1;
|
|
511
|
-
}
|
|
512
|
-
}
|
|
513
|
-
return !0;
|
|
514
|
-
}
|
|
515
|
-
return k.$canShowPlaceholder = C, k.$canShowPlaceholderCurry = function(d) {
|
|
516
|
-
return () => C(d);
|
|
517
|
-
}, k.$findTextIntersectionFromCharacters = function(d, p) {
|
|
518
|
-
var e = d.getFirstChild();
|
|
519
|
-
d = 0;
|
|
520
|
-
e:
|
|
521
|
-
for (; e !== null; ) {
|
|
522
|
-
if (l.$isElementNode(e)) {
|
|
523
|
-
var t = e.getFirstChild();
|
|
524
|
-
if (t !== null) {
|
|
525
|
-
e = t;
|
|
526
|
-
continue;
|
|
527
|
-
}
|
|
528
|
-
} else if (l.$isTextNode(e)) {
|
|
529
|
-
if (t = e.getTextContentSize(), d + t > p)
|
|
530
|
-
return { node: e, offset: p - d };
|
|
531
|
-
d += t;
|
|
532
|
-
}
|
|
533
|
-
if (t = e.getNextSibling(), t !== null)
|
|
534
|
-
e = t;
|
|
535
|
-
else {
|
|
536
|
-
for (e = e.getParent(); e !== null; ) {
|
|
537
|
-
if (t = e.getNextSibling(), t !== null) {
|
|
538
|
-
e = t;
|
|
539
|
-
continue e;
|
|
540
|
-
}
|
|
541
|
-
e = e.getParent();
|
|
542
|
-
}
|
|
543
|
-
break;
|
|
544
|
-
}
|
|
545
|
-
}
|
|
546
|
-
return null;
|
|
547
|
-
}, k.$isRootTextContentEmpty = s, k.$isRootTextContentEmptyCurry = function(d, p) {
|
|
548
|
-
return () => s(d, p);
|
|
549
|
-
}, k.$rootTextContent = g, k.registerLexicalTextEntity = function(d, p, e, t) {
|
|
550
|
-
let n = (r) => {
|
|
551
|
-
const i = l.$createTextNode(r.getTextContent());
|
|
552
|
-
i.setFormat(r.getFormat()), r.replace(i);
|
|
553
|
-
}, o = d.registerNodeTransform(l.TextNode, (r) => {
|
|
554
|
-
if (r.isSimpleText()) {
|
|
555
|
-
var i = r.getPreviousSibling(), u = r.getTextContent(), f = r;
|
|
556
|
-
if (l.$isTextNode(i)) {
|
|
557
|
-
var a = i.getTextContent(), h = p(a + u);
|
|
558
|
-
if (i instanceof e) {
|
|
559
|
-
if (h === null || i.getLatest().__mode !== 0) {
|
|
560
|
-
n(i);
|
|
561
|
-
return;
|
|
562
|
-
}
|
|
563
|
-
if (h = h.end - a.length, 0 < h) {
|
|
564
|
-
f = u.slice(0, h), f = a + f, i.select(), i.setTextContent(f), h === u.length ? r.remove() : (i = u.slice(h), r.setTextContent(i));
|
|
565
|
-
return;
|
|
566
|
-
}
|
|
567
|
-
} else if (h === null || h.start < a.length)
|
|
568
|
-
return;
|
|
569
|
-
}
|
|
570
|
-
for (; ; ) {
|
|
571
|
-
if (r = p(u), u = h = r === null ? "" : u.slice(r.end), h === "") {
|
|
572
|
-
if (a = f.getNextSibling(), l.$isTextNode(a)) {
|
|
573
|
-
if (h = f.getTextContent() + a.getTextContent(), h = p(h), h === null) {
|
|
574
|
-
a instanceof e ? n(a) : a.markDirty();
|
|
575
|
-
break;
|
|
576
|
-
} else if (h.start !== 0)
|
|
577
|
-
break;
|
|
578
|
-
}
|
|
579
|
-
} else if (a = p(h), a !== null && a.start === 0)
|
|
580
|
-
break;
|
|
581
|
-
if (r === null)
|
|
582
|
-
break;
|
|
583
|
-
if (r.start === 0 && l.$isTextNode(i) && i.isTextEntity())
|
|
584
|
-
continue;
|
|
585
|
-
let v;
|
|
586
|
-
if (r.start === 0 ? [v, f] = f.splitText(r.end) : [, v, f] = f.splitText(r.start, r.end), r = t(v), r.setFormat(v.getFormat()), v.replace(r), f == null)
|
|
587
|
-
break;
|
|
588
|
-
}
|
|
589
|
-
}
|
|
590
|
-
});
|
|
591
|
-
return d = d.registerNodeTransform(e, (r) => {
|
|
592
|
-
var i = r.getTextContent();
|
|
593
|
-
const u = p(i);
|
|
594
|
-
u === null || u.start !== 0 ? n(r) : i.length > u.end ? r.splitText(u.end) : (i = r.getPreviousSibling(), l.$isTextNode(i) && i.isTextEntity() && (n(i), n(r)), i = r.getNextSibling(), l.$isTextNode(i) && i.isTextEntity() && (n(i), r instanceof e && n(r)));
|
|
595
|
-
}), [o, d];
|
|
596
|
-
}, k;
|
|
597
|
-
}
|
|
598
|
-
var Q, ve;
|
|
599
|
-
function Be() {
|
|
600
|
-
return ve || (ve = 1, Q = process.env.NODE_ENV === "development" ? vt() : Ct()), Q;
|
|
601
|
-
}
|
|
602
|
-
var _ = {}, Ce;
|
|
603
|
-
function Lt() {
|
|
604
|
-
if (Ce)
|
|
605
|
-
return _;
|
|
606
|
-
Ce = 1;
|
|
607
|
-
var l = qe, s = A;
|
|
608
|
-
function g(c, ...m) {
|
|
609
|
-
m.forEach((x) => {
|
|
610
|
-
if (typeof x == "string") {
|
|
611
|
-
const y = x.split(" ").filter((T) => T !== "");
|
|
612
|
-
c.classList.add(...y);
|
|
613
|
-
}
|
|
614
|
-
});
|
|
615
|
-
}
|
|
616
|
-
function C(c, ...m) {
|
|
617
|
-
m.forEach((x) => {
|
|
618
|
-
typeof x == "string" && c.classList.remove(...x.split(" "));
|
|
619
|
-
});
|
|
620
|
-
}
|
|
621
|
-
function d(c, m) {
|
|
622
|
-
for (const x of m)
|
|
623
|
-
if (c.type.startsWith(x))
|
|
624
|
-
return !0;
|
|
625
|
-
return !1;
|
|
626
|
-
}
|
|
627
|
-
function p(c, m) {
|
|
628
|
-
const x = c[Symbol.iterator]();
|
|
629
|
-
return new Promise((y, T) => {
|
|
630
|
-
const L = [], w = () => {
|
|
631
|
-
const {
|
|
632
|
-
done: b,
|
|
633
|
-
value: N
|
|
634
|
-
} = x.next();
|
|
635
|
-
if (b)
|
|
636
|
-
return y(L);
|
|
637
|
-
const S = new FileReader();
|
|
638
|
-
S.addEventListener("error", T), S.addEventListener("load", () => {
|
|
639
|
-
const P = S.result;
|
|
640
|
-
typeof P == "string" && L.push({
|
|
641
|
-
file: N,
|
|
642
|
-
result: P
|
|
643
|
-
}), w();
|
|
644
|
-
}), d(N, m) ? S.readAsDataURL(N) : w();
|
|
645
|
-
};
|
|
646
|
-
w();
|
|
647
|
-
});
|
|
648
|
-
}
|
|
649
|
-
function e(c, m) {
|
|
650
|
-
const x = [], y = (c || s.$getRoot()).getLatest(), T = m || (s.$isElementNode(y) ? y.getLastDescendant() : y);
|
|
651
|
-
let L = y, w = t(L);
|
|
652
|
-
for (; L !== null && !L.is(T); )
|
|
653
|
-
if (x.push({
|
|
654
|
-
depth: w,
|
|
655
|
-
node: L
|
|
656
|
-
}), s.$isElementNode(L) && L.getChildrenSize() > 0)
|
|
657
|
-
L = L.getFirstChild(), w++;
|
|
658
|
-
else {
|
|
659
|
-
let b = null;
|
|
660
|
-
for (; b === null && L !== null; )
|
|
661
|
-
b = L.getNextSibling(), b === null ? (L = L.getParent(), w--) : L = b;
|
|
662
|
-
}
|
|
663
|
-
return L !== null && L.is(T) && x.push({
|
|
664
|
-
depth: w,
|
|
665
|
-
node: L
|
|
666
|
-
}), x;
|
|
667
|
-
}
|
|
668
|
-
function t(c) {
|
|
669
|
-
let m = c, x = 0;
|
|
670
|
-
for (; (m = m.getParent()) !== null; )
|
|
671
|
-
x++;
|
|
672
|
-
return x;
|
|
673
|
-
}
|
|
674
|
-
function n(c, m) {
|
|
675
|
-
let x = c;
|
|
676
|
-
for (; x != null; ) {
|
|
677
|
-
if (x instanceof m)
|
|
678
|
-
return x;
|
|
679
|
-
x = x.getParent();
|
|
680
|
-
}
|
|
681
|
-
return null;
|
|
682
|
-
}
|
|
683
|
-
function o(c) {
|
|
684
|
-
const m = r(c, (x) => s.$isElementNode(x) && !x.isInline());
|
|
685
|
-
if (!s.$isElementNode(m))
|
|
686
|
-
throw Error(`Expected node ${c.__key} to have closest block element node.`);
|
|
687
|
-
return m;
|
|
688
|
-
}
|
|
689
|
-
function r(c, m) {
|
|
690
|
-
let x = c;
|
|
691
|
-
for (; x !== s.$getRoot() && x != null; ) {
|
|
692
|
-
if (m(x))
|
|
693
|
-
return x;
|
|
694
|
-
x = x.getParent();
|
|
695
|
-
}
|
|
696
|
-
return null;
|
|
697
|
-
}
|
|
698
|
-
function i(...c) {
|
|
699
|
-
return () => {
|
|
700
|
-
c.forEach((m) => m());
|
|
701
|
-
};
|
|
702
|
-
}
|
|
703
|
-
function u(c, m, x, y) {
|
|
704
|
-
const T = (b) => b instanceof m, L = (b) => {
|
|
705
|
-
const N = b.getChildren();
|
|
706
|
-
for (let D = 0; D < N.length; D++) {
|
|
707
|
-
const j = N[D];
|
|
708
|
-
if (T(j))
|
|
709
|
-
return null;
|
|
710
|
-
}
|
|
711
|
-
let S = b, P = b;
|
|
712
|
-
for (; S !== null; )
|
|
713
|
-
if (P = S, S = S.getParent(), T(S))
|
|
714
|
-
return {
|
|
715
|
-
child: P,
|
|
716
|
-
parent: S
|
|
717
|
-
};
|
|
718
|
-
return null;
|
|
719
|
-
}, w = (b) => {
|
|
720
|
-
const N = L(b);
|
|
721
|
-
if (N !== null) {
|
|
722
|
-
const {
|
|
723
|
-
child: S,
|
|
724
|
-
parent: P
|
|
725
|
-
} = N;
|
|
726
|
-
if (S.is(b)) {
|
|
727
|
-
y(P, b);
|
|
728
|
-
const D = S.getNextSiblings(), j = D.length;
|
|
729
|
-
if (P.insertAfter(S), j !== 0) {
|
|
730
|
-
const le = x(P);
|
|
731
|
-
S.insertAfter(le);
|
|
732
|
-
for (let V = 0; V < j; V++)
|
|
733
|
-
le.append(D[V]);
|
|
734
|
-
}
|
|
735
|
-
!P.canBeEmpty() && P.getChildrenSize() === 0 && P.remove();
|
|
736
|
-
}
|
|
737
|
-
}
|
|
738
|
-
};
|
|
739
|
-
return c.registerNodeTransform(m, w);
|
|
740
|
-
}
|
|
741
|
-
function f(c, m) {
|
|
742
|
-
const y = /* @__PURE__ */ new Map(), T = c._pendingEditorState;
|
|
743
|
-
for (const [w, b] of m._nodeMap) {
|
|
744
|
-
const N = l.$cloneWithProperties(b);
|
|
745
|
-
s.$isTextNode(N) && (N.__text = b.__text), y.set(w, N);
|
|
746
|
-
}
|
|
747
|
-
T && (T._nodeMap = y), c._dirtyType = 2;
|
|
748
|
-
const L = m._selection;
|
|
749
|
-
s.$setSelection(L === null ? null : L.clone());
|
|
750
|
-
}
|
|
751
|
-
function a(c) {
|
|
752
|
-
const m = s.$getSelection() || s.$getPreviousSelection();
|
|
753
|
-
if (s.$isRangeSelection(m)) {
|
|
754
|
-
const {
|
|
755
|
-
focus: x
|
|
756
|
-
} = m, y = x.getNode(), T = x.offset;
|
|
757
|
-
if (s.$isRootOrShadowRoot(y)) {
|
|
758
|
-
const L = y.getChildAtIndex(T);
|
|
759
|
-
L == null ? y.append(c) : L.insertBefore(c), c.selectNext();
|
|
760
|
-
} else {
|
|
761
|
-
let L, w;
|
|
762
|
-
s.$isTextNode(y) ? (L = y.getParentOrThrow(), w = y.getIndexWithinParent(), T > 0 && (w += 1, y.splitText(T))) : (L = y, w = T);
|
|
763
|
-
const [, b] = s.$splitNode(L, w);
|
|
764
|
-
b.insertBefore(c), b.selectStart();
|
|
765
|
-
}
|
|
766
|
-
} else {
|
|
767
|
-
if (s.$isNodeSelection(m) || s.DEPRECATED_$isGridSelection(m)) {
|
|
768
|
-
const y = m.getNodes();
|
|
769
|
-
y[y.length - 1].getTopLevelElementOrThrow().insertAfter(c);
|
|
770
|
-
} else
|
|
771
|
-
s.$getRoot().append(c);
|
|
772
|
-
const x = s.$createParagraphNode();
|
|
773
|
-
c.insertAfter(x), x.select();
|
|
774
|
-
}
|
|
775
|
-
return c.getLatest();
|
|
776
|
-
}
|
|
777
|
-
function h(c, m) {
|
|
778
|
-
const x = m();
|
|
779
|
-
return c.replace(x), x.append(c), x;
|
|
780
|
-
}
|
|
781
|
-
function v(c) {
|
|
782
|
-
return E(c) && c.tagName === "A";
|
|
783
|
-
}
|
|
784
|
-
function E(c) {
|
|
785
|
-
return c.nodeType === 1;
|
|
786
|
-
}
|
|
787
|
-
function $(c, m) {
|
|
788
|
-
return c !== null ? Object.getPrototypeOf(c).constructor.name === m.name : !1;
|
|
789
|
-
}
|
|
790
|
-
return _.$splitNode = s.$splitNode, _.$dfs = e, _.$findMatchingParent = r, _.$getNearestBlockElementAncestorOrThrow = o, _.$getNearestNodeOfType = n, _.$insertNodeToNearestRoot = a, _.$restoreEditorState = f, _.$wrapNodeInElement = h, _.addClassNamesToElement = g, _.isHTMLAnchorElement = v, _.isHTMLElement = E, _.isMimeType = d, _.mediaFileReader = p, _.mergeRegister = i, _.objectKlassEquals = $, _.registerNestedElementResolver = u, _.removeClassNamesFromElement = C, _;
|
|
791
|
-
}
|
|
792
|
-
var R = {}, Le;
|
|
793
|
-
function yt() {
|
|
794
|
-
if (Le)
|
|
795
|
-
return R;
|
|
796
|
-
Le = 1;
|
|
797
|
-
var l = qe, s = A;
|
|
798
|
-
function g(e) {
|
|
799
|
-
let t = new URLSearchParams();
|
|
800
|
-
t.append("code", e);
|
|
801
|
-
for (let n = 1; n < arguments.length; n++)
|
|
802
|
-
t.append("v", arguments[n]);
|
|
803
|
-
throw Error(`Minified Lexical error #${e}; visit https://lexical.dev/docs/error?${t} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`);
|
|
804
|
-
}
|
|
805
|
-
function C(e, t) {
|
|
806
|
-
for (let n of t)
|
|
807
|
-
if (e.type.startsWith(n))
|
|
808
|
-
return !0;
|
|
809
|
-
return !1;
|
|
810
|
-
}
|
|
811
|
-
function d(e, t) {
|
|
812
|
-
for (; e !== s.$getRoot() && e != null; ) {
|
|
813
|
-
if (t(e))
|
|
814
|
-
return e;
|
|
815
|
-
e = e.getParent();
|
|
816
|
-
}
|
|
817
|
-
return null;
|
|
818
|
-
}
|
|
819
|
-
function p(e) {
|
|
820
|
-
return e.nodeType === 1;
|
|
821
|
-
}
|
|
822
|
-
return R.$splitNode = s.$splitNode, R.$dfs = function(e, t) {
|
|
823
|
-
let n = [];
|
|
824
|
-
e = (e || s.$getRoot()).getLatest(), t = t || (s.$isElementNode(e) ? e.getLastDescendant() : e);
|
|
825
|
-
for (var o = e, r = 0; (o = o.getParent()) !== null; )
|
|
826
|
-
r++;
|
|
827
|
-
for (o = r; e !== null && !e.is(t); )
|
|
828
|
-
if (n.push({ depth: o, node: e }), s.$isElementNode(e) && 0 < e.getChildrenSize())
|
|
829
|
-
e = e.getFirstChild(), o++;
|
|
830
|
-
else
|
|
831
|
-
for (r = null; r === null && e !== null; )
|
|
832
|
-
r = e.getNextSibling(), r === null ? (e = e.getParent(), o--) : e = r;
|
|
833
|
-
return e !== null && e.is(t) && n.push({ depth: o, node: e }), n;
|
|
834
|
-
}, R.$findMatchingParent = d, R.$getNearestBlockElementAncestorOrThrow = function(e) {
|
|
835
|
-
let t = d(e, (n) => s.$isElementNode(n) && !n.isInline());
|
|
836
|
-
return s.$isElementNode(t) || g(4, e.__key), t;
|
|
837
|
-
}, R.$getNearestNodeOfType = function(e, t) {
|
|
838
|
-
for (; e != null; ) {
|
|
839
|
-
if (e instanceof t)
|
|
840
|
-
return e;
|
|
841
|
-
e = e.getParent();
|
|
842
|
-
}
|
|
843
|
-
return null;
|
|
844
|
-
}, R.$insertNodeToNearestRoot = function(e) {
|
|
845
|
-
var t = s.$getSelection() || s.$getPreviousSelection();
|
|
846
|
-
if (s.$isRangeSelection(t)) {
|
|
847
|
-
var { focus: n } = t;
|
|
848
|
-
if (t = n.getNode(), n = n.offset, s.$isRootOrShadowRoot(t))
|
|
849
|
-
n = t.getChildAtIndex(n), n == null ? t.append(e) : n.insertBefore(e), e.selectNext();
|
|
850
|
-
else {
|
|
851
|
-
let o, r;
|
|
852
|
-
s.$isTextNode(t) ? (o = t.getParentOrThrow(), r = t.getIndexWithinParent(), 0 < n && (r += 1, t.splitText(n))) : (o = t, r = n), [, t] = s.$splitNode(o, r), t.insertBefore(e), t.selectStart();
|
|
61
|
+
t.isEmpty() || o.setEditorState(t);
|
|
853
62
|
}
|
|
854
|
-
}
|
|
855
|
-
|
|
856
|
-
return e.getLatest();
|
|
857
|
-
}, R.$restoreEditorState = function(e, t) {
|
|
858
|
-
let n = /* @__PURE__ */ new Map(), o = e._pendingEditorState;
|
|
859
|
-
for (let [r, i] of t._nodeMap) {
|
|
860
|
-
let u = l.$cloneWithProperties(i);
|
|
861
|
-
s.$isTextNode(u) && (u.__text = i.__text), n.set(r, u);
|
|
63
|
+
} catch (t) {
|
|
64
|
+
console.error(t);
|
|
862
65
|
}
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
},
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
return o(i);
|
|
879
|
-
const h = new FileReader();
|
|
880
|
-
h.addEventListener("error", r), h.addEventListener("load", () => {
|
|
881
|
-
const v = h.result;
|
|
882
|
-
typeof v == "string" && i.push({ file: a, result: v }), u();
|
|
883
|
-
}), C(a, t) ? h.readAsDataURL(a) : u();
|
|
884
|
-
};
|
|
885
|
-
u();
|
|
886
|
-
});
|
|
887
|
-
}, R.mergeRegister = function(...e) {
|
|
888
|
-
return () => {
|
|
889
|
-
e.forEach((t) => t());
|
|
890
|
-
};
|
|
891
|
-
}, R.objectKlassEquals = function(e, t) {
|
|
892
|
-
return e !== null ? Object.getPrototypeOf(e).constructor.name === t.name : !1;
|
|
893
|
-
}, R.registerNestedElementResolver = function(e, t, n, o) {
|
|
894
|
-
return e.registerNodeTransform(t, (r) => {
|
|
895
|
-
e: {
|
|
896
|
-
for (var i = r.getChildren(), u = 0; u < i.length; u++)
|
|
897
|
-
if (i[u] instanceof t) {
|
|
898
|
-
i = null;
|
|
899
|
-
break e;
|
|
900
|
-
}
|
|
901
|
-
for (i = r; i !== null; )
|
|
902
|
-
if (u = i, i = i.getParent(), i instanceof t) {
|
|
903
|
-
i = { child: u, parent: i };
|
|
904
|
-
break e;
|
|
905
|
-
}
|
|
906
|
-
i = null;
|
|
907
|
-
}
|
|
908
|
-
if (i !== null) {
|
|
909
|
-
const { child: f, parent: a } = i;
|
|
910
|
-
if (f.is(r)) {
|
|
911
|
-
if (o(a, r), r = f.getNextSiblings(), i = r.length, a.insertAfter(f), i !== 0) {
|
|
912
|
-
u = n(a), f.insertAfter(u);
|
|
913
|
-
for (let h = 0; h < i; h++)
|
|
914
|
-
u.append(r[h]);
|
|
915
|
-
}
|
|
916
|
-
a.canBeEmpty() || a.getChildrenSize() !== 0 || a.remove();
|
|
917
|
-
}
|
|
918
|
-
}
|
|
919
|
-
});
|
|
920
|
-
}, R.removeClassNamesFromElement = function(e, ...t) {
|
|
921
|
-
t.forEach((n) => {
|
|
922
|
-
typeof n == "string" && e.classList.remove(...n.split(" "));
|
|
923
|
-
});
|
|
924
|
-
}, R;
|
|
925
|
-
}
|
|
926
|
-
var X, ye;
|
|
927
|
-
function Ie() {
|
|
928
|
-
return ye || (ye = 1, X = process.env.NODE_ENV === "development" ? Lt() : yt()), X;
|
|
929
|
-
}
|
|
930
|
-
var Z = {}, Te;
|
|
931
|
-
function Tt() {
|
|
932
|
-
if (Te)
|
|
933
|
-
return Z;
|
|
934
|
-
Te = 1;
|
|
935
|
-
var l = A;
|
|
936
|
-
function s(g) {
|
|
937
|
-
const C = window.location.origin, d = (p) => {
|
|
938
|
-
if (p.origin !== C)
|
|
939
|
-
return;
|
|
940
|
-
const e = g.getRootElement();
|
|
941
|
-
if (document.activeElement !== e)
|
|
942
|
-
return;
|
|
943
|
-
const t = p.data;
|
|
944
|
-
if (typeof t == "string") {
|
|
945
|
-
let n;
|
|
946
|
-
try {
|
|
947
|
-
n = JSON.parse(t);
|
|
948
|
-
} catch {
|
|
949
|
-
return;
|
|
950
|
-
}
|
|
951
|
-
if (n && n.protocol === "nuanria_messaging" && n.type === "request") {
|
|
952
|
-
const o = n.payload;
|
|
953
|
-
if (o && o.functionId === "makeChanges") {
|
|
954
|
-
const r = o.args;
|
|
955
|
-
if (r) {
|
|
956
|
-
const [i, u, f, a, h, v] = r;
|
|
957
|
-
g.update(() => {
|
|
958
|
-
const E = l.$getSelection();
|
|
959
|
-
if (l.$isRangeSelection(E)) {
|
|
960
|
-
const $ = E.anchor;
|
|
961
|
-
let c = $.getNode(), m = 0, x = 0;
|
|
962
|
-
if (l.$isTextNode(c) && i >= 0 && u >= 0 && (m = i, x = i + u, E.setTextNodeRange(c, m, c, x)), (m !== x || f !== "") && (E.insertRawText(f), c = $.getNode()), l.$isTextNode(c)) {
|
|
963
|
-
m = a, x = a + h;
|
|
964
|
-
const y = c.getTextContentSize();
|
|
965
|
-
m = m > y ? y : m, x = x > y ? y : x, E.setTextNodeRange(c, m, c, x);
|
|
966
|
-
}
|
|
967
|
-
p.stopImmediatePropagation();
|
|
968
|
-
}
|
|
969
|
-
});
|
|
970
|
-
}
|
|
971
|
-
}
|
|
972
|
-
}
|
|
973
|
-
}
|
|
974
|
-
};
|
|
975
|
-
return window.addEventListener("message", d, !0), () => {
|
|
976
|
-
window.removeEventListener("message", d, !0);
|
|
977
|
-
};
|
|
978
|
-
}
|
|
979
|
-
return Z.registerDragonSupport = s, Z;
|
|
980
|
-
}
|
|
981
|
-
var ee = {}, be;
|
|
982
|
-
function bt() {
|
|
983
|
-
if (be)
|
|
984
|
-
return ee;
|
|
985
|
-
be = 1;
|
|
986
|
-
var l = A;
|
|
987
|
-
return ee.registerDragonSupport = function(s) {
|
|
988
|
-
let g = window.location.origin, C = (d) => {
|
|
989
|
-
if (d.origin === g) {
|
|
990
|
-
var p = s.getRootElement();
|
|
991
|
-
if (document.activeElement === p && (p = d.data, typeof p == "string")) {
|
|
992
|
-
try {
|
|
993
|
-
var e = JSON.parse(p);
|
|
994
|
-
} catch {
|
|
995
|
-
return;
|
|
996
|
-
}
|
|
997
|
-
if (e && e.protocol === "nuanria_messaging" && e.type === "request" && (e = e.payload) && e.functionId === "makeChanges" && (e = e.args)) {
|
|
998
|
-
const [t, n, o, r, i] = e;
|
|
999
|
-
s.update(() => {
|
|
1000
|
-
const u = l.$getSelection();
|
|
1001
|
-
if (l.$isRangeSelection(u)) {
|
|
1002
|
-
var f = u.anchor;
|
|
1003
|
-
let a = f.getNode(), h = 0, v = 0;
|
|
1004
|
-
l.$isTextNode(a) && 0 <= t && 0 <= n && (h = t, v = t + n, u.setTextNodeRange(a, h, a, v)), (h !== v || o !== "") && (u.insertRawText(o), a = f.getNode()), l.$isTextNode(a) && (h = r, v = r + i, f = a.getTextContentSize(), h = h > f ? f : h, v = v > f ? f : v, u.setTextNodeRange(a, h, a, v)), d.stopImmediatePropagation();
|
|
1005
|
-
}
|
|
1006
|
-
});
|
|
1007
|
-
}
|
|
1008
|
-
}
|
|
1009
|
-
}
|
|
1010
|
-
};
|
|
1011
|
-
return window.addEventListener("message", C, !0), () => {
|
|
1012
|
-
window.removeEventListener("message", C, !0);
|
|
1013
|
-
};
|
|
1014
|
-
}, ee;
|
|
1015
|
-
}
|
|
1016
|
-
var te, Ne;
|
|
1017
|
-
function Ue() {
|
|
1018
|
-
return Ne || (Ne = 1, te = process.env.NODE_ENV === "development" ? Tt() : bt()), te;
|
|
1019
|
-
}
|
|
1020
|
-
var $e;
|
|
1021
|
-
function Nt() {
|
|
1022
|
-
if ($e)
|
|
1023
|
-
return W;
|
|
1024
|
-
$e = 1;
|
|
1025
|
-
var l = M(), s = Me(), g = q, C = Be(), d = Ie(), p = Ae, e = Ue(), t = Oe, r = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u" ? g.useLayoutEffect : g.useEffect;
|
|
1026
|
-
function i(E) {
|
|
1027
|
-
return E.getEditorState().read(C.$canShowPlaceholderCurry(E.isComposing()));
|
|
1028
|
-
}
|
|
1029
|
-
function u(E) {
|
|
1030
|
-
const [$, c] = g.useState(() => i(E));
|
|
1031
|
-
return r(() => {
|
|
1032
|
-
function m() {
|
|
1033
|
-
const x = i(E);
|
|
1034
|
-
c(x);
|
|
1035
|
-
}
|
|
1036
|
-
return m(), d.mergeRegister(E.registerUpdateListener(() => {
|
|
1037
|
-
m();
|
|
1038
|
-
}), E.registerEditableListener(() => {
|
|
1039
|
-
m();
|
|
1040
|
-
}));
|
|
1041
|
-
}, [E]), $;
|
|
1042
|
-
}
|
|
1043
|
-
function f(E, $) {
|
|
1044
|
-
const [c, m] = g.useState(() => E.getDecorators());
|
|
1045
|
-
return r(() => E.registerDecoratorListener((x) => {
|
|
1046
|
-
p.flushSync(() => {
|
|
1047
|
-
m(x);
|
|
1048
|
-
});
|
|
1049
|
-
}), [E]), g.useEffect(() => {
|
|
1050
|
-
m(E.getDecorators());
|
|
1051
|
-
}, [E]), g.useMemo(() => {
|
|
1052
|
-
const x = [], y = Object.keys(c);
|
|
1053
|
-
for (let T = 0; T < y.length; T++) {
|
|
1054
|
-
const L = y[T], w = /* @__PURE__ */ g.createElement($, {
|
|
1055
|
-
onError: (N) => E._onError(N)
|
|
1056
|
-
}, /* @__PURE__ */ g.createElement(g.Suspense, {
|
|
1057
|
-
fallback: null
|
|
1058
|
-
}, c[L])), b = E.getElementByKey(L);
|
|
1059
|
-
b !== null && x.push(/* @__PURE__ */ p.createPortal(w, b, L));
|
|
1060
|
-
}
|
|
1061
|
-
return x;
|
|
1062
|
-
}, [$, c, E]);
|
|
1063
|
-
}
|
|
1064
|
-
function a(E) {
|
|
1065
|
-
r(() => d.mergeRegister(t.registerRichText(E), e.registerDragonSupport(E)), [E]);
|
|
1066
|
-
}
|
|
1067
|
-
function h({
|
|
1068
|
-
contentEditable: E,
|
|
1069
|
-
placeholder: $,
|
|
1070
|
-
ErrorBoundary: c
|
|
1071
|
-
}) {
|
|
1072
|
-
const [m] = l.useLexicalComposerContext(), x = f(m, c);
|
|
1073
|
-
return a(m), /* @__PURE__ */ g.createElement(g.Fragment, null, E, /* @__PURE__ */ g.createElement(v, {
|
|
1074
|
-
content: $
|
|
1075
|
-
}), x);
|
|
1076
|
-
}
|
|
1077
|
-
function v({
|
|
1078
|
-
content: E
|
|
1079
|
-
}) {
|
|
1080
|
-
const [$] = l.useLexicalComposerContext(), c = u($), m = s();
|
|
1081
|
-
return c ? typeof E == "function" ? E(m) : E : null;
|
|
1082
|
-
}
|
|
1083
|
-
return W.RichTextPlugin = h, W;
|
|
1084
|
-
}
|
|
1085
|
-
var re = {}, we;
|
|
1086
|
-
function $t() {
|
|
1087
|
-
if (we)
|
|
1088
|
-
return re;
|
|
1089
|
-
we = 1;
|
|
1090
|
-
var l = M(), s = Me(), g = q, C = Be(), d = Ie(), p = Ae, e = Ue(), t = Oe, n = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u" ? g.useLayoutEffect : g.useEffect;
|
|
1091
|
-
function o(a) {
|
|
1092
|
-
return a.getEditorState().read(C.$canShowPlaceholderCurry(a.isComposing()));
|
|
1093
|
-
}
|
|
1094
|
-
function r(a) {
|
|
1095
|
-
let [h, v] = g.useState(() => o(a));
|
|
1096
|
-
return n(() => {
|
|
1097
|
-
function E() {
|
|
1098
|
-
let $ = o(a);
|
|
1099
|
-
v($);
|
|
1100
|
-
}
|
|
1101
|
-
return E(), d.mergeRegister(a.registerUpdateListener(() => {
|
|
1102
|
-
E();
|
|
1103
|
-
}), a.registerEditableListener(() => {
|
|
1104
|
-
E();
|
|
1105
|
-
}));
|
|
1106
|
-
}, [a]), h;
|
|
1107
|
-
}
|
|
1108
|
-
function i(a, h) {
|
|
1109
|
-
let [v, E] = g.useState(() => a.getDecorators());
|
|
1110
|
-
return n(() => a.registerDecoratorListener(($) => {
|
|
1111
|
-
p.flushSync(() => {
|
|
1112
|
-
E($);
|
|
1113
|
-
});
|
|
1114
|
-
}), [a]), g.useEffect(() => {
|
|
1115
|
-
E(a.getDecorators());
|
|
1116
|
-
}, [a]), g.useMemo(() => {
|
|
1117
|
-
let $ = [], c = Object.keys(v);
|
|
1118
|
-
for (let m = 0; m < c.length; m++) {
|
|
1119
|
-
let x = c[m], y = g.createElement(h, { onError: (L) => a._onError(L) }, g.createElement(g.Suspense, { fallback: null }, v[x])), T = a.getElementByKey(x);
|
|
1120
|
-
T !== null && $.push(p.createPortal(y, T, x));
|
|
1121
|
-
}
|
|
1122
|
-
return $;
|
|
1123
|
-
}, [h, v, a]);
|
|
1124
|
-
}
|
|
1125
|
-
function u(a) {
|
|
1126
|
-
n(() => d.mergeRegister(t.registerRichText(a), e.registerDragonSupport(a)), [a]);
|
|
1127
|
-
}
|
|
1128
|
-
function f({ content: a }) {
|
|
1129
|
-
var [h] = l.useLexicalComposerContext();
|
|
1130
|
-
h = r(h);
|
|
1131
|
-
let v = s();
|
|
1132
|
-
return h ? typeof a == "function" ? a(v) : a : null;
|
|
1133
|
-
}
|
|
1134
|
-
return re.RichTextPlugin = function({ contentEditable: a, placeholder: h, ErrorBoundary: v }) {
|
|
1135
|
-
let [E] = l.useLexicalComposerContext();
|
|
1136
|
-
return v = i(E, v), u(E), g.createElement(g.Fragment, null, a, g.createElement(f, { content: h }), v);
|
|
1137
|
-
}, re;
|
|
1138
|
-
}
|
|
1139
|
-
const wt = process.env.NODE_ENV === "development" ? Nt() : $t();
|
|
1140
|
-
var St = wt, ne = {}, Se;
|
|
1141
|
-
function _t() {
|
|
1142
|
-
if (Se)
|
|
1143
|
-
return ne;
|
|
1144
|
-
Se = 1;
|
|
1145
|
-
var l = M(), s = q;
|
|
1146
|
-
function g() {
|
|
1147
|
-
return g = Object.assign ? Object.assign.bind() : function(t) {
|
|
1148
|
-
for (var n = 1; n < arguments.length; n++) {
|
|
1149
|
-
var o = arguments[n];
|
|
1150
|
-
for (var r in o)
|
|
1151
|
-
Object.prototype.hasOwnProperty.call(o, r) && (t[r] = o[r]);
|
|
1152
|
-
}
|
|
1153
|
-
return t;
|
|
1154
|
-
}, g.apply(this, arguments);
|
|
1155
|
-
}
|
|
1156
|
-
var p = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u" ? s.useLayoutEffect : s.useEffect;
|
|
1157
|
-
function e({
|
|
1158
|
-
ariaActiveDescendant: t,
|
|
1159
|
-
ariaAutoComplete: n,
|
|
1160
|
-
ariaControls: o,
|
|
1161
|
-
ariaDescribedBy: r,
|
|
1162
|
-
ariaExpanded: i,
|
|
1163
|
-
ariaLabel: u,
|
|
1164
|
-
ariaLabelledBy: f,
|
|
1165
|
-
ariaMultiline: a,
|
|
1166
|
-
ariaOwns: h,
|
|
1167
|
-
ariaRequired: v,
|
|
1168
|
-
autoCapitalize: E,
|
|
1169
|
-
className: $,
|
|
1170
|
-
id: c,
|
|
1171
|
-
role: m = "textbox",
|
|
1172
|
-
spellCheck: x = !0,
|
|
1173
|
-
style: y,
|
|
1174
|
-
tabIndex: T,
|
|
1175
|
-
"data-testid": L,
|
|
1176
|
-
...w
|
|
1177
|
-
}) {
|
|
1178
|
-
const [b] = l.useLexicalComposerContext(), [N, S] = s.useState(!1), P = s.useCallback((D) => {
|
|
1179
|
-
b.setRootElement(D);
|
|
1180
|
-
}, [b]);
|
|
1181
|
-
return p(() => (S(b.isEditable()), b.registerEditableListener((D) => {
|
|
1182
|
-
S(D);
|
|
1183
|
-
})), [b]), /* @__PURE__ */ s.createElement("div", g({}, w, {
|
|
1184
|
-
"aria-activedescendant": N ? t : void 0,
|
|
1185
|
-
"aria-autocomplete": N ? n : "none",
|
|
1186
|
-
"aria-controls": N ? o : void 0,
|
|
1187
|
-
"aria-describedby": r,
|
|
1188
|
-
"aria-expanded": N && m === "combobox" ? !!i : void 0,
|
|
1189
|
-
"aria-label": u,
|
|
1190
|
-
"aria-labelledby": f,
|
|
1191
|
-
"aria-multiline": a,
|
|
1192
|
-
"aria-owns": N ? h : void 0,
|
|
1193
|
-
"aria-readonly": N ? void 0 : !0,
|
|
1194
|
-
"aria-required": v,
|
|
1195
|
-
autoCapitalize: E,
|
|
1196
|
-
className: $,
|
|
1197
|
-
contentEditable: N,
|
|
1198
|
-
"data-testid": L,
|
|
1199
|
-
id: c,
|
|
1200
|
-
ref: P,
|
|
1201
|
-
role: m,
|
|
1202
|
-
spellCheck: x,
|
|
1203
|
-
style: y,
|
|
1204
|
-
tabIndex: T
|
|
1205
|
-
}));
|
|
1206
|
-
}
|
|
1207
|
-
return ne.ContentEditable = e, ne;
|
|
1208
|
-
}
|
|
1209
|
-
var oe = {}, _e;
|
|
1210
|
-
function Rt() {
|
|
1211
|
-
if (_e)
|
|
1212
|
-
return oe;
|
|
1213
|
-
_e = 1;
|
|
1214
|
-
var l = M(), s = q;
|
|
1215
|
-
function g() {
|
|
1216
|
-
return g = Object.assign ? Object.assign.bind() : function(d) {
|
|
1217
|
-
for (var p = 1; p < arguments.length; p++) {
|
|
1218
|
-
var e = arguments[p], t;
|
|
1219
|
-
for (t in e)
|
|
1220
|
-
Object.prototype.hasOwnProperty.call(e, t) && (d[t] = e[t]);
|
|
1221
|
-
}
|
|
1222
|
-
return d;
|
|
1223
|
-
}, g.apply(this, arguments);
|
|
1224
|
-
}
|
|
1225
|
-
var C = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u" ? s.useLayoutEffect : s.useEffect;
|
|
1226
|
-
return oe.ContentEditable = function({ ariaActiveDescendant: d, ariaAutoComplete: p, ariaControls: e, ariaDescribedBy: t, ariaExpanded: n, ariaLabel: o, ariaLabelledBy: r, ariaMultiline: i, ariaOwns: u, ariaRequired: f, autoCapitalize: a, className: h, id: v, role: E = "textbox", spellCheck: $ = !0, style: c, tabIndex: m, "data-testid": x, ...y }) {
|
|
1227
|
-
let [T] = l.useLexicalComposerContext(), [L, w] = s.useState(!1), b = s.useCallback((N) => {
|
|
1228
|
-
T.setRootElement(N);
|
|
1229
|
-
}, [T]);
|
|
1230
|
-
return C(() => (w(T.isEditable()), T.registerEditableListener((N) => {
|
|
1231
|
-
w(N);
|
|
1232
|
-
})), [T]), s.createElement(
|
|
1233
|
-
"div",
|
|
1234
|
-
g({}, y, { "aria-activedescendant": L ? d : void 0, "aria-autocomplete": L ? p : "none", "aria-controls": L ? e : void 0, "aria-describedby": t, "aria-expanded": L && E === "combobox" ? !!n : void 0, "aria-label": o, "aria-labelledby": r, "aria-multiline": i, "aria-owns": L ? u : void 0, "aria-readonly": L ? void 0 : !0, "aria-required": f, autoCapitalize: a, className: h, contentEditable: L, "data-testid": x, id: v, ref: b, role: E, spellCheck: $, style: c, tabIndex: m })
|
|
1235
|
-
);
|
|
1236
|
-
}, oe;
|
|
1237
|
-
}
|
|
1238
|
-
const Pt = process.env.NODE_ENV === "development" ? _t() : Rt();
|
|
1239
|
-
var Dt = Pt, ie, Re;
|
|
1240
|
-
function qt() {
|
|
1241
|
-
if (Re)
|
|
1242
|
-
return ie;
|
|
1243
|
-
Re = 1;
|
|
1244
|
-
var l = q;
|
|
1245
|
-
function s(t, n) {
|
|
1246
|
-
return s = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(r, i) {
|
|
1247
|
-
return r.__proto__ = i, r;
|
|
1248
|
-
}, s(t, n);
|
|
1249
|
-
}
|
|
1250
|
-
function g(t, n) {
|
|
1251
|
-
t.prototype = Object.create(n.prototype), t.prototype.constructor = t, s(t, n);
|
|
1252
|
-
}
|
|
1253
|
-
var C = function(n, o) {
|
|
1254
|
-
return n === void 0 && (n = []), o === void 0 && (o = []), n.length !== o.length || n.some(function(r, i) {
|
|
1255
|
-
return !Object.is(r, o[i]);
|
|
1256
|
-
});
|
|
1257
|
-
}, d = {
|
|
1258
|
-
error: null
|
|
1259
|
-
}, p = /* @__PURE__ */ function(t) {
|
|
1260
|
-
g(n, t);
|
|
1261
|
-
function n() {
|
|
1262
|
-
for (var r, i = arguments.length, u = new Array(i), f = 0; f < i; f++)
|
|
1263
|
-
u[f] = arguments[f];
|
|
1264
|
-
return r = t.call.apply(t, [this].concat(u)) || this, r.state = d, r.resetErrorBoundary = function() {
|
|
1265
|
-
for (var a, h = arguments.length, v = new Array(h), E = 0; E < h; E++)
|
|
1266
|
-
v[E] = arguments[E];
|
|
1267
|
-
r.props.onReset == null || (a = r.props).onReset.apply(a, v), r.reset();
|
|
1268
|
-
}, r;
|
|
1269
|
-
}
|
|
1270
|
-
n.getDerivedStateFromError = function(i) {
|
|
1271
|
-
return {
|
|
1272
|
-
error: i
|
|
1273
|
-
};
|
|
1274
|
-
};
|
|
1275
|
-
var o = n.prototype;
|
|
1276
|
-
return o.reset = function() {
|
|
1277
|
-
this.setState(d);
|
|
1278
|
-
}, o.componentDidCatch = function(i, u) {
|
|
1279
|
-
var f, a;
|
|
1280
|
-
(f = (a = this.props).onError) == null || f.call(a, i, u);
|
|
1281
|
-
}, o.componentDidUpdate = function(i, u) {
|
|
1282
|
-
var f = this.state.error, a = this.props.resetKeys;
|
|
1283
|
-
if (f !== null && u.error !== null && C(i.resetKeys, a)) {
|
|
1284
|
-
var h, v;
|
|
1285
|
-
(h = (v = this.props).onResetKeysChange) == null || h.call(v, i.resetKeys, a), this.reset();
|
|
1286
|
-
}
|
|
1287
|
-
}, o.render = function() {
|
|
1288
|
-
var i = this.state.error, u = this.props, f = u.fallbackRender, a = u.FallbackComponent, h = u.fallback;
|
|
1289
|
-
if (i !== null) {
|
|
1290
|
-
var v = {
|
|
1291
|
-
error: i,
|
|
1292
|
-
resetErrorBoundary: this.resetErrorBoundary
|
|
1293
|
-
};
|
|
1294
|
-
if (/* @__PURE__ */ l.isValidElement(h))
|
|
1295
|
-
return h;
|
|
1296
|
-
if (typeof f == "function")
|
|
1297
|
-
return f(v);
|
|
1298
|
-
if (a)
|
|
1299
|
-
return /* @__PURE__ */ l.createElement(a, v);
|
|
1300
|
-
throw new Error("react-error-boundary requires either a fallback, fallbackRender, or FallbackComponent prop");
|
|
1301
|
-
}
|
|
1302
|
-
return this.props.children;
|
|
1303
|
-
}, n;
|
|
1304
|
-
}(l.Component);
|
|
1305
|
-
function e({
|
|
1306
|
-
children: t,
|
|
1307
|
-
onError: n
|
|
1308
|
-
}) {
|
|
1309
|
-
return /* @__PURE__ */ l.createElement(p, {
|
|
1310
|
-
fallback: /* @__PURE__ */ l.createElement("div", {
|
|
1311
|
-
style: {
|
|
1312
|
-
border: "1px solid #f00",
|
|
1313
|
-
color: "#f00",
|
|
1314
|
-
padding: "8px"
|
|
1315
|
-
}
|
|
1316
|
-
}, "An error was thrown."),
|
|
1317
|
-
onError: n
|
|
1318
|
-
}, t);
|
|
1319
|
-
}
|
|
1320
|
-
return ie = e, ie;
|
|
1321
|
-
}
|
|
1322
|
-
var se, Pe;
|
|
1323
|
-
function Ot() {
|
|
1324
|
-
if (Pe)
|
|
1325
|
-
return se;
|
|
1326
|
-
Pe = 1;
|
|
1327
|
-
var l = q;
|
|
1328
|
-
function s(e, t) {
|
|
1329
|
-
return s = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(n, o) {
|
|
1330
|
-
return n.__proto__ = o, n;
|
|
1331
|
-
}, s(e, t);
|
|
1332
|
-
}
|
|
1333
|
-
function g(e, t) {
|
|
1334
|
-
e.prototype = Object.create(t.prototype), e.prototype.constructor = e, s(e, t);
|
|
1335
|
-
}
|
|
1336
|
-
function C(e, t) {
|
|
1337
|
-
return e === void 0 && (e = []), t === void 0 && (t = []), e.length !== t.length || e.some(function(n, o) {
|
|
1338
|
-
return !Object.is(n, t[o]);
|
|
1339
|
-
});
|
|
1340
|
-
}
|
|
1341
|
-
var d = { error: null }, p = function(e) {
|
|
1342
|
-
function t() {
|
|
1343
|
-
for (var o, r = arguments.length, i = Array(r), u = 0; u < r; u++)
|
|
1344
|
-
i[u] = arguments[u];
|
|
1345
|
-
return o = e.call.apply(e, [this].concat(i)) || this, o.state = d, o.resetErrorBoundary = function() {
|
|
1346
|
-
for (var f, a = arguments.length, h = Array(a), v = 0; v < a; v++)
|
|
1347
|
-
h[v] = arguments[v];
|
|
1348
|
-
o.props.onReset == null || (f = o.props).onReset.apply(f, h), o.reset();
|
|
1349
|
-
}, o;
|
|
1350
|
-
}
|
|
1351
|
-
g(t, e), t.getDerivedStateFromError = function(o) {
|
|
1352
|
-
return { error: o };
|
|
1353
|
-
};
|
|
1354
|
-
var n = t.prototype;
|
|
1355
|
-
return n.reset = function() {
|
|
1356
|
-
this.setState(d);
|
|
1357
|
-
}, n.componentDidCatch = function(o, r) {
|
|
1358
|
-
var i, u;
|
|
1359
|
-
(i = (u = this.props).onError) == null || i.call(u, o, r);
|
|
1360
|
-
}, n.componentDidUpdate = function(o, r) {
|
|
1361
|
-
var i = this.props.resetKeys;
|
|
1362
|
-
if (this.state.error !== null && r.error !== null && C(o.resetKeys, i)) {
|
|
1363
|
-
var u, f;
|
|
1364
|
-
(u = (f = this.props).onResetKeysChange) == null || u.call(f, o.resetKeys, i), this.reset();
|
|
1365
|
-
}
|
|
1366
|
-
}, n.render = function() {
|
|
1367
|
-
var o = this.state.error, r = this.props, i = r.fallbackRender, u = r.FallbackComponent;
|
|
1368
|
-
if (r = r.fallback, o !== null) {
|
|
1369
|
-
if (o = { error: o, resetErrorBoundary: this.resetErrorBoundary }, l.isValidElement(r))
|
|
1370
|
-
return r;
|
|
1371
|
-
if (typeof i == "function")
|
|
1372
|
-
return i(o);
|
|
1373
|
-
if (u)
|
|
1374
|
-
return l.createElement(u, o);
|
|
1375
|
-
throw Error("react-error-boundary requires either a fallback, fallbackRender, or FallbackComponent prop");
|
|
1376
|
-
}
|
|
1377
|
-
return this.props.children;
|
|
1378
|
-
}, t;
|
|
1379
|
-
}(l.Component);
|
|
1380
|
-
return se = function({ children: e, onError: t }) {
|
|
1381
|
-
return l.createElement(p, { fallback: l.createElement("div", { style: { border: "1px solid #f00", color: "#f00", padding: "8px" } }, "An error was thrown."), onError: t }, e);
|
|
1382
|
-
}, se;
|
|
1383
|
-
}
|
|
1384
|
-
const Ft = process.env.NODE_ENV === "development" ? qt() : Ot();
|
|
1385
|
-
var kt = Ft;
|
|
1386
|
-
const At = U({
|
|
66
|
+
let s = "";
|
|
67
|
+
return o.update(() => {
|
|
68
|
+
s = N(o);
|
|
69
|
+
}), { html: s, trimCount: r };
|
|
70
|
+
}, Ce = [
|
|
71
|
+
F,
|
|
72
|
+
L,
|
|
73
|
+
w,
|
|
74
|
+
j,
|
|
75
|
+
E,
|
|
76
|
+
v,
|
|
77
|
+
R,
|
|
78
|
+
H,
|
|
79
|
+
k
|
|
80
|
+
], Q = m({
|
|
1387
81
|
fontWeight: "bold"
|
|
1388
|
-
}),
|
|
82
|
+
}), Y = m({
|
|
1389
83
|
fontStyle: "italic"
|
|
1390
|
-
}),
|
|
84
|
+
}), G = m({
|
|
1391
85
|
textDecoration: "underline"
|
|
1392
|
-
}),
|
|
86
|
+
}), K = m({
|
|
1393
87
|
listStyleType: "none"
|
|
1394
|
-
}),
|
|
88
|
+
}), U = m({
|
|
1395
89
|
borderLeft: "4px solid #ccc",
|
|
1396
90
|
color: "#666",
|
|
1397
91
|
fontStyle: "italic",
|
|
1398
92
|
margin: "1.5em 10px",
|
|
1399
93
|
padding: "0.5em 10px"
|
|
1400
|
-
}),
|
|
1401
|
-
quote:
|
|
94
|
+
}), X = {
|
|
95
|
+
quote: U().className,
|
|
1402
96
|
text: {
|
|
1403
|
-
bold:
|
|
1404
|
-
italic:
|
|
1405
|
-
underline:
|
|
97
|
+
bold: Q().className,
|
|
98
|
+
italic: Y().className,
|
|
99
|
+
underline: G().className
|
|
1406
100
|
},
|
|
1407
101
|
list: {
|
|
1408
102
|
nested: {
|
|
1409
|
-
listitem:
|
|
103
|
+
listitem: K().className
|
|
1410
104
|
}
|
|
1411
105
|
}
|
|
1412
|
-
},
|
|
1413
|
-
const [
|
|
1414
|
-
|
|
1415
|
-
}, []),
|
|
1416
|
-
|
|
1417
|
-
|
|
106
|
+
}, b = P({ hasFocus: !1, editorRef: { current: null } }), Z = ({ onBlur: e }) => {
|
|
107
|
+
const [a, n] = B(!1), r = h(null), o = u(() => {
|
|
108
|
+
n(!0), r.current && window.clearTimeout(r.current);
|
|
109
|
+
}, []), s = u(() => {
|
|
110
|
+
r.current = window.setTimeout(() => {
|
|
111
|
+
n(!1), e == null || e();
|
|
1418
112
|
}, 0);
|
|
1419
|
-
}, [
|
|
113
|
+
}, [e]);
|
|
1420
114
|
return {
|
|
1421
|
-
hasFocus:
|
|
115
|
+
hasFocus: a,
|
|
1422
116
|
attributes: {
|
|
1423
|
-
onFocus:
|
|
1424
|
-
onBlur:
|
|
117
|
+
onFocus: o,
|
|
118
|
+
onBlur: s
|
|
1425
119
|
}
|
|
1426
120
|
};
|
|
1427
|
-
},
|
|
121
|
+
}, Ne = () => I(b), _ = f("div", {
|
|
1428
122
|
border: "1px solid $borderDarker",
|
|
1429
123
|
borderRadius: "$md",
|
|
1430
124
|
position: "relative",
|
|
@@ -1454,7 +148,7 @@ const At = U({
|
|
|
1454
148
|
}
|
|
1455
149
|
}
|
|
1456
150
|
]
|
|
1457
|
-
}),
|
|
151
|
+
}), ee = f(D, {}, {
|
|
1458
152
|
padding: "0 $4",
|
|
1459
153
|
overflowY: "auto",
|
|
1460
154
|
maxHeight: "30rem",
|
|
@@ -1478,55 +172,54 @@ const At = U({
|
|
|
1478
172
|
color: "$gray500"
|
|
1479
173
|
}
|
|
1480
174
|
}
|
|
1481
|
-
}),
|
|
1482
|
-
isLoading:
|
|
1483
|
-
}) => /* @__PURE__ */
|
|
1484
|
-
|
|
175
|
+
}), te = ({
|
|
176
|
+
isLoading: e
|
|
177
|
+
}) => /* @__PURE__ */ i.jsx(
|
|
178
|
+
x,
|
|
1485
179
|
{
|
|
1486
180
|
css: {
|
|
1487
|
-
visibility:
|
|
181
|
+
visibility: e ? "visible" : "hidden",
|
|
1488
182
|
position: "absolute",
|
|
1489
183
|
bottom: "1rem",
|
|
1490
184
|
right: "1rem",
|
|
1491
185
|
display: "flex"
|
|
1492
186
|
},
|
|
1493
|
-
children: /* @__PURE__ */
|
|
1494
|
-
}
|
|
1495
|
-
),
|
|
1496
|
-
isLoading:
|
|
1497
|
-
children:
|
|
1498
|
-
placeholderText:
|
|
1499
|
-
nodes:
|
|
1500
|
-
plugins:
|
|
1501
|
-
toolbar:
|
|
1502
|
-
refs: e
|
|
187
|
+
children: /* @__PURE__ */ i.jsx(z, {})
|
|
188
|
+
}
|
|
189
|
+
), Te = ({
|
|
190
|
+
isLoading: e,
|
|
191
|
+
children: a,
|
|
192
|
+
placeholderText: n,
|
|
193
|
+
nodes: r,
|
|
194
|
+
plugins: o,
|
|
195
|
+
toolbar: s
|
|
1503
196
|
}) => {
|
|
1504
|
-
const { hasFocus: t, attributes:
|
|
1505
|
-
return /* @__PURE__ */
|
|
1506
|
-
|
|
197
|
+
const { hasFocus: t, attributes: c } = Z({}), l = h(null), d = M(() => ({ hasFocus: t, editorRef: l }), [t]);
|
|
198
|
+
return /* @__PURE__ */ i.jsx(b.Provider, { value: d, children: /* @__PURE__ */ i.jsxs(
|
|
199
|
+
q,
|
|
1507
200
|
{
|
|
1508
201
|
initialConfig: {
|
|
1509
202
|
namespace: "CommentEditor",
|
|
1510
|
-
onError: (
|
|
1511
|
-
console.error(
|
|
203
|
+
onError: (g) => {
|
|
204
|
+
console.error(g);
|
|
1512
205
|
},
|
|
1513
|
-
theme:
|
|
1514
|
-
nodes:
|
|
206
|
+
theme: X,
|
|
207
|
+
nodes: r,
|
|
1515
208
|
editable: !0
|
|
1516
209
|
},
|
|
1517
210
|
children: [
|
|
1518
|
-
/* @__PURE__ */
|
|
1519
|
-
|
|
211
|
+
/* @__PURE__ */ i.jsxs(
|
|
212
|
+
_,
|
|
1520
213
|
{
|
|
1521
|
-
ref:
|
|
214
|
+
ref: l,
|
|
1522
215
|
hasFocus: t,
|
|
1523
|
-
...
|
|
216
|
+
...c,
|
|
1524
217
|
children: [
|
|
1525
|
-
/* @__PURE__ */
|
|
1526
|
-
|
|
218
|
+
/* @__PURE__ */ i.jsx(
|
|
219
|
+
A,
|
|
1527
220
|
{
|
|
1528
|
-
contentEditable: /* @__PURE__ */
|
|
1529
|
-
|
|
221
|
+
contentEditable: /* @__PURE__ */ i.jsx(
|
|
222
|
+
ee,
|
|
1530
223
|
{
|
|
1531
224
|
css: {
|
|
1532
225
|
paddingTop: 16,
|
|
@@ -1534,8 +227,8 @@ const At = U({
|
|
|
1534
227
|
}
|
|
1535
228
|
}
|
|
1536
229
|
),
|
|
1537
|
-
placeholder:
|
|
1538
|
-
|
|
230
|
+
placeholder: n ? /* @__PURE__ */ i.jsx(
|
|
231
|
+
x,
|
|
1539
232
|
{
|
|
1540
233
|
css: {
|
|
1541
234
|
position: "absolute",
|
|
@@ -1545,26 +238,29 @@ const At = U({
|
|
|
1545
238
|
pointerEvents: "none",
|
|
1546
239
|
fontSize: "$sm"
|
|
1547
240
|
},
|
|
1548
|
-
children:
|
|
241
|
+
children: n
|
|
1549
242
|
}
|
|
1550
243
|
) : null,
|
|
1551
|
-
ErrorBoundary:
|
|
244
|
+
ErrorBoundary: V
|
|
1552
245
|
}
|
|
1553
246
|
),
|
|
1554
|
-
|
|
1555
|
-
/* @__PURE__ */
|
|
1556
|
-
|
|
247
|
+
o,
|
|
248
|
+
/* @__PURE__ */ i.jsx(te, { isLoading: e }),
|
|
249
|
+
s
|
|
1557
250
|
]
|
|
1558
251
|
}
|
|
1559
252
|
),
|
|
1560
|
-
/* @__PURE__ */
|
|
253
|
+
/* @__PURE__ */ i.jsx(i.Fragment, { children: a })
|
|
1561
254
|
]
|
|
1562
255
|
}
|
|
1563
256
|
) });
|
|
1564
257
|
};
|
|
1565
258
|
export {
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
259
|
+
Te as RichTextEditor,
|
|
260
|
+
Ce as defaultNodes,
|
|
261
|
+
O as isJSON,
|
|
262
|
+
b as richTextContext,
|
|
263
|
+
ge as stateToHTML,
|
|
264
|
+
Z as useHasFocusWithin,
|
|
265
|
+
Ne as useRichTextContext
|
|
1570
266
|
};
|