sykpcomposer 0.0.384 → 0.0.386

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 (118) hide show
  1. package/dist/ImageComponent-3ea88307.js +975 -0
  2. package/dist/ImageComponent-3ea88307.js.map +1 -0
  3. package/dist/InlineImageComponent-5dd3db9b.js +535 -0
  4. package/dist/InlineImageComponent-5dd3db9b.js.map +1 -0
  5. package/dist/LexicalNestedComposer.esm-e4c542f3.js +109 -0
  6. package/dist/LexicalNestedComposer.esm-e4c542f3.js.map +1 -0
  7. package/dist/PollComponent-83646e23.js +169 -0
  8. package/dist/PollComponent-83646e23.js.map +1 -0
  9. package/dist/emoji-list-48028e71.js +16606 -0
  10. package/dist/emoji-list-48028e71.js.map +1 -0
  11. package/dist/index-095d8c6f.js +67324 -0
  12. package/dist/index-095d8c6f.js.map +1 -0
  13. package/dist/index.d.ts +1 -0
  14. package/dist/index.es.js +7 -0
  15. package/dist/index.es.js.map +1 -0
  16. package/dist/index.html +36 -7
  17. package/dist/index.umd.js +1497 -0
  18. package/dist/index.umd.js.map +1 -0
  19. package/dist/src/lexical/Editor.d.ts +6 -0
  20. package/dist/src/lexical/appSettings.d.ts +27 -0
  21. package/dist/src/lexical/codoxCollab.d.ts +1 -0
  22. package/dist/src/lexical/commenting/index.d.ts +48 -0
  23. package/dist/src/lexical/context/SettingsContext.d.ts +18 -0
  24. package/dist/src/lexical/context/SharedAutocompleteContext.d.ts +16 -0
  25. package/dist/src/lexical/context/SharedHistoryContext.d.ts +17 -0
  26. package/dist/src/lexical/hooks/useModal.d.ts +12 -0
  27. package/dist/src/lexical/http.d.ts +13 -0
  28. package/dist/src/lexical/nodes/AutocompleteNode.d.ts +32 -0
  29. package/dist/src/lexical/nodes/EmojiNode.d.ts +25 -0
  30. package/dist/src/lexical/nodes/FigmaNode.d.ts +27 -0
  31. package/dist/src/lexical/nodes/ImageComponent.d.ts +22 -0
  32. package/dist/src/lexical/nodes/ImageNode.d.ts +56 -0
  33. package/dist/src/lexical/nodes/InlineImageComponent.d.ts +25 -0
  34. package/dist/src/lexical/nodes/InlineImageNode.d.ts +65 -0
  35. package/dist/src/lexical/nodes/KeywordNode.d.ts +22 -0
  36. package/dist/src/lexical/nodes/LayoutContainerNode.d.ts +30 -0
  37. package/dist/src/lexical/nodes/LayoutItemNode.d.ts +22 -0
  38. package/dist/src/lexical/nodes/MentionNode.d.ts +28 -0
  39. package/dist/src/lexical/nodes/PageBreakNode/index.d.ts +24 -0
  40. package/dist/src/lexical/nodes/PlaygroundNodes.d.ts +10 -0
  41. package/dist/src/lexical/nodes/PollComponent.d.ts +15 -0
  42. package/dist/src/lexical/nodes/PollNode.d.ts +40 -0
  43. package/dist/src/lexical/nodes/TweetNode.d.ts +28 -0
  44. package/dist/src/lexical/nodes/YouTubeNode.d.ts +29 -0
  45. package/dist/src/lexical/plugins/AutoEmbedPlugin/index.d.ts +26 -0
  46. package/dist/src/lexical/plugins/AutoLinkPlugin/index.d.ts +9 -0
  47. package/dist/src/lexical/plugins/AutocompletePlugin/index.d.ts +10 -0
  48. package/dist/src/lexical/plugins/CollapsiblePlugin/CollapsibleContainerNode.d.ts +30 -0
  49. package/dist/src/lexical/plugins/CollapsiblePlugin/CollapsibleContentNode.d.ts +24 -0
  50. package/dist/src/lexical/plugins/CollapsiblePlugin/CollapsibleTitleNode.d.ts +25 -0
  51. package/dist/src/lexical/plugins/CollapsiblePlugin/index.d.ts +10 -0
  52. package/dist/src/lexical/plugins/CommentPlugin/index.d.ts +15 -0
  53. package/dist/src/lexical/plugins/DragDropPastePlugin/index.d.ts +8 -0
  54. package/dist/src/lexical/plugins/DraggableBlockPlugin/index.d.ts +11 -0
  55. package/dist/src/lexical/plugins/EmojiPickerPlugin/index.d.ts +8 -0
  56. package/dist/src/lexical/plugins/EmojisPlugin/index.d.ts +9 -0
  57. package/dist/src/lexical/plugins/FigmaPlugin/index.d.ts +11 -0
  58. package/dist/src/lexical/plugins/FloatingLinkEditorPlugin/index.d.ts +13 -0
  59. package/dist/src/lexical/plugins/FloatingTextFormatToolbarPlugin/index.d.ts +11 -0
  60. package/dist/src/lexical/plugins/ImagesPlugin/index.d.ts +24 -0
  61. package/dist/src/lexical/plugins/InlineImagePlugin/index.d.ts +16 -0
  62. package/dist/src/lexical/plugins/KeywordsPlugin/index.d.ts +9 -0
  63. package/dist/src/lexical/plugins/LayoutPlugin/InsertLayoutDialog.d.ts +13 -0
  64. package/dist/src/lexical/plugins/LayoutPlugin/LayoutPlugin.d.ts +14 -0
  65. package/dist/src/lexical/plugins/LinkPlugin/index.d.ts +9 -0
  66. package/dist/src/lexical/plugins/ListMaxIndentLevelPlugin/index.d.ts +12 -0
  67. package/dist/src/lexical/plugins/MentionsPlugin/index.d.ts +9 -0
  68. package/dist/src/lexical/plugins/PageBreakPlugin/index.d.ts +4 -0
  69. package/dist/src/lexical/plugins/PollPlugin/index.d.ts +15 -0
  70. package/dist/src/lexical/plugins/TabFocusPlugin/index.d.ts +8 -0
  71. package/dist/src/lexical/plugins/TableActionMenuPlugin/index.d.ts +12 -0
  72. package/dist/src/lexical/plugins/TableCellResizer/index.d.ts +2 -0
  73. package/dist/src/lexical/plugins/TablePlugin.d.ts +39 -0
  74. package/dist/src/lexical/plugins/ToolbarPlugin/fontSize.d.ts +13 -0
  75. package/dist/src/lexical/plugins/ToolbarPlugin/index.d.ts +12 -0
  76. package/dist/src/lexical/plugins/TreeViewPlugin/index.d.ts +9 -0
  77. package/dist/src/lexical/plugins/TwitterPlugin/index.d.ts +11 -0
  78. package/dist/src/lexical/plugins/YouTubePlugin/index.d.ts +11 -0
  79. package/dist/src/lexical/themes/CommentEditorTheme.d.ts +10 -0
  80. package/dist/src/lexical/themes/PlaygroundEditorTheme.d.ts +10 -0
  81. package/dist/src/lexical/ui/Button.d.ts +17 -0
  82. package/dist/src/lexical/ui/ColorPicker.d.ts +19 -0
  83. package/dist/src/lexical/ui/ContentEditable.d.ts +11 -0
  84. package/dist/src/lexical/ui/Dialog.d.ts +15 -0
  85. package/dist/src/lexical/ui/DropDown.d.ts +24 -0
  86. package/dist/src/lexical/ui/DropdownColorPicker.d.ts +20 -0
  87. package/dist/src/lexical/ui/FileInput.d.ts +16 -0
  88. package/dist/src/lexical/ui/ImageResizer.d.ts +24 -0
  89. package/dist/src/lexical/ui/Modal.d.ts +14 -0
  90. package/dist/src/lexical/ui/Placeholder.d.ts +12 -0
  91. package/dist/src/lexical/ui/Select.d.ts +14 -0
  92. package/dist/src/lexical/ui/TextInput.d.ts +18 -0
  93. package/dist/src/lexical/utils/canUseDOM.d.ts +8 -0
  94. package/dist/src/lexical/utils/emoji-list.d.ts +27 -0
  95. package/dist/src/lexical/utils/environment.d.ts +24 -0
  96. package/dist/src/lexical/utils/getDOMRangeRect.d.ts +8 -0
  97. package/dist/src/lexical/utils/getSelectedNode.d.ts +2 -0
  98. package/dist/src/lexical/utils/guard.d.ts +8 -0
  99. package/dist/src/lexical/utils/invariant.d.ts +8 -0
  100. package/dist/src/lexical/utils/joinClasses.d.ts +8 -0
  101. package/dist/src/lexical/utils/point.d.ts +21 -0
  102. package/dist/src/lexical/utils/rect.d.ts +45 -0
  103. package/dist/src/lexical/utils/setFloatingElemPosition.d.ts +1 -0
  104. package/dist/src/lexical/utils/setFloatingElemPositionForLinkEditor.d.ts +1 -0
  105. package/dist/src/lexical/utils/swipe.d.ts +11 -0
  106. package/dist/src/lexical/utils/url.d.ts +9 -0
  107. package/dist/style.css +1 -0
  108. package/package.json +3 -3
  109. package/dist/assets/ImageComponent-DncIDz48.js +0 -23
  110. package/dist/assets/ImageComponent-NSP6xs1B.css +0 -1
  111. package/dist/assets/InlineImageComponent-BefYBd1k.js +0 -1
  112. package/dist/assets/InlineImageComponent-BnmVdNhp.css +0 -1
  113. package/dist/assets/LexicalNestedComposer.prod-BGbK0rVf.js +0 -1
  114. package/dist/assets/PollComponent-Brv_H-Vr.js +0 -1
  115. package/dist/assets/PollComponent-CymKlNoB.css +0 -1
  116. package/dist/assets/emoji-list-D_N31RbD.js +0 -1
  117. package/dist/assets/index-BR8wqG2P.js +0 -1441
  118. package/dist/assets/index-CDE-KF5Y.css +0 -1
