lexical-medium-editor 1.2.19 → 1.2.20

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.
@@ -1,219 +1,219 @@
1
1
  import './lexical-medium-editor.css';
2
- import { jsxs as D, Fragment as tt, jsx as h } from "react/jsx-runtime";
3
- import { AutoFocusPlugin as Et } from "@lexical/react/LexicalAutoFocusPlugin";
2
+ import { jsxs as D, Fragment as rt, jsx as h } from "react/jsx-runtime";
3
+ import { AutoFocusPlugin as Nt } from "@lexical/react/LexicalAutoFocusPlugin";
4
4
  import { LexicalComposer as xt } from "@lexical/react/LexicalComposer";
5
5
  import { RichTextPlugin as Tt } from "@lexical/react/LexicalRichTextPlugin";
6
6
  import { HistoryPlugin as At } from "@lexical/react/LexicalHistoryPlugin";
7
- import { LexicalErrorBoundary as St } from "@lexical/react/LexicalErrorBoundary";
7
+ import { LexicalErrorBoundary as Lt } from "@lexical/react/LexicalErrorBoundary";
8
8
  import { useLexicalComposerContext as M } from "@lexical/react/LexicalComposerContext";
9
- import { createCommand as Z, $getSelection as F, $isRangeSelection as k, $createParagraphNode as pe, COMMAND_PRIORITY_HIGH as $, $getRoot as fe, CLICK_COMMAND as Lt, COMMAND_PRIORITY_LOW as nt, TextNode as se, $isParagraphNode as J, $getCharacterOffsets as $t, FORMAT_TEXT_COMMAND as xe, SELECTION_CHANGE_COMMAND as Y, BLUR_COMMAND as be, $getNodeByKey as j, $isLineBreakNode as ie, $getPreviousSelection as ve, KEY_BACKSPACE_COMMAND as Ie, $isNodeSelection as Me, PASTE_COMMAND as Oe, $setSelection as rt, KEY_ARROW_RIGHT_COMMAND as Ft, $getAdjacentNode as Fe, $createTextNode as kt, COMMAND_PRIORITY_NORMAL as wt, KEY_ENTER_COMMAND as It, $isTextNode as Mt, ParagraphNode as Ot, $createLineBreakNode as Pt, KEY_TAB_COMMAND as _t } from "lexical";
10
- import { useEffect as b, useState as O, useRef as ee, useLayoutEffect as Dt, useCallback as de } from "react";
11
- import { createPortal as Pe } from "react-dom";
9
+ import { createCommand as Z, $getSelection as $, $isRangeSelection as k, $createParagraphNode as Ce, COMMAND_PRIORITY_HIGH as F, $getRoot as me, CLICK_COMMAND as St, COMMAND_PRIORITY_LOW as ke, TextNode as se, $isParagraphNode as J, $getCharacterOffsets as $t, FORMAT_TEXT_COMMAND as Ae, SELECTION_CHANGE_COMMAND as Y, BLUR_COMMAND as ae, $getNodeByKey as j, $isLineBreakNode as ie, $getPreviousSelection as ye, KEY_BACKSPACE_COMMAND as Oe, $isNodeSelection as pe, $setSelection as Pe, PASTE_COMMAND as _e, KEY_ARROW_RIGHT_COMMAND as Ft, $getAdjacentNode as we, $createTextNode as kt, COMMAND_PRIORITY_NORMAL as wt, KEY_ENTER_COMMAND as It, $isTextNode as Mt, ParagraphNode as Ot, $createLineBreakNode as Pt, KEY_TAB_COMMAND as _t } from "lexical";
10
+ import { useEffect as b, useState as O, useRef as ee, useLayoutEffect as Dt, useCallback as ge } from "react";
11
+ import { createPortal as De } from "react-dom";
12
12
  import { $findMatchingParent as I, $dfs as Bt } from "@lexical/utils";
13
- import { Toolbar as _e, TextField as Ht, Input as it, Group as oe, Button as q, ToggleButton as ne, Separator as Ge, ComboBox as Rt, Popover as ot, ListBox as zt, ListBoxItem as Gt, DialogTrigger as Wt, FileTrigger as Kt } from "react-aria-components";
13
+ import { Toolbar as Be, TextField as Ht, Input as it, Group as oe, Button as q, ToggleButton as ne, Separator as Ke, ComboBox as Rt, Popover as ot, ListBox as zt, ListBoxItem as Gt, DialogTrigger as Wt, FileTrigger as Kt } from "react-aria-components";
14
14
  import { IconCheck as Ut, IconX as qt, IconBold as jt, IconItalic as Yt, IconCode as Zt, IconTextSize as Qt, IconBlockquote as Xt, IconLink as Vt, IconCaretDownFilled as Jt, IconPlus as en, IconPhoto as tn, IconCodePlus as nn, IconLineDashed as rn } from "@tabler/icons-react";
15
- import { $isAtNodeEnd as We, $setBlocksType as st, createDOMRange as on } from "@lexical/selection";
16
- import { $createHeadingNode as at, HeadingNode as sn, $createQuoteNode as an, $isHeadingNode as ke, $isQuoteNode as ln } from "@lexical/rich-text";
15
+ import { $isAtNodeEnd as Ue, $setBlocksType as st, createDOMRange as on } from "@lexical/selection";
16
+ import { $createHeadingNode as at, HeadingNode as sn, $createQuoteNode as an, $isHeadingNode as Ie, $isQuoteNode as ln } from "@lexical/rich-text";
17
17
  import { $toggleLink as cn, $isLinkNode as un } from "@lexical/link";
18
- import { $isListNode as dn, $isListItemNode as Ke, $insertList as Ue } from "@lexical/list";
19
- import { $ as V, a as X, b as W, H as gn, c as fn, I as qe, d as Te, e as hn, f as re, M as he, g as mn, h as Ae, i as U, j as pn, k as Se } from "./ImageNode-Cqkp_4Y6.js";
20
- import { $isCodeNode as me, getCodeLanguages as bn, getLanguageFriendlyName as Le, registerCodeHighlighting as vn, $createCodeNode as je } from "@lexical/code";
21
- import { NodeEventPlugin as De } from "@lexical/react/LexicalNodeEventPlugin";
18
+ import { $isListNode as dn, $isListItemNode as qe, $insertList as je } from "@lexical/list";
19
+ import { $ as V, a as X, b as W, H as gn, c as fn, I as Ye, d as fe, e as hn, f as re, M as be, g as mn, h as Le, i as U, j as pn, k as Se } from "./ImageNode-Cqkp_4Y6.js";
20
+ import { $isCodeNode as ve, getCodeLanguages as bn, getLanguageFriendlyName as $e, registerCodeHighlighting as vn, $createCodeNode as Ze } from "@lexical/code";
21
+ import { NodeEventPlugin as He } from "@lexical/react/LexicalNodeEventPlugin";
22
22
  import { ListPlugin as Cn } from "@lexical/react/LexicalListPlugin";
23
23
  import { OnChangePlugin as yn } from "@lexical/react/LexicalOnChangePlugin";
24
- import { ContentEditable as Nn } from "@lexical/react/LexicalContentEditable";
25
- import { ClearEditorPlugin as En } from "@lexical/react/LexicalClearEditorPlugin";
24
+ import { ContentEditable as En } from "@lexical/react/LexicalContentEditable";
25
+ import { ClearEditorPlugin as Nn } from "@lexical/react/LexicalClearEditorPlugin";
26
26
  const B = -1e3;
