@uva-glass/component-library 1.52.0 → 1.53.0

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 (68) hide show
  1. package/dist/{Lexical.prod-DSsdOWxu.js → Lexical.prod-DNRTKPfN.js} +264 -251
  2. package/dist/Lexical.prod-DNRTKPfN.js.map +1 -0
  3. package/dist/LexicalUtils.prod-D_BPEjfg.js +64 -0
  4. package/dist/LexicalUtils.prod-D_BPEjfg.js.map +1 -0
  5. package/dist/ListPlugin-CgNBzfIl.js +588 -0
  6. package/dist/ListPlugin-CgNBzfIl.js.map +1 -0
  7. package/dist/RteEditor.module-BjGyWKhW.js +26 -0
  8. package/dist/RteEditor.module-BjGyWKhW.js.map +1 -0
  9. package/dist/assets/RteEditor.css +1 -1
  10. package/dist/assets/useFlyout.css +1 -0
  11. package/dist/components/Buttons/Button.stories.js +1 -1
  12. package/dist/components/Buttons/Button.stories.js.map +1 -1
  13. package/dist/components/Buttons/LinkButton.stories.js +5 -5
  14. package/dist/components/Buttons/LinkButton.stories.js.map +1 -1
  15. package/dist/components/Buttons/MenuButton.stories.js +10 -10
  16. package/dist/components/Buttons/MenuButton.stories.js.map +1 -1
  17. package/dist/components/HorizontalList/HorizontalList.stories.js +1 -1
  18. package/dist/components/HorizontalList/HorizontalList.stories.js.map +1 -1
  19. package/dist/components/Icon/Icon.d.ts +1 -1
  20. package/dist/components/Icon/Icon.js.map +1 -1
  21. package/dist/components/Icon/icons/index.d.ts +9 -0
  22. package/dist/components/Icon/icons/index.js +52 -37
  23. package/dist/components/Icon/icons/index.js.map +1 -1
  24. package/dist/components/RteEditor/Plugins/BlockFormatPlugin/BlockFormatPlugin.js +2 -2
  25. package/dist/components/RteEditor/Plugins/HistoryPlugin/HistoryPlugin.d.ts +1 -0
  26. package/dist/components/RteEditor/Plugins/HistoryPlugin/HistoryPlugin.js +62 -0
  27. package/dist/components/RteEditor/Plugins/HistoryPlugin/HistoryPlugin.js.map +1 -0
  28. package/dist/components/RteEditor/Plugins/HistoryPlugin/index.d.ts +1 -0
  29. package/dist/components/RteEditor/Plugins/HistoryPlugin/index.js +5 -0
  30. package/dist/components/RteEditor/Plugins/HistoryPlugin/index.js.map +1 -0
  31. package/dist/components/RteEditor/Plugins/LinkPlugin/LinkPlugin.d.ts +6 -0
  32. package/dist/components/RteEditor/Plugins/LinkPlugin/LinkPlugin.js +98 -0
  33. package/dist/components/RteEditor/Plugins/LinkPlugin/LinkPlugin.js.map +1 -0
  34. package/dist/components/RteEditor/Plugins/LinkPlugin/helpers.d.ts +8 -0
  35. package/dist/components/RteEditor/Plugins/LinkPlugin/helpers.js +7 -0
  36. package/dist/components/RteEditor/Plugins/LinkPlugin/helpers.js.map +1 -0
  37. package/dist/components/RteEditor/Plugins/LinkPlugin/index.d.ts +1 -0
  38. package/dist/components/RteEditor/Plugins/LinkPlugin/index.js +5 -0
  39. package/dist/components/RteEditor/Plugins/LinkPlugin/index.js.map +1 -0
  40. package/dist/components/RteEditor/Plugins/ListPlugin/ListPlugin.js +3 -3
  41. package/dist/components/RteEditor/Plugins/ListPlugin/index.js +1 -1
  42. package/dist/components/RteEditor/Plugins/ToolbarPlugin/ToolbarPlugin.d.ts +6 -0
  43. package/dist/components/RteEditor/Plugins/ToolbarPlugin/ToolbarPlugin.js +34 -27
  44. package/dist/components/RteEditor/Plugins/ToolbarPlugin/ToolbarPlugin.js.map +1 -1
  45. package/dist/components/RteEditor/Plugins/index.d.ts +2 -0
  46. package/dist/components/RteEditor/Plugins/index.js +10 -6
  47. package/dist/components/RteEditor/Plugins/index.js.map +1 -1
  48. package/dist/components/RteEditor/RteEditor.js +681 -501
  49. package/dist/components/RteEditor/RteEditor.js.map +1 -1
  50. package/dist/components/RteEditor/RteEditor.stories.js +1 -1
  51. package/dist/components/RteEditor/RteEditor.stories.js.map +1 -1
  52. package/dist/components/RteEditor/UvaTheme/UvaTheme.d.ts +1 -0
  53. package/dist/components/RteEditor/UvaTheme/UvaTheme.js +5 -4
  54. package/dist/components/RteEditor/UvaTheme/UvaTheme.js.map +1 -1
  55. package/dist/components/RteEditor/hooks/index.d.ts +1 -0
  56. package/dist/components/RteEditor/hooks/index.js +5 -0
  57. package/dist/components/RteEditor/hooks/index.js.map +1 -0
  58. package/dist/components/RteEditor/hooks/useFlyout.d.ts +12 -0
  59. package/dist/components/RteEditor/hooks/useFlyout.js +45 -0
  60. package/dist/components/RteEditor/hooks/useFlyout.js.map +1 -0
  61. package/dist/helpers-TSjo3aAv.js +365 -0
  62. package/dist/helpers-TSjo3aAv.js.map +1 -0
  63. package/package.json +15 -15
  64. package/dist/Lexical.prod-DSsdOWxu.js.map +0 -1
  65. package/dist/ListPlugin-Bu2AbCDB.js +0 -643
  66. package/dist/ListPlugin-Bu2AbCDB.js.map +0 -1
  67. package/dist/RteEditor.module-RkKUrkOO.js +0 -21
  68. package/dist/RteEditor.module-RkKUrkOO.js.map +0 -1
@@ -1,179 +1,196 @@
1
- import { jsx as y, jsxs as J, Fragment as $e } from "react/jsx-runtime";
2
- import { W as qe, w as P, P as te, I as p, l as He, c as Xe, u as A, e as F, y as x, F as Ye, g as T, T as Ze, X as Y, h as Ne, m as w, i as Se, $ as De, j as Pe, v as Ge, S as ie, b as Qe, E as Z, C as se, k as ae, n as Te, q as et, r as tt, M as _e, A as nt, s as rt, x as ot, z as it, B as st, D as h, G as at, H as L, J as lt, V as ct, K as ut, N as G, O as dt, Q as ft, R as mt, U as pt, Y as gt, Z as ht, a0 as wt, a1 as le, a as ce, a2 as vt, a3 as H, a4 as yt, a5 as ue, a6 as Ct, a7 as Et, a8 as bt, a9 as xt, aa as $t, ab as Nt, ac as St, ad as Dt, d as Pt, ae as Tt, af as _t, ag as Lt, ah as Ot, ai as Rt, t as Ft } from "../../Lexical.prod-DSsdOWxu.js";
3
- import * as X from "react";
4
- import { useMemo as V, useLayoutEffect as M, useEffect as _, useRef as It, useState as I, Suspense as At, forwardRef as Le, useCallback as Mt } from "react";
5
- import { i as O, a as q, e as kt, t as Oe, J as Re, D as Fe, Z as Kt } from "../../ListPlugin-Bu2AbCDB.js";
6
- import { r as de } from "../../index-DsprzSCj.js";
7
- import { s as B } from "../../RteEditor.module-RkKUrkOO.js";
8
- import { ToolBarPlugin as Bt } from "./Plugins/ToolbarPlugin/ToolbarPlugin.js";
9
- import { UvaTheme as jt } from "./UvaTheme/UvaTheme.js";
10
- const Ie = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0, zt = Ie ? M : _, j = { tag: "history-merge" };
11
- function Ut({ initialConfig: t, children: e }) {
12
- const n = V(() => {
13
- const { theme: r, namespace: o, nodes: s, onError: i, editorState: a, html: l } = t, c = Xe(null, r), u = qe({ editable: t.editable, html: l, namespace: o, nodes: s, onError: (d) => i(d, u), theme: r });
1
+ import { jsx as E, jsxs as Q, Fragment as Ie } from "react/jsx-runtime";
2
+ import { W as st, w as O, P as de, I as g, e as at, i as lt, u as T, j as I, y as _, F as ct, l as N, T as ut, X as ie, k as fe, m as h, n as Ke, q as ze, r as Ue, v as dt, S as ge, b as ft, E as se, C as he, s as ve, z as Be, A as mt, B as pt, M as je, D as gt, G as ht, H as vt, N as Je, O as yt, Q as y, R as wt, c as F, U as Ct, V as Et, Z as bt, a0 as ee, a1 as xt, a2 as $t, a3 as St, a4 as _t, a5 as Nt, a6 as Dt, a7 as kt, a8 as ye, a as we, a9 as Lt, aa as ne, ab as Tt, ac as Ce, ad as Pt, ae as Rt, af as Ot, ag as Mt, ah as Ft, ai as At, aj as It, ak as Kt, d as zt, al as Ut, am as Bt, an as jt, ao as Jt, ap as Wt, t as Vt, L as Ee, aq as qt, x as Ht, K as q, $ as H, ar as Xt, as as Yt, g as Zt, h as Gt } from "../../Lexical.prod-DNRTKPfN.js";
3
+ import * as re from "react";
4
+ import { useMemo as W, useLayoutEffect as z, useEffect as k, useRef as Qt, useState as K, Suspense as en, forwardRef as We, useCallback as tn } from "react";
5
+ import { i as R, L as U, e as nn, t as me } from "../../LexicalUtils.prod-D_BPEjfg.js";
6
+ import { r as be } from "../../index-DsprzSCj.js";
7
+ import { J as Ve, D as qe, Z as rn } from "../../ListPlugin-CgNBzfIl.js";
8
+ import { a as He, U as xe, m as oe, g as on, b as sn, F as an, M as ln, f as cn } from "../../helpers-TSjo3aAv.js";
9
+ import { s as J } from "../../RteEditor.module-BjGyWKhW.js";
10
+ import { ToolBarPlugin as un } from "./Plugins/ToolbarPlugin/ToolbarPlugin.js";
11
+ import "../Buttons/Button.js";
12
+ import "../Buttons/LinkButton.js";
13
+ import "@react-aria/button";
14
+ import "@react-aria/dialog";
15
+ import "@react-aria/focus";
16
+ import "@react-aria/overlays";
17
+ import "../OverlayCloseButton/OverlayCloseButton.js";
18
+ import "../GridRow/GridRow.js";
19
+ import "../IconButton/IconButton.js";
20
+ import "../Input/Input.js";
21
+ import "../InputField/InputField.js";
22
+ import "react-router-dom";
23
+ import "../../MultiSelect-D1FnMER4.js";
24
+ import "../SelectListbox/SelectListbox.js";
25
+ import "../SelectListbox/SelectProvider.js";
26
+ import { UvaTheme as dn } from "./UvaTheme/UvaTheme.js";
27
+ const Xe = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0, fn = Xe ? z : k, X = { tag: "history-merge" };
28
+ function mn({ initialConfig: t, children: e }) {
29
+ const n = W(() => {
30
+ const { theme: r, namespace: s, nodes: i, onError: o, editorState: a, html: l } = t, c = lt(null, r), u = st({ editable: t.editable, html: l, namespace: s, nodes: i, onError: (d) => o(d, u), theme: r });
14
31
  return function(d, f) {
15
32
  if (f !== null) {
16
33
  if (f === void 0) d.update(() => {
17
- const g = P();
18
- if (g.isEmpty()) {
19
- const m = te();
20
- g.append(m);
21
- const v = Ie ? document.activeElement : null;
22
- (p() !== null || v !== null && v === d.getRootElement()) && m.select();
34
+ const p = O();
35
+ if (p.isEmpty()) {
36
+ const m = de();
37
+ p.append(m);
38
+ const v = Xe ? document.activeElement : null;
39
+ (g() !== null || v !== null && v === d.getRootElement()) && m.select();
23
40
  }
24
- }, j);
41
+ }, X);
25
42
  else if (f !== null) switch (typeof f) {
26
43
  case "string": {
27
- const g = d.parseEditorState(f);
28
- d.setEditorState(g, j);
44
+ const p = d.parseEditorState(f);
45
+ d.setEditorState(p, X);
29
46
  break;
30
47
  }
31
48
  case "object":
32
- d.setEditorState(f, j);
49
+ d.setEditorState(f, X);
33
50
  break;
34
51
  case "function":
35
52
  d.update(() => {
36
- P().isEmpty() && f(d);
37
- }, j);
53
+ O().isEmpty() && f(d);
54
+ }, X);
38
55
  }
39
56
  }
40
57
  }(u, a), [u, c];
41
58
  }, []);
42
- return zt(() => {
43
- const r = t.editable, [o] = n;
44
- o.setEditable(r === void 0 || r);
45
- }, []), y(He.Provider, { value: n, children: e });
59
+ return fn(() => {
60
+ const r = t.editable, [s] = n;
61
+ s.setEditable(r === void 0 || r);
62
+ }, []), E(at.Provider, { value: n, children: e });
46
63
  }
