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