@arkitektbedriftene/fe-lib 0.4.38 → 0.4.39

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/rich-text.es.js +645 -2610
  2. package/package.json +1 -1
@@ -1,47 +1,55 @@
1
- var Ur = Object.defineProperty;
2
- var Kr = (t, e, i) => e in t ? Ur(t, e, { enumerable: !0, configurable: !0, writable: !0, value: i }) : t[e] = i;
3
- var Nt = (t, e, i) => (Kr(t, typeof e != "symbol" ? e + "" : e, i), i);
4
- import { createHeadlessEditor as Wr } from "@lexical/headless";
5
- import { $generateHtmlFromNodes as jr } from "@lexical/html";
6
- import W, { $getRoot as Ae, ParagraphNode as Yr, $createParagraphNode as Pe, $createTextNode as ve, $setSelection as ir, SELECTION_CHANGE_COMMAND as Le, $getSelection as ee, COMMAND_PRIORITY_CRITICAL as at, $isRangeSelection as te, $isRootOrShadowRoot as Vr, FORMAT_TEXT_COMMAND as Ee, COMMAND_PRIORITY_LOW as de, KEY_ARROW_DOWN_COMMAND as Gr, KEY_ARROW_UP_COMMAND as Jr, KEY_ESCAPE_COMMAND as lr, KEY_SPACE_COMMAND as Xr, $getNearestNodeFromDOMNode as ct, KEY_ARROW_LEFT_COMMAND as Qr, $isElementNode as Zr, COMMAND_PRIORITY_NORMAL as en, $isParagraphNode as tn, COMMAND_PRIORITY_HIGH as rn } from "lexical";
7
- import sr, { trimTextContentFromAnchor as nn, $setBlocksType as qe, $isAtNodeEnd as Tt } from "@lexical/selection";
8
- import { LinkNode as me, AutoLinkNode as ar, $isLinkNode as $e, TOGGLE_LINK_COMMAND as ut } from "@lexical/link";
9
- import cr, { ListNode as dt, ListItemNode as ur, $isListNode as ft, INSERT_UNORDERED_LIST_COMMAND as on, INSERT_ORDERED_LIST_COMMAND as ln, INSERT_CHECK_LIST_COMMAND as dr, insertList as sn, $isListItemNode as xe } from "@lexical/list";
10
- import fr, { HeadingNode as gr, QuoteNode as pr, $isHeadingNode as an, $createHeadingNode as cn, $createQuoteNode as un } from "@lexical/rich-text";
11
- import hr, { TableNode as mr, TableRowNode as xr, TableCellNode as Cr, INSERT_TABLE_COMMAND as dn, $getTableCellNodeFromLexicalNode as fn, $deleteTableColumn__EXPERIMENTAL as gn, $deleteTableRow__EXPERIMENTAL as pn, $insertTableColumn__EXPERIMENTAL as vt, $insertTableRow__EXPERIMENTAL as _t } from "@lexical/table";
12
- import { jsx as _, jsxs as K, Fragment as Ie } from "react/jsx-runtime";
13
- import q, { createContext as hn, useState as Y, useRef as gt, useCallback as J, useContext as mn, useEffect as oe, useMemo as Er, useLayoutEffect as xn } from "react";
14
- import { DropdownMenu as pt, ToolbarButton as Nr, DropdownMenuIconItem as Z, Box as _e, ToolbarToggleGroup as Tr, ToolbarToggleItem as he, OverlayCard as vr, Toolbar as Cn, ToolbarSeparator as En, styled as Nn, Spinner as Tn, Button as Ce, DropdownMenuItem as pe, DropdownMenuSeparator as Lt, Dialog as vn, NavBar as _n, NavBarItem as yt, TextInput as Ln, DialogActions as _r, Combobox as yn } from "./ui.es.js";
15
- import Lr from "react-dom";
16
- import { useFloating as ht, autoUpdate as yr, size as Mn, flip as Rn, offset as Mr, shift as bn, useInteractions as Rr, useRole as br, FloatingPortal as Sr, inline as Sn, useDismiss as kn } from "@floating-ui/react";
17
- import { G as F, e as On } from "./index.esm-67eba761.js";
18
- import { s as $n, c as Dn } from "./stitches.config-00c23cdb.js";
1
+ var Yt = Object.defineProperty;
2
+ var Gt = (t, e, r) => e in t ? Yt(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r;
3
+ var st = (t, e, r) => (Gt(t, typeof e != "symbol" ? e + "" : e, r), r);
4
+ import { createHeadlessEditor as Jt } from "@lexical/headless";
5
+ import { $generateHtmlFromNodes as Xt } from "@lexical/html";
6
+ import { $getRoot as K, ParagraphNode as Qt, $createParagraphNode as q, $createTextNode as D, $setSelection as bt, SELECTION_CHANGE_COMMAND as F, $getSelection as T, COMMAND_PRIORITY_CRITICAL as Q, $isRangeSelection as L, $isRootOrShadowRoot as Vt, FORMAT_TEXT_COMMAND as B, COMMAND_PRIORITY_LOW as E, KEY_ARROW_DOWN_COMMAND as Zt, KEY_ARROW_UP_COMMAND as te, KEY_ESCAPE_COMMAND as vt, KEY_SPACE_COMMAND as ee, $getNearestNodeFromDOMNode as V, KEY_ARROW_LEFT_COMMAND as re, $isElementNode as ne, COMMAND_PRIORITY_NORMAL as oe, $isParagraphNode as ie, COMMAND_PRIORITY_HIGH as ae } from "lexical";
7
+ import { trimTextContentFromAnchor as le, $setBlocksType as J, $isAtNodeEnd as ct } from "@lexical/selection";
8
+ import { LinkNode as z, AutoLinkNode as Mt, $isLinkNode as U, TOGGLE_LINK_COMMAND as Z } from "@lexical/link";
9
+ import { ListNode as tt, ListItemNode as Ct, $isListNode as et, INSERT_UNORDERED_LIST_COMMAND as se, INSERT_ORDERED_LIST_COMMAND as ce, INSERT_CHECK_LIST_COMMAND as Tt, insertList as de, $isListItemNode as O } from "@lexical/list";
10
+ import { HeadingNode as Lt, QuoteNode as xt, $isHeadingNode as ue, $createHeadingNode as he, $createQuoteNode as pe } from "@lexical/rich-text";
11
+ import { TableNode as yt, TableRowNode as Nt, TableCellNode as St, INSERT_TABLE_COMMAND as ge, $getTableCellNodeFromLexicalNode as fe, $deleteTableColumn__EXPERIMENTAL as me, $deleteTableRow__EXPERIMENTAL as ke, $insertTableColumn__EXPERIMENTAL as dt, $insertTableRow__EXPERIMENTAL as ut } from "@lexical/table";
12
+ import { jsx as n, jsxs as g, Fragment as Y } from "react/jsx-runtime";
13
+ import { createContext as be, useState as b, useRef as rt, useCallback as v, useContext as ve, useEffect as x, useMemo as wt, useLayoutEffect as Me } from "react";
14
+ import { DropdownMenu as nt, ToolbarButton as Et, DropdownMenuIconItem as C, Box as P, ToolbarToggleGroup as _t, ToolbarToggleItem as I, OverlayCard as Rt, Toolbar as Ce, ToolbarSeparator as Te, styled as Le, Spinner as xe, Button as $, DropdownMenuItem as R, DropdownMenuSeparator as ht, Dialog as ye, NavBar as Ne, NavBarItem as pt, TextInput as Se, DialogActions as It, Combobox as we } from "./ui.es.js";
15
+ import { LexicalComposer as Ee } from "@lexical/react/LexicalComposer.js";
16
+ import { RichTextPlugin as _e } from "@lexical/react/LexicalRichTextPlugin.js";
17
+ import Re from "@lexical/react/LexicalErrorBoundary.js";
18
+ import { useFloating as ot, autoUpdate as zt, size as Ie, flip as ze, offset as Ot, shift as Oe, useInteractions as $t, useRole as At, FloatingPortal as Bt, inline as $e, useDismiss as Ae } from "@floating-ui/react";
19
+ import { useLexicalComposerContext as y } from "@lexical/react/LexicalComposerContext.js";
20
+ import { $getNearestNodeOfType as Be, $findMatchingParent as Dt, mergeRegister as it, isHTMLElement as gt } from "@lexical/utils";
21
+ import { G as h, e as De } from "./index.esm-67eba761.js";
22
+ import { s as Pe, c as Fe } from "./stitches.config-00c23cdb.js";
23
+ import { ListPlugin as He } from "@lexical/react/LexicalListPlugin.js";
24
+ import { HistoryPlugin as Ue } from "@lexical/react/LexicalHistoryPlugin.js";
25
+ import { TablePlugin as We } from "@lexical/react/LexicalTablePlugin.js";
26
+ import { TabIndentationPlugin as je } from "@lexical/react/LexicalTabIndentationPlugin.js";
19
27
  import "@stitches/react";
20
- const wn = ({
28
+ const Ke = ({
21
29
  text: t,
22
30
  maxChars: e,
23
- maxLines: i
31
+ maxLines: r
24
32
  }) => {
25
33
  if (t.length === 0)
26
34
  return 0;
27
- const d = typeof i == "number", s = typeof e == "number";
28
- if (!d && !s)
35
+ const o = typeof r == "number", i = typeof e == "number";
36
+ if (!o && !i)
29
37
  return t.length;
30
- let u = 0, l = 0;
31
- for (; l < t.length && (!d || u < i) && (!s || l < e); )
32
- t[l] === `
33
- ` && u++, l++;
34
- return t.slice(0, l).length;
35
- }, An = ({
38
+ let l = 0, a = 0;
39
+ for (; a < t.length && (!o || l < r) && (!i || a < e); )
40
+ t[a] === `
41
+ ` && l++, a++;
42
+ return t.slice(0, a).length;
43
+ }, qe = ({
36
44
  editor: t,
37
45
  maxChars: e,
38
- maxLines: i
46
+ maxLines: r
39
47
  }) => {
40
- const d = Ae(), s = d.getTextContent(), u = wn({ text: s, maxChars: e, maxLines: i }), l = s.length - u, o = d.select().anchor;
41
- nn(t, o, l);
42
- const n = d.getLastChild();
43
- return n instanceof Yr && n.getChildrenSize() === 0 && n.remove(), l;
44
- }, kr = {
48
+ const o = K(), i = o.getTextContent(), l = Ke({ text: i, maxChars: e, maxLines: r }), a = i.length - l, d = o.select().anchor;
49
+ le(t, d, a);
50
+ const c = o.getLastChild();
51
+ return c instanceof Qt && c.getChildrenSize() === 0 && c.remove(), a;
52
+ }, Pt = {
45
53
  quote: "ain-rich-text-quote",
46
54
  text: {
47
55
  bold: "ain-rich-text-bold",
@@ -53,78 +61,78 @@ const wn = ({
53
61
  listitem: "ain-rich-text-nested-list-item"
54
62
  }
55
63
  }
56
- }, Or = (t) => t[0] === "{", Pn = (t) => t !== null && typeof t == "object" && "isEmpty" in t, In = (t, e) => {
64
+ }, Ft = (t) => t[0] === "{", Ye = (t) => t !== null && typeof t == "object" && "isEmpty" in t, Ge = (t, e) => {
57
65
  t.update(
58
66
  () => {
59
- const i = Ae();
60
- i.clear();
61
- const d = Pe();
62
- d.append(ve("")), i.append(d), ir(null);
67
+ const r = K();
68
+ r.clear();
69
+ const o = q();
70
+ o.append(D("")), r.append(o), bt(null);
63
71
  },
64
72
  {
65
73
  tag: e
66
74
  }
67
75
  );
68
- }, Bn = (t, e, i) => {
76
+ }, Je = (t, e, r) => {
69
77
  e.update(
70
78
  () => {
71
- const d = Ae();
72
- d.clear();
73
- const s = Pe();
74
- s.append(ve(t.trim())), d.append(s), ir(null);
79
+ const o = K();
80
+ o.clear();
81
+ const i = q();
82
+ i.append(D(t.trim())), o.append(i), bt(null);
75
83
  },
76
84
  {
77
- tag: i
85
+ tag: r
78
86
  }
79
87
  ), e.blur();
80
- }, ki = (t, e, i) => {
81
- let d = 0;
82
- const s = Wr({
88
+ }, ln = (t, e, r) => {
89
+ let o = 0;
90
+ const i = Jt({
83
91
  nodes: e,
84
92
  editable: !1,
85
- theme: kr
93
+ theme: Pt
86
94
  });
87
95
  if (t)
88
96
  try {
89
- if (typeof t == "string" && !Or(t))
90
- s.update(() => {
91
- const l = Ae(), c = Pe();
92
- c.append(ve(t.trim())), l.append(c);
97
+ if (typeof t == "string" && !Ft(t))
98
+ i.update(() => {
99
+ const a = K(), s = q();
100
+ s.append(D(t.trim())), a.append(s);
93
101
  });
94
102
  else {
95
- const l = s.parseEditorState(t, () => {
96
- (i == null ? void 0 : i.maxLines) !== void 0 && (d = An({
97
- editor: s,
98
- maxLines: i.maxLines
103
+ const a = i.parseEditorState(t, () => {
104
+ (r == null ? void 0 : r.maxLines) !== void 0 && (o = qe({
105
+ editor: i,
106
+ maxLines: r.maxLines
99
107
  }));
100
108
  });
101
- l.isEmpty() || s.setEditorState(l);
109
+ a.isEmpty() || i.setEditorState(a);
102
110
  }
103
- } catch (l) {
104
- console.error(l);
111
+ } catch (a) {
112
+ console.error(a);
105
113
  }
106
- let u = "";
107
- return s.update(() => {
108
- var l;
109
- i != null && i.updateFn && ((l = i.updateFn) == null || l.call(i)), u = jr(s);
110
- }), { html: u, trimCount: d };
114
+ let l = "";
115
+ return i.update(() => {
116
+ var a;
117
+ r != null && r.updateFn && ((a = r.updateFn) == null || a.call(r)), l = Xt(i);
118
+ }), { html: l, trimCount: o };
111
119
  };
112
- class De extends me {
120
+ class W extends z {
113
121
  static getType() {
114
122
  return "target-link";
115
123
  }
116
- constructor(e, i, d) {
117
- let s = !1;
118
- const u = { ...i };
124
+ constructor(e, r, o) {
125
+ let i = !1;
126
+ const l = { ...r };
119
127
  try {
120
- const l = new URL(e);
121
- window.location.hostname !== l.hostname && (s = !0);
128
+ const a = new URL(e);
129
+ window.location.hostname !== a.hostname && (i = !0);
122
130
  } catch {
123
131
  }
124
- s && (u.target = "_blank", u.rel = "noopener noreferrer"), super(e, u, d);
132
+ i && (l.target = "_blank", l.rel = "noopener noreferrer"), super(e, l, o);
125
133
  }
126
134
  static clone(e) {
127
- return new De(
135
+ return new W(
128
136
  e.__url,
129
137
  { rel: e.__rel, target: e.__target, title: e.__title },
130
138
  e.__key
@@ -134,1538 +142,111 @@ class De extends me {
134
142
  return super.exportJSON();
135
143
  }
136
144
  static importJSON(e) {
137
- return me.importJSON(e);
145
+ return z.importJSON(e);
138
146
  }
139
147
  }
140
- const Oi = [
141
- gr,
142
- pr,
143
- dt,
144
- ur,
145
- ar,
146
- me,
147
- mr,
148
- xr,
149
- Cr
150
- ], $i = [
151
- gr,
152
- pr,
153
- dt,
154
- ur,
155
- ar,
156
- me,
157
- mr,
158
- xr,
159
- Cr,
160
- De,
148
+ const sn = [
149
+ Lt,
150
+ xt,
151
+ tt,
152
+ Ct,
153
+ Mt,
154
+ z,
155
+ yt,
156
+ Nt,
157
+ St
158
+ ], cn = [
159
+ Lt,
160
+ xt,
161
+ tt,
162
+ Ct,
163
+ Mt,
164
+ z,
165
+ yt,
166
+ Nt,
167
+ St,
168
+ W,
161
169
  {
162
- replace: me,
163
- with: (t) => new De(
170
+ replace: z,
171
+ with: (t) => new W(
164
172
  t.getURL(),
165
173
  { rel: t.__rel, target: t.__target, title: t.__title }
166
174
  )
167
175
  }
168
- ];
169
- var Ue = {}, Ne = {}, Mt;
170
- function Hn() {
171
- if (Mt)
172
- return Ne;
173
- Mt = 1;
174
- var t = q;
175
- const e = /* @__PURE__ */ t.createContext(null);
176
- function i(s, u) {
177
- let l = null;
178
- s != null && (l = s[1]);
179
- function c() {
180
- return u ?? (l != null ? l.getTheme() : null);
181
- }
182
- return {
183
- getTheme: c
184
- };
185
- }
186
- function d() {
187
- const s = t.useContext(e);
188
- if (s == null)
189
- throw Error("LexicalComposerContext.useLexicalComposerContext: cannot find a LexicalComposerContext");
190
- return s;
191
- }
192
- return Ne.LexicalComposerContext = e, Ne.createLexicalComposerContext = i, Ne.useLexicalComposerContext = d, Ne;
193
- }
194
- var Te = {}, Rt;
195
- function Fn() {
196
- if (Rt)
197
- return Te;
198
- Rt = 1;
199
- var t = q;
200
- function e(d) {
201
- let s = new URLSearchParams();
202
- s.append("code", d);
203
- for (let u = 1; u < arguments.length; u++)
204
- s.append("v", arguments[u]);
205
- throw Error(`Minified Lexical error #${d}; visit https://lexical.dev/docs/error?${s} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`);
206
- }
207
- let i = t.createContext(null);
208
- return Te.LexicalComposerContext = i, Te.createLexicalComposerContext = function(d, s) {
209
- let u = null;
210
- return d != null && (u = d[1]), { getTheme: function() {
211
- return s ?? (u != null ? u.getTheme() : null);
212
- } };
213
- }, Te.useLexicalComposerContext = function() {
214
- let d = t.useContext(i);
215
- return d == null && e(8), d;
216
- }, Te;
217
- }
218
- const zn = process.env.NODE_ENV === "development" ? Hn() : Fn();
219
- var P = zn, bt;
220
- function qn() {
221
- if (bt)
222
- return Ue;
223
- bt = 1;
224
- var t = P, e = W, i = q;
225
- const d = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u";
226
- var u = d ? i.useLayoutEffect : i.useEffect;
227
- const l = {
228
- tag: "history-merge"
229
- };
230
- function c({
231
- initialConfig: n,
232
- children: r
233
- }) {
234
- const a = i.useMemo(
235
- () => {
236
- const {
237
- theme: g,
238
- namespace: f,
239
- editor__DEPRECATED: p,
240
- nodes: h,
241
- onError: x,
242
- editorState: C,
243
- html: L
244
- } = n, E = t.createLexicalComposerContext(null, g);
245
- let T = p || null;
246
- if (T === null) {
247
- const M = e.createEditor({
248
- editable: n.editable,
249
- html: L,
250
- namespace: f,
251
- nodes: h,
252
- onError: (b) => x(b, M),
253
- theme: g
254
- });
255
- o(M, C), T = M;
256
- }
257
- return [T, E];
258
- },
259
- // We only do this for init
260
- // eslint-disable-next-line react-hooks/exhaustive-deps
261
- []
262
- );
263
- return u(() => {
264
- const g = n.editable, [f] = a;
265
- f.setEditable(g !== void 0 ? g : !0);
266
- }, []), /* @__PURE__ */ i.createElement(t.LexicalComposerContext.Provider, {
267
- value: a
268
- }, r);
269
- }
270
- function o(n, r) {
271
- if (r !== null) {
272
- if (r === void 0)
273
- n.update(() => {
274
- const a = e.$getRoot();
275
- if (a.isEmpty()) {
276
- const g = e.$createParagraphNode();
277
- a.append(g);
278
- const f = d ? document.activeElement : null;
279
- (e.$getSelection() !== null || f !== null && f === n.getRootElement()) && g.select();
280
- }
281
- }, l);
282
- else if (r !== null)
283
- switch (typeof r) {
284
- case "string": {
285
- const a = n.parseEditorState(r);
286
- n.setEditorState(a, l);
287
- break;
288
- }
289
- case "object": {
290
- n.setEditorState(r, l);
291
- break;
292
- }
293
- case "function": {
294
- n.update(() => {
295
- e.$getRoot().isEmpty() && r(n);
296
- }, l);
297
- break;
298
- }
299
- }
300
- }
301
- }
302
- return Ue.LexicalComposer = c, Ue;
303
- }
304
- var Ke = {}, St;
305
- function Un() {
306
- if (St)
307
- return Ke;
308
- St = 1;
309
- var t = P, e = W, i = q;
310
- let d = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u";
311
- var s = d ? i.useLayoutEffect : i.useEffect;
312
- let u = { tag: "history-merge" };
313
- function l(c, o) {
314
- if (o !== null) {
315
- if (o === void 0)
316
- c.update(() => {
317
- var n = e.$getRoot();
318
- if (n.isEmpty()) {
319
- let r = e.$createParagraphNode();
320
- n.append(r), n = d ? document.activeElement : null, (e.$getSelection() !== null || n !== null && n === c.getRootElement()) && r.select();
321
- }
322
- }, u);
323
- else if (o !== null)
324
- switch (typeof o) {
325
- case "string":
326
- let n = c.parseEditorState(o);
327
- c.setEditorState(n, u);
328
- break;
329
- case "object":
330
- c.setEditorState(o, u);
331
- break;
332
- case "function":
333
- c.update(() => {
334
- e.$getRoot().isEmpty() && o(c);
335
- }, u);
336
- }
337
- }
338
- }
339
- return Ke.LexicalComposer = function({ initialConfig: c, children: o }) {
340
- let n = i.useMemo(() => {
341
- const { theme: r, namespace: a, editor__DEPRECATED: g, nodes: f, onError: p, editorState: h, html: x } = c, C = t.createLexicalComposerContext(null, r);
342
- let L = g || null;
343
- if (L === null) {
344
- const E = e.createEditor({ editable: c.editable, html: x, namespace: a, nodes: f, onError: (T) => p(T, E), theme: r });
345
- l(E, h), L = E;
346
- }
347
- return [L, C];
348
- }, []);
349
- return s(() => {
350
- let r = c.editable, [a] = n;
351
- a.setEditable(r !== void 0 ? r : !0);
352
- }, []), i.createElement(
353
- t.LexicalComposerContext.Provider,
354
- { value: n },
355
- o
356
- );
357
- }, Ke;
358
- }
359
- const Kn = process.env.NODE_ENV === "development" ? qn() : Un();
360
- var Wn = Kn, We = {}, je, kt;
361
- function jn() {
362
- if (kt)
363
- return je;
364
- kt = 1;
365
- var t = P, e = q, s = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u" ? e.useLayoutEffect : e.useEffect;
366
- function u(o) {
367
- const [n] = t.useLexicalComposerContext(), r = e.useMemo(() => o(n), [n, o]), a = e.useRef(r.initialValueFn()), [g, f] = e.useState(a.current);
368
- return s(() => {
369
- const {
370
- initialValueFn: p,
371
- subscribe: h
372
- } = r, x = p();
373
- return a.current !== x && (a.current = x, f(x)), h((C) => {
374
- a.current = C, f(C);
375
- });
376
- }, [r, o]), g;
377
- }
378
- function l(o) {
379
- return {
380
- initialValueFn: () => o.isEditable(),
381
- subscribe: (n) => o.registerEditableListener(n)
382
- };
383
- }
384
- function c() {
385
- return u(l);
386
- }
387
- return je = c, je;
388
- }
389
- var Ye, Ot;
390
- function Yn() {
391
- if (Ot)
392
- return Ye;
393
- Ot = 1;
394
- var t = P, e = q, i = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u" ? e.useLayoutEffect : e.useEffect;
395
- function d(u) {
396
- let [l] = t.useLexicalComposerContext(), c = e.useMemo(() => u(l), [l, u]), o = e.useRef(c.initialValueFn()), [n, r] = e.useState(o.current);
397
- return i(() => {
398
- let { initialValueFn: a, subscribe: g } = c, f = a();
399
- return o.current !== f && (o.current = f, r(f)), g((p) => {
400
- o.current = p, r(p);
401
- });
402
- }, [c, u]), n;
403
- }
404
- function s(u) {
405
- return { initialValueFn: () => u.isEditable(), subscribe: (l) => u.registerEditableListener(l) };
406
- }
407
- return Ye = function() {
408
- return d(s);
409
- }, Ye;
410
- }
411
- var Ve, $t;
412
- function $r() {
413
- return $t || ($t = 1, Ve = process.env.NODE_ENV === "development" ? jn() : Yn()), Ve;
414
- }
415
- var le = {}, Dt;
416
- function Vn() {
417
- if (Dt)
418
- return le;
419
- Dt = 1;
420
- var t = W;
421
- function e(o, n) {
422
- let r = o.getFirstChild(), a = 0;
423
- e:
424
- for (; r !== null; ) {
425
- if (t.$isElementNode(r)) {
426
- const p = r.getFirstChild();
427
- if (p !== null) {
428
- r = p;
429
- continue;
430
- }
431
- } else if (t.$isTextNode(r)) {
432
- const p = r.getTextContentSize();
433
- if (a + p > n)
434
- return {
435
- node: r,
436
- offset: n - a
437
- };
438
- a += p;
439
- }
440
- const g = r.getNextSibling();
441
- if (g !== null) {
442
- r = g;
443
- continue;
444
- }
445
- let f = r.getParent();
446
- for (; f !== null; ) {
447
- const p = f.getNextSibling();
448
- if (p !== null) {
449
- r = p;
450
- continue e;
451
- }
452
- f = f.getParent();
453
- }
454
- break;
455
- }
456
- return null;
457
- }
458
- function i(o, n = !0) {
459
- if (o)
460
- return !1;
461
- let r = s();
462
- return n && (r = r.trim()), r === "";
463
- }
464
- function d(o, n) {
465
- return () => i(o, n);
466
- }
467
- function s() {
468
- return t.$getRoot().getTextContent();
469
- }
470
- function u(o) {
471
- if (!i(o, !1))
472
- return !1;
473
- const r = t.$getRoot().getChildren(), a = r.length;
474
- if (a > 1)
475
- return !1;
476
- for (let g = 0; g < a; g++) {
477
- const f = r[g];
478
- if (t.$isDecoratorNode(f))
479
- return !1;
480
- if (t.$isElementNode(f)) {
481
- if (!t.$isParagraphNode(f) || f.__indent !== 0)
482
- return !1;
483
- const p = f.getChildren(), h = p.length;
484
- for (let x = 0; x < h; x++) {
485
- const C = p[g];
486
- if (!t.$isTextNode(C))
487
- return !1;
488
- }
489
- }
490
- }
491
- return !0;
492
- }
493
- function l(o) {
494
- return () => u(o);
495
- }
496
- function c(o, n, r, a) {
497
- const g = (E) => E instanceof r, f = (E) => {
498
- const T = t.$createTextNode(E.getTextContent());
499
- T.setFormat(E.getFormat()), E.replace(T);
500
- }, p = (E) => E.getLatest().__mode, h = (E) => {
501
- if (!E.isSimpleText())
502
- return;
503
- const T = E.getPreviousSibling();
504
- let M = E.getTextContent(), b = E, m;
505
- if (t.$isTextNode(T)) {
506
- const v = T.getTextContent(), N = v + M, y = n(N);
507
- if (g(T))
508
- if (y === null || p(T) !== 0) {
509
- f(T);
510
- return;
511
- } else {
512
- const R = y.end - v.length;
513
- if (R > 0) {
514
- const S = M.slice(0, R), O = v + S;
515
- if (T.select(), T.setTextContent(O), R === M.length)
516
- E.remove();
517
- else {
518
- const k = M.slice(R);
519
- E.setTextContent(k);
520
- }
521
- return;
522
- }
523
- }
524
- else if (y === null || y.start < v.length)
525
- return;
526
- }
527
- for (; ; ) {
528
- m = n(M);
529
- let v = m === null ? "" : M.slice(m.end);
530
- if (M = v, v === "") {
531
- const R = b.getNextSibling();
532
- if (t.$isTextNode(R)) {
533
- v = b.getTextContent() + R.getTextContent();
534
- const S = n(v);
535
- if (S === null) {
536
- g(R) ? f(R) : R.markDirty();
537
- return;
538
- } else if (S.start !== 0)
539
- return;
540
- }
541
- } else {
542
- const R = n(v);
543
- if (R !== null && R.start === 0)
544
- return;
545
- }
546
- if (m === null)
547
- return;
548
- if (m.start === 0 && t.$isTextNode(T) && T.isTextEntity())
549
- continue;
550
- let N;
551
- m.start === 0 ? [N, b] = b.splitText(m.end) : [, N, b] = b.splitText(m.start, m.end);
552
- const y = a(N);
553
- if (y.setFormat(N.getFormat()), N.replace(y), b == null)
554
- return;
555
- }
556
- }, x = (E) => {
557
- const T = E.getTextContent(), M = n(T);
558
- if (M === null || M.start !== 0) {
559
- f(E);
560
- return;
561
- }
562
- if (T.length > M.end) {
563
- E.splitText(M.end);
564
- return;
565
- }
566
- const b = E.getPreviousSibling();
567
- t.$isTextNode(b) && b.isTextEntity() && (f(b), f(E));
568
- const m = E.getNextSibling();
569
- t.$isTextNode(m) && m.isTextEntity() && (f(m), g(E) && f(E));
570
- }, C = o.registerNodeTransform(t.TextNode, h), L = o.registerNodeTransform(r, x);
571
- return [C, L];
572
- }
573
- return le.$canShowPlaceholder = u, le.$canShowPlaceholderCurry = l, le.$findTextIntersectionFromCharacters = e, le.$isRootTextContentEmpty = i, le.$isRootTextContentEmptyCurry = d, le.$rootTextContent = s, le.registerLexicalTextEntity = c, le;
574
- }
575
- var se = {}, wt;
576
- function Gn() {
577
- if (wt)
578
- return se;
579
- wt = 1;
580
- var t = W;
581
- function e(s, u = !0) {
582
- return s ? !1 : (s = i(), u && (s = s.trim()), s === "");
583
- }
584
- function i() {
585
- return t.$getRoot().getTextContent();
586
- }
587
- function d(s) {
588
- if (!e(s, !1))
589
- return !1;
590
- s = t.$getRoot().getChildren();
591
- let u = s.length;
592
- if (1 < u)
593
- return !1;
594
- for (let c = 0; c < u; c++) {
595
- var l = s[c];
596
- if (t.$isDecoratorNode(l))
597
- return !1;
598
- if (t.$isElementNode(l)) {
599
- if (!t.$isParagraphNode(l) || l.__indent !== 0)
600
- return !1;
601
- l = l.getChildren();
602
- let o = l.length;
603
- for (let n = 0; n < o; n++)
604
- if (!t.$isTextNode(l[c]))
605
- return !1;
606
- }
607
- }
608
- return !0;
609
- }
610
- return se.$canShowPlaceholder = d, se.$canShowPlaceholderCurry = function(s) {
611
- return () => d(s);
612
- }, se.$findTextIntersectionFromCharacters = function(s, u) {
613
- var l = s.getFirstChild();
614
- s = 0;
615
- e:
616
- for (; l !== null; ) {
617
- if (t.$isElementNode(l)) {
618
- var c = l.getFirstChild();
619
- if (c !== null) {
620
- l = c;
621
- continue;
622
- }
623
- } else if (t.$isTextNode(l)) {
624
- if (c = l.getTextContentSize(), s + c > u)
625
- return { node: l, offset: u - s };
626
- s += c;
627
- }
628
- if (c = l.getNextSibling(), c !== null)
629
- l = c;
630
- else {
631
- for (l = l.getParent(); l !== null; ) {
632
- if (c = l.getNextSibling(), c !== null) {
633
- l = c;
634
- continue e;
635
- }
636
- l = l.getParent();
637
- }
638
- break;
639
- }
640
- }
641
- return null;
642
- }, se.$isRootTextContentEmpty = e, se.$isRootTextContentEmptyCurry = function(s, u) {
643
- return () => e(s, u);
644
- }, se.$rootTextContent = i, se.registerLexicalTextEntity = function(s, u, l, c) {
645
- let o = (r) => {
646
- const a = t.$createTextNode(r.getTextContent());
647
- a.setFormat(r.getFormat()), r.replace(a);
648
- }, n = s.registerNodeTransform(t.TextNode, (r) => {
649
- if (r.isSimpleText()) {
650
- var a = r.getPreviousSibling(), g = r.getTextContent(), f = r;
651
- if (t.$isTextNode(a)) {
652
- var p = a.getTextContent(), h = u(p + g);
653
- if (a instanceof l) {
654
- if (h === null || a.getLatest().__mode !== 0) {
655
- o(a);
656
- return;
657
- }
658
- if (h = h.end - p.length, 0 < h) {
659
- f = g.slice(0, h), f = p + f, a.select(), a.setTextContent(f), h === g.length ? r.remove() : (a = g.slice(h), r.setTextContent(a));
660
- return;
661
- }
662
- } else if (h === null || h.start < p.length)
663
- return;
664
- }
665
- for (; ; ) {
666
- if (r = u(g), g = h = r === null ? "" : g.slice(r.end), h === "") {
667
- if (p = f.getNextSibling(), t.$isTextNode(p)) {
668
- if (h = f.getTextContent() + p.getTextContent(), h = u(h), h === null) {
669
- p instanceof l ? o(p) : p.markDirty();
670
- break;
671
- } else if (h.start !== 0)
672
- break;
673
- }
674
- } else if (p = u(h), p !== null && p.start === 0)
675
- break;
676
- if (r === null)
677
- break;
678
- if (r.start === 0 && t.$isTextNode(a) && a.isTextEntity())
679
- continue;
680
- let x;
681
- if (r.start === 0 ? [x, f] = f.splitText(r.end) : [, x, f] = f.splitText(r.start, r.end), r = c(x), r.setFormat(x.getFormat()), x.replace(r), f == null)
682
- break;
683
- }
684
- }
685
- });
686
- return s = s.registerNodeTransform(l, (r) => {
687
- var a = r.getTextContent();
688
- const g = u(a);
689
- g === null || g.start !== 0 ? o(r) : a.length > g.end ? r.splitText(g.end) : (a = r.getPreviousSibling(), t.$isTextNode(a) && a.isTextEntity() && (o(a), o(r)), a = r.getNextSibling(), t.$isTextNode(a) && a.isTextEntity() && (o(a), r instanceof l && o(r)));
690
- }), [n, s];
691
- }, se;
692
- }
693
- var Ge, At;
694
- function Dr() {
695
- return At || (At = 1, Ge = process.env.NODE_ENV === "development" ? Vn() : Gn()), Ge;
696
- }
697
- var I = {}, Pt;
698
- function Jn() {
699
- if (Pt)
700
- return I;
701
- Pt = 1;
702
- var t = sr, e = W;
703
- function i(...m) {
704
- return () => {
705
- m.forEach((v) => v());
706
- };
707
- }
708
- function d(m) {
709
- return `${m}px`;
710
- }
711
- const s = {
712
- attributes: !0,
713
- characterData: !0,
714
- childList: !0,
715
- subtree: !0
716
- };
717
- function u(m, v, N) {
718
- let y = null, R = null, S = null, O = [];
719
- const k = document.createElement("div");
720
- function $() {
721
- if (y === null)
722
- throw Error("Unexpected null rootDOMNode");
723
- if (R === null)
724
- throw Error("Unexpected null parentDOMNode");
725
- const {
726
- left: A,
727
- top: j
728
- } = y.getBoundingClientRect(), U = R, V = t.createRectsFromDOMRange(m, v);
729
- k.isConnected || U.append(k);
730
- let X = !1;
731
- for (let re = 0; re < V.length; re++) {
732
- const ae = V[re], ne = O[re] || document.createElement("div"), ie = ne.style;
733
- ie.position !== "absolute" && (ie.position = "absolute", X = !0);
734
- const ye = d(ae.left - A);
735
- ie.left !== ye && (ie.left = ye, X = !0);
736
- const ce = d(ae.top - j);
737
- ie.top !== ce && (ne.style.top = ce, X = !0);
738
- const ue = d(ae.width);
739
- ie.width !== ue && (ne.style.width = ue, X = !0);
740
- const ge = d(ae.height);
741
- ie.height !== ge && (ne.style.height = ge, X = !0), ne.parentNode !== k && (k.append(ne), X = !0), O[re] = ne;
742
- }
743
- for (; O.length > V.length; )
744
- O.pop();
745
- X && N(O);
746
- }
747
- function D() {
748
- R = null, y = null, S !== null && S.disconnect(), S = null, k.remove();
749
- for (const A of O)
750
- A.remove();
751
- O = [];
752
- }
753
- function w() {
754
- const A = m.getRootElement();
755
- if (A === null)
756
- return D();
757
- const j = A.parentElement;
758
- if (!(j instanceof HTMLElement))
759
- return D();
760
- D(), y = A, R = j, S = new MutationObserver((U) => {
761
- const V = m.getRootElement(), X = V && V.parentElement;
762
- if (V !== y || X !== R)
763
- return w();
764
- for (const re of U)
765
- if (!k.contains(re.target))
766
- return $();
767
- }), S.observe(j, s), $();
768
- }
769
- const H = m.registerRootListener(w);
770
- return () => {
771
- H(), D();
772
- };
773
- }
774
- function l(m, v) {
775
- let N = null, y = null, R = null, S = null, O = () => {
776
- };
777
- function k($) {
778
- $.read(() => {
779
- const D = e.$getSelection();
780
- if (!e.$isRangeSelection(D)) {
781
- N = null, y = null, R = null, S = null, O(), O = () => {
782
- };
783
- return;
784
- }
785
- const {
786
- anchor: w,
787
- focus: H
788
- } = D, A = w.getNode(), j = A.getKey(), U = w.offset, V = H.getNode(), X = V.getKey(), re = H.offset, ae = m.getElementByKey(j), ne = m.getElementByKey(X), ie = N === null || ae === null || U !== y || j !== N.getKey() || A !== N && (!(N instanceof e.TextNode) || A.updateDOM(N, ae, m._config)), ye = R === null || ne === null || re !== S || X !== R.getKey() || V !== R && (!(R instanceof e.TextNode) || V.updateDOM(R, ne, m._config));
789
- if (ie || ye) {
790
- const ce = m.getElementByKey(w.getNode().getKey()), ue = m.getElementByKey(H.getNode().getKey());
791
- if (ce !== null && ue !== null && ce.tagName === "SPAN" && ue.tagName === "SPAN") {
792
- const ge = document.createRange();
793
- let Be, He, Fe, ze;
794
- H.isBefore(w) ? (Be = ue, He = H.offset, Fe = ce, ze = w.offset) : (Be = ce, He = w.offset, Fe = ue, ze = H.offset);
795
- const xt = Be.firstChild;
796
- if (xt === null)
797
- throw Error("Expected text node to be first child of span");
798
- const Ct = Fe.firstChild;
799
- if (Ct === null)
800
- throw Error("Expected text node to be first child of span");
801
- ge.setStart(xt, He), ge.setEnd(Ct, ze), O(), O = u(m, ge, (Et) => {
802
- for (const qr of Et) {
803
- const G = qr.style;
804
- G.background !== "Highlight" && (G.background = "Highlight"), G.color !== "HighlightText" && (G.color = "HighlightText"), G.zIndex !== "-1" && (G.zIndex = "-1"), G.pointerEvents !== "none" && (G.pointerEvents = "none"), G.marginTop !== d(-1.5) && (G.marginTop = d(-1.5)), G.paddingTop !== d(4) && (G.paddingTop = d(4)), G.paddingBottom !== d(0) && (G.paddingBottom = d(0));
805
- }
806
- v !== void 0 && v(Et);
807
- });
808
- }
809
- }
810
- N = A, y = U, R = V, S = re;
811
- });
812
- }
813
- return k(m.getEditorState()), i(m.registerUpdateListener(({
814
- editorState: $
815
- }) => k($)), O, () => {
816
- O();
817
- });
818
- }
819
- function c(m, ...v) {
820
- v.forEach((N) => {
821
- if (typeof N == "string") {
822
- const y = N.split(" ").filter((R) => R !== "");
823
- m.classList.add(...y);
824
- }
825
- });
826
- }
827
- function o(m, ...v) {
828
- v.forEach((N) => {
829
- typeof N == "string" && m.classList.remove(...N.split(" "));
830
- });
831
- }
832
- function n(m, v) {
833
- for (const N of v)
834
- if (m.type.startsWith(N))
835
- return !0;
836
- return !1;
837
- }
838
- function r(m, v) {
839
- const N = m[Symbol.iterator]();
840
- return new Promise((y, R) => {
841
- const S = [], O = () => {
842
- const {
843
- done: k,
844
- value: $
845
- } = N.next();
846
- if (k)
847
- return y(S);
848
- const D = new FileReader();
849
- D.addEventListener("error", R), D.addEventListener("load", () => {
850
- const w = D.result;
851
- typeof w == "string" && S.push({
852
- file: $,
853
- result: w
854
- }), O();
855
- }), n($, v) ? D.readAsDataURL($) : O();
856
- };
857
- O();
858
- });
859
- }
860
- function a(m, v) {
861
- const N = [], y = (m || e.$getRoot()).getLatest(), R = v || (e.$isElementNode(y) ? y.getLastDescendant() : y);
862
- let S = y, O = g(S);
863
- for (; S !== null && !S.is(R); )
864
- if (N.push({
865
- depth: O,
866
- node: S
867
- }), e.$isElementNode(S) && S.getChildrenSize() > 0)
868
- S = S.getFirstChild(), O++;
869
- else {
870
- let k = null;
871
- for (; k === null && S !== null; )
872
- k = S.getNextSibling(), k === null ? (S = S.getParent(), O--) : S = k;
873
- }
874
- return S !== null && S.is(R) && N.push({
875
- depth: O,
876
- node: S
877
- }), N;
878
- }
879
- function g(m) {
880
- let v = m, N = 0;
881
- for (; (v = v.getParent()) !== null; )
882
- N++;
883
- return N;
884
- }
885
- function f(m, v) {
886
- let N = m;
887
- for (; N != null; ) {
888
- if (N instanceof v)
889
- return N;
890
- N = N.getParent();
891
- }
892
- return null;
893
- }
894
- function p(m) {
895
- const v = h(m, (N) => e.$isElementNode(N) && !N.isInline());
896
- if (!e.$isElementNode(v))
897
- throw Error(`Expected node ${m.__key} to have closest block element node.`);
898
- return v;
899
- }
900
- const h = (m, v) => {
901
- let N = m;
902
- for (; N !== e.$getRoot() && N != null; ) {
903
- if (v(N))
904
- return N;
905
- N = N.getParent();
906
- }
907
- return null;
908
- };
909
- function x(m, v, N, y) {
910
- const R = (k) => k instanceof v, S = (k) => {
911
- const $ = k.getChildren();
912
- for (let H = 0; H < $.length; H++) {
913
- const A = $[H];
914
- if (R(A))
915
- return null;
916
- }
917
- let D = k, w = k;
918
- for (; D !== null; )
919
- if (w = D, D = D.getParent(), R(D))
920
- return {
921
- child: w,
922
- parent: D
923
- };
924
- return null;
925
- }, O = (k) => {
926
- const $ = S(k);
927
- if ($ !== null) {
928
- const {
929
- child: D,
930
- parent: w
931
- } = $;
932
- if (D.is(k)) {
933
- y(w, k);
934
- const H = D.getNextSiblings(), A = H.length;
935
- if (w.insertAfter(D), A !== 0) {
936
- const j = N(w);
937
- D.insertAfter(j);
938
- for (let U = 0; U < A; U++)
939
- j.append(H[U]);
940
- }
941
- !w.canBeEmpty() && w.getChildrenSize() === 0 && w.remove();
942
- }
943
- }
944
- };
945
- return m.registerNodeTransform(v, O);
946
- }
947
- function C(m, v) {
948
- const y = /* @__PURE__ */ new Map(), R = m._pendingEditorState;
949
- for (const [O, k] of v._nodeMap) {
950
- const $ = t.$cloneWithProperties(k);
951
- if (e.$isTextNode($)) {
952
- if (!e.$isTextNode(k))
953
- throw Error("Expected node be a TextNode");
954
- $.__text = k.__text;
955
- }
956
- y.set(O, $);
957
- }
958
- R && (R._nodeMap = y), m._dirtyType = 2;
959
- const S = v._selection;
960
- e.$setSelection(S === null ? null : S.clone());
961
- }
962
- function L(m) {
963
- const v = e.$getSelection() || e.$getPreviousSelection();
964
- if (e.$isRangeSelection(v)) {
965
- const {
966
- focus: N
967
- } = v, y = N.getNode(), R = N.offset;
968
- if (e.$isRootOrShadowRoot(y)) {
969
- const S = y.getChildAtIndex(R);
970
- S == null ? y.append(m) : S.insertBefore(m), m.selectNext();
971
- } else {
972
- let S, O;
973
- e.$isTextNode(y) ? (S = y.getParentOrThrow(), O = y.getIndexWithinParent(), R > 0 && (O += 1, y.splitText(R))) : (S = y, O = R);
974
- const [, k] = e.$splitNode(S, O);
975
- k.insertBefore(m), k.selectStart();
976
- }
977
- } else {
978
- if (v != null) {
979
- const y = v.getNodes();
980
- y[y.length - 1].getTopLevelElementOrThrow().insertAfter(m);
981
- } else
982
- e.$getRoot().append(m);
983
- const N = e.$createParagraphNode();
984
- m.insertAfter(N), N.select();
985
- }
986
- return m.getLatest();
987
- }
988
- function E(m, v) {
989
- const N = v();
990
- return m.replace(N), N.append(m), N;
991
- }
992
- function T(m, v) {
993
- return m !== null ? Object.getPrototypeOf(m).constructor.name === v.name : !1;
994
- }
995
- function M(m, v) {
996
- const N = [];
997
- for (let y = 0; y < m.length; y++) {
998
- const R = v(m[y]);
999
- R !== null && N.push(R);
1000
- }
1001
- return N;
1002
- }
1003
- function b(m, v) {
1004
- const N = m.getFirstChild();
1005
- N !== null ? N.insertBefore(v) : m.append(v);
1006
- }
1007
- return I.$splitNode = e.$splitNode, I.isHTMLAnchorElement = e.isHTMLAnchorElement, I.isHTMLElement = e.isHTMLElement, I.$dfs = a, I.$filter = M, I.$findMatchingParent = h, I.$getNearestBlockElementAncestorOrThrow = p, I.$getNearestNodeOfType = f, I.$insertFirst = b, I.$insertNodeToNearestRoot = L, I.$restoreEditorState = C, I.$wrapNodeInElement = E, I.addClassNamesToElement = c, I.isMimeType = n, I.markSelection = l, I.mediaFileReader = r, I.mergeRegister = i, I.objectKlassEquals = T, I.positionNodeOnRange = u, I.registerNestedElementResolver = x, I.removeClassNamesFromElement = o, I;
1008
- }
1009
- var B = {}, It;
1010
- function Xn() {
1011
- if (It)
1012
- return B;
1013
- It = 1;
1014
- var t = sr, e = W;
1015
- function i(o) {
1016
- let n = new URLSearchParams();
1017
- n.append("code", o);
1018
- for (let r = 1; r < arguments.length; r++)
1019
- n.append("v", arguments[r]);
1020
- throw Error(`Minified Lexical error #${o}; visit https://lexical.dev/docs/error?${n} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`);
1021
- }
1022
- function d(...o) {
1023
- return () => {
1024
- o.forEach((n) => n());
1025
- };
1026
- }
1027
- let s = { attributes: !0, characterData: !0, childList: !0, subtree: !0 };
1028
- function u(o, n, r) {
1029
- function a() {
1030
- if (p === null)
1031
- throw Error("Unexpected null rootDOMNode");
1032
- if (h === null)
1033
- throw Error("Unexpected null parentDOMNode");
1034
- let { left: T, top: M } = p.getBoundingClientRect();
1035
- var b = h;
1036
- let m = t.createRectsFromDOMRange(o, n);
1037
- L.isConnected || b.append(L), b = !1;
1038
- for (let y = 0; y < m.length; y++) {
1039
- var v = m[y];
1040
- let R = C[y] || document.createElement("div"), S = R.style;
1041
- S.position !== "absolute" && (S.position = "absolute", b = !0);
1042
- var N = `${v.left - T}px`;
1043
- S.left !== N && (S.left = N, b = !0), N = `${v.top - M}px`, S.top !== N && (R.style.top = N, b = !0), N = `${v.width}px`, S.width !== N && (R.style.width = N, b = !0), v = `${v.height}px`, S.height !== v && (R.style.height = v, b = !0), R.parentNode !== L && (L.append(R), b = !0), C[y] = R;
1044
- }
1045
- for (; C.length > m.length; )
1046
- C.pop();
1047
- b && r(C);
1048
- }
1049
- function g() {
1050
- p = h = null, x !== null && x.disconnect(), x = null, L.remove();
1051
- for (let T of C)
1052
- T.remove();
1053
- C = [];
1054
- }
1055
- function f() {
1056
- let T = o.getRootElement();
1057
- if (T === null)
1058
- return g();
1059
- let M = T.parentElement;
1060
- if (!(M instanceof HTMLElement))
1061
- return g();
1062
- g(), p = T, h = M, x = new MutationObserver((b) => {
1063
- let m = o.getRootElement(), v = m && m.parentElement;
1064
- if (m !== p || v !== h)
1065
- return f();
1066
- for (let N of b)
1067
- if (!L.contains(N.target))
1068
- return a();
1069
- }), x.observe(M, s), a();
1070
- }
1071
- let p = null, h = null, x = null, C = [], L = document.createElement("div"), E = o.registerRootListener(f);
1072
- return () => {
1073
- E(), g();
1074
- };
1075
- }
1076
- function l(o, n) {
1077
- for (let r of n)
1078
- if (o.type.startsWith(r))
1079
- return !0;
1080
- return !1;
1081
- }
1082
- let c = (o, n) => {
1083
- for (; o !== e.$getRoot() && o != null; ) {
1084
- if (n(o))
1085
- return o;
1086
- o = o.getParent();
1087
- }
1088
- return null;
1089
- };
1090
- return B.$splitNode = e.$splitNode, B.isHTMLAnchorElement = e.isHTMLAnchorElement, B.isHTMLElement = e.isHTMLElement, B.$dfs = function(o, n) {
1091
- let r = [];
1092
- o = (o || e.$getRoot()).getLatest(), n = n || (e.$isElementNode(o) ? o.getLastDescendant() : o);
1093
- for (var a = o, g = 0; (a = a.getParent()) !== null; )
1094
- g++;
1095
- for (a = g; o !== null && !o.is(n); )
1096
- if (r.push({ depth: a, node: o }), e.$isElementNode(o) && 0 < o.getChildrenSize())
1097
- o = o.getFirstChild(), a++;
1098
- else
1099
- for (g = null; g === null && o !== null; )
1100
- g = o.getNextSibling(), g === null ? (o = o.getParent(), a--) : o = g;
1101
- return o !== null && o.is(n) && r.push({ depth: a, node: o }), r;
1102
- }, B.$filter = function(o, n) {
1103
- let r = [];
1104
- for (let a = 0; a < o.length; a++) {
1105
- let g = n(o[a]);
1106
- g !== null && r.push(g);
1107
- }
1108
- return r;
1109
- }, B.$findMatchingParent = c, B.$getNearestBlockElementAncestorOrThrow = function(o) {
1110
- let n = c(o, (r) => e.$isElementNode(r) && !r.isInline());
1111
- return e.$isElementNode(n) || i(4, o.__key), n;
1112
- }, B.$getNearestNodeOfType = function(o, n) {
1113
- for (; o != null; ) {
1114
- if (o instanceof n)
1115
- return o;
1116
- o = o.getParent();
1117
- }
1118
- return null;
1119
- }, B.$insertFirst = function(o, n) {
1120
- let r = o.getFirstChild();
1121
- r !== null ? r.insertBefore(n) : o.append(n);
1122
- }, B.$insertNodeToNearestRoot = function(o) {
1123
- var n = e.$getSelection() || e.$getPreviousSelection();
1124
- if (e.$isRangeSelection(n)) {
1125
- var { focus: r } = n;
1126
- if (n = r.getNode(), r = r.offset, e.$isRootOrShadowRoot(n))
1127
- r = n.getChildAtIndex(r), r == null ? n.append(o) : r.insertBefore(o), o.selectNext();
1128
- else {
1129
- let a, g;
1130
- e.$isTextNode(n) ? (a = n.getParentOrThrow(), g = n.getIndexWithinParent(), 0 < r && (g += 1, n.splitText(r))) : (a = n, g = r), [, n] = e.$splitNode(a, g), n.insertBefore(o), n.selectStart();
1131
- }
1132
- } else
1133
- n != null ? (n = n.getNodes(), n[n.length - 1].getTopLevelElementOrThrow().insertAfter(o)) : e.$getRoot().append(o), n = e.$createParagraphNode(), o.insertAfter(n), n.select();
1134
- return o.getLatest();
1135
- }, B.$restoreEditorState = function(o, n) {
1136
- let r = /* @__PURE__ */ new Map(), a = o._pendingEditorState;
1137
- for (let [g, f] of n._nodeMap) {
1138
- let p = t.$cloneWithProperties(f);
1139
- if (e.$isTextNode(p)) {
1140
- if (!e.$isTextNode(f))
1141
- throw Error("Expected node be a TextNode");
1142
- p.__text = f.__text;
1143
- }
1144
- r.set(g, p);
1145
- }
1146
- a && (a._nodeMap = r), o._dirtyType = 2, o = n._selection, e.$setSelection(o === null ? null : o.clone());
1147
- }, B.$wrapNodeInElement = function(o, n) {
1148
- return n = n(), o.replace(n), n.append(o), n;
1149
- }, B.addClassNamesToElement = function(o, ...n) {
1150
- n.forEach((r) => {
1151
- typeof r == "string" && (r = r.split(" ").filter((a) => a !== ""), o.classList.add(...r));
1152
- });
1153
- }, B.isMimeType = l, B.markSelection = function(o, n) {
1154
- function r(x) {
1155
- x.read(() => {
1156
- var C = e.$getSelection();
1157
- if (e.$isRangeSelection(C)) {
1158
- var { anchor: L, focus: E } = C;
1159
- C = L.getNode();
1160
- var T = C.getKey(), M = L.offset, b = E.getNode(), m = b.getKey(), v = E.offset, N = o.getElementByKey(T), y = o.getElementByKey(m);
1161
- if (T = a === null || N === null || M !== g || T !== a.getKey() || C !== a && (!(a instanceof e.TextNode) || C.updateDOM(a, N, o._config)), m = f === null || y === null || v !== p || m !== f.getKey() || b !== f && (!(f instanceof e.TextNode) || b.updateDOM(f, y, o._config)), T || m) {
1162
- N = o.getElementByKey(L.getNode().getKey());
1163
- var R = o.getElementByKey(E.getNode().getKey());
1164
- if (N !== null && R !== null && N.tagName === "SPAN" && R.tagName === "SPAN") {
1165
- if (m = document.createRange(), E.isBefore(L) ? (T = R, y = E.offset, R = N, N = L.offset) : (T = N, y = L.offset, N = E.offset), T = T.firstChild, T === null || (R = R.firstChild, R === null))
1166
- throw Error("Expected text node to be first child of span");
1167
- m.setStart(T, y), m.setEnd(R, N), h(), h = u(o, m, (S) => {
1168
- for (let O of S) {
1169
- let k = O.style;
1170
- k.background !== "Highlight" && (k.background = "Highlight"), k.color !== "HighlightText" && (k.color = "HighlightText"), k.zIndex !== "-1" && (k.zIndex = "-1"), k.pointerEvents !== "none" && (k.pointerEvents = "none"), k.marginTop !== "-1.5px" && (k.marginTop = "-1.5px"), k.paddingTop !== "4px" && (k.paddingTop = "4px"), k.paddingBottom !== "0px" && (k.paddingBottom = "0px");
1171
- }
1172
- n !== void 0 && n(S);
1173
- });
1174
- }
1175
- }
1176
- a = C, g = M, f = b, p = v;
1177
- } else
1178
- p = f = g = a = null, h(), h = () => {
1179
- };
1180
- });
1181
- }
1182
- let a = null, g = null, f = null, p = null, h = () => {
1183
- };
1184
- return r(o.getEditorState()), d(o.registerUpdateListener(({ editorState: x }) => r(x)), h, () => {
1185
- h();
1186
- });
1187
- }, B.mediaFileReader = function(o, n) {
1188
- let r = o[Symbol.iterator]();
1189
- return new Promise((a, g) => {
1190
- let f = [], p = () => {
1191
- const { done: h, value: x } = r.next();
1192
- if (h)
1193
- return a(f);
1194
- const C = new FileReader();
1195
- C.addEventListener("error", g), C.addEventListener("load", () => {
1196
- const L = C.result;
1197
- typeof L == "string" && f.push({ file: x, result: L }), p();
1198
- }), l(x, n) ? C.readAsDataURL(x) : p();
1199
- };
1200
- p();
1201
- });
1202
- }, B.mergeRegister = d, B.objectKlassEquals = function(o, n) {
1203
- return o !== null ? Object.getPrototypeOf(o).constructor.name === n.name : !1;
1204
- }, B.positionNodeOnRange = u, B.registerNestedElementResolver = function(o, n, r, a) {
1205
- return o.registerNodeTransform(n, (g) => {
1206
- e: {
1207
- for (var f = g.getChildren(), p = 0; p < f.length; p++)
1208
- if (f[p] instanceof n) {
1209
- f = null;
1210
- break e;
1211
- }
1212
- for (f = g; f !== null; )
1213
- if (p = f, f = f.getParent(), f instanceof n) {
1214
- f = { child: p, parent: f };
1215
- break e;
1216
- }
1217
- f = null;
1218
- }
1219
- if (f !== null) {
1220
- const { child: h, parent: x } = f;
1221
- if (h.is(g)) {
1222
- if (a(x, g), g = h.getNextSiblings(), f = g.length, x.insertAfter(h), f !== 0) {
1223
- p = r(x), h.insertAfter(p);
1224
- for (let C = 0; C < f; C++)
1225
- p.append(g[C]);
1226
- }
1227
- x.canBeEmpty() || x.getChildrenSize() !== 0 || x.remove();
1228
- }
1229
- }
1230
- });
1231
- }, B.removeClassNamesFromElement = function(o, ...n) {
1232
- n.forEach((r) => {
1233
- typeof r == "string" && o.classList.remove(...r.split(" "));
1234
- });
1235
- }, B;
1236
- }
1237
- const Qn = process.env.NODE_ENV === "development" ? Jn() : Xn();
1238
- var z = Qn, Je = {}, Bt;
1239
- function Zn() {
1240
- if (Bt)
1241
- return Je;
1242
- Bt = 1;
1243
- var t = W;
1244
- function e(i) {
1245
- const d = window.location.origin, s = (u) => {
1246
- if (u.origin !== d)
1247
- return;
1248
- const l = i.getRootElement();
1249
- if (document.activeElement !== l)
1250
- return;
1251
- const c = u.data;
1252
- if (typeof c == "string") {
1253
- let o;
1254
- try {
1255
- o = JSON.parse(c);
1256
- } catch {
1257
- return;
1258
- }
1259
- if (o && o.protocol === "nuanria_messaging" && o.type === "request") {
1260
- const n = o.payload;
1261
- if (n && n.functionId === "makeChanges") {
1262
- const r = n.args;
1263
- if (r) {
1264
- const [a, g, f, p, h, x] = r;
1265
- i.update(() => {
1266
- const C = t.$getSelection();
1267
- if (t.$isRangeSelection(C)) {
1268
- const L = C.anchor;
1269
- let E = L.getNode(), T = 0, M = 0;
1270
- if (t.$isTextNode(E) && a >= 0 && g >= 0 && (T = a, M = a + g, C.setTextNodeRange(E, T, E, M)), (T !== M || f !== "") && (C.insertRawText(f), E = L.getNode()), t.$isTextNode(E)) {
1271
- T = p, M = p + h;
1272
- const b = E.getTextContentSize();
1273
- T = T > b ? b : T, M = M > b ? b : M, C.setTextNodeRange(E, T, E, M);
1274
- }
1275
- u.stopImmediatePropagation();
1276
- }
1277
- });
1278
- }
1279
- }
1280
- }
1281
- }
1282
- };
1283
- return window.addEventListener("message", s, !0), () => {
1284
- window.removeEventListener("message", s, !0);
1285
- };
1286
- }
1287
- return Je.registerDragonSupport = e, Je;
1288
- }
1289
- var Xe = {}, Ht;
1290
- function eo() {
1291
- if (Ht)
1292
- return Xe;
1293
- Ht = 1;
1294
- var t = W;
1295
- return Xe.registerDragonSupport = function(e) {
1296
- let i = window.location.origin, d = (s) => {
1297
- if (s.origin === i) {
1298
- var u = e.getRootElement();
1299
- if (document.activeElement === u && (u = s.data, typeof u == "string")) {
1300
- try {
1301
- var l = JSON.parse(u);
1302
- } catch {
1303
- return;
1304
- }
1305
- if (l && l.protocol === "nuanria_messaging" && l.type === "request" && (l = l.payload) && l.functionId === "makeChanges" && (l = l.args)) {
1306
- const [c, o, n, r, a] = l;
1307
- e.update(() => {
1308
- const g = t.$getSelection();
1309
- if (t.$isRangeSelection(g)) {
1310
- var f = g.anchor;
1311
- let p = f.getNode(), h = 0, x = 0;
1312
- t.$isTextNode(p) && 0 <= c && 0 <= o && (h = c, x = c + o, g.setTextNodeRange(p, h, p, x)), (h !== x || n !== "") && (g.insertRawText(n), p = f.getNode()), t.$isTextNode(p) && (h = r, x = r + a, f = p.getTextContentSize(), h = h > f ? f : h, x = x > f ? f : x, g.setTextNodeRange(p, h, p, x)), s.stopImmediatePropagation();
1313
- }
1314
- });
1315
- }
1316
- }
1317
- }
1318
- };
1319
- return window.addEventListener("message", d, !0), () => {
1320
- window.removeEventListener("message", d, !0);
1321
- };
1322
- }, Xe;
1323
- }
1324
- var Qe, Ft;
1325
- function wr() {
1326
- return Ft || (Ft = 1, Qe = process.env.NODE_ENV === "development" ? Zn() : eo()), Qe;
1327
- }
1328
- var zt;
1329
- function to() {
1330
- if (zt)
1331
- return We;
1332
- zt = 1;
1333
- var t = P, e = $r(), i = q, d = Dr(), s = z, u = Lr, l = wr(), c = fr, r = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u" ? i.useLayoutEffect : i.useEffect;
1334
- function a(C) {
1335
- return C.getEditorState().read(d.$canShowPlaceholderCurry(C.isComposing()));
1336
- }
1337
- function g(C) {
1338
- const [L, E] = i.useState(() => a(C));
1339
- return r(() => {
1340
- function T() {
1341
- const M = a(C);
1342
- E(M);
1343
- }
1344
- return T(), s.mergeRegister(C.registerUpdateListener(() => {
1345
- T();
1346
- }), C.registerEditableListener(() => {
1347
- T();
1348
- }));
1349
- }, [C]), L;
1350
- }
1351
- function f(C, L) {
1352
- const [E, T] = i.useState(() => C.getDecorators());
1353
- return r(() => C.registerDecoratorListener((M) => {
1354
- u.flushSync(() => {
1355
- T(M);
1356
- });
1357
- }), [C]), i.useEffect(() => {
1358
- T(C.getDecorators());
1359
- }, [C]), i.useMemo(() => {
1360
- const M = [], b = Object.keys(E);
1361
- for (let m = 0; m < b.length; m++) {
1362
- const v = b[m], N = /* @__PURE__ */ i.createElement(L, {
1363
- onError: (R) => C._onError(R)
1364
- }, /* @__PURE__ */ i.createElement(i.Suspense, {
1365
- fallback: null
1366
- }, E[v])), y = C.getElementByKey(v);
1367
- y !== null && M.push(/* @__PURE__ */ u.createPortal(N, y, v));
1368
- }
1369
- return M;
1370
- }, [L, E, C]);
1371
- }
1372
- function p(C) {
1373
- r(() => s.mergeRegister(c.registerRichText(C), l.registerDragonSupport(C)), [C]);
1374
- }
1375
- function h({
1376
- contentEditable: C,
1377
- placeholder: L,
1378
- ErrorBoundary: E
1379
- }) {
1380
- const [T] = t.useLexicalComposerContext(), M = f(T, E);
1381
- return p(T), /* @__PURE__ */ i.createElement(i.Fragment, null, C, /* @__PURE__ */ i.createElement(x, {
1382
- content: L
1383
- }), M);
1384
- }
1385
- function x({
1386
- content: C
1387
- }) {
1388
- const [L] = t.useLexicalComposerContext(), E = g(L), T = e();
1389
- return E ? typeof C == "function" ? C(T) : C : null;
1390
- }
1391
- return We.RichTextPlugin = h, We;
1392
- }
1393
- var Ze = {}, qt;
1394
- function ro() {
1395
- if (qt)
1396
- return Ze;
1397
- qt = 1;
1398
- var t = P, e = $r(), i = q, d = Dr(), s = z, u = Lr, l = wr(), c = fr, o = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u" ? i.useLayoutEffect : i.useEffect;
1399
- function n(p) {
1400
- return p.getEditorState().read(d.$canShowPlaceholderCurry(p.isComposing()));
1401
- }
1402
- function r(p) {
1403
- let [h, x] = i.useState(() => n(p));
1404
- return o(() => {
1405
- function C() {
1406
- let L = n(p);
1407
- x(L);
1408
- }
1409
- return C(), s.mergeRegister(p.registerUpdateListener(() => {
1410
- C();
1411
- }), p.registerEditableListener(() => {
1412
- C();
1413
- }));
1414
- }, [p]), h;
1415
- }
1416
- function a(p, h) {
1417
- let [x, C] = i.useState(() => p.getDecorators());
1418
- return o(() => p.registerDecoratorListener((L) => {
1419
- u.flushSync(() => {
1420
- C(L);
1421
- });
1422
- }), [p]), i.useEffect(() => {
1423
- C(p.getDecorators());
1424
- }, [p]), i.useMemo(() => {
1425
- let L = [], E = Object.keys(x);
1426
- for (let T = 0; T < E.length; T++) {
1427
- let M = E[T], b = i.createElement(h, { onError: (v) => p._onError(v) }, i.createElement(i.Suspense, { fallback: null }, x[M])), m = p.getElementByKey(M);
1428
- m !== null && L.push(u.createPortal(b, m, M));
1429
- }
1430
- return L;
1431
- }, [h, x, p]);
1432
- }
1433
- function g(p) {
1434
- o(() => s.mergeRegister(c.registerRichText(p), l.registerDragonSupport(p)), [p]);
1435
- }
1436
- function f({ content: p }) {
1437
- var [h] = t.useLexicalComposerContext();
1438
- h = r(h);
1439
- let x = e();
1440
- return h ? typeof p == "function" ? p(x) : p : null;
1441
- }
1442
- return Ze.RichTextPlugin = function({ contentEditable: p, placeholder: h, ErrorBoundary: x }) {
1443
- let [C] = t.useLexicalComposerContext();
1444
- return x = a(C, x), g(C), i.createElement(i.Fragment, null, p, i.createElement(f, { content: h }), x);
1445
- }, Ze;
1446
- }
1447
- const no = process.env.NODE_ENV === "development" ? to() : ro();
1448
- var oo = no, et, Ut;
1449
- function io() {
1450
- if (Ut)
1451
- return et;
1452
- Ut = 1;
1453
- var t = q;
1454
- function e(c, o) {
1455
- return e = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(r, a) {
1456
- return r.__proto__ = a, r;
1457
- }, e(c, o);
1458
- }
1459
- function i(c, o) {
1460
- c.prototype = Object.create(o.prototype), c.prototype.constructor = c, e(c, o);
1461
- }
1462
- var d = function(o, n) {
1463
- return o === void 0 && (o = []), n === void 0 && (n = []), o.length !== n.length || o.some(function(r, a) {
1464
- return !Object.is(r, n[a]);
1465
- });
1466
- }, s = {
1467
- error: null
1468
- }, u = /* @__PURE__ */ function(c) {
1469
- i(o, c);
1470
- function o() {
1471
- for (var r, a = arguments.length, g = new Array(a), f = 0; f < a; f++)
1472
- g[f] = arguments[f];
1473
- return r = c.call.apply(c, [this].concat(g)) || this, r.state = s, r.resetErrorBoundary = function() {
1474
- for (var p, h = arguments.length, x = new Array(h), C = 0; C < h; C++)
1475
- x[C] = arguments[C];
1476
- r.props.onReset == null || (p = r.props).onReset.apply(p, x), r.reset();
1477
- }, r;
1478
- }
1479
- o.getDerivedStateFromError = function(a) {
1480
- return {
1481
- error: a
1482
- };
1483
- };
1484
- var n = o.prototype;
1485
- return n.reset = function() {
1486
- this.setState(s);
1487
- }, n.componentDidCatch = function(a, g) {
1488
- var f, p;
1489
- (f = (p = this.props).onError) == null || f.call(p, a, g);
1490
- }, n.componentDidUpdate = function(a, g) {
1491
- var f = this.state.error, p = this.props.resetKeys;
1492
- if (f !== null && g.error !== null && d(a.resetKeys, p)) {
1493
- var h, x;
1494
- (h = (x = this.props).onResetKeysChange) == null || h.call(x, a.resetKeys, p), this.reset();
1495
- }
1496
- }, n.render = function() {
1497
- var a = this.state.error, g = this.props, f = g.fallbackRender, p = g.FallbackComponent, h = g.fallback;
1498
- if (a !== null) {
1499
- var x = {
1500
- error: a,
1501
- resetErrorBoundary: this.resetErrorBoundary
1502
- };
1503
- if (/* @__PURE__ */ t.isValidElement(h))
1504
- return h;
1505
- if (typeof f == "function")
1506
- return f(x);
1507
- if (p)
1508
- return /* @__PURE__ */ t.createElement(p, x);
1509
- throw new Error("react-error-boundary requires either a fallback, fallbackRender, or FallbackComponent prop");
1510
- }
1511
- return this.props.children;
1512
- }, o;
1513
- }(t.Component);
1514
- function l({
1515
- children: c,
1516
- onError: o
1517
- }) {
1518
- return /* @__PURE__ */ t.createElement(u, {
1519
- fallback: /* @__PURE__ */ t.createElement("div", {
1520
- style: {
1521
- border: "1px solid #f00",
1522
- color: "#f00",
1523
- padding: "8px"
1524
- }
1525
- }, "An error was thrown."),
1526
- onError: o
1527
- }, c);
1528
- }
1529
- return et = l, et;
1530
- }
1531
- var tt, Kt;
1532
- function lo() {
1533
- if (Kt)
1534
- return tt;
1535
- Kt = 1;
1536
- var t = q;
1537
- function e(l, c) {
1538
- return e = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(o, n) {
1539
- return o.__proto__ = n, o;
1540
- }, e(l, c);
1541
- }
1542
- function i(l, c) {
1543
- l.prototype = Object.create(c.prototype), l.prototype.constructor = l, e(l, c);
1544
- }
1545
- function d(l, c) {
1546
- return l === void 0 && (l = []), c === void 0 && (c = []), l.length !== c.length || l.some(function(o, n) {
1547
- return !Object.is(o, c[n]);
1548
- });
1549
- }
1550
- var s = { error: null }, u = function(l) {
1551
- function c() {
1552
- for (var n, r = arguments.length, a = Array(r), g = 0; g < r; g++)
1553
- a[g] = arguments[g];
1554
- return n = l.call.apply(l, [this].concat(a)) || this, n.state = s, n.resetErrorBoundary = function() {
1555
- for (var f, p = arguments.length, h = Array(p), x = 0; x < p; x++)
1556
- h[x] = arguments[x];
1557
- n.props.onReset == null || (f = n.props).onReset.apply(f, h), n.reset();
1558
- }, n;
1559
- }
1560
- i(c, l), c.getDerivedStateFromError = function(n) {
1561
- return { error: n };
1562
- };
1563
- var o = c.prototype;
1564
- return o.reset = function() {
1565
- this.setState(s);
1566
- }, o.componentDidCatch = function(n, r) {
1567
- var a, g;
1568
- (a = (g = this.props).onError) == null || a.call(g, n, r);
1569
- }, o.componentDidUpdate = function(n, r) {
1570
- var a = this.props.resetKeys;
1571
- if (this.state.error !== null && r.error !== null && d(n.resetKeys, a)) {
1572
- var g, f;
1573
- (g = (f = this.props).onResetKeysChange) == null || g.call(f, n.resetKeys, a), this.reset();
1574
- }
1575
- }, o.render = function() {
1576
- var n = this.state.error, r = this.props, a = r.fallbackRender, g = r.FallbackComponent;
1577
- if (r = r.fallback, n !== null) {
1578
- if (n = { error: n, resetErrorBoundary: this.resetErrorBoundary }, t.isValidElement(r))
1579
- return r;
1580
- if (typeof a == "function")
1581
- return a(n);
1582
- if (g)
1583
- return t.createElement(g, n);
1584
- throw Error("react-error-boundary requires either a fallback, fallbackRender, or FallbackComponent prop");
1585
- }
1586
- return this.props.children;
1587
- }, c;
1588
- }(t.Component);
1589
- return tt = function({ children: l, onError: c }) {
1590
- return t.createElement(u, { fallback: t.createElement("div", { style: { border: "1px solid #f00", color: "#f00", padding: "8px" } }, "An error was thrown."), onError: c }, l);
1591
- }, tt;
1592
- }
1593
- const so = process.env.NODE_ENV === "development" ? io() : lo();
1594
- var ao = so;
1595
- const Ar = hn({ hasFocus: !1, editorRef: { current: null } }), co = ({ onBlur: t }) => {
1596
- const [e, i] = Y(!1), d = gt(null), s = J(() => {
1597
- i(!0), d.current && window.clearTimeout(d.current);
1598
- }, []), u = J(() => {
1599
- d.current = window.setTimeout(() => {
1600
- i(!1), t == null || t();
176
+ ], Ht = be({ hasFocus: !1, editorRef: { current: null } }), Xe = ({ onBlur: t }) => {
177
+ const [e, r] = b(!1), o = rt(null), i = v(() => {
178
+ r(!0), o.current && window.clearTimeout(o.current);
179
+ }, []), l = v(() => {
180
+ o.current = window.setTimeout(() => {
181
+ r(!1), t == null || t();
1601
182
  }, 0);
1602
183
  }, [t]);
1603
184
  return {
1604
185
  hasFocus: e,
1605
186
  attributes: {
1606
- onFocus: s,
1607
- onBlur: u
187
+ onFocus: i,
188
+ onBlur: l
1608
189
  }
1609
190
  };
1610
- }, mt = () => mn(Ar);
1611
- function uo(t) {
1612
- return F({ tag: "svg", attr: { viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { stroke: "none", d: "M0 0h24v24H0z", fill: "none" } }, { tag: "path", attr: { d: "M7 5h6a3.5 3.5 0 0 1 0 7h-6z" } }, { tag: "path", attr: { d: "M13 12h1a3.5 3.5 0 0 1 0 7h-7v-7" } }] })(t);
191
+ }, at = () => ve(Ht);
192
+ function Qe(t) {
193
+ return h({ tag: "svg", attr: { viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { stroke: "none", d: "M0 0h24v24H0z", fill: "none" } }, { tag: "path", attr: { d: "M7 5h6a3.5 3.5 0 0 1 0 7h-6z" } }, { tag: "path", attr: { d: "M13 12h1a3.5 3.5 0 0 1 0 7h-7v-7" } }] })(t);
1613
194
  }
1614
- function fo(t) {
1615
- return F({ tag: "svg", attr: { viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { stroke: "none", d: "M0 0h24v24H0z", fill: "none" } }, { tag: "path", attr: { d: "M7 8l-4 4l4 4" } }, { tag: "path", attr: { d: "M17 8l4 4l-4 4" } }, { tag: "path", attr: { d: "M14 4l-4 16" } }] })(t);
195
+ function Ve(t) {
196
+ return h({ tag: "svg", attr: { viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { stroke: "none", d: "M0 0h24v24H0z", fill: "none" } }, { tag: "path", attr: { d: "M7 8l-4 4l4 4" } }, { tag: "path", attr: { d: "M17 8l4 4l-4 4" } }, { tag: "path", attr: { d: "M14 4l-4 16" } }] })(t);
1616
197
  }
1617
- function go(t) {
1618
- return F({ tag: "svg", attr: { viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { stroke: "none", d: "M0 0h24v24H0z", fill: "none" } }, { tag: "path", attr: { d: "M19 18v-8l-2 2" } }, { tag: "path", attr: { d: "M4 6v12" } }, { tag: "path", attr: { d: "M12 6v12" } }, { tag: "path", attr: { d: "M11 18h2" } }, { tag: "path", attr: { d: "M3 18h2" } }, { tag: "path", attr: { d: "M4 12h8" } }, { tag: "path", attr: { d: "M3 6h2" } }, { tag: "path", attr: { d: "M11 6h2" } }] })(t);
198
+ function Ze(t) {
199
+ return h({ tag: "svg", attr: { viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { stroke: "none", d: "M0 0h24v24H0z", fill: "none" } }, { tag: "path", attr: { d: "M19 18v-8l-2 2" } }, { tag: "path", attr: { d: "M4 6v12" } }, { tag: "path", attr: { d: "M12 6v12" } }, { tag: "path", attr: { d: "M11 18h2" } }, { tag: "path", attr: { d: "M3 18h2" } }, { tag: "path", attr: { d: "M4 12h8" } }, { tag: "path", attr: { d: "M3 6h2" } }, { tag: "path", attr: { d: "M11 6h2" } }] })(t);
1619
200
  }
1620
- function po(t) {
1621
- return F({ tag: "svg", attr: { viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { stroke: "none", d: "M0 0h24v24H0z", fill: "none" } }, { tag: "path", attr: { d: "M17 12a2 2 0 1 1 4 0c0 .591 -.417 1.318 -.816 1.858l-3.184 4.143l4 0" } }, { tag: "path", attr: { d: "M4 6v12" } }, { tag: "path", attr: { d: "M12 6v12" } }, { tag: "path", attr: { d: "M11 18h2" } }, { tag: "path", attr: { d: "M3 18h2" } }, { tag: "path", attr: { d: "M4 12h8" } }, { tag: "path", attr: { d: "M3 6h2" } }, { tag: "path", attr: { d: "M11 6h2" } }] })(t);
201
+ function tr(t) {
202
+ return h({ tag: "svg", attr: { viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { stroke: "none", d: "M0 0h24v24H0z", fill: "none" } }, { tag: "path", attr: { d: "M17 12a2 2 0 1 1 4 0c0 .591 -.417 1.318 -.816 1.858l-3.184 4.143l4 0" } }, { tag: "path", attr: { d: "M4 6v12" } }, { tag: "path", attr: { d: "M12 6v12" } }, { tag: "path", attr: { d: "M11 18h2" } }, { tag: "path", attr: { d: "M3 18h2" } }, { tag: "path", attr: { d: "M4 12h8" } }, { tag: "path", attr: { d: "M3 6h2" } }, { tag: "path", attr: { d: "M11 6h2" } }] })(t);
1622
203
  }
1623
- function ho(t) {
1624
- return F({ tag: "svg", attr: { viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { stroke: "none", d: "M0 0h24v24H0z", fill: "none" } }, { tag: "path", attr: { d: "M19 14a2 2 0 1 0 -2 -2" } }, { tag: "path", attr: { d: "M17 16a2 2 0 1 0 2 -2" } }, { tag: "path", attr: { d: "M4 6v12" } }, { tag: "path", attr: { d: "M12 6v12" } }, { tag: "path", attr: { d: "M11 18h2" } }, { tag: "path", attr: { d: "M3 18h2" } }, { tag: "path", attr: { d: "M4 12h8" } }, { tag: "path", attr: { d: "M3 6h2" } }, { tag: "path", attr: { d: "M11 6h2" } }] })(t);
204
+ function er(t) {
205
+ return h({ tag: "svg", attr: { viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { stroke: "none", d: "M0 0h24v24H0z", fill: "none" } }, { tag: "path", attr: { d: "M19 14a2 2 0 1 0 -2 -2" } }, { tag: "path", attr: { d: "M17 16a2 2 0 1 0 2 -2" } }, { tag: "path", attr: { d: "M4 6v12" } }, { tag: "path", attr: { d: "M12 6v12" } }, { tag: "path", attr: { d: "M11 18h2" } }, { tag: "path", attr: { d: "M3 18h2" } }, { tag: "path", attr: { d: "M4 12h8" } }, { tag: "path", attr: { d: "M3 6h2" } }, { tag: "path", attr: { d: "M11 6h2" } }] })(t);
1625
206
  }
1626
- function mo(t) {
1627
- return F({ tag: "svg", attr: { viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { stroke: "none", d: "M0 0h24v24H0z", fill: "none" } }, { tag: "path", attr: { d: "M20 18v-8l-4 6h5" } }, { tag: "path", attr: { d: "M4 6v12" } }, { tag: "path", attr: { d: "M12 6v12" } }, { tag: "path", attr: { d: "M11 18h2" } }, { tag: "path", attr: { d: "M3 18h2" } }, { tag: "path", attr: { d: "M4 12h8" } }, { tag: "path", attr: { d: "M3 6h2" } }, { tag: "path", attr: { d: "M11 6h2" } }] })(t);
207
+ function rr(t) {
208
+ return h({ tag: "svg", attr: { viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { stroke: "none", d: "M0 0h24v24H0z", fill: "none" } }, { tag: "path", attr: { d: "M20 18v-8l-4 6h5" } }, { tag: "path", attr: { d: "M4 6v12" } }, { tag: "path", attr: { d: "M12 6v12" } }, { tag: "path", attr: { d: "M11 18h2" } }, { tag: "path", attr: { d: "M3 18h2" } }, { tag: "path", attr: { d: "M4 12h8" } }, { tag: "path", attr: { d: "M3 6h2" } }, { tag: "path", attr: { d: "M11 6h2" } }] })(t);
1628
209
  }
1629
- function xo(t) {
1630
- return F({ tag: "svg", attr: { viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { stroke: "none", d: "M0 0h24v24H0z", fill: "none" } }, { tag: "path", attr: { d: "M17 18h2a2 2 0 1 0 0 -4h-2v-4h4" } }, { tag: "path", attr: { d: "M4 6v12" } }, { tag: "path", attr: { d: "M12 6v12" } }, { tag: "path", attr: { d: "M11 18h2" } }, { tag: "path", attr: { d: "M3 18h2" } }, { tag: "path", attr: { d: "M4 12h8" } }, { tag: "path", attr: { d: "M3 6h2" } }, { tag: "path", attr: { d: "M11 6h2" } }] })(t);
210
+ function nr(t) {
211
+ return h({ tag: "svg", attr: { viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { stroke: "none", d: "M0 0h24v24H0z", fill: "none" } }, { tag: "path", attr: { d: "M17 18h2a2 2 0 1 0 0 -4h-2v-4h4" } }, { tag: "path", attr: { d: "M4 6v12" } }, { tag: "path", attr: { d: "M12 6v12" } }, { tag: "path", attr: { d: "M11 18h2" } }, { tag: "path", attr: { d: "M3 18h2" } }, { tag: "path", attr: { d: "M4 12h8" } }, { tag: "path", attr: { d: "M3 6h2" } }, { tag: "path", attr: { d: "M11 6h2" } }] })(t);
1631
212
  }
1632
- function Co(t) {
1633
- return F({ tag: "svg", attr: { viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { stroke: "none", d: "M0 0h24v24H0z", fill: "none" } }, { tag: "path", attr: { d: "M19 14a2 2 0 1 0 0 4a2 2 0 0 0 0 -4z" } }, { tag: "path", attr: { d: "M21 12a2 2 0 1 0 -4 0v4" } }, { tag: "path", attr: { d: "M4 6v12" } }, { tag: "path", attr: { d: "M12 6v12" } }, { tag: "path", attr: { d: "M11 18h2" } }, { tag: "path", attr: { d: "M3 18h2" } }, { tag: "path", attr: { d: "M4 12h8" } }, { tag: "path", attr: { d: "M3 6h2" } }, { tag: "path", attr: { d: "M11 6h2" } }] })(t);
213
+ function or(t) {
214
+ return h({ tag: "svg", attr: { viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { stroke: "none", d: "M0 0h24v24H0z", fill: "none" } }, { tag: "path", attr: { d: "M19 14a2 2 0 1 0 0 4a2 2 0 0 0 0 -4z" } }, { tag: "path", attr: { d: "M21 12a2 2 0 1 0 -4 0v4" } }, { tag: "path", attr: { d: "M4 6v12" } }, { tag: "path", attr: { d: "M12 6v12" } }, { tag: "path", attr: { d: "M11 18h2" } }, { tag: "path", attr: { d: "M3 18h2" } }, { tag: "path", attr: { d: "M4 12h8" } }, { tag: "path", attr: { d: "M3 6h2" } }, { tag: "path", attr: { d: "M11 6h2" } }] })(t);
1634
215
  }
1635
- function Eo(t) {
1636
- return F({ tag: "svg", attr: { viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { stroke: "none", d: "M0 0h24v24H0z", fill: "none" } }, { tag: "path", attr: { d: "M11 5l6 0" } }, { tag: "path", attr: { d: "M7 19l6 0" } }, { tag: "path", attr: { d: "M14 5l-4 14" } }] })(t);
216
+ function ir(t) {
217
+ return h({ tag: "svg", attr: { viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { stroke: "none", d: "M0 0h24v24H0z", fill: "none" } }, { tag: "path", attr: { d: "M11 5l6 0" } }, { tag: "path", attr: { d: "M7 19l6 0" } }, { tag: "path", attr: { d: "M14 5l-4 14" } }] })(t);
1637
218
  }
1638
- function No(t) {
1639
- return F({ tag: "svg", attr: { viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { stroke: "none", d: "M0 0h24v24H0z", fill: "none" } }, { tag: "path", attr: { d: "M17.5 15.5m-3.5 0a3.5 3.5 0 1 0 7 0a3.5 3.5 0 1 0 -7 0" } }, { tag: "path", attr: { d: "M3 19v-10.5a3.5 3.5 0 0 1 7 0v10.5" } }, { tag: "path", attr: { d: "M3 13h7" } }, { tag: "path", attr: { d: "M21 12v7" } }] })(t);
219
+ function ar(t) {
220
+ return h({ tag: "svg", attr: { viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { stroke: "none", d: "M0 0h24v24H0z", fill: "none" } }, { tag: "path", attr: { d: "M17.5 15.5m-3.5 0a3.5 3.5 0 1 0 7 0a3.5 3.5 0 1 0 -7 0" } }, { tag: "path", attr: { d: "M3 19v-10.5a3.5 3.5 0 0 1 7 0v10.5" } }, { tag: "path", attr: { d: "M3 13h7" } }, { tag: "path", attr: { d: "M21 12v7" } }] })(t);
1640
221
  }
1641
- function To(t) {
1642
- return F({ tag: "svg", attr: { viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { stroke: "none", d: "M0 0h24v24H0z", fill: "none" } }, { tag: "path", attr: { d: "M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5" } }, { tag: "path", attr: { d: "M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5" } }] })(t);
222
+ function lr(t) {
223
+ return h({ tag: "svg", attr: { viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { stroke: "none", d: "M0 0h24v24H0z", fill: "none" } }, { tag: "path", attr: { d: "M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5" } }, { tag: "path", attr: { d: "M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5" } }] })(t);
1643
224
  }
1644
- function vo(t) {
1645
- return F({ tag: "svg", attr: { viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { stroke: "none", d: "M0 0h24v24H0z", fill: "none" } }, { tag: "path", attr: { d: "M3.5 5.5l1.5 1.5l2.5 -2.5" } }, { tag: "path", attr: { d: "M3.5 11.5l1.5 1.5l2.5 -2.5" } }, { tag: "path", attr: { d: "M3.5 17.5l1.5 1.5l2.5 -2.5" } }, { tag: "path", attr: { d: "M11 6l9 0" } }, { tag: "path", attr: { d: "M11 12l9 0" } }, { tag: "path", attr: { d: "M11 18l9 0" } }] })(t);
225
+ function sr(t) {
226
+ return h({ tag: "svg", attr: { viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { stroke: "none", d: "M0 0h24v24H0z", fill: "none" } }, { tag: "path", attr: { d: "M3.5 5.5l1.5 1.5l2.5 -2.5" } }, { tag: "path", attr: { d: "M3.5 11.5l1.5 1.5l2.5 -2.5" } }, { tag: "path", attr: { d: "M3.5 17.5l1.5 1.5l2.5 -2.5" } }, { tag: "path", attr: { d: "M11 6l9 0" } }, { tag: "path", attr: { d: "M11 12l9 0" } }, { tag: "path", attr: { d: "M11 18l9 0" } }] })(t);
1646
227
  }
1647
- function _o(t) {
1648
- return F({ tag: "svg", attr: { viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { stroke: "none", d: "M0 0h24v24H0z", fill: "none" } }, { tag: "path", attr: { d: "M11 6h9" } }, { tag: "path", attr: { d: "M11 12h9" } }, { tag: "path", attr: { d: "M12 18h8" } }, { tag: "path", attr: { d: "M4 16a2 2 0 1 1 4 0c0 .591 -.5 1 -1 1.5l-3 2.5h4" } }, { tag: "path", attr: { d: "M6 10v-6l-2 2" } }] })(t);
228
+ function cr(t) {
229
+ return h({ tag: "svg", attr: { viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { stroke: "none", d: "M0 0h24v24H0z", fill: "none" } }, { tag: "path", attr: { d: "M11 6h9" } }, { tag: "path", attr: { d: "M11 12h9" } }, { tag: "path", attr: { d: "M12 18h8" } }, { tag: "path", attr: { d: "M4 16a2 2 0 1 1 4 0c0 .591 -.5 1 -1 1.5l-3 2.5h4" } }, { tag: "path", attr: { d: "M6 10v-6l-2 2" } }] })(t);
1649
230
  }
1650
- function Lo(t) {
1651
- return F({ tag: "svg", attr: { viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { stroke: "none", d: "M0 0h24v24H0z", fill: "none" } }, { tag: "path", attr: { d: "M9 6l11 0" } }, { tag: "path", attr: { d: "M9 12l11 0" } }, { tag: "path", attr: { d: "M9 18l11 0" } }, { tag: "path", attr: { d: "M5 6l0 .01" } }, { tag: "path", attr: { d: "M5 12l0 .01" } }, { tag: "path", attr: { d: "M5 18l0 .01" } }] })(t);
231
+ function dr(t) {
232
+ return h({ tag: "svg", attr: { viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { stroke: "none", d: "M0 0h24v24H0z", fill: "none" } }, { tag: "path", attr: { d: "M9 6l11 0" } }, { tag: "path", attr: { d: "M9 12l11 0" } }, { tag: "path", attr: { d: "M9 18l11 0" } }, { tag: "path", attr: { d: "M5 6l0 .01" } }, { tag: "path", attr: { d: "M5 12l0 .01" } }, { tag: "path", attr: { d: "M5 18l0 .01" } }] })(t);
1652
233
  }
1653
- function yo(t) {
1654
- return F({ tag: "svg", attr: { viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { stroke: "none", d: "M0 0h24v24H0z", fill: "none" } }, { tag: "path", attr: { d: "M10 11h-4a1 1 0 0 1 -1 -1v-3a1 1 0 0 1 1 -1h3a1 1 0 0 1 1 1v6c0 2.667 -1.333 4.333 -4 5" } }, { tag: "path", attr: { d: "M19 11h-4a1 1 0 0 1 -1 -1v-3a1 1 0 0 1 1 -1h3a1 1 0 0 1 1 1v6c0 2.667 -1.333 4.333 -4 5" } }] })(t);
234
+ function ur(t) {
235
+ return h({ tag: "svg", attr: { viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { stroke: "none", d: "M0 0h24v24H0z", fill: "none" } }, { tag: "path", attr: { d: "M10 11h-4a1 1 0 0 1 -1 -1v-3a1 1 0 0 1 1 -1h3a1 1 0 0 1 1 1v6c0 2.667 -1.333 4.333 -4 5" } }, { tag: "path", attr: { d: "M19 11h-4a1 1 0 0 1 -1 -1v-3a1 1 0 0 1 1 -1h3a1 1 0 0 1 1 1v6c0 2.667 -1.333 4.333 -4 5" } }] })(t);
1655
236
  }
1656
- function Mo(t) {
1657
- return F({ tag: "svg", attr: { viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { stroke: "none", d: "M0 0h24v24H0z", fill: "none" } }, { tag: "path", attr: { d: "M5 7l8 10m-8 0l8 -10" } }, { tag: "path", attr: { d: "M21 11h-4l3.5 -4a1.73 1.73 0 0 0 -3.5 -2" } }] })(t);
237
+ function hr(t) {
238
+ return h({ tag: "svg", attr: { viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { stroke: "none", d: "M0 0h24v24H0z", fill: "none" } }, { tag: "path", attr: { d: "M5 7l8 10m-8 0l8 -10" } }, { tag: "path", attr: { d: "M21 11h-4l3.5 -4a1.73 1.73 0 0 0 -3.5 -2" } }] })(t);
1658
239
  }
1659
- function Ro(t) {
1660
- return F({ tag: "svg", attr: { viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { stroke: "none", d: "M0 0h24v24H0z", fill: "none" } }, { tag: "path", attr: { d: "M4 4m0 2a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2z" } }, { tag: "path", attr: { d: "M4 10l16 0" } }, { tag: "path", attr: { d: "M10 4l0 16" } }] })(t);
240
+ function pr(t) {
241
+ return h({ tag: "svg", attr: { viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { stroke: "none", d: "M0 0h24v24H0z", fill: "none" } }, { tag: "path", attr: { d: "M4 4m0 2a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2z" } }, { tag: "path", attr: { d: "M4 10l16 0" } }, { tag: "path", attr: { d: "M10 4l0 16" } }] })(t);
1661
242
  }
1662
- function bo(t) {
1663
- return F({ tag: "svg", attr: { viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { stroke: "none", d: "M0 0h24v24H0z", fill: "none" } }, { tag: "path", attr: { d: "M7 5v5a5 5 0 0 0 10 0v-5" } }, { tag: "path", attr: { d: "M5 19h14" } }] })(t);
243
+ function gr(t) {
244
+ return h({ tag: "svg", attr: { viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { stroke: "none", d: "M0 0h24v24H0z", fill: "none" } }, { tag: "path", attr: { d: "M7 5v5a5 5 0 0 0 10 0v-5" } }, { tag: "path", attr: { d: "M5 19h14" } }] })(t);
1664
245
  }
1665
- const So = $n("div", {
246
+ const fr = Pe("div", {
1666
247
  width: "10rem",
1667
248
  display: "flex"
1668
- }), Pr = {
249
+ }), Ut = {
1669
250
  bullet: "Punktliste",
1670
251
  h1: "Overskrift 1",
1671
252
  h2: "Overskrift 2",
@@ -1677,24 +258,24 @@ const So = $n("div", {
1677
258
  paragraph: "Normal",
1678
259
  quote: "Sitat",
1679
260
  check: "Avkrysningsliste"
1680
- }, ko = {
1681
- bullet: /* @__PURE__ */ _(Lo, { size: "1.25rem" }),
1682
- h1: /* @__PURE__ */ _(go, { size: "1.25rem" }),
1683
- h2: /* @__PURE__ */ _(po, { size: "1.25rem" }),
1684
- h3: /* @__PURE__ */ _(ho, { size: "1.25rem" }),
1685
- h4: /* @__PURE__ */ _(mo, { size: "1.25rem" }),
1686
- h5: /* @__PURE__ */ _(xo, { size: "1.25rem" }),
1687
- h6: /* @__PURE__ */ _(Co, { size: "1.25rem" }),
1688
- number: /* @__PURE__ */ _(_o, { size: "1.25rem" }),
1689
- check: /* @__PURE__ */ _(vo, { size: "1.25rem" }),
1690
- paragraph: /* @__PURE__ */ _(No, { size: "1.25rem" }),
1691
- quote: /* @__PURE__ */ _(yo, { size: "1.25rem" })
1692
- }, Q = ({
261
+ }, mr = {
262
+ bullet: /* @__PURE__ */ n(dr, { size: "1.25rem" }),
263
+ h1: /* @__PURE__ */ n(Ze, { size: "1.25rem" }),
264
+ h2: /* @__PURE__ */ n(tr, { size: "1.25rem" }),
265
+ h3: /* @__PURE__ */ n(er, { size: "1.25rem" }),
266
+ h4: /* @__PURE__ */ n(rr, { size: "1.25rem" }),
267
+ h5: /* @__PURE__ */ n(nr, { size: "1.25rem" }),
268
+ h6: /* @__PURE__ */ n(or, { size: "1.25rem" }),
269
+ number: /* @__PURE__ */ n(cr, { size: "1.25rem" }),
270
+ check: /* @__PURE__ */ n(sr, { size: "1.25rem" }),
271
+ paragraph: /* @__PURE__ */ n(ar, { size: "1.25rem" }),
272
+ quote: /* @__PURE__ */ n(ur, { size: "1.25rem" })
273
+ }, M = ({
1693
274
  blockType: t
1694
- }) => /* @__PURE__ */ K(Ie, { children: [
1695
- /* @__PURE__ */ _(_e, { css: { display: "flex", flex: "0 0 auto" }, children: ko[t] }),
1696
- /* @__PURE__ */ _(
1697
- _e,
275
+ }) => /* @__PURE__ */ g(Y, { children: [
276
+ /* @__PURE__ */ n(P, { css: { display: "flex", flex: "0 0 auto" }, children: mr[t] }),
277
+ /* @__PURE__ */ n(
278
+ P,
1698
279
  {
1699
280
  css: {
1700
281
  flex: "1 1 auto",
@@ -1702,872 +283,326 @@ const So = $n("div", {
1702
283
  textOverflow: "ellipsis",
1703
284
  whiteSpace: "nowrap"
1704
285
  },
1705
- children: Pr[t]
286
+ children: Ut[t]
1706
287
  }
1707
288
  )
1708
- ] }), Oo = (t) => {
1709
- if (!te(t))
289
+ ] }), kr = (t) => {
290
+ if (!L(t))
1710
291
  return null;
1711
292
  const e = t.anchor.getNode();
1712
- let i = e.getKey() === "root" ? e : z.$findMatchingParent(e, (d) => {
1713
- const s = d.getParent();
1714
- return s !== null && Vr(s);
293
+ let r = e.getKey() === "root" ? e : Dt(e, (o) => {
294
+ const i = o.getParent();
295
+ return i !== null && Vt(i);
1715
296
  });
1716
- return i === null && (i = e.getTopLevelElementOrThrow()), {
297
+ return r === null && (r = e.getTopLevelElementOrThrow()), {
1717
298
  anchorNode: e,
1718
- element: i
299
+ element: r
1719
300
  };
1720
- }, $o = () => {
1721
- const [t] = P.useLexicalComposerContext(), [e, i] = Y("paragraph");
1722
- oe(() => t.registerCommand(
1723
- Le,
301
+ }, br = () => {
302
+ const [t] = y(), [e, r] = b("paragraph");
303
+ x(() => t.registerCommand(
304
+ F,
1724
305
  () => {
1725
- const n = ee(), r = Oo(n);
1726
- if (!r)
306
+ const c = T(), f = kr(c);
307
+ if (!f)
1727
308
  return !1;
1728
- const { element: a, anchorNode: g } = r, f = a.getKey();
1729
- if (t.getElementByKey(f) !== null)
1730
- if (ft(a)) {
1731
- const h = z.$getNearestNodeOfType(
1732
- g,
1733
- dt
1734
- ), x = h ? h.getListType() : a.getListType();
1735
- i(x);
309
+ const { element: u, anchorNode: m } = f, w = u.getKey();
310
+ if (t.getElementByKey(w) !== null)
311
+ if (et(u)) {
312
+ const k = Be(
313
+ m,
314
+ tt
315
+ ), S = k ? k.getListType() : u.getListType();
316
+ r(S);
1736
317
  } else {
1737
- const h = an(a) ? a.getTag() : a.getType();
1738
- h in Pr && i(h);
318
+ const k = ue(u) ? u.getTag() : u.getType();
319
+ k in Ut && r(k);
1739
320
  }
1740
321
  return !1;
1741
322
  },
1742
- at
323
+ Q
1743
324
  ), [t]);
1744
- const d = (n) => {
1745
- e !== n && t.update(() => {
1746
- const r = ee();
1747
- te(r) && (qe(r, () => cn(n)), i(n));
325
+ const o = (c) => {
326
+ e !== c && t.update(() => {
327
+ const f = T();
328
+ L(f) && (J(f, () => he(c)), r(c));
1748
329
  });
1749
330
  };
1750
- return /* @__PURE__ */ _(So, { children: /* @__PURE__ */ K(
1751
- pt,
331
+ return /* @__PURE__ */ n(fr, { children: /* @__PURE__ */ g(
332
+ nt,
1752
333
  {
1753
- trigger: /* @__PURE__ */ _(
1754
- Nr,
334
+ trigger: /* @__PURE__ */ n(
335
+ Et,
1755
336
  {
1756
337
  dropdown: !0,
1757
338
  css: { display: "flex", width: "100%", overflow: "hidden" },
1758
- children: /* @__PURE__ */ _(Q, { blockType: e })
339
+ children: /* @__PURE__ */ n(M, { blockType: e })
1759
340
  }
1760
341
  ),
1761
342
  side: "bottom",
1762
343
  align: "start",
1763
344
  children: [
1764
- /* @__PURE__ */ _(Z, { onClick: () => {
345
+ /* @__PURE__ */ n(C, { onClick: () => {
1765
346
  e !== "paragraph" && t.update(() => {
1766
- const n = ee();
1767
- te(n) && (qe(n, () => Pe()), i("paragraph"));
347
+ const c = T();
348
+ L(c) && (J(c, () => q()), r("paragraph"));
1768
349
  });
1769
- }, children: /* @__PURE__ */ _(Q, { blockType: "paragraph" }) }),
1770
- /* @__PURE__ */ _(Z, { onClick: () => d("h1"), children: /* @__PURE__ */ _(Q, { blockType: "h1" }) }),
1771
- /* @__PURE__ */ _(Z, { onClick: () => d("h2"), children: /* @__PURE__ */ _(Q, { blockType: "h2" }) }),
1772
- /* @__PURE__ */ _(Z, { onClick: () => d("h3"), children: /* @__PURE__ */ _(Q, { blockType: "h3" }) }),
1773
- /* @__PURE__ */ _(Z, { onClick: () => d("h4"), children: /* @__PURE__ */ _(Q, { blockType: "h4" }) }),
1774
- /* @__PURE__ */ _(Z, { onClick: () => d("h5"), children: /* @__PURE__ */ _(Q, { blockType: "h5" }) }),
1775
- /* @__PURE__ */ _(Z, { onClick: () => d("h6"), children: /* @__PURE__ */ _(Q, { blockType: "h6" }) }),
1776
- /* @__PURE__ */ _(Z, { onClick: () => {
1777
- e !== "bullet" && (t.dispatchCommand(on, void 0), i("bullet"));
1778
- }, children: /* @__PURE__ */ _(Q, { blockType: "bullet" }) }),
1779
- /* @__PURE__ */ _(Z, { onClick: () => {
1780
- e !== "number" && (t.dispatchCommand(ln, void 0), i("number"));
1781
- }, children: /* @__PURE__ */ _(Q, { blockType: "number" }) }),
1782
- /* @__PURE__ */ _(Z, { onClick: () => {
1783
- e !== "check" && (t.dispatchCommand(dr, void 0), i("check"));
1784
- }, children: /* @__PURE__ */ _(Q, { blockType: "check" }) }),
1785
- /* @__PURE__ */ _(Z, { onClick: () => {
350
+ }, children: /* @__PURE__ */ n(M, { blockType: "paragraph" }) }),
351
+ /* @__PURE__ */ n(C, { onClick: () => o("h1"), children: /* @__PURE__ */ n(M, { blockType: "h1" }) }),
352
+ /* @__PURE__ */ n(C, { onClick: () => o("h2"), children: /* @__PURE__ */ n(M, { blockType: "h2" }) }),
353
+ /* @__PURE__ */ n(C, { onClick: () => o("h3"), children: /* @__PURE__ */ n(M, { blockType: "h3" }) }),
354
+ /* @__PURE__ */ n(C, { onClick: () => o("h4"), children: /* @__PURE__ */ n(M, { blockType: "h4" }) }),
355
+ /* @__PURE__ */ n(C, { onClick: () => o("h5"), children: /* @__PURE__ */ n(M, { blockType: "h5" }) }),
356
+ /* @__PURE__ */ n(C, { onClick: () => o("h6"), children: /* @__PURE__ */ n(M, { blockType: "h6" }) }),
357
+ /* @__PURE__ */ n(C, { onClick: () => {
358
+ e !== "bullet" && (t.dispatchCommand(se, void 0), r("bullet"));
359
+ }, children: /* @__PURE__ */ n(M, { blockType: "bullet" }) }),
360
+ /* @__PURE__ */ n(C, { onClick: () => {
361
+ e !== "number" && (t.dispatchCommand(ce, void 0), r("number"));
362
+ }, children: /* @__PURE__ */ n(M, { blockType: "number" }) }),
363
+ /* @__PURE__ */ n(C, { onClick: () => {
364
+ e !== "check" && (t.dispatchCommand(Tt, void 0), r("check"));
365
+ }, children: /* @__PURE__ */ n(M, { blockType: "check" }) }),
366
+ /* @__PURE__ */ n(C, { onClick: () => {
1786
367
  e !== "quote" && t.update(() => {
1787
- const n = ee();
1788
- te(n) && (qe(n, () => un()), i("quote"));
368
+ const c = T();
369
+ L(c) && (J(c, () => pe()), r("quote"));
1789
370
  });
1790
- }, children: /* @__PURE__ */ _(Q, { blockType: "quote" }) })
371
+ }, children: /* @__PURE__ */ n(M, { blockType: "quote" }) })
1791
372
  ]
1792
373
  }
1793
374
  ) });
1794
- }, Do = () => {
1795
- const [t] = P.useLexicalComposerContext(), [e, i] = Y(!1), [d, s] = Y(!1), [u, l] = Y(!1), [c, o] = Y(!1), [n, r] = Y(!1), a = J(() => {
1796
- const L = ee();
1797
- te(L) && (i(L.hasFormat("bold")), s(L.hasFormat("italic")), l(L.hasFormat("underline")), o(L.hasFormat("code")), r(L.hasFormat("superscript")));
375
+ }, vr = () => {
376
+ const [t] = y(), [e, r] = b(!1), [o, i] = b(!1), [l, a] = b(!1), [s, d] = b(!1), [c, f] = b(!1), u = v(() => {
377
+ const p = T();
378
+ L(p) && (r(p.hasFormat("bold")), i(p.hasFormat("italic")), a(p.hasFormat("underline")), d(p.hasFormat("code")), f(p.hasFormat("superscript")));
1798
379
  }, []);
1799
- oe(() => z.mergeRegister(
380
+ x(() => it(
1800
381
  t.registerCommand(
1801
- Le,
1802
- () => (a(), !1),
1803
- at
382
+ F,
383
+ () => (u(), !1),
384
+ Q
1804
385
  ),
1805
- t.registerUpdateListener(({ editorState: L }) => {
1806
- L.read(() => {
1807
- a();
386
+ t.registerUpdateListener(({ editorState: p }) => {
387
+ p.read(() => {
388
+ u();
1808
389
  });
1809
390
  })
1810
- ), [t, a]);
1811
- const g = J(
1812
- () => t.dispatchCommand(Ee, "bold"),
391
+ ), [t, u]);
392
+ const m = v(
393
+ () => t.dispatchCommand(B, "bold"),
1813
394
  [t]
1814
- ), f = J(
1815
- () => t.dispatchCommand(Ee, "italic"),
395
+ ), w = v(
396
+ () => t.dispatchCommand(B, "italic"),
1816
397
  [t]
1817
- ), p = J(
1818
- () => t.dispatchCommand(Ee, "underline"),
398
+ ), N = v(
399
+ () => t.dispatchCommand(B, "underline"),
1819
400
  [t]
1820
- ), h = J(
1821
- () => t.dispatchCommand(Ee, "code"),
401
+ ), k = v(
402
+ () => t.dispatchCommand(B, "code"),
1822
403
  [t]
1823
- ), x = J(
1824
- () => t.dispatchCommand(Ee, "superscript"),
404
+ ), S = v(
405
+ () => t.dispatchCommand(B, "superscript"),
1825
406
  [t]
1826
- ), C = Er(() => {
1827
- const L = [];
1828
- return e && L.push("bold"), d && L.push("italic"), u && L.push("underline"), c && L.push("code"), n && L.push("superscript"), L;
1829
- }, [e, d, u, c, n]);
1830
- return /* @__PURE__ */ K(
1831
- Tr,
407
+ ), A = wt(() => {
408
+ const p = [];
409
+ return e && p.push("bold"), o && p.push("italic"), l && p.push("underline"), s && p.push("code"), c && p.push("superscript"), p;
410
+ }, [e, o, l, s, c]);
411
+ return /* @__PURE__ */ g(
412
+ _t,
1832
413
  {
1833
414
  type: "multiple",
1834
415
  "aria-label": "Tekstformattering",
1835
- value: C,
416
+ value: A,
1836
417
  children: [
1837
- /* @__PURE__ */ _(he, { onClick: g, title: "Fet tekst", value: "bold", children: /* @__PURE__ */ _(uo, { size: "1.25rem" }) }),
1838
- /* @__PURE__ */ _(
1839
- he,
418
+ /* @__PURE__ */ n(I, { onClick: m, title: "Fet tekst", value: "bold", children: /* @__PURE__ */ n(Qe, { size: "1.25rem" }) }),
419
+ /* @__PURE__ */ n(
420
+ I,
1840
421
  {
1841
- onClick: f,
422
+ onClick: w,
1842
423
  title: "Kursiv tekst",
1843
424
  value: "italic",
1844
- children: /* @__PURE__ */ _(Eo, { size: "1.25rem" })
425
+ children: /* @__PURE__ */ n(ir, { size: "1.25rem" })
1845
426
  }
1846
427
  ),
1847
- /* @__PURE__ */ _(
1848
- he,
428
+ /* @__PURE__ */ n(
429
+ I,
1849
430
  {
1850
- onClick: p,
431
+ onClick: N,
1851
432
  title: "Understreket tekst",
1852
433
  value: "underline",
1853
- children: /* @__PURE__ */ _(bo, { size: "1.25rem" })
434
+ children: /* @__PURE__ */ n(gr, { size: "1.25rem" })
1854
435
  }
1855
436
  ),
1856
- /* @__PURE__ */ _(he, { onClick: h, title: "Kode", value: "code", children: /* @__PURE__ */ _(fo, { size: "1.25rem" }) }),
1857
- /* @__PURE__ */ _(
1858
- he,
437
+ /* @__PURE__ */ n(I, { onClick: k, title: "Kode", value: "code", children: /* @__PURE__ */ n(Ve, { size: "1.25rem" }) }),
438
+ /* @__PURE__ */ n(
439
+ I,
1859
440
  {
1860
- onClick: x,
441
+ onClick: S,
1861
442
  title: "Superscript",
1862
443
  value: "superscript",
1863
- children: /* @__PURE__ */ _(Mo, { size: "1.25rem" })
444
+ children: /* @__PURE__ */ n(hr, { size: "1.25rem" })
1864
445
  }
1865
446
  )
1866
447
  ]
1867
448
  }
1868
449
  );
1869
- }, wo = ({ children: t }) => {
1870
- const { hasFocus: e, editorRef: i } = mt(), d = e, [s, u] = Y(d);
1871
- xn(() => {
1872
- u(d);
1873
- }, [d]);
1874
- const { context: l, refs: c, floatingStyles: o } = ht({
450
+ }, Mr = ({ children: t }) => {
451
+ const { hasFocus: e, editorRef: r } = at(), o = e, [i, l] = b(o);
452
+ Me(() => {
453
+ l(o);
454
+ }, [o]);
455
+ const { context: a, refs: s, floatingStyles: d } = ot({
1875
456
  placement: "top",
1876
- whileElementsMounted: yr,
457
+ whileElementsMounted: zt,
1877
458
  middleware: [
1878
- Mn({
1879
- apply: ({ rects: r, elements: a }) => {
1880
- a.floating.style.minWidth = `${r.reference.width}px`;
459
+ Ie({
460
+ apply: ({ rects: f, elements: u }) => {
461
+ u.floating.style.minWidth = `${f.reference.width}px`;
1881
462
  }
1882
463
  }),
1883
- Rn(),
1884
- Mr({
464
+ ze(),
465
+ Ot({
1885
466
  mainAxis: 8
1886
467
  }),
1887
- bn({
468
+ Oe({
1888
469
  padding: 8
1889
470
  })
1890
471
  ],
1891
- open: s,
1892
- onOpenChange: u,
472
+ open: i,
473
+ onOpenChange: l,
1893
474
  elements: {
1894
- reference: i.current
475
+ reference: r.current
1895
476
  }
1896
- }), { getFloatingProps: n } = Rr([
1897
- br(l, {
477
+ }), { getFloatingProps: c } = $t([
478
+ At(a, {
1898
479
  role: "dialog"
1899
480
  })
1900
481
  ]);
1901
- return s ? /* @__PURE__ */ _(Sr, { children: /* @__PURE__ */ _(
1902
- vr,
482
+ return i ? /* @__PURE__ */ n(Bt, { children: /* @__PURE__ */ n(
483
+ Rt,
1903
484
  {
1904
- ref: c.setFloating,
1905
- style: o,
1906
- ...n,
485
+ ref: s.setFloating,
486
+ style: d,
487
+ ...c,
1907
488
  css: {
1908
489
  border: "1px solid $border",
1909
490
  borderRadius: "$md",
1910
491
  overflow: "hidden",
1911
492
  boxShadow: "$md"
1912
493
  },
1913
- children: /* @__PURE__ */ _(Ao, { children: t })
494
+ children: /* @__PURE__ */ n(Cr, { children: t })
1914
495
  }
1915
496
  ) }) : null;
1916
- }, Ao = ({
497
+ }, Cr = ({
1917
498
  children: t,
1918
499
  ...e
1919
- }) => /* @__PURE__ */ K(Cn, { "aria-label": "Formattering", ...e, children: [
1920
- /* @__PURE__ */ _($o, {}),
1921
- /* @__PURE__ */ _(En, {}),
1922
- /* @__PURE__ */ _(Do, {}),
500
+ }) => /* @__PURE__ */ g(Ce, { "aria-label": "Formattering", ...e, children: [
501
+ /* @__PURE__ */ n(br, {}),
502
+ /* @__PURE__ */ n(Te, {}),
503
+ /* @__PURE__ */ n(vr, {}),
1923
504
  t
1924
505
  ] });
1925
- var rt = {}, Wt;
1926
- function Po() {
1927
- if (Wt)
1928
- return rt;
1929
- Wt = 1;
1930
- var t = cr, e = P, i = q, d = z, s = W;
1931
- function u(c) {
1932
- i.useEffect(() => d.mergeRegister(c.registerCommand(t.INSERT_ORDERED_LIST_COMMAND, () => (t.insertList(c, "number"), !0), s.COMMAND_PRIORITY_LOW), c.registerCommand(t.INSERT_UNORDERED_LIST_COMMAND, () => (t.insertList(c, "bullet"), !0), s.COMMAND_PRIORITY_LOW), c.registerCommand(t.REMOVE_LIST_COMMAND, () => (t.removeList(c), !0), s.COMMAND_PRIORITY_LOW), c.registerCommand(s.INSERT_PARAGRAPH_COMMAND, () => !!t.$handleListInsertParagraph(), s.COMMAND_PRIORITY_LOW)), [c]);
1933
- }
1934
- function l() {
1935
- const [c] = e.useLexicalComposerContext();
1936
- return i.useEffect(() => {
1937
- if (!c.hasNodes([t.ListNode, t.ListItemNode]))
1938
- throw new Error("ListPlugin: ListNode and/or ListItemNode not registered on editor");
1939
- }, [c]), u(c), null;
1940
- }
1941
- return rt.ListPlugin = l, rt;
1942
- }
1943
- var nt = {}, jt;
1944
- function Io() {
1945
- if (jt)
1946
- return nt;
1947
- jt = 1;
1948
- var t = cr, e = P, i = q, d = z, s = W;
1949
- function u(l) {
1950
- i.useEffect(() => d.mergeRegister(l.registerCommand(t.INSERT_ORDERED_LIST_COMMAND, () => (t.insertList(l, "number"), !0), s.COMMAND_PRIORITY_LOW), l.registerCommand(t.INSERT_UNORDERED_LIST_COMMAND, () => (t.insertList(l, "bullet"), !0), s.COMMAND_PRIORITY_LOW), l.registerCommand(t.REMOVE_LIST_COMMAND, () => (t.removeList(l), !0), s.COMMAND_PRIORITY_LOW), l.registerCommand(s.INSERT_PARAGRAPH_COMMAND, () => !!t.$handleListInsertParagraph(), s.COMMAND_PRIORITY_LOW)), [l]);
1951
- }
1952
- return nt.ListPlugin = function() {
1953
- let [l] = e.useLexicalComposerContext();
1954
- return i.useEffect(() => {
1955
- if (!l.hasNodes([t.ListNode, t.ListItemNode]))
1956
- throw Error("ListPlugin: ListNode and/or ListItemNode not registered on editor");
1957
- }, [l]), u(l), null;
1958
- }, nt;
1959
- }
1960
- const Bo = process.env.NODE_ENV === "development" ? Po() : Io();
1961
- var Ho = Bo, Me = {}, Re = {}, Yt;
1962
- function Fo() {
1963
- if (Yt)
1964
- return Re;
1965
- Yt = 1;
1966
- var t = z, e = W;
1967
- const i = 0, d = 1, s = 2, u = 0, l = 1, c = 2, o = 3, n = 4;
1968
- function r(E, T, M) {
1969
- const b = E._nodeMap, m = [];
1970
- for (const v of T) {
1971
- const N = b.get(v);
1972
- N !== void 0 && m.push(N);
1973
- }
1974
- for (const [v, N] of M) {
1975
- if (!N)
1976
- continue;
1977
- const y = b.get(v);
1978
- y !== void 0 && !e.$isRootNode(y) && m.push(y);
1979
- }
1980
- return m;
1981
- }
1982
- function a(E, T, M, b, m) {
1983
- if (E === null || M.size === 0 && b.size === 0 && !m)
1984
- return u;
1985
- const v = T._selection, N = E._selection;
1986
- if (m)
1987
- return l;
1988
- if (!e.$isRangeSelection(v) || !e.$isRangeSelection(N) || !N.isCollapsed() || !v.isCollapsed())
1989
- return u;
1990
- const y = r(T, M, b);
1991
- if (y.length === 0)
1992
- return u;
1993
- if (y.length > 1) {
1994
- const j = T._nodeMap, U = j.get(v.anchor.key), V = j.get(N.anchor.key);
1995
- return U && V && !E._nodeMap.has(U.__key) && e.$isTextNode(U) && U.__text.length === 1 && v.anchor.offset === 1 ? c : u;
1996
- }
1997
- const R = y[0], S = E._nodeMap.get(R.__key);
1998
- if (!e.$isTextNode(S) || !e.$isTextNode(R) || S.__mode !== R.__mode)
1999
- return u;
2000
- const O = S.__text, k = R.__text;
2001
- if (O === k)
2002
- return u;
2003
- const $ = v.anchor, D = N.anchor;
2004
- if ($.key !== D.key || $.type !== "text")
2005
- return u;
2006
- const w = $.offset, H = D.offset, A = k.length - O.length;
2007
- return A === 1 && H === w - 1 ? c : A === -1 && H === w + 1 ? o : A === -1 && H === w ? n : u;
2008
- }
2009
- function g(E, T, M) {
2010
- const b = T._nodeMap.get(E), m = M._nodeMap.get(E), v = T._selection, N = M._selection;
2011
- let y = !1;
2012
- return e.$isRangeSelection(v) && e.$isRangeSelection(N) && (y = v.anchor.type === "element" && v.focus.type === "element" && N.anchor.type === "text" && N.focus.type === "text"), !y && e.$isTextNode(b) && e.$isTextNode(m) ? b.__type === m.__type && b.__text === m.__text && b.__mode === m.__mode && b.__detail === m.__detail && b.__style === m.__style && b.__format === m.__format && b.__parent === m.__parent : !1;
2013
- }
2014
- function f(E, T) {
2015
- let M = Date.now(), b = u;
2016
- return (m, v, N, y, R, S) => {
2017
- const O = Date.now();
2018
- if (S.has("historic"))
2019
- return b = u, M = O, s;
2020
- const k = a(m, v, y, R, E.isComposing()), $ = (() => {
2021
- const D = N === null || N.editor === E, w = S.has("history-push");
2022
- if (!w && D && S.has("history-merge"))
2023
- return i;
2024
- if (m === null)
2025
- return d;
2026
- const A = v._selection;
2027
- if (!(y.size > 0 || R.size > 0))
2028
- return A !== null ? i : s;
2029
- if (w === !1 && k !== u && k === b && O < M + T && D)
2030
- return i;
2031
- if (y.size === 1) {
2032
- const U = Array.from(y)[0];
2033
- if (g(U, m, v))
2034
- return i;
2035
- }
2036
- return d;
2037
- })();
2038
- return M = O, b = k, $;
2039
- };
2040
- }
2041
- function p(E, T) {
2042
- const M = T.redoStack, b = T.undoStack;
2043
- if (M.length !== 0) {
2044
- const m = T.current;
2045
- m !== null && (b.push(m), E.dispatchCommand(e.CAN_UNDO_COMMAND, !0));
2046
- const v = M.pop();
2047
- M.length === 0 && E.dispatchCommand(e.CAN_REDO_COMMAND, !1), T.current = v || null, v && v.editor.setEditorState(v.editorState, {
2048
- tag: "historic"
2049
- });
2050
- }
2051
- }
2052
- function h(E, T) {
2053
- const M = T.redoStack, b = T.undoStack;
2054
- if (b.length !== 0) {
2055
- const v = T.current, N = b.pop();
2056
- v !== null && (M.push(v), E.dispatchCommand(e.CAN_REDO_COMMAND, !0)), b.length === 0 && E.dispatchCommand(e.CAN_UNDO_COMMAND, !1), T.current = N || null, N && N.editor.setEditorState(N.editorState, {
2057
- tag: "historic"
2058
- });
2059
- }
2060
- }
2061
- function x(E) {
2062
- E.undoStack = [], E.redoStack = [], E.current = null;
2063
- }
2064
- function C(E, T, M) {
2065
- const b = f(E, M), m = ({
2066
- editorState: y,
2067
- prevEditorState: R,
2068
- dirtyLeaves: S,
2069
- dirtyElements: O,
2070
- tags: k
2071
- }) => {
2072
- const $ = T.current, D = T.redoStack, w = T.undoStack, H = $ === null ? null : $.editorState;
2073
- if ($ !== null && y === H)
2074
- return;
2075
- const A = b(R, y, $, S, O, k);
2076
- if (A === d)
2077
- D.length !== 0 && (T.redoStack = [], E.dispatchCommand(e.CAN_REDO_COMMAND, !1)), $ !== null && (w.push({
2078
- ...$
2079
- }), E.dispatchCommand(e.CAN_UNDO_COMMAND, !0));
2080
- else if (A === s)
2081
- return;
2082
- T.current = {
2083
- editor: E,
2084
- editorState: y
2085
- };
2086
- }, v = t.mergeRegister(E.registerCommand(e.UNDO_COMMAND, () => (h(E, T), !0), e.COMMAND_PRIORITY_EDITOR), E.registerCommand(e.REDO_COMMAND, () => (p(E, T), !0), e.COMMAND_PRIORITY_EDITOR), E.registerCommand(e.CLEAR_EDITOR_COMMAND, () => (x(T), !1), e.COMMAND_PRIORITY_EDITOR), E.registerCommand(e.CLEAR_HISTORY_COMMAND, () => (x(T), E.dispatchCommand(e.CAN_REDO_COMMAND, !1), E.dispatchCommand(e.CAN_UNDO_COMMAND, !1), !0), e.COMMAND_PRIORITY_EDITOR), E.registerUpdateListener(m)), N = E.registerUpdateListener(m);
2087
- return () => {
2088
- v(), N();
2089
- };
2090
- }
2091
- function L() {
2092
- return {
2093
- current: null,
2094
- redoStack: [],
2095
- undoStack: []
2096
- };
2097
- }
2098
- return Re.createEmptyHistoryState = L, Re.registerHistory = C, Re;
2099
- }
2100
- var be = {}, Vt;
2101
- function zo() {
2102
- if (Vt)
2103
- return be;
2104
- Vt = 1;
2105
- var t = z, e = W;
2106
- function i(s, u, l, c, o) {
2107
- if (s === null || l.size === 0 && c.size === 0 && !o)
2108
- return 0;
2109
- var n = u._selection, r = s._selection;
2110
- if (o)
2111
- return 1;
2112
- if (!(e.$isRangeSelection(n) && e.$isRangeSelection(r) && r.isCollapsed() && n.isCollapsed()))
2113
- return 0;
2114
- o = u._nodeMap;
2115
- let a = [];
2116
- for (let g of l)
2117
- l = o.get(g), l !== void 0 && a.push(l);
2118
- for (let [g, f] of c)
2119
- f && (c = o.get(g), c === void 0 || e.$isRootNode(c) || a.push(c));
2120
- return a.length === 0 ? 0 : 1 < a.length ? (c = u._nodeMap, u = c.get(n.anchor.key), r = c.get(r.anchor.key), u && r && !s._nodeMap.has(u.__key) && e.$isTextNode(u) && u.__text.length === 1 && n.anchor.offset === 1 ? 2 : 0) : (u = a[0], s = s._nodeMap.get(u.__key), !e.$isTextNode(s) || !e.$isTextNode(u) || s.__mode !== u.__mode || (s = s.__text, u = u.__text, s === u) || (n = n.anchor, r = r.anchor, n.key !== r.key || n.type !== "text") ? 0 : (n = n.offset, r = r.offset, s = u.length - s.length, s === 1 && r === n - 1 ? 2 : s === -1 && r === n + 1 ? 3 : s === -1 && r === n ? 4 : 0));
2121
- }
2122
- function d(s, u) {
2123
- let l = Date.now(), c = 0;
2124
- return (o, n, r, a, g, f) => {
2125
- let p = Date.now();
2126
- if (f.has("historic"))
2127
- return c = 0, l = p, 2;
2128
- let h = i(o, n, a, g, s.isComposing()), x = (() => {
2129
- var C = r === null || r.editor === s, L = f.has("history-push");
2130
- if (!L && C && f.has("history-merge"))
2131
- return 0;
2132
- if (o === null)
2133
- return 1;
2134
- var E = n._selection;
2135
- if (!(0 < a.size || 0 < g.size))
2136
- return E !== null ? 0 : 2;
2137
- if (L === !1 && h !== 0 && h === c && p < l + u && C)
2138
- return 0;
2139
- if (a.size === 1) {
2140
- {
2141
- L = Array.from(a)[0], C = o._nodeMap.get(L), L = n._nodeMap.get(L), E = o._selection;
2142
- let T = n._selection, M = !1;
2143
- e.$isRangeSelection(E) && e.$isRangeSelection(T) && (M = E.anchor.type === "element" && E.focus.type === "element" && T.anchor.type === "text" && T.focus.type === "text"), C = !M && e.$isTextNode(C) && e.$isTextNode(L) ? C.__type === L.__type && C.__text === L.__text && C.__mode === L.__mode && C.__detail === L.__detail && C.__style === L.__style && C.__format === L.__format && C.__parent === L.__parent : !1;
2144
- }
2145
- if (C)
2146
- return 0;
2147
- }
2148
- return 1;
2149
- })();
2150
- return l = p, c = h, x;
2151
- };
2152
- }
2153
- return be.createEmptyHistoryState = function() {
2154
- return { current: null, redoStack: [], undoStack: [] };
2155
- }, be.registerHistory = function(s, u, l) {
2156
- let c = d(s, l);
2157
- l = ({ editorState: r, prevEditorState: a, dirtyLeaves: g, dirtyElements: f, tags: p }) => {
2158
- const h = u.current, x = u.redoStack, C = u.undoStack, L = h === null ? null : h.editorState;
2159
- if (h === null || r !== L) {
2160
- if (a = c(a, r, h, g, f, p), a === 1)
2161
- x.length !== 0 && (u.redoStack = [], s.dispatchCommand(e.CAN_REDO_COMMAND, !1)), h !== null && (C.push({ ...h }), s.dispatchCommand(e.CAN_UNDO_COMMAND, !0));
2162
- else if (a === 2)
2163
- return;
2164
- u.current = { editor: s, editorState: r };
2165
- }
2166
- };
2167
- let o = t.mergeRegister(s.registerCommand(
2168
- e.UNDO_COMMAND,
2169
- () => {
2170
- let r = u.redoStack, a = u.undoStack;
2171
- if (a.length !== 0) {
2172
- let g = u.current, f = a.pop();
2173
- g !== null && (r.push(g), s.dispatchCommand(e.CAN_REDO_COMMAND, !0)), a.length === 0 && s.dispatchCommand(e.CAN_UNDO_COMMAND, !1), u.current = f || null, f && f.editor.setEditorState(f.editorState, { tag: "historic" });
2174
- }
2175
- return !0;
2176
- },
2177
- e.COMMAND_PRIORITY_EDITOR
2178
- ), s.registerCommand(e.REDO_COMMAND, () => {
2179
- let r = u.redoStack;
2180
- var a = u.undoStack;
2181
- if (r.length !== 0) {
2182
- let g = u.current;
2183
- g !== null && (a.push(g), s.dispatchCommand(e.CAN_UNDO_COMMAND, !0)), a = r.pop(), r.length === 0 && s.dispatchCommand(e.CAN_REDO_COMMAND, !1), u.current = a || null, a && a.editor.setEditorState(a.editorState, { tag: "historic" });
2184
- }
2185
- return !0;
2186
- }, e.COMMAND_PRIORITY_EDITOR), s.registerCommand(e.CLEAR_EDITOR_COMMAND, () => (u.undoStack = [], u.redoStack = [], u.current = null, !1), e.COMMAND_PRIORITY_EDITOR), s.registerCommand(e.CLEAR_HISTORY_COMMAND, () => (u.undoStack = [], u.redoStack = [], u.current = null, s.dispatchCommand(e.CAN_REDO_COMMAND, !1), s.dispatchCommand(e.CAN_UNDO_COMMAND, !1), !0), e.COMMAND_PRIORITY_EDITOR), s.registerUpdateListener(l)), n = s.registerUpdateListener(l);
2187
- return () => {
2188
- o(), n();
2189
- };
2190
- }, be;
2191
- }
2192
- var ot, Gt;
2193
- function Ir() {
2194
- return Gt || (Gt = 1, ot = process.env.NODE_ENV === "development" ? Fo() : zo()), ot;
2195
- }
2196
- var Jt;
2197
- function qo() {
2198
- if (Jt)
2199
- return Me;
2200
- Jt = 1;
2201
- var t = P, e = Ir(), i = q;
2202
- function d(u, l, c = 1e3) {
2203
- const o = i.useMemo(() => l || e.createEmptyHistoryState(), [l]);
2204
- i.useEffect(() => e.registerHistory(u, o, c), [c, u, o]);
2205
- }
2206
- function s({
2207
- externalHistoryState: u
2208
- }) {
2209
- const [l] = t.useLexicalComposerContext();
2210
- return d(l, u), null;
2211
- }
2212
- return Me.createEmptyHistoryState = e.createEmptyHistoryState, Me.HistoryPlugin = s, Me;
2213
- }
2214
- var Se = {}, Xt;
2215
- function Uo() {
2216
- if (Xt)
2217
- return Se;
2218
- Xt = 1;
2219
- var t = P, e = Ir(), i = q;
2220
- function d(s, u, l = 1e3) {
2221
- let c = i.useMemo(() => u || e.createEmptyHistoryState(), [u]);
2222
- i.useEffect(() => e.registerHistory(s, c, l), [l, s, c]);
2223
- }
2224
- return Se.createEmptyHistoryState = e.createEmptyHistoryState, Se.HistoryPlugin = function({ externalHistoryState: s }) {
2225
- let [u] = t.useLexicalComposerContext();
2226
- return d(u, s), null;
2227
- }, Se;
2228
- }
2229
- const Ko = process.env.NODE_ENV === "development" ? qo() : Uo();
2230
- var Wo = Ko, it = {}, Qt;
2231
- function jo() {
2232
- if (Qt)
2233
- return it;
2234
- Qt = 1;
2235
- var t = P, e = hr, i = z, d = W, s = q;
2236
- function u({
2237
- hasCellMerge: l = !0,
2238
- hasCellBackgroundColor: c = !0,
2239
- hasTabHandler: o = !0
2240
- }) {
2241
- const [n] = t.useLexicalComposerContext();
2242
- return s.useEffect(() => {
2243
- if (!n.hasNodes([e.TableNode, e.TableCellNode, e.TableRowNode]))
2244
- throw Error("TablePlugin: TableNode, TableCellNode or TableRowNode not registered on editor");
2245
- return n.registerCommand(e.INSERT_TABLE_COMMAND, ({
2246
- columns: r,
2247
- rows: a,
2248
- includeHeaders: g
2249
- }) => {
2250
- const f = e.$createTableNodeWithDimensions(Number(a), Number(r), g);
2251
- i.$insertNodeToNearestRoot(f);
2252
- const p = f.getFirstDescendant();
2253
- return d.$isTextNode(p) && p.select(), !0;
2254
- }, d.COMMAND_PRIORITY_EDITOR);
2255
- }, [n]), s.useEffect(() => {
2256
- const r = /* @__PURE__ */ new Map(), a = (f) => {
2257
- const p = f.getKey(), h = n.getElementByKey(p);
2258
- if (h && !r.has(p)) {
2259
- const x = e.applyTableHandlers(f, h, n, o);
2260
- r.set(p, x);
2261
- }
2262
- };
2263
- n.getEditorState().read(() => {
2264
- const f = d.$nodesOfType(e.TableNode);
2265
- for (const p of f)
2266
- e.$isTableNode(p) && a(p);
2267
- });
2268
- const g = n.registerMutationListener(e.TableNode, (f) => {
2269
- for (const [p, h] of f)
2270
- if (h === "created")
2271
- n.getEditorState().read(() => {
2272
- const x = d.$getNodeByKey(p);
2273
- e.$isTableNode(x) && a(x);
2274
- });
2275
- else if (h === "destroyed") {
2276
- const x = r.get(p);
2277
- x !== void 0 && (x.removeListeners(), r.delete(p));
2278
- }
2279
- });
2280
- return () => {
2281
- g();
2282
- for (const [, f] of r)
2283
- f.removeListeners();
2284
- };
2285
- }, [n, o]), s.useEffect(() => {
2286
- if (!l)
2287
- return n.registerNodeTransform(e.TableCellNode, (r) => {
2288
- if (r.getColSpan() > 1 || r.getRowSpan() > 1) {
2289
- const [, , a] = d.DEPRECATED_$getNodeTriplet(r), [g] = d.DEPRECATED_$computeGridMap(a, r, r), f = g.length, p = g[0].length;
2290
- let h = a.getFirstChild();
2291
- if (!d.DEPRECATED_$isGridRowNode(h))
2292
- throw Error("Expected TableNode first child to be a RowNode");
2293
- const x = [];
2294
- for (let C = 0; C < f; C++) {
2295
- if (C !== 0 && (h = h.getNextSibling(), !d.DEPRECATED_$isGridRowNode(h)))
2296
- throw Error("Expected TableNode first child to be a RowNode");
2297
- let L = null;
2298
- for (let E = 0; E < p; E++) {
2299
- const T = g[C][E], M = T.cell;
2300
- if (T.startRow === C && T.startColumn === E)
2301
- L = M, x.push(M);
2302
- else if (M.getColSpan() > 1 || M.getRowSpan() > 1) {
2303
- if (!e.$isTableCellNode(M))
2304
- throw Error("Expected TableNode cell to be a TableCellNode");
2305
- const b = e.$createTableCellNode(M.__headerState);
2306
- L !== null ? L.insertAfter(b) : i.$insertFirst(h, b);
2307
- }
2308
- }
2309
- }
2310
- for (const C of x)
2311
- C.setColSpan(1), C.setRowSpan(1);
2312
- }
2313
- });
2314
- }, [n, l]), s.useEffect(() => {
2315
- if (!c)
2316
- return n.registerNodeTransform(e.TableCellNode, (r) => {
2317
- r.getBackgroundColor() !== null && r.setBackgroundColor(null);
2318
- });
2319
- }, [n, c, l]), null;
2320
- }
2321
- return it.TablePlugin = u, it;
2322
- }
2323
- var lt = {}, Zt;
2324
- function Yo() {
2325
- if (Zt)
2326
- return lt;
2327
- Zt = 1;
2328
- var t = P, e = hr, i = z, d = W, s = q;
2329
- function u(l) {
2330
- let c = new URLSearchParams();
2331
- c.append("code", l);
2332
- for (let o = 1; o < arguments.length; o++)
2333
- c.append("v", arguments[o]);
2334
- throw Error(`Minified Lexical error #${l}; visit https://lexical.dev/docs/error?${c} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`);
2335
- }
2336
- return lt.TablePlugin = function({ hasCellMerge: l = !0, hasCellBackgroundColor: c = !0, hasTabHandler: o = !0 }) {
2337
- let [n] = t.useLexicalComposerContext();
2338
- return s.useEffect(() => (n.hasNodes([e.TableNode, e.TableCellNode, e.TableRowNode]) || u(10), n.registerCommand(e.INSERT_TABLE_COMMAND, ({ columns: r, rows: a, includeHeaders: g }) => (r = e.$createTableNodeWithDimensions(Number(a), Number(r), g), i.$insertNodeToNearestRoot(r), r = r.getFirstDescendant(), d.$isTextNode(r) && r.select(), !0), d.COMMAND_PRIORITY_EDITOR)), [n]), s.useEffect(
2339
- () => {
2340
- let r = /* @__PURE__ */ new Map(), a = (f) => {
2341
- const p = f.getKey(), h = n.getElementByKey(p);
2342
- h && !r.has(p) && (f = e.applyTableHandlers(f, h, n, o), r.set(p, f));
2343
- };
2344
- n.getEditorState().read(() => {
2345
- let f = d.$nodesOfType(e.TableNode);
2346
- for (let p of f)
2347
- e.$isTableNode(p) && a(p);
2348
- });
2349
- let g = n.registerMutationListener(e.TableNode, (f) => {
2350
- for (const [p, h] of f)
2351
- h === "created" ? n.getEditorState().read(() => {
2352
- const x = d.$getNodeByKey(p);
2353
- e.$isTableNode(x) && a(x);
2354
- }) : h === "destroyed" && (f = r.get(p), f !== void 0 && (f.removeListeners(), r.delete(p)));
2355
- });
2356
- return () => {
2357
- g();
2358
- for (let [, f] of r)
2359
- f.removeListeners();
2360
- };
2361
- },
2362
- [n, o]
2363
- ), s.useEffect(() => {
2364
- if (!l)
2365
- return n.registerNodeTransform(e.TableCellNode, (r) => {
2366
- if (1 < r.getColSpan() || 1 < r.getRowSpan()) {
2367
- var [, , a] = d.DEPRECATED_$getNodeTriplet(r);
2368
- [r] = d.DEPRECATED_$computeGridMap(a, r, r);
2369
- let f = r.length, p = r[0].length;
2370
- if (a = a.getFirstChild(), !d.DEPRECATED_$isGridRowNode(a))
2371
- throw Error("Expected TableNode first child to be a RowNode");
2372
- let h = [];
2373
- for (let x = 0; x < f; x++) {
2374
- if (x !== 0 && (a = a.getNextSibling(), !d.DEPRECATED_$isGridRowNode(a)))
2375
- throw Error("Expected TableNode first child to be a RowNode");
2376
- let C = null;
2377
- for (let L = 0; L < p; L++) {
2378
- var g = r[x][L];
2379
- let E = g.cell;
2380
- if (g.startRow === x && g.startColumn === L)
2381
- C = E, h.push(E);
2382
- else if (1 < E.getColSpan() || 1 < E.getRowSpan()) {
2383
- if (!e.$isTableCellNode(E))
2384
- throw Error("Expected TableNode cell to be a TableCellNode");
2385
- g = e.$createTableCellNode(E.__headerState), C !== null ? C.insertAfter(g) : i.$insertFirst(a, g);
2386
- }
2387
- }
2388
- }
2389
- for (let x of h)
2390
- x.setColSpan(1), x.setRowSpan(1);
2391
- }
2392
- });
2393
- }, [n, l]), s.useEffect(
2394
- () => {
2395
- if (!c)
2396
- return n.registerNodeTransform(e.TableCellNode, (r) => {
2397
- r.getBackgroundColor() !== null && r.setBackgroundColor(null);
2398
- });
2399
- },
2400
- [n, c, l]
2401
- ), null;
2402
- }, lt;
2403
- }
2404
- const Vo = process.env.NODE_ENV === "development" ? jo() : Yo();
2405
- var Go = Vo, ke = {}, er;
2406
- function Jo() {
2407
- if (er)
2408
- return ke;
2409
- er = 1;
2410
- var t = P, e = z, i = W, d = q;
2411
- function s(c) {
2412
- const o = c.getNodes();
2413
- if (e.$filter(o, (h) => i.$isBlockElementNode(h) && h.canIndent() ? h : null).length > 0)
2414
- return !0;
2415
- const r = c.anchor, a = c.focus, g = a.isBefore(r) ? a : r, f = g.getNode(), p = e.$getNearestBlockElementAncestorOrThrow(f);
2416
- if (p.canIndent()) {
2417
- const h = p.getKey();
2418
- let x = i.$createRangeSelection();
2419
- if (x.anchor.set(h, 0, "element"), x.focus.set(h, 0, "element"), x = i.$normalizeSelection__EXPERIMENTAL(x), x.anchor.is(g))
2420
- return !0;
2421
- }
2422
- return !1;
2423
- }
2424
- function u(c) {
2425
- return c.registerCommand(i.KEY_TAB_COMMAND, (o) => {
2426
- const n = i.$getSelection();
2427
- if (!i.$isRangeSelection(n))
2428
- return !1;
2429
- o.preventDefault();
2430
- const r = s(n) ? o.shiftKey ? i.OUTDENT_CONTENT_COMMAND : i.INDENT_CONTENT_COMMAND : i.INSERT_TAB_COMMAND;
2431
- return c.dispatchCommand(r, void 0);
2432
- }, i.COMMAND_PRIORITY_EDITOR);
2433
- }
2434
- function l() {
2435
- const [c] = t.useLexicalComposerContext();
2436
- return d.useEffect(() => u(c)), null;
2437
- }
2438
- return ke.TabIndentationPlugin = l, ke.registerTabIndentation = u, ke;
2439
- }
2440
- var Oe = {}, tr;
2441
- function Xo() {
2442
- if (tr)
2443
- return Oe;
2444
- tr = 1;
2445
- var t = P, e = z, i = W, d = q;
2446
- function s(l) {
2447
- var c = l.getNodes();
2448
- if (0 < e.$filter(c, (o) => i.$isBlockElementNode(o) && o.canIndent() ? o : null).length)
2449
- return !0;
2450
- if (c = l.anchor, l = l.focus, l = l.isBefore(c) ? l : c, c = l.getNode(), c = e.$getNearestBlockElementAncestorOrThrow(c), c.canIndent()) {
2451
- c = c.getKey();
2452
- let o = i.$createRangeSelection();
2453
- if (o.anchor.set(c, 0, "element"), o.focus.set(c, 0, "element"), o = i.$normalizeSelection__EXPERIMENTAL(o), o.anchor.is(l))
2454
- return !0;
2455
- }
2456
- return !1;
2457
- }
2458
- function u(l) {
2459
- return l.registerCommand(i.KEY_TAB_COMMAND, (c) => {
2460
- let o = i.$getSelection();
2461
- return i.$isRangeSelection(o) ? (c.preventDefault(), c = s(o) ? c.shiftKey ? i.OUTDENT_CONTENT_COMMAND : i.INDENT_CONTENT_COMMAND : i.INSERT_TAB_COMMAND, l.dispatchCommand(c, void 0)) : !1;
2462
- }, i.COMMAND_PRIORITY_EDITOR);
2463
- }
2464
- return Oe.TabIndentationPlugin = function() {
2465
- let [l] = t.useLexicalComposerContext();
2466
- return d.useEffect(() => u(l)), null;
2467
- }, Oe.registerTabIndentation = u, Oe;
2468
- }
2469
- const Qo = process.env.NODE_ENV === "development" ? Jo() : Xo();
2470
- var Zo = Qo;
2471
- function ei() {
2472
- const [t] = P.useLexicalComposerContext();
2473
- return oe(() => z.mergeRegister(
506
+ function Tr() {
507
+ const [t] = y();
508
+ return x(() => it(
2474
509
  t.registerCommand(
2475
- dr,
2476
- () => (sn(t, "check"), !0),
2477
- de
510
+ Tt,
511
+ () => (de(t, "check"), !0),
512
+ E
2478
513
  ),
2479
514
  t.registerCommand(
2480
- Gr,
2481
- (e) => or(e, t, !1),
2482
- de
515
+ Zt,
516
+ (e) => kt(e, t, !1),
517
+ E
2483
518
  ),
2484
519
  t.registerCommand(
2485
- Jr,
2486
- (e) => or(e, t, !0),
2487
- de
520
+ te,
521
+ (e) => kt(e, t, !0),
522
+ E
2488
523
  ),
2489
524
  t.registerCommand(
2490
- lr,
525
+ vt,
2491
526
  (e) => {
2492
- if (st() != null) {
2493
- const d = t.getRootElement();
2494
- return d != null && d.focus(), !0;
527
+ if (X() != null) {
528
+ const o = t.getRootElement();
529
+ return o != null && o.focus(), !0;
2495
530
  }
2496
531
  return !1;
2497
532
  },
2498
- de
533
+ E
2499
534
  ),
2500
535
  t.registerCommand(
2501
- Xr,
536
+ ee,
2502
537
  (e) => {
2503
- const i = st();
2504
- return i != null && t.isEditable() ? (t.update(() => {
2505
- const d = ct(i);
2506
- xe(d) && (e.preventDefault(), d.toggleChecked());
538
+ const r = X();
539
+ return r != null && t.isEditable() ? (t.update(() => {
540
+ const o = V(r);
541
+ O(o) && (e.preventDefault(), o.toggleChecked());
2507
542
  }), !0) : !1;
2508
543
  },
2509
- de
544
+ E
2510
545
  ),
2511
546
  t.registerCommand(
2512
- Qr,
547
+ re,
2513
548
  (e) => t.getEditorState().read(() => {
2514
- const i = ee();
2515
- if (te(i) && i.isCollapsed()) {
2516
- const { anchor: d } = i, s = d.type === "element";
2517
- if (s || d.offset === 0) {
2518
- const u = d.getNode(), l = z.$findMatchingParent(
2519
- u,
2520
- (c) => Zr(c) && !c.isInline()
549
+ const r = T();
550
+ if (L(r) && r.isCollapsed()) {
551
+ const { anchor: o } = r, i = o.type === "element";
552
+ if (i || o.offset === 0) {
553
+ const l = o.getNode(), a = Dt(
554
+ l,
555
+ (s) => ne(s) && !s.isInline()
2521
556
  );
2522
- if (xe(l)) {
2523
- const c = l.getParent();
2524
- if (ft(c) && c.getListType() === "check" && (s || l.getFirstDescendant() === u)) {
2525
- const o = t.getElementByKey(l.__key);
2526
- if (o != null && document.activeElement !== o)
2527
- return o.focus(), e.preventDefault(), !0;
557
+ if (O(a)) {
558
+ const s = a.getParent();
559
+ if (et(s) && s.getListType() === "check" && (i || a.getFirstDescendant() === l)) {
560
+ const d = t.getElementByKey(a.__key);
561
+ if (d != null && document.activeElement !== d)
562
+ return d.focus(), e.preventDefault(), !0;
2528
563
  }
2529
564
  }
2530
565
  }
2531
566
  }
2532
567
  return !1;
2533
568
  }),
2534
- de
569
+ E
2535
570
  ),
2536
- t.registerRootListener((e, i) => {
2537
- e !== null && (e.addEventListener("click", rr), e.addEventListener("pointerdown", nr)), i !== null && (i.removeEventListener("click", rr), i.removeEventListener("pointerdown", nr));
571
+ t.registerRootListener((e, r) => {
572
+ e !== null && (e.addEventListener("click", ft), e.addEventListener("pointerdown", mt)), r !== null && (r.removeEventListener("click", ft), r.removeEventListener("pointerdown", mt));
2538
573
  })
2539
574
  ), [t]), null;
2540
575
  }
2541
- function Br(t, e) {
2542
- const i = t.target;
2543
- if (i === null || !z.isHTMLElement(i))
576
+ function Wt(t, e) {
577
+ const r = t.target;
578
+ if (r === null || !gt(r))
2544
579
  return;
2545
- const d = i.firstChild;
2546
- if (d != null && z.isHTMLElement(d) && (d.tagName === "UL" || d.tagName === "OL"))
580
+ const o = r.firstChild;
581
+ if (o != null && gt(o) && (o.tagName === "UL" || o.tagName === "OL"))
2547
582
  return;
2548
- const s = i.parentNode;
2549
- if (!s || s.__lexicalListType !== "check")
583
+ const i = r.parentNode;
584
+ if (!i || i.__lexicalListType !== "check")
2550
585
  return;
2551
- const u = t.pageX, l = i.getBoundingClientRect();
2552
- (i.dir === "rtl" ? u < l.right && u > l.right - 20 : u > l.left && u < l.left + 20) && e();
586
+ const l = t.pageX, a = r.getBoundingClientRect();
587
+ (r.dir === "rtl" ? l < a.right && l > a.right - 20 : l > a.left && l < a.left + 20) && e();
2553
588
  }
2554
- function rr(t) {
2555
- Br(t, () => {
2556
- const e = t.target, i = ti(e);
2557
- i != null && i.isEditable() && i.update(() => {
589
+ function ft(t) {
590
+ Wt(t, () => {
591
+ const e = t.target, r = Lr(e);
592
+ r != null && r.isEditable() && r.update(() => {
2558
593
  if (t.target) {
2559
- const d = ct(e);
2560
- xe(d) && (e.focus(), d.toggleChecked());
594
+ const o = V(e);
595
+ O(o) && (e.focus(), o.toggleChecked());
2561
596
  }
2562
597
  });
2563
598
  });
2564
599
  }
2565
- function nr(t) {
2566
- Br(t, () => {
600
+ function mt(t) {
601
+ Wt(t, () => {
2567
602
  t.preventDefault();
2568
603
  });
2569
604
  }
2570
- function ti(t) {
605
+ function Lr(t) {
2571
606
  let e = t;
2572
607
  for (; e; ) {
2573
608
  if (e.__lexicalEditor)
@@ -2576,67 +611,67 @@ function ti(t) {
2576
611
  }
2577
612
  return null;
2578
613
  }
2579
- function st() {
614
+ function X() {
2580
615
  const t = document.activeElement;
2581
616
  return t != null && t.tagName === "LI" && t.parentNode != null && // @ts-ignore internal field
2582
617
  t.parentNode.__lexicalListType === "check" ? t : null;
2583
618
  }
2584
- function ri(t, e) {
2585
- let i = e ? t.getPreviousSibling() : t.getNextSibling(), d = t;
2586
- for (; i == null && xe(d); )
2587
- d = d.getParentOrThrow().getParent(), d != null && (i = e ? d.getPreviousSibling() : d.getNextSibling());
2588
- for (; xe(i); ) {
2589
- const s = e ? i.getLastChild() : i.getFirstChild();
2590
- if (!ft(s))
2591
- return i;
2592
- i = e ? s.getLastChild() : s.getFirstChild();
619
+ function xr(t, e) {
620
+ let r = e ? t.getPreviousSibling() : t.getNextSibling(), o = t;
621
+ for (; r == null && O(o); )
622
+ o = o.getParentOrThrow().getParent(), o != null && (r = e ? o.getPreviousSibling() : o.getNextSibling());
623
+ for (; O(r); ) {
624
+ const i = e ? r.getLastChild() : r.getFirstChild();
625
+ if (!et(i))
626
+ return r;
627
+ r = e ? i.getLastChild() : i.getFirstChild();
2593
628
  }
2594
629
  return null;
2595
630
  }
2596
- function or(t, e, i) {
2597
- const d = st();
2598
- return d != null && e.update(() => {
2599
- const s = ct(d);
2600
- if (!xe(s))
631
+ function kt(t, e, r) {
632
+ const o = X();
633
+ return o != null && e.update(() => {
634
+ const i = V(o);
635
+ if (!O(i))
2601
636
  return;
2602
- const u = ri(s, i);
2603
- if (u != null) {
2604
- u.selectStart();
2605
- const l = e.getElementByKey(u.__key);
2606
- l != null && (t.preventDefault(), setTimeout(() => {
2607
- l.focus();
637
+ const l = xr(i, r);
638
+ if (l != null) {
639
+ l.selectStart();
640
+ const a = e.getElementByKey(l.__key);
641
+ a != null && (t.preventDefault(), setTimeout(() => {
642
+ a.focus();
2608
643
  }, 0));
2609
644
  }
2610
645
  }), !1;
2611
646
  }
2612
- const ni = () => /* @__PURE__ */ K(Ie, { children: [
2613
- /* @__PURE__ */ _(Ho.ListPlugin, {}),
2614
- /* @__PURE__ */ _(Go.TablePlugin, {}),
2615
- /* @__PURE__ */ _(Wo.HistoryPlugin, {}),
2616
- /* @__PURE__ */ _(ei, {}),
2617
- /* @__PURE__ */ _(Zo.TabIndentationPlugin, {})
2618
- ] }), oi = ({
647
+ const yr = () => /* @__PURE__ */ g(Y, { children: [
648
+ /* @__PURE__ */ n(He, {}),
649
+ /* @__PURE__ */ n(We, {}),
650
+ /* @__PURE__ */ n(Ue, {}),
651
+ /* @__PURE__ */ n(Tr, {}),
652
+ /* @__PURE__ */ n(je, {})
653
+ ] }), Nr = ({
2619
654
  state: t
2620
655
  }) => {
2621
- const [e] = P.useLexicalComposerContext();
2622
- return oe(() => {
656
+ const [e] = y();
657
+ return x(() => {
2623
658
  if (t)
2624
659
  try {
2625
- if (Pn(t)) {
2626
- t.isEmpty() ? In(e) : e.setEditorState(t);
660
+ if (Ye(t)) {
661
+ t.isEmpty() ? Ge(e) : e.setEditorState(t);
2627
662
  return;
2628
663
  }
2629
- if (typeof t == "string" && !Or(t)) {
2630
- Bn(t, e);
664
+ if (typeof t == "string" && !Ft(t)) {
665
+ Je(t, e);
2631
666
  return;
2632
667
  }
2633
- const i = e.parseEditorState(t);
2634
- i.isEmpty() || e.setEditorState(i);
2635
- } catch (i) {
2636
- console.error("Could not parse"), console.error(i);
668
+ const r = e.parseEditorState(t);
669
+ r.isEmpty() || e.setEditorState(r);
670
+ } catch (r) {
671
+ console.error("Could not parse"), console.error(r);
2637
672
  }
2638
673
  }, []), null;
2639
- }, ii = Nn("div", {
674
+ }, Sr = Le("div", {
2640
675
  border: "1px solid $borderDarker",
2641
676
  borderRadius: "$md",
2642
677
  position: "relative",
@@ -2673,10 +708,10 @@ const ni = () => /* @__PURE__ */ K(Ie, { children: [
2673
708
  }
2674
709
  }
2675
710
  ]
2676
- }), li = ({
711
+ }), wr = ({
2677
712
  isLoading: t
2678
- }) => /* @__PURE__ */ _(
2679
- _e,
713
+ }) => /* @__PURE__ */ n(
714
+ P,
2680
715
  {
2681
716
  css: {
2682
717
  visibility: t ? "visible" : "hidden",
@@ -2685,52 +720,52 @@ const ni = () => /* @__PURE__ */ K(Ie, { children: [
2685
720
  right: "1rem",
2686
721
  display: "flex"
2687
722
  },
2688
- children: /* @__PURE__ */ _(Tn, {})
723
+ children: /* @__PURE__ */ n(xe, {})
2689
724
  }
2690
- ), Di = ({
725
+ ), dn = ({
2691
726
  isLoading: t,
2692
727
  children: e,
2693
- placeholderText: i,
2694
- nodes: d,
2695
- plugins: s,
2696
- toolbar: u,
2697
- toolbarContent: l,
2698
- content: c,
2699
- hideBorder: o,
2700
- onBlur: n,
2701
- defaultState: r,
2702
- css: a
728
+ placeholderText: r,
729
+ nodes: o,
730
+ plugins: i,
731
+ toolbar: l,
732
+ toolbarContent: a,
733
+ content: s,
734
+ hideBorder: d,
735
+ onBlur: c,
736
+ defaultState: f,
737
+ css: u
2703
738
  }) => {
2704
- const { hasFocus: g, attributes: f } = co({ onBlur: n }), p = gt(null), h = Er(() => ({ hasFocus: g, editorRef: p }), [g]);
2705
- return /* @__PURE__ */ _(Ar.Provider, { value: h, children: /* @__PURE__ */ K(
2706
- Wn.LexicalComposer,
739
+ const { hasFocus: m, attributes: w } = Xe({ onBlur: c }), N = rt(null), k = wt(() => ({ hasFocus: m, editorRef: N }), [m]);
740
+ return /* @__PURE__ */ n(Ht.Provider, { value: k, children: /* @__PURE__ */ g(
741
+ Ee,
2707
742
  {
2708
743
  initialConfig: {
2709
744
  namespace: "ain-rich-text",
2710
- onError: (x) => {
2711
- console.error(x);
745
+ onError: (S) => {
746
+ console.error(S);
2712
747
  },
2713
- theme: kr,
2714
- nodes: d,
748
+ theme: Pt,
749
+ nodes: o,
2715
750
  editable: !0
2716
751
  },
2717
752
  children: [
2718
- /* @__PURE__ */ K(
2719
- ii,
753
+ /* @__PURE__ */ g(
754
+ Sr,
2720
755
  {
2721
- ref: p,
2722
- hasFocus: g,
2723
- hideBorder: o,
2724
- css: a,
2725
- ...f,
756
+ ref: N,
757
+ hasFocus: m,
758
+ hideBorder: d,
759
+ css: u,
760
+ ...w,
2726
761
  children: [
2727
- u,
2728
- /* @__PURE__ */ _(
2729
- oo.RichTextPlugin,
762
+ l,
763
+ /* @__PURE__ */ n(
764
+ _e,
2730
765
  {
2731
- contentEditable: c,
2732
- placeholder: i ? /* @__PURE__ */ _(
2733
- _e,
766
+ contentEditable: s,
767
+ placeholder: r ? /* @__PURE__ */ n(
768
+ P,
2734
769
  {
2735
770
  css: {
2736
771
  position: "absolute",
@@ -2740,25 +775,25 @@ const ni = () => /* @__PURE__ */ K(Ie, { children: [
2740
775
  pointerEvents: "none",
2741
776
  fontSize: "$sm"
2742
777
  },
2743
- children: i
778
+ children: r
2744
779
  }
2745
780
  ) : null,
2746
- ErrorBoundary: ao
781
+ ErrorBoundary: Re
2747
782
  }
2748
783
  ),
2749
- /* @__PURE__ */ _(ni, {}),
2750
- s,
2751
- /* @__PURE__ */ _(li, { isLoading: t }),
2752
- !u && /* @__PURE__ */ _(wo, { children: l })
784
+ /* @__PURE__ */ n(yr, {}),
785
+ i,
786
+ /* @__PURE__ */ n(wr, { isLoading: t }),
787
+ !l && /* @__PURE__ */ n(Mr, { children: a })
2753
788
  ]
2754
789
  }
2755
790
  ),
2756
- /* @__PURE__ */ _(oi, { state: r }),
2757
- /* @__PURE__ */ _(Ie, { children: e })
791
+ /* @__PURE__ */ n(Nr, { state: f }),
792
+ /* @__PURE__ */ n(Y, { children: e })
2758
793
  ]
2759
794
  }
2760
795
  ) });
2761
- }, si = {
796
+ }, Er = {
2762
797
  fontSize: "1rem",
2763
798
  lineHeight: "1.5",
2764
799
  "h1, h2, h3, h4, h5, h6": {
@@ -2948,129 +983,129 @@ const ni = () => /* @__PURE__ */ K(Ie, { children: [
2948
983
  defaultVariants: {
2949
984
  size: "md"
2950
985
  }
2951
- }, wi = Dn(si), Ai = () => {
2952
- const [t] = P.useLexicalComposerContext(), e = J(() => {
2953
- t.dispatchCommand(dn, {
986
+ }, un = Fe(Er), hn = () => {
987
+ const [t] = y(), e = v(() => {
988
+ t.dispatchCommand(ge, {
2954
989
  rows: "3",
2955
990
  columns: "3",
2956
991
  includeHeaders: !1
2957
992
  });
2958
993
  }, [t]);
2959
- return /* @__PURE__ */ _(
2960
- pt,
994
+ return /* @__PURE__ */ n(
995
+ nt,
2961
996
  {
2962
- trigger: /* @__PURE__ */ _(Nr, { dropdown: !0, children: "Sett inn" }),
997
+ trigger: /* @__PURE__ */ n(Et, { dropdown: !0, children: "Sett inn" }),
2963
998
  side: "bottom",
2964
999
  align: "end",
2965
- children: /* @__PURE__ */ K(Z, { onClick: e, children: [
2966
- /* @__PURE__ */ _(Ro, { size: "1.25rem" }),
1000
+ children: /* @__PURE__ */ g(C, { onClick: e, children: [
1001
+ /* @__PURE__ */ n(pr, { size: "1.25rem" }),
2967
1002
  " Tabell"
2968
1003
  ] })
2969
1004
  }
2970
1005
  );
2971
1006
  };
2972
- function ai(t) {
2973
- return F({ tag: "svg", attr: { viewBox: "0 0 512 512" }, child: [{ tag: "circle", attr: { cx: "256", cy: "256", r: "48" } }, { tag: "circle", attr: { cx: "416", cy: "256", r: "48" } }, { tag: "circle", attr: { cx: "96", cy: "256", r: "48" } }] })(t);
1007
+ function _r(t) {
1008
+ return h({ tag: "svg", attr: { viewBox: "0 0 512 512" }, child: [{ tag: "circle", attr: { cx: "256", cy: "256", r: "48" } }, { tag: "circle", attr: { cx: "416", cy: "256", r: "48" } }, { tag: "circle", attr: { cx: "96", cy: "256", r: "48" } }] })(t);
2974
1009
  }
2975
- const Pi = () => {
2976
- const [t] = P.useLexicalComposerContext(), [e, i] = Y(null), { hasFocus: d } = mt();
2977
- oe(() => {
2978
- !d && e && i(null);
2979
- }, [d, e]);
2980
- const { refs: s, floatingStyles: u } = ht({
1010
+ const pn = () => {
1011
+ const [t] = y(), [e, r] = b(null), { hasFocus: o } = at();
1012
+ x(() => {
1013
+ !o && e && r(null);
1014
+ }, [o, e]);
1015
+ const { refs: i, floatingStyles: l } = ot({
2981
1016
  placement: "top-end",
2982
1017
  open: !!e,
2983
1018
  elements: {
2984
1019
  reference: e
2985
1020
  },
2986
- middleware: [Mr({ mainAxis: -20, crossAxis: -2 })]
1021
+ middleware: [Ot({ mainAxis: -20, crossAxis: -2 })]
2987
1022
  });
2988
- oe(() => t.registerCommand(
2989
- Le,
1023
+ x(() => t.registerCommand(
1024
+ F,
2990
1025
  () => {
2991
- const c = ee();
2992
- if (te(c)) {
2993
- const o = c.anchor.getNode(), n = fn(o);
2994
- i(n ? t.getElementByKey(n.getKey()) : null);
1026
+ const s = T();
1027
+ if (L(s)) {
1028
+ const d = s.anchor.getNode(), c = fe(d);
1029
+ r(c ? t.getElementByKey(c.getKey()) : null);
2995
1030
  }
2996
1031
  return !1;
2997
1032
  },
2998
- en
1033
+ oe
2999
1034
  ), [t]);
3000
- const l = (c) => () => {
1035
+ const a = (s) => () => {
3001
1036
  t.update(() => {
3002
- switch (c) {
1037
+ switch (s) {
3003
1038
  case "add-row-over":
3004
- _t(!1);
1039
+ ut(!1);
3005
1040
  break;
3006
1041
  case "add-row-under":
3007
- _t(!0);
1042
+ ut(!0);
3008
1043
  break;
3009
1044
  case "add-column-left":
3010
- vt(!1);
1045
+ dt(!1);
3011
1046
  break;
3012
1047
  case "add-column-right":
3013
- vt(!0);
1048
+ dt(!0);
3014
1049
  break;
3015
1050
  case "delete-row":
3016
- pn();
1051
+ ke();
3017
1052
  break;
3018
1053
  case "delete-column":
3019
- gn();
1054
+ me();
3020
1055
  break;
3021
1056
  }
3022
1057
  });
3023
1058
  };
3024
- return e ? /* @__PURE__ */ K(
3025
- pt,
1059
+ return e ? /* @__PURE__ */ g(
1060
+ nt,
3026
1061
  {
3027
- trigger: /* @__PURE__ */ _(
3028
- Ce,
1062
+ trigger: /* @__PURE__ */ n(
1063
+ $,
3029
1064
  {
3030
1065
  icon: !0,
3031
1066
  variant: "primary",
3032
1067
  color: "secondary",
3033
- ref: s.setFloating,
3034
- style: u,
1068
+ ref: i.setFloating,
1069
+ style: l,
3035
1070
  css: { padding: "2px", width: "18px", height: "18px" },
3036
- children: /* @__PURE__ */ _(ai, {})
1071
+ children: /* @__PURE__ */ n(_r, {})
3037
1072
  }
3038
1073
  ),
3039
1074
  children: [
3040
- /* @__PURE__ */ _(pe, { onClick: l("add-row-over"), children: "Legg til rad over" }),
3041
- /* @__PURE__ */ _(pe, { onClick: l("add-row-under"), children: "Legg til rad under" }),
3042
- /* @__PURE__ */ _(Lt, {}),
3043
- /* @__PURE__ */ _(pe, { onClick: l("add-column-left"), children: "Legg til kolonne venstre" }),
3044
- /* @__PURE__ */ _(pe, { onClick: l("add-column-right"), children: "Legg til kolonne høyre" }),
3045
- /* @__PURE__ */ _(Lt, {}),
3046
- /* @__PURE__ */ _(pe, { onClick: l("delete-row"), children: "Fjern rad" }),
3047
- /* @__PURE__ */ _(pe, { onClick: l("delete-column"), children: "Fjern kolonne" })
1075
+ /* @__PURE__ */ n(R, { onClick: a("add-row-over"), children: "Legg til rad over" }),
1076
+ /* @__PURE__ */ n(R, { onClick: a("add-row-under"), children: "Legg til rad under" }),
1077
+ /* @__PURE__ */ n(ht, {}),
1078
+ /* @__PURE__ */ n(R, { onClick: a("add-column-left"), children: "Legg til kolonne venstre" }),
1079
+ /* @__PURE__ */ n(R, { onClick: a("add-column-right"), children: "Legg til kolonne høyre" }),
1080
+ /* @__PURE__ */ n(ht, {}),
1081
+ /* @__PURE__ */ n(R, { onClick: a("delete-row"), children: "Fjern rad" }),
1082
+ /* @__PURE__ */ n(R, { onClick: a("delete-column"), children: "Fjern kolonne" })
3048
1083
  ]
3049
1084
  }
3050
1085
  ) : null;
3051
1086
  };
3052
- function Hr(t) {
1087
+ function jt(t) {
3053
1088
  let e = t;
3054
- const i = /^(?:(?:https?|mailto|ftp|tel|file|sms):|[^&:/?#]*(?:[/?#]|$))/gi, d = /^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[a-z0-9+/]+=*$/i;
3055
- return e = String(e).trim(), e.match(i) || e.match(d) ? e : "https://";
1089
+ const r = /^(?:(?:https?|mailto|ftp|tel|file|sms):|[^&:/?#]*(?:[/?#]|$))/gi, o = /^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[a-z0-9+/]+=*$/i;
1090
+ return e = String(e).trim(), e.match(r) || e.match(o) ? e : "https://";
3056
1091
  }
3057
- function Fr(t) {
3058
- const e = t.anchor, i = t.focus, d = t.anchor.getNode(), s = t.focus.getNode();
3059
- return d === s ? d : t.isBackward() ? Tt(i) ? d : s : Tt(e) ? d : s;
1092
+ function Kt(t) {
1093
+ const e = t.anchor, r = t.focus, o = t.anchor.getNode(), i = t.focus.getNode();
1094
+ return o === i ? o : t.isBackward() ? ct(r) ? o : i : ct(e) ? o : i;
3060
1095
  }
3061
- const Ii = (t) => (fe.baseURL = t, fe), we = class extends me {
1096
+ const gn = (t) => (_.baseURL = t, _), j = class extends z {
3062
1097
  static getType() {
3063
1098
  return "rutine_link";
3064
1099
  }
3065
1100
  static clone(e) {
3066
- return new we(e.__url, {}, e.__key);
1101
+ return new j(e.__url, {}, e.__key);
3067
1102
  }
3068
1103
  createDOM(e) {
3069
- const i = super.createDOM(e);
3070
- return i.setAttribute("href", this.getURL()), i.setAttribute("target", "_blank"), i.setAttribute("rel", "noopener noreferrer"), i.classList.add("rutine-link"), i;
1104
+ const r = super.createDOM(e);
1105
+ return r.setAttribute("href", this.getURL()), r.setAttribute("target", "_blank"), r.setAttribute("rel", "noopener noreferrer"), r.classList.add("rutine-link"), r;
3071
1106
  }
3072
1107
  static importJSON(e) {
3073
- return zr(e.url);
1108
+ return qt(e.url);
3074
1109
  }
3075
1110
  exportJSON() {
3076
1111
  return {
@@ -3082,190 +1117,190 @@ const Ii = (t) => (fe.baseURL = t, fe), we = class extends me {
3082
1117
  }
3083
1118
  getURL() {
3084
1119
  try {
3085
- return new URL(this.__url, we.baseURL).toString();
1120
+ return new URL(this.__url, j.baseURL).toString();
3086
1121
  } catch {
3087
1122
  return "";
3088
1123
  }
3089
1124
  }
3090
1125
  };
3091
- let fe = we;
3092
- Nt(fe, "baseURL", "");
3093
- function zr(t) {
3094
- return new fe(t);
1126
+ let _ = j;
1127
+ st(_, "baseURL", "");
1128
+ function qt(t) {
1129
+ return new _(t);
3095
1130
  }
3096
- function ci(t) {
3097
- return t instanceof fe;
1131
+ function Rr(t) {
1132
+ return t instanceof _;
3098
1133
  }
3099
- const ui = ({ onClose: t }) => {
3100
- const [e] = P.useLexicalComposerContext(), i = J(
3101
- (s) => {
1134
+ const Ir = ({ onClose: t }) => {
1135
+ const [e] = y(), r = v(
1136
+ (i) => {
3102
1137
  e.update(() => {
3103
- const u = ee();
3104
- if (te(u) && u.isCollapsed()) {
3105
- const l = u.getNodes();
3106
- if (l.length === 1) {
3107
- const c = l[0];
3108
- tn(c) && c.getChildren().length === 0 && u.insertText(s);
1138
+ const l = T();
1139
+ if (L(l) && l.isCollapsed()) {
1140
+ const a = l.getNodes();
1141
+ if (a.length === 1) {
1142
+ const s = a[0];
1143
+ ie(s) && s.getChildren().length === 0 && l.insertText(i);
3109
1144
  }
3110
1145
  }
3111
- }), e.dispatchCommand(ut, Hr(s));
1146
+ }), e.dispatchCommand(Z, jt(i));
3112
1147
  },
3113
1148
  [e]
3114
1149
  );
3115
- return /* @__PURE__ */ K("form", { onSubmit: (s) => {
3116
- i(s.target.url.value), t();
1150
+ return /* @__PURE__ */ g("form", { onSubmit: (i) => {
1151
+ r(i.target.url.value), t();
3117
1152
  }, children: [
3118
- /* @__PURE__ */ _(Ln, { name: "url", label: "URL", type: "url", required: !0 }),
3119
- /* @__PURE__ */ K(_r, { children: [
3120
- /* @__PURE__ */ _(Ce, { onClick: t, children: "Avbryt" }),
3121
- /* @__PURE__ */ _(Ce, { type: "submit", variant: "primary", children: "Lagre" })
1153
+ /* @__PURE__ */ n(Se, { name: "url", label: "URL", type: "url", required: !0 }),
1154
+ /* @__PURE__ */ g(It, { children: [
1155
+ /* @__PURE__ */ n($, { onClick: t, children: "Avbryt" }),
1156
+ /* @__PURE__ */ n($, { type: "submit", variant: "primary", children: "Lagre" })
3122
1157
  ] })
3123
1158
  ] });
3124
- }, di = ({ onClose: t, getDocs: e }) => {
3125
- const [i] = P.useLexicalComposerContext(), [d, s] = Y([]), u = e(), l = J(
3126
- (c) => {
3127
- i.update(() => {
3128
- const o = ee();
3129
- if (te(o)) {
3130
- const n = [];
3131
- for (const [r, a] of c.entries()) {
3132
- const g = zr(a.value);
3133
- g.append(ve(a.label)), n.push(g), r !== c.length - 1 && n.push(ve(" "));
1159
+ }, zr = ({ onClose: t, getDocs: e }) => {
1160
+ const [r] = y(), [o, i] = b([]), l = e(), a = v(
1161
+ (s) => {
1162
+ r.update(() => {
1163
+ const d = T();
1164
+ if (L(d)) {
1165
+ const c = [];
1166
+ for (const [f, u] of s.entries()) {
1167
+ const m = qt(u.value);
1168
+ m.append(D(u.label)), c.push(m), f !== s.length - 1 && c.push(D(" "));
3134
1169
  }
3135
- o.insertNodes(n);
1170
+ d.insertNodes(c);
3136
1171
  }
3137
1172
  });
3138
1173
  },
3139
- [i]
1174
+ [r]
3140
1175
  );
3141
- return /* @__PURE__ */ K(Ie, { children: [
3142
- /* @__PURE__ */ _(yn, { isMulti: !0, options: u, onChange: s }),
3143
- /* @__PURE__ */ K(_r, { children: [
3144
- /* @__PURE__ */ _(Ce, { onClick: t, children: "Avbryt" }),
3145
- /* @__PURE__ */ _(
3146
- Ce,
1176
+ return /* @__PURE__ */ g(Y, { children: [
1177
+ /* @__PURE__ */ n(we, { isMulti: !0, options: l, onChange: i }),
1178
+ /* @__PURE__ */ g(It, { children: [
1179
+ /* @__PURE__ */ n($, { onClick: t, children: "Avbryt" }),
1180
+ /* @__PURE__ */ n(
1181
+ $,
3147
1182
  {
3148
1183
  variant: "primary",
3149
1184
  onClick: () => {
3150
- l(d), t();
1185
+ a(o), t();
3151
1186
  },
3152
1187
  children: "Lagre"
3153
1188
  }
3154
1189
  )
3155
1190
  ] })
3156
1191
  ] });
3157
- }, fi = ({
1192
+ }, Or = ({
3158
1193
  open: t,
3159
1194
  onOpenChange: e,
3160
- getDocs: i
1195
+ getDocs: r
3161
1196
  }) => {
3162
- const [d, s] = Y("url"), u = () => {
1197
+ const [o, i] = b("url"), l = () => {
3163
1198
  e(!1);
3164
1199
  };
3165
- return /* @__PURE__ */ K(vn, { open: t, onOpenChange: e, css: { width: "600px" }, children: [
3166
- /* @__PURE__ */ K(_n, { css: { marginBottom: "$8" }, children: [
3167
- /* @__PURE__ */ _(yt, { active: d === "url", onClick: () => s("url"), children: "URL" }),
3168
- /* @__PURE__ */ _(yt, { active: d === "rutine", onClick: () => s("rutine"), children: "Rutine" })
1200
+ return /* @__PURE__ */ g(ye, { open: t, onOpenChange: e, css: { width: "600px" }, children: [
1201
+ /* @__PURE__ */ g(Ne, { css: { marginBottom: "$8" }, children: [
1202
+ /* @__PURE__ */ n(pt, { active: o === "url", onClick: () => i("url"), children: "URL" }),
1203
+ /* @__PURE__ */ n(pt, { active: o === "rutine", onClick: () => i("rutine"), children: "Rutine" })
3169
1204
  ] }),
3170
- d === "url" && /* @__PURE__ */ _(ui, { onClose: u }),
3171
- d === "rutine" && /* @__PURE__ */ _(di, { onClose: u, getDocs: i })
1205
+ o === "url" && /* @__PURE__ */ n(Ir, { onClose: l }),
1206
+ o === "rutine" && /* @__PURE__ */ n(zr, { onClose: l, getDocs: r })
3172
1207
  ] });
3173
- }, Bi = ({ getDocs: t }) => {
3174
- const [e] = P.useLexicalComposerContext(), [i, d] = Y(!1), [s, u] = Y(!1), l = J(() => {
3175
- const c = ee();
3176
- if (te(c)) {
3177
- const o = Fr(c), n = o.getParent();
3178
- d($e(n) || $e(o));
1208
+ }, fn = ({ getDocs: t }) => {
1209
+ const [e] = y(), [r, o] = b(!1), [i, l] = b(!1), a = v(() => {
1210
+ const s = T();
1211
+ if (L(s)) {
1212
+ const d = Kt(s), c = d.getParent();
1213
+ o(U(c) || U(d));
3179
1214
  }
3180
1215
  }, []);
3181
- return oe(() => e.registerCommand(
3182
- Le,
3183
- () => (l(), !1),
3184
- at
3185
- ), [e, l]), /* @__PURE__ */ K(Tr, { type: "single", value: i ? "link" : "", children: [
3186
- /* @__PURE__ */ _(
3187
- he,
1216
+ return x(() => e.registerCommand(
1217
+ F,
1218
+ () => (a(), !1),
1219
+ Q
1220
+ ), [e, a]), /* @__PURE__ */ g(_t, { type: "single", value: r ? "link" : "", children: [
1221
+ /* @__PURE__ */ n(
1222
+ I,
3188
1223
  {
3189
1224
  onClick: () => {
3190
- i ? e.dispatchCommand(ut, null) : u(!0);
1225
+ r ? e.dispatchCommand(Z, null) : l(!0);
3191
1226
  },
3192
1227
  title: "Lenke",
3193
1228
  value: "link",
3194
- children: /* @__PURE__ */ _(To, { size: "1.25rem" })
1229
+ children: /* @__PURE__ */ n(lr, { size: "1.25rem" })
3195
1230
  }
3196
1231
  ),
3197
- /* @__PURE__ */ _(
3198
- fi,
1232
+ /* @__PURE__ */ n(
1233
+ Or,
3199
1234
  {
3200
- open: s,
3201
- onOpenChange: u,
1235
+ open: i,
1236
+ onOpenChange: l,
3202
1237
  getDocs: t
3203
1238
  }
3204
1239
  )
3205
1240
  ] });
3206
- }, Hi = () => {
3207
- const [t] = P.useLexicalComposerContext(), e = gt(null), [i, d] = Y(null), [s, u] = Y(""), { hasFocus: l } = mt();
3208
- oe(() => {
3209
- i ? t.update(() => {
3210
- u(i.getURL());
3211
- }) : u("");
3212
- }, [t, i]);
3213
- const c = !!(i && s && l), { refs: o, floatingStyles: n, context: r } = ht({
1241
+ }, mn = () => {
1242
+ const [t] = y(), e = rt(null), [r, o] = b(null), [i, l] = b(""), { hasFocus: a } = at();
1243
+ x(() => {
1244
+ r ? t.update(() => {
1245
+ l(r.getURL());
1246
+ }) : l("");
1247
+ }, [t, r]);
1248
+ const s = !!(r && i && a), { refs: d, floatingStyles: c, context: f } = ot({
3214
1249
  placement: "top",
3215
1250
  strategy: "fixed",
3216
- open: c,
3217
- whileElementsMounted: yr,
1251
+ open: s,
1252
+ whileElementsMounted: zt,
3218
1253
  elements: {
3219
1254
  reference: e.current
3220
1255
  },
3221
- middleware: [Sn()]
3222
- }), { getFloatingProps: a } = Rr([
3223
- br(r),
3224
- kn(r)
3225
- ]), g = J(() => {
3226
- var x;
3227
- const h = ee();
3228
- if (te(h)) {
3229
- const C = Fr(h), L = C.getParent();
3230
- let E = null;
3231
- if ($e(L) ? E = L : $e(C) && (E = C), E) {
3232
- const T = window.getSelection(), M = t.getRootElement();
3233
- h !== null && T !== null && M !== null && M.contains(T.anchorNode) && t.isEditable() && (e.current = ((x = T.focusNode) == null ? void 0 : x.parentElement) ?? null);
1256
+ middleware: [$e()]
1257
+ }), { getFloatingProps: u } = $t([
1258
+ At(f),
1259
+ Ae(f)
1260
+ ]), m = v(() => {
1261
+ var S;
1262
+ const k = T();
1263
+ if (L(k)) {
1264
+ const A = Kt(k), p = A.getParent();
1265
+ let H = null;
1266
+ if (U(p) ? H = p : U(A) && (H = A), H) {
1267
+ const G = window.getSelection(), lt = t.getRootElement();
1268
+ k !== null && G !== null && lt !== null && lt.contains(G.anchorNode) && t.isEditable() && (e.current = ((S = G.focusNode) == null ? void 0 : S.parentElement) ?? null);
3234
1269
  }
3235
- d(E);
1270
+ o(H);
3236
1271
  }
3237
- }, [t]), f = J(() => {
3238
- i && ci(i) && t.update(() => {
3239
- i.remove();
3240
- }), t.dispatchCommand(ut, null);
3241
- }, [t, i]);
3242
- if (oe(() => {
1272
+ }, [t]), w = v(() => {
1273
+ r && Rr(r) && t.update(() => {
1274
+ r.remove();
1275
+ }), t.dispatchCommand(Z, null);
1276
+ }, [t, r]);
1277
+ if (x(() => {
3243
1278
  t.getEditorState().read(() => {
3244
- g();
1279
+ m();
3245
1280
  });
3246
- }, [t, g]), oe(() => z.mergeRegister(
3247
- t.registerUpdateListener(({ editorState: h }) => {
3248
- h.read(() => {
3249
- g();
1281
+ }, [t, m]), x(() => it(
1282
+ t.registerUpdateListener(({ editorState: k }) => {
1283
+ k.read(() => {
1284
+ m();
3250
1285
  });
3251
1286
  }),
3252
1287
  t.registerCommand(
3253
- Le,
3254
- () => (g(), !0),
3255
- de
1288
+ F,
1289
+ () => (m(), !0),
1290
+ E
3256
1291
  ),
3257
1292
  t.registerCommand(
3258
- lr,
3259
- () => i ? (d(null), !0) : !1,
3260
- rn
1293
+ vt,
1294
+ () => r ? (o(null), !0) : !1,
1295
+ ae
3261
1296
  )
3262
- ), [t, g, i]), !c)
1297
+ ), [t, m, r]), !s)
3263
1298
  return null;
3264
- const p = Hr(s);
3265
- return /* @__PURE__ */ _(Sr, { children: /* @__PURE__ */ K(
3266
- vr,
1299
+ const N = jt(i);
1300
+ return /* @__PURE__ */ n(Bt, { children: /* @__PURE__ */ g(
1301
+ Rt,
3267
1302
  {
3268
- ref: o.setFloating,
1303
+ ref: d.setFloating,
3269
1304
  css: {
3270
1305
  padding: "$2 $4",
3271
1306
  // Make sure this renders above the toolbar
@@ -3273,11 +1308,11 @@ const ui = ({ onClose: t }) => {
3273
1308
  display: "flex",
3274
1309
  alignItems: "center"
3275
1310
  },
3276
- style: n,
3277
- ...a(),
1311
+ style: c,
1312
+ ...u(),
3278
1313
  children: [
3279
- /* @__PURE__ */ _(
3280
- _e,
1314
+ /* @__PURE__ */ n(
1315
+ P,
3281
1316
  {
3282
1317
  as: "a",
3283
1318
  css: {
@@ -3287,41 +1322,41 @@ const ui = ({ onClose: t }) => {
3287
1322
  textOverflow: "ellipsis",
3288
1323
  marginRight: "$4"
3289
1324
  },
3290
- href: p,
3291
- title: p,
1325
+ href: N,
1326
+ title: N,
3292
1327
  target: "_blank",
3293
1328
  rel: "noreferrer",
3294
- children: s
1329
+ children: i
3295
1330
  }
3296
1331
  ),
3297
- /* @__PURE__ */ _(Ce, { color: "danger", icon: !0, size: "sm", onClick: f, children: /* @__PURE__ */ _(On, { size: 24 }) })
1332
+ /* @__PURE__ */ n($, { color: "danger", icon: !0, size: "sm", onClick: w, children: /* @__PURE__ */ n(De, { size: 24 }) })
3298
1333
  ]
3299
1334
  }
3300
1335
  ) });
3301
1336
  };
3302
1337
  export {
3303
- zr as $createRutineLinkNode,
3304
- ci as $isRutineLinkNode,
3305
- wo as FloatingToolbar,
3306
- Ai as InsertSelector,
3307
- Hi as LinkEditPlugin,
3308
- De as LinkTargetNode,
3309
- Bi as LinkToolbarButton,
3310
- Di as RichTextEditor,
3311
- Ao as RichTextToolbar,
3312
- fe as RutineLinkNode,
3313
- Ii as RutineLinkNodeInit,
3314
- Pi as TableEditPlugin,
3315
- In as clearEditorState,
3316
- Oi as defaultNodes,
3317
- $i as defaultViewNodes,
3318
- Pn as isEditorState,
3319
- Or as isJSON,
3320
- Ar as richTextContext,
3321
- wi as richTextCss,
3322
- si as richTextStyleObj,
3323
- Bn as setStateFromPlainText,
3324
- ki as stateToHTML,
3325
- co as useHasFocusWithin,
3326
- mt as useRichTextContext
1338
+ qt as $createRutineLinkNode,
1339
+ Rr as $isRutineLinkNode,
1340
+ Mr as FloatingToolbar,
1341
+ hn as InsertSelector,
1342
+ mn as LinkEditPlugin,
1343
+ W as LinkTargetNode,
1344
+ fn as LinkToolbarButton,
1345
+ dn as RichTextEditor,
1346
+ Cr as RichTextToolbar,
1347
+ _ as RutineLinkNode,
1348
+ gn as RutineLinkNodeInit,
1349
+ pn as TableEditPlugin,
1350
+ Ge as clearEditorState,
1351
+ sn as defaultNodes,
1352
+ cn as defaultViewNodes,
1353
+ Ye as isEditorState,
1354
+ Ft as isJSON,
1355
+ Ht as richTextContext,
1356
+ un as richTextCss,
1357
+ Er as richTextStyleObj,
1358
+ Je as setStateFromPlainText,
1359
+ ln as stateToHTML,
1360
+ Xe as useHasFocusWithin,
1361
+ at as useRichTextContext
3327
1362
  };