@@ -0,0 +1,975 @@
1
+ import { m as ce, C as Se, $ as Ne, a as V, b as be, c as J, d as xe, e as te, f as U, g as Te, h as ee, i as we, u as Le, j as T, k as Ie, l as Ae, n as oe, o as se, p as fe, S as ze, q as Y, r as Oe, D as Be, K as He, s as Fe, t as Ke, v as We, w as Ue, A as Ye, N as Ge, L as Ve, E as Xe, H as qe, x as Je, R as Qe, y as Ze, P as et, z as tt, B as nt } from "./index-095d8c6f.js";
2
+ import { L as rt } from "./LexicalNestedComposer.esm-e4c542f3.js";
3
+ import * as k from "react";
4
+ import { createContext as ot, useContext as st, useState as A, useRef as O, useCallback as G, useEffect as H, useMemo as $e, Suspense as it } from "react";
5
+ import "react-dom";
6
+ const de = window.location.hostname, lt = de !== "playground.lexical.dev" && de !== "lexical-playground.vercel.app", at = {
7
+ disableBeforeInput: !1,
8
+ emptyEditor: lt,
9
+ isAutocomplete: !1,
10
+ isCharLimit: !1,
11
+ isCharLimitUtf8: !1,
12
+ isCollab: !1,
13
+ isMaxLength: !1,
14
+ isRichText: !0,
15
+ measureTypingPerf: !1,
16
+ shouldUseLexicalContextMenu: !1,
17
+ showNestedEditorTreeView: !1,
18
+ showTableOfContents: !1,
19
+ showTreeView: !0,
20
+ tableCellBackgroundColor: !0,
21
+ tableCellMerge: !0
22
+ }, ct = ot({
23
+ setOption: (e, t) => {
24
+ },
25
+ settings: at
26
+ }), ut = () => st(ct), je = Object.freeze({
27
+ " ": "\\t",
28
+ "\n": "\\n"
29
+ }), me = new RegExp(Object.keys(je).join("|"), "g"), W = Object.freeze({
30
+ ancestorHasNextSibling: "|",
31
+ ancestorIsLastChild: " ",
32
+ hasNextSibling: "├",
33
+ isLastChild: "└",
34
+ selectedChar: "^",
35
+ selectedLine: ">"
36
+ });
37
+ function ft({
38
+ treeTypeButtonClassName: e,
39
+ timeTravelButtonClassName: t,
40
+ timeTravelPanelSliderClassName: r,
41
+ timeTravelPanelButtonClassName: a,
42
+ viewClassName: c,
43
+ timeTravelPanelClassName: u,
44
+ editor: o
45
+ }) {
46
+ const [s, v] = A([]), [d, l] = A(""), [m, h] = A(!1), [g, I] = A(!1), E = O(0), L = O(null), p = O(null), [R, _] = A(!1), [S, B] = A(!1), [i, N] = A(!1), f = O(null), w = dt(o), D = G((n) => {
47
+ const b = ie(o, w, g);
48
+ l(b), m || v(($) => [...$, [Date.now(), n]]);
49
+ }, [w, o, m, g]);
50
+ H(() => {
51
+ const n = o.getEditorState();
52
+ !i && n._nodeMap.size < 1e3 && l(ie(o, w, g));
53
+ }, [w, o, i, g]), H(() => ce(o.registerUpdateListener(({
54
+ editorState: n
55
+ }) => {
56
+ !i && n._nodeMap.size > 1e3 && (f.current = n, B(!0), !i) || D(n);
57
+ }), o.registerEditableListener(() => {
58
+ const n = ie(o, w, g);
59
+ l(n);
60
+ })), [w, o, g, S, D, i]);
61
+ const y = s.length;
62
+ return H(() => {
63
+ if (R) {
64
+ let n;
65
+ const b = () => {
66
+ const $ = E.current;
67
+ if ($ === y - 1) {
68
+ _(!1);
69
+ return;
70
+ }
71
+ const z = s[$][0], x = s[$ + 1][0] - z;
72
+ n = setTimeout(() => {
73
+ E.current++;
74
+ const P = E.current, M = p.current;
75
+ M !== null && (M.value = String(P)), o.setEditorState(s[P][1]), b();
76
+ }, x);
77
+ };
78
+ return b(), () => {
79
+ clearTimeout(n);
80
+ };
81
+ }
82
+ }, [s, R, o, y]), H(() => {
83
+ const n = L.current;
84
+ if (n !== null)
85
+ return n.__lexicalEditor = o, () => {
86
+ n.__lexicalEditor = null;
87
+ };
88
+ }, [o]), /* @__PURE__ */ k.createElement("div", {
89
+ className: c
90
+ }, !i && S ? /* @__PURE__ */ k.createElement("div", {
91
+ style: {
92
+ padding: 20
93
+ }
94
+ }, /* @__PURE__ */ k.createElement("span", {
95
+ style: {
96
+ marginRight: 20
97
+ }
98
+ }, "Detected large EditorState, this can impact debugging performance."), /* @__PURE__ */ k.createElement("button", {
99
+ onClick: () => {
100
+ N(!0);
101
+ const n = f.current;
102
+ n !== null && (f.current = null, D(n));
103
+ },
104
+ style: {
105
+ background: "transparent",
106
+ border: "1px solid white",
107
+ color: "white",
108
+ cursor: "pointer",
109
+ padding: 5
110
+ }
111
+ }, "Show full tree")) : null, i ? null : /* @__PURE__ */ k.createElement("button", {
112
+ onClick: () => I(!g),
113
+ className: e,
114
+ type: "button"
115
+ }, g ? "Tree" : "Export DOM"), !m && (i || !S) && y > 2 && /* @__PURE__ */ k.createElement("button", {
116
+ onClick: () => {
117
+ const n = o.getRootElement();
118
+ n !== null && (n.contentEditable = "false", E.current = y - 1, h(!0));
119
+ },
120
+ className: t,
121
+ type: "button"
122
+ }, "Time Travel"), (i || !S) && /* @__PURE__ */ k.createElement("pre", {
123
+ ref: L
124
+ }, d), m && (i || !S) && /* @__PURE__ */ k.createElement("div", {
125
+ className: u
126
+ }, /* @__PURE__ */ k.createElement("button", {
127
+ className: a,
128
+ onClick: () => {
129
+ E.current === y - 1 && (E.current = 1), _(!R);
130
+ },
131
+ type: "button"
132
+ }, R ? "Pause" : "Play"), /* @__PURE__ */ k.createElement("input", {
133
+ className: r,
134
+ ref: p,
135
+ onChange: (n) => {
136
+ const b = Number(n.target.value), $ = s[b];
137
+ $ && (E.current = b, o.setEditorState($[1]));
138
+ },
139
+ type: "range",
140
+ min: "1",
141
+ max: y - 1
142
+ }), /* @__PURE__ */ k.createElement("button", {
143
+ className: a,
144
+ onClick: () => {
145
+ const n = o.getRootElement();
146
+ if (n !== null) {
147
+ n.contentEditable = "true";
148
+ const b = s.length - 1, $ = s[b];
149
+ o.setEditorState($[1]);
150
+ const z = p.current;
151
+ z !== null && (z.value = String(b)), h(!1), _(!1);
152
+ }
153
+ },
154
+ type: "button"
155
+ }, "Exit")));
156
+ }
157
+ function dt(e) {
158
+ const [t, r] = A([]);
159
+ return H(() => {
160
+ const a = /* @__PURE__ */ new Set();
161
+ for (const [c] of e._commands)
162
+ a.add(e.registerCommand(c, (u) => (r((o) => {
163
+ const s = [...o];
164
+ return s.push({
165
+ payload: u,
166
+ type: c.type ? c.type : "UNKNOWN"
167
+ }), s.length > 10 && s.shift(), s;
168
+ }), !1), Se));
169
+ return () => a.forEach((c) => c());
170
+ }, [e]), $e(() => t, [t]);
171
+ }
172
+ function mt(e) {
173
+ let t = "";
174
+ const r = _e(e);
175
+ t += `: range ${r !== "" ? `{ ${r} }` : ""} ${e.style !== "" ? `{ style: ${e.style} } ` : ""}`;
176
+ const a = e.anchor, c = e.focus, u = a.offset, o = c.offset;
177
+ return t += `
178
+ ├ anchor { key: ${a.key}, offset: ${u === null ? "null" : u}, type: ${a.type} }`, t += `
179
+ └ focus { key: ${c.key}, offset: ${o === null ? "null" : o}, type: ${c.type} }`, t;
180
+ }
181
+ function gt(e) {
182
+ return U(e) ? `: node
183
+ └ [${Array.from(e._nodes).join(", ")}]` : "";
184
+ }
185
+ function ht(e) {
186
+ return `: table
187
+ └ { table: ${e.tableKey}, anchorCell: ${e.anchor.key}, focusCell: ${e.focus.key} }`;
188
+ }
189
+ function ie(e, t, r) {
190
+ const a = e.getEditorState(), c = e._config, u = e._compositionKey, o = e._editable;
191
+ if (r) {
192
+ let d = "";
193
+ return a.read(() => {
194
+ d = jt(Ne(e));
195
+ }), d;
196
+ }
197
+ let s = ` root
198
+ `;
199
+ const v = a.read(() => {
200
+ const d = V();
201
+ return ve(be(), (l, m) => {
202
+ const g = `(${l.getKey()})`, I = l.getType() || "", E = l.isSelected(), L = Te(l) ? ` id: [ ${l.getIDs().join(", ")} ] ` : "";
203
+ s += `${E ? W.selectedLine : " "} ${m.join(" ")} ${g} ${I} ${L} ${pt(l)}
204
+ `, s += $t({
205
+ indent: m,
206
+ isSelected: E,
207
+ node: l,
208
+ nodeKeyDisplay: g,
209
+ selection: d,
210
+ typeDisplay: I
211
+ });
212
+ }), d === null ? ": null" : J(d) ? mt(d) : xe(d) ? ht(d) : gt(d);
213
+ });
214
+ if (s += `
215
+ selection` + v, s += `
216
+
217
+ commands:`, t.length)
218
+ for (const {
219
+ type: d,
220
+ payload: l
221
+ } of t)
222
+ s += `
223
+ └ { type: ${d}, payload: ${l instanceof Event ? l.constructor.name : l} }`;
224
+ else
225
+ s += `
226
+ └ None dispatched.`;
227
+ return s += `
228
+
229
+ editor:`, s += `
230
+ └ namespace ${c.namespace}`, u !== null && (s += `
231
+ └ compositionKey ${u}`), s += `
232
+ └ editable ${String(o)}`, s;
233
+ }
234
+ function ve(e, t, r = []) {
235
+ const a = e.getChildren(), c = a.length;
236
+ a.forEach((u, o) => {
237
+ t(u, r.concat(o === c - 1 ? W.isLastChild : W.hasNextSibling)), te(u) && ve(u, t, r.concat(o === c - 1 ? W.ancestorIsLastChild : W.ancestorHasNextSibling));
238
+ });
239
+ }
240
+ function ge(e) {
241
+ return Object.entries(je).reduce((t, [r, a]) => t.replace(new RegExp(r, "g"), String(a)), e);
242
+ }
243
+ function pt(e) {
244
+ if (ee(e)) {
245
+ const t = e.getTextContent(), r = t.length === 0 ? "(empty)" : `"${ge(t)}"`, a = St(e);
246
+ return [r, a.length !== 0 ? `{ ${a} }` : null].filter(Boolean).join(" ").trim();
247
+ } else if (we(e)) {
248
+ const t = e.getURL(), r = t.length === 0 ? "(empty)" : `"${ge(t)}"`, a = Nt(e);
249
+ return [r, a.length !== 0 ? `{ ${a} }` : null].filter(Boolean).join(" ").trim();
250
+ } else
251
+ return "";
252
+ }
253
+ const yt = [(e) => e.hasFormat("bold") && "Bold", (e) => e.hasFormat("code") && "Code", (e) => e.hasFormat("italic") && "Italic", (e) => e.hasFormat("strikethrough") && "Strikethrough", (e) => e.hasFormat("subscript") && "Subscript", (e) => e.hasFormat("superscript") && "Superscript", (e) => e.hasFormat("underline") && "Underline"], Et = [(e) => e.isDirectionless() && "Directionless", (e) => e.isUnmergeable() && "Unmergeable"], Ct = [(e) => e.isToken() && "Token", (e) => e.isSegmented() && "Segmented"];
254
+ function St(e) {
255
+ return [_e(e), bt(e), xt(e)].filter(Boolean).join(", ");
256
+ }
257
+ function Nt(e) {
258
+ return [Tt(e), wt(e), Lt(e)].filter(Boolean).join(", ");
259
+ }
260
+ function bt(e) {
261
+ let t = Et.map((r) => r(e)).filter(Boolean).join(", ").toLocaleLowerCase();
262
+ return t !== "" && (t = "detail: " + t), t;
263
+ }
264
+ function xt(e) {
265
+ let t = Ct.map((r) => r(e)).filter(Boolean).join(", ").toLocaleLowerCase();
266
+ return t !== "" && (t = "mode: " + t), t;
267
+ }
268
+ function _e(e) {
269
+ let t = yt.map((r) => r(e)).filter(Boolean).join(", ").toLocaleLowerCase();
270
+ return t !== "" && (t = "format: " + t), t;
271
+ }
272
+ function Tt(e) {
273
+ let t = e.getTarget();
274
+ return t != null && (t = "target: " + t), t;
275
+ }
276
+ function wt(e) {
277
+ let t = e.getRel();
278
+ return t != null && (t = "rel: " + t), t;
279
+ }
280
+ function Lt(e) {
281
+ let t = e.getTitle();
282
+ return t != null && (t = "title: " + t), t;
283
+ }
284
+ function $t({
285
+ indent: e,
286
+ isSelected: t,
287
+ node: r,
288
+ nodeKeyDisplay: a,
289
+ selection: c,
290
+ typeDisplay: u
291
+ }) {
292
+ if (!ee(r) || !J(c) || !t || te(r))
293
+ return "";
294
+ const o = c.anchor, s = c.focus;
295
+ if (r.getTextContent() === "" || o.getNode() === c.focus.getNode() && o.offset === s.offset)
296
+ return "";
297
+ const [v, d] = vt(r, c);
298
+ if (v === d)
299
+ return "";
300
+ const l = e[e.length - 1] === W.hasNextSibling ? W.ancestorHasNextSibling : W.ancestorIsLastChild, m = [...e.slice(0, e.length - 1), l], h = Array(v + 1).fill(" "), g = Array(d - v).fill(W.selectedChar), I = u.length + 3, E = Array(a.length + I).fill(" ");
301
+ return [W.selectedLine, m.join(" "), [...E, ...h, ...g].join("")].join(" ") + `
302
+ `;
303
+ }
304
+ function jt(e) {
305
+ const t = document.createElement("div");
306
+ return t.innerHTML = e.trim(), Re(t, 0).innerHTML;
307
+ }
308
+ function Re(e, t) {
309
+ const r = new Array(t++ + 1).join(" "), a = new Array(t - 1).join(" ");
310
+ let c;
311
+ for (let u = 0; u < e.children.length; u++)
312
+ c = document.createTextNode(`
313
+ ` + r), e.insertBefore(c, e.children[u]), Re(e.children[u], t), e.lastElementChild === e.children[u] && (c = document.createTextNode(`
314
+ ` + a), e.appendChild(c));
315
+ return e;
316
+ }
317
+ function vt(e, t) {
318
+ const r = t.getStartEndPoints();
319
+ if (U(t) || r === null)
320
+ return [-1, -1];
321
+ const [a, c] = r, u = e.getTextContent(), o = u.length;
322
+ let s = -1, v = -1;
323
+ if (a.type === "text" && c.type === "text") {
324
+ const m = a.getNode(), h = c.getNode();
325
+ m === h && e === m && a.offset !== c.offset ? [s, v] = a.offset < c.offset ? [a.offset, c.offset] : [c.offset, a.offset] : e === m ? [s, v] = m.isBefore(h) ? [a.offset, o] : [0, a.offset] : e === h ? [s, v] = h.isBefore(m) ? [c.offset, o] : [0, c.offset] : [s, v] = [0, o];
326
+ }
327
+ const d = (u.slice(0, s).match(me) || []).length, l = (u.slice(s, v).match(me) || []).length;
328
+ return [s + d, v + d + l];
329
+ }
330
+ const _t = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
331
+ __proto__: null,
332
+ TreeView: ft
333
+ }, Symbol.toStringTag, { value: "Module" })), De = Object.freeze({ " ": "\\t", "\n": "\\n" }), he = new RegExp(Object.keys(De).join("|"), "g"), K = Object.freeze({ ancestorHasNextSibling: "|", ancestorIsLastChild: " ", hasNextSibling: "├", isLastChild: "└", selectedChar: "^", selectedLine: ">" });
334
+ function Rt({ treeTypeButtonClassName: e, timeTravelButtonClassName: t, timeTravelPanelSliderClassName: r, timeTravelPanelButtonClassName: a, viewClassName: c, timeTravelPanelClassName: u, editor: o }) {
335
+ const [s, v] = A([]), [d, l] = A(""), [m, h] = A(!1), [g, I] = A(!1), E = O(0), L = O(null), p = O(null), [R, _] = A(!1), [S, B] = A(!1), [i, N] = A(!1), f = O(null), w = function(n) {
336
+ const [b, $] = A([]);
337
+ return H(() => {
338
+ const z = /* @__PURE__ */ new Set();
339
+ for (const [C] of n._commands)
340
+ z.add(n.registerCommand(C, (x) => ($((P) => {
341
+ const M = [...P];
342
+ return M.push({ payload: x, type: C.type ? C.type : "UNKNOWN" }), M.length > 10 && M.shift(), M;
343
+ }), !1), Se));
344
+ return () => z.forEach((C) => C());
345
+ }, [n]), $e(() => b, [b]);
346
+ }(o), D = G((n) => {
347
+ const b = le(o, w, g);
348
+ l(b), m || v(($) => [...$, [Date.now(), n]]);
349
+ }, [w, o, m, g]);
350
+ H(() => {
351
+ const n = o.getEditorState();
352
+ !i && n._nodeMap.size < 1e3 && l(le(o, w, g));
353
+ }, [w, o, i, g]), H(() => ce(o.registerUpdateListener(({ editorState: n }) => {
354
+ !i && n._nodeMap.size > 1e3 && (f.current = n, B(!0), !i) || D(n);
355
+ }), o.registerEditableListener(() => {
356
+ const n = le(o, w, g);
357
+ l(n);
358
+ })), [w, o, g, S, D, i]);
359
+ const y = s.length;
360
+ return H(() => {
361
+ if (R) {
362
+ let n;
363
+ const b = () => {
364
+ const $ = E.current;
365
+ if ($ === y - 1)
366
+ return void _(!1);
367
+ const z = s[$][0], C = s[$ + 1][0];
368
+ n = setTimeout(() => {
369
+ E.current++;
370
+ const x = E.current, P = p.current;
371
+ P !== null && (P.value = String(x)), o.setEditorState(s[x][1]), b();
372
+ }, C - z);
373
+ };
374
+ return b(), () => {
375
+ clearTimeout(n);
376
+ };
377
+ }
378
+ }, [s, R, o, y]), H(() => {
379
+ const n = L.current;
380
+ if (n !== null)
381
+ return n.__lexicalEditor = o, () => {
382
+ n.__lexicalEditor = null;
383
+ };
384
+ }, [o]), k.createElement("div", { className: c }, !i && S ? k.createElement("div", { style: { padding: 20 } }, k.createElement("span", { style: { marginRight: 20 } }, "Detected large EditorState, this can impact debugging performance."), k.createElement("button", { onClick: () => {
385
+ N(!0);
386
+ const n = f.current;
387
+ n !== null && (f.current = null, D(n));
388
+ }, style: { background: "transparent", border: "1px solid white", color: "white", cursor: "pointer", padding: 5 } }, "Show full tree")) : null, i ? null : k.createElement("button", { onClick: () => I(!g), className: e, type: "button" }, g ? "Tree" : "Export DOM"), !m && (i || !S) && y > 2 && k.createElement("button", { onClick: () => {
389
+ const n = o.getRootElement();
390
+ n !== null && (n.contentEditable = "false", E.current = y - 1, h(!0));
391
+ }, className: t, type: "button" }, "Time Travel"), (i || !S) && k.createElement("pre", { ref: L }, d), m && (i || !S) && k.createElement("div", { className: u }, k.createElement("button", { className: a, onClick: () => {
392
+ E.current === y - 1 && (E.current = 1), _(!R);
393
+ }, type: "button" }, R ? "Pause" : "Play"), k.createElement("input", { className: r, ref: p, onChange: (n) => {
394
+ const b = Number(n.target.value), $ = s[b];
395
+ $ && (E.current = b, o.setEditorState($[1]));
396
+ }, type: "range", min: "1", max: y - 1 }), k.createElement("button", { className: a, onClick: () => {
397
+ const n = o.getRootElement();
398
+ if (n !== null) {
399
+ n.contentEditable = "true";
400
+ const b = s.length - 1, $ = s[b];
401
+ o.setEditorState($[1]);
402
+ const z = p.current;
403
+ z !== null && (z.value = String(b)), h(!1), _(!1);
404
+ }
405
+ }, type: "button" }, "Exit")));
406
+ }
407
+ function le(e, t, r) {
408
+ const a = e.getEditorState(), c = e._config, u = e._compositionKey, o = e._editable;
409
+ if (r) {
410
+ let d = "";
411
+ return a.read(() => {
412
+ d = function(l) {
413
+ const m = document.createElement("div");
414
+ return m.innerHTML = l.trim(), Me(m, 0).innerHTML;
415
+ }(Ne(e));
416
+ }), d;
417
+ }
418
+ let s = ` root
419
+ `;
420
+ const v = a.read(() => {
421
+ const d = V();
422
+ return Pe(be(), (l, m) => {
423
+ const h = `(${l.getKey()})`, g = l.getType() || "", I = l.isSelected(), E = Te(l) ? ` id: [ ${l.getIDs().join(", ")} ] ` : "";
424
+ s += `${I ? K.selectedLine : " "} ${m.join(" ")} ${h} ${g} ${E} ${function(L) {
425
+ if (ee(L)) {
426
+ const p = L.getTextContent(), R = p.length === 0 ? "(empty)" : `"${pe(p)}"`, _ = function(S) {
427
+ return [ye(S), kt(S), It(S)].filter(Boolean).join(", ");
428
+ }(L);
429
+ return [R, _.length !== 0 ? `{ ${_} }` : null].filter(Boolean).join(" ").trim();
430
+ }
431
+ if (we(L)) {
432
+ const p = L.getURL(), R = p.length === 0 ? "(empty)" : `"${pe(p)}"`, _ = function(S) {
433
+ return [At(S), zt(S), Ot(S)].filter(Boolean).join(", ");
434
+ }(L);
435
+ return [R, _.length !== 0 ? `{ ${_} }` : null].filter(Boolean).join(" ").trim();
436
+ }
437
+ return "";
438
+ }(l)}
439
+ `, s += function({ indent: L, isSelected: p, node: R, nodeKeyDisplay: _, selection: S, typeDisplay: B }) {
440
+ if (!ee(R) || !J(S) || !p || te(R))
441
+ return "";
442
+ const i = S.anchor, N = S.focus;
443
+ if (R.getTextContent() === "" || i.getNode() === S.focus.getNode() && i.offset === N.offset)
444
+ return "";
445
+ const [f, w] = function(C, x) {
446
+ const P = x.getStartEndPoints();
447
+ if (U(x) || P === null)
448
+ return [-1, -1];
449
+ const [M, F] = P, ne = C.getTextContent(), re = ne.length;
450
+ let X = -1, Q = -1;
451
+ if (M.type === "text" && F.type === "text") {
452
+ const q = M.getNode(), Z = F.getNode();
453
+ q === Z && C === q && M.offset !== F.offset ? [X, Q] = M.offset < F.offset ? [M.offset, F.offset] : [F.offset, M.offset] : [X, Q] = C === q ? q.isBefore(Z) ? [M.offset, re] : [0, M.offset] : C === Z ? Z.isBefore(q) ? [F.offset, re] : [0, F.offset] : [0, re];
454
+ }
455
+ const ue = (ne.slice(0, X).match(he) || []).length, ke = (ne.slice(X, Q).match(he) || []).length;
456
+ return [X + ue, Q + ue + ke];
457
+ }(R, S);
458
+ if (f === w)
459
+ return "";
460
+ const D = L[L.length - 1] === K.hasNextSibling ? K.ancestorHasNextSibling : K.ancestorIsLastChild, y = [...L.slice(0, L.length - 1), D], n = Array(f + 1).fill(" "), b = Array(w - f).fill(K.selectedChar), $ = B.length + 3, z = Array(_.length + $).fill(" ");
461
+ return [K.selectedLine, y.join(" "), [...z, ...n, ...b].join("")].join(" ") + `
462
+ `;
463
+ }({ indent: m, isSelected: I, node: l, nodeKeyDisplay: h, selection: d, typeDisplay: g });
464
+ }), d === null ? ": null" : J(d) ? function(l) {
465
+ let m = "";
466
+ const h = ye(l);
467
+ m += `: range ${h !== "" ? `{ ${h} }` : ""} ${l.style !== "" ? `{ style: ${l.style} } ` : ""}`;
468
+ const g = l.anchor, I = l.focus, E = g.offset, L = I.offset;
469
+ return m += `
470
+ ├ anchor { key: ${g.key}, offset: ${E === null ? "null" : E}, type: ${g.type} }`, m += `
471
+ └ focus { key: ${I.key}, offset: ${L === null ? "null" : L}, type: ${I.type} }`, m;
472
+ }(d) : xe(d) ? function(l) {
473
+ return `: table
474
+ └ { table: ${l.tableKey}, anchorCell: ${l.anchor.key}, focusCell: ${l.focus.key} }`;
475
+ }(d) : function(l) {
476
+ return U(l) ? `: node
477
+ └ [${Array.from(l._nodes).join(", ")}]` : "";
478
+ }(d);
479
+ });
480
+ if (s += `
481
+ selection` + v, s += `
482
+
483
+ commands:`, t.length)
484
+ for (const { type: d, payload: l } of t)
485
+ s += `
486
+ └ { type: ${d}, payload: ${l instanceof Event ? l.constructor.name : l} }`;
487
+ else
488
+ s += `
489
+ └ None dispatched.`;
490
+ return s += `
491
+
492
+ editor:`, s += `
493
+ └ namespace ${c.namespace}`, u !== null && (s += `
494
+ └ compositionKey ${u}`), s += `
495
+ └ editable ${String(o)}`, s;
496
+ }
497
+ function Pe(e, t, r = []) {
498
+ const a = e.getChildren(), c = a.length;
499
+ a.forEach((u, o) => {
500
+ t(u, r.concat(o === c - 1 ? K.isLastChild : K.hasNextSibling)), te(u) && Pe(u, t, r.concat(o === c - 1 ? K.ancestorIsLastChild : K.ancestorHasNextSibling));
501
+ });
502
+ }
503
+ function pe(e) {
504
+ return Object.entries(De).reduce((t, [r, a]) => t.replace(new RegExp(r, "g"), String(a)), e);
505
+ }
506
+ const Dt = [(e) => e.hasFormat("bold") && "Bold", (e) => e.hasFormat("code") && "Code", (e) => e.hasFormat("italic") && "Italic", (e) => e.hasFormat("strikethrough") && "Strikethrough", (e) => e.hasFormat("subscript") && "Subscript", (e) => e.hasFormat("superscript") && "Superscript", (e) => e.hasFormat("underline") && "Underline"], Pt = [(e) => e.isDirectionless() && "Directionless", (e) => e.isUnmergeable() && "Unmergeable"], Mt = [(e) => e.isToken() && "Token", (e) => e.isSegmented() && "Segmented"];
507
+ function kt(e) {
508
+ let t = Pt.map((r) => r(e)).filter(Boolean).join(", ").toLocaleLowerCase();
509
+ return t !== "" && (t = "detail: " + t), t;
510
+ }
511
+ function It(e) {
512
+ let t = Mt.map((r) => r(e)).filter(Boolean).join(", ").toLocaleLowerCase();
513
+ return t !== "" && (t = "mode: " + t), t;
514
+ }
515
+ function ye(e) {
516
+ let t = Dt.map((r) => r(e)).filter(Boolean).join(", ").toLocaleLowerCase();
517
+ return t !== "" && (t = "format: " + t), t;
518
+ }
519
+ function At(e) {
520
+ let t = e.getTarget();
521
+ return t != null && (t = "target: " + t), t;
522
+ }
523
+ function zt(e) {
524
+ let t = e.getRel();
525
+ return t != null && (t = "rel: " + t), t;
526
+ }
527
+ function Ot(e) {
528
+ let t = e.getTitle();
529
+ return t != null && (t = "title: " + t), t;
530
+ }
531
+ function Me(e, t) {
532
+ const r = new Array(1 + t++).join(" "), a = new Array(t - 1).join(" ");
533
+ let c;
534
+ for (let u = 0; u < e.children.length; u++)
535
+ c = document.createTextNode(`
536
+ ` + r), e.insertBefore(c, e.children[u]), Me(e.children[u], t), e.lastElementChild === e.children[u] && (c = document.createTextNode(`
537
+ ` + a), e.appendChild(c));
538
+ return e;
539
+ }
540
+ const Bt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
541
+ __proto__: null,
542
+ TreeView: Rt
543
+ }, Symbol.toStringTag, { value: "Module" })), Ht = process.env.NODE_ENV === "development" ? _t : Bt, Ft = Ht.TreeView;
544
+ function Kt() {
545
+ const [e] = Le();
546
+ return /* @__PURE__ */ T.jsx(
547
+ Ft,
548
+ {
549
+ viewClassName: "tree-view-output",
550
+ treeTypeButtonClassName: "debug-treetype-button",
551
+ timeTravelPanelClassName: "debug-timetravel-panel",
552
+ timeTravelButtonClassName: "debug-timetravel-button",
553
+ timeTravelPanelSliderClassName: "debug-timetravel-panel-slider",
554
+ timeTravelPanelButtonClassName: "debug-timetravel-panel-button",
555
+ editor: e
556
+ }
557
+ );
558
+ }
559
+ function ae(e, t, r) {
560
+ return Math.min(Math.max(e, t), r);
561
+ }
562
+ const j = {
563
+ east: 1,
564
+ north: 8,
565
+ south: 2,
566
+ west: 4
567
+ };
568
+ function Wt({
569
+ onResizeStart: e,
570
+ onResizeEnd: t,
571
+ buttonRef: r,
572
+ imageRef: a,
573
+ maxWidth: c,
574
+ editor: u,
575
+ showCaption: o,
576
+ setShowCaption: s,
577
+ captionsEnabled: v
578
+ }) {
579
+ const d = O(null), l = O({
580
+ priority: "",
581
+ value: "default"
582
+ }), m = O({
583
+ currentHeight: 0,
584
+ currentWidth: 0,
585
+ direction: 0,
586
+ isResizing: !1,
587
+ ratio: 0,
588
+ startHeight: 0,
589
+ startWidth: 0,
590
+ startX: 0,
591
+ startY: 0
592
+ }), h = u.getRootElement(), g = c || (h !== null ? h.getBoundingClientRect().width - 20 : 100), I = h !== null ? h.getBoundingClientRect().height - 20 : 100, E = 100, L = 100, p = (i) => {
593
+ const N = i === j.east || i === j.west, f = i === j.north || i === j.south, w = i & j.north && i & j.west || i & j.south && i & j.east, D = N ? "ew" : f ? "ns" : w ? "nwse" : "nesw";
594
+ h !== null && h.style.setProperty(
595
+ "cursor",
596
+ `${D}-resize`,
597
+ "important"
598
+ ), document.body !== null && (document.body.style.setProperty(
599
+ "cursor",
600
+ `${D}-resize`,
601
+ "important"
602
+ ), l.current.value = document.body.style.getPropertyValue(
603
+ "-webkit-user-select"
604
+ ), l.current.priority = document.body.style.getPropertyPriority(
605
+ "-webkit-user-select"
606
+ ), document.body.style.setProperty(
607
+ "-webkit-user-select",
608
+ "none",
609
+ "important"
610
+ ));
611
+ }, R = () => {
612
+ h !== null && h.style.setProperty("cursor", "text"), document.body !== null && (document.body.style.setProperty("cursor", "default"), document.body.style.setProperty(
613
+ "-webkit-user-select",
614
+ l.current.value,
615
+ l.current.priority
616
+ ));
617
+ }, _ = (i, N) => {
618
+ if (!u.isEditable())
619
+ return;
620
+ const f = a.current, w = d.current;
621
+ if (f !== null && w !== null) {
622
+ i.preventDefault();
623
+ const { width: D, height: y } = f.getBoundingClientRect(), n = m.current;
624
+ n.startWidth = D, n.startHeight = y, n.ratio = D / y, n.currentWidth = D, n.currentHeight = y, n.startX = i.clientX, n.startY = i.clientY, n.isResizing = !0, n.direction = N, p(N), e(), w.classList.add("image-control-wrapper--resizing"), f.style.height = `${y}px`, f.style.width = `${D}px`, document.addEventListener("pointermove", S), document.addEventListener("pointerup", B);
625
+ }
626
+ }, S = (i) => {
627
+ const N = a.current, f = m.current, w = f.direction & (j.east | j.west), D = f.direction & (j.south | j.north);
628
+ if (N !== null && f.isResizing)
629
+ if (w && D) {
630
+ let y = Math.floor(f.startX - i.clientX);
631
+ y = f.direction & j.east ? -y : y;
632
+ const n = ae(
633
+ f.startWidth + y,
634
+ E,
635
+ g
636
+ ), b = n / f.ratio;
637
+ N.style.width = `${n}px`, N.style.height = `${b}px`, f.currentHeight = b, f.currentWidth = n;
638
+ } else if (D) {
639
+ let y = Math.floor(f.startY - i.clientY);
640
+ y = f.direction & j.south ? -y : y;
641
+ const n = ae(
642
+ f.startHeight + y,
643
+ L,
644
+ I
645
+ );
646
+ N.style.height = `${n}px`, f.currentHeight = n;
647
+ } else {
648
+ let y = Math.floor(f.startX - i.clientX);
649
+ y = f.direction & j.east ? -y : y;
650
+ const n = ae(
651
+ f.startWidth + y,
652
+ E,
653
+ g
654
+ );
655
+ N.style.width = `${n}px`, f.currentWidth = n;
656
+ }
657
+ }, B = () => {
658
+ const i = a.current, N = m.current, f = d.current;
659
+ if (i !== null && f !== null && N.isResizing) {
660
+ const w = N.currentWidth, D = N.currentHeight;
661
+ N.startWidth = 0, N.startHeight = 0, N.ratio = 0, N.startX = 0, N.startY = 0, N.currentWidth = 0, N.currentHeight = 0, N.isResizing = !1, f.classList.remove("image-control-wrapper--resizing"), R(), t(w, D), document.removeEventListener("pointermove", S), document.removeEventListener("pointerup", B);
662
+ }
663
+ };
664
+ return /* @__PURE__ */ T.jsxs("div", { ref: d, children: [
665
+ !o && v && /* @__PURE__ */ T.jsx(
666
+ "button",
667
+ {
668
+ className: "image-caption-button",
669
+ ref: r,
670
+ onClick: () => {
671
+ s(!o);
672
+ },
673
+ children: "Add Caption"
674
+ }
675
+ ),
676
+ /* @__PURE__ */ T.jsx(
677
+ "div",
678
+ {
679
+ className: "image-resizer image-resizer-n",
680
+ onPointerDown: (i) => {
681
+ _(i, j.north);
682
+ }
683
+ }
684
+ ),
685
+ /* @__PURE__ */ T.jsx(
686
+ "div",
687
+ {
688
+ className: "image-resizer image-resizer-ne",
689
+ onPointerDown: (i) => {
690
+ _(i, j.north | j.east);
691
+ }
692
+ }
693
+ ),
694
+ /* @__PURE__ */ T.jsx(
695
+ "div",
696
+ {
697
+ className: "image-resizer image-resizer-e",
698
+ onPointerDown: (i) => {
699
+ _(i, j.east);
700
+ }
701
+ }
702
+ ),
703
+ /* @__PURE__ */ T.jsx(
704
+ "div",
705
+ {
706
+ className: "image-resizer image-resizer-se",
707
+ onPointerDown: (i) => {
708
+ _(i, j.south | j.east);
709
+ }
710
+ }
711
+ ),
712
+ /* @__PURE__ */ T.jsx(
713
+ "div",
714
+ {
715
+ className: "image-resizer image-resizer-s",
716
+ onPointerDown: (i) => {
717
+ _(i, j.south);
718
+ }
719
+ }
720
+ ),
721
+ /* @__PURE__ */ T.jsx(
722
+ "div",
723
+ {
724
+ className: "image-resizer image-resizer-sw",
725
+ onPointerDown: (i) => {
726
+ _(i, j.south | j.west);
727
+ }
728
+ }
729
+ ),
730
+ /* @__PURE__ */ T.jsx(
731
+ "div",
732
+ {
733
+ className: "image-resizer image-resizer-w",
734
+ onPointerDown: (i) => {
735
+ _(i, j.west);
736
+ }
737
+ }
738
+ ),
739
+ /* @__PURE__ */ T.jsx(
740
+ "div",
741
+ {
742
+ className: "image-resizer image-resizer-nw",
743
+ onPointerDown: (i) => {
744
+ _(i, j.north | j.west);
745
+ }
746
+ }
747
+ )
748
+ ] });
749
+ }
750
+ const Ee = /* @__PURE__ */ new Set(), Ce = nt("RIGHT_CLICK_IMAGE_COMMAND");
751
+ function Ut(e) {
752
+ if (!Ee.has(e))
753
+ throw new Promise((t) => {
754
+ const r = new Image();
755
+ r.src = e, r.onload = () => {
756
+ Ee.add(e), t(null);
757
+ };
758
+ });
759
+ }
760
+ function Yt({
761
+ altText: e,
762
+ className: t,
763
+ imageRef: r,
764
+ src: a,
765
+ width: c,
766
+ height: u,
767
+ maxWidth: o
768
+ }) {
769
+ return Ut(a), /* @__PURE__ */ T.jsx(
770
+ "img",
771
+ {
772
+ className: t || void 0,
773
+ src: a,
774
+ alt: e,
775
+ ref: r,
776
+ style: {
777
+ height: u,
778
+ maxWidth: o,
779
+ width: c
780
+ },
781
+ draggable: "false"
782
+ }
783
+ );
784
+ }
785
+ function Jt({
786
+ src: e,
787
+ altText: t,
788
+ nodeKey: r,
789
+ width: a,
790
+ height: c,
791
+ maxWidth: u,
792
+ resizable: o,
793
+ showCaption: s,
794
+ caption: v,
795
+ captionsEnabled: d
796
+ }) {
797
+ const l = O(null), m = O(null), [h, g, I] = Ie(r), [E, L] = A(!1);
798
+ Ae();
799
+ const [p] = Le(), [R, _] = A(null), S = O(null), B = G(
800
+ (C) => {
801
+ if (h && U(V())) {
802
+ C.preventDefault();
803
+ const P = oe(r);
804
+ if (se(P))
805
+ return P.remove(), !0;
806
+ }
807
+ return !1;
808
+ },
809
+ [h, r]
810
+ ), i = G(
811
+ (C) => {
812
+ const x = V(), P = m.current;
813
+ if (h && U(x) && x.getNodes().length === 1) {
814
+ if (s)
815
+ return fe(null), C.preventDefault(), v.focus(), !0;
816
+ if (P !== null && P !== document.activeElement)
817
+ return C.preventDefault(), P.focus(), !0;
818
+ }
819
+ return !1;
820
+ },
821
+ [v, h, s]
822
+ ), N = G(
823
+ (C) => S.current === v || m.current === C.target ? (fe(null), p.update(() => {
824
+ g(!0);
825
+ const x = p.getRootElement();
826
+ x !== null && x.focus();
827
+ }), !0) : !1,
828
+ [v, p, g]
829
+ ), f = G(
830
+ (C) => {
831
+ const x = C;
832
+ return E ? !0 : x.target === l.current ? (x.shiftKey ? g(!h) : (I(), g(!0)), !0) : !1;
833
+ },
834
+ [E, h, g, I]
835
+ ), w = G(
836
+ (C) => {
837
+ p.getEditorState().read(() => {
838
+ const x = V();
839
+ C.target.tagName === "IMG" && J(x) && x.getNodes().length === 1 && p.dispatchCommand(
840
+ Ce,
841
+ C
842
+ );
843
+ });
844
+ },
845
+ [p]
846
+ );
847
+ H(() => {
848
+ let C = !0;
849
+ const x = p.getRootElement(), P = ce(
850
+ p.registerUpdateListener(({ editorState: M }) => {
851
+ C && _(M.read(() => V()));
852
+ }),
853
+ p.registerCommand(
854
+ ze,
855
+ (M, F) => (S.current = F, !1),
856
+ Y
857
+ ),
858
+ p.registerCommand(
859
+ Oe,
860
+ f,
861
+ Y
862
+ ),
863
+ p.registerCommand(
864
+ Ce,
865
+ f,
866
+ Y
867
+ ),
868
+ p.registerCommand(
869
+ Be,
870
+ (M) => M.target === l.current ? (M.preventDefault(), !0) : !1,
871
+ Y
872
+ ),
873
+ p.registerCommand(
874
+ He,
875
+ B,
876
+ Y
877
+ ),
878
+ p.registerCommand(
879
+ Fe,
880
+ B,
881
+ Y
882
+ ),
883
+ p.registerCommand(Ke, i, Y),
884
+ p.registerCommand(
885
+ We,
886
+ N,
887
+ Y
888
+ )
889
+ );
890
+ return x == null || x.addEventListener("contextmenu", w), () => {
891
+ C = !1, P(), x == null || x.removeEventListener("contextmenu", w);
892
+ };
893
+ }, [
894
+ I,
895
+ p,
896
+ E,
897
+ h,
898
+ r,
899
+ B,
900
+ i,
901
+ N,
902
+ f,
903
+ w,
904
+ g
905
+ ]);
906
+ const D = () => {
907
+ p.update(() => {
908
+ const C = oe(r);
909
+ se(C) && C.setShowCaption(!0);
910
+ });
911
+ }, y = (C, x) => {
912
+ setTimeout(() => {
913
+ L(!1);
914
+ }, 200), p.update(() => {
915
+ const P = oe(r);
916
+ se(P) && P.setWidthAndHeight(C, x);
917
+ });
918
+ }, n = () => {
919
+ L(!0);
920
+ };
921
+ Ue();
922
+ const {
923
+ settings: { showNestedEditorTreeView: b }
924
+ } = ut(), $ = h && U(R) && !E, z = h || E;
925
+ return /* @__PURE__ */ T.jsx(it, { fallback: null, children: /* @__PURE__ */ T.jsxs(T.Fragment, { children: [
926
+ /* @__PURE__ */ T.jsx("div", { draggable: $, children: /* @__PURE__ */ T.jsx(
927
+ Yt,
928
+ {
929
+ className: z ? `focused ${U(R) ? "draggable" : ""}` : null,
930
+ src: e,
931
+ altText: t,
932
+ imageRef: l,
933
+ width: a,
934
+ height: c,
935
+ maxWidth: u
936
+ }
937
+ ) }),
938
+ s && /* @__PURE__ */ T.jsx("div", { className: "image-caption-container", children: /* @__PURE__ */ T.jsxs(rt, { initialEditor: v, children: [
939
+ /* @__PURE__ */ T.jsx(Ye, {}),
940
+ /* @__PURE__ */ T.jsx(Ge, {}),
941
+ /* @__PURE__ */ T.jsx(Ve, {}),
942
+ /* @__PURE__ */ T.jsx(Xe, {}),
943
+ /* @__PURE__ */ T.jsx(qe, {}),
944
+ /* @__PURE__ */ T.jsx(Je, {}),
945
+ /* @__PURE__ */ T.jsx(
946
+ Qe,
947
+ {
948
+ contentEditable: /* @__PURE__ */ T.jsx(Ze, { className: "ImageNode__contentEditable" }),
949
+ placeholder: /* @__PURE__ */ T.jsx(et, { className: "ImageNode__placeholder", children: "Enter a caption..." }),
950
+ ErrorBoundary: tt
951
+ }
952
+ ),
953
+ b === !0 ? /* @__PURE__ */ T.jsx(Kt, {}) : null
954
+ ] }) }),
955
+ o && U(R) && z && /* @__PURE__ */ T.jsx(
956
+ Wt,
957
+ {
958
+ showCaption: s,
959
+ setShowCaption: D,
960
+ editor: p,
961
+ buttonRef: m,
962
+ imageRef: l,
963
+ maxWidth: u,
964
+ onResizeStart: n,
965
+ onResizeEnd: y,
966
+ captionsEnabled: d
967
+ }
968
+ )
969
+ ] }) });
970
+ }
971
+ export {
972
+ Ce as RIGHT_CLICK_IMAGE_COMMAND,
973
+ Jt as default
974
+ };
975
+ //# sourceMappingURL=ImageComponent-3ea88307.js.map