47
- const Jt = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0 ? M : _;
48
- function Wt(t) {
64
+ const pn = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0 ? z : k;
65
+ function gn(t) {
49
66
  return { initialValueFn: () => t.isEditable(), subscribe: (e) => t.registerEditableListener(e) };
50
67
  }
51
- function Vt() {
68
+ function hn() {
52
69
  return function(t) {
53
- const [e] = A(), n = V(() => t(e), [e, t]), r = It(n.initialValueFn()), [o, s] = I(r.current);
54
- return Jt(() => {
55
- const { initialValueFn: i, subscribe: a } = n, l = i();
56
- return r.current !== l && (r.current = l, s(l)), a((c) => {
57
- r.current = c, s(c);
70
+ const [e] = T(), n = W(() => t(e), [e, t]), r = Qt(n.initialValueFn()), [s, i] = K(r.current);
71
+ return pn(() => {
72
+ const { initialValueFn: o, subscribe: a } = n, l = o();
73
+ return r.current !== l && (r.current = l, i(l)), a((c) => {
74
+ r.current = c, i(c);
58
75
  });
59
- }, [n, t]), o;
60
- }(Wt);
76
+ }, [n, t]), s;
77
+ }(gn);
61
78
  }
62
- function qt() {
63
- return P().getTextContent();
79
+ function vn() {
80
+ return O().getTextContent();
64
81
  }
65
- function Ht(t, e = !0) {
82
+ function yn(t, e = !0) {
66
83
  if (t) return !1;
67
- let n = qt();
84
+ let n = vn();
68
85
  return e && (n = n.trim()), n === "";
69
86
  }
70
- function Xt(t) {
71
- if (!Ht(t, !1)) return !1;
72
- const e = P().getChildren(), n = e.length;
87
+ function wn(t) {
88
+ if (!yn(t, !1)) return !1;
89
+ const e = O().getChildren(), n = e.length;
73
90
  if (n > 1) return !1;
74
91
  for (let r = 0; r < n; r++) {
75
- const o = e[r];
76
- if (F(o)) return !1;
77
- if (x(o)) {
78
- if (!Ye(o) || o.__indent !== 0) return !1;
79
- const s = o.getChildren(), i = s.length;
80
- for (let a = 0; a < i; a++) {
81
- const l = s[r];
82
- if (!T(l)) return !1;
92
+ const s = e[r];
93
+ if (I(s)) return !1;
94
+ if (_(s)) {
95
+ if (!ct(s) || s.__indent !== 0) return !1;
96
+ const i = s.getChildren(), o = i.length;
97
+ for (let a = 0; a < o; a++) {
98
+ const l = i[r];
99
+ if (!N(l)) return !1;
83
100
  }
84
101
  }
85
102
  }
86
103
  return !0;
87
104
  }
88
- function Ae(t) {
89
- return () => Xt(t);
105
+ function Ye(t) {
106
+ return () => wn(t);
90
107
  }
91
- function Yt(t) {
108
+ function Cn(t) {
92
109
  return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
93
110
  }
94
- Yt(function(t) {
111
+ Cn(function(t) {
95
112
  const e = new URLSearchParams();
96
113
  e.append("code", t);
97
114
  for (let n = 1; n < arguments.length; n++) e.append("v", arguments[n]);
98
115
  throw Error(`Minified Lexical error #${t}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`);
99
116
  });
100
- function Zt(t) {
117
+ function En(t) {
101
118
  return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
102
119
  }
103
- Zt(function(t) {
120
+ En(function(t) {
104
121
  const e = new URLSearchParams();
105
122
  e.append("code", t);
106
123
  for (let n = 1; n < arguments.length; n++) e.append("v", arguments[n]);
107
124
  throw Error(`Minified Lexical error #${t}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`);
108
125
  });
109
- const Gt = /* @__PURE__ */ new Map();
110
- function Qt(t) {
126
+ const bn = /* @__PURE__ */ new Map();
127
+ function xn(t) {
111
128
  const e = {}, n = t.split(";");
112
129
  for (const r of n) if (r !== "") {
113
- const [o, s] = r.split(/:([^]+)/);
114
- o && s && (e[o.trim()] = s.trim());
130
+ const [s, i] = r.split(/:([^]+)/);
131
+ s && i && (e[s.trim()] = i.trim());
115
132
  }
116
133
  return e;
117
134
  }
118
- function Me(t, e) {
135
+ function Ze(t, e) {
119
136
  const n = t.getStartEndPoints();
120
137
  if (e.isSelected(t) && !e.isSegmented() && !e.isToken() && n !== null) {
121
- const [r, o] = n, s = t.isBackward(), i = r.getNode(), a = o.getNode(), l = e.is(i), c = e.is(a);
138
+ const [r, s] = n, i = t.isBackward(), o = r.getNode(), a = s.getNode(), l = e.is(o), c = e.is(a);
122
139
  if (l || c) {
123
- const [u, d] = Ze(t), f = i.is(a), g = e.is(s ? a : i), m = e.is(s ? i : a);
124
- let v, $ = 0;
125
- return f ? ($ = u > d ? d : u, v = u > d ? u : d) : g ? ($ = s ? d : u, v = void 0) : m && ($ = 0, v = s ? u : d), e.__text = e.__text.slice($, v), e;
140
+ const [u, d] = ut(t), f = o.is(a), p = e.is(i ? a : o), m = e.is(i ? o : a);
141
+ let v, b = 0;
142
+ return f ? (b = u > d ? d : u, v = u > d ? u : d) : p ? (b = i ? d : u, v = void 0) : m && (b = 0, v = i ? u : d), e.__text = e.__text.slice(b, v), e;
126
143
  }
127
144
  }
128
145
  return e;
129
146
  }
130
- function en(t) {
131
- const e = t.getStyle(), n = Qt(e);
132
- Gt.set(e, n);
147
+ function $n(t) {
148
+ const e = t.getStyle(), n = xn(e);
149
+ bn.set(e, n);
133
150
  }
134
- function fe(t, e) {
135
- const n = Y(t.focus, e);
136
- return F(n) && !n.isIsolated() || x(n) && !n.isInline() && !n.canBeEmpty();
151
+ function $e(t, e) {
152
+ const n = ie(t.focus, e);
153
+ return I(n) && !n.isIsolated() || _(n) && !n.isInline() && !n.canBeEmpty();
137
154
  }
138
- function tn(t, e, n, r) {
155
+ function Sn(t, e, n, r) {
139
156
  t.modify(e ? "extend" : "move", n, r);
140
157
  }
141
- function nn(t) {
158
+ function _n(t) {
142
159
  const e = t.anchor.getNode();
143
- return (Ne(e) ? e : e.getParentOrThrow()).getDirection() === "rtl";
160
+ return (fe(e) ? e : e.getParentOrThrow()).getDirection() === "rtl";
144
161
  }
145
- function me(t, e, n) {
146
- const r = nn(t);
147
- tn(t, e, n ? !r : r, "character");
162
+ function Se(t, e, n) {
163
+ const r = _n(t);
164
+ Sn(t, e, n ? !r : r, "character");
148
165
  }
149
- function rn(t) {
166
+ function Nn(t) {
150
167
  const e = window.location.origin, n = (r) => {
151
168
  if (r.origin !== e) return;
152
- const o = t.getRootElement();
153
- if (document.activeElement !== o) return;
154
- const s = r.data;
155
- if (typeof s == "string") {
156
- let i;
169
+ const s = t.getRootElement();
170
+ if (document.activeElement !== s) return;
171
+ const i = r.data;
172
+ if (typeof i == "string") {
173
+ let o;
157
174
  try {
158
- i = JSON.parse(s);
175
+ o = JSON.parse(i);
159
176
  } catch {
160
177
  return;
161
178
  }
162
- if (i && i.protocol === "nuanria_messaging" && i.type === "request") {
163
- const a = i.payload;
179
+ if (o && o.protocol === "nuanria_messaging" && o.type === "request") {
180
+ const a = o.payload;
164
181
  if (a && a.functionId === "makeChanges") {
165
182
  const l = a.args;
166
183
  if (l) {
167
- const [c, u, d, f, g, m] = l;
184
+ const [c, u, d, f, p, m] = l;
168
185
  t.update(() => {
169
- const v = p();
170
- if (w(v)) {
171
- const $ = v.anchor;
172
- let E = $.getNode(), C = 0, b = 0;
173
- if (T(E) && c >= 0 && u >= 0 && (C = c, b = c + u, v.setTextNodeRange(E, C, E, b)), C === b && d === "" || (v.insertRawText(d), E = $.getNode()), T(E)) {
174
- C = f, b = f + g;
175
- const N = E.getTextContentSize();
176
- C = C > N ? N : C, b = b > N ? N : b, v.setTextNodeRange(E, C, E, b);
186
+ const v = g();
187
+ if (h(v)) {
188
+ const b = v.anchor;
189
+ let w = b.getNode(), C = 0, x = 0;
190
+ if (N(w) && c >= 0 && u >= 0 && (C = c, x = c + u, v.setTextNodeRange(w, C, w, x)), C === x && d === "" || (v.insertRawText(d), w = b.getNode()), N(w)) {
191
+ C = f, x = f + p;
192
+ const $ = w.getTextContentSize();
193
+ C = C > $ ? $ : C, x = x > $ ? $ : x, v.setTextNodeRange(w, C, w, x);
177
194
  }
178
195
  r.stopImmediatePropagation();
179
196
  }
@@ -187,70 +204,70 @@ function rn(t) {
187
204
  window.removeEventListener("message", n, !0);
188
205
  };
189
206
  }
190
- function ke(t, e) {
207
+ function Ge(t, e) {
191
208
  const n = e.body ? e.body.childNodes : [];
192
209
  let r = [];
193
- const o = [];
194
- for (let s = 0; s < n.length; s++) {
195
- const i = n[s];
196
- if (!je.has(i.nodeName)) {
197
- const a = ze(i, t, o, !1);
210
+ const s = [];
211
+ for (let i = 0; i < n.length; i++) {
212
+ const o = n[i];
213
+ if (!tt.has(o.nodeName)) {
214
+ const a = nt(o, t, s, !1);
198
215
  a !== null && (r = r.concat(a));
199
216
  }
200
217
  }
201
- return function(s) {
202
- for (const i of s) i.getNextSibling() instanceof Se && i.insertAfter(De());
203
- for (const i of s) {
204
- const a = i.getChildren();
205
- for (const l of a) i.insertBefore(l);
206
- i.remove();
218
+ return function(i) {
219
+ for (const o of i) o.getNextSibling() instanceof Ke && o.insertAfter(ze());
220
+ for (const o of i) {
221
+ const a = o.getChildren();
222
+ for (const l of a) o.insertBefore(l);
223
+ o.remove();
207
224
  }
208
- }(o), r;
225
+ }(s), r;
209
226
  }
210
- function Ke(t, e) {
227
+ function Qe(t, e) {
211
228
  if (typeof document > "u" || typeof window > "u" && global.window === void 0) throw new Error("To use $generateHtmlFromNodes in headless mode please initialize a headless browser implementation such as JSDom before calling this function.");
212
- const n = document.createElement("div"), r = P().getChildren();
213
- for (let o = 0; o < r.length; o++)
214
- Be(t, r[o], n, e);
229
+ const n = document.createElement("div"), r = O().getChildren();
230
+ for (let s = 0; s < r.length; s++)
231
+ et(t, r[s], n, e);
215
232
  return n.innerHTML;
216
233
  }
217
- function Be(t, e, n, r = null) {
218
- let o = r === null || e.isSelected(r);
219
- const s = x(e) && e.excludeFromCopy("html");
220
- let i = e;
234
+ function et(t, e, n, r = null) {
235
+ let s = r === null || e.isSelected(r);
236
+ const i = _(e) && e.excludeFromCopy("html");
237
+ let o = e;
221
238
  if (r !== null) {
222
- let g = Pe(e);
223
- g = T(g) && r !== null ? Me(r, g) : g, i = g;
239
+ let p = Ue(e);
240
+ p = N(p) && r !== null ? Ze(r, p) : p, o = p;
224
241
  }
225
- const a = x(i) ? i.getChildren() : [], l = t._nodes.get(i.getType());
242
+ const a = _(o) ? o.getChildren() : [], l = t._nodes.get(o.getType());
226
243
  let c;
227
- c = l && l.exportDOM !== void 0 ? l.exportDOM(t, i) : i.exportDOM(t);
244
+ c = l && l.exportDOM !== void 0 ? l.exportDOM(t, o) : o.exportDOM(t);
228
245
  const { element: u, after: d } = c;
229
246
  if (!u) return !1;
230
247
  const f = document.createDocumentFragment();
231
- for (let g = 0; g < a.length; g++) {
232
- const m = a[g], v = Be(t, m, f, r);
233
- !o && x(e) && v && e.extractWithChild(m, r, "html") && (o = !0);
248
+ for (let p = 0; p < a.length; p++) {
249
+ const m = a[p], v = et(t, m, f, r);
250
+ !s && _(e) && v && e.extractWithChild(m, r, "html") && (s = !0);
234
251
  }
235
- if (o && !s) {
236
- if ((Ge(u) || ie(u)) && u.append(f), n.append(u), d) {
237
- const g = d.call(i, u);
238
- g && (ie(u) ? u.replaceChildren(g) : u.replaceWith(g));
252
+ if (s && !i) {
253
+ if ((dt(u) || ge(u)) && u.append(f), n.append(u), d) {
254
+ const p = d.call(o, u);
255
+ p && (ge(u) ? u.replaceChildren(p) : u.replaceWith(p));
239
256
  }
240
257
  } else n.append(f);
241
- return o;
258
+ return s;
242
259
  }
243
- const je = /* @__PURE__ */ new Set(["STYLE", "SCRIPT"]);
244
- function ze(t, e, n, r, o = /* @__PURE__ */ new Map(), s) {
245
- let i = [];
246
- if (je.has(t.nodeName)) return i;
260
+ const tt = /* @__PURE__ */ new Set(["STYLE", "SCRIPT"]);
261
+ function nt(t, e, n, r, s = /* @__PURE__ */ new Map(), i) {
262
+ let o = [];
263
+ if (tt.has(t.nodeName)) return o;
247
264
  let a = null;
248
265
  const l = function(m, v) {
249
- const { nodeName: $ } = m, E = v._htmlConversions.get($.toLowerCase());
266
+ const { nodeName: b } = m, w = v._htmlConversions.get(b.toLowerCase());
250
267
  let C = null;
251
- if (E !== void 0) for (const b of E) {
252
- const N = b(m);
253
- N !== null && (C === null || (C.priority || 0) < (N.priority || 0)) && (C = N);
268
+ if (w !== void 0) for (const x of w) {
269
+ const $ = x(m);
270
+ $ !== null && (C === null || (C.priority || 0) < ($.priority || 0)) && (C = $);
254
271
  }
255
272
  return C !== null ? C.conversion : null;
256
273
  }(t, e), c = l ? l(t) : null;
@@ -259,181 +276,181 @@ function ze(t, e, n, r, o = /* @__PURE__ */ new Map(), s) {
259
276
  u = c.after;
260
277
  const m = c.node;
261
278
  if (a = Array.isArray(m) ? m[m.length - 1] : m, a !== null) {
262
- for (const [, v] of o) if (a = v(a, s), !a) break;
263
- a && i.push(...Array.isArray(m) ? m : [a]);
279
+ for (const [, v] of s) if (a = v(a, i), !a) break;
280
+ a && o.push(...Array.isArray(m) ? m : [a]);
264
281
  }
265
- c.forChild != null && o.set(t.nodeName, c.forChild);
282
+ c.forChild != null && s.set(t.nodeName, c.forChild);
266
283
  }
267
284
  const d = t.childNodes;
268
285
  let f = [];
269
- const g = (a == null || !Qe(a)) && (a != null && Z(a) || r);
270
- for (let m = 0; m < d.length; m++) f.push(...ze(d[m], e, n, g, new Map(o), a));
271
- return u != null && (f = u(f)), se(t) && (f = on(t, f, g ? () => {
272
- const m = new Se();
286
+ const p = (a == null || !ft(a)) && (a != null && se(a) || r);
287
+ for (let m = 0; m < d.length; m++) f.push(...nt(d[m], e, n, p, new Map(s), a));
288
+ return u != null && (f = u(f)), he(t) && (f = Dn(t, f, p ? () => {
289
+ const m = new Ke();
273
290
  return n.push(m), m;
274
- } : te)), a == null ? f.length > 0 ? i = i.concat(f) : se(t) && function(m) {
275
- return m.nextSibling == null || m.previousSibling == null ? !1 : ae(m.nextSibling) && ae(m.previousSibling);
276
- }(t) && (i = i.concat(De())) : x(a) && a.append(...f), i;
277
- }
278
- function on(t, e, n) {
279
- const r = t.style.textAlign, o = [];
280
- let s = [];
281
- for (let i = 0; i < e.length; i++) {
282
- const a = e[i];
283
- if (Z(a)) r && !a.getFormat() && a.setFormat(r), o.push(a);
284
- else if (s.push(a), i === e.length - 1 || i < e.length - 1 && Z(e[i + 1])) {
291
+ } : de)), a == null ? f.length > 0 ? o = o.concat(f) : he(t) && function(m) {
292
+ return m.nextSibling == null || m.previousSibling == null ? !1 : ve(m.nextSibling) && ve(m.previousSibling);
293
+ }(t) && (o = o.concat(ze())) : _(a) && a.append(...f), o;
294
+ }
295
+ function Dn(t, e, n) {
296
+ const r = t.style.textAlign, s = [];
297
+ let i = [];
298
+ for (let o = 0; o < e.length; o++) {
299
+ const a = e[o];
300
+ if (se(a)) r && !a.getFormat() && a.setFormat(r), s.push(a);
301
+ else if (i.push(a), o === e.length - 1 || o < e.length - 1 && se(e[o + 1])) {
285
302
  const l = n();
286
- l.setFormat(r), l.append(...s), o.push(l), s = [];
303
+ l.setFormat(r), l.append(...i), s.push(l), i = [];
287
304
  }
288
305
  }
289
- return o;
306
+ return s;
290
307
  }
291
- function sn(t) {
308
+ function kn(t) {
292
309
  return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
293
310
  }
294
- var W = sn(function(t) {
311
+ var te = kn(function(t) {
295
312
  const e = new URLSearchParams();
296
313
  e.append("code", t);
297
314
  for (let n = 1; n < arguments.length; n++) e.append("v", arguments[n]);
298
315
  throw Error(`Minified Lexical error #${t}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`);
299
316
  });
300
- const an = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0, Ue = (t) => an ? (t || window).getSelection() : null;
301
- function ln(t, e = p()) {
302
- return e == null && W(166), w(e) && e.isCollapsed() || e.getNodes().length === 0 ? "" : Ke(t, e);
317
+ const Ln = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0, rt = (t) => Ln ? (t || window).getSelection() : null;
318
+ function Tn(t, e = g()) {
319
+ return e == null && te(166), h(e) && e.isCollapsed() || e.getNodes().length === 0 ? "" : Qe(t, e);
303
320
  }
304
- function cn(t, e = p()) {
305
- return e == null && W(166), w(e) && e.isCollapsed() || e.getNodes().length === 0 ? null : JSON.stringify(un(t, e));
321
+ function Pn(t, e = g()) {
322
+ return e == null && te(166), h(e) && e.isCollapsed() || e.getNodes().length === 0 ? null : JSON.stringify(Rn(t, e));
306
323
  }
307
- function pe(t, e, n) {
324
+ function _e(t, e, n) {
308
325
  const r = t.getData("application/x-lexical-editor");
309
326
  if (r) try {
310
- const i = JSON.parse(r);
311
- if (i.namespace === n._config.namespace && Array.isArray(i.nodes))
312
- return ge(n, dn(i.nodes), e);
327
+ const o = JSON.parse(r);
328
+ if (o.namespace === n._config.namespace && Array.isArray(o.nodes))
329
+ return Ne(n, On(o.nodes), e);
313
330
  } catch {
314
331
  }
315
- const o = t.getData("text/html");
316
- if (o) try {
317
- const i = new DOMParser().parseFromString(o, "text/html");
318
- return ge(n, ke(n, i), e);
332
+ const s = t.getData("text/html");
333
+ if (s) try {
334
+ const o = new DOMParser().parseFromString(s, "text/html");
335
+ return Ne(n, Ge(n, o), e);
319
336
  } catch {
320
337
  }
321
- const s = t.getData("text/plain") || t.getData("text/uri-list");
322
- if (s != null) if (w(e)) {
323
- const i = s.split(/(\r?\n|\t)/);
324
- i[i.length - 1] === "" && i.pop();
325
- for (let a = 0; a < i.length; a++) {
326
- const l = p();
327
- if (w(l)) {
328
- const c = i[a];
338
+ const i = t.getData("text/plain") || t.getData("text/uri-list");
339
+ if (i != null) if (h(e)) {
340
+ const o = i.split(/(\r?\n|\t)/);
341
+ o[o.length - 1] === "" && o.pop();
342
+ for (let a = 0; a < o.length; a++) {
343
+ const l = g();
344
+ if (h(l)) {
345
+ const c = o[a];
329
346
  c === `
330
347
  ` || c === `\r
331
- ` ? l.insertParagraph() : c === " " ? l.insertNodes([Te()]) : l.insertText(c);
348
+ ` ? l.insertParagraph() : c === " " ? l.insertNodes([Be()]) : l.insertText(c);
332
349
  }
333
350
  }
334
- } else e.insertRawText(s);
351
+ } else e.insertRawText(i);
335
352
  }
336
- function ge(t, e, n) {
337
- t.dispatchCommand(et, { nodes: e, selection: n }) || n.insertNodes(e);
353
+ function Ne(t, e, n) {
354
+ t.dispatchCommand(mt, { nodes: e, selection: n }) || n.insertNodes(e);
338
355
  }
339
- function Je(t, e, n, r = []) {
340
- let o = e === null || n.isSelected(e);
341
- const s = x(n) && n.excludeFromCopy("html");
342
- let i = n;
356
+ function ot(t, e, n, r = []) {
357
+ let s = e === null || n.isSelected(e);
358
+ const i = _(n) && n.excludeFromCopy("html");
359
+ let o = n;
343
360
  if (e !== null) {
344
- let c = Pe(n);
345
- c = T(c) && e !== null ? Me(e, c) : c, i = c;
361
+ let c = Ue(n);
362
+ c = N(c) && e !== null ? Ze(e, c) : c, o = c;
346
363
  }
347
- const a = x(i) ? i.getChildren() : [], l = function(c) {
364
+ const a = _(o) ? o.getChildren() : [], l = function(c) {
348
365
  const u = c.exportJSON(), d = c.constructor;
349
- if (u.type !== d.getType() && W(58, d.name), x(c)) {
366
+ if (u.type !== d.getType() && te(58, d.name), _(c)) {
350
367
  const f = u.children;
351
- Array.isArray(f) || W(59, d.name);
368
+ Array.isArray(f) || te(59, d.name);
352
369
  }
353
370
  return u;
354
- }(i);
355
- if (T(i)) {
356
- const c = i.__text;
357
- c.length > 0 ? l.text = c : o = !1;
371
+ }(o);
372
+ if (N(o)) {
373
+ const c = o.__text;
374
+ c.length > 0 ? l.text = c : s = !1;
358
375
  }
359
376
  for (let c = 0; c < a.length; c++) {
360
- const u = a[c], d = Je(t, e, u, l.children);
361
- !o && x(n) && d && n.extractWithChild(u, e, "clone") && (o = !0);
377
+ const u = a[c], d = ot(t, e, u, l.children);
378
+ !s && _(n) && d && n.extractWithChild(u, e, "clone") && (s = !0);
362
379
  }
363
- if (o && !s) r.push(l);
380
+ if (s && !i) r.push(l);
364
381
  else if (Array.isArray(l.children)) for (let c = 0; c < l.children.length; c++) {
365
382
  const u = l.children[c];
366
383
  r.push(u);
367
384
  }
368
- return o;
385
+ return s;
369
386
  }
370
- function un(t, e) {
371
- const n = [], r = P().getChildren();
372
- for (let o = 0; o < r.length; o++)
373
- Je(t, e, r[o], n);
387
+ function Rn(t, e) {
388
+ const n = [], r = O().getChildren();
389
+ for (let s = 0; s < r.length; s++)
390
+ ot(t, e, r[s], n);
374
391
  return { namespace: t._config.namespace, nodes: n };
375
392
  }
376
- function dn(t) {
393
+ function On(t) {
377
394
  const e = [];
378
395
  for (let n = 0; n < t.length; n++) {
379
- const r = t[n], o = tt(r);
380
- T(o) && en(o), e.push(o);
396
+ const r = t[n], s = pt(r);
397
+ N(s) && $n(s), e.push(s);
381
398
  }
382
399
  return e;
383
400
  }
384
- let R = null;
385
- async function he(t, e, n) {
386
- if (R !== null) return !1;
401
+ let A = null;
402
+ async function De(t, e, n) {
403
+ if (A !== null) return !1;
387
404
  if (e !== null) return new Promise((l, c) => {
388
405
  t.update(() => {
389
- l(we(t, e, n));
406
+ l(ke(t, e, n));
390
407
  });
391
408
  });
392
- const r = t.getRootElement(), o = t._window == null ? window.document : t._window.document, s = Ue(t._window);
393
- if (r === null || s === null) return !1;
394
- const i = o.createElement("span");
395
- i.style.cssText = "position: fixed; top: -1000px;", i.append(o.createTextNode("#")), r.append(i);
409
+ const r = t.getRootElement(), s = t._window == null ? window.document : t._window.document, i = rt(t._window);
410
+ if (r === null || i === null) return !1;
411
+ const o = s.createElement("span");
412
+ o.style.cssText = "position: fixed; top: -1000px;", o.append(s.createTextNode("#")), r.append(o);
396
413
  const a = new Range();
397
- return a.setStart(i, 0), a.setEnd(i, 1), s.removeAllRanges(), s.addRange(a), new Promise((l, c) => {
398
- const u = t.registerCommand(_e, (d) => (O(d, ClipboardEvent) && (u(), R !== null && (window.clearTimeout(R), R = null), l(we(t, d, n))), !0), nt);
399
- R = window.setTimeout(() => {
400
- u(), R = null, l(!1);
401
- }, 50), o.execCommand("copy"), i.remove();
414
+ return a.setStart(o, 0), a.setEnd(o, 1), i.removeAllRanges(), i.addRange(a), new Promise((l, c) => {
415
+ const u = t.registerCommand(je, (d) => (R(d, ClipboardEvent) && (u(), A !== null && (window.clearTimeout(A), A = null), l(ke(t, d, n))), !0), gt);
416
+ A = window.setTimeout(() => {
417
+ u(), A = null, l(!1);
418
+ }, 50), s.execCommand("copy"), o.remove();
402
419
  });
403
420
  }
404
- function we(t, e, n) {
421
+ function ke(t, e, n) {
405
422
  if (n === void 0) {
406
- const o = Ue(t._window);
407
- if (!o) return !1;
408
- const s = o.anchorNode, i = o.focusNode;
409
- if (s !== null && i !== null && !rt(t, s, i)) return !1;
410
- const a = p();
423
+ const s = rt(t._window);
424
+ if (!s) return !1;
425
+ const i = s.anchorNode, o = s.focusNode;
426
+ if (i !== null && o !== null && !ht(t, i, o)) return !1;
427
+ const a = g();
411
428
  if (a === null) return !1;
412
- n = mn(a);
429
+ n = Fn(a);
413
430
  }
414
431
  e.preventDefault();
415
432
  const r = e.clipboardData;
416
- return r !== null && (pn(r, n), !0);
433
+ return r !== null && (An(r, n), !0);
417
434
  }
418
- const fn = [["text/html", ln], ["application/x-lexical-editor", cn]];
419
- function mn(t = p()) {
435
+ const Mn = [["text/html", Tn], ["application/x-lexical-editor", Pn]];
436
+ function Fn(t = g()) {
420
437
  const e = { "text/plain": t ? t.getTextContent() : "" };
421
438
  if (t) {
422
- const n = ot();
423
- for (const [r, o] of fn) {
424
- const s = o(n, t);
425
- s !== null && (e[r] = s);
439
+ const n = vt();
440
+ for (const [r, s] of Mn) {
441
+ const i = s(n, t);
442
+ i !== null && (e[r] = i);
426
443
  }
427
444
  }
428
445
  return e;
429
446
  }
430
- function pn(t, e) {
447
+ function An(t, e) {
431
448
  for (const n in e) {
432
449
  const r = e[n];
433
450
  r !== void 0 && t.setData(n, r);
434
451
  }
435
452
  }
436
- function ve(t, e) {
453
+ function Le(t, e) {
437
454
  if (document.caretRangeFromPoint !== void 0) {
438
455
  const n = document.caretRangeFromPoint(t, e);
439
456
  return n === null ? null : { node: n.startContainer, offset: n.startOffset };
@@ -444,390 +461,553 @@ function ve(t, e) {
444
461
  }
445
462
  return null;
446
463
  }
447
- const k = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0, gn = k && "documentMode" in document ? document.documentMode : null, hn = !(!k || !("InputEvent" in window) || gn) && "getTargetRanges" in new window.InputEvent("input"), wn = k && /Version\/[\d.]+.*Safari/.test(navigator.userAgent), vn = k && /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream, yn = k && /^(?=.*Chrome).*/i.test(navigator.userAgent), Cn = k && /AppleWebKit\/[\d.]+/.test(navigator.userAgent) && !yn, ye = Ft();
448
- function z(t) {
464
+ const B = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0, In = B && "documentMode" in document ? document.documentMode : null, Kn = !(!B || !("InputEvent" in window) || In) && "getTargetRanges" in new window.InputEvent("input"), zn = B && /Version\/[\d.]+.*Safari/.test(navigator.userAgent), Un = B && /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream, Bn = B && /^(?=.*Chrome).*/i.test(navigator.userAgent), jn = B && /AppleWebKit\/[\d.]+/.test(navigator.userAgent) && !Bn, Te = Vt();
465
+ function Y(t) {
449
466
  let e = null;
450
- if (O(t, DragEvent) ? e = t.dataTransfer : O(t, ClipboardEvent) && (e = t.clipboardData), e === null) return [!1, [], !1];
451
- const n = e.types, r = n.includes("Files"), o = n.includes("text/html") || n.includes("text/plain");
452
- return [r, Array.from(e.files), o];
467
+ if (R(t, DragEvent) ? e = t.dataTransfer : R(t, ClipboardEvent) && (e = t.clipboardData), e === null) return [!1, [], !1];
468
+ const n = e.types, r = n.includes("Files"), s = n.includes("text/html") || n.includes("text/plain");
469
+ return [r, Array.from(e.files), s];
453
470
  }
454
- function Ce(t) {
455
- const e = p();
456
- if (!w(e)) return !1;
471
+ function Pe(t) {
472
+ const e = g();
473
+ if (!h(e)) return !1;
457
474
  const n = /* @__PURE__ */ new Set(), r = e.getNodes();
458
- for (let o = 0; o < r.length; o++) {
459
- const s = r[o], i = s.getKey();
460
- if (n.has(i)) continue;
461
- const a = Oe(s, (c) => x(c) && !c.isInline());
475
+ for (let s = 0; s < r.length; s++) {
476
+ const i = r[s], o = i.getKey();
477
+ if (n.has(o)) continue;
478
+ const a = me(i, (c) => _(c) && !c.isInline());
462
479
  if (a === null) continue;
463
480
  const l = a.getKey();
464
481
  a.canIndent() && !n.has(l) && (n.add(l), t(a));
465
482
  }
466
483
  return n.size > 0;
467
484
  }
468
- function U(t) {
469
- const e = G(t);
470
- return F(e);
471
- }
472
- function En(t) {
473
- return q(t.registerCommand(Rt, (e) => {
474
- const n = p();
475
- return !!L(n) && (n.clear(), !0);
476
- }, 0), t.registerCommand(H, (e) => {
477
- const n = p();
478
- return !!w(n) && (n.deleteCharacter(e), !0);
479
- }, h), t.registerCommand(Ot, (e) => {
480
- const n = p();
481
- return !!w(n) && (n.deleteWord(e), !0);
482
- }, h), t.registerCommand(Lt, (e) => {
483
- const n = p();
484
- return !!w(n) && (n.deleteLine(e), !0);
485
- }, h), t.registerCommand(_t, (e) => {
486
- const n = p();
485
+ function Z(t) {
486
+ const e = ee(t);
487
+ return I(e);
488
+ }
489
+ function Jn(t) {
490
+ return U(t.registerCommand(Wt, (e) => {
491
+ const n = g();
492
+ return !!F(n) && (n.clear(), !0);
493
+ }, 0), t.registerCommand(ne, (e) => {
494
+ const n = g();
495
+ return !!h(n) && (n.deleteCharacter(e), !0);
496
+ }, y), t.registerCommand(Jt, (e) => {
497
+ const n = g();
498
+ return !!h(n) && (n.deleteWord(e), !0);
499
+ }, y), t.registerCommand(jt, (e) => {
500
+ const n = g();
501
+ return !!h(n) && (n.deleteLine(e), !0);
502
+ }, y), t.registerCommand(Bt, (e) => {
503
+ const n = g();
487
504
  if (typeof e == "string") n !== null && n.insertText(e);
488
505
  else {
489
506
  if (n === null) return !1;
490
507
  const r = e.dataTransfer;
491
- if (r != null) pe(r, n, t);
492
- else if (w(n)) {
493
- const o = e.data;
494
- return o && n.insertText(o), !0;
508
+ if (r != null) _e(r, n, t);
509
+ else if (h(n)) {
510
+ const s = e.data;
511
+ return s && n.insertText(s), !0;
495
512
  }
496
513
  }
497
514
  return !0;
498
- }, h), t.registerCommand(Tt, () => {
499
- const e = p();
500
- return !!w(e) && (e.removeText(), !0);
501
- }, h), t.registerCommand(Pt, (e) => {
502
- const n = p();
503
- return !!w(n) && (n.formatText(e), !0);
504
- }, h), t.registerCommand(Dt, (e) => {
505
- const n = p();
506
- if (!w(n) && !L(n)) return !1;
515
+ }, y), t.registerCommand(Ut, () => {
516
+ const e = g();
517
+ return !!h(e) && (e.removeText(), !0);
518
+ }, y), t.registerCommand(zt, (e) => {
519
+ const n = g();
520
+ return !!h(n) && (n.formatText(e), !0);
521
+ }, y), t.registerCommand(Kt, (e) => {
522
+ const n = g();
523
+ if (!h(n) && !F(n)) return !1;
507
524
  const r = n.getNodes();
508
- for (const o of r) {
509
- const s = Oe(o, (i) => x(i) && !i.isInline());
510
- s !== null && s.setFormat(e);
525
+ for (const s of r) {
526
+ const i = me(s, (o) => _(o) && !o.isInline());
527
+ i !== null && i.setFormat(e);
511
528
  }
512
529
  return !0;
513
- }, h), t.registerCommand(le, (e) => {
514
- const n = p();
515
- return !!w(n) && (n.insertLineBreak(e), !0);
516
- }, h), t.registerCommand(ce, () => {
517
- const e = p();
518
- return !!w(e) && (e.insertParagraph(), !0);
519
- }, h), t.registerCommand(Nt, () => (St([Te()]), !0), h), t.registerCommand($t, () => Ce((e) => {
530
+ }, y), t.registerCommand(ye, (e) => {
531
+ const n = g();
532
+ return !!h(n) && (n.insertLineBreak(e), !0);
533
+ }, y), t.registerCommand(we, () => {
534
+ const e = g();
535
+ return !!h(e) && (e.insertParagraph(), !0);
536
+ }, y), t.registerCommand(At, () => (It([Be()]), !0), y), t.registerCommand(Ft, () => Pe((e) => {
520
537
  const n = e.getIndent();
521
538
  e.setIndent(n + 1);
522
- }), h), t.registerCommand(ue, () => Ce((e) => {
539
+ }), y), t.registerCommand(Ce, () => Pe((e) => {
523
540
  const n = e.getIndent();
524
541
  n > 0 && e.setIndent(n - 1);
525
- }), h), t.registerCommand(xt, (e) => {
526
- const n = p();
527
- if (L(n) && !U(e.target)) {
542
+ }), y), t.registerCommand(Mt, (e) => {
543
+ const n = g();
544
+ if (F(n) && !Z(e.target)) {
528
545
  const r = n.getNodes();
529
546
  if (r.length > 0) return r[0].selectPrevious(), !0;
530
- } else if (w(n)) {
531
- const r = Y(n.focus, !0);
532
- if (!e.shiftKey && F(r) && !r.isIsolated() && !r.isInline()) return r.selectPrevious(), e.preventDefault(), !0;
547
+ } else if (h(n)) {
548
+ const r = ie(n.focus, !0);
549
+ if (!e.shiftKey && I(r) && !r.isIsolated() && !r.isInline()) return r.selectPrevious(), e.preventDefault(), !0;
533
550
  }
534
551
  return !1;
535
- }, h), t.registerCommand(bt, (e) => {
536
- const n = p();
537
- if (L(n)) {
552
+ }, y), t.registerCommand(Ot, (e) => {
553
+ const n = g();
554
+ if (F(n)) {
538
555
  const r = n.getNodes();
539
556
  if (r.length > 0) return r[0].selectNext(0, 0), !0;
540
- } else if (w(n)) {
541
- if (function(o) {
542
- const s = o.focus;
543
- return s.key === "root" && s.offset === P().getChildrenSize();
557
+ } else if (h(n)) {
558
+ if (function(s) {
559
+ const i = s.focus;
560
+ return i.key === "root" && i.offset === O().getChildrenSize();
544
561
  }(n)) return e.preventDefault(), !0;
545
- const r = Y(n.focus, !1);
546
- if (!e.shiftKey && F(r) && !r.isIsolated() && !r.isInline()) return r.selectNext(), e.preventDefault(), !0;
562
+ const r = ie(n.focus, !1);
563
+ if (!e.shiftKey && I(r) && !r.isIsolated() && !r.isInline()) return r.selectNext(), e.preventDefault(), !0;
547
564
  }
548
565
  return !1;
549
- }, h), t.registerCommand(Et, (e) => {
550
- const n = p();
551
- if (L(n)) {
566
+ }, y), t.registerCommand(Rt, (e) => {
567
+ const n = g();
568
+ if (F(n)) {
552
569
  const r = n.getNodes();
553
570
  if (r.length > 0) return e.preventDefault(), r[0].selectPrevious(), !0;
554
571
  }
555
- if (!w(n)) return !1;
556
- if (fe(n, !0)) {
572
+ if (!h(n)) return !1;
573
+ if ($e(n, !0)) {
557
574
  const r = e.shiftKey;
558
- return e.preventDefault(), me(n, r, !0), !0;
575
+ return e.preventDefault(), Se(n, r, !0), !0;
559
576
  }
560
577
  return !1;
561
- }, h), t.registerCommand(Ct, (e) => {
562
- const n = p();
563
- if (L(n) && !U(e.target)) {
564
- const o = n.getNodes();
565
- if (o.length > 0) return e.preventDefault(), o[0].selectNext(0, 0), !0;
578
+ }, y), t.registerCommand(Pt, (e) => {
579
+ const n = g();
580
+ if (F(n) && !Z(e.target)) {
581
+ const s = n.getNodes();
582
+ if (s.length > 0) return e.preventDefault(), s[0].selectNext(0, 0), !0;
566
583
  }
567
- if (!w(n)) return !1;
584
+ if (!h(n)) return !1;
568
585
  const r = e.shiftKey;
569
- return !!fe(n, !1) && (e.preventDefault(), me(n, r, !1), !0);
570
- }, h), t.registerCommand(yt, (e) => {
571
- if (U(e.target)) return !1;
572
- const n = p();
573
- if (!w(n)) return !1;
586
+ return !!$e(n, !1) && (e.preventDefault(), Se(n, r, !1), !0);
587
+ }, y), t.registerCommand(Tt, (e) => {
588
+ if (Z(e.target)) return !1;
589
+ const n = g();
590
+ if (!h(n)) return !1;
574
591
  e.preventDefault();
575
- const { anchor: r } = n, o = r.getNode();
576
- return n.isCollapsed() && r.offset === 0 && !Ne(o) && kt(o).getIndent() > 0 ? t.dispatchCommand(ue, void 0) : t.dispatchCommand(H, !0);
577
- }, h), t.registerCommand(vt, (e) => {
578
- if (U(e.target)) return !1;
579
- const n = p();
580
- return !!w(n) && (e.preventDefault(), t.dispatchCommand(H, !1));
581
- }, h), t.registerCommand(wt, (e) => {
582
- const n = p();
583
- if (!w(n)) return !1;
592
+ const { anchor: r } = n, s = r.getNode();
593
+ return n.isCollapsed() && r.offset === 0 && !fe(s) && nn(s).getIndent() > 0 ? t.dispatchCommand(Ce, void 0) : t.dispatchCommand(ne, !0);
594
+ }, y), t.registerCommand(Lt, (e) => {
595
+ if (Z(e.target)) return !1;
596
+ const n = g();
597
+ return !!h(n) && (e.preventDefault(), t.dispatchCommand(ne, !1));
598
+ }, y), t.registerCommand(kt, (e) => {
599
+ const n = g();
600
+ if (!h(n)) return !1;
584
601
  if (e !== null) {
585
- if ((vn || wn || Cn) && hn) return !1;
586
- if (e.preventDefault(), e.shiftKey) return t.dispatchCommand(le, !1);
602
+ if ((Un || zn || jn) && Kn) return !1;
603
+ if (e.preventDefault(), e.shiftKey) return t.dispatchCommand(ye, !1);
587
604
  }
588
- return t.dispatchCommand(ce, void 0);
589
- }, h), t.registerCommand(ht, () => {
590
- const e = p();
591
- return !!w(e) && (t.blur(), !0);
592
- }, h), t.registerCommand(ft, (e) => {
593
- const [, n] = z(e);
605
+ return t.dispatchCommand(we, void 0);
606
+ }, y), t.registerCommand(Dt, () => {
607
+ const e = g();
608
+ return !!h(e) && (t.blur(), !0);
609
+ }, y), t.registerCommand($t, (e) => {
610
+ const [, n] = Y(e);
594
611
  if (n.length > 0) {
595
- const o = ve(e.clientX, e.clientY);
596
- if (o !== null) {
597
- const { offset: s, node: i } = o, a = G(i);
612
+ const s = Le(e.clientX, e.clientY);
613
+ if (s !== null) {
614
+ const { offset: i, node: o } = s, a = ee(o);
598
615
  if (a !== null) {
599
- const l = mt();
600
- if (T(a)) l.anchor.set(a.getKey(), s, "text"), l.focus.set(a.getKey(), s, "text");
616
+ const l = St();
617
+ if (N(a)) l.anchor.set(a.getKey(), i, "text"), l.focus.set(a.getKey(), i, "text");
601
618
  else {
602
619
  const u = a.getParentOrThrow().getKey(), d = a.getIndexWithinParent() + 1;
603
620
  l.anchor.set(u, d, "element"), l.focus.set(u, d, "element");
604
621
  }
605
- const c = pt(l);
606
- gt(c);
622
+ const c = _t(l);
623
+ Nt(c);
607
624
  }
608
- t.dispatchCommand(ye, n);
625
+ t.dispatchCommand(Te, n);
609
626
  }
610
627
  return e.preventDefault(), !0;
611
628
  }
612
- const r = p();
613
- return !!w(r);
614
- }, h), t.registerCommand(dt, (e) => {
615
- const [n] = z(e), r = p();
616
- return !(n && !w(r));
617
- }, h), t.registerCommand(ut, (e) => {
618
- const [n] = z(e), r = p();
619
- if (n && !w(r)) return !1;
620
- const o = ve(e.clientX, e.clientY);
621
- if (o !== null) {
622
- const s = G(o.node);
623
- F(s) && e.preventDefault();
629
+ const r = g();
630
+ return !!h(r);
631
+ }, y), t.registerCommand(xt, (e) => {
632
+ const [n] = Y(e), r = g();
633
+ return !(n && !h(r));
634
+ }, y), t.registerCommand(bt, (e) => {
635
+ const [n] = Y(e), r = g();
636
+ if (n && !h(r)) return !1;
637
+ const s = Le(e.clientX, e.clientY);
638
+ if (s !== null) {
639
+ const i = ee(s.node);
640
+ I(i) && e.preventDefault();
624
641
  }
625
642
  return !0;
626
- }, h), t.registerCommand(lt, () => (ct(), !0), h), t.registerCommand(_e, (e) => (he(t, O(e, ClipboardEvent) ? e : null), !0), h), t.registerCommand(at, (e) => (async function(n, r) {
627
- await he(r, O(n, ClipboardEvent) ? n : null), r.update(() => {
628
- const o = p();
629
- w(o) ? o.removeText() : L(o) && o.getNodes().forEach((s) => s.remove());
643
+ }, y), t.registerCommand(Ct, () => (Et(), !0), y), t.registerCommand(je, (e) => (De(t, R(e, ClipboardEvent) ? e : null), !0), y), t.registerCommand(wt, (e) => (async function(n, r) {
644
+ await De(r, R(n, ClipboardEvent) ? n : null), r.update(() => {
645
+ const s = g();
646
+ h(s) ? s.removeText() : F(s) && s.getNodes().forEach((i) => i.remove());
630
647
  });
631
- }(e, t), !0), h), t.registerCommand(it, (e) => {
632
- const [, n, r] = z(e);
633
- return n.length > 0 && !r ? (t.dispatchCommand(ye, n), !0) : st(e.target) ? !1 : p() !== null && (function(o, s) {
634
- o.preventDefault(), s.update(() => {
635
- const i = p(), a = O(o, InputEvent) || O(o, KeyboardEvent) ? null : o.clipboardData;
636
- a != null && i !== null && pe(a, i, s);
648
+ }(e, t), !0), y), t.registerCommand(Je, (e) => {
649
+ const [, n, r] = Y(e);
650
+ return n.length > 0 && !r ? (t.dispatchCommand(Te, n), !0) : yt(e.target) ? !1 : g() !== null && (function(s, i) {
651
+ s.preventDefault(), i.update(() => {
652
+ const o = g(), a = R(s, InputEvent) || R(s, KeyboardEvent) ? null : s.clipboardData;
653
+ a != null && o !== null && _e(a, o, i);
637
654
  }, { tag: "paste" });
638
655
  }(e, t), !0);
639
- }, h));
656
+ }, y));
640
657
  }
641
- const Q = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0 ? M : _;
642
- function Ee(t) {
643
- return t.getEditorState().read(Ae(t.isComposing()));
658
+ const ae = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0 ? z : k;
659
+ function Re(t) {
660
+ return t.getEditorState().read(Ye(t.isComposing()));
644
661
  }
645
- function bn({ contentEditable: t, placeholder: e = null, ErrorBoundary: n }) {
646
- const [r] = A(), o = function(s, i) {
647
- const [a, l] = I(() => s.getDecorators());
648
- return Q(() => s.registerDecoratorListener((c) => {
649
- de.flushSync(() => {
662
+ function Wn({ contentEditable: t, placeholder: e = null, ErrorBoundary: n }) {
663
+ const [r] = T(), s = function(i, o) {
664
+ const [a, l] = K(() => i.getDecorators());
665
+ return ae(() => i.registerDecoratorListener((c) => {
666
+ be.flushSync(() => {
650
667
  l(c);
651
668
  });
652
- }), [s]), _(() => {
653
- l(s.getDecorators());
654
- }, [s]), V(() => {
669
+ }), [i]), k(() => {
670
+ l(i.getDecorators());
671
+ }, [i]), W(() => {
655
672
  const c = [], u = Object.keys(a);
656
673
  for (let d = 0; d < u.length; d++) {
657
- const f = u[d], g = y(i, { onError: (v) => s._onError(v), children: y(At, { fallback: null, children: a[f] }) }), m = s.getElementByKey(f);
658
- m !== null && c.push(de.createPortal(g, m, f));
674
+ const f = u[d], p = E(o, { onError: (v) => i._onError(v), children: E(en, { fallback: null, children: a[f] }) }), m = i.getElementByKey(f);
675
+ m !== null && c.push(be.createPortal(p, m, f));
659
676
  }
660
677
  return c;
661
- }, [i, a, s]);
678
+ }, [o, a, i]);
662
679
  }(r, n);
663
- return function(s) {
664
- Q(() => q(En(s), rn(s)), [s]);
665
- }(r), J($e, { children: [t, y(xn, { content: e }), o] });
666
- }
667
- function xn({ content: t }) {
668
- const [e] = A(), n = function(o) {
669
- const [s, i] = I(() => Ee(o));
670
- return Q(() => {
680
+ return function(i) {
681
+ ae(() => U(Jn(i), Nn(i)), [i]);
682
+ }(r), Q(Ie, { children: [t, E(Vn, { content: e }), s] });
683
+ }
684
+ function Vn({ content: t }) {
685
+ const [e] = T(), n = function(s) {
686
+ const [i, o] = K(() => Re(s));
687
+ return ae(() => {
671
688
  function a() {
672
- const l = Ee(o);
673
- i(l);
689
+ const l = Re(s);
690
+ o(l);
674
691
  }
675
- return a(), q(o.registerUpdateListener(() => {
692
+ return a(), U(s.registerUpdateListener(() => {
676
693
  a();
677
- }), o.registerEditableListener(() => {
694
+ }), s.registerEditableListener(() => {
678
695
  a();
679
696
  }));
680
- }, [o]), s;
681
- }(e), r = Vt();
697
+ }, [s]), i;
698
+ }(e), r = hn();
682
699
  return n ? typeof t == "function" ? t(r) : t : null;
683
700
  }
684
- const We = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0 ? M : _;
685
- function $n({ editor: t, ariaActiveDescendant: e, ariaAutoComplete: n, ariaControls: r, ariaDescribedBy: o, ariaExpanded: s, ariaLabel: i, ariaLabelledBy: a, ariaMultiline: l, ariaOwns: c, ariaRequired: u, autoCapitalize: d, className: f, id: g, role: m = "textbox", spellCheck: v = !0, style: $, tabIndex: E, "data-testid": C, ...b }, N) {
686
- const [S, ne] = I(t.isEditable()), re = Mt((D) => {
687
- D && D.ownerDocument && D.ownerDocument.defaultView ? t.setRootElement(D) : t.setRootElement(null);
688
- }, [t]), Ve = V(() => /* @__PURE__ */ function(...D) {
689
- return (oe) => {
690
- D.forEach((K) => {
691
- typeof K == "function" ? K(oe) : K != null && (K.current = oe);
701
+ const it = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0 ? z : k;
702
+ function qn({ editor: t, ariaActiveDescendant: e, ariaAutoComplete: n, ariaControls: r, ariaDescribedBy: s, ariaExpanded: i, ariaLabel: o, ariaLabelledBy: a, ariaMultiline: l, ariaOwns: c, ariaRequired: u, autoCapitalize: d, className: f, id: p, role: m = "textbox", spellCheck: v = !0, style: b, tabIndex: w, "data-testid": C, ...x }, $) {
703
+ const [S, L] = K(t.isEditable()), M = tn((P) => {
704
+ P && P.ownerDocument && P.ownerDocument.defaultView ? t.setRootElement(P) : t.setRootElement(null);
705
+ }, [t]), j = W(() => /* @__PURE__ */ function(...P) {
706
+ return (pe) => {
707
+ P.forEach((V) => {
708
+ typeof V == "function" ? V(pe) : V != null && (V.current = pe);
692
709
  });
693
710
  };
694
- }(N, re), [re, N]);
695
- return We(() => (ne(t.isEditable()), t.registerEditableListener((D) => {
696
- ne(D);
697
- })), [t]), y("div", { ...b, "aria-activedescendant": S ? e : void 0, "aria-autocomplete": S ? n : "none", "aria-controls": S ? r : void 0, "aria-describedby": o, "aria-expanded": S && m === "combobox" ? !!s : void 0, "aria-label": i, "aria-labelledby": a, "aria-multiline": l, "aria-owns": S ? c : void 0, "aria-readonly": !S || void 0, "aria-required": u, autoCapitalize: d, className: f, contentEditable: S, "data-testid": C, id: g, ref: Ve, role: S ? m : void 0, spellCheck: v, style: $, tabIndex: E });
698
- }
699
- const Nn = Le($n);
700
- function be(t) {
701
- return t.getEditorState().read(Ae(t.isComposing()));
702
- }
703
- const Sn = Le(Dn);
704
- function Dn(t, e) {
705
- const { placeholder: n, ...r } = t, [o] = A();
706
- return J($e, { children: [y(Nn, { editor: o, ...r, ref: e }), n != null && y(Pn, { editor: o, content: n })] });
707
- }
708
- function Pn({ content: t, editor: e }) {
709
- const n = function(i) {
710
- const [a, l] = I(() => be(i));
711
- return We(() => {
711
+ }($, M), [M, $]);
712
+ return it(() => (L(t.isEditable()), t.registerEditableListener((P) => {
713
+ L(P);
714
+ })), [t]), E("div", { ...x, "aria-activedescendant": S ? e : void 0, "aria-autocomplete": S ? n : "none", "aria-controls": S ? r : void 0, "aria-describedby": s, "aria-expanded": S && m === "combobox" ? !!i : void 0, "aria-label": o, "aria-labelledby": a, "aria-multiline": l, "aria-owns": S ? c : void 0, "aria-readonly": !S || void 0, "aria-required": u, autoCapitalize: d, className: f, contentEditable: S, "data-testid": C, id: p, ref: j, role: S ? m : void 0, spellCheck: v, style: b, tabIndex: w });
715
+ }
716
+ const Hn = We(qn);
717
+ function Oe(t) {
718
+ return t.getEditorState().read(Ye(t.isComposing()));
719
+ }
720
+ const Xn = We(Yn);
721
+ function Yn(t, e) {
722
+ const { placeholder: n, ...r } = t, [s] = T();
723
+ return Q(Ie, { children: [E(Hn, { editor: s, ...r, ref: e }), n != null && E(Zn, { editor: s, content: n })] });
724
+ }
725
+ function Zn({ content: t, editor: e }) {
726
+ const n = function(o) {
727
+ const [a, l] = K(() => Oe(o));
728
+ return it(() => {
712
729
  function c() {
713
- const u = be(i);
730
+ const u = Oe(o);
714
731
  l(u);
715
732
  }
716
- return c(), q(i.registerUpdateListener(() => {
733
+ return c(), U(o.registerUpdateListener(() => {
717
734
  c();
718
- }), i.registerEditableListener(() => {
735
+ }), o.registerEditableListener(() => {
719
736
  c();
720
737
  }));
721
- }, [i]), a;
722
- }(e), [r, o] = I(e.isEditable());
723
- if (M(() => (o(e.isEditable()), e.registerEditableListener((i) => {
724
- o(i);
738
+ }, [o]), a;
739
+ }(e), [r, s] = K(e.isEditable());
740
+ if (z(() => (s(e.isEditable()), e.registerEditableListener((o) => {
741
+ s(o);
725
742
  })), [e]), !n) return null;
726
- let s = null;
727
- return typeof t == "function" ? s = t(r) : t !== null && (s = t), s === null ? null : y("div", { "aria-hidden": !0, children: s });
743
+ let i = null;
744
+ return typeof t == "function" ? i = t(r) : t !== null && (i = t), i === null ? null : E("div", { "aria-hidden": !0, children: i });
728
745
  }
729
- function ee(t, e) {
730
- return ee = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(n, r) {
746
+ function le(t, e) {
747
+ return le = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(n, r) {
731
748
  return n.__proto__ = r, n;
732
- }, ee(t, e);
749
+ }, le(t, e);
733
750
  }
734
- var xe = { error: null }, Tn = function(t) {
751
+ var Me = { error: null }, Gn = function(t) {
735
752
  var e, n;
736
753
  function r() {
737
- for (var s, i = arguments.length, a = new Array(i), l = 0; l < i; l++) a[l] = arguments[l];
738
- return (s = t.call.apply(t, [this].concat(a)) || this).state = xe, s.resetErrorBoundary = function() {
754
+ for (var i, o = arguments.length, a = new Array(o), l = 0; l < o; l++) a[l] = arguments[l];
755
+ return (i = t.call.apply(t, [this].concat(a)) || this).state = Me, i.resetErrorBoundary = function() {
739
756
  for (var c, u = arguments.length, d = new Array(u), f = 0; f < u; f++) d[f] = arguments[f];
740
- s.props.onReset == null || (c = s.props).onReset.apply(c, d), s.reset();
741
- }, s;
757
+ i.props.onReset == null || (c = i.props).onReset.apply(c, d), i.reset();
758
+ }, i;
742
759
  }
743
- n = t, (e = r).prototype = Object.create(n.prototype), e.prototype.constructor = e, ee(e, n), r.getDerivedStateFromError = function(s) {
744
- return { error: s };
760
+ n = t, (e = r).prototype = Object.create(n.prototype), e.prototype.constructor = e, le(e, n), r.getDerivedStateFromError = function(i) {
761
+ return { error: i };
745
762
  };
746
- var o = r.prototype;
747
- return o.reset = function() {
748
- this.setState(xe);
749
- }, o.componentDidCatch = function(s, i) {
763
+ var s = r.prototype;
764
+ return s.reset = function() {
765
+ this.setState(Me);
766
+ }, s.componentDidCatch = function(i, o) {
750
767
  var a, l;
751
- (a = (l = this.props).onError) == null || a.call(l, s, i);
752
- }, o.componentDidUpdate = function(s, i) {
768
+ (a = (l = this.props).onError) == null || a.call(l, i, o);
769
+ }, s.componentDidUpdate = function(i, o) {
753
770
  var a, l, c, u, d = this.state.error, f = this.props.resetKeys;
754
- d !== null && i.error !== null && ((c = s.resetKeys) === void 0 && (c = []), (u = f) === void 0 && (u = []), c.length !== u.length || c.some(function(g, m) {
755
- return !Object.is(g, u[m]);
756
- })) && ((a = (l = this.props).onResetKeysChange) == null || a.call(l, s.resetKeys, f), this.reset());
757
- }, o.render = function() {
758
- var s = this.state.error, i = this.props, a = i.fallbackRender, l = i.FallbackComponent, c = i.fallback;
759
- if (s !== null) {
760
- var u = { error: s, resetErrorBoundary: this.resetErrorBoundary };
761
- if (X.isValidElement(c)) return c;
771
+ d !== null && o.error !== null && ((c = i.resetKeys) === void 0 && (c = []), (u = f) === void 0 && (u = []), c.length !== u.length || c.some(function(p, m) {
772
+ return !Object.is(p, u[m]);
773
+ })) && ((a = (l = this.props).onResetKeysChange) == null || a.call(l, i.resetKeys, f), this.reset());
774
+ }, s.render = function() {
775
+ var i = this.state.error, o = this.props, a = o.fallbackRender, l = o.FallbackComponent, c = o.fallback;
776
+ if (i !== null) {
777
+ var u = { error: i, resetErrorBoundary: this.resetErrorBoundary };
778
+ if (re.isValidElement(c)) return c;
762
779
  if (typeof a == "function") return a(u);
763
- if (l) return X.createElement(l, u);
780
+ if (l) return re.createElement(l, u);
764
781
  throw new Error("react-error-boundary requires either a fallback, fallbackRender, or FallbackComponent prop");
765
782
  }
766
783
  return this.props.children;
767
784
  }, r;
768
- }(X.Component);
769
- function _n({ children: t, onError: e }) {
770
- return y(Tn, { fallback: y("div", { style: { border: "1px solid #f00", color: "#f00", padding: "8px" }, children: "An error was thrown." }), onError: e, children: t });
771
- }
772
- const Ln = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0 ? M : _;
773
- function On({ ignoreHistoryMergeTagChange: t = !0, ignoreSelectionChange: e = !1, onChange: n }) {
774
- const [r] = A();
775
- return Ln(() => {
776
- if (n) return r.registerUpdateListener(({ editorState: o, dirtyElements: s, dirtyLeaves: i, prevEditorState: a, tags: l }) => {
777
- e && s.size === 0 && i.size === 0 || t && l.has("history-merge") || a.isEmpty() || n(o, r, l);
785
+ }(re.Component);
786
+ function Qn({ children: t, onError: e }) {
787
+ return E(Gn, { fallback: E("div", { style: { border: "1px solid #f00", color: "#f00", padding: "8px" }, children: "An error was thrown." }), onError: e, children: t });
788
+ }
789
+ const er = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0 ? z : k;
790
+ function tr({ ignoreHistoryMergeTagChange: t = !0, ignoreSelectionChange: e = !1, onChange: n }) {
791
+ const [r] = T();
792
+ return er(() => {
793
+ if (n) return r.registerUpdateListener(({ editorState: s, dirtyElements: i, dirtyLeaves: o, prevEditorState: a, tags: l }) => {
794
+ e && i.size === 0 && o.size === 0 || t && l.has("history-merge") || a.isEmpty() || n(s, r, l);
778
795
  });
779
796
  }, [r, t, e, n]), null;
780
797
  }
781
- function Rn() {
782
- const [t] = A();
783
- return _(() => {
784
- if (!t.hasNodes([Re, Fe])) throw new Error("ListPlugin: ListNode and/or ListItemNode not registered on editor");
798
+ function nr() {
799
+ const [t] = T();
800
+ return k(() => {
801
+ if (!t.hasNodes([Ve, qe])) throw new Error("ListPlugin: ListNode and/or ListItemNode not registered on editor");
785
802
  }, [t]), function(e) {
786
- _(() => Kt(e), [e]);
803
+ k(() => rn(e), [e]);
787
804
  }(t), null;
788
805
  }
789
- const zn = ({
806
+ function rr({ validateUrl: t }) {
807
+ const [e] = T();
808
+ return k(() => {
809
+ if (!e.hasNodes([He])) throw new Error("LinkPlugin: LinkNode not registered on editor");
810
+ return U(e.registerCommand(xe, (n) => {
811
+ if (n === null) return oe(n), !0;
812
+ if (typeof n == "string") return !(t !== void 0 && !t(n)) && (oe(n), !0);
813
+ {
814
+ const { url: r, target: s, rel: i, title: o } = n;
815
+ return oe(r, { rel: i, target: s, title: o }), !0;
816
+ }
817
+ }, Ee), t !== void 0 ? e.registerCommand(Je, (n) => {
818
+ const r = g();
819
+ if (!h(r) || r.isCollapsed() || !R(n, ClipboardEvent)) return !1;
820
+ const s = n;
821
+ if (s.clipboardData === null) return !1;
822
+ const i = s.clipboardData.getData("text");
823
+ return !!t(i) && !r.getNodes().some((o) => _(o)) && (e.dispatchCommand(xe, i), n.preventDefault(), !0);
824
+ }, Ee) : () => {
825
+ });
826
+ }, [e, t]), null;
827
+ }
828
+ function or({ newTab: t = !0, disabled: e = !1 }) {
829
+ const [n] = T();
830
+ return k(() => {
831
+ const r = (i) => {
832
+ const o = i.target;
833
+ if (!(o instanceof Node)) return;
834
+ const a = qt(o);
835
+ if (a === null) return;
836
+ let l = null, c = null;
837
+ if (a.update(() => {
838
+ const f = ee(o);
839
+ if (f !== null) {
840
+ const p = me(f, _);
841
+ if (!e) if (on(p)) l = p.sanitizeUrl(p.getURL()), c = p.getTarget();
842
+ else {
843
+ const m = function(v, b) {
844
+ let w = v;
845
+ for (; w != null; ) {
846
+ if (b(w)) return w;
847
+ w = w.parentNode;
848
+ }
849
+ return null;
850
+ }(o, Ht);
851
+ m !== null && (l = m.href, c = m.target);
852
+ }
853
+ }
854
+ }), l === null || l === "") return;
855
+ const u = n.getEditorState().read(g);
856
+ if (h(u) && !u.isCollapsed()) return void i.preventDefault();
857
+ const d = i.type === "auxclick" && i.button === 1;
858
+ window.open(l, t || d || i.metaKey || i.ctrlKey || c === "_blank" ? "_blank" : "_self"), i.preventDefault();
859
+ }, s = (i) => {
860
+ i.button === 1 && r(i);
861
+ };
862
+ return n.registerRootListener((i, o) => {
863
+ o !== null && (o.removeEventListener("click", r), o.removeEventListener("mouseup", s)), i !== null && (i.addEventListener("click", r), i.addEventListener("mouseup", s));
864
+ });
865
+ }, [n, t, e]), null;
866
+ }
867
+ const G = 0, ce = 1, ue = 2, D = 0, ir = 1, Fe = 2, sr = 3, ar = 4;
868
+ function lr(t, e, n, r, s) {
869
+ if (t === null || n.size === 0 && r.size === 0 && !s) return D;
870
+ const i = e._selection, o = t._selection;
871
+ if (s) return ir;
872
+ if (!(h(i) && h(o) && o.isCollapsed() && i.isCollapsed())) return D;
873
+ const a = function(w, C, x) {
874
+ const $ = w._nodeMap, S = [];
875
+ for (const L of C) {
876
+ const M = $.get(L);
877
+ M !== void 0 && S.push(M);
878
+ }
879
+ for (const [L, M] of x) {
880
+ if (!M) continue;
881
+ const j = $.get(L);
882
+ j === void 0 || fe(j) || S.push(j);
883
+ }
884
+ return S;
885
+ }(e, n, r);
886
+ if (a.length === 0) return D;
887
+ if (a.length > 1) {
888
+ const w = e._nodeMap, C = w.get(i.anchor.key), x = w.get(o.anchor.key);
889
+ return C && x && !t._nodeMap.has(C.__key) && N(C) && C.__text.length === 1 && i.anchor.offset === 1 ? Fe : D;
890
+ }
891
+ const l = a[0], c = t._nodeMap.get(l.__key);
892
+ if (!N(c) || !N(l) || c.__mode !== l.__mode) return D;
893
+ const u = c.__text, d = l.__text;
894
+ if (u === d) return D;
895
+ const f = i.anchor, p = o.anchor;
896
+ if (f.key !== p.key || f.type !== "text") return D;
897
+ const m = f.offset, v = p.offset, b = d.length - u.length;
898
+ return b === 1 && v === m - 1 ? Fe : b === -1 && v === m + 1 ? sr : b === -1 && v === m ? ar : D;
899
+ }
900
+ function cr(t, e) {
901
+ let n = Date.now(), r = D;
902
+ return (s, i, o, a, l, c) => {
903
+ const u = Date.now();
904
+ if (c.has("historic")) return r = D, n = u, ue;
905
+ const d = lr(s, i, a, l, t.isComposing()), f = (() => {
906
+ const p = o === null || o.editor === t, m = c.has("history-push");
907
+ if (!m && p && c.has("history-merge")) return G;
908
+ if (s === null) return ce;
909
+ const v = i._selection;
910
+ return a.size > 0 || l.size > 0 ? m === !1 && d !== D && d === r && u < n + e && p || a.size === 1 && function(b, w, C) {
911
+ const x = w._nodeMap.get(b), $ = C._nodeMap.get(b), S = w._selection, L = C._selection;
912
+ return !(h(S) && h(L) && S.anchor.type === "element" && S.focus.type === "element" && L.anchor.type === "text" && L.focus.type === "text" || !N(x) || !N($) || x.__parent !== $.__parent) && JSON.stringify(w.read(() => x.exportJSON())) === JSON.stringify(C.read(() => $.exportJSON()));
913
+ }(Array.from(a)[0], s, i) ? G : ce : v !== null ? G : ue;
914
+ })();
915
+ return n = u, r = d, f;
916
+ };
917
+ }
918
+ function Ae(t) {
919
+ t.undoStack = [], t.redoStack = [], t.current = null;
920
+ }
921
+ function ur(t, e, n) {
922
+ const r = cr(t, n);
923
+ return U(t.registerCommand(Gt, () => (function(i, o) {
924
+ const a = o.redoStack, l = o.undoStack;
925
+ if (l.length !== 0) {
926
+ const c = o.current, u = l.pop();
927
+ c !== null && (a.push(c), i.dispatchCommand(q, !0)), l.length === 0 && i.dispatchCommand(H, !1), o.current = u || null, u && u.editor.setEditorState(u.editorState, { tag: "historic" });
928
+ }
929
+ }(t, e), !0), y), t.registerCommand(Zt, () => (function(i, o) {
930
+ const a = o.redoStack, l = o.undoStack;
931
+ if (a.length !== 0) {
932
+ const c = o.current;
933
+ c !== null && (l.push(c), i.dispatchCommand(H, !0));
934
+ const u = a.pop();
935
+ a.length === 0 && i.dispatchCommand(q, !1), o.current = u || null, u && u.editor.setEditorState(u.editorState, { tag: "historic" });
936
+ }
937
+ }(t, e), !0), y), t.registerCommand(Yt, () => (Ae(e), !1), y), t.registerCommand(Xt, () => (Ae(e), t.dispatchCommand(q, !1), t.dispatchCommand(H, !1), !0), y), t.registerUpdateListener(({ editorState: i, prevEditorState: o, dirtyLeaves: a, dirtyElements: l, tags: c }) => {
938
+ const u = e.current, d = e.redoStack, f = e.undoStack, p = u === null ? null : u.editorState;
939
+ if (u !== null && i === p) return;
940
+ const m = r(o, i, u, a, l, c);
941
+ if (m === ce) d.length !== 0 && (e.redoStack = [], t.dispatchCommand(q, !1)), u !== null && (f.push({ ...u }), t.dispatchCommand(H, !0));
942
+ else if (m === ue) return;
943
+ e.current = { editor: t, editorState: i };
944
+ }));
945
+ }
946
+ function dr() {
947
+ return { current: null, redoStack: [], undoStack: [] };
948
+ }
949
+ function fr({ delay: t, externalHistoryState: e }) {
950
+ const [n] = T();
951
+ return function(r, s, i = 1e3) {
952
+ const o = W(() => s || dr(), [s]);
953
+ k(() => ur(r, o, i), [i, r, o]);
954
+ }(n, e, t), null;
955
+ }
956
+ const Ir = ({
790
957
  namespace: t = "UvaEditor",
791
958
  initialValue: e = "",
792
959
  placeholder: n = "",
793
960
  onChange: r
794
961
  }) => {
795
- const o = {
962
+ const s = {
796
963
  namespace: t,
797
- theme: jt,
798
- onError(i) {
799
- throw i;
964
+ theme: dn,
965
+ onError(o) {
966
+ throw o;
800
967
  },
801
- nodes: [Re, Fe],
802
- editorState: (i) => {
803
- const l = new DOMParser().parseFromString(e, "text/html"), c = ke(i, l), u = P();
968
+ nodes: [Ve, qe, He, cn],
969
+ editorState: (o) => {
970
+ const l = new DOMParser().parseFromString(e, "text/html"), c = Ge(o, l), u = O();
804
971
  u.clear();
805
- const d = te();
972
+ const d = de();
806
973
  c.forEach((f) => d.append(f)), u.append(d);
807
974
  }
808
- }, s = (i, a) => {
809
- i.read(() => {
810
- const l = Ke(a);
975
+ }, i = (o, a) => {
976
+ o.read(() => {
977
+ const l = Qe(a);
811
978
  r(l);
812
979
  });
813
980
  };
814
- return /* @__PURE__ */ y("div", { className: B.editor__wrapper, children: /* @__PURE__ */ J(Ut, { initialConfig: o, children: [
815
- /* @__PURE__ */ y(Bt, {}),
816
- /* @__PURE__ */ J("div", { className: B["editor__field-wrapper"], children: [
817
- /* @__PURE__ */ y(
818
- bn,
981
+ return /* @__PURE__ */ E("div", { className: J.editor__wrapper, children: /* @__PURE__ */ Q(mn, { initialConfig: s, children: [
982
+ /* @__PURE__ */ E(un, {}),
983
+ /* @__PURE__ */ Q("div", { className: J["editor__field-wrapper"], children: [
984
+ /* @__PURE__ */ E(
985
+ Wn,
819
986
  {
820
- contentEditable: /* @__PURE__ */ y(Sn, { className: B.editor__field }),
821
- placeholder: /* @__PURE__ */ y("div", { className: B.editor__placeholder, children: n }),
822
- ErrorBoundary: _n
987
+ contentEditable: /* @__PURE__ */ E(
988
+ Xn,
989
+ {
990
+ className: J.editor__field,
991
+ "aria-label": "Rich text editor content",
992
+ "aria-placeholder": n,
993
+ title: "Rich text editor content",
994
+ placeholder: /* @__PURE__ */ E("div", { className: J.editor__placeholder, children: n })
995
+ }
996
+ ),
997
+ placeholder: /* @__PURE__ */ E("div", { className: J.editor__placeholder, children: n }),
998
+ ErrorBoundary: Qn
823
999
  }
824
1000
  ),
825
- /* @__PURE__ */ y(Rn, {}),
826
- /* @__PURE__ */ y(On, { onChange: s })
1001
+ /* @__PURE__ */ E(fr, {}),
1002
+ /* @__PURE__ */ E(nr, {}),
1003
+ /* @__PURE__ */ E(rr, { validateUrl: sn }),
1004
+ /* @__PURE__ */ E(an, { matchers: ln }),
1005
+ /* @__PURE__ */ E(or, {}),
1006
+ /* @__PURE__ */ E(tr, { onChange: i })
827
1007
  ] })
828
1008
  ] }) });
829
1009
  };
830
1010
  export {
831
- zn as RteEditor
1011
+ Ir as RteEditor
832
1012
  };
833
1013
  //# sourceMappingURL=RteEditor.js.map