27
- function xn(t, a, e = 0) {
28
- if (!a || !a.current)
27
+ function xn(n, s, e = 0) {
28
+ if (!s || !s.current)
29
29
  return console.error("Invalid popover reference"), {
30
30
  x: B,
31
31
  y: B
32
32
  };
33
- const n = a.current, { x: o, y: r } = t, { width: i, height: s } = n.getBoundingClientRect(), u = o - i / 2, m = r - s - e;
33
+ const t = s.current, { x: o, y: i } = n, { width: r, height: a } = t.getBoundingClientRect(), u = o - r / 2, m = i - a - e;
34
34
  return {
35
35
  x: u,
36
36
  y: m
37
37
  };
38
38
  }
39
- function Tn(t) {
40
- if (!t || typeof t.getBoundingClientRect != "function")
39
+ function Tn(n) {
40
+ if (!n || typeof n.getBoundingClientRect != "function")
41
41
  return console.error("Invalid DOM range"), null;
42
- const a = t.getBoundingClientRect(), e = a.left + a.width / 2, n = a.top + window.scrollY;
42
+ const s = n.getBoundingClientRect(), e = s.left + s.width / 2, t = s.top + window.scrollY;
43
43
  return {
44
44
  x: e,
45
- y: n
45
+ y: t
46
46
  };
47
47
  }
48
- function An(t, a, e = 0) {
49
- if (!a || !a.current)
48
+ function An(n, s, e = 0) {
49
+ if (!s || !s.current)
50
50
  return console.error("Invalid popover reference"), {
51
51
  x: B,
52
52
  y: B
53
53
  };
54
- const { x: n, y: o } = t, r = a.current, { width: i, height: s } = r.getBoundingClientRect(), u = n - i - e, m = o - s / 2;
54
+ const { x: t, y: o } = n, i = s.current, { width: r, height: a } = i.getBoundingClientRect(), u = t - r - e, m = o - a / 2;
55
55
  return {
56
56
  x: u,
57
57
  y: m
58
58
  };
59
59
  }
60
- function Sn(t, a, e = 16, n = 12) {
61
- if (!a || !a.current)
60
+ function Ln(n, s, e = 16, t = 12) {
61
+ if (!s || !s.current)
62
62
  return console.error("Invalid popover reference"), {
63
63
  x: B,
64
64
  y: B
65
65
  };
66
- const o = a.current, { x: r, y: i } = t, { width: s } = o.getBoundingClientRect(), u = r - s - e, m = i + n;
66
+ const o = s.current, { x: i, y: r } = n, { width: a } = o.getBoundingClientRect(), u = i - a - e, m = r + t;
67
67
  return {
68
68
  x: u,
69
69
  y: m
70
70
  };
71
71
  }
72
72
  const lt = Z("TOGGLE_HEADING_COMMAND"), ct = Z("TOGGLE_QUOTE_COMMAND"), ut = Z("TOGGLE_LINK_COMMAND");
73
- function Ce(t) {
74
- const a = t.anchor, e = t.focus, n = t.anchor.getNode(), o = t.focus.getNode();
75
- return n === o ? n : t.isBackward() ? We(e) ? n : o : We(a) ? n : o;
73
+ function Ee(n) {
74
+ const s = n.anchor, e = n.focus, t = n.anchor.getNode(), o = n.focus.getNode();
75
+ return t === o ? t : n.isBackward() ? Ue(e) ? t : o : Ue(s) ? t : o;
76
76
  }
77
- function Ye(t) {
78
- const a = I(t, ke);
79
- return a ? a.getTag() : null;
77
+ function Qe(n) {
78
+ const s = I(n, Ie);
79
+ return s ? s.getTag() : null;
80
80
  }
81
- function Ln(t) {
82
- const a = {
81
+ function Sn(n) {
82
+ const s = {
83
83
  isHeadingOne: !1,
84
84
  isHeadingTwo: !1,
85
85
  isHeadingThree: !1
86
- }, e = t.getNodes();
87
- if (!e.length) return a;
88
- const n = Ye(e[0]);
89
- if (!n) return a;
86
+ }, e = n.getNodes();
87
+ if (!e.length) return s;
88
+ const t = Qe(e[0]);
89
+ if (!t) return s;
90
90
  if (e.every(
91
- (r) => Ye(r) === n
91
+ (i) => Qe(i) === t
92
92
  )) {
93
- const r = {
93
+ const i = {
94
94
  h1: "isHeadingOne",
95
95
  h2: "isHeadingTwo",
96
96
  h3: "isHeadingThree"
97
- }[n];
98
- r && (a[r] = !0);
97
+ }[t];
98
+ i && (s[i] = !0);
99
99
  }
100
- return a;
100
+ return s;
101
101
  }
102
102
  function $n() {
103
- const [t] = M();
104
- return b(() => t.registerCommand(
103
+ const [n] = M();
104
+ return b(() => n.registerCommand(
105
105
  lt,
106
106
  (e) => {
107
- const { isHeadingOne: n, isHeadingTwo: o, isHeadingThree: r } = e, i = F();
108
- if (k(i)) {
109
- let s;
110
- n || o ? s = "h3" : r ? s = null : s = "h2", st(
111
- i,
112
- () => s ? at(s) : pe()
107
+ const { isHeadingOne: t, isHeadingTwo: o, isHeadingThree: i } = e, r = $();
108
+ if (k(r)) {
109
+ let a;
110
+ t || o ? a = "h3" : i ? a = null : a = "h2", st(
111
+ r,
112
+ () => a ? at(a) : Ce()
113
113
  );
114
114
  }
115
115
  return !0;
116
116
  },
117
- $
118
- ), [t]), null;
117
+ F
118
+ ), [n]), null;
119
119
  }
120
120
  function Fn() {
121
- const [t] = M();
121
+ const [n] = M();
122
122
  return b(() => {
123
- const a = t.registerNodeTransform(
123
+ const s = n.registerNodeTransform(
124
124
  sn,
125
125
  (e) => {
126
126
  if (e.getTag() !== "h2")
127
127
  return;
128
- const o = fe().getFirstChild();
128
+ const o = me().getFirstChild();
129
129
  if (o !== null && e.is(o)) {
130
- const r = e.getChildren(), i = at("h1");
131
- i.append(...r), e.replace(i);
130
+ const i = e.getChildren(), r = at("h1");
131
+ r.append(...i), e.replace(r);
132
132
  }
133
133
  }
134
134
  );
135
135
  return () => {
136
- a();
136
+ s();
137
137
  };
138
- }, [t]), null;
138
+ }, [n]), null;
139
139
  }
140
- function kn(t) {
141
- return I(t, ln);
140
+ function kn(n) {
141
+ return I(n, ln);
142
142
  }
143
- function wn(t) {
144
- const a = t.getNodes();
145
- return a.length ? a.length > 0 && a.every((e) => kn(e)) : !1;
143
+ function wn(n) {
144
+ const s = n.getNodes();
145
+ return s.length ? s.length > 0 && s.every((e) => kn(e)) : !1;
146
146
  }
147
147
  function In() {
148
- const [t] = M();
149
- return b(() => t.registerCommand(
148
+ const [n] = M();
149
+ return b(() => n.registerCommand(
150
150
  ct,
151
151
  (e) => {
152
- const n = F();
153
- return k(n) && st(
154
- n,
155
- () => e.isQuote ? pe() : an()
152
+ const t = $();
153
+ return k(t) && st(
154
+ t,
155
+ () => e.isQuote ? Ce() : an()
156
156
  ), !0;
157
157
  },
158
- $
159
- ), [t]), null;
158
+ F
159
+ ), [n]), null;
160
160
  }
161
- function dt(t) {
162
- if (!k(t))
161
+ function dt(n) {
162
+ if (!k(n))
163
163
  return null;
164
- const a = Ce(t);
165
- return I(a, un);
164
+ const s = Ee(n);
165
+ return I(s, un);
166
166
  }
167
167
  function Mn() {
168
- const [t] = M();
169
- return b(() => t.registerCommand(
170
- Lt,
168
+ const [n] = M();
169
+ return b(() => n.registerCommand(
170
+ St,
171
171
  (e) => {
172
- const n = F(), o = dt(n);
172
+ const t = $(), o = dt(t);
173
173
  return o && (e.metaKey || e.ctrlKey) ? (window.open(o.getURL(), "_blank"), !0) : !1;
174
174
  },
175
- nt
176
- ), [t]), b(() => t.registerCommand(
175
+ ke
176
+ ), [n]), b(() => n.registerCommand(
177
177
  ut,
178
178
  (e) => (cn(e), !0),
179
- $
180
- ), [t]), null;
179
+ F
180
+ ), [n]), null;
181
181
  }
182
182
  function On() {
183
- const [t] = M(), a = "heading-above";
184
- return b(() => t.registerNodeTransform(
183
+ const [n] = M(), s = "heading-above";
184
+ return b(() => n.registerNodeTransform(
185
185
  se,
186
- (n) => {
187
- const o = I(n, J) || I(n, dn);
188
- if (!o || ke(o))
186
+ (t) => {
187
+ const o = I(t, J) || I(t, dn);
188
+ if (!o || Ie(o))
189
189
  return;
190
- const r = o, i = t.getElementByKey(r.getKey());
191
- if (!i)
190
+ const i = o, r = n.getElementByKey(i.getKey());
191
+ if (!r)
192
192
  return;
193
- const s = r.getPreviousSibling(), u = ke(s), m = i.classList.contains(a);
194
- u && !m ? i.classList.add(a) : !u && m && i.classList.remove(a);
193
+ const a = i.getPreviousSibling(), u = Ie(a), m = r.classList.contains(s);
194
+ u && !m ? r.classList.add(s) : !u && m && r.classList.remove(s);
195
195
  }
196
- ), [t]), null;
196
+ ), [n]), null;
197
197
  }
198
- function Pn({ isHeadingOneFirst: t }) {
199
- return /* @__PURE__ */ D(tt, { children: [
198
+ function Pn({ isHeadingOneFirst: n }) {
199
+ return /* @__PURE__ */ D(rt, { children: [
200
200
  /* @__PURE__ */ h($n, {}),
201
- t && /* @__PURE__ */ h(Fn, {}),
201
+ n && /* @__PURE__ */ h(Fn, {}),
202
202
  /* @__PURE__ */ h(In, {}),
203
203
  /* @__PURE__ */ h(Mn, {}),
204
204
  /* @__PURE__ */ h(On, {})
205
205
  ] });
206
206
  }
207
- function _n({ style: t, closeToolbar: a, existingLinkURL: e }) {
208
- const [n] = M(), [o, r] = O(e);
209
- return /* @__PURE__ */ D(_e, { style: t, "aria-details": "link toolbar", id: "link-toolbar", children: [
207
+ function _n({ style: n, closeToolbar: s, existingLinkURL: e }) {
208
+ const [t] = M(), [o, i] = O(e);
209
+ return /* @__PURE__ */ D(Be, { style: n, "aria-details": "link toolbar", id: "link-toolbar", children: [
210
210
  /* @__PURE__ */ h(
211
211
  Ht,
212
212
  {
213
213
  "aria-label": "url",
214
214
  autoFocus: !0,
215
215
  defaultValue: o,
216
- onChange: r,
216
+ onChange: i,
217
217
  children: /* @__PURE__ */ h(it, { placeholder: "Enter Link" })
218
218
  }
219
219
  ),
@@ -223,23 +223,23 @@ function _n({ style: t, closeToolbar: a, existingLinkURL: e }) {
223
223
  {
224
224
  "aria-label": "Update link",
225
225
  onPress: () => {
226
- const i = o === "" ? null : o;
227
- n.dispatchCommand(ut, i), a();
226
+ const r = o === "" ? null : o;
227
+ t.dispatchCommand(ut, r), s();
228
228
  },
229
229
  children: /* @__PURE__ */ h(Ut, { size: K })
230
230
  }
231
231
  ),
232
- /* @__PURE__ */ h(q, { "aria-label": "Discard changes", onPress: a, children: /* @__PURE__ */ h(qt, { size: K }) })
232
+ /* @__PURE__ */ h(q, { "aria-label": "Discard changes", onPress: s, children: /* @__PURE__ */ h(qt, { size: K }) })
233
233
  ] }),
234
234
  /* @__PURE__ */ h("div", { className: "inline-toolbar-pointer" })
235
235
  ] });
236
236
  }
237
237
  const K = 24, Dn = 16;
238
- function Bn({ editor: t }) {
239
- const [a, e] = O(null), [n, o] = O({
238
+ function Bn({ editor: n }) {
239
+ const [s, e] = O(null), [t, o] = O({
240
240
  x: B,
241
241
  y: B
242
- }), r = ee(null), [i, s] = O({
242
+ }), i = ee(null), [r, a] = O({
243
243
  isBold: !1,
244
244
  isItalic: !1,
245
245
  isCode: !1,
@@ -247,44 +247,44 @@ function Bn({ editor: t }) {
247
247
  isHeadingTwo: !1,
248
248
  isHeadingThree: !1,
249
249
  isQuote: !1
250
- }), [u, m] = O(!1), [T, A] = O(0), [S, L] = O(""), N = (p) => {
250
+ }), [u, m] = O(!1), [A, L] = O(0), [S, T] = O(""), E = (p) => {
251
251
  if (k(p)) {
252
- s({
252
+ a({
253
253
  isBold: p.hasFormat("bold"),
254
254
  isItalic: p.hasFormat("italic"),
255
255
  isCode: p.hasFormat("code"),
256
256
  isQuote: wn(p)
257
257
  });
258
- const y = Ln(p);
259
- s((l) => ({
258
+ const y = Sn(p);
259
+ a((l) => ({
260
260
  ...l,
261
261
  ...y
262
262
  }));
263
263
  const x = dt(p);
264
- L(x ? x.getURL() : "");
264
+ T(x ? x.getURL() : "");
265
265
  }
266
266
  };
267
267
  return b(() => {
268
- t.read(() => {
269
- const p = F();
270
- N(p);
268
+ n.read(() => {
269
+ const p = $();
270
+ E(p);
271
271
  });
272
- }, [t]), b(() => t.registerUpdateListener(
272
+ }, [n]), b(() => n.registerUpdateListener(
273
273
  ({ editorState: y }) => {
274
274
  y.read(() => {
275
- const x = F();
276
- N(x);
275
+ const x = $();
276
+ E(x);
277
277
  });
278
278
  }
279
- ), [t]), b(() => {
280
- t.read(() => {
281
- const p = F();
279
+ ), [n]), b(() => {
280
+ n.read(() => {
281
+ const p = $();
282
282
  if (k(p)) {
283
283
  const [y, x] = p.getStartEndPoints(), [l, c] = [
284
284
  y.getNode(),
285
285
  x.getNode()
286
286
  ], [d, g] = $t(p), f = on(
287
- t,
287
+ n,
288
288
  l,
289
289
  d,
290
290
  c,
@@ -293,31 +293,31 @@ function Bn({ editor: t }) {
293
293
  e(Tn(f));
294
294
  }
295
295
  });
296
- }, [t, i]), b(() => {
296
+ }, [n, r]), b(() => {
297
297
  var p;
298
- a ? (o(
298
+ s ? (o(
299
299
  xn(
300
- a,
301
- r,
300
+ s,
301
+ i,
302
302
  Dn
303
303
  )
304
304
  ), setTimeout(() => {
305
305
  var y;
306
- (y = r.current) == null || y.classList.add("visible");
307
- }, 50)) : (p = r.current) == null || p.classList.remove("visible");
308
- }, [a]), Dt(() => {
309
- if (r.current) {
310
- const p = window.getComputedStyle(r.current), y = parseFloat(p.width);
311
- A(y);
306
+ (y = i.current) == null || y.classList.add("visible");
307
+ }, 50)) : (p = i.current) == null || p.classList.remove("visible");
308
+ }, [s]), Dt(() => {
309
+ if (i.current) {
310
+ const p = window.getComputedStyle(i.current), y = parseFloat(p.width);
311
+ L(y);
312
312
  }
313
- }, [a]), a && (u ? /* @__PURE__ */ h(
313
+ }, [s]), s && (u ? /* @__PURE__ */ h(
314
314
  _n,
315
315
  {
316
316
  style: {
317
317
  position: "absolute",
318
- top: n.y,
319
- left: n.x,
320
- width: T
318
+ top: t.y,
319
+ left: t.x,
320
+ width: A
321
321
  },
322
322
  closeToolbar: () => {
323
323
  m(!1), e(null);
@@ -325,25 +325,25 @@ function Bn({ editor: t }) {
325
325
  existingLinkURL: S
326
326
  }
327
327
  ) : /* @__PURE__ */ D(
328
- _e,
328
+ Be,
329
329
  {
330
330
  style: {
331
331
  position: "absolute",
332
- top: n.y,
333
- left: n.x
332
+ top: t.y,
333
+ left: t.x
334
334
  },
335
335
  "aria-label": "Text formatting",
336
336
  id: "inline-toolbar",
337
- ref: r,
337
+ ref: i,
338
338
  children: [
339
339
  /* @__PURE__ */ D(oe, { "aria-label": "Style", children: [
340
340
  /* @__PURE__ */ h(
341
341
  ne,
342
342
  {
343
343
  "aria-label": "Bold",
344
- isSelected: i.isBold,
345
- isDisabled: i.isCode || i.isHeadingOne || i.isHeadingTwo || i.isHeadingThree,
346
- onChange: () => t.dispatchCommand(xe, "bold"),
344
+ isSelected: r.isBold,
345
+ isDisabled: r.isCode || r.isHeadingOne || r.isHeadingTwo || r.isHeadingThree,
346
+ onChange: () => n.dispatchCommand(Ae, "bold"),
347
347
  children: /* @__PURE__ */ h(jt, { size: K })
348
348
  }
349
349
  ),
@@ -351,9 +351,9 @@ function Bn({ editor: t }) {
351
351
  ne,
352
352
  {
353
353
  "aria-label": "Italic",
354
- isSelected: i.isItalic,
355
- isDisabled: i.isCode || i.isHeadingOne,
356
- onChange: () => t.dispatchCommand(xe, "italic"),
354
+ isSelected: r.isItalic,
355
+ isDisabled: r.isCode || r.isHeadingOne,
356
+ onChange: () => n.dispatchCommand(Ae, "italic"),
357
357
  children: /* @__PURE__ */ h(Yt, { size: K })
358
358
  }
359
359
  ),
@@ -361,21 +361,21 @@ function Bn({ editor: t }) {
361
361
  ne,
362
362
  {
363
363
  "aria-label": "inline-code",
364
- isDisabled: i.isHeadingOne,
365
- isSelected: i.isCode,
366
- onChange: () => t.dispatchCommand(xe, "code"),
364
+ isDisabled: r.isHeadingOne,
365
+ isSelected: r.isCode,
366
+ onChange: () => n.dispatchCommand(Ae, "code"),
367
367
  children: /* @__PURE__ */ h(Zt, { size: K })
368
368
  }
369
369
  )
370
370
  ] }),
371
- /* @__PURE__ */ h(Ge, { orientation: "vertical" }),
371
+ /* @__PURE__ */ h(Ke, { orientation: "vertical" }),
372
372
  /* @__PURE__ */ D(oe, { "aria-label": "Text Blocks", children: [
373
373
  /* @__PURE__ */ h(
374
374
  ne,
375
375
  {
376
376
  "aria-label": "Heading",
377
- isSelected: i.isHeadingOne || i.isHeadingTwo || i.isHeadingThree,
378
- onChange: () => t.dispatchCommand(lt, i),
377
+ isSelected: r.isHeadingOne || r.isHeadingTwo || r.isHeadingThree,
378
+ onChange: () => n.dispatchCommand(lt, r),
379
379
  children: /* @__PURE__ */ h(Qt, { size: K })
380
380
  }
381
381
  ),
@@ -383,18 +383,18 @@ function Bn({ editor: t }) {
383
383
  ne,
384
384
  {
385
385
  "aria-label": "Quote",
386
- isSelected: i.isQuote,
387
- onChange: () => t.dispatchCommand(ct, i),
386
+ isSelected: r.isQuote,
387
+ onChange: () => n.dispatchCommand(ct, r),
388
388
  children: /* @__PURE__ */ h(Xt, { size: K })
389
389
  }
390
390
  )
391
391
  ] }),
392
- /* @__PURE__ */ h(Ge, { orientation: "vertical" }),
392
+ /* @__PURE__ */ h(Ke, { orientation: "vertical" }),
393
393
  /* @__PURE__ */ h(oe, { "aria-label": "Links", children: /* @__PURE__ */ h(
394
394
  q,
395
395
  {
396
396
  onPress: () => m(!0),
397
- isDisabled: i.isHeadingOne,
397
+ isDisabled: r.isHeadingOne,
398
398
  children: /* @__PURE__ */ h(Vt, { size: K })
399
399
  }
400
400
  ) }),
@@ -405,36 +405,40 @@ function Bn({ editor: t }) {
405
405
  }
406
406
  const Hn = document.body;
407
407
  function Rn() {
408
- const [t, a] = O(!1), [e] = M();
409
- return b(() => e.registerCommand(
408
+ const [n, s] = O(!1), [e] = M();
409
+ return b(() => e.registerEditableListener((t) => {
410
+ t || s(!1);
411
+ }), [e]), b(() => e.registerCommand(
410
412
  Y,
411
413
  () => {
412
- const o = F();
414
+ if (!e.isEditable())
415
+ return s(!1), !1;
416
+ const o = $();
413
417
  if (!k(o) || o.isCollapsed())
414
- return a(!1), !1;
415
- const r = o.getNodes(), i = r.some((m) => V(m)), s = r.length === 1 && (X(r[0]) || I(r[0], W)), u = r.some(
416
- (m) => I(m, me)
418
+ return s(!1), !1;
419
+ const i = o.getNodes(), r = i.some((m) => V(m)), a = i.length === 1 && (X(i[0]) || I(i[0], W)), u = i.some(
420
+ (m) => I(m, ve)
417
421
  );
418
- return a(!i && !s && !u), !1;
422
+ return s(!r && !a && !u), !1;
419
423
  },
420
- $
424
+ F
421
425
  ), [e]), b(() => e.registerCommand(
422
- be,
426
+ ae,
423
427
  () => (setTimeout(() => {
424
- const o = document.getElementById("inline-toolbar"), r = document.getElementById("link-toolbar"), i = document.activeElement;
425
- o && (o === i || o.contains(i)) || r && (r === i || r.contains(i)) || a(!1);
428
+ const o = document.getElementById("inline-toolbar"), i = document.getElementById("link-toolbar"), r = document.activeElement;
429
+ o && (o === r || o.contains(r)) || i && (i === r || i.contains(r)) || s(!1);
426
430
  }, 0), !1),
427
- $
428
- ), [e]), t && Pe(/* @__PURE__ */ h(Bn, { editor: e }), Hn);
431
+ F
432
+ ), [e]), n && De(/* @__PURE__ */ h(Bn, { editor: e }), Hn);
429
433
  }
430
- var Ze = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
431
- function zn(t) {
432
- return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
434
+ var Xe = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
435
+ function zn(n) {
436
+ return n && n.__esModule && Object.prototype.hasOwnProperty.call(n, "default") ? n.default : n;
433
437
  }
434
- var $e = { exports: {} }, Qe;
438
+ var Fe = { exports: {} }, Ve;
435
439
  function Gn() {
436
- return Qe || (Qe = 1, function(t) {
437
- var a = typeof window < "u" ? window : typeof WorkerGlobalScope < "u" && self instanceof WorkerGlobalScope ? self : {};
440
+ return Ve || (Ve = 1, function(n) {
441
+ var s = typeof window < "u" ? window : typeof WorkerGlobalScope < "u" && self instanceof WorkerGlobalScope ? self : {};
438
442
  /**
439
443
  * Prism: Lightweight, robust, elegant syntax highlighting
440
444
  *
@@ -443,8 +447,8 @@ function Gn() {
443
447
  * @namespace
444
448
  * @public
445
449
  */
446
- var e = function(n) {
447
- var o = /(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i, r = 0, i = {}, s = {
450
+ var e = function(t) {
451
+ var o = /(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i, i = 0, r = {}, a = {
448
452
  /**
449
453
  * By default, Prism will attempt to highlight all code elements (by calling {@link Prism.highlightAll}) on the
450
454
  * current page after the page finished loading. This might be a problem if e.g. you wanted to asynchronously load
@@ -466,7 +470,7 @@ function Gn() {
466
470
  * @memberof Prism
467
471
  * @public
468
472
  */
469
- manual: n.Prism && n.Prism.manual,
473
+ manual: t.Prism && t.Prism.manual,
470
474
  /**
471
475
  * By default, if Prism is in a web worker, it assumes that it is in a worker it created itself, so it uses
472
476
  * `addEventListener` to communicate with its parent instance. However, if you're using Prism manually in your
@@ -488,7 +492,7 @@ function Gn() {
488
492
  * @memberof Prism
489
493
  * @public
490
494
  */
491
- disableWorkerMessageHandler: n.Prism && n.Prism.disableWorkerMessageHandler,
495
+ disableWorkerMessageHandler: t.Prism && t.Prism.disableWorkerMessageHandler,
492
496
  /**
493
497
  * A namespace for utility methods.
494
498
  *
@@ -528,7 +532,7 @@ function Gn() {
528
532
  * @returns {number}
529
533
  */
530
534
  objId: function(l) {
531
- return l.__id || Object.defineProperty(l, "__id", { value: ++r }), l.__id;
535
+ return l.__id || Object.defineProperty(l, "__id", { value: ++i }), l.__id;
532
536
  },
533
537
  /**
534
538
  * Creates a deep clone of the given object.
@@ -543,9 +547,9 @@ function Gn() {
543
547
  clone: function l(c, d) {
544
548
  d = d || {};
545
549
  var g, f;
546
- switch (s.util.type(c)) {
550
+ switch (a.util.type(c)) {
547
551
  case "Object":
548
- if (f = s.util.objId(c), d[f])
552
+ if (f = a.util.objId(c), d[f])
549
553
  return d[f];
550
554
  g = /** @type {Record<string, any>} */
551
555
  {}, d[f] = g;
@@ -556,10 +560,10 @@ function Gn() {
556
560
  g
557
561
  );
558
562
  case "Array":
559
- return f = s.util.objId(c), d[f] ? d[f] : (g = [], d[f] = g, /** @type {Array} */
563
+ return f = a.util.objId(c), d[f] ? d[f] : (g = [], d[f] = g, /** @type {Array} */
560
564
  /** @type {any} */
561
- c.forEach(function(E, v) {
562
- g[v] = l(E, d);
565
+ c.forEach(function(N, v) {
566
+ g[v] = l(N, d);
563
567
  }), /** @type {any} */
564
568
  g);
565
569
  default:
@@ -663,10 +667,10 @@ function Gn() {
663
667
  /**
664
668
  * The grammar for plain, unformatted text.
665
669
  */
666
- plain: i,
667
- plaintext: i,
668
- text: i,
669
- txt: i,
670
+ plain: r,
671
+ plaintext: r,
672
+ text: r,
673
+ txt: r,
670
674
  /**
671
675
  * Creates a deep copy of the language with the given id and appends the given tokens.
672
676
  *
@@ -696,7 +700,7 @@ function Gn() {
696
700
  * });
697
701
  */
698
702
  extend: function(l, c) {
699
- var d = s.util.clone(s.languages[l]);
703
+ var d = a.util.clone(a.languages[l]);
700
704
  for (var g in c)
701
705
  d[g] = c[g];
702
706
  return d;
@@ -778,29 +782,29 @@ function Gn() {
778
782
  */
779
783
  insertBefore: function(l, c, d, g) {
780
784
  g = g || /** @type {any} */
781
- s.languages;
785
+ a.languages;
782
786
  var f = g[l], C = {};
783
- for (var E in f)
784
- if (f.hasOwnProperty(E)) {
785
- if (E == c)
787
+ for (var N in f)
788
+ if (f.hasOwnProperty(N)) {
789
+ if (N == c)
786
790
  for (var v in d)
787
791
  d.hasOwnProperty(v) && (C[v] = d[v]);
788
- d.hasOwnProperty(E) || (C[E] = f[E]);
792
+ d.hasOwnProperty(N) || (C[N] = f[N]);
789
793
  }
790
794
  var w = g[l];
791
- return g[l] = C, s.languages.DFS(s.languages, function(P, z) {
795
+ return g[l] = C, a.languages.DFS(a.languages, function(P, z) {
792
796
  z === w && P != l && (this[P] = C);
793
797
  }), C;
794
798
  },
795
799
  // Traverse a language definition with Depth First Search
796
800
  DFS: function l(c, d, g, f) {
797
801
  f = f || {};
798
- var C = s.util.objId;
799
- for (var E in c)
800
- if (c.hasOwnProperty(E)) {
801
- d.call(c, E, c[E], g || E);
802
- var v = c[E], w = s.util.type(v);
803
- w === "Object" && !f[C(v)] ? (f[C(v)] = !0, l(v, d, null, f)) : w === "Array" && !f[C(v)] && (f[C(v)] = !0, l(v, d, E, f));
802
+ var C = a.util.objId;
803
+ for (var N in c)
804
+ if (c.hasOwnProperty(N)) {
805
+ d.call(c, N, c[N], g || N);
806
+ var v = c[N], w = a.util.type(v);
807
+ w === "Object" && !f[C(v)] ? (f[C(v)] = !0, l(v, d, null, f)) : w === "Array" && !f[C(v)] && (f[C(v)] = !0, l(v, d, N, f));
804
808
  }
805
809
  }
806
810
  },
@@ -818,7 +822,7 @@ function Gn() {
818
822
  * @public
819
823
  */
820
824
  highlightAll: function(l, c) {
821
- s.highlightAllUnder(document, l, c);
825
+ a.highlightAllUnder(document, l, c);
822
826
  },
823
827
  /**
824
828
  * Fetches all the descendants of `container` that have a `.language-xxxx` class and then calls
@@ -841,9 +845,9 @@ function Gn() {
841
845
  container: l,
842
846
  selector: 'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'
843
847
  };
844
- s.hooks.run("before-highlightall", g), g.elements = Array.prototype.slice.apply(g.container.querySelectorAll(g.selector)), s.hooks.run("before-all-elements-highlight", g);
848
+ a.hooks.run("before-highlightall", g), g.elements = Array.prototype.slice.apply(g.container.querySelectorAll(g.selector)), a.hooks.run("before-all-elements-highlight", g);
845
849
  for (var f = 0, C; C = g.elements[f++]; )
846
- s.highlightElement(C, c === !0, g.callback);
850
+ a.highlightElement(C, c === !0, g.callback);
847
851
  },
848
852
  /**
849
853
  * Highlights the code inside a single element.
@@ -874,29 +878,29 @@ function Gn() {
874
878
  * @public
875
879
  */
876
880
  highlightElement: function(l, c, d) {
877
- var g = s.util.getLanguage(l), f = s.languages[g];
878
- s.util.setLanguage(l, g);
881
+ var g = a.util.getLanguage(l), f = a.languages[g];
882
+ a.util.setLanguage(l, g);
879
883
  var C = l.parentElement;
880
- C && C.nodeName.toLowerCase() === "pre" && s.util.setLanguage(C, g);
881
- var E = l.textContent, v = {
884
+ C && C.nodeName.toLowerCase() === "pre" && a.util.setLanguage(C, g);
885
+ var N = l.textContent, v = {
882
886
  element: l,
883
887
  language: g,
884
888
  grammar: f,
885
- code: E
889
+ code: N
886
890
  };
887
891
  function w(z) {
888
- v.highlightedCode = z, s.hooks.run("before-insert", v), v.element.innerHTML = v.highlightedCode, s.hooks.run("after-highlight", v), s.hooks.run("complete", v), d && d.call(v.element);
892
+ v.highlightedCode = z, a.hooks.run("before-insert", v), v.element.innerHTML = v.highlightedCode, a.hooks.run("after-highlight", v), a.hooks.run("complete", v), d && d.call(v.element);
889
893
  }
890
- if (s.hooks.run("before-sanity-check", v), C = v.element.parentElement, C && C.nodeName.toLowerCase() === "pre" && !C.hasAttribute("tabindex") && C.setAttribute("tabindex", "0"), !v.code) {
891
- s.hooks.run("complete", v), d && d.call(v.element);
894
+ if (a.hooks.run("before-sanity-check", v), C = v.element.parentElement, C && C.nodeName.toLowerCase() === "pre" && !C.hasAttribute("tabindex") && C.setAttribute("tabindex", "0"), !v.code) {
895
+ a.hooks.run("complete", v), d && d.call(v.element);
892
896
  return;
893
897
  }
894
- if (s.hooks.run("before-highlight", v), !v.grammar) {
895
- w(s.util.encode(v.code));
898
+ if (a.hooks.run("before-highlight", v), !v.grammar) {
899
+ w(a.util.encode(v.code));
896
900
  return;
897
901
  }
898
- if (c && n.Worker) {
899
- var P = new Worker(s.filename);
902
+ if (c && t.Worker) {
903
+ var P = new Worker(a.filename);
900
904
  P.onmessage = function(z) {
901
905
  w(z.data);
902
906
  }, P.postMessage(JSON.stringify({
@@ -905,7 +909,7 @@ function Gn() {
905
909
  immediateClose: !0
906
910
  }));
907
911
  } else
908
- w(s.highlight(v.code, v.grammar, v.language));
912
+ w(a.highlight(v.code, v.grammar, v.language));
909
913
  },
910
914
  /**
911
915
  * Low-level function, only use if you know what you’re doing. It accepts a string of text as input
@@ -933,9 +937,9 @@ function Gn() {
933
937
  grammar: c,
934
938
  language: d
935
939
  };
936
- if (s.hooks.run("before-tokenize", g), !g.grammar)
940
+ if (a.hooks.run("before-tokenize", g), !g.grammar)
937
941
  throw new Error('The language "' + g.language + '" has no grammar.');
938
- return g.tokens = s.tokenize(g.code, g.grammar), s.hooks.run("after-tokenize", g), u.stringify(s.util.encode(g.tokens), g.language);
942
+ return g.tokens = a.tokenize(g.code, g.grammar), a.hooks.run("after-tokenize", g), u.stringify(a.util.encode(g.tokens), g.language);
939
943
  },
940
944
  /**
941
945
  * This is the heart of Prism, and the most low-level function you can use. It accepts a string of text as input
@@ -968,8 +972,8 @@ function Gn() {
968
972
  c[g] = d[g];
969
973
  delete c.rest;
970
974
  }
971
- var f = new A();
972
- return S(f, f.head, l), T(l, f, c, f.head, 0), N(f);
975
+ var f = new L();
976
+ return S(f, f.head, l), A(l, f, c, f.head, 0), E(f);
973
977
  },
974
978
  /**
975
979
  * @namespace
@@ -991,7 +995,7 @@ function Gn() {
991
995
  * @public
992
996
  */
993
997
  add: function(l, c) {
994
- var d = s.hooks.all;
998
+ var d = a.hooks.all;
995
999
  d[l] = d[l] || [], d[l].push(c);
996
1000
  },
997
1001
  /**
@@ -1004,7 +1008,7 @@ function Gn() {
1004
1008
  * @public
1005
1009
  */
1006
1010
  run: function(l, c) {
1007
- var d = s.hooks.all[l];
1011
+ var d = a.hooks.all[l];
1008
1012
  if (!(!d || !d.length))
1009
1013
  for (var g = 0, f; f = d[g++]; )
1010
1014
  f(c);
@@ -1012,7 +1016,7 @@ function Gn() {
1012
1016
  },
1013
1017
  Token: u
1014
1018
  };
1015
- n.Prism = s;
1019
+ t.Prism = a;
1016
1020
  function u(l, c, d, g) {
1017
1021
  this.type = l, this.content = c, this.alias = d, this.length = (g || "").length | 0;
1018
1022
  }
@@ -1033,11 +1037,11 @@ function Gn() {
1033
1037
  attributes: {},
1034
1038
  language: d
1035
1039
  }, C = c.alias;
1036
- C && (Array.isArray(C) ? Array.prototype.push.apply(f.classes, C) : f.classes.push(C)), s.hooks.run("wrap", f);
1037
- var E = "";
1040
+ C && (Array.isArray(C) ? Array.prototype.push.apply(f.classes, C) : f.classes.push(C)), a.hooks.run("wrap", f);
1041
+ var N = "";
1038
1042
  for (var v in f.attributes)
1039
- E += " " + v + '="' + (f.attributes[v] || "").replace(/"/g, "&quot;") + '"';
1040
- return "<" + f.tag + ' class="' + f.classes.join(" ") + '"' + E + ">" + f.content + "</" + f.tag + ">";
1043
+ N += " " + v + '="' + (f.attributes[v] || "").replace(/"/g, "&quot;") + '"';
1044
+ return "<" + f.tag + ' class="' + f.classes.join(" ") + '"' + N + ">" + f.content + "</" + f.tag + ">";
1041
1045
  };
1042
1046
  function m(l, c, d, g) {
1043
1047
  l.lastIndex = c;
@@ -1048,56 +1052,56 @@ function Gn() {
1048
1052
  }
1049
1053
  return f;
1050
1054
  }
1051
- function T(l, c, d, g, f, C) {
1052
- for (var E in d)
1053
- if (!(!d.hasOwnProperty(E) || !d[E])) {
1054
- var v = d[E];
1055
+ function A(l, c, d, g, f, C) {
1056
+ for (var N in d)
1057
+ if (!(!d.hasOwnProperty(N) || !d[N])) {
1058
+ var v = d[N];
1055
1059
  v = Array.isArray(v) ? v : [v];
1056
1060
  for (var w = 0; w < v.length; ++w) {
1057
- if (C && C.cause == E + "," + w)
1061
+ if (C && C.cause == N + "," + w)
1058
1062
  return;
1059
- var P = v[w], z = P.inside, Be = !!P.lookbehind, He = !!P.greedy, vt = P.alias;
1060
- if (He && !P.pattern.global) {
1063
+ var P = v[w], z = P.inside, Re = !!P.lookbehind, ze = !!P.greedy, vt = P.alias;
1064
+ if (ze && !P.pattern.global) {
1061
1065
  var Ct = P.pattern.toString().match(/[imsuy]*$/)[0];
1062
1066
  P.pattern = RegExp(P.pattern.source, Ct + "g");
1063
1067
  }
1064
- for (var Re = P.pattern || P, _ = g.next, R = f; _ !== c.tail && !(C && R >= C.reach); R += _.value.length, _ = _.next) {
1068
+ for (var Ge = P.pattern || P, _ = g.next, R = f; _ !== c.tail && !(C && R >= C.reach); R += _.value.length, _ = _.next) {
1065
1069
  var Q = _.value;
1066
1070
  if (c.length > l.length)
1067
1071
  return;
1068
1072
  if (!(Q instanceof u)) {
1069
- var ae = 1, H;
1070
- if (He) {
1071
- if (H = m(Re, R, l, Be), !H || H.index >= l.length)
1073
+ var le = 1, H;
1074
+ if (ze) {
1075
+ if (H = m(Ge, R, l, Re), !H || H.index >= l.length)
1072
1076
  break;
1073
- var le = H.index, yt = H.index + H[0].length, G = R;
1074
- for (G += _.value.length; le >= G; )
1077
+ var ce = H.index, yt = H.index + H[0].length, G = R;
1078
+ for (G += _.value.length; ce >= G; )
1075
1079
  _ = _.next, G += _.value.length;
1076
1080
  if (G -= _.value.length, R = G, _.value instanceof u)
1077
1081
  continue;
1078
1082
  for (var te = _; te !== c.tail && (G < yt || typeof te.value == "string"); te = te.next)
1079
- ae++, G += te.value.length;
1080
- ae--, Q = l.slice(R, G), H.index -= R;
1081
- } else if (H = m(Re, 0, Q, Be), !H)
1083
+ le++, G += te.value.length;
1084
+ le--, Q = l.slice(R, G), H.index -= R;
1085
+ } else if (H = m(Ge, 0, Q, Re), !H)
1082
1086
  continue;
1083
- var le = H.index, ce = H[0], ye = Q.slice(0, le), ze = Q.slice(le + ce.length), Ne = R + Q.length;
1084
- C && Ne > C.reach && (C.reach = Ne);
1085
- var ue = _.prev;
1086
- ye && (ue = S(c, ue, ye), R += ye.length), L(c, ue, ae);
1087
- var Nt = new u(E, z ? s.tokenize(ce, z) : ce, vt, ce);
1088
- if (_ = S(c, ue, Nt), ze && S(c, _, ze), ae > 1) {
1089
- var Ee = {
1090
- cause: E + "," + w,
1091
- reach: Ne
1087
+ var ce = H.index, ue = H[0], Ne = Q.slice(0, ce), We = Q.slice(ce + ue.length), xe = R + Q.length;
1088
+ C && xe > C.reach && (C.reach = xe);
1089
+ var de = _.prev;
1090
+ Ne && (de = S(c, de, Ne), R += Ne.length), T(c, de, le);
1091
+ var Et = new u(N, z ? a.tokenize(ue, z) : ue, vt, ue);
1092
+ if (_ = S(c, de, Et), We && S(c, _, We), le > 1) {
1093
+ var Te = {
1094
+ cause: N + "," + w,
1095
+ reach: xe
1092
1096
  };
1093
- T(l, c, d, _.prev, R, Ee), C && Ee.reach > C.reach && (C.reach = Ee.reach);
1097
+ A(l, c, d, _.prev, R, Te), C && Te.reach > C.reach && (C.reach = Te.reach);
1094
1098
  }
1095
1099
  }
1096
1100
  }
1097
1101
  }
1098
1102
  }
1099
1103
  }
1100
- function A() {
1104
+ function L() {
1101
1105
  var l = { value: null, prev: null, next: null }, c = { value: null, prev: l, next: null };
1102
1106
  l.next = c, this.head = l, this.tail = c, this.length = 0;
1103
1107
  }
@@ -1105,33 +1109,33 @@ function Gn() {
1105
1109
  var g = c.next, f = { value: d, prev: c, next: g };
1106
1110
  return c.next = f, g.prev = f, l.length++, f;
1107
1111
  }
1108
- function L(l, c, d) {
1112
+ function T(l, c, d) {
1109
1113
  for (var g = c.next, f = 0; f < d && g !== l.tail; f++)
1110
1114
  g = g.next;
1111
1115
  c.next = g, g.prev = c, l.length -= f;
1112
1116
  }
1113
- function N(l) {
1117
+ function E(l) {
1114
1118
  for (var c = [], d = l.head.next; d !== l.tail; )
1115
1119
  c.push(d.value), d = d.next;
1116
1120
  return c;
1117
1121
  }
1118
- if (!n.document)
1119
- return n.addEventListener && (s.disableWorkerMessageHandler || n.addEventListener("message", function(l) {
1122
+ if (!t.document)
1123
+ return t.addEventListener && (a.disableWorkerMessageHandler || t.addEventListener("message", function(l) {
1120
1124
  var c = JSON.parse(l.data), d = c.language, g = c.code, f = c.immediateClose;
1121
- n.postMessage(s.highlight(g, s.languages[d], d)), f && n.close();
1122
- }, !1)), s;
1123
- var p = s.util.currentScript();
1124
- p && (s.filename = p.src, p.hasAttribute("data-manual") && (s.manual = !0));
1125
+ t.postMessage(a.highlight(g, a.languages[d], d)), f && t.close();
1126
+ }, !1)), a;
1127
+ var p = a.util.currentScript();
1128
+ p && (a.filename = p.src, p.hasAttribute("data-manual") && (a.manual = !0));
1125
1129
  function y() {
1126
- s.manual || s.highlightAll();
1130
+ a.manual || a.highlightAll();
1127
1131
  }
1128
- if (!s.manual) {
1132
+ if (!a.manual) {
1129
1133
  var x = document.readyState;
1130
1134
  x === "loading" || x === "interactive" && p && p.defer ? document.addEventListener("DOMContentLoaded", y) : window.requestAnimationFrame ? window.requestAnimationFrame(y) : window.setTimeout(y, 16);
1131
1135
  }
1132
- return s;
1133
- }(a);
1134
- t.exports && (t.exports = e), typeof Ze < "u" && (Ze.Prism = e), e.languages.markup = {
1136
+ return a;
1137
+ }(s);
1138
+ n.exports && (n.exports = e), typeof Xe < "u" && (Xe.Prism = e), e.languages.markup = {
1135
1139
  comment: {
1136
1140
  pattern: /<!--(?:(?!<!--)[\s\S])*?-->/,
1137
1141
  greedy: !0
@@ -1208,8 +1212,8 @@ function Gn() {
1208
1212
  },
1209
1213
  /&#x?[\da-f]{1,8};/i
1210
1214
  ]
1211
- }, e.languages.markup.tag.inside["attr-value"].inside.entity = e.languages.markup.entity, e.languages.markup.doctype.inside["internal-subset"].inside = e.languages.markup, e.hooks.add("wrap", function(n) {
1212
- n.type === "entity" && (n.attributes.title = n.content.replace(/&amp;/, "&"));
1215
+ }, e.languages.markup.tag.inside["attr-value"].inside.entity = e.languages.markup.entity, e.languages.markup.doctype.inside["internal-subset"].inside = e.languages.markup, e.hooks.add("wrap", function(t) {
1216
+ t.type === "entity" && (t.attributes.title = t.content.replace(/&amp;/, "&"));
1213
1217
  }), Object.defineProperty(e.languages.markup.tag, "addInlined", {
1214
1218
  /**
1215
1219
  * Adds an inlined language to markup.
@@ -1222,22 +1226,22 @@ function Gn() {
1222
1226
  * @example
1223
1227
  * addInlined('style', 'css');
1224
1228
  */
1225
- value: function(o, r) {
1226
- var i = {};
1227
- i["language-" + r] = {
1229
+ value: function(o, i) {
1230
+ var r = {};
1231
+ r["language-" + i] = {
1228
1232
  pattern: /(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,
1229
1233
  lookbehind: !0,
1230
- inside: e.languages[r]
1231
- }, i.cdata = /^<!\[CDATA\[|\]\]>$/i;
1232
- var s = {
1234
+ inside: e.languages[i]
1235
+ }, r.cdata = /^<!\[CDATA\[|\]\]>$/i;
1236
+ var a = {
1233
1237
  "included-cdata": {
1234
1238
  pattern: /<!\[CDATA\[[\s\S]*?\]\]>/i,
1235
- inside: i
1239
+ inside: r
1236
1240
  }
1237
1241
  };
1238
- s["language-" + r] = {
1242
+ a["language-" + i] = {
1239
1243
  pattern: /[\s\S]+/,
1240
- inside: e.languages[r]
1244
+ inside: e.languages[i]
1241
1245
  };
1242
1246
  var u = {};
1243
1247
  u[o] = {
@@ -1246,7 +1250,7 @@ function Gn() {
1246
1250
  }), "i"),
1247
1251
  lookbehind: !0,
1248
1252
  greedy: !0,
1249
- inside: s
1253
+ inside: a
1250
1254
  }, e.languages.insertBefore("markup", "cdata", u);
1251
1255
  }
1252
1256
  }), Object.defineProperty(e.languages.markup.tag, "addAttribute", {
@@ -1261,10 +1265,10 @@ function Gn() {
1261
1265
  * @example
1262
1266
  * addAttribute('style', 'css');
1263
1267
  */
1264
- value: function(n, o) {
1268
+ value: function(t, o) {
1265
1269
  e.languages.markup.tag.inside["special-attr"].push({
1266
1270
  pattern: RegExp(
1267
- /(^|["'\s])/.source + "(?:" + n + ")" + /\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,
1271
+ /(^|["'\s])/.source + "(?:" + t + ")" + /\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,
1268
1272
  "i"
1269
1273
  ),
1270
1274
  lookbehind: !0,
@@ -1291,9 +1295,9 @@ function Gn() {
1291
1295
  }
1292
1296
  });
1293
1297
  }
1294
- }), e.languages.html = e.languages.markup, e.languages.mathml = e.languages.markup, e.languages.svg = e.languages.markup, e.languages.xml = e.languages.extend("markup", {}), e.languages.ssml = e.languages.xml, e.languages.atom = e.languages.xml, e.languages.rss = e.languages.xml, function(n) {
1298
+ }), e.languages.html = e.languages.markup, e.languages.mathml = e.languages.markup, e.languages.svg = e.languages.markup, e.languages.xml = e.languages.extend("markup", {}), e.languages.ssml = e.languages.xml, e.languages.atom = e.languages.xml, e.languages.rss = e.languages.xml, function(t) {
1295
1299
  var o = /(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;
1296
- n.languages.css = {
1300
+ t.languages.css = {
1297
1301
  comment: /\/\*[\s\S]*?\*\//,
1298
1302
  atrule: {
1299
1303
  pattern: RegExp("@[\\w-](?:" + /[^;{\s"']|\s+(?!\s)/.source + "|" + o.source + ")*?" + /(?:;|(?=\s*\{))/.source),
@@ -1342,9 +1346,9 @@ function Gn() {
1342
1346
  lookbehind: !0
1343
1347
  },
1344
1348
  punctuation: /[(){};:,]/
1345
- }, n.languages.css.atrule.inside.rest = n.languages.css;
1346
- var r = n.languages.markup;
1347
- r && (r.tag.addInlined("style", "css"), r.tag.addAttribute("style", "css"));
1349
+ }, t.languages.css.atrule.inside.rest = t.languages.css;
1350
+ var i = t.languages.markup;
1351
+ i && (i.tag.addInlined("style", "css"), i.tag.addAttribute("style", "css"));
1348
1352
  }(e), e.languages.clike = {
1349
1353
  comment: [
1350
1354
  {
@@ -1509,9 +1513,9 @@ function Gn() {
1509
1513
  if (typeof e > "u" || typeof document > "u")
1510
1514
  return;
1511
1515
  Element.prototype.matches || (Element.prototype.matches = Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector);
1512
- var n = "Loading…", o = function(p, y) {
1516
+ var t = "Loading…", o = function(p, y) {
1513
1517
  return "✖ Error " + p + " while fetching file: " + y;
1514
- }, r = "✖ Error: File does not exist or is empty", i = {
1518
+ }, i = "✖ Error: File does not exist or is empty", r = {
1515
1519
  js: "javascript",
1516
1520
  py: "python",
1517
1521
  rb: "ruby",
@@ -1521,14 +1525,14 @@ function Gn() {
1521
1525
  bat: "batch",
1522
1526
  h: "c",
1523
1527
  tex: "latex"
1524
- }, s = "data-src-status", u = "loading", m = "loaded", T = "failed", A = "pre[data-src]:not([" + s + '="' + m + '"]):not([' + s + '="' + u + '"])';
1528
+ }, a = "data-src-status", u = "loading", m = "loaded", A = "failed", L = "pre[data-src]:not([" + a + '="' + m + '"]):not([' + a + '="' + u + '"])';
1525
1529
  function S(p, y, x) {
1526
1530
  var l = new XMLHttpRequest();
1527
1531
  l.open("GET", p, !0), l.onreadystatechange = function() {
1528
- l.readyState == 4 && (l.status < 400 && l.responseText ? y(l.responseText) : l.status >= 400 ? x(o(l.status, l.statusText)) : x(r));
1532
+ l.readyState == 4 && (l.status < 400 && l.responseText ? y(l.responseText) : l.status >= 400 ? x(o(l.status, l.statusText)) : x(i));
1529
1533
  }, l.send(null);
1530
1534
  }
1531
- function L(p) {
1535
+ function T(p) {
1532
1536
  var y = /^\s*(\d+)\s*(?:(,)\s*(?:(\d+)\s*)?)?$/.exec(p || "");
1533
1537
  if (y) {
1534
1538
  var x = Number(y[1]), l = y[2], c = y[3];
@@ -1536,37 +1540,37 @@ function Gn() {
1536
1540
  }
1537
1541
  }
1538
1542
  e.hooks.add("before-highlightall", function(p) {
1539
- p.selector += ", " + A;
1543
+ p.selector += ", " + L;
1540
1544
  }), e.hooks.add("before-sanity-check", function(p) {
1541
1545
  var y = (
1542
1546
  /** @type {HTMLPreElement} */
1543
1547
  p.element
1544
1548
  );
1545
- if (y.matches(A)) {
1546
- p.code = "", y.setAttribute(s, u);
1549
+ if (y.matches(L)) {
1550
+ p.code = "", y.setAttribute(a, u);
1547
1551
  var x = y.appendChild(document.createElement("CODE"));
1548
- x.textContent = n;
1552
+ x.textContent = t;
1549
1553
  var l = y.getAttribute("data-src"), c = p.language;
1550
1554
  if (c === "none") {
1551
1555
  var d = (/\.(\w+)$/.exec(l) || [, "none"])[1];
1552
- c = i[d] || d;
1556
+ c = r[d] || d;
1553
1557
  }
1554
1558
  e.util.setLanguage(x, c), e.util.setLanguage(y, c);
1555
1559
  var g = e.plugins.autoloader;
1556
1560
  g && g.loadLanguages(c), S(
1557
1561
  l,
1558
1562
  function(f) {
1559
- y.setAttribute(s, m);
1560
- var C = L(y.getAttribute("data-range"));
1563
+ y.setAttribute(a, m);
1564
+ var C = T(y.getAttribute("data-range"));
1561
1565
  if (C) {
1562
- var E = f.split(/\r\n?|\n/g), v = C[0], w = C[1] == null ? E.length : C[1];
1563
- v < 0 && (v += E.length), v = Math.max(0, Math.min(v - 1, E.length)), w < 0 && (w += E.length), w = Math.max(0, Math.min(w, E.length)), f = E.slice(v, w).join(`
1566
+ var N = f.split(/\r\n?|\n/g), v = C[0], w = C[1] == null ? N.length : C[1];
1567
+ v < 0 && (v += N.length), v = Math.max(0, Math.min(v - 1, N.length)), w < 0 && (w += N.length), w = Math.max(0, Math.min(w, N.length)), f = N.slice(v, w).join(`
1564
1568
  `), y.hasAttribute("data-start") || y.setAttribute("data-start", String(v + 1));
1565
1569
  }
1566
1570
  x.textContent = f, e.highlightElement(x);
1567
1571
  },
1568
1572
  function(f) {
1569
- y.setAttribute(s, T), x.textContent = f;
1573
+ y.setAttribute(a, A), x.textContent = f;
1570
1574
  }
1571
1575
  );
1572
1576
  }
@@ -1579,64 +1583,64 @@ function Gn() {
1579
1583
  * @param {ParentNode} [container=document]
1580
1584
  */
1581
1585
  highlight: function(y) {
1582
- for (var x = (y || document).querySelectorAll(A), l = 0, c; c = x[l++]; )
1586
+ for (var x = (y || document).querySelectorAll(L), l = 0, c; c = x[l++]; )
1583
1587
  e.highlightElement(c);
1584
1588
  }
1585
1589
  };
1586
- var N = !1;
1590
+ var E = !1;
1587
1591
  e.fileHighlight = function() {
1588
- N || (console.warn("Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead."), N = !0), e.plugins.fileHighlight.highlight.apply(this, arguments);
1592
+ E || (console.warn("Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead."), E = !0), e.plugins.fileHighlight.highlight.apply(this, arguments);
1589
1593
  };
1590
1594
  }();
1591
- }($e)), $e.exports;
1595
+ }(Fe)), Fe.exports;
1592
1596
  }
1593
1597
  var Wn = Gn();
1594
1598
  const Kn = /* @__PURE__ */ zn(Wn);
1595
1599
  typeof globalThis < "u" && (globalThis.Prism = Kn);
1596
- function Un({ codeBlockCoords: t, codeNodeKey: a }) {
1597
- const [e] = M(), [n, o] = O({
1600
+ function Un({ codeBlockCoords: n, codeNodeKey: s }) {
1601
+ const [e] = M(), [t, o] = O({
1598
1602
  x: B,
1599
1603
  y: B
1600
- }), r = ee(null), [i, s] = O(""), u = bn(), m = Array.from(
1601
- new Set(u.map((A) => Le(A)))
1602
- ), T = {};
1603
- return u.forEach((A) => {
1604
- const S = Le(A);
1605
- T[S] || (T[S] = A);
1604
+ }), i = ee(null), [r, a] = O(""), u = bn(), m = Array.from(
1605
+ new Set(u.map((L) => $e(L)))
1606
+ ), A = {};
1607
+ return u.forEach((L) => {
1608
+ const S = $e(L);
1609
+ A[S] || (A[S] = L);
1606
1610
  }), b(() => {
1607
- o(Sn(t, r));
1608
- }, [t]), b(() => {
1611
+ o(Ln(n, i));
1612
+ }, [n]), b(() => {
1609
1613
  e.read(() => {
1610
- if (a) {
1611
- const S = j(a).getLanguage();
1612
- s(Le(S));
1614
+ if (s) {
1615
+ const S = j(s).getLanguage();
1616
+ a($e(S));
1613
1617
  }
1614
1618
  });
1615
- }, [e, a]), /* @__PURE__ */ D(
1619
+ }, [e, s]), /* @__PURE__ */ D(
1616
1620
  Rt,
1617
1621
  {
1618
1622
  id: "code-highlight-menu",
1619
- ref: r,
1623
+ ref: i,
1620
1624
  style: {
1621
1625
  position: "absolute",
1622
- top: n.y,
1623
- left: n.x
1626
+ top: t.y,
1627
+ left: t.x
1624
1628
  },
1625
1629
  "aria-label": "Code menu",
1626
- inputValue: i,
1627
- onInputChange: (A) => {
1628
- const S = T[A];
1630
+ inputValue: r,
1631
+ onInputChange: (L) => {
1632
+ const S = A[L];
1629
1633
  e.dispatchCommand(ft, [
1630
- a,
1634
+ s,
1631
1635
  S
1632
- ]), s(A);
1636
+ ]), a(L);
1633
1637
  },
1634
1638
  children: [
1635
1639
  /* @__PURE__ */ D("div", { children: [
1636
1640
  /* @__PURE__ */ h(it, {}),
1637
1641
  /* @__PURE__ */ h(q, { children: /* @__PURE__ */ h(Jt, { size: 24 }) })
1638
1642
  ] }),
1639
- /* @__PURE__ */ h(ot, { children: /* @__PURE__ */ h(zt, { children: m.map((A, S) => /* @__PURE__ */ h(Gt, { children: A }, S)) }) })
1643
+ /* @__PURE__ */ h(ot, { children: /* @__PURE__ */ h(zt, { children: m.map((L, S) => /* @__PURE__ */ h(Gt, { children: L }, S)) }) })
1640
1644
  ]
1641
1645
  }
1642
1646
  );
@@ -1647,106 +1651,106 @@ const qn = document.body, gt = Z(
1647
1651
  "SET_CODE_LANGUAGE_COMMAND"
1648
1652
  );
1649
1653
  function jn() {
1650
- const [t, a] = O(null), [e, n] = O(null), [o, r] = O(!1), [i, s] = O(!1), [u] = M(), m = de(() => {
1651
- a(null), n(null);
1652
- }, []), T = de(() => {
1653
- const L = document.getElementById("code-highlight-menu"), N = document.activeElement;
1654
- return !!(L && N && (L === N || L.contains(N)));
1655
- }, []), A = de(() => {
1656
- const L = T();
1657
- return s(L), L;
1658
- }, [T]), S = de(() => {
1659
- const L = A();
1660
- r(!1), L || m();
1661
- }, [m, A]);
1654
+ const [n, s] = O(null), [e, t] = O(null), [o, i] = O(!1), [r, a] = O(!1), [u] = M(), m = ge(() => {
1655
+ s(null), t(null);
1656
+ }, []), A = ge(() => {
1657
+ const T = document.getElementById("code-highlight-menu"), E = document.activeElement;
1658
+ return !!(T && E && (T === E || T.contains(E)));
1659
+ }, []), L = ge(() => {
1660
+ const T = A();
1661
+ return a(T), T;
1662
+ }, [A]), S = ge(() => {
1663
+ const T = L();
1664
+ i(!1), T || m();
1665
+ }, [m, L]);
1662
1666
  return b(() => u.registerCommand(
1663
1667
  Y,
1664
1668
  () => {
1665
- const N = A(), p = u.getRootElement();
1669
+ const E = L(), p = u.getRootElement();
1666
1670
  if (p) {
1667
1671
  const c = p === document.activeElement || p.contains(document.activeElement);
1668
- r((d) => d === c ? d : c);
1672
+ i((d) => d === c ? d : c);
1669
1673
  }
1670
- const y = F();
1674
+ const y = $();
1671
1675
  if (!k(y))
1672
- return N || m(), !1;
1673
- const x = Ce(y), l = I(x, me);
1676
+ return E || m(), !1;
1677
+ const x = Ee(y), l = I(x, ve);
1674
1678
  if (l) {
1675
1679
  const d = u.getElementByKey(l.getKey()).getBoundingClientRect(), g = d.right, f = d.top + window.scrollY;
1676
- a({ x: g, y: f }), n(l.getKey());
1680
+ s({ x: g, y: f }), t(l.getKey());
1677
1681
  } else
1678
- N || m();
1682
+ E || m();
1679
1683
  return !1;
1680
1684
  },
1681
- $
1682
- ), [u, A, m]), b(() => u.registerCommand(
1683
- be,
1685
+ F
1686
+ ), [u, L, m]), b(() => u.registerCommand(
1687
+ ae,
1684
1688
  () => (setTimeout(S, 0), !1),
1685
- $
1689
+ F
1686
1690
  ), [u, S]), b(() => {
1687
- const L = () => {
1688
- r(!0), s(!1);
1689
- }, N = () => setTimeout(S, 0);
1691
+ const T = () => {
1692
+ i(!0), a(!1);
1693
+ }, E = () => setTimeout(S, 0);
1690
1694
  return u.registerRootListener((p, y) => {
1691
- p && (p.addEventListener("focus", L), p.addEventListener("blur", N)), y && (y.removeEventListener("focus", L), y.removeEventListener("blur", N));
1695
+ p && (p.addEventListener("focus", T), p.addEventListener("blur", E)), y && (y.removeEventListener("focus", T), y.removeEventListener("blur", E));
1692
1696
  });
1693
- }, [u, S]), t && (o || i) && Pe(
1694
- /* @__PURE__ */ h(Un, { codeBlockCoords: t, codeNodeKey: e }),
1697
+ }, [u, S]), n && (o || r) && De(
1698
+ /* @__PURE__ */ h(Un, { codeBlockCoords: n, codeNodeKey: e }),
1695
1699
  qn
1696
1700
  );
1697
1701
  }
1698
1702
  function Yn() {
1699
- const [t] = M();
1700
- return b(() => vn(t), [t]), b(() => t.registerNodeTransform(se, (e) => {
1703
+ const [n] = M();
1704
+ return b(() => vn(n), [n]), b(() => n.registerNodeTransform(se, (e) => {
1701
1705
  if (!e.isSimpleText())
1702
1706
  return;
1703
- const n = e.getTextContent();
1704
- if (n.startsWith("``` ")) {
1705
- const o = e.getPreviousSibling(), r = I(e, J), i = r !== null && r.getChildrenSize() === 1, s = ie(o);
1706
- if (i || s) {
1707
- if (n.length > 4)
1707
+ const t = e.getTextContent();
1708
+ if (t.startsWith("``` ")) {
1709
+ const o = e.getPreviousSibling(), i = I(e, J), r = i !== null && i.getChildrenSize() === 1, a = ie(o);
1710
+ if (r || a) {
1711
+ if (t.length > 4)
1708
1712
  return;
1709
- const u = je();
1713
+ const u = Ze();
1710
1714
  e.replace(u), u.select();
1711
1715
  const m = u.getNextSibling();
1712
1716
  ie(m) && m.remove();
1713
1717
  return;
1714
1718
  }
1715
1719
  }
1716
- }), [t]), b(() => t.registerCommand(
1720
+ }), [n]), b(() => n.registerCommand(
1717
1721
  gt,
1718
1722
  () => {
1719
- const e = ve();
1723
+ const e = ye();
1720
1724
  if (k(e)) {
1721
- const n = je();
1722
- return e.insertNodes([n]), n.selectStart(), setTimeout(() => {
1723
- t.focus();
1725
+ const t = Ze();
1726
+ return e.insertNodes([t]), t.selectStart(), setTimeout(() => {
1727
+ n.focus();
1724
1728
  }, 0), !0;
1725
1729
  }
1726
1730
  return !1;
1727
1731
  },
1728
- $
1729
- ), [t]), b(() => t.registerCommand(
1732
+ F
1733
+ ), [n]), b(() => n.registerCommand(
1730
1734
  ft,
1731
1735
  (e) => {
1732
- const [n, o] = e, r = j(n);
1733
- return me(r) ? (r.setLanguage(o), !0) : !1;
1736
+ const [t, o] = e, i = j(t);
1737
+ return ve(i) ? (i.setLanguage(o), !0) : !1;
1734
1738
  },
1735
- $
1736
- ), [t]), b(() => t.registerCommand(
1737
- Ie,
1739
+ F
1740
+ ), [n]), b(() => n.registerCommand(
1741
+ Oe,
1738
1742
  (e) => {
1739
- const n = F();
1740
- if (!k(n) || !n.isCollapsed())
1743
+ const t = $();
1744
+ if (!k(t) || !t.isCollapsed())
1741
1745
  return !1;
1742
- const o = n.anchor.getNode(), r = I(o, me);
1743
- return r && n.anchor.offset === 0 && r.getTextContent() === "" ? (r.remove(), !0) : !1;
1746
+ const o = t.anchor.getNode(), i = I(o, ve);
1747
+ return i && t.anchor.offset === 0 && i.getTextContent() === "" ? (i.remove(), !0) : !1;
1744
1748
  },
1745
- $
1746
- ), [t]), null;
1749
+ F
1750
+ ), [n]), null;
1747
1751
  }
1748
1752
  function Zn() {
1749
- return /* @__PURE__ */ D(tt, { children: [
1753
+ return /* @__PURE__ */ D(rt, { children: [
1750
1754
  /* @__PURE__ */ h(Yn, {}),
1751
1755
  /* @__PURE__ */ h(jn, {})
1752
1756
  ] });
@@ -1755,121 +1759,130 @@ const ht = Z(
1755
1759
  "INSERT_HORIZONTAL_DIVIDER_COMMAND"
1756
1760
  );
1757
1761
  function Qn() {
1758
- const [t] = M();
1762
+ const [n] = M();
1759
1763
  return b(() => {
1760
- if (!t.hasNodes([gn]))
1764
+ if (!n.hasNodes([gn]))
1761
1765
  throw new Error("HorizontalDividerNode not registered on editor");
1762
- return t.registerCommand(
1766
+ return n.registerCommand(
1763
1767
  ht,
1764
1768
  () => {
1765
- const e = ve();
1769
+ const e = ye();
1766
1770
  if (k(e)) {
1767
- const n = fn();
1768
- e.insertNodes([n]);
1769
- let o = n.getNextSibling() || n.getParent().getNextSibling();
1770
- return o || (o = pe(), n.insertAfter(o)), o.selectStart(), setTimeout(() => {
1771
- t.focus();
1771
+ const t = fn();
1772
+ e.insertNodes([t]);
1773
+ let o = t.getNextSibling() || t.getParent().getNextSibling();
1774
+ return o || (o = Ce(), t.insertAfter(o)), o.selectStart(), setTimeout(() => {
1775
+ n.focus();
1772
1776
  }, 0), !0;
1773
1777
  }
1774
1778
  return !1;
1775
1779
  },
1776
- $
1780
+ F
1777
1781
  );
1778
- }, [t]), null;
1782
+ }, [n]), null;
1779
1783
  }
1780
- const we = Z("INSERT_IMAGE_COMMAND"), Xe = "selected";
1781
- function Ve(t) {
1782
- return t && t.type && t.type.startsWith("image/");
1784
+ const Me = Z("INSERT_IMAGE_COMMAND"), Je = "selected";
1785
+ function et(n) {
1786
+ return n && n.type && n.type.startsWith("image/");
1783
1787
  }
1784
- function Je(t, a) {
1785
- const e = ve() || F();
1788
+ function tt(n, s) {
1789
+ const e = ye() || $();
1786
1790
  if (!k(e))
1787
1791
  return null;
1788
- const n = hn(t, a);
1789
- e.insertNodes([n]);
1790
- let o = n.getNextSibling() || n.getParent().getNextSibling();
1791
- return o || (o = pe(), n.insertAfter(o)), n.select(), n.getKey();
1792
+ const t = hn(n, s);
1793
+ e.insertNodes([t]);
1794
+ let o = t.getNextSibling() || t.getParent().getNextSibling();
1795
+ return o || (o = Ce(), t.insertAfter(o)), t.select(), t.getKey();
1792
1796
  }
1793
- function Xn({ onImageUpload: t }) {
1794
- const [a] = M(), e = ee(null), n = ee(t);
1797
+ function Xn({ onImageUpload: n }) {
1798
+ const [s] = M(), e = ee(null), t = ee(n);
1795
1799
  b(() => {
1796
- n.current = t;
1797
- }, [t]), b(() => {
1798
- if (!a.hasNode(qe))
1800
+ t.current = n;
1801
+ }, [n]), b(() => {
1802
+ if (!s.hasNode(Ye))
1799
1803
  throw new Error("ImagePlugin: ImageNode not registered on editor");
1800
- }, [a]);
1801
- const o = (r, i, s) => {
1802
- const u = n.current;
1803
- u && Promise.resolve().then(() => u(i)).then((m) => {
1804
+ }, [s]);
1805
+ const o = (i, r, a) => {
1806
+ const u = t.current;
1807
+ u && Promise.resolve().then(() => u(r)).then((m) => {
1804
1808
  if (typeof m != "string" || !m)
1805
1809
  throw new Error("onImageUpload must resolve to a URL string");
1806
- a.update(() => {
1807
- const T = j(r);
1808
- Te(T) && (T.setSrc(m), T.setUploadState(re.UPLOADED));
1809
- }), URL.revokeObjectURL(s);
1810
+ s.update(() => {
1811
+ const A = j(i);
1812
+ fe(A) && (A.setSrc(m), A.setUploadState(re.UPLOADED));
1813
+ }), URL.revokeObjectURL(a);
1810
1814
  }).catch((m) => {
1811
- console.error("ImagePlugin: image upload failed", m), a.update(() => {
1812
- const T = j(r);
1813
- Te(T) && T.setUploadState(re.ERROR);
1815
+ console.error("ImagePlugin: image upload failed", m), s.update(() => {
1816
+ const A = j(i);
1817
+ fe(A) && A.setUploadState(re.ERROR);
1814
1818
  });
1815
1819
  });
1816
1820
  };
1817
- return b(() => a.registerCommand(
1818
- we,
1819
- (i) => {
1820
- if (typeof i == "string")
1821
- return Je(i, re.UPLOADED), !0;
1822
- if (i instanceof File && Ve(i)) {
1823
- const s = URL.createObjectURL(i), u = !!n.current, m = Je(
1824
- s,
1821
+ return b(() => s.registerCommand(
1822
+ Me,
1823
+ (r) => {
1824
+ if (typeof r == "string")
1825
+ return tt(r, re.UPLOADED), !0;
1826
+ if (r instanceof File && et(r)) {
1827
+ const a = URL.createObjectURL(r), u = !!t.current, m = tt(
1828
+ a,
1825
1829
  u ? re.UPLOADING : re.UPLOADED
1826
1830
  );
1827
- return m && u && o(m, i, s), !0;
1831
+ return m && u && o(m, r, a), !0;
1828
1832
  }
1829
1833
  return !1;
1830
1834
  },
1831
- $
1832
- ), [a]), b(() => a.registerCommand(
1835
+ F
1836
+ ), [s]), b(() => s.registerCommand(
1833
1837
  Y,
1834
1838
  () => {
1835
- e.current && (e.current.classList.remove(Xe), e.current = null);
1836
- const i = F();
1837
- if (Me(i) && i.getNodes().length === 1) {
1838
- const s = i.getNodes()[0];
1839
- if (Te(s)) {
1840
- const u = a.getElementByKey(s.getKey());
1841
- u.classList.add(Xe), e.current = u;
1839
+ e.current && (e.current.classList.remove(Je), e.current = null);
1840
+ const r = $();
1841
+ if (pe(r) && r.getNodes().length === 1) {
1842
+ const a = r.getNodes()[0];
1843
+ if (fe(a)) {
1844
+ const u = s.getElementByKey(a.getKey());
1845
+ u.classList.add(Je), e.current = u;
1842
1846
  }
1843
1847
  }
1844
1848
  return !1;
1845
1849
  },
1846
- nt
1847
- ), [a]), b(() => a.registerCommand(
1848
- Oe,
1849
- (i) => {
1850
- const s = i.clipboardData;
1851
- if (!s) return !1;
1852
- const u = Array.from(s.files).filter(Ve);
1850
+ ke
1851
+ ), [s]), b(() => s.registerCommand(
1852
+ ae,
1853
+ () => {
1854
+ const r = $();
1855
+ return pe(r) && r.getNodes().length === 1 && fe(r.getNodes()[0]) && Pe(null), !1;
1856
+ },
1857
+ ke
1858
+ ), [s]), b(() => s.registerCommand(
1859
+ _e,
1860
+ (r) => {
1861
+ const a = r.clipboardData;
1862
+ if (!a) return !1;
1863
+ const u = Array.from(a.files).filter(et);
1853
1864
  if (u.length !== 1) return !1;
1854
- const m = F() || ve();
1855
- return k(m) ? (i.preventDefault(), a.dispatchCommand(we, u[0]), !0) : !1;
1865
+ const m = $() || ye();
1866
+ return k(m) ? (r.preventDefault(), s.dispatchCommand(Me, u[0]), !0) : !1;
1856
1867
  },
1857
- $
1858
- ), [a]), /* @__PURE__ */ h(
1859
- De,
1868
+ F
1869
+ ), [s]), /* @__PURE__ */ h(
1870
+ He,
1860
1871
  {
1861
- nodeType: qe,
1872
+ nodeType: Ye,
1862
1873
  eventType: "click",
1863
- eventListener: (r, i, s) => {
1864
- j(s).select();
1874
+ eventListener: (i, r, a) => {
1875
+ if (!r.isEditable())
1876
+ return;
1877
+ j(a).select();
1865
1878
  }
1866
1879
  }
1867
1880
  );
1868
1881
  }
1869
- const ge = 24;
1882
+ const he = 24;
1870
1883
  function Vn() {
1871
- const [t] = M();
1872
- return /* @__PURE__ */ h(_e, { "aria-label": "Block toolbar", id: "block-toolbar", children: /* @__PURE__ */ D(oe, { "aria-label": "Media", children: [
1884
+ const [n] = M();
1885
+ return /* @__PURE__ */ h(Be, { "aria-label": "Block toolbar", id: "block-toolbar", children: /* @__PURE__ */ D(oe, { "aria-label": "Media", children: [
1873
1886
  /* @__PURE__ */ h(
1874
1887
  Kt,
1875
1888
  {
@@ -1877,15 +1890,15 @@ function Vn() {
1877
1890
  onSelect: (e) => {
1878
1891
  if (!e || e.length === 0)
1879
1892
  return;
1880
- const n = e[0];
1881
- if (!n.type.startsWith("image/")) {
1893
+ const t = e[0];
1894
+ if (!t.type.startsWith("image/")) {
1882
1895
  alert("Please select an image file.");
1883
1896
  return;
1884
1897
  }
1885
- t.dispatchCommand(we, n);
1898
+ n.dispatchCommand(Me, t);
1886
1899
  },
1887
1900
  allowsMultiple: !1,
1888
- children: /* @__PURE__ */ h(q, { "aria-label": "image", children: /* @__PURE__ */ h(tn, { size: ge }) })
1901
+ children: /* @__PURE__ */ h(q, { "aria-label": "image", children: /* @__PURE__ */ h(tn, { size: he }) })
1889
1902
  }
1890
1903
  ),
1891
1904
  /* @__PURE__ */ h(
@@ -1893,9 +1906,9 @@ function Vn() {
1893
1906
  {
1894
1907
  "aria-label": "code block",
1895
1908
  onPress: () => {
1896
- t.dispatchCommand(gt, void 0);
1909
+ n.dispatchCommand(gt, void 0);
1897
1910
  },
1898
- children: /* @__PURE__ */ h(nn, { size: ge })
1911
+ children: /* @__PURE__ */ h(nn, { size: he })
1899
1912
  }
1900
1913
  ),
1901
1914
  /* @__PURE__ */ h(
@@ -1903,112 +1916,116 @@ function Vn() {
1903
1916
  {
1904
1917
  "aria-label": "horizontal divider",
1905
1918
  onPress: () => {
1906
- t.dispatchCommand(
1919
+ n.dispatchCommand(
1907
1920
  ht,
1908
1921
  void 0
1909
1922
  );
1910
1923
  },
1911
- children: /* @__PURE__ */ h(rn, { size: ge })
1924
+ children: /* @__PURE__ */ h(rn, { size: he })
1912
1925
  }
1913
1926
  )
1914
1927
  ] }) });
1915
1928
  }
1916
1929
  function Jn({
1917
- selectionRectCoords: t,
1918
- TOOLBAR_OFFSET: a,
1930
+ selectionRectCoords: n,
1931
+ TOOLBAR_OFFSET: s,
1919
1932
  toolbarTriggerId: e,
1920
- toolbarPopoverId: n
1933
+ toolbarPopoverId: t
1921
1934
  }) {
1922
- const [o, r] = O({
1935
+ const [o, i] = O({
1923
1936
  x: B,
1924
1937
  y: B
1925
- }), i = ee(null);
1938
+ }), r = ee(null);
1926
1939
  return b(() => {
1927
- r(
1940
+ i(
1928
1941
  An(
1929
- t,
1930
- i,
1931
- a
1942
+ n,
1943
+ r,
1944
+ s
1932
1945
  )
1933
1946
  );
1934
- }, [t]), /* @__PURE__ */ D(Wt, { children: [
1947
+ }, [n]), /* @__PURE__ */ D(Wt, { children: [
1935
1948
  /* @__PURE__ */ h(
1936
1949
  q,
1937
1950
  {
1938
1951
  "aria-label": "Block toolbar trigger",
1939
1952
  className: "block-toolbar-trigger",
1940
1953
  id: e,
1941
- ref: i,
1954
+ ref: r,
1942
1955
  style: {
1943
1956
  position: "absolute",
1944
1957
  top: o.y,
1945
1958
  left: o.x
1946
1959
  },
1947
- children: /* @__PURE__ */ h(en, { size: ge })
1960
+ children: /* @__PURE__ */ h(en, { size: he })
1948
1961
  }
1949
1962
  ),
1950
1963
  /* @__PURE__ */ h(
1951
1964
  ot,
1952
1965
  {
1953
1966
  className: "block-toolbar-popover",
1954
- id: n,
1967
+ id: t,
1955
1968
  placement: "end",
1956
1969
  shouldFlip: !1,
1957
- offset: a,
1970
+ offset: s,
1958
1971
  children: /* @__PURE__ */ h(Vn, {})
1959
1972
  }
1960
1973
  )
1961
1974
  ] });
1962
1975
  }
1963
1976
  const er = document.body;
1964
- function tr({ toolbarGap: t }) {
1965
- const [a, e] = O(null), [n] = M(), [o, r] = O(!1), [i, s] = O(!1), u = ee(Math.random().toString(36).substring(2, 9)), m = `block-toolbar-trigger-${u.current}`, T = `block-toolbar-popover-${u.current}`, A = () => r(!0), S = (L) => {
1977
+ function tr({ toolbarGap: n }) {
1978
+ const [s, e] = O(null), [t] = M(), [o, i] = O(!1), [r, a] = O(!1), u = ee(Math.random().toString(36).substring(2, 9)), m = `block-toolbar-trigger-${u.current}`, A = `block-toolbar-popover-${u.current}`, L = () => i(!0), S = (T) => {
1966
1979
  setTimeout(() => {
1967
- const N = document.getElementById(m);
1968
- N && (N === document.activeElement || N.contains(document.activeElement) || N.contains(L.relatedTarget)) || r(!1);
1980
+ const E = document.getElementById(m);
1981
+ E && (E === document.activeElement || E.contains(document.activeElement) || E.contains(T.relatedTarget)) || i(!1);
1969
1982
  }, 10);
1970
1983
  };
1971
1984
  return b(() => {
1972
- const L = () => {
1973
- const p = !!document.getElementById(T);
1974
- s(p);
1975
- }, N = new MutationObserver(L);
1976
- return N.observe(document.body, {
1985
+ const T = () => {
1986
+ const p = !!document.getElementById(A);
1987
+ a(p);
1988
+ }, E = new MutationObserver(T);
1989
+ return E.observe(document.body, {
1977
1990
  childList: !0,
1978
1991
  subtree: !0
1979
- }), L(), () => N.disconnect();
1980
- }, []), b(() => n.registerRootListener(
1981
- (N, p) => {
1982
- N && (N.addEventListener("focus", A), N.addEventListener("blur", S)), p && (p.removeEventListener("focus", A), p.removeEventListener("blur", S));
1992
+ }), T(), () => E.disconnect();
1993
+ }, []), b(() => t.registerRootListener(
1994
+ (E, p) => {
1995
+ E && (E.addEventListener("focus", L), E.addEventListener("blur", S)), p && (p.removeEventListener("focus", L), p.removeEventListener("blur", S));
1983
1996
  }
1984
- ), [n]), b(() => n.registerCommand(
1997
+ ), [t]), b(() => t.registerEditableListener((T) => {
1998
+ T || e(null);
1999
+ }), [t]), b(() => t.registerCommand(
1985
2000
  Y,
1986
2001
  () => {
1987
- const N = n.getRootElement();
1988
- if (N) {
1989
- const x = N === document.activeElement || N.contains(document.activeElement);
1990
- x !== o && r(x);
2002
+ if (!t.isEditable())
2003
+ return e(null), !1;
2004
+ const E = t.getRootElement();
2005
+ if (E) {
2006
+ const x = E === document.activeElement || E.contains(document.activeElement);
2007
+ x !== o && i(x);
1991
2008
  }
1992
- const p = F();
2009
+ const p = $();
1993
2010
  if (!k(p) || !p.isCollapsed())
1994
2011
  return e(null), !1;
1995
- const y = Ce(p);
2012
+ const y = Ee(p);
1996
2013
  if (J(y) && y.getTextContent() === "") {
1997
- const l = n.getElementByKey(y.getKey()).getBoundingClientRect(), c = l.left, d = l.top + l.height / 2 + window.scrollY;
2014
+ const l = t.getElementByKey(y.getKey()).getBoundingClientRect(), c = l.left, d = l.top + l.height / 2 + window.scrollY;
1998
2015
  e({ x: c, y: d });
1999
2016
  } else
2000
2017
  e(null);
2001
2018
  return !1;
2002
2019
  },
2003
- $
2004
- ), [n]), a && (o || i) && Pe(
2020
+ F
2021
+ ), [t]), s && (o || r) && De(
2005
2022
  /* @__PURE__ */ h(
2006
2023
  Jn,
2007
2024
  {
2008
- selectionRectCoords: a,
2009
- TOOLBAR_OFFSET: t,
2025
+ selectionRectCoords: s,
2026
+ TOOLBAR_OFFSET: n,
2010
2027
  toolbarTriggerId: m,
2011
- toolbarPopoverId: T
2028
+ toolbarPopoverId: A
2012
2029
  }
2013
2030
  ),
2014
2031
  er
@@ -2020,305 +2037,309 @@ const nr = [
2020
2037
  ], rr = [
2021
2038
  ["$$", "$$"],
2022
2039
  ["\\[", "\\]"]
2023
- ], et = (t) => t.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), mt = (t, a) => {
2040
+ ], nt = (n) => n.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), mt = (n, s) => {
2024
2041
  let e = null;
2025
- for (const [n, o] of a) {
2026
- const i = new RegExp(
2027
- `(.*?)(${et(n)})(.*?)(${et(o)})`,
2042
+ for (const [t, o] of s) {
2043
+ const r = new RegExp(
2044
+ `(.*?)(${nt(t)})(.*?)(${nt(o)})`,
2028
2045
  "g"
2029
- ).exec(t);
2030
- if (i) {
2031
- const s = i[3];
2032
- if (s && s.trim() !== "") {
2033
- const u = i.index + i[1].length, m = i.index + i[0].length;
2046
+ ).exec(n);
2047
+ if (r) {
2048
+ const a = r[3];
2049
+ if (a && a.trim() !== "") {
2050
+ const u = r.index + r[1].length, m = r.index + r[0].length;
2034
2051
  (!e || u < e.start) && (e = {
2035
2052
  start: u,
2036
2053
  end: m,
2037
- content: n + s + o
2054
+ content: t + a + o
2038
2055
  });
2039
2056
  }
2040
2057
  }
2041
2058
  }
2042
2059
  return e;
2043
- }, pt = (t, a) => {
2044
- if (!k(t))
2060
+ }, pt = (n, s) => {
2061
+ if (!k(n))
2045
2062
  return null;
2046
- const e = t.anchor.getNode(), n = t.focus.getNode(), o = a(e) ? e : I(e, a), r = a(n) ? n : I(n, a);
2047
- return !o || !r ? null : o.getKey() === r.getKey() ? o : null;
2048
- }, bt = (t) => t.getData("text/plain") || t.getData("text") || t.getData("text/uri-list");
2063
+ const e = n.anchor.getNode(), t = n.focus.getNode(), o = s(e) ? e : I(e, s), i = s(t) ? t : I(t, s);
2064
+ return !o || !i ? null : o.getKey() === i.getKey() ? o : null;
2065
+ }, bt = (n) => n.getData("text/plain") || n.getData("text") || n.getData("text/uri-list");
2049
2066
  function ir() {
2050
- const [t] = M();
2067
+ const [n] = M();
2051
2068
  return b(() => {
2052
- if (!t.hasNodes([he, mn]))
2069
+ if (!n.hasNodes([be, mn]))
2053
2070
  throw new Error(
2054
2071
  "MathInlinePlugin: MathNode or MathHighlightNodeInline not registered on editor"
2055
2072
  );
2056
- }, [t]), b(() => t.registerNodeTransform(se, (e) => {
2073
+ }, [n]), b(() => n.registerNodeTransform(se, (e) => {
2057
2074
  if (!e.isSimpleText() || X(e) || I(e, W))
2058
2075
  return;
2059
- const n = e.getTextContent(), o = mt(n, nr);
2076
+ const t = e.getTextContent(), o = mt(t, nr);
2060
2077
  if (o) {
2061
- const { start: r, end: i, content: s } = o;
2078
+ const { start: i, end: r, content: a } = o;
2062
2079
  let u;
2063
- const m = U(s, !0);
2064
- return r === 0 ? ([u] = e.splitText(i), u.insertBefore(m), u.remove()) : ([, u] = e.splitText(r, i), u.replace(m)), m;
2080
+ const m = U(a, !0);
2081
+ return i === 0 ? ([u] = e.splitText(r), u.insertBefore(m), u.remove()) : ([, u] = e.splitText(i, r), u.replace(m)), m;
2065
2082
  }
2066
- }), [t]), b(() => t.registerCommand(
2083
+ }), [n]), b(() => n.registerCommand(
2067
2084
  Y,
2068
2085
  () => {
2069
- const e = F(), n = /* @__PURE__ */ new Set();
2070
- if (Me(e)) {
2071
- const i = e.getNodes();
2072
- if (i.length === 1 && V(i[0])) {
2073
- const s = i[0];
2074
- if (s.isInline()) {
2075
- let u = s.getEquation();
2086
+ const e = $(), t = /* @__PURE__ */ new Set();
2087
+ if (pe(e)) {
2088
+ const r = e.getNodes();
2089
+ if (r.length === 1 && V(r[0]) && n.isEditable()) {
2090
+ const a = r[0];
2091
+ if (a.isInline()) {
2092
+ let u = a.getEquation();
2076
2093
  u.startsWith("$") && u.endsWith("$") ? u = u.slice(1, -1) : u.startsWith("\\(") && u.endsWith("\\)") && (u = u.slice(2, -2));
2077
- const m = Ae(u);
2078
- return s.replace(m), m.select(), !0;
2094
+ const m = Le(u);
2095
+ return a.replace(m), m.select(), !0;
2079
2096
  }
2080
2097
  }
2081
- } else k(e) && e.getNodes().forEach((i) => n.add(i.getKey()));
2082
- return fe().getAllTextNodes().forEach((i) => {
2083
- if (X(i) && !n.has(i.getKey())) {
2084
- let s = i.getTextContent();
2085
- if (!s) {
2086
- i.remove();
2098
+ } else k(e) && e.getNodes().forEach((r) => t.add(r.getKey()));
2099
+ return me().getAllTextNodes().forEach((r) => {
2100
+ if (X(r) && !t.has(r.getKey())) {
2101
+ let a = r.getTextContent();
2102
+ if (!a) {
2103
+ r.remove();
2087
2104
  return;
2088
2105
  }
2089
2106
  let u = !1;
2090
- s.startsWith("$") && s.endsWith("$") && s.length >= 2 && (s = s.slice(1, -1), u = !0);
2091
- const m = u ? U(`$$${s}$$`, !1) : U(`$${s}$`, !0);
2092
- i.replace(m);
2107
+ a.startsWith("$") && a.endsWith("$") && a.length >= 2 && (a = a.slice(1, -1), u = !0);
2108
+ const m = u ? U(`$$${a}$$`, !1) : U(`$${a}$`, !0);
2109
+ r.replace(m);
2093
2110
  }
2094
2111
  }), !1;
2095
2112
  },
2096
- $
2097
- ), [t]), b(() => t.registerCommand(
2098
- be,
2099
- () => (t.update(() => {
2100
- fe().getAllTextNodes().forEach((n) => {
2101
- if (X(n)) {
2102
- let o = n.getTextContent();
2113
+ F
2114
+ ), [n]), b(() => n.registerCommand(
2115
+ ae,
2116
+ () => (n.update(() => {
2117
+ me().getAllTextNodes().forEach((t) => {
2118
+ if (X(t)) {
2119
+ let o = t.getTextContent();
2103
2120
  if (!o) {
2104
- n.remove();
2121
+ t.remove();
2105
2122
  return;
2106
2123
  }
2107
- let r = !1;
2108
- o.startsWith("$") && o.endsWith("$") && o.length >= 2 && (o = o.slice(1, -1), r = !0);
2109
- const i = r ? U(`$$${o}$$`, !1) : U(`$${o}$`, !0);
2110
- n.replace(i), rt(null);
2124
+ let i = !1;
2125
+ o.startsWith("$") && o.endsWith("$") && o.length >= 2 && (o = o.slice(1, -1), i = !0);
2126
+ const r = i ? U(`$$${o}$$`, !1) : U(`$${o}$`, !0);
2127
+ t.replace(r), Pe(null);
2111
2128
  }
2112
2129
  });
2113
2130
  }), !1),
2114
- $
2115
- ), [t]), b(() => t.registerCommand(
2131
+ F
2132
+ ), [n]), b(() => n.registerCommand(
2116
2133
  Ft,
2117
- (a) => {
2118
- const e = F();
2134
+ (s) => {
2135
+ const e = $();
2119
2136
  if (!k(e) || !e.isCollapsed())
2120
2137
  return !1;
2121
- const n = Fe(e.anchor, !1);
2122
- if (V(n) && n.isInline()) {
2123
- let r = n.getEquation();
2124
- r.startsWith("$") && r.endsWith("$") ? r = r.slice(1, -1) : r.startsWith("\\(") && r.endsWith("\\)") && (r = r.slice(2, -2));
2125
- const i = Ae(r);
2126
- return n.replace(i), i.select(0, 0), !0;
2138
+ const t = we(e.anchor, !1);
2139
+ if (V(t) && t.isInline()) {
2140
+ let i = t.getEquation();
2141
+ i.startsWith("$") && i.endsWith("$") ? i = i.slice(1, -1) : i.startsWith("\\(") && i.endsWith("\\)") && (i = i.slice(2, -2));
2142
+ const r = Le(i);
2143
+ return t.replace(r), r.select(0, 0), !0;
2127
2144
  }
2128
2145
  return !1;
2129
2146
  },
2130
- $
2131
- ), [t]), b(() => t.registerCommand(
2132
- Ie,
2133
- (a) => {
2134
- const e = F();
2147
+ F
2148
+ ), [n]), b(() => n.registerCommand(
2149
+ Oe,
2150
+ (s) => {
2151
+ const e = $();
2135
2152
  if (!k(e) || !e.isCollapsed())
2136
2153
  return !1;
2137
- const n = Fe(e.anchor, !0);
2138
- if (V(n) && n.isInline()) {
2139
- let r = n.getEquation();
2140
- r.startsWith("$") && r.endsWith("$") ? r = r.slice(1, -1) : r.startsWith("\\(") && r.endsWith("\\)") && (r = r.slice(2, -2));
2141
- const i = Ae(r);
2142
- return n.replace(i), i.select(), !0;
2154
+ const t = we(e.anchor, !0);
2155
+ if (V(t) && t.isInline()) {
2156
+ let i = t.getEquation();
2157
+ i.startsWith("$") && i.endsWith("$") ? i = i.slice(1, -1) : i.startsWith("\\(") && i.endsWith("\\)") && (i = i.slice(2, -2));
2158
+ const r = Le(i);
2159
+ return t.replace(r), r.select(), !0;
2143
2160
  }
2144
2161
  return !1;
2145
2162
  },
2146
- $
2147
- ), [t]), b(() => t.registerCommand(
2148
- Oe,
2149
- (a) => {
2150
- const e = a.clipboardData;
2163
+ F
2164
+ ), [n]), b(() => n.registerCommand(
2165
+ _e,
2166
+ (s) => {
2167
+ const e = s.clipboardData;
2151
2168
  if (!e)
2152
2169
  return !1;
2153
- const n = F();
2170
+ const t = $();
2154
2171
  if (!pt(
2155
- n,
2172
+ t,
2156
2173
  X
2157
2174
  ))
2158
2175
  return !1;
2159
- const r = bt(e);
2160
- return r ? (a.preventDefault(), n.insertText(r), !0) : !1;
2176
+ const i = bt(e);
2177
+ return i ? (s.preventDefault(), t.insertText(i), !0) : !1;
2161
2178
  },
2162
- $
2163
- ), [t]), b(() => t.registerCommand(
2179
+ F
2180
+ ), [n]), b(() => n.registerCommand(
2164
2181
  Y,
2165
2182
  () => {
2166
- const a = F();
2167
- if (!k(a) || !a.isCollapsed())
2183
+ const s = $();
2184
+ if (!k(s) || !s.isCollapsed())
2168
2185
  return !1;
2169
- const e = a.anchor.getNode();
2186
+ const e = s.anchor.getNode();
2170
2187
  return X(e) && (e.getNextSibling() || e.insertAfter(kt(" "))), !1;
2171
2188
  },
2172
2189
  wt
2173
- ), [t]), // Register click event for MathNode
2190
+ ), [n]), // Register click event for MathNode
2174
2191
  /* @__PURE__ */ h(
2175
- De,
2192
+ He,
2176
2193
  {
2177
- nodeType: he,
2194
+ nodeType: be,
2178
2195
  eventType: "click",
2179
- eventListener: (a, e, n) => {
2180
- const o = j(n);
2196
+ eventListener: (s, e, t) => {
2197
+ if (!e.isEditable())
2198
+ return;
2199
+ const o = j(t);
2181
2200
  o && o.isInline() && o.select();
2182
2201
  }
2183
2202
  }
2184
2203
  );
2185
2204
  }
2186
2205
  function or() {
2187
- const [t] = M();
2206
+ const [n] = M();
2188
2207
  return b(() => {
2189
- if (!t.hasNodes([he, pn]))
2208
+ if (!n.hasNodes([be, pn]))
2190
2209
  throw new Error(
2191
2210
  "MathBlockPlugin: MathNode or MathHighlightNodeBlock not registered on editor"
2192
2211
  );
2193
- }, [t]), b(() => t.registerNodeTransform(se, (e) => {
2212
+ }, [n]), b(() => n.registerNodeTransform(se, (e) => {
2194
2213
  if (!e.isSimpleText() || I(e, W))
2195
2214
  return;
2196
- const n = e.getTextContent();
2197
- if (n.startsWith("$$ ")) {
2198
- const r = e.getPreviousSibling(), i = I(e, J), s = i !== null && i.getChildrenSize() === 1, u = ie(r);
2199
- if (s || u) {
2200
- if (n.length > 3)
2215
+ const t = e.getTextContent();
2216
+ if (t.startsWith("$$ ")) {
2217
+ const i = e.getPreviousSibling(), r = I(e, J), a = r !== null && r.getChildrenSize() === 1, u = ie(i);
2218
+ if (a || u) {
2219
+ if (t.length > 3)
2201
2220
  return;
2202
2221
  const m = Se("");
2203
2222
  e.replace(m), m.select();
2204
- const T = m.getNextSibling();
2205
- ie(T) && T.remove();
2223
+ const A = m.getNextSibling();
2224
+ ie(A) && A.remove();
2206
2225
  return;
2207
2226
  }
2208
2227
  }
2209
- const o = mt(n, rr);
2228
+ const o = mt(t, rr);
2210
2229
  if (o) {
2211
- const { start: r, end: i, content: s } = o;
2230
+ const { start: i, end: r, content: a } = o;
2212
2231
  let u;
2213
- const m = U(s, !1);
2214
- return r === 0 ? ([u] = e.splitText(i), u.insertBefore(m), u.remove()) : ([, u] = e.splitText(r, i), u.replace(m)), m;
2232
+ const m = U(a, !1);
2233
+ return i === 0 ? ([u] = e.splitText(r), u.insertBefore(m), u.remove()) : ([, u] = e.splitText(i, r), u.replace(m)), m;
2215
2234
  }
2216
- }), [t]), b(() => t.registerCommand(
2235
+ }), [n]), b(() => n.registerCommand(
2217
2236
  Y,
2218
2237
  () => {
2219
- const e = F(), n = /* @__PURE__ */ new Set();
2220
- if (Me(e)) {
2221
- const i = e.getNodes();
2222
- if (i.length === 1 && V(i[0])) {
2223
- const s = i[0];
2224
- if (!s.isInline()) {
2225
- let u = s.getEquation();
2238
+ const e = $(), t = /* @__PURE__ */ new Set();
2239
+ if (pe(e)) {
2240
+ const r = e.getNodes();
2241
+ if (r.length === 1 && V(r[0]) && n.isEditable()) {
2242
+ const a = r[0];
2243
+ if (!a.isInline()) {
2244
+ let u = a.getEquation();
2226
2245
  (u.startsWith("$$") && u.endsWith("$$") || u.startsWith("\\[") && u.endsWith("\\]")) && (u = u.slice(2, -2));
2227
2246
  const m = Se(u);
2228
- return s.replace(m), m.select(), !0;
2247
+ return a.replace(m), m.select(), !0;
2229
2248
  }
2230
2249
  }
2231
- } else k(e) && e.getNodes().forEach((i) => {
2232
- n.add(i.getKey());
2233
- const s = I(i, W);
2234
- s && n.add(s.getKey());
2250
+ } else k(e) && e.getNodes().forEach((r) => {
2251
+ t.add(r.getKey());
2252
+ const a = I(r, W);
2253
+ a && t.add(a.getKey());
2235
2254
  });
2236
- const r = t.getEditorState()._nodeMap;
2237
- for (const [, i] of r)
2238
- if (W(i) && i.isAttached() && !n.has(i.getKey())) {
2239
- const s = i.getTextContent();
2240
- if (!s) {
2241
- i.remove();
2255
+ const i = n.getEditorState()._nodeMap;
2256
+ for (const [, r] of i)
2257
+ if (W(r) && r.isAttached() && !t.has(r.getKey())) {
2258
+ const a = r.getTextContent();
2259
+ if (!a) {
2260
+ r.remove();
2242
2261
  continue;
2243
2262
  }
2244
- const u = U(`$$${s}$$`, !1);
2245
- i.replace(u);
2263
+ const u = U(`$$${a}$$`, !1);
2264
+ r.replace(u);
2246
2265
  }
2247
2266
  return !1;
2248
2267
  },
2249
- $
2250
- ), [t]), b(() => t.registerCommand(
2251
- be,
2252
- () => (t.update(() => {
2253
- const a = fe();
2254
- Bt(a).forEach(({ node: n }) => {
2255
- if (W(n)) {
2256
- const o = n.getTextContent();
2268
+ F
2269
+ ), [n]), b(() => n.registerCommand(
2270
+ ae,
2271
+ () => (n.update(() => {
2272
+ const s = me();
2273
+ Bt(s).forEach(({ node: t }) => {
2274
+ if (W(t)) {
2275
+ const o = t.getTextContent();
2257
2276
  if (!o) {
2258
- n.remove();
2277
+ t.remove();
2259
2278
  return;
2260
2279
  }
2261
- const r = U(`$$${o}$$`, !1);
2262
- n.replace(r), rt(null);
2280
+ const i = U(`$$${o}$$`, !1);
2281
+ t.replace(i), Pe(null);
2263
2282
  }
2264
2283
  });
2265
2284
  }), !1),
2266
- $
2267
- ), [t]), b(() => t.registerCommand(
2285
+ F
2286
+ ), [n]), b(() => n.registerCommand(
2268
2287
  It,
2269
2288
  () => {
2270
- const e = F();
2289
+ const e = $();
2271
2290
  if (!k(e))
2272
2291
  return !1;
2273
- const n = e.getNodes()[0], o = I(
2274
- n,
2292
+ const t = e.getNodes()[0], o = I(
2293
+ t,
2275
2294
  W
2276
2295
  );
2277
2296
  if (!o)
2278
2297
  return !1;
2279
- const r = o.getLastChild();
2280
- return e.isCollapsed() && (e.anchor.getNode().getKey() === o.getKey() && e.anchor.offset === 0 && o.getChildrenSize() === 0 || r && ie(r) && e.anchor.getNode().getKey() === o.getKey() && e.anchor.offset === o.getChildrenSize() || r && Mt(r) && e.anchor.getNode().getKey() === r.getKey() && e.anchor.offset === r.getTextContent().length) ? !1 : (e.insertLineBreak(), !0);
2298
+ const i = o.getLastChild();
2299
+ return e.isCollapsed() && (e.anchor.getNode().getKey() === o.getKey() && e.anchor.offset === 0 && o.getChildrenSize() === 0 || i && ie(i) && e.anchor.getNode().getKey() === o.getKey() && e.anchor.offset === o.getChildrenSize() || i && Mt(i) && e.anchor.getNode().getKey() === i.getKey() && e.anchor.offset === i.getTextContent().length) ? !1 : (e.insertLineBreak(), !0);
2281
2300
  },
2282
- $
2283
- ), [t]), b(() => t.registerCommand(
2284
- Ie,
2285
- (a) => {
2286
- const e = F();
2301
+ F
2302
+ ), [n]), b(() => n.registerCommand(
2303
+ Oe,
2304
+ (s) => {
2305
+ const e = $();
2287
2306
  if (!k(e) || !e.isCollapsed())
2288
2307
  return !1;
2289
- const n = Fe(e.anchor, !0);
2290
- if (V(n) && !n.isInline()) {
2291
- let r = n.getEquation();
2292
- (r.startsWith("$$") && r.endsWith("$$") || r.startsWith("\\[") && r.endsWith("\\]")) && (r = r.slice(2, -2));
2293
- const i = Se(r);
2294
- return n.replace(i), i.select(), !0;
2308
+ const t = we(e.anchor, !0);
2309
+ if (V(t) && !t.isInline()) {
2310
+ let i = t.getEquation();
2311
+ (i.startsWith("$$") && i.endsWith("$$") || i.startsWith("\\[") && i.endsWith("\\]")) && (i = i.slice(2, -2));
2312
+ const r = Se(i);
2313
+ return t.replace(r), r.select(), !0;
2295
2314
  }
2296
2315
  return !1;
2297
2316
  },
2298
- $
2299
- ), [t]), b(() => t.registerCommand(
2300
- Oe,
2301
- (a) => {
2302
- const e = a.clipboardData;
2317
+ F
2318
+ ), [n]), b(() => n.registerCommand(
2319
+ _e,
2320
+ (s) => {
2321
+ const e = s.clipboardData;
2303
2322
  if (!e)
2304
2323
  return !1;
2305
- const n = F();
2324
+ const t = $();
2306
2325
  if (!pt(
2307
- n,
2326
+ t,
2308
2327
  W
2309
2328
  ))
2310
2329
  return !1;
2311
- const r = bt(e);
2312
- return r ? (a.preventDefault(), n.insertRawText(r), !0) : !1;
2330
+ const i = bt(e);
2331
+ return i ? (s.preventDefault(), t.insertRawText(i), !0) : !1;
2313
2332
  },
2314
- $
2315
- ), [t]), /* @__PURE__ */ h(
2316
- De,
2333
+ F
2334
+ ), [n]), /* @__PURE__ */ h(
2335
+ He,
2317
2336
  {
2318
- nodeType: he,
2337
+ nodeType: be,
2319
2338
  eventType: "click",
2320
- eventListener: (a, e, n) => {
2321
- const o = j(n);
2339
+ eventListener: (s, e, t) => {
2340
+ if (!e.isEditable())
2341
+ return;
2342
+ const o = j(t);
2322
2343
  o && !o.isInline() && o.select();
2323
2344
  }
2324
2345
  }
@@ -2326,100 +2347,100 @@ function or() {
2326
2347
  }
2327
2348
  const sr = 3;
2328
2349
  function ar() {
2329
- const [t] = M();
2330
- return b(() => t.registerNodeTransform(
2350
+ const [n] = M();
2351
+ return b(() => n.registerNodeTransform(
2331
2352
  Ot,
2332
2353
  (e) => {
2333
- const n = e.getParent();
2334
- if (Ke(n)) {
2354
+ const t = e.getParent();
2355
+ if (qe(t)) {
2335
2356
  const o = Pt();
2336
2357
  e.replace(o), o.selectEnd();
2337
2358
  }
2338
2359
  }
2339
- ), [t]), b(() => t.registerNodeTransform(se, (e) => {
2360
+ ), [n]), b(() => n.registerNodeTransform(se, (e) => {
2340
2361
  if (!I(e, J) || I(e, J).getFirstDescendant() !== e)
2341
2362
  return;
2342
- const o = F();
2363
+ const o = $();
2343
2364
  if (k(o) && o.isCollapsed()) {
2344
- const i = o.anchor.offset;
2345
- e.getTextContent() === "1. " && i === 3 ? (Ue("number"), e.setTextContent("")) : e.getTextContent() === "- " && i === 2 && (Ue("bullet"), e.setTextContent(""));
2365
+ const r = o.anchor.offset;
2366
+ e.getTextContent() === "1. " && r === 3 ? (je("number"), e.setTextContent("")) : e.getTextContent() === "- " && r === 2 && (je("bullet"), e.setTextContent(""));
2346
2367
  }
2347
- }), [t]), b(() => t.registerCommand(
2368
+ }), [n]), b(() => n.registerCommand(
2348
2369
  _t,
2349
2370
  (e) => {
2350
- const n = F();
2351
- if (!k(n))
2371
+ const t = $();
2372
+ if (!k(t))
2352
2373
  return !1;
2353
- const o = Ce(n), r = I(o, Ke);
2354
- if (!r)
2374
+ const o = Ee(t), i = I(o, qe);
2375
+ if (!i)
2355
2376
  return !1;
2356
- const i = r.getIndent();
2377
+ const r = i.getIndent();
2357
2378
  if (e.shiftKey) {
2358
- if (i <= 0)
2379
+ if (r <= 0)
2359
2380
  return !1;
2360
- r.setIndent(i - 1);
2381
+ i.setIndent(r - 1);
2361
2382
  } else {
2362
- if (i > sr)
2383
+ if (r > sr)
2363
2384
  return !1;
2364
- r.setIndent(i + 1);
2385
+ i.setIndent(r + 1);
2365
2386
  }
2366
2387
  return !0;
2367
2388
  },
2368
- $
2369
- ), [t]), null;
2389
+ F
2390
+ ), [n]), null;
2370
2391
  }
2371
2392
  function lr() {
2372
- const [t] = M(), a = (e) => {
2393
+ const [n] = M(), s = (e) => {
2373
2394
  e.key === "Tab" && e.preventDefault();
2374
2395
  };
2375
- return b(() => t.registerRootListener(
2376
- (n, o) => {
2377
- n && n.addEventListener("keydown", a), o && o.removeEventListener("keydown", a);
2396
+ return b(() => n.registerRootListener(
2397
+ (t, o) => {
2398
+ t && t.addEventListener("keydown", s), o && o.removeEventListener("keydown", s);
2378
2399
  }
2379
- ), [t]), null;
2400
+ ), [n]), null;
2380
2401
  }
2381
- function cr({ editorRef: t }) {
2382
- const [a] = M();
2402
+ function cr({ editorRef: n }) {
2403
+ const [s] = M();
2383
2404
  return b(() => {
2384
- if (t)
2385
- return t.current = a, () => {
2386
- t && (t.current = null);
2405
+ if (n)
2406
+ return n.current = s, () => {
2407
+ n && (n.current = null);
2387
2408
  };
2388
- }, [a, t]), null;
2409
+ }, [s, n]), null;
2389
2410
  }
2390
2411
  function Or({
2391
- initialConfig: t,
2392
- onChange: a,
2412
+ initialConfig: n,
2413
+ onChange: s,
2393
2414
  editorRef: e,
2394
- blockToolbarGap: n,
2415
+ blockToolbarGap: t,
2395
2416
  spellCheck: o,
2396
- isHeadingOneFirst: r,
2397
- onImageUpload: i
2417
+ isHeadingOneFirst: i,
2418
+ onImageUpload: r
2398
2419
  }) {
2399
- return /* @__PURE__ */ D(xt, { initialConfig: t, children: [
2420
+ return /* @__PURE__ */ D(xt, { initialConfig: n, children: [
2400
2421
  /* @__PURE__ */ h(
2401
2422
  Tt,
2402
2423
  {
2403
- contentEditable: /* @__PURE__ */ h(Nn, { spellCheck: o, className: "editor-input" }),
2404
- ErrorBoundary: St
2424
+ contentEditable: /* @__PURE__ */ h(En, { spellCheck: o, className: "editor-input" }),
2425
+ ErrorBoundary: Lt
2405
2426
  }
2406
2427
  ),
2407
- /* @__PURE__ */ h(Pn, { isHeadingOneFirst: r }),
2428
+ /* @__PURE__ */ h(Pn, { isHeadingOneFirst: i }),
2408
2429
  /* @__PURE__ */ h(Rn, {}),
2409
- /* @__PURE__ */ h(tr, { toolbarGap: n }),
2410
- /* @__PURE__ */ h(Et, {}),
2430
+ /* @__PURE__ */ h(tr, { toolbarGap: t }),
2431
+ /* @__PURE__ */ h(Nt, {}),
2411
2432
  /* @__PURE__ */ h(At, {}),
2412
2433
  /* @__PURE__ */ h(ir, {}),
2413
2434
  /* @__PURE__ */ h(or, {}),
2414
2435
  /* @__PURE__ */ h(Zn, {}),
2415
2436
  /* @__PURE__ */ h(Qn, {}),
2416
- /* @__PURE__ */ h(Xn, { onImageUpload: i }),
2437
+ /* @__PURE__ */ h(Xn, { onImageUpload: r }),
2417
2438
  /* @__PURE__ */ h(Cn, {}),
2418
2439
  /* @__PURE__ */ h(ar, {}),
2419
2440
  /* @__PURE__ */ h(lr, {}),
2420
- /* @__PURE__ */ h(yn, { onChange: a }),
2441
+ /* @__PURE__ */ h(yn, { onChange: s }),
2421
2442
  /* @__PURE__ */ h(cr, { editorRef: e }),
2422
- /* @__PURE__ */ h(En, {})
2443
+ /* @__PURE__ */ h(Nn, {})
2423
2444
  ] });
2424
2445
  }
2425
2446
  export {