lexical-medium-editor 1.2.15 → 1.2.17

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,245 +1,245 @@
1
1
  import './lexical-medium-editor.css';
2
- import { jsxs as $, Fragment as Ie, jsx as l } from "react/jsx-runtime";
3
- import { AutoFocusPlugin as Fe } from "@lexical/react/LexicalAutoFocusPlugin";
4
- import { LexicalComposer as Ke } from "@lexical/react/LexicalComposer";
5
- import { RichTextPlugin as We } from "@lexical/react/LexicalRichTextPlugin";
6
- import { HistoryPlugin as Ge } from "@lexical/react/LexicalHistoryPlugin";
7
- import { LexicalErrorBoundary as ze } from "@lexical/react/LexicalErrorBoundary";
8
- import { useLexicalComposerContext as b } from "@lexical/react/LexicalComposerContext";
9
- import { createCommand as _, $getSelection as T, $isRangeSelection as N, $createParagraphNode as G, COMMAND_PRIORITY_HIGH as h, $getRoot as j, CLICK_COMMAND as qe, COMMAND_PRIORITY_LOW as Se, TextNode as z, $isParagraphNode as R, $getCharacterOffsets as Ue, FORMAT_TEXT_COMMAND as oe, SELECTION_CHANGE_COMMAND as A, BLUR_COMMAND as J, $getNodeByKey as q, $isLineBreakNode as K, $getPreviousSelection as X, KEY_BACKSPACE_COMMAND as ce, $isNodeSelection as de, PASTE_COMMAND as Ye, $setSelection as $e, KEY_ARROW_RIGHT_COMMAND as Qe, $getAdjacentNode as ae, $createTextNode as je, COMMAND_PRIORITY_NORMAL as Xe, KEY_ENTER_COMMAND as Ve, $isTextNode as Ze, ParagraphNode as Je, $createLineBreakNode as et, KEY_TAB_COMMAND as tt } from "lexical";
10
- import { useEffect as u, useState as M, useRef as U, useLayoutEffect as nt, useCallback as Y } from "react";
11
- import { createPortal as ue } from "react-dom";
12
- import { $findMatchingParent as I, $dfs as ot } from "@lexical/utils";
13
- import { Toolbar as ge, TextField as rt, Input as xe, Group as W, Button as B, ToggleButton as w, Separator as me, ComboBox as it, Popover as ve, ListBox as st, ListBoxItem as at, DialogTrigger as lt, FileTrigger as ct } from "react-aria-components";
14
- import { IconCheck as dt, IconX as ut, IconBold as gt, IconItalic as ft, IconCode as mt, IconTextSize as ht, IconBlockquote as Nt, IconLink as Ct, IconCaretDownFilled as pt, IconPlus as Tt, IconPhoto as Et, IconCodePlus as bt, IconLineDashed as Lt } from "@tabler/icons-react";
15
- import { $isAtNodeEnd as he, $setBlocksType as ye, createDOMRange as Mt } from "@lexical/selection";
16
- import { $createHeadingNode as Oe, HeadingNode as It, $createQuoteNode as St, $isHeadingNode as le, $isQuoteNode as $t } from "@lexical/rich-text";
17
- import { $toggleLink as xt, $isLinkNode as vt } from "@lexical/link";
18
- import { $isListNode as yt, $isListItemNode as Ne, $insertList as Ce } from "@lexical/list";
19
- import { $ as H, a as F, b as k, H as Ot, c as Pt, I as pe, d as Te, e as Bt, M as V, f as Dt, g as re, h as P, i as kt, j as ie } from "./ImageNode-BhH71HMX.js";
20
- import { $isCodeNode as Z, getCodeLanguages as At, getLanguageFriendlyName as se, registerCodeHighlighting as _t, $createCodeNode as Ee } from "@lexical/code";
21
- import { NodeEventPlugin as fe } from "@lexical/react/LexicalNodeEventPlugin";
22
- import { ListPlugin as Ht } from "@lexical/react/LexicalListPlugin";
23
- import { OnChangePlugin as Rt } from "@lexical/react/LexicalOnChangePlugin";
24
- import { ContentEditable as wt } from "@lexical/react/LexicalContentEditable";
25
- import { ClearEditorPlugin as Ft } from "@lexical/react/LexicalClearEditorPlugin";
26
- const x = -1e3;
27
- function Kt(e, s, t = 0) {
28
- if (!s || !s.current)
2
+ import { jsxs as D, Fragment as Xe, jsx as h } from "react/jsx-runtime";
3
+ import { AutoFocusPlugin as Ct } from "@lexical/react/LexicalAutoFocusPlugin";
4
+ import { LexicalComposer as yt } from "@lexical/react/LexicalComposer";
5
+ import { RichTextPlugin as Nt } from "@lexical/react/LexicalRichTextPlugin";
6
+ import { HistoryPlugin as xt } from "@lexical/react/LexicalHistoryPlugin";
7
+ import { LexicalErrorBoundary as Et } from "@lexical/react/LexicalErrorBoundary";
8
+ import { useLexicalComposerContext as M } from "@lexical/react/LexicalComposerContext";
9
+ import { createCommand as Y, $getSelection as L, $isRangeSelection as w, $createParagraphNode as re, COMMAND_PRIORITY_HIGH as $, $getRoot as fe, CLICK_COMMAND as Tt, COMMAND_PRIORITY_LOW as Ve, TextNode as ie, $isParagraphNode as V, $getCharacterOffsets as At, FORMAT_TEXT_COMMAND as xe, SELECTION_CHANGE_COMMAND as j, BLUR_COMMAND as be, $getNodeByKey as oe, $isLineBreakNode as te, $getPreviousSelection as he, KEY_BACKSPACE_COMMAND as Le, $isNodeSelection as we, PASTE_COMMAND as ke, $setSelection as Je, KEY_ARROW_RIGHT_COMMAND as St, $getAdjacentNode as Fe, $createTextNode as Ft, COMMAND_PRIORITY_NORMAL as $t, KEY_ENTER_COMMAND as Lt, $isTextNode as wt, ParagraphNode as kt, $createLineBreakNode as It, KEY_TAB_COMMAND as Mt } from "lexical";
10
+ import { useEffect as C, useState as O, useRef as se, useLayoutEffect as Ot, useCallback as de } from "react";
11
+ import { createPortal as Ie } from "react-dom";
12
+ import { $findMatchingParent as I, $dfs as Pt } from "@lexical/utils";
13
+ import { Toolbar as Me, TextField as _t, Input as et, Group as ne, Button as U, ToggleButton as ee, Separator as He, ComboBox as Dt, Popover as tt, ListBox as Bt, ListBoxItem as Ht, DialogTrigger as Rt, FileTrigger as zt } from "react-aria-components";
14
+ import { IconCheck as Wt, IconX as Gt, IconBold as Kt, IconItalic as qt, IconCode as Ut, IconTextSize as jt, IconBlockquote as Yt, IconLink as Zt, IconCaretDownFilled as Qt, IconPlus as Xt, IconPhoto as Vt, IconCodePlus as Jt, IconLineDashed as en } from "@tabler/icons-react";
15
+ import { $isAtNodeEnd as Re, $setBlocksType as nt, createDOMRange as tn } from "@lexical/selection";
16
+ import { $createHeadingNode as rt, HeadingNode as nn, $createQuoteNode as rn, $isHeadingNode as $e, $isQuoteNode as on } from "@lexical/rich-text";
17
+ import { $toggleLink as sn, $isLinkNode as an } from "@lexical/link";
18
+ import { $isListNode as ln, $isListItemNode as ze, $insertList as We } from "@lexical/list";
19
+ import { $ as X, a as Q, b as G, H as cn, c as un, I as Ge, d as Ke, e as dn, M as me, f as gn, g as Ee, h as q, i as fn, j as Te } from "./ImageNode-BhH71HMX.js";
20
+ import { $isCodeNode as pe, getCodeLanguages as hn, getLanguageFriendlyName as Ae, registerCodeHighlighting as mn, $createCodeNode as qe } from "@lexical/code";
21
+ import { NodeEventPlugin as Oe } from "@lexical/react/LexicalNodeEventPlugin";
22
+ import { ListPlugin as pn } from "@lexical/react/LexicalListPlugin";
23
+ import { OnChangePlugin as bn } from "@lexical/react/LexicalOnChangePlugin";
24
+ import { ContentEditable as vn } from "@lexical/react/LexicalContentEditable";
25
+ import { ClearEditorPlugin as Cn } from "@lexical/react/LexicalClearEditorPlugin";
26
+ const B = -1e3;
27
+ function yn(t, a, e = 0) {
28
+ if (!a || !a.current)
29
29
  return console.error("Invalid popover reference"), {
30
- x,
31
- y: x
30
+ x: B,
31
+ y: B
32
32
  };
33
- const n = s.current, { x: i, y: o } = e, { width: r, height: c } = n.getBoundingClientRect(), a = i - r / 2, d = o - c - t;
33
+ const n = a.current, { x: i, y: r } = t, { width: o, height: s } = n.getBoundingClientRect(), u = i - o / 2, m = r - s - e;
34
34
  return {
35
- x: a,
36
- y: d
35
+ x: u,
36
+ y: m
37
37
  };
38
38
  }
39
- function Wt(e) {
40
- if (!e || typeof e.getBoundingClientRect != "function")
39
+ function Nn(t) {
40
+ if (!t || typeof t.getBoundingClientRect != "function")
41
41
  return console.error("Invalid DOM range"), null;
42
- const s = e.getBoundingClientRect(), t = s.left + s.width / 2, n = s.top + window.scrollY;
42
+ const a = t.getBoundingClientRect(), e = a.left + a.width / 2, n = a.top + window.scrollY;
43
43
  return {
44
- x: t,
44
+ x: e,
45
45
  y: n
46
46
  };
47
47
  }
48
- function Gt(e, s, t = 0) {
49
- if (!s || !s.current)
48
+ function xn(t, a, e = 0) {
49
+ if (!a || !a.current)
50
50
  return console.error("Invalid popover reference"), {
51
- x,
52
- y: x
51
+ x: B,
52
+ y: B
53
53
  };
54
- const { x: n, y: i } = e, o = s.current, { width: r, height: c } = o.getBoundingClientRect(), a = n - r - t, d = i - c / 2;
54
+ const { x: n, y: i } = t, r = a.current, { width: o, height: s } = r.getBoundingClientRect(), u = n - o - e, m = i - s / 2;
55
55
  return {
56
- x: a,
57
- y: d
56
+ x: u,
57
+ y: m
58
58
  };
59
59
  }
60
- function zt(e, s, t = 16, n = 12) {
61
- if (!s || !s.current)
60
+ function En(t, a, e = 16, n = 12) {
61
+ if (!a || !a.current)
62
62
  return console.error("Invalid popover reference"), {
63
- x,
64
- y: x
63
+ x: B,
64
+ y: B
65
65
  };
66
- const i = s.current, { x: o, y: r } = e, { width: c } = i.getBoundingClientRect(), a = o - c - t, d = r + n;
66
+ const i = a.current, { x: r, y: o } = t, { width: s } = i.getBoundingClientRect(), u = r - s - e, m = o + n;
67
67
  return {
68
- x: a,
69
- y: d
68
+ x: u,
69
+ y: m
70
70
  };
71
71
  }
72
- const Pe = _("TOGGLE_HEADING_COMMAND"), Be = _("TOGGLE_QUOTE_COMMAND"), De = _("TOGGLE_LINK_COMMAND");
73
- function ee(e) {
74
- const s = e.anchor, t = e.focus, n = e.anchor.getNode(), i = e.focus.getNode();
75
- return n === i ? n : e.isBackward() ? he(t) ? n : i : he(s) ? n : i;
72
+ const it = Y("TOGGLE_HEADING_COMMAND"), ot = Y("TOGGLE_QUOTE_COMMAND"), st = Y("TOGGLE_LINK_COMMAND");
73
+ function ve(t) {
74
+ const a = t.anchor, e = t.focus, n = t.anchor.getNode(), i = t.focus.getNode();
75
+ return n === i ? n : t.isBackward() ? Re(e) ? n : i : Re(a) ? n : i;
76
76
  }
77
- function be(e) {
78
- const s = I(e, le);
79
- return s ? s.getTag() : null;
77
+ function Ue(t) {
78
+ const a = I(t, $e);
79
+ return a ? a.getTag() : null;
80
80
  }
81
- function qt(e) {
82
- const s = {
81
+ function Tn(t) {
82
+ const a = {
83
83
  isHeadingOne: !1,
84
84
  isHeadingTwo: !1,
85
85
  isHeadingThree: !1
86
- }, t = e.getNodes();
87
- if (!t.length) return s;
88
- const n = be(t[0]);
89
- if (!n) return s;
90
- if (t.every(
91
- (o) => be(o) === n
86
+ }, e = t.getNodes();
87
+ if (!e.length) return a;
88
+ const n = Ue(e[0]);
89
+ if (!n) return a;
90
+ if (e.every(
91
+ (r) => Ue(r) === n
92
92
  )) {
93
- const o = {
93
+ const r = {
94
94
  h1: "isHeadingOne",
95
95
  h2: "isHeadingTwo",
96
96
  h3: "isHeadingThree"
97
97
  }[n];
98
- o && (s[o] = !0);
98
+ r && (a[r] = !0);
99
99
  }
100
- return s;
100
+ return a;
101
101
  }
102
- function Ut() {
103
- const [e] = b();
104
- return u(() => e.registerCommand(
105
- Pe,
106
- (t) => {
107
- const { isHeadingOne: n, isHeadingTwo: i, isHeadingThree: o } = t, r = T();
108
- if (N(r)) {
109
- let c;
110
- n || i ? c = "h3" : o ? c = null : c = "h2", ye(
111
- r,
112
- () => c ? Oe(c) : G()
102
+ function An() {
103
+ const [t] = M();
104
+ return C(() => t.registerCommand(
105
+ it,
106
+ (e) => {
107
+ const { isHeadingOne: n, isHeadingTwo: i, isHeadingThree: r } = e, o = L();
108
+ if (w(o)) {
109
+ let s;
110
+ n || i ? s = "h3" : r ? s = null : s = "h2", nt(
111
+ o,
112
+ () => s ? rt(s) : re()
113
113
  );
114
114
  }
115
115
  return !0;
116
116
  },
117
- h
118
- ), [e]), null;
117
+ $
118
+ ), [t]), null;
119
119
  }
120
- function Yt() {
121
- const [e] = b();
122
- return u(() => {
123
- const s = e.registerNodeTransform(
124
- It,
125
- (t) => {
126
- if (t.getTag() !== "h2")
120
+ function Sn() {
121
+ const [t] = M();
122
+ return C(() => {
123
+ const a = t.registerNodeTransform(
124
+ nn,
125
+ (e) => {
126
+ if (e.getTag() !== "h2")
127
127
  return;
128
- const i = j().getFirstChild();
129
- if (i !== null && t.is(i)) {
130
- const o = t.getChildren(), r = Oe("h1");
131
- r.append(...o), t.replace(r);
128
+ const i = fe().getFirstChild();
129
+ if (i !== null && e.is(i)) {
130
+ const r = e.getChildren(), o = rt("h1");
131
+ o.append(...r), e.replace(o);
132
132
  }
133
133
  }
134
134
  );
135
135
  return () => {
136
- s();
136
+ a();
137
137
  };
138
- }, [e]), null;
138
+ }, [t]), null;
139
139
  }
140
- function Qt(e) {
141
- return I(e, $t);
140
+ function Fn(t) {
141
+ return I(t, on);
142
142
  }
143
- function jt(e) {
144
- const s = e.getNodes();
145
- return s.length ? s.length > 0 && s.every((t) => Qt(t)) : !1;
143
+ function $n(t) {
144
+ const a = t.getNodes();
145
+ return a.length ? a.length > 0 && a.every((e) => Fn(e)) : !1;
146
146
  }
147
- function Xt() {
148
- const [e] = b();
149
- return u(() => e.registerCommand(
150
- Be,
151
- (t) => {
152
- const n = T();
153
- return N(n) && ye(
147
+ function Ln() {
148
+ const [t] = M();
149
+ return C(() => t.registerCommand(
150
+ ot,
151
+ (e) => {
152
+ const n = L();
153
+ return w(n) && nt(
154
154
  n,
155
- () => t.isQuote ? G() : St()
155
+ () => e.isQuote ? re() : rn()
156
156
  ), !0;
157
157
  },
158
- h
159
- ), [e]), null;
158
+ $
159
+ ), [t]), null;
160
160
  }
161
- function ke(e) {
162
- if (!N(e))
161
+ function at(t) {
162
+ if (!w(t))
163
163
  return null;
164
- const s = ee(e);
165
- return I(s, vt);
164
+ const a = ve(t);
165
+ return I(a, an);
166
166
  }
167
- function Vt() {
168
- const [e] = b();
169
- return u(() => e.registerCommand(
170
- qe,
171
- (t) => {
172
- const n = T(), i = ke(n);
173
- return i && (t.metaKey || t.ctrlKey) ? (window.open(i.getURL(), "_blank"), !0) : !1;
167
+ function wn() {
168
+ const [t] = M();
169
+ return C(() => t.registerCommand(
170
+ Tt,
171
+ (e) => {
172
+ const n = L(), i = at(n);
173
+ return i && (e.metaKey || e.ctrlKey) ? (window.open(i.getURL(), "_blank"), !0) : !1;
174
174
  },
175
- Se
176
- ), [e]), u(() => e.registerCommand(
177
- De,
178
- (t) => (xt(t), !0),
179
- h
180
- ), [e]), null;
175
+ Ve
176
+ ), [t]), C(() => t.registerCommand(
177
+ st,
178
+ (e) => (sn(e), !0),
179
+ $
180
+ ), [t]), null;
181
181
  }
182
- function Zt() {
183
- const [e] = b(), s = "heading-above";
184
- return u(() => e.registerNodeTransform(
185
- z,
182
+ function kn() {
183
+ const [t] = M(), a = "heading-above";
184
+ return C(() => t.registerNodeTransform(
185
+ ie,
186
186
  (n) => {
187
- const i = I(n, R) || I(n, yt);
188
- if (!i || le(i))
187
+ const i = I(n, V) || I(n, ln);
188
+ if (!i || $e(i))
189
189
  return;
190
- const o = i, r = e.getElementByKey(o.getKey());
191
- if (!r)
190
+ const r = i, o = t.getElementByKey(r.getKey());
191
+ if (!o)
192
192
  return;
193
- const c = o.getPreviousSibling(), a = le(c), d = r.classList.contains(s);
194
- a && !d ? r.classList.add(s) : !a && d && r.classList.remove(s);
193
+ const s = r.getPreviousSibling(), u = $e(s), m = o.classList.contains(a);
194
+ u && !m ? o.classList.add(a) : !u && m && o.classList.remove(a);
195
195
  }
196
- ), [e]), null;
196
+ ), [t]), null;
197
197
  }
198
- function Jt({ isHeadingOneFirst: e }) {
199
- return /* @__PURE__ */ $(Ie, { children: [
200
- /* @__PURE__ */ l(Ut, {}),
201
- e && /* @__PURE__ */ l(Yt, {}),
202
- /* @__PURE__ */ l(Xt, {}),
203
- /* @__PURE__ */ l(Vt, {}),
204
- /* @__PURE__ */ l(Zt, {})
198
+ function In({ isHeadingOneFirst: t }) {
199
+ return /* @__PURE__ */ D(Xe, { children: [
200
+ /* @__PURE__ */ h(An, {}),
201
+ t && /* @__PURE__ */ h(Sn, {}),
202
+ /* @__PURE__ */ h(Ln, {}),
203
+ /* @__PURE__ */ h(wn, {}),
204
+ /* @__PURE__ */ h(kn, {})
205
205
  ] });
206
206
  }
207
- function en({ style: e, closeToolbar: s, existingLinkURL: t }) {
208
- const [n] = b(), [i, o] = M(t);
209
- return /* @__PURE__ */ $(ge, { style: e, "aria-details": "link toolbar", id: "link-toolbar", children: [
210
- /* @__PURE__ */ l(
211
- rt,
207
+ function Mn({ style: t, closeToolbar: a, existingLinkURL: e }) {
208
+ const [n] = M(), [i, r] = O(e);
209
+ return /* @__PURE__ */ D(Me, { style: t, "aria-details": "link toolbar", id: "link-toolbar", children: [
210
+ /* @__PURE__ */ h(
211
+ _t,
212
212
  {
213
213
  "aria-label": "url",
214
214
  autoFocus: !0,
215
215
  defaultValue: i,
216
- onChange: o,
217
- children: /* @__PURE__ */ l(xe, { placeholder: "Enter Link" })
216
+ onChange: r,
217
+ children: /* @__PURE__ */ h(et, { placeholder: "Enter Link" })
218
218
  }
219
219
  ),
220
- /* @__PURE__ */ $(W, { "aria-label": "edit link", children: [
221
- /* @__PURE__ */ l(
222
- B,
220
+ /* @__PURE__ */ D(ne, { "aria-label": "edit link", children: [
221
+ /* @__PURE__ */ h(
222
+ U,
223
223
  {
224
224
  "aria-label": "Update link",
225
225
  onPress: () => {
226
- const r = i === "" ? null : i;
227
- n.dispatchCommand(De, r), s();
226
+ const o = i === "" ? null : i;
227
+ n.dispatchCommand(st, o), a();
228
228
  },
229
- children: /* @__PURE__ */ l(dt, { size: O })
229
+ children: /* @__PURE__ */ h(Wt, { size: K })
230
230
  }
231
231
  ),
232
- /* @__PURE__ */ l(B, { "aria-label": "Discard changes", onPress: s, children: /* @__PURE__ */ l(ut, { size: O }) })
232
+ /* @__PURE__ */ h(U, { "aria-label": "Discard changes", onPress: a, children: /* @__PURE__ */ h(Gt, { size: K }) })
233
233
  ] }),
234
- /* @__PURE__ */ l("div", { className: "inline-toolbar-pointer" })
234
+ /* @__PURE__ */ h("div", { className: "inline-toolbar-pointer" })
235
235
  ] });
236
236
  }
237
- const O = 24, tn = 16;
238
- function nn({ editor: e }) {
239
- const [s, t] = M(null), [n, i] = M({
240
- x,
241
- y: x
242
- }), o = U(null), [r, c] = M({
237
+ const K = 24, On = 16;
238
+ function Pn({ editor: t }) {
239
+ const [a, e] = O(null), [n, i] = O({
240
+ x: B,
241
+ y: B
242
+ }), r = se(null), [o, s] = O({
243
243
  isBold: !1,
244
244
  isItalic: !1,
245
245
  isCode: !1,
@@ -247,85 +247,85 @@ function nn({ editor: e }) {
247
247
  isHeadingTwo: !1,
248
248
  isHeadingThree: !1,
249
249
  isQuote: !1
250
- }), [a, d] = M(!1), [E, m] = M(0), [L, C] = M(""), f = (g) => {
251
- if (N(g)) {
252
- c({
253
- isBold: g.hasFormat("bold"),
254
- isItalic: g.hasFormat("italic"),
255
- isCode: g.hasFormat("code"),
256
- isQuote: jt(g)
250
+ }), [u, m] = O(!1), [A, T] = O(0), [S, F] = O(""), N = (p) => {
251
+ if (w(p)) {
252
+ s({
253
+ isBold: p.hasFormat("bold"),
254
+ isItalic: p.hasFormat("italic"),
255
+ isCode: p.hasFormat("code"),
256
+ isQuote: $n(p)
257
257
  });
258
- const p = qt(g);
259
- c((v) => ({
260
- ...v,
261
- ...p
258
+ const y = Tn(p);
259
+ s((l) => ({
260
+ ...l,
261
+ ...y
262
262
  }));
263
- const S = ke(g);
264
- C(S ? S.getURL() : "");
263
+ const E = at(p);
264
+ F(E ? E.getURL() : "");
265
265
  }
266
266
  };
267
- return u(() => {
268
- e.read(() => {
269
- const g = T();
270
- f(g);
267
+ return C(() => {
268
+ t.read(() => {
269
+ const p = L();
270
+ N(p);
271
271
  });
272
- }, [e]), u(() => e.registerUpdateListener(
273
- ({ editorState: p }) => {
274
- p.read(() => {
275
- const S = T();
276
- f(S);
272
+ }, [t]), C(() => t.registerUpdateListener(
273
+ ({ editorState: y }) => {
274
+ y.read(() => {
275
+ const E = L();
276
+ N(E);
277
277
  });
278
278
  }
279
- ), [e]), u(() => {
280
- e.read(() => {
281
- const g = T();
282
- if (N(g)) {
283
- const [p, S] = g.getStartEndPoints(), [v, D] = [
284
- p.getNode(),
285
- S.getNode()
286
- ], [y, te] = Ue(g), ne = Mt(
287
- e,
288
- v,
289
- y,
290
- D,
291
- te
279
+ ), [t]), C(() => {
280
+ t.read(() => {
281
+ const p = L();
282
+ if (w(p)) {
283
+ const [y, E] = p.getStartEndPoints(), [l, c] = [
284
+ y.getNode(),
285
+ E.getNode()
286
+ ], [d, g] = At(p), f = tn(
287
+ t,
288
+ l,
289
+ d,
290
+ c,
291
+ g
292
292
  );
293
- t(Wt(ne));
293
+ e(Nn(f));
294
294
  }
295
295
  });
296
- }, [e, r]), u(() => {
297
- var g;
298
- s ? (i(
299
- Kt(
300
- s,
301
- o,
302
- tn
296
+ }, [t, o]), C(() => {
297
+ var p;
298
+ a ? (i(
299
+ yn(
300
+ a,
301
+ r,
302
+ On
303
303
  )
304
304
  ), setTimeout(() => {
305
- var p;
306
- (p = o.current) == null || p.classList.add("visible");
307
- }, 50)) : (g = o.current) == null || g.classList.remove("visible");
308
- }, [s]), nt(() => {
309
- if (o.current) {
310
- const g = window.getComputedStyle(o.current), p = parseFloat(g.width);
311
- m(p);
305
+ var y;
306
+ (y = r.current) == null || y.classList.add("visible");
307
+ }, 50)) : (p = r.current) == null || p.classList.remove("visible");
308
+ }, [a]), Ot(() => {
309
+ if (r.current) {
310
+ const p = window.getComputedStyle(r.current), y = parseFloat(p.width);
311
+ T(y);
312
312
  }
313
- }, [s]), s && (a ? /* @__PURE__ */ l(
314
- en,
313
+ }, [a]), a && (u ? /* @__PURE__ */ h(
314
+ Mn,
315
315
  {
316
316
  style: {
317
317
  position: "absolute",
318
318
  top: n.y,
319
319
  left: n.x,
320
- width: E
320
+ width: A
321
321
  },
322
322
  closeToolbar: () => {
323
- d(!1), t(null);
323
+ m(!1), e(null);
324
324
  },
325
- existingLinkURL: L
325
+ existingLinkURL: S
326
326
  }
327
- ) : /* @__PURE__ */ $(
328
- ge,
327
+ ) : /* @__PURE__ */ D(
328
+ Me,
329
329
  {
330
330
  style: {
331
331
  position: "absolute",
@@ -334,879 +334,2082 @@ function nn({ editor: e }) {
334
334
  },
335
335
  "aria-label": "Text formatting",
336
336
  id: "inline-toolbar",
337
- ref: o,
337
+ ref: r,
338
338
  children: [
339
- /* @__PURE__ */ $(W, { "aria-label": "Style", children: [
340
- /* @__PURE__ */ l(
341
- w,
339
+ /* @__PURE__ */ D(ne, { "aria-label": "Style", children: [
340
+ /* @__PURE__ */ h(
341
+ ee,
342
342
  {
343
343
  "aria-label": "Bold",
344
- isSelected: r.isBold,
345
- isDisabled: r.isCode || r.isHeadingOne || r.isHeadingTwo || r.isHeadingThree,
346
- onChange: () => e.dispatchCommand(oe, "bold"),
347
- children: /* @__PURE__ */ l(gt, { size: O })
344
+ isSelected: o.isBold,
345
+ isDisabled: o.isCode || o.isHeadingOne || o.isHeadingTwo || o.isHeadingThree,
346
+ onChange: () => t.dispatchCommand(xe, "bold"),
347
+ children: /* @__PURE__ */ h(Kt, { size: K })
348
348
  }
349
349
  ),
350
- /* @__PURE__ */ l(
351
- w,
350
+ /* @__PURE__ */ h(
351
+ ee,
352
352
  {
353
353
  "aria-label": "Italic",
354
- isSelected: r.isItalic,
355
- isDisabled: r.isCode || r.isHeadingOne,
356
- onChange: () => e.dispatchCommand(oe, "italic"),
357
- children: /* @__PURE__ */ l(ft, { size: O })
354
+ isSelected: o.isItalic,
355
+ isDisabled: o.isCode || o.isHeadingOne,
356
+ onChange: () => t.dispatchCommand(xe, "italic"),
357
+ children: /* @__PURE__ */ h(qt, { size: K })
358
358
  }
359
359
  ),
360
- /* @__PURE__ */ l(
361
- w,
360
+ /* @__PURE__ */ h(
361
+ ee,
362
362
  {
363
363
  "aria-label": "inline-code",
364
- isDisabled: r.isHeadingOne,
365
- isSelected: r.isCode,
366
- onChange: () => e.dispatchCommand(oe, "code"),
367
- children: /* @__PURE__ */ l(mt, { size: O })
364
+ isDisabled: o.isHeadingOne,
365
+ isSelected: o.isCode,
366
+ onChange: () => t.dispatchCommand(xe, "code"),
367
+ children: /* @__PURE__ */ h(Ut, { size: K })
368
368
  }
369
369
  )
370
370
  ] }),
371
- /* @__PURE__ */ l(me, { orientation: "vertical" }),
372
- /* @__PURE__ */ $(W, { "aria-label": "Text Blocks", children: [
373
- /* @__PURE__ */ l(
374
- w,
371
+ /* @__PURE__ */ h(He, { orientation: "vertical" }),
372
+ /* @__PURE__ */ D(ne, { "aria-label": "Text Blocks", children: [
373
+ /* @__PURE__ */ h(
374
+ ee,
375
375
  {
376
376
  "aria-label": "Heading",
377
- isSelected: r.isHeadingOne || r.isHeadingTwo || r.isHeadingThree,
378
- onChange: () => e.dispatchCommand(Pe, r),
379
- children: /* @__PURE__ */ l(ht, { size: O })
377
+ isSelected: o.isHeadingOne || o.isHeadingTwo || o.isHeadingThree,
378
+ onChange: () => t.dispatchCommand(it, o),
379
+ children: /* @__PURE__ */ h(jt, { size: K })
380
380
  }
381
381
  ),
382
- /* @__PURE__ */ l(
383
- w,
382
+ /* @__PURE__ */ h(
383
+ ee,
384
384
  {
385
385
  "aria-label": "Quote",
386
- isSelected: r.isQuote,
387
- onChange: () => e.dispatchCommand(Be, r),
388
- children: /* @__PURE__ */ l(Nt, { size: O })
386
+ isSelected: o.isQuote,
387
+ onChange: () => t.dispatchCommand(ot, o),
388
+ children: /* @__PURE__ */ h(Yt, { size: K })
389
389
  }
390
390
  )
391
391
  ] }),
392
- /* @__PURE__ */ l(me, { orientation: "vertical" }),
393
- /* @__PURE__ */ l(W, { "aria-label": "Links", children: /* @__PURE__ */ l(
394
- B,
392
+ /* @__PURE__ */ h(He, { orientation: "vertical" }),
393
+ /* @__PURE__ */ h(ne, { "aria-label": "Links", children: /* @__PURE__ */ h(
394
+ U,
395
395
  {
396
- onPress: () => d(!0),
397
- isDisabled: r.isHeadingOne,
398
- children: /* @__PURE__ */ l(Ct, { size: O })
396
+ onPress: () => m(!0),
397
+ isDisabled: o.isHeadingOne,
398
+ children: /* @__PURE__ */ h(Zt, { size: K })
399
399
  }
400
400
  ) }),
401
- /* @__PURE__ */ l("div", { className: "inline-toolbar-pointer" })
401
+ /* @__PURE__ */ h("div", { className: "inline-toolbar-pointer" })
402
402
  ]
403
403
  }
404
404
  ));
405
405
  }
406
- const on = document.body;
407
- function rn() {
408
- const [e, s] = M(!1), [t] = b();
409
- return u(() => t.registerCommand(
410
- A,
406
+ const _n = document.body;
407
+ function Dn() {
408
+ const [t, a] = O(!1), [e] = M();
409
+ return C(() => e.registerCommand(
410
+ j,
411
411
  () => {
412
- const i = T();
413
- if (!N(i) || i.isCollapsed())
414
- return s(!1), !1;
415
- const o = i.getNodes(), r = o.some((d) => H(d)), c = o.length === 1 && (F(o[0]) || I(o[0], k)), a = o.some(
416
- (d) => I(d, Z)
412
+ const i = L();
413
+ if (!w(i) || i.isCollapsed())
414
+ return a(!1), !1;
415
+ const r = i.getNodes(), o = r.some((m) => X(m)), s = r.length === 1 && (Q(r[0]) || I(r[0], G)), u = r.some(
416
+ (m) => I(m, pe)
417
417
  );
418
- return s(!r && !c && !a), !1;
418
+ return a(!o && !s && !u), !1;
419
419
  },
420
- h
421
- ), [t]), u(() => t.registerCommand(
422
- J,
420
+ $
421
+ ), [e]), C(() => e.registerCommand(
422
+ be,
423
423
  () => (setTimeout(() => {
424
- const i = document.getElementById("inline-toolbar"), o = document.getElementById("link-toolbar"), r = document.activeElement;
425
- i && (i === r || i.contains(r)) || o && (o === r || o.contains(r)) || s(!1);
424
+ const i = document.getElementById("inline-toolbar"), r = document.getElementById("link-toolbar"), o = document.activeElement;
425
+ i && (i === o || i.contains(o)) || r && (r === o || r.contains(o)) || a(!1);
426
426
  }, 0), !1),
427
- h
428
- ), [t]), e && ue(/* @__PURE__ */ l(nn, { editor: t }), on);
427
+ $
428
+ ), [e]), t && Ie(/* @__PURE__ */ h(Pn, { editor: e }), _n);
429
429
  }
430
- function sn({ codeBlockCoords: e, codeNodeKey: s }) {
431
- const [t] = b(), [n, i] = M({
432
- x,
433
- y: x
434
- }), o = U(null), [r, c] = M(""), a = At(), d = Array.from(
435
- new Set(a.map((m) => se(m)))
436
- ), E = {};
437
- return a.forEach((m) => {
438
- const L = se(m);
439
- E[L] || (E[L] = m);
440
- }), u(() => {
441
- i(zt(e, o));
442
- }, [e]), u(() => {
443
- t.read(() => {
444
- if (s) {
445
- const L = q(s).getLanguage();
446
- c(se(L));
430
+ var je = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
431
+ function Bn(t) {
432
+ return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
433
+ }
434
+ var Se = { exports: {} }, Ye;
435
+ function Hn() {
436
+ return Ye || (Ye = 1, function(t) {
437
+ var a = typeof window < "u" ? window : typeof WorkerGlobalScope < "u" && self instanceof WorkerGlobalScope ? self : {};
438
+ /**
439
+ * Prism: Lightweight, robust, elegant syntax highlighting
440
+ *
441
+ * @license MIT <https://opensource.org/licenses/MIT>
442
+ * @author Lea Verou <https://lea.verou.me>
443
+ * @namespace
444
+ * @public
445
+ */
446
+ var e = function(n) {
447
+ var i = /(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i, r = 0, o = {}, s = {
448
+ /**
449
+ * By default, Prism will attempt to highlight all code elements (by calling {@link Prism.highlightAll}) on the
450
+ * current page after the page finished loading. This might be a problem if e.g. you wanted to asynchronously load
451
+ * additional languages or plugins yourself.
452
+ *
453
+ * By setting this value to `true`, Prism will not automatically highlight all code elements on the page.
454
+ *
455
+ * You obviously have to change this value before the automatic highlighting started. To do this, you can add an
456
+ * empty Prism object into the global scope before loading the Prism script like this:
457
+ *
458
+ * ```js
459
+ * window.Prism = window.Prism || {};
460
+ * Prism.manual = true;
461
+ * // add a new <script> to load Prism's script
462
+ * ```
463
+ *
464
+ * @default false
465
+ * @type {boolean}
466
+ * @memberof Prism
467
+ * @public
468
+ */
469
+ manual: n.Prism && n.Prism.manual,
470
+ /**
471
+ * By default, if Prism is in a web worker, it assumes that it is in a worker it created itself, so it uses
472
+ * `addEventListener` to communicate with its parent instance. However, if you're using Prism manually in your
473
+ * own worker, you don't want it to do this.
474
+ *
475
+ * By setting this value to `true`, Prism will not add its own listeners to the worker.
476
+ *
477
+ * You obviously have to change this value before Prism executes. To do this, you can add an
478
+ * empty Prism object into the global scope before loading the Prism script like this:
479
+ *
480
+ * ```js
481
+ * window.Prism = window.Prism || {};
482
+ * Prism.disableWorkerMessageHandler = true;
483
+ * // Load Prism's script
484
+ * ```
485
+ *
486
+ * @default false
487
+ * @type {boolean}
488
+ * @memberof Prism
489
+ * @public
490
+ */
491
+ disableWorkerMessageHandler: n.Prism && n.Prism.disableWorkerMessageHandler,
492
+ /**
493
+ * A namespace for utility methods.
494
+ *
495
+ * All function in this namespace that are not explicitly marked as _public_ are for __internal use only__ and may
496
+ * change or disappear at any time.
497
+ *
498
+ * @namespace
499
+ * @memberof Prism
500
+ */
501
+ util: {
502
+ encode: function l(c) {
503
+ return c instanceof u ? new u(c.type, l(c.content), c.alias) : Array.isArray(c) ? c.map(l) : c.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/\u00a0/g, " ");
504
+ },
505
+ /**
506
+ * Returns the name of the type of the given value.
507
+ *
508
+ * @param {any} o
509
+ * @returns {string}
510
+ * @example
511
+ * type(null) === 'Null'
512
+ * type(undefined) === 'Undefined'
513
+ * type(123) === 'Number'
514
+ * type('foo') === 'String'
515
+ * type(true) === 'Boolean'
516
+ * type([1, 2]) === 'Array'
517
+ * type({}) === 'Object'
518
+ * type(String) === 'Function'
519
+ * type(/abc+/) === 'RegExp'
520
+ */
521
+ type: function(l) {
522
+ return Object.prototype.toString.call(l).slice(8, -1);
523
+ },
524
+ /**
525
+ * Returns a unique number for the given object. Later calls will still return the same number.
526
+ *
527
+ * @param {Object} obj
528
+ * @returns {number}
529
+ */
530
+ objId: function(l) {
531
+ return l.__id || Object.defineProperty(l, "__id", { value: ++r }), l.__id;
532
+ },
533
+ /**
534
+ * Creates a deep clone of the given object.
535
+ *
536
+ * The main intended use of this function is to clone language definitions.
537
+ *
538
+ * @param {T} o
539
+ * @param {Record<number, any>} [visited]
540
+ * @returns {T}
541
+ * @template T
542
+ */
543
+ clone: function l(c, d) {
544
+ d = d || {};
545
+ var g, f;
546
+ switch (s.util.type(c)) {
547
+ case "Object":
548
+ if (f = s.util.objId(c), d[f])
549
+ return d[f];
550
+ g = /** @type {Record<string, any>} */
551
+ {}, d[f] = g;
552
+ for (var v in c)
553
+ c.hasOwnProperty(v) && (g[v] = l(c[v], d));
554
+ return (
555
+ /** @type {any} */
556
+ g
557
+ );
558
+ case "Array":
559
+ return f = s.util.objId(c), d[f] ? d[f] : (g = [], d[f] = g, /** @type {Array} */
560
+ /** @type {any} */
561
+ c.forEach(function(x, b) {
562
+ g[b] = l(x, d);
563
+ }), /** @type {any} */
564
+ g);
565
+ default:
566
+ return c;
567
+ }
568
+ },
569
+ /**
570
+ * Returns the Prism language of the given element set by a `language-xxxx` or `lang-xxxx` class.
571
+ *
572
+ * If no language is set for the element or the element is `null` or `undefined`, `none` will be returned.
573
+ *
574
+ * @param {Element} element
575
+ * @returns {string}
576
+ */
577
+ getLanguage: function(l) {
578
+ for (; l; ) {
579
+ var c = i.exec(l.className);
580
+ if (c)
581
+ return c[1].toLowerCase();
582
+ l = l.parentElement;
583
+ }
584
+ return "none";
585
+ },
586
+ /**
587
+ * Sets the Prism `language-xxxx` class of the given element.
588
+ *
589
+ * @param {Element} element
590
+ * @param {string} language
591
+ * @returns {void}
592
+ */
593
+ setLanguage: function(l, c) {
594
+ l.className = l.className.replace(RegExp(i, "gi"), ""), l.classList.add("language-" + c);
595
+ },
596
+ /**
597
+ * Returns the script element that is currently executing.
598
+ *
599
+ * This does __not__ work for line script element.
600
+ *
601
+ * @returns {HTMLScriptElement | null}
602
+ */
603
+ currentScript: function() {
604
+ if (typeof document > "u")
605
+ return null;
606
+ if (document.currentScript && document.currentScript.tagName === "SCRIPT")
607
+ return (
608
+ /** @type {any} */
609
+ document.currentScript
610
+ );
611
+ try {
612
+ throw new Error();
613
+ } catch (g) {
614
+ var l = (/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(g.stack) || [])[1];
615
+ if (l) {
616
+ var c = document.getElementsByTagName("script");
617
+ for (var d in c)
618
+ if (c[d].src == l)
619
+ return c[d];
620
+ }
621
+ return null;
622
+ }
623
+ },
624
+ /**
625
+ * Returns whether a given class is active for `element`.
626
+ *
627
+ * The class can be activated if `element` or one of its ancestors has the given class and it can be deactivated
628
+ * if `element` or one of its ancestors has the negated version of the given class. The _negated version_ of the
629
+ * given class is just the given class with a `no-` prefix.
630
+ *
631
+ * Whether the class is active is determined by the closest ancestor of `element` (where `element` itself is
632
+ * closest ancestor) that has the given class or the negated version of it. If neither `element` nor any of its
633
+ * ancestors have the given class or the negated version of it, then the default activation will be returned.
634
+ *
635
+ * In the paradoxical situation where the closest ancestor contains __both__ the given class and the negated
636
+ * version of it, the class is considered active.
637
+ *
638
+ * @param {Element} element
639
+ * @param {string} className
640
+ * @param {boolean} [defaultActivation=false]
641
+ * @returns {boolean}
642
+ */
643
+ isActive: function(l, c, d) {
644
+ for (var g = "no-" + c; l; ) {
645
+ var f = l.classList;
646
+ if (f.contains(c))
647
+ return !0;
648
+ if (f.contains(g))
649
+ return !1;
650
+ l = l.parentElement;
651
+ }
652
+ return !!d;
653
+ }
654
+ },
655
+ /**
656
+ * This namespace contains all currently loaded languages and the some helper functions to create and modify languages.
657
+ *
658
+ * @namespace
659
+ * @memberof Prism
660
+ * @public
661
+ */
662
+ languages: {
663
+ /**
664
+ * The grammar for plain, unformatted text.
665
+ */
666
+ plain: o,
667
+ plaintext: o,
668
+ text: o,
669
+ txt: o,
670
+ /**
671
+ * Creates a deep copy of the language with the given id and appends the given tokens.
672
+ *
673
+ * If a token in `redef` also appears in the copied language, then the existing token in the copied language
674
+ * will be overwritten at its original position.
675
+ *
676
+ * ## Best practices
677
+ *
678
+ * Since the position of overwriting tokens (token in `redef` that overwrite tokens in the copied language)
679
+ * doesn't matter, they can technically be in any order. However, this can be confusing to others that trying to
680
+ * understand the language definition because, normally, the order of tokens matters in Prism grammars.
681
+ *
682
+ * Therefore, it is encouraged to order overwriting tokens according to the positions of the overwritten tokens.
683
+ * Furthermore, all non-overwriting tokens should be placed after the overwriting ones.
684
+ *
685
+ * @param {string} id The id of the language to extend. This has to be a key in `Prism.languages`.
686
+ * @param {Grammar} redef The new tokens to append.
687
+ * @returns {Grammar} The new language created.
688
+ * @public
689
+ * @example
690
+ * Prism.languages['css-with-colors'] = Prism.languages.extend('css', {
691
+ * // Prism.languages.css already has a 'comment' token, so this token will overwrite CSS' 'comment' token
692
+ * // at its original position
693
+ * 'comment': { ... },
694
+ * // CSS doesn't have a 'color' token, so this token will be appended
695
+ * 'color': /\b(?:red|green|blue)\b/
696
+ * });
697
+ */
698
+ extend: function(l, c) {
699
+ var d = s.util.clone(s.languages[l]);
700
+ for (var g in c)
701
+ d[g] = c[g];
702
+ return d;
703
+ },
704
+ /**
705
+ * Inserts tokens _before_ another token in a language definition or any other grammar.
706
+ *
707
+ * ## Usage
708
+ *
709
+ * This helper method makes it easy to modify existing languages. For example, the CSS language definition
710
+ * not only defines CSS highlighting for CSS documents, but also needs to define highlighting for CSS embedded
711
+ * in HTML through `<style>` elements. To do this, it needs to modify `Prism.languages.markup` and add the
712
+ * appropriate tokens. However, `Prism.languages.markup` is a regular JavaScript object literal, so if you do
713
+ * this:
714
+ *
715
+ * ```js
716
+ * Prism.languages.markup.style = {
717
+ * // token
718
+ * };
719
+ * ```
720
+ *
721
+ * then the `style` token will be added (and processed) at the end. `insertBefore` allows you to insert tokens
722
+ * before existing tokens. For the CSS example above, you would use it like this:
723
+ *
724
+ * ```js
725
+ * Prism.languages.insertBefore('markup', 'cdata', {
726
+ * 'style': {
727
+ * // token
728
+ * }
729
+ * });
730
+ * ```
731
+ *
732
+ * ## Special cases
733
+ *
734
+ * If the grammars of `inside` and `insert` have tokens with the same name, the tokens in `inside`'s grammar
735
+ * will be ignored.
736
+ *
737
+ * This behavior can be used to insert tokens after `before`:
738
+ *
739
+ * ```js
740
+ * Prism.languages.insertBefore('markup', 'comment', {
741
+ * 'comment': Prism.languages.markup.comment,
742
+ * // tokens after 'comment'
743
+ * });
744
+ * ```
745
+ *
746
+ * ## Limitations
747
+ *
748
+ * The main problem `insertBefore` has to solve is iteration order. Since ES2015, the iteration order for object
749
+ * properties is guaranteed to be the insertion order (except for integer keys) but some browsers behave
750
+ * differently when keys are deleted and re-inserted. So `insertBefore` can't be implemented by temporarily
751
+ * deleting properties which is necessary to insert at arbitrary positions.
752
+ *
753
+ * To solve this problem, `insertBefore` doesn't actually insert the given tokens into the target object.
754
+ * Instead, it will create a new object and replace all references to the target object with the new one. This
755
+ * can be done without temporarily deleting properties, so the iteration order is well-defined.
756
+ *
757
+ * However, only references that can be reached from `Prism.languages` or `insert` will be replaced. I.e. if
758
+ * you hold the target object in a variable, then the value of the variable will not change.
759
+ *
760
+ * ```js
761
+ * var oldMarkup = Prism.languages.markup;
762
+ * var newMarkup = Prism.languages.insertBefore('markup', 'comment', { ... });
763
+ *
764
+ * assert(oldMarkup !== Prism.languages.markup);
765
+ * assert(newMarkup === Prism.languages.markup);
766
+ * ```
767
+ *
768
+ * @param {string} inside The property of `root` (e.g. a language id in `Prism.languages`) that contains the
769
+ * object to be modified.
770
+ * @param {string} before The key to insert before.
771
+ * @param {Grammar} insert An object containing the key-value pairs to be inserted.
772
+ * @param {Object<string, any>} [root] The object containing `inside`, i.e. the object that contains the
773
+ * object to be modified.
774
+ *
775
+ * Defaults to `Prism.languages`.
776
+ * @returns {Grammar} The new grammar object.
777
+ * @public
778
+ */
779
+ insertBefore: function(l, c, d, g) {
780
+ g = g || /** @type {any} */
781
+ s.languages;
782
+ var f = g[l], v = {};
783
+ for (var x in f)
784
+ if (f.hasOwnProperty(x)) {
785
+ if (x == c)
786
+ for (var b in d)
787
+ d.hasOwnProperty(b) && (v[b] = d[b]);
788
+ d.hasOwnProperty(x) || (v[x] = f[x]);
789
+ }
790
+ var k = g[l];
791
+ return g[l] = v, s.languages.DFS(s.languages, function(P, z) {
792
+ z === k && P != l && (this[P] = v);
793
+ }), v;
794
+ },
795
+ // Traverse a language definition with Depth First Search
796
+ DFS: function l(c, d, g, f) {
797
+ f = f || {};
798
+ var v = s.util.objId;
799
+ for (var x in c)
800
+ if (c.hasOwnProperty(x)) {
801
+ d.call(c, x, c[x], g || x);
802
+ var b = c[x], k = s.util.type(b);
803
+ k === "Object" && !f[v(b)] ? (f[v(b)] = !0, l(b, d, null, f)) : k === "Array" && !f[v(b)] && (f[v(b)] = !0, l(b, d, x, f));
804
+ }
805
+ }
806
+ },
807
+ plugins: {},
808
+ /**
809
+ * This is the most high-level function in Prism’s API.
810
+ * It fetches all the elements that have a `.language-xxxx` class and then calls {@link Prism.highlightElement} on
811
+ * each one of them.
812
+ *
813
+ * This is equivalent to `Prism.highlightAllUnder(document, async, callback)`.
814
+ *
815
+ * @param {boolean} [async=false] Same as in {@link Prism.highlightAllUnder}.
816
+ * @param {HighlightCallback} [callback] Same as in {@link Prism.highlightAllUnder}.
817
+ * @memberof Prism
818
+ * @public
819
+ */
820
+ highlightAll: function(l, c) {
821
+ s.highlightAllUnder(document, l, c);
822
+ },
823
+ /**
824
+ * Fetches all the descendants of `container` that have a `.language-xxxx` class and then calls
825
+ * {@link Prism.highlightElement} on each one of them.
826
+ *
827
+ * The following hooks will be run:
828
+ * 1. `before-highlightall`
829
+ * 2. `before-all-elements-highlight`
830
+ * 3. All hooks of {@link Prism.highlightElement} for each element.
831
+ *
832
+ * @param {ParentNode} container The root element, whose descendants that have a `.language-xxxx` class will be highlighted.
833
+ * @param {boolean} [async=false] Whether each element is to be highlighted asynchronously using Web Workers.
834
+ * @param {HighlightCallback} [callback] An optional callback to be invoked on each element after its highlighting is done.
835
+ * @memberof Prism
836
+ * @public
837
+ */
838
+ highlightAllUnder: function(l, c, d) {
839
+ var g = {
840
+ callback: d,
841
+ container: l,
842
+ selector: 'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'
843
+ };
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);
845
+ for (var f = 0, v; v = g.elements[f++]; )
846
+ s.highlightElement(v, c === !0, g.callback);
847
+ },
848
+ /**
849
+ * Highlights the code inside a single element.
850
+ *
851
+ * The following hooks will be run:
852
+ * 1. `before-sanity-check`
853
+ * 2. `before-highlight`
854
+ * 3. All hooks of {@link Prism.highlight}. These hooks will be run by an asynchronous worker if `async` is `true`.
855
+ * 4. `before-insert`
856
+ * 5. `after-highlight`
857
+ * 6. `complete`
858
+ *
859
+ * Some the above hooks will be skipped if the element doesn't contain any text or there is no grammar loaded for
860
+ * the element's language.
861
+ *
862
+ * @param {Element} element The element containing the code.
863
+ * It must have a class of `language-xxxx` to be processed, where `xxxx` is a valid language identifier.
864
+ * @param {boolean} [async=false] Whether the element is to be highlighted asynchronously using Web Workers
865
+ * to improve performance and avoid blocking the UI when highlighting very large chunks of code. This option is
866
+ * [disabled by default](https://prismjs.com/faq.html#why-is-asynchronous-highlighting-disabled-by-default).
867
+ *
868
+ * Note: All language definitions required to highlight the code must be included in the main `prism.js` file for
869
+ * asynchronous highlighting to work. You can build your own bundle on the
870
+ * [Download page](https://prismjs.com/download.html).
871
+ * @param {HighlightCallback} [callback] An optional callback to be invoked after the highlighting is done.
872
+ * Mostly useful when `async` is `true`, since in that case, the highlighting is done asynchronously.
873
+ * @memberof Prism
874
+ * @public
875
+ */
876
+ highlightElement: function(l, c, d) {
877
+ var g = s.util.getLanguage(l), f = s.languages[g];
878
+ s.util.setLanguage(l, g);
879
+ var v = l.parentElement;
880
+ v && v.nodeName.toLowerCase() === "pre" && s.util.setLanguage(v, g);
881
+ var x = l.textContent, b = {
882
+ element: l,
883
+ language: g,
884
+ grammar: f,
885
+ code: x
886
+ };
887
+ function k(z) {
888
+ b.highlightedCode = z, s.hooks.run("before-insert", b), b.element.innerHTML = b.highlightedCode, s.hooks.run("after-highlight", b), s.hooks.run("complete", b), d && d.call(b.element);
889
+ }
890
+ if (s.hooks.run("before-sanity-check", b), v = b.element.parentElement, v && v.nodeName.toLowerCase() === "pre" && !v.hasAttribute("tabindex") && v.setAttribute("tabindex", "0"), !b.code) {
891
+ s.hooks.run("complete", b), d && d.call(b.element);
892
+ return;
893
+ }
894
+ if (s.hooks.run("before-highlight", b), !b.grammar) {
895
+ k(s.util.encode(b.code));
896
+ return;
897
+ }
898
+ if (c && n.Worker) {
899
+ var P = new Worker(s.filename);
900
+ P.onmessage = function(z) {
901
+ k(z.data);
902
+ }, P.postMessage(JSON.stringify({
903
+ language: b.language,
904
+ code: b.code,
905
+ immediateClose: !0
906
+ }));
907
+ } else
908
+ k(s.highlight(b.code, b.grammar, b.language));
909
+ },
910
+ /**
911
+ * Low-level function, only use if you know what you’re doing. It accepts a string of text as input
912
+ * and the language definitions to use, and returns a string with the HTML produced.
913
+ *
914
+ * The following hooks will be run:
915
+ * 1. `before-tokenize`
916
+ * 2. `after-tokenize`
917
+ * 3. `wrap`: On each {@link Token}.
918
+ *
919
+ * @param {string} text A string with the code to be highlighted.
920
+ * @param {Grammar} grammar An object containing the tokens to use.
921
+ *
922
+ * Usually a language definition like `Prism.languages.markup`.
923
+ * @param {string} language The name of the language definition passed to `grammar`.
924
+ * @returns {string} The highlighted HTML.
925
+ * @memberof Prism
926
+ * @public
927
+ * @example
928
+ * Prism.highlight('var foo = true;', Prism.languages.javascript, 'javascript');
929
+ */
930
+ highlight: function(l, c, d) {
931
+ var g = {
932
+ code: l,
933
+ grammar: c,
934
+ language: d
935
+ };
936
+ if (s.hooks.run("before-tokenize", g), !g.grammar)
937
+ 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);
939
+ },
940
+ /**
941
+ * This is the heart of Prism, and the most low-level function you can use. It accepts a string of text as input
942
+ * and the language definitions to use, and returns an array with the tokenized code.
943
+ *
944
+ * When the language definition includes nested tokens, the function is called recursively on each of these tokens.
945
+ *
946
+ * This method could be useful in other contexts as well, as a very crude parser.
947
+ *
948
+ * @param {string} text A string with the code to be highlighted.
949
+ * @param {Grammar} grammar An object containing the tokens to use.
950
+ *
951
+ * Usually a language definition like `Prism.languages.markup`.
952
+ * @returns {TokenStream} An array of strings and tokens, a token stream.
953
+ * @memberof Prism
954
+ * @public
955
+ * @example
956
+ * let code = `var foo = 0;`;
957
+ * let tokens = Prism.tokenize(code, Prism.languages.javascript);
958
+ * tokens.forEach(token => {
959
+ * if (token instanceof Prism.Token && token.type === 'number') {
960
+ * console.log(`Found numeric literal: ${token.content}`);
961
+ * }
962
+ * });
963
+ */
964
+ tokenize: function(l, c) {
965
+ var d = c.rest;
966
+ if (d) {
967
+ for (var g in d)
968
+ c[g] = d[g];
969
+ delete c.rest;
970
+ }
971
+ var f = new T();
972
+ return S(f, f.head, l), A(l, f, c, f.head, 0), N(f);
973
+ },
974
+ /**
975
+ * @namespace
976
+ * @memberof Prism
977
+ * @public
978
+ */
979
+ hooks: {
980
+ all: {},
981
+ /**
982
+ * Adds the given callback to the list of callbacks for the given hook.
983
+ *
984
+ * The callback will be invoked when the hook it is registered for is run.
985
+ * Hooks are usually directly run by a highlight function but you can also run hooks yourself.
986
+ *
987
+ * One callback function can be registered to multiple hooks and the same hook multiple times.
988
+ *
989
+ * @param {string} name The name of the hook.
990
+ * @param {HookCallback} callback The callback function which is given environment variables.
991
+ * @public
992
+ */
993
+ add: function(l, c) {
994
+ var d = s.hooks.all;
995
+ d[l] = d[l] || [], d[l].push(c);
996
+ },
997
+ /**
998
+ * Runs a hook invoking all registered callbacks with the given environment variables.
999
+ *
1000
+ * Callbacks will be invoked synchronously and in the order in which they were registered.
1001
+ *
1002
+ * @param {string} name The name of the hook.
1003
+ * @param {Object<string, any>} env The environment variables of the hook passed to all callbacks registered.
1004
+ * @public
1005
+ */
1006
+ run: function(l, c) {
1007
+ var d = s.hooks.all[l];
1008
+ if (!(!d || !d.length))
1009
+ for (var g = 0, f; f = d[g++]; )
1010
+ f(c);
1011
+ }
1012
+ },
1013
+ Token: u
1014
+ };
1015
+ n.Prism = s;
1016
+ function u(l, c, d, g) {
1017
+ this.type = l, this.content = c, this.alias = d, this.length = (g || "").length | 0;
1018
+ }
1019
+ u.stringify = function l(c, d) {
1020
+ if (typeof c == "string")
1021
+ return c;
1022
+ if (Array.isArray(c)) {
1023
+ var g = "";
1024
+ return c.forEach(function(k) {
1025
+ g += l(k, d);
1026
+ }), g;
1027
+ }
1028
+ var f = {
1029
+ type: c.type,
1030
+ content: l(c.content, d),
1031
+ tag: "span",
1032
+ classes: ["token", c.type],
1033
+ attributes: {},
1034
+ language: d
1035
+ }, v = c.alias;
1036
+ v && (Array.isArray(v) ? Array.prototype.push.apply(f.classes, v) : f.classes.push(v)), s.hooks.run("wrap", f);
1037
+ var x = "";
1038
+ for (var b in f.attributes)
1039
+ x += " " + b + '="' + (f.attributes[b] || "").replace(/"/g, "&quot;") + '"';
1040
+ return "<" + f.tag + ' class="' + f.classes.join(" ") + '"' + x + ">" + f.content + "</" + f.tag + ">";
1041
+ };
1042
+ function m(l, c, d, g) {
1043
+ l.lastIndex = c;
1044
+ var f = l.exec(d);
1045
+ if (f && g && f[1]) {
1046
+ var v = f[1].length;
1047
+ f.index += v, f[0] = f[0].slice(v);
1048
+ }
1049
+ return f;
1050
+ }
1051
+ function A(l, c, d, g, f, v) {
1052
+ for (var x in d)
1053
+ if (!(!d.hasOwnProperty(x) || !d[x])) {
1054
+ var b = d[x];
1055
+ b = Array.isArray(b) ? b : [b];
1056
+ for (var k = 0; k < b.length; ++k) {
1057
+ if (v && v.cause == x + "," + k)
1058
+ return;
1059
+ var P = b[k], z = P.inside, Pe = !!P.lookbehind, _e = !!P.greedy, mt = P.alias;
1060
+ if (_e && !P.pattern.global) {
1061
+ var pt = P.pattern.toString().match(/[imsuy]*$/)[0];
1062
+ P.pattern = RegExp(P.pattern.source, pt + "g");
1063
+ }
1064
+ for (var De = P.pattern || P, _ = g.next, R = f; _ !== c.tail && !(v && R >= v.reach); R += _.value.length, _ = _.next) {
1065
+ var Z = _.value;
1066
+ if (c.length > l.length)
1067
+ return;
1068
+ if (!(Z instanceof u)) {
1069
+ var ae = 1, H;
1070
+ if (_e) {
1071
+ if (H = m(De, R, l, Pe), !H || H.index >= l.length)
1072
+ break;
1073
+ var le = H.index, bt = H.index + H[0].length, W = R;
1074
+ for (W += _.value.length; le >= W; )
1075
+ _ = _.next, W += _.value.length;
1076
+ if (W -= _.value.length, R = W, _.value instanceof u)
1077
+ continue;
1078
+ for (var J = _; J !== c.tail && (W < bt || typeof J.value == "string"); J = J.next)
1079
+ ae++, W += J.value.length;
1080
+ ae--, Z = l.slice(R, W), H.index -= R;
1081
+ } else if (H = m(De, 0, Z, Pe), !H)
1082
+ continue;
1083
+ var le = H.index, ce = H[0], Ce = Z.slice(0, le), Be = Z.slice(le + ce.length), ye = R + Z.length;
1084
+ v && ye > v.reach && (v.reach = ye);
1085
+ var ue = _.prev;
1086
+ Ce && (ue = S(c, ue, Ce), R += Ce.length), F(c, ue, ae);
1087
+ var vt = new u(x, z ? s.tokenize(ce, z) : ce, mt, ce);
1088
+ if (_ = S(c, ue, vt), Be && S(c, _, Be), ae > 1) {
1089
+ var Ne = {
1090
+ cause: x + "," + k,
1091
+ reach: ye
1092
+ };
1093
+ A(l, c, d, _.prev, R, Ne), v && Ne.reach > v.reach && (v.reach = Ne.reach);
1094
+ }
1095
+ }
1096
+ }
1097
+ }
1098
+ }
1099
+ }
1100
+ function T() {
1101
+ var l = { value: null, prev: null, next: null }, c = { value: null, prev: l, next: null };
1102
+ l.next = c, this.head = l, this.tail = c, this.length = 0;
1103
+ }
1104
+ function S(l, c, d) {
1105
+ var g = c.next, f = { value: d, prev: c, next: g };
1106
+ return c.next = f, g.prev = f, l.length++, f;
1107
+ }
1108
+ function F(l, c, d) {
1109
+ for (var g = c.next, f = 0; f < d && g !== l.tail; f++)
1110
+ g = g.next;
1111
+ c.next = g, g.prev = c, l.length -= f;
1112
+ }
1113
+ function N(l) {
1114
+ for (var c = [], d = l.head.next; d !== l.tail; )
1115
+ c.push(d.value), d = d.next;
1116
+ return c;
1117
+ }
1118
+ if (!n.document)
1119
+ return n.addEventListener && (s.disableWorkerMessageHandler || n.addEventListener("message", function(l) {
1120
+ 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
+ function y() {
1126
+ s.manual || s.highlightAll();
1127
+ }
1128
+ if (!s.manual) {
1129
+ var E = document.readyState;
1130
+ E === "loading" || E === "interactive" && p && p.defer ? document.addEventListener("DOMContentLoaded", y) : window.requestAnimationFrame ? window.requestAnimationFrame(y) : window.setTimeout(y, 16);
1131
+ }
1132
+ return s;
1133
+ }(a);
1134
+ t.exports && (t.exports = e), typeof je < "u" && (je.Prism = e), e.languages.markup = {
1135
+ comment: {
1136
+ pattern: /<!--(?:(?!<!--)[\s\S])*?-->/,
1137
+ greedy: !0
1138
+ },
1139
+ prolog: {
1140
+ pattern: /<\?[\s\S]+?\?>/,
1141
+ greedy: !0
1142
+ },
1143
+ doctype: {
1144
+ // https://www.w3.org/TR/xml/#NT-doctypedecl
1145
+ pattern: /<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,
1146
+ greedy: !0,
1147
+ inside: {
1148
+ "internal-subset": {
1149
+ pattern: /(^[^\[]*\[)[\s\S]+(?=\]>$)/,
1150
+ lookbehind: !0,
1151
+ greedy: !0,
1152
+ inside: null
1153
+ // see below
1154
+ },
1155
+ string: {
1156
+ pattern: /"[^"]*"|'[^']*'/,
1157
+ greedy: !0
1158
+ },
1159
+ punctuation: /^<!|>$|[[\]]/,
1160
+ "doctype-tag": /^DOCTYPE/i,
1161
+ name: /[^\s<>'"]+/
1162
+ }
1163
+ },
1164
+ cdata: {
1165
+ pattern: /<!\[CDATA\[[\s\S]*?\]\]>/i,
1166
+ greedy: !0
1167
+ },
1168
+ tag: {
1169
+ pattern: /<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,
1170
+ greedy: !0,
1171
+ inside: {
1172
+ tag: {
1173
+ pattern: /^<\/?[^\s>\/]+/,
1174
+ inside: {
1175
+ punctuation: /^<\/?/,
1176
+ namespace: /^[^\s>\/:]+:/
1177
+ }
1178
+ },
1179
+ "special-attr": [],
1180
+ "attr-value": {
1181
+ pattern: /=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,
1182
+ inside: {
1183
+ punctuation: [
1184
+ {
1185
+ pattern: /^=/,
1186
+ alias: "attr-equals"
1187
+ },
1188
+ {
1189
+ pattern: /^(\s*)["']|["']$/,
1190
+ lookbehind: !0
1191
+ }
1192
+ ]
1193
+ }
1194
+ },
1195
+ punctuation: /\/?>/,
1196
+ "attr-name": {
1197
+ pattern: /[^\s>\/]+/,
1198
+ inside: {
1199
+ namespace: /^[^\s>\/:]+:/
1200
+ }
1201
+ }
1202
+ }
1203
+ },
1204
+ entity: [
1205
+ {
1206
+ pattern: /&[\da-z]{1,8};/i,
1207
+ alias: "named-entity"
1208
+ },
1209
+ /&#x?[\da-f]{1,8};/i
1210
+ ]
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;/, "&"));
1213
+ }), Object.defineProperty(e.languages.markup.tag, "addInlined", {
1214
+ /**
1215
+ * Adds an inlined language to markup.
1216
+ *
1217
+ * An example of an inlined language is CSS with `<style>` tags.
1218
+ *
1219
+ * @param {string} tagName The name of the tag that contains the inlined language. This name will be treated as
1220
+ * case insensitive.
1221
+ * @param {string} lang The language key.
1222
+ * @example
1223
+ * addInlined('style', 'css');
1224
+ */
1225
+ value: function(i, r) {
1226
+ var o = {};
1227
+ o["language-" + r] = {
1228
+ pattern: /(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,
1229
+ lookbehind: !0,
1230
+ inside: e.languages[r]
1231
+ }, o.cdata = /^<!\[CDATA\[|\]\]>$/i;
1232
+ var s = {
1233
+ "included-cdata": {
1234
+ pattern: /<!\[CDATA\[[\s\S]*?\]\]>/i,
1235
+ inside: o
1236
+ }
1237
+ };
1238
+ s["language-" + r] = {
1239
+ pattern: /[\s\S]+/,
1240
+ inside: e.languages[r]
1241
+ };
1242
+ var u = {};
1243
+ u[i] = {
1244
+ pattern: RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g, function() {
1245
+ return i;
1246
+ }), "i"),
1247
+ lookbehind: !0,
1248
+ greedy: !0,
1249
+ inside: s
1250
+ }, e.languages.insertBefore("markup", "cdata", u);
1251
+ }
1252
+ }), Object.defineProperty(e.languages.markup.tag, "addAttribute", {
1253
+ /**
1254
+ * Adds an pattern to highlight languages embedded in HTML attributes.
1255
+ *
1256
+ * An example of an inlined language is CSS with `style` attributes.
1257
+ *
1258
+ * @param {string} attrName The name of the tag that contains the inlined language. This name will be treated as
1259
+ * case insensitive.
1260
+ * @param {string} lang The language key.
1261
+ * @example
1262
+ * addAttribute('style', 'css');
1263
+ */
1264
+ value: function(n, i) {
1265
+ e.languages.markup.tag.inside["special-attr"].push({
1266
+ pattern: RegExp(
1267
+ /(^|["'\s])/.source + "(?:" + n + ")" + /\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,
1268
+ "i"
1269
+ ),
1270
+ lookbehind: !0,
1271
+ inside: {
1272
+ "attr-name": /^[^\s=]+/,
1273
+ "attr-value": {
1274
+ pattern: /=[\s\S]+/,
1275
+ inside: {
1276
+ value: {
1277
+ pattern: /(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,
1278
+ lookbehind: !0,
1279
+ alias: [i, "language-" + i],
1280
+ inside: e.languages[i]
1281
+ },
1282
+ punctuation: [
1283
+ {
1284
+ pattern: /^=/,
1285
+ alias: "attr-equals"
1286
+ },
1287
+ /"|'/
1288
+ ]
1289
+ }
1290
+ }
1291
+ }
1292
+ });
1293
+ }
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) {
1295
+ var i = /(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;
1296
+ n.languages.css = {
1297
+ comment: /\/\*[\s\S]*?\*\//,
1298
+ atrule: {
1299
+ pattern: RegExp("@[\\w-](?:" + /[^;{\s"']|\s+(?!\s)/.source + "|" + i.source + ")*?" + /(?:;|(?=\s*\{))/.source),
1300
+ inside: {
1301
+ rule: /^@[\w-]+/,
1302
+ "selector-function-argument": {
1303
+ pattern: /(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,
1304
+ lookbehind: !0,
1305
+ alias: "selector"
1306
+ },
1307
+ keyword: {
1308
+ pattern: /(^|[^\w-])(?:and|not|only|or)(?![\w-])/,
1309
+ lookbehind: !0
1310
+ }
1311
+ // See rest below
1312
+ }
1313
+ },
1314
+ url: {
1315
+ // https://drafts.csswg.org/css-values-3/#urls
1316
+ pattern: RegExp("\\burl\\((?:" + i.source + "|" + /(?:[^\\\r\n()"']|\\[\s\S])*/.source + ")\\)", "i"),
1317
+ greedy: !0,
1318
+ inside: {
1319
+ function: /^url/i,
1320
+ punctuation: /^\(|\)$/,
1321
+ string: {
1322
+ pattern: RegExp("^" + i.source + "$"),
1323
+ alias: "url"
1324
+ }
1325
+ }
1326
+ },
1327
+ selector: {
1328
+ pattern: RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|` + i.source + ")*(?=\\s*\\{)"),
1329
+ lookbehind: !0
1330
+ },
1331
+ string: {
1332
+ pattern: i,
1333
+ greedy: !0
1334
+ },
1335
+ property: {
1336
+ pattern: /(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,
1337
+ lookbehind: !0
1338
+ },
1339
+ important: /!important\b/i,
1340
+ function: {
1341
+ pattern: /(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,
1342
+ lookbehind: !0
1343
+ },
1344
+ 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"));
1348
+ }(e), e.languages.clike = {
1349
+ comment: [
1350
+ {
1351
+ pattern: /(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,
1352
+ lookbehind: !0,
1353
+ greedy: !0
1354
+ },
1355
+ {
1356
+ pattern: /(^|[^\\:])\/\/.*/,
1357
+ lookbehind: !0,
1358
+ greedy: !0
1359
+ }
1360
+ ],
1361
+ string: {
1362
+ pattern: /(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
1363
+ greedy: !0
1364
+ },
1365
+ "class-name": {
1366
+ pattern: /(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,
1367
+ lookbehind: !0,
1368
+ inside: {
1369
+ punctuation: /[.\\]/
1370
+ }
1371
+ },
1372
+ keyword: /\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,
1373
+ boolean: /\b(?:false|true)\b/,
1374
+ function: /\b\w+(?=\()/,
1375
+ number: /\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,
1376
+ operator: /[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,
1377
+ punctuation: /[{}[\];(),.:]/
1378
+ }, e.languages.javascript = e.languages.extend("clike", {
1379
+ "class-name": [
1380
+ e.languages.clike["class-name"],
1381
+ {
1382
+ pattern: /(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,
1383
+ lookbehind: !0
1384
+ }
1385
+ ],
1386
+ keyword: [
1387
+ {
1388
+ pattern: /((?:^|\})\s*)catch\b/,
1389
+ lookbehind: !0
1390
+ },
1391
+ {
1392
+ pattern: /(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,
1393
+ lookbehind: !0
1394
+ }
1395
+ ],
1396
+ // Allow for all non-ASCII characters (See http://stackoverflow.com/a/2008444)
1397
+ function: /#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,
1398
+ number: {
1399
+ pattern: RegExp(
1400
+ /(^|[^\w$])/.source + "(?:" + // constant
1401
+ (/NaN|Infinity/.source + "|" + // binary integer
1402
+ /0[bB][01]+(?:_[01]+)*n?/.source + "|" + // octal integer
1403
+ /0[oO][0-7]+(?:_[0-7]+)*n?/.source + "|" + // hexadecimal integer
1404
+ /0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source + "|" + // decimal bigint
1405
+ /\d+(?:_\d+)*n/.source + "|" + // decimal number (integer or float) but no bigint
1406
+ /(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source) + ")" + /(?![\w$])/.source
1407
+ ),
1408
+ lookbehind: !0
1409
+ },
1410
+ operator: /--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/
1411
+ }), e.languages.javascript["class-name"][0].pattern = /(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/, e.languages.insertBefore("javascript", "keyword", {
1412
+ regex: {
1413
+ pattern: RegExp(
1414
+ // lookbehind
1415
+ // eslint-disable-next-line regexp/no-dupe-characters-character-class
1416
+ /((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source + // Regex pattern:
1417
+ // There are 2 regex patterns here. The RegExp set notation proposal added support for nested character
1418
+ // classes if the `v` flag is present. Unfortunately, nested CCs are both context-free and incompatible
1419
+ // with the only syntax, so we have to define 2 different regex patterns.
1420
+ /\//.source + "(?:" + /(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source + "|" + // `v` flag syntax. This supports 3 levels of nested character classes.
1421
+ /(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source + ")" + // lookahead
1422
+ /(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source
1423
+ ),
1424
+ lookbehind: !0,
1425
+ greedy: !0,
1426
+ inside: {
1427
+ "regex-source": {
1428
+ pattern: /^(\/)[\s\S]+(?=\/[a-z]*$)/,
1429
+ lookbehind: !0,
1430
+ alias: "language-regex",
1431
+ inside: e.languages.regex
1432
+ },
1433
+ "regex-delimiter": /^\/|\/$/,
1434
+ "regex-flags": /^[a-z]+$/
1435
+ }
1436
+ },
1437
+ // This must be declared before keyword because we use "function" inside the look-forward
1438
+ "function-variable": {
1439
+ pattern: /#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,
1440
+ alias: "function"
1441
+ },
1442
+ parameter: [
1443
+ {
1444
+ pattern: /(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,
1445
+ lookbehind: !0,
1446
+ inside: e.languages.javascript
1447
+ },
1448
+ {
1449
+ pattern: /(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,
1450
+ lookbehind: !0,
1451
+ inside: e.languages.javascript
1452
+ },
1453
+ {
1454
+ pattern: /(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,
1455
+ lookbehind: !0,
1456
+ inside: e.languages.javascript
1457
+ },
1458
+ {
1459
+ pattern: /((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,
1460
+ lookbehind: !0,
1461
+ inside: e.languages.javascript
1462
+ }
1463
+ ],
1464
+ constant: /\b[A-Z](?:[A-Z_]|\dx?)*\b/
1465
+ }), e.languages.insertBefore("javascript", "string", {
1466
+ hashbang: {
1467
+ pattern: /^#!.*/,
1468
+ greedy: !0,
1469
+ alias: "comment"
1470
+ },
1471
+ "template-string": {
1472
+ pattern: /`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,
1473
+ greedy: !0,
1474
+ inside: {
1475
+ "template-punctuation": {
1476
+ pattern: /^`|`$/,
1477
+ alias: "string"
1478
+ },
1479
+ interpolation: {
1480
+ pattern: /((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,
1481
+ lookbehind: !0,
1482
+ inside: {
1483
+ "interpolation-punctuation": {
1484
+ pattern: /^\$\{|\}$/,
1485
+ alias: "punctuation"
1486
+ },
1487
+ rest: e.languages.javascript
1488
+ }
1489
+ },
1490
+ string: /[\s\S]+/
1491
+ }
1492
+ },
1493
+ "string-property": {
1494
+ pattern: /((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,
1495
+ lookbehind: !0,
1496
+ greedy: !0,
1497
+ alias: "property"
1498
+ }
1499
+ }), e.languages.insertBefore("javascript", "operator", {
1500
+ "literal-property": {
1501
+ pattern: /((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,
1502
+ lookbehind: !0,
1503
+ alias: "property"
1504
+ }
1505
+ }), e.languages.markup && (e.languages.markup.tag.addInlined("script", "javascript"), e.languages.markup.tag.addAttribute(
1506
+ /on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,
1507
+ "javascript"
1508
+ )), e.languages.js = e.languages.javascript, function() {
1509
+ if (typeof e > "u" || typeof document > "u")
1510
+ return;
1511
+ Element.prototype.matches || (Element.prototype.matches = Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector);
1512
+ var n = "Loading…", i = function(p, y) {
1513
+ return "✖ Error " + p + " while fetching file: " + y;
1514
+ }, r = "✖ Error: File does not exist or is empty", o = {
1515
+ js: "javascript",
1516
+ py: "python",
1517
+ rb: "ruby",
1518
+ ps1: "powershell",
1519
+ psm1: "powershell",
1520
+ sh: "bash",
1521
+ bat: "batch",
1522
+ h: "c",
1523
+ tex: "latex"
1524
+ }, s = "data-src-status", u = "loading", m = "loaded", A = "failed", T = "pre[data-src]:not([" + s + '="' + m + '"]):not([' + s + '="' + u + '"])';
1525
+ function S(p, y, E) {
1526
+ var l = new XMLHttpRequest();
1527
+ l.open("GET", p, !0), l.onreadystatechange = function() {
1528
+ l.readyState == 4 && (l.status < 400 && l.responseText ? y(l.responseText) : l.status >= 400 ? E(i(l.status, l.statusText)) : E(r));
1529
+ }, l.send(null);
1530
+ }
1531
+ function F(p) {
1532
+ var y = /^\s*(\d+)\s*(?:(,)\s*(?:(\d+)\s*)?)?$/.exec(p || "");
1533
+ if (y) {
1534
+ var E = Number(y[1]), l = y[2], c = y[3];
1535
+ return l ? c ? [E, Number(c)] : [E, void 0] : [E, E];
1536
+ }
1537
+ }
1538
+ e.hooks.add("before-highlightall", function(p) {
1539
+ p.selector += ", " + T;
1540
+ }), e.hooks.add("before-sanity-check", function(p) {
1541
+ var y = (
1542
+ /** @type {HTMLPreElement} */
1543
+ p.element
1544
+ );
1545
+ if (y.matches(T)) {
1546
+ p.code = "", y.setAttribute(s, u);
1547
+ var E = y.appendChild(document.createElement("CODE"));
1548
+ E.textContent = n;
1549
+ var l = y.getAttribute("data-src"), c = p.language;
1550
+ if (c === "none") {
1551
+ var d = (/\.(\w+)$/.exec(l) || [, "none"])[1];
1552
+ c = o[d] || d;
1553
+ }
1554
+ e.util.setLanguage(E, c), e.util.setLanguage(y, c);
1555
+ var g = e.plugins.autoloader;
1556
+ g && g.loadLanguages(c), S(
1557
+ l,
1558
+ function(f) {
1559
+ y.setAttribute(s, m);
1560
+ var v = F(y.getAttribute("data-range"));
1561
+ if (v) {
1562
+ var x = f.split(/\r\n?|\n/g), b = v[0], k = v[1] == null ? x.length : v[1];
1563
+ b < 0 && (b += x.length), b = Math.max(0, Math.min(b - 1, x.length)), k < 0 && (k += x.length), k = Math.max(0, Math.min(k, x.length)), f = x.slice(b, k).join(`
1564
+ `), y.hasAttribute("data-start") || y.setAttribute("data-start", String(b + 1));
1565
+ }
1566
+ E.textContent = f, e.highlightElement(E);
1567
+ },
1568
+ function(f) {
1569
+ y.setAttribute(s, A), E.textContent = f;
1570
+ }
1571
+ );
1572
+ }
1573
+ }), e.plugins.fileHighlight = {
1574
+ /**
1575
+ * Executes the File Highlight plugin for all matching `pre` elements under the given container.
1576
+ *
1577
+ * Note: Elements which are already loaded or currently loading will not be touched by this method.
1578
+ *
1579
+ * @param {ParentNode} [container=document]
1580
+ */
1581
+ highlight: function(y) {
1582
+ for (var E = (y || document).querySelectorAll(T), l = 0, c; c = E[l++]; )
1583
+ e.highlightElement(c);
1584
+ }
1585
+ };
1586
+ var N = !1;
1587
+ 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);
1589
+ };
1590
+ }();
1591
+ }(Se)), Se.exports;
1592
+ }
1593
+ var Rn = Hn();
1594
+ const zn = /* @__PURE__ */ Bn(Rn);
1595
+ typeof globalThis < "u" && (globalThis.Prism = zn);
1596
+ function Wn({ codeBlockCoords: t, codeNodeKey: a }) {
1597
+ const [e] = M(), [n, i] = O({
1598
+ x: B,
1599
+ y: B
1600
+ }), r = se(null), [o, s] = O(""), u = hn(), m = Array.from(
1601
+ new Set(u.map((T) => Ae(T)))
1602
+ ), A = {};
1603
+ return u.forEach((T) => {
1604
+ const S = Ae(T);
1605
+ A[S] || (A[S] = T);
1606
+ }), C(() => {
1607
+ i(En(t, r));
1608
+ }, [t]), C(() => {
1609
+ e.read(() => {
1610
+ if (a) {
1611
+ const S = oe(a).getLanguage();
1612
+ s(Ae(S));
447
1613
  }
448
1614
  });
449
- }, [t, s]), /* @__PURE__ */ $(
450
- it,
1615
+ }, [e, a]), /* @__PURE__ */ D(
1616
+ Dt,
451
1617
  {
452
1618
  id: "code-highlight-menu",
453
- ref: o,
1619
+ ref: r,
454
1620
  style: {
455
1621
  position: "absolute",
456
1622
  top: n.y,
457
1623
  left: n.x
458
1624
  },
459
1625
  "aria-label": "Code menu",
460
- inputValue: r,
461
- onInputChange: (m) => {
462
- const L = E[m];
463
- t.dispatchCommand(_e, [
464
- s,
465
- L
466
- ]), c(m);
1626
+ inputValue: o,
1627
+ onInputChange: (T) => {
1628
+ const S = A[T];
1629
+ e.dispatchCommand(ct, [
1630
+ a,
1631
+ S
1632
+ ]), s(T);
467
1633
  },
468
1634
  children: [
469
- /* @__PURE__ */ $("div", { children: [
470
- /* @__PURE__ */ l(xe, {}),
471
- /* @__PURE__ */ l(B, { children: /* @__PURE__ */ l(pt, { size: 24 }) })
1635
+ /* @__PURE__ */ D("div", { children: [
1636
+ /* @__PURE__ */ h(et, {}),
1637
+ /* @__PURE__ */ h(U, { children: /* @__PURE__ */ h(Qt, { size: 24 }) })
472
1638
  ] }),
473
- /* @__PURE__ */ l(ve, { children: /* @__PURE__ */ l(st, { children: d.map((m, L) => /* @__PURE__ */ l(at, { children: m }, L)) }) })
1639
+ /* @__PURE__ */ h(tt, { children: /* @__PURE__ */ h(Bt, { children: m.map((T, S) => /* @__PURE__ */ h(Ht, { children: T }, S)) }) })
474
1640
  ]
475
1641
  }
476
1642
  );
477
1643
  }
478
- const an = document.body, Ae = _(
1644
+ const Gn = document.body, lt = Y(
479
1645
  "INSERT_CODE_BLOCK_COMMAND"
480
- ), _e = _(
1646
+ ), ct = Y(
481
1647
  "SET_CODE_LANGUAGE_COMMAND"
482
1648
  );
483
- function ln() {
484
- const [e, s] = M(null), [t, n] = M(null), [i, o] = M(!1), [r, c] = M(!1), [a] = b(), d = Y(() => {
485
- s(null), n(null);
486
- }, []), E = Y(() => {
487
- const C = document.getElementById("code-highlight-menu"), f = document.activeElement;
488
- return !!(C && f && (C === f || C.contains(f)));
489
- }, []), m = Y(() => {
490
- const C = E();
491
- return c(C), C;
492
- }, [E]), L = Y(() => {
493
- const C = m();
494
- o(!1), C || d();
495
- }, [d, m]);
496
- return u(() => a.registerCommand(
497
- A,
1649
+ function Kn() {
1650
+ const [t, a] = O(null), [e, n] = O(null), [i, r] = O(!1), [o, s] = O(!1), [u] = M(), m = de(() => {
1651
+ a(null), n(null);
1652
+ }, []), A = de(() => {
1653
+ const F = document.getElementById("code-highlight-menu"), N = document.activeElement;
1654
+ return !!(F && N && (F === N || F.contains(N)));
1655
+ }, []), T = de(() => {
1656
+ const F = A();
1657
+ return s(F), F;
1658
+ }, [A]), S = de(() => {
1659
+ const F = T();
1660
+ r(!1), F || m();
1661
+ }, [m, T]);
1662
+ return C(() => u.registerCommand(
1663
+ j,
498
1664
  () => {
499
- const f = m(), g = a.getRootElement();
500
- if (g) {
501
- const D = g === document.activeElement || g.contains(document.activeElement);
502
- o((y) => y === D ? y : D);
1665
+ const N = T(), p = u.getRootElement();
1666
+ if (p) {
1667
+ const c = p === document.activeElement || p.contains(document.activeElement);
1668
+ r((d) => d === c ? d : c);
503
1669
  }
504
- const p = T();
505
- if (!N(p))
506
- return f || d(), !1;
507
- const S = ee(p), v = I(S, Z);
508
- if (v) {
509
- const y = a.getElementByKey(v.getKey()).getBoundingClientRect(), te = y.right, ne = y.top + window.scrollY;
510
- s({ x: te, y: ne }), n(v.getKey());
1670
+ const y = L();
1671
+ if (!w(y))
1672
+ return N || m(), !1;
1673
+ const E = ve(y), l = I(E, pe);
1674
+ if (l) {
1675
+ const d = u.getElementByKey(l.getKey()).getBoundingClientRect(), g = d.right, f = d.top + window.scrollY;
1676
+ a({ x: g, y: f }), n(l.getKey());
511
1677
  } else
512
- f || d();
1678
+ N || m();
513
1679
  return !1;
514
1680
  },
515
- h
516
- ), [a, m, d]), u(() => a.registerCommand(
517
- J,
518
- () => (setTimeout(L, 0), !1),
519
- h
520
- ), [a, L]), u(() => {
521
- const C = () => {
522
- o(!0), c(!1);
523
- }, f = () => setTimeout(L, 0);
524
- return a.registerRootListener((g, p) => {
525
- g && (g.addEventListener("focus", C), g.addEventListener("blur", f)), p && (p.removeEventListener("focus", C), p.removeEventListener("blur", f));
1681
+ $
1682
+ ), [u, T, m]), C(() => u.registerCommand(
1683
+ be,
1684
+ () => (setTimeout(S, 0), !1),
1685
+ $
1686
+ ), [u, S]), C(() => {
1687
+ const F = () => {
1688
+ r(!0), s(!1);
1689
+ }, N = () => setTimeout(S, 0);
1690
+ return u.registerRootListener((p, y) => {
1691
+ p && (p.addEventListener("focus", F), p.addEventListener("blur", N)), y && (y.removeEventListener("focus", F), y.removeEventListener("blur", N));
526
1692
  });
527
- }, [a, L]), e && (i || r) && ue(
528
- /* @__PURE__ */ l(sn, { codeBlockCoords: e, codeNodeKey: t }),
529
- an
1693
+ }, [u, S]), t && (i || o) && Ie(
1694
+ /* @__PURE__ */ h(Wn, { codeBlockCoords: t, codeNodeKey: e }),
1695
+ Gn
530
1696
  );
531
1697
  }
532
- function cn() {
533
- const [e] = b();
534
- return u(() => _t(e), [e]), u(() => e.registerNodeTransform(z, (t) => {
535
- if (!t.isSimpleText())
1698
+ function qn() {
1699
+ const [t] = M();
1700
+ return C(() => mn(t), [t]), C(() => t.registerNodeTransform(ie, (e) => {
1701
+ if (!e.isSimpleText())
536
1702
  return;
537
- const n = t.getTextContent();
1703
+ const n = e.getTextContent();
538
1704
  if (n.startsWith("``` ")) {
539
- const i = t.getPreviousSibling(), o = I(t, R), r = o !== null && o.getChildrenSize() === 1, c = K(i);
540
- if (r || c) {
1705
+ const i = e.getPreviousSibling(), r = I(e, V), o = r !== null && r.getChildrenSize() === 1, s = te(i);
1706
+ if (o || s) {
541
1707
  if (n.length > 4)
542
1708
  return;
543
- const a = Ee();
544
- t.replace(a), a.select();
545
- const d = a.getNextSibling();
546
- K(d) && d.remove();
1709
+ const u = qe();
1710
+ e.replace(u), u.select();
1711
+ const m = u.getNextSibling();
1712
+ te(m) && m.remove();
547
1713
  return;
548
1714
  }
549
1715
  }
550
- }), [e]), u(() => e.registerCommand(
551
- Ae,
1716
+ }), [t]), C(() => t.registerCommand(
1717
+ lt,
552
1718
  () => {
553
- const t = X();
554
- if (N(t)) {
555
- const n = Ee();
556
- return t.insertNodes([n]), n.selectStart(), setTimeout(() => {
557
- e.focus();
1719
+ const e = he();
1720
+ if (w(e)) {
1721
+ const n = qe();
1722
+ return e.insertNodes([n]), n.selectStart(), setTimeout(() => {
1723
+ t.focus();
558
1724
  }, 0), !0;
559
1725
  }
560
1726
  return !1;
561
1727
  },
562
- h
563
- ), [e]), u(() => e.registerCommand(
564
- _e,
565
- (t) => {
566
- const [n, i] = t, o = q(n);
567
- return Z(o) ? (o.setLanguage(i), !0) : !1;
1728
+ $
1729
+ ), [t]), C(() => t.registerCommand(
1730
+ ct,
1731
+ (e) => {
1732
+ const [n, i] = e, r = oe(n);
1733
+ return pe(r) ? (r.setLanguage(i), !0) : !1;
568
1734
  },
569
- h
570
- ), [e]), u(() => e.registerCommand(
571
- ce,
572
- (t) => {
573
- const n = T();
574
- if (!N(n) || !n.isCollapsed())
1735
+ $
1736
+ ), [t]), C(() => t.registerCommand(
1737
+ Le,
1738
+ (e) => {
1739
+ const n = L();
1740
+ if (!w(n) || !n.isCollapsed())
575
1741
  return !1;
576
- const i = n.anchor.getNode(), o = I(i, Z);
577
- return o && n.anchor.offset === 0 && o.getTextContent() === "" ? (o.remove(), !0) : !1;
1742
+ const i = n.anchor.getNode(), r = I(i, pe);
1743
+ return r && n.anchor.offset === 0 && r.getTextContent() === "" ? (r.remove(), !0) : !1;
578
1744
  },
579
- h
580
- ), [e]), null;
1745
+ $
1746
+ ), [t]), null;
581
1747
  }
582
- function dn() {
583
- return /* @__PURE__ */ $(Ie, { children: [
584
- /* @__PURE__ */ l(cn, {}),
585
- /* @__PURE__ */ l(ln, {})
1748
+ function Un() {
1749
+ return /* @__PURE__ */ D(Xe, { children: [
1750
+ /* @__PURE__ */ h(qn, {}),
1751
+ /* @__PURE__ */ h(Kn, {})
586
1752
  ] });
587
1753
  }
588
- const He = _(
1754
+ const ut = Y(
589
1755
  "INSERT_HORIZONTAL_DIVIDER_COMMAND"
590
1756
  );
591
- function un() {
592
- const [e] = b();
593
- return u(() => {
594
- if (!e.hasNodes([Ot]))
1757
+ function jn() {
1758
+ const [t] = M();
1759
+ return C(() => {
1760
+ if (!t.hasNodes([cn]))
595
1761
  throw new Error("HorizontalDividerNode not registered on editor");
596
- return e.registerCommand(
597
- He,
1762
+ return t.registerCommand(
1763
+ ut,
598
1764
  () => {
599
- const t = X();
600
- if (N(t)) {
601
- const n = Pt();
602
- t.insertNodes([n]);
1765
+ const e = he();
1766
+ if (w(e)) {
1767
+ const n = un();
1768
+ e.insertNodes([n]);
603
1769
  let i = n.getNextSibling() || n.getParent().getNextSibling();
604
- return i || (i = G(), n.insertAfter(i)), i.selectStart(), setTimeout(() => {
605
- e.focus();
1770
+ return i || (i = re(), n.insertAfter(i)), i.selectStart(), setTimeout(() => {
1771
+ t.focus();
606
1772
  }, 0), !0;
607
1773
  }
608
1774
  return !1;
609
1775
  },
610
- h
1776
+ $
611
1777
  );
612
- }, [e]), null;
1778
+ }, [t]), null;
613
1779
  }
614
- const Re = _("INSERT_IMAGE_COMMAND"), Le = "selected";
615
- function gn(e) {
616
- return e && e.type && e.type.startsWith("image/");
1780
+ const dt = Y("INSERT_IMAGE_COMMAND"), Ze = "selected";
1781
+ function Yn(t) {
1782
+ return t && t.type && t.type.startsWith("image/");
617
1783
  }
618
- function fn() {
619
- const [e] = b(), s = U(null);
620
- return u(() => {
621
- if (!e.hasNode(pe))
1784
+ function Zn() {
1785
+ const [t] = M(), a = se(null);
1786
+ return C(() => {
1787
+ if (!t.hasNode(Ge))
622
1788
  throw new Error("ImagePlugin: ImageNode not registered on editor");
623
- return e.registerCommand(
624
- Re,
1789
+ return t.registerCommand(
1790
+ dt,
625
1791
  (n) => {
626
- const i = n, o = X();
627
- if (N(o)) {
628
- const r = Te(i);
629
- o.insertNodes([r]);
630
- let c = r.getNextSibling() || r.getParent().getNextSibling();
631
- return c || (c = G(), r.insertAfter(c)), r.select(), !0;
1792
+ const i = n, r = he();
1793
+ if (w(r)) {
1794
+ const o = Ke(i);
1795
+ r.insertNodes([o]);
1796
+ let s = o.getNextSibling() || o.getParent().getNextSibling();
1797
+ return s || (s = re(), o.insertAfter(s)), o.select(), !0;
632
1798
  }
633
1799
  return !1;
634
1800
  },
635
- h
1801
+ $
636
1802
  );
637
- }, [e]), u(() => e.registerCommand(
638
- A,
1803
+ }, [t]), C(() => t.registerCommand(
1804
+ j,
639
1805
  () => {
640
- s.current && (s.current.classList.remove(Le), s.current = null);
641
- const n = T();
642
- if (de(n) && n.getNodes().length === 1) {
1806
+ a.current && (a.current.classList.remove(Ze), a.current = null);
1807
+ const n = L();
1808
+ if (we(n) && n.getNodes().length === 1) {
643
1809
  const i = n.getNodes()[0];
644
- if (Bt(i)) {
645
- const o = e.getElementByKey(i.getKey());
646
- o.classList.add(Le), s.current = o;
1810
+ if (dn(i)) {
1811
+ const r = t.getElementByKey(i.getKey());
1812
+ r.classList.add(Ze), a.current = r;
647
1813
  }
648
1814
  }
649
1815
  return !1;
650
1816
  },
651
- Se
652
- ), [e]), u(() => e.registerCommand(
653
- Ye,
1817
+ Ve
1818
+ ), [t]), C(() => t.registerCommand(
1819
+ ke,
654
1820
  (n) => {
655
1821
  const i = n.clipboardData;
656
1822
  if (!i)
657
1823
  return !1;
658
- const r = Array.from(i.files).filter(gn);
659
- if (r.length === 1) {
1824
+ const o = Array.from(i.files).filter(Yn);
1825
+ if (o.length === 1) {
660
1826
  n.preventDefault();
661
- const c = r[0], a = T() || X();
662
- if (!N(a))
1827
+ const s = o[0], u = L() || he();
1828
+ if (!w(u))
663
1829
  return !1;
664
- const d = URL.createObjectURL(c), E = Te(d);
665
- a.insertNodes([E]);
666
- let m = E.getNextSibling() || E.getParent().getNextSibling();
667
- return m || (m = G(), E.insertAfter(m)), E.select(), !0;
1830
+ const m = URL.createObjectURL(s), A = Ke(m);
1831
+ u.insertNodes([A]);
1832
+ let T = A.getNextSibling() || A.getParent().getNextSibling();
1833
+ return T || (T = re(), A.insertAfter(T)), A.select(), !0;
668
1834
  }
669
1835
  return !1;
670
1836
  },
671
- h
672
- ), [e]), // Make the Image selectable
673
- /* @__PURE__ */ l(
674
- fe,
1837
+ $
1838
+ ), [t]), // Make the Image selectable
1839
+ /* @__PURE__ */ h(
1840
+ Oe,
675
1841
  {
676
- nodeType: pe,
1842
+ nodeType: Ge,
677
1843
  eventType: "click",
678
- eventListener: (t, n, i) => {
679
- q(i).select();
1844
+ eventListener: (e, n, i) => {
1845
+ oe(i).select();
680
1846
  }
681
1847
  }
682
1848
  );
683
1849
  }
684
- const Q = 24;
685
- function mn() {
686
- const [e] = b();
687
- return /* @__PURE__ */ l(ge, { "aria-label": "Block toolbar", id: "block-toolbar", children: /* @__PURE__ */ $(W, { "aria-label": "Media", children: [
688
- /* @__PURE__ */ l(
689
- ct,
1850
+ const ge = 24;
1851
+ function Qn() {
1852
+ const [t] = M();
1853
+ return /* @__PURE__ */ h(Me, { "aria-label": "Block toolbar", id: "block-toolbar", children: /* @__PURE__ */ D(ne, { "aria-label": "Media", children: [
1854
+ /* @__PURE__ */ h(
1855
+ zt,
690
1856
  {
691
1857
  acceptedFileTypes: ["image/png", "image/jpeg", "image/gif"],
692
- onSelect: (t) => {
693
- if (!t || t.length === 0)
1858
+ onSelect: (e) => {
1859
+ if (!e || e.length === 0)
694
1860
  return;
695
- const n = t[0];
1861
+ const n = e[0];
696
1862
  if (!n.type.startsWith("image/")) {
697
1863
  alert("Please select an image file.");
698
1864
  return;
699
1865
  }
700
1866
  const i = new FileReader();
701
- i.onload = (o) => {
702
- var c;
703
- const r = (c = o.target) == null ? void 0 : c.result;
704
- typeof r == "string" ? e.dispatchCommand(Re, r) : alert("Failed to read file as Data URL.");
705
- }, i.onerror = (o) => {
706
- console.error("Error reading file:", o), alert("Error reading file.");
1867
+ i.onload = (r) => {
1868
+ var s;
1869
+ const o = (s = r.target) == null ? void 0 : s.result;
1870
+ typeof o == "string" ? t.dispatchCommand(dt, o) : alert("Failed to read file as Data URL.");
1871
+ }, i.onerror = (r) => {
1872
+ console.error("Error reading file:", r), alert("Error reading file.");
707
1873
  }, i.readAsDataURL(n);
708
1874
  },
709
1875
  allowsMultiple: !1,
710
- children: /* @__PURE__ */ l(B, { "aria-label": "image", children: /* @__PURE__ */ l(Et, { size: Q }) })
1876
+ children: /* @__PURE__ */ h(U, { "aria-label": "image", children: /* @__PURE__ */ h(Vt, { size: ge }) })
711
1877
  }
712
1878
  ),
713
- /* @__PURE__ */ l(
714
- B,
1879
+ /* @__PURE__ */ h(
1880
+ U,
715
1881
  {
716
1882
  "aria-label": "code block",
717
1883
  onPress: () => {
718
- e.dispatchCommand(Ae, void 0);
1884
+ t.dispatchCommand(lt, void 0);
719
1885
  },
720
- children: /* @__PURE__ */ l(bt, { size: Q })
1886
+ children: /* @__PURE__ */ h(Jt, { size: ge })
721
1887
  }
722
1888
  ),
723
- /* @__PURE__ */ l(
724
- B,
1889
+ /* @__PURE__ */ h(
1890
+ U,
725
1891
  {
726
1892
  "aria-label": "horizontal divider",
727
1893
  onPress: () => {
728
- e.dispatchCommand(
729
- He,
1894
+ t.dispatchCommand(
1895
+ ut,
730
1896
  void 0
731
1897
  );
732
1898
  },
733
- children: /* @__PURE__ */ l(Lt, { size: Q })
1899
+ children: /* @__PURE__ */ h(en, { size: ge })
734
1900
  }
735
1901
  )
736
1902
  ] }) });
737
1903
  }
738
- function hn({
739
- selectionRectCoords: e,
740
- TOOLBAR_OFFSET: s,
741
- toolbarTriggerId: t,
1904
+ function Xn({
1905
+ selectionRectCoords: t,
1906
+ TOOLBAR_OFFSET: a,
1907
+ toolbarTriggerId: e,
742
1908
  toolbarPopoverId: n
743
1909
  }) {
744
- const [i, o] = M({
745
- x,
746
- y: x
747
- }), r = U(null);
748
- return u(() => {
749
- o(
750
- Gt(
751
- e,
752
- r,
753
- s
1910
+ const [i, r] = O({
1911
+ x: B,
1912
+ y: B
1913
+ }), o = se(null);
1914
+ return C(() => {
1915
+ r(
1916
+ xn(
1917
+ t,
1918
+ o,
1919
+ a
754
1920
  )
755
1921
  );
756
- }, [e]), /* @__PURE__ */ $(lt, { children: [
757
- /* @__PURE__ */ l(
758
- B,
1922
+ }, [t]), /* @__PURE__ */ D(Rt, { children: [
1923
+ /* @__PURE__ */ h(
1924
+ U,
759
1925
  {
760
1926
  "aria-label": "Block toolbar trigger",
761
1927
  className: "block-toolbar-trigger",
762
- id: t,
763
- ref: r,
1928
+ id: e,
1929
+ ref: o,
764
1930
  style: {
765
1931
  position: "absolute",
766
1932
  top: i.y,
767
1933
  left: i.x
768
1934
  },
769
- children: /* @__PURE__ */ l(Tt, { size: Q })
1935
+ children: /* @__PURE__ */ h(Xt, { size: ge })
770
1936
  }
771
1937
  ),
772
- /* @__PURE__ */ l(
773
- ve,
1938
+ /* @__PURE__ */ h(
1939
+ tt,
774
1940
  {
775
1941
  className: "block-toolbar-popover",
776
1942
  id: n,
777
1943
  placement: "end",
778
1944
  shouldFlip: !1,
779
- offset: s,
780
- children: /* @__PURE__ */ l(mn, {})
1945
+ offset: a,
1946
+ children: /* @__PURE__ */ h(Qn, {})
781
1947
  }
782
1948
  )
783
1949
  ] });
784
1950
  }
785
- const Nn = document.body;
786
- function Cn({ toolbarGap: e }) {
787
- const [s, t] = M(null), [n] = b(), [i, o] = M(!1), [r, c] = M(!1), a = U(Math.random().toString(36).substring(2, 9)), d = `block-toolbar-trigger-${a.current}`, E = `block-toolbar-popover-${a.current}`, m = () => o(!0), L = (C) => {
1951
+ const Vn = document.body;
1952
+ function Jn({ toolbarGap: t }) {
1953
+ const [a, e] = O(null), [n] = M(), [i, r] = O(!1), [o, s] = O(!1), u = se(Math.random().toString(36).substring(2, 9)), m = `block-toolbar-trigger-${u.current}`, A = `block-toolbar-popover-${u.current}`, T = () => r(!0), S = (F) => {
788
1954
  setTimeout(() => {
789
- const f = document.getElementById(d);
790
- f && (f === document.activeElement || f.contains(document.activeElement) || f.contains(C.relatedTarget)) || o(!1);
1955
+ const N = document.getElementById(m);
1956
+ N && (N === document.activeElement || N.contains(document.activeElement) || N.contains(F.relatedTarget)) || r(!1);
791
1957
  }, 10);
792
1958
  };
793
- return u(() => {
794
- const C = () => {
795
- const g = !!document.getElementById(E);
796
- c(g);
797
- }, f = new MutationObserver(C);
798
- return f.observe(document.body, {
1959
+ return C(() => {
1960
+ const F = () => {
1961
+ const p = !!document.getElementById(A);
1962
+ s(p);
1963
+ }, N = new MutationObserver(F);
1964
+ return N.observe(document.body, {
799
1965
  childList: !0,
800
1966
  subtree: !0
801
- }), C(), () => f.disconnect();
802
- }, []), u(() => n.registerRootListener(
803
- (f, g) => {
804
- f && (f.addEventListener("focus", m), f.addEventListener("blur", L)), g && (g.removeEventListener("focus", m), g.removeEventListener("blur", L));
1967
+ }), F(), () => N.disconnect();
1968
+ }, []), C(() => n.registerRootListener(
1969
+ (N, p) => {
1970
+ N && (N.addEventListener("focus", T), N.addEventListener("blur", S)), p && (p.removeEventListener("focus", T), p.removeEventListener("blur", S));
805
1971
  }
806
- ), [n]), u(() => n.registerCommand(
807
- A,
1972
+ ), [n]), C(() => n.registerCommand(
1973
+ j,
808
1974
  () => {
809
- const f = n.getRootElement();
810
- if (f) {
811
- const S = f === document.activeElement || f.contains(document.activeElement);
812
- S !== i && o(S);
1975
+ const N = n.getRootElement();
1976
+ if (N) {
1977
+ const E = N === document.activeElement || N.contains(document.activeElement);
1978
+ E !== i && r(E);
813
1979
  }
814
- const g = T();
815
- if (!N(g) || !g.isCollapsed())
816
- return t(null), !1;
817
- const p = ee(g);
818
- if (R(p) && p.getTextContent() === "") {
819
- const v = n.getElementByKey(p.getKey()).getBoundingClientRect(), D = v.left, y = v.top + v.height / 2 + window.scrollY;
820
- t({ x: D, y });
1980
+ const p = L();
1981
+ if (!w(p) || !p.isCollapsed())
1982
+ return e(null), !1;
1983
+ const y = ve(p);
1984
+ if (V(y) && y.getTextContent() === "") {
1985
+ const l = n.getElementByKey(y.getKey()).getBoundingClientRect(), c = l.left, d = l.top + l.height / 2 + window.scrollY;
1986
+ e({ x: c, y: d });
821
1987
  } else
822
- t(null);
1988
+ e(null);
823
1989
  return !1;
824
1990
  },
825
- h
826
- ), [n]), s && (i || r) && ue(
827
- /* @__PURE__ */ l(
828
- hn,
1991
+ $
1992
+ ), [n]), a && (i || o) && Ie(
1993
+ /* @__PURE__ */ h(
1994
+ Xn,
829
1995
  {
830
- selectionRectCoords: s,
831
- TOOLBAR_OFFSET: e,
832
- toolbarTriggerId: d,
833
- toolbarPopoverId: E
1996
+ selectionRectCoords: a,
1997
+ TOOLBAR_OFFSET: t,
1998
+ toolbarTriggerId: m,
1999
+ toolbarPopoverId: A
834
2000
  }
835
2001
  ),
836
- Nn
2002
+ Vn
837
2003
  );
838
2004
  }
839
- const pn = [
2005
+ const er = [
840
2006
  ["$", "$"],
841
2007
  ["\\(", "\\)"]
842
- ], Tn = [
2008
+ ], tr = [
843
2009
  ["$$", "$$"],
844
2010
  ["\\[", "\\]"]
845
- ], Me = (e) => e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), we = (e, s) => {
846
- let t = null;
847
- for (const [n, i] of s) {
848
- const r = new RegExp(
849
- `(.*?)(${Me(n)})(.*?)(${Me(i)})`,
2011
+ ], Qe = (t) => t.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), gt = (t, a) => {
2012
+ let e = null;
2013
+ for (const [n, i] of a) {
2014
+ const o = new RegExp(
2015
+ `(.*?)(${Qe(n)})(.*?)(${Qe(i)})`,
850
2016
  "g"
851
- ).exec(e);
852
- if (r) {
853
- const c = r[3];
854
- if (c && c.trim() !== "") {
855
- const a = r.index + r[1].length, d = r.index + r[0].length;
856
- (!t || a < t.start) && (t = {
857
- start: a,
858
- end: d,
859
- content: n + c + i
2017
+ ).exec(t);
2018
+ if (o) {
2019
+ const s = o[3];
2020
+ if (s && s.trim() !== "") {
2021
+ const u = o.index + o[1].length, m = o.index + o[0].length;
2022
+ (!e || u < e.start) && (e = {
2023
+ start: u,
2024
+ end: m,
2025
+ content: n + s + i
860
2026
  });
861
2027
  }
862
2028
  }
863
2029
  }
864
- return t;
865
- };
866
- function En() {
867
- const [e] = b();
868
- return u(() => {
869
- if (!e.hasNodes([V, Dt]))
2030
+ return e;
2031
+ }, ft = (t, a) => {
2032
+ if (!w(t))
2033
+ return null;
2034
+ const e = t.anchor.getNode(), n = t.focus.getNode(), i = a(e) ? e : I(e, a), r = a(n) ? n : I(n, a);
2035
+ return !i || !r ? null : i.getKey() === r.getKey() ? i : null;
2036
+ }, ht = (t) => t.getData("text/plain") || t.getData("text") || t.getData("text/uri-list");
2037
+ function nr() {
2038
+ const [t] = M();
2039
+ return C(() => {
2040
+ if (!t.hasNodes([me, gn]))
870
2041
  throw new Error(
871
2042
  "MathInlinePlugin: MathNode or MathHighlightNodeInline not registered on editor"
872
2043
  );
873
- }, [e]), u(() => e.registerNodeTransform(z, (t) => {
874
- if (!t.isSimpleText() || F(t) || I(t, k))
2044
+ }, [t]), C(() => t.registerNodeTransform(ie, (e) => {
2045
+ if (!e.isSimpleText() || Q(e) || I(e, G))
875
2046
  return;
876
- const n = t.getTextContent(), i = we(n, pn);
2047
+ const n = e.getTextContent(), i = gt(n, er);
877
2048
  if (i) {
878
- const { start: o, end: r, content: c } = i;
879
- let a;
880
- const d = P(c, !0);
881
- return o === 0 ? ([a] = t.splitText(r), a.insertBefore(d), a.remove()) : ([, a] = t.splitText(o, r), a.replace(d)), d;
2049
+ const { start: r, end: o, content: s } = i;
2050
+ let u;
2051
+ const m = q(s, !0);
2052
+ return r === 0 ? ([u] = e.splitText(o), u.insertBefore(m), u.remove()) : ([, u] = e.splitText(r, o), u.replace(m)), m;
882
2053
  }
883
- }), [e]), u(() => e.registerCommand(
884
- A,
2054
+ }), [t]), C(() => t.registerCommand(
2055
+ j,
885
2056
  () => {
886
- const t = T(), n = /* @__PURE__ */ new Set();
887
- if (de(t)) {
888
- const r = t.getNodes();
889
- if (r.length === 1 && H(r[0])) {
890
- const c = r[0];
891
- if (c.isInline()) {
892
- let a = c.getEquation();
893
- a.startsWith("$") && a.endsWith("$") ? a = a.slice(1, -1) : a.startsWith("\\(") && a.endsWith("\\)") && (a = a.slice(2, -2));
894
- const d = re(a);
895
- return c.replace(d), d.select(), !0;
2057
+ const e = L(), n = /* @__PURE__ */ new Set();
2058
+ if (we(e)) {
2059
+ const o = e.getNodes();
2060
+ if (o.length === 1 && X(o[0])) {
2061
+ const s = o[0];
2062
+ if (s.isInline()) {
2063
+ let u = s.getEquation();
2064
+ u.startsWith("$") && u.endsWith("$") ? u = u.slice(1, -1) : u.startsWith("\\(") && u.endsWith("\\)") && (u = u.slice(2, -2));
2065
+ const m = Ee(u);
2066
+ return s.replace(m), m.select(), !0;
896
2067
  }
897
2068
  }
898
- } else N(t) && t.getNodes().forEach((r) => n.add(r.getKey()));
899
- return j().getAllTextNodes().forEach((r) => {
900
- if (F(r) && !n.has(r.getKey())) {
901
- let c = r.getTextContent();
902
- if (!c) {
903
- r.remove();
2069
+ } else w(e) && e.getNodes().forEach((o) => n.add(o.getKey()));
2070
+ return fe().getAllTextNodes().forEach((o) => {
2071
+ if (Q(o) && !n.has(o.getKey())) {
2072
+ let s = o.getTextContent();
2073
+ if (!s) {
2074
+ o.remove();
904
2075
  return;
905
2076
  }
906
- let a = !1;
907
- c.startsWith("$") && c.endsWith("$") && c.length >= 2 && (c = c.slice(1, -1), a = !0);
908
- const d = a ? P(`$$${c}$$`, !1) : P(`$${c}$`, !0);
909
- r.replace(d);
2077
+ let u = !1;
2078
+ s.startsWith("$") && s.endsWith("$") && s.length >= 2 && (s = s.slice(1, -1), u = !0);
2079
+ const m = u ? q(`$$${s}$$`, !1) : q(`$${s}$`, !0);
2080
+ o.replace(m);
910
2081
  }
911
2082
  }), !1;
912
2083
  },
913
- h
914
- ), [e]), u(() => e.registerCommand(
915
- J,
916
- () => (e.update(() => {
917
- j().getAllTextNodes().forEach((n) => {
918
- if (F(n)) {
2084
+ $
2085
+ ), [t]), C(() => t.registerCommand(
2086
+ be,
2087
+ () => (t.update(() => {
2088
+ fe().getAllTextNodes().forEach((n) => {
2089
+ if (Q(n)) {
919
2090
  let i = n.getTextContent();
920
2091
  if (!i) {
921
2092
  n.remove();
922
2093
  return;
923
2094
  }
924
- let o = !1;
925
- i.startsWith("$") && i.endsWith("$") && i.length >= 2 && (i = i.slice(1, -1), o = !0);
926
- const r = o ? P(`$$${i}$$`, !1) : P(`$${i}$`, !0);
927
- n.replace(r), $e(null);
2095
+ let r = !1;
2096
+ i.startsWith("$") && i.endsWith("$") && i.length >= 2 && (i = i.slice(1, -1), r = !0);
2097
+ const o = r ? q(`$$${i}$$`, !1) : q(`$${i}$`, !0);
2098
+ n.replace(o), Je(null);
928
2099
  }
929
2100
  });
930
2101
  }), !1),
931
- h
932
- ), [e]), u(() => e.registerCommand(
933
- Qe,
934
- (s) => {
935
- const t = T();
936
- if (!N(t) || !t.isCollapsed())
2102
+ $
2103
+ ), [t]), C(() => t.registerCommand(
2104
+ St,
2105
+ (a) => {
2106
+ const e = L();
2107
+ if (!w(e) || !e.isCollapsed())
937
2108
  return !1;
938
- const n = ae(t.anchor, !1);
939
- if (H(n) && n.isInline()) {
940
- let o = n.getEquation();
941
- o.startsWith("$") && o.endsWith("$") ? o = o.slice(1, -1) : o.startsWith("\\(") && o.endsWith("\\)") && (o = o.slice(2, -2));
942
- const r = re(o);
943
- return n.replace(r), r.select(0, 0), !0;
2109
+ const n = Fe(e.anchor, !1);
2110
+ if (X(n) && n.isInline()) {
2111
+ let r = n.getEquation();
2112
+ r.startsWith("$") && r.endsWith("$") ? r = r.slice(1, -1) : r.startsWith("\\(") && r.endsWith("\\)") && (r = r.slice(2, -2));
2113
+ const o = Ee(r);
2114
+ return n.replace(o), o.select(0, 0), !0;
944
2115
  }
945
2116
  return !1;
946
2117
  },
947
- h
948
- ), [e]), u(() => e.registerCommand(
949
- ce,
950
- (s) => {
951
- const t = T();
952
- if (!N(t) || !t.isCollapsed())
2118
+ $
2119
+ ), [t]), C(() => t.registerCommand(
2120
+ Le,
2121
+ (a) => {
2122
+ const e = L();
2123
+ if (!w(e) || !e.isCollapsed())
953
2124
  return !1;
954
- const n = ae(t.anchor, !0);
955
- if (H(n) && n.isInline()) {
956
- let o = n.getEquation();
957
- o.startsWith("$") && o.endsWith("$") ? o = o.slice(1, -1) : o.startsWith("\\(") && o.endsWith("\\)") && (o = o.slice(2, -2));
958
- const r = re(o);
959
- return n.replace(r), r.select(), !0;
2125
+ const n = Fe(e.anchor, !0);
2126
+ if (X(n) && n.isInline()) {
2127
+ let r = n.getEquation();
2128
+ r.startsWith("$") && r.endsWith("$") ? r = r.slice(1, -1) : r.startsWith("\\(") && r.endsWith("\\)") && (r = r.slice(2, -2));
2129
+ const o = Ee(r);
2130
+ return n.replace(o), o.select(), !0;
960
2131
  }
961
2132
  return !1;
962
2133
  },
963
- h
964
- ), [e]), u(() => e.registerCommand(
965
- A,
2134
+ $
2135
+ ), [t]), C(() => t.registerCommand(
2136
+ ke,
2137
+ (a) => {
2138
+ const e = a.clipboardData;
2139
+ if (!e)
2140
+ return !1;
2141
+ const n = L();
2142
+ if (!ft(
2143
+ n,
2144
+ Q
2145
+ ))
2146
+ return !1;
2147
+ const r = ht(e);
2148
+ return r ? (a.preventDefault(), n.insertText(r), !0) : !1;
2149
+ },
2150
+ $
2151
+ ), [t]), C(() => t.registerCommand(
2152
+ j,
966
2153
  () => {
967
- const s = T();
968
- if (!N(s) || !s.isCollapsed())
2154
+ const a = L();
2155
+ if (!w(a) || !a.isCollapsed())
969
2156
  return !1;
970
- const t = s.anchor.getNode();
971
- return F(t) && (t.getNextSibling() || t.insertAfter(je(" "))), !1;
2157
+ const e = a.anchor.getNode();
2158
+ return Q(e) && (e.getNextSibling() || e.insertAfter(Ft(" "))), !1;
972
2159
  },
973
- Xe
974
- ), [e]), // Register click event for MathNode
975
- /* @__PURE__ */ l(
976
- fe,
2160
+ $t
2161
+ ), [t]), // Register click event for MathNode
2162
+ /* @__PURE__ */ h(
2163
+ Oe,
977
2164
  {
978
- nodeType: V,
2165
+ nodeType: me,
979
2166
  eventType: "click",
980
- eventListener: (s, t, n) => {
981
- const i = q(n);
2167
+ eventListener: (a, e, n) => {
2168
+ const i = oe(n);
982
2169
  i && i.isInline() && i.select();
983
2170
  }
984
2171
  }
985
2172
  );
986
2173
  }
987
- function bn() {
988
- const [e] = b();
989
- return u(() => {
990
- if (!e.hasNodes([V, kt]))
2174
+ function rr() {
2175
+ const [t] = M();
2176
+ return C(() => {
2177
+ if (!t.hasNodes([me, fn]))
991
2178
  throw new Error(
992
2179
  "MathBlockPlugin: MathNode or MathHighlightNodeBlock not registered on editor"
993
2180
  );
994
- }, [e]), u(() => e.registerNodeTransform(z, (t) => {
995
- if (!t.isSimpleText() || I(t, k))
2181
+ }, [t]), C(() => t.registerNodeTransform(ie, (e) => {
2182
+ if (!e.isSimpleText() || I(e, G))
996
2183
  return;
997
- const n = t.getTextContent();
2184
+ const n = e.getTextContent();
998
2185
  if (n.startsWith("$$ ")) {
999
- const o = t.getPreviousSibling(), r = I(t, R), c = r !== null && r.getChildrenSize() === 1, a = K(o);
1000
- if (c || a) {
2186
+ const r = e.getPreviousSibling(), o = I(e, V), s = o !== null && o.getChildrenSize() === 1, u = te(r);
2187
+ if (s || u) {
1001
2188
  if (n.length > 3)
1002
2189
  return;
1003
- const d = ie("");
1004
- t.replace(d), d.select();
1005
- const E = d.getNextSibling();
1006
- K(E) && E.remove();
2190
+ const m = Te("");
2191
+ e.replace(m), m.select();
2192
+ const A = m.getNextSibling();
2193
+ te(A) && A.remove();
1007
2194
  return;
1008
2195
  }
1009
2196
  }
1010
- const i = we(n, Tn);
2197
+ const i = gt(n, tr);
1011
2198
  if (i) {
1012
- const { start: o, end: r, content: c } = i;
1013
- let a;
1014
- const d = P(c, !1);
1015
- return o === 0 ? ([a] = t.splitText(r), a.insertBefore(d), a.remove()) : ([, a] = t.splitText(o, r), a.replace(d)), d;
2199
+ const { start: r, end: o, content: s } = i;
2200
+ let u;
2201
+ const m = q(s, !1);
2202
+ return r === 0 ? ([u] = e.splitText(o), u.insertBefore(m), u.remove()) : ([, u] = e.splitText(r, o), u.replace(m)), m;
1016
2203
  }
1017
- }), [e]), u(() => e.registerCommand(
1018
- A,
2204
+ }), [t]), C(() => t.registerCommand(
2205
+ j,
1019
2206
  () => {
1020
- const t = T(), n = /* @__PURE__ */ new Set();
1021
- if (de(t)) {
1022
- const r = t.getNodes();
1023
- if (r.length === 1 && H(r[0])) {
1024
- const c = r[0];
1025
- if (!c.isInline()) {
1026
- let a = c.getEquation();
1027
- (a.startsWith("$$") && a.endsWith("$$") || a.startsWith("\\[") && a.endsWith("\\]")) && (a = a.slice(2, -2));
1028
- const d = ie(a);
1029
- return c.replace(d), d.select(), !0;
2207
+ const e = L(), n = /* @__PURE__ */ new Set();
2208
+ if (we(e)) {
2209
+ const o = e.getNodes();
2210
+ if (o.length === 1 && X(o[0])) {
2211
+ const s = o[0];
2212
+ if (!s.isInline()) {
2213
+ let u = s.getEquation();
2214
+ (u.startsWith("$$") && u.endsWith("$$") || u.startsWith("\\[") && u.endsWith("\\]")) && (u = u.slice(2, -2));
2215
+ const m = Te(u);
2216
+ return s.replace(m), m.select(), !0;
1030
2217
  }
1031
2218
  }
1032
- } else N(t) && t.getNodes().forEach((r) => {
1033
- n.add(r.getKey());
1034
- const c = I(r, k);
1035
- c && n.add(c.getKey());
2219
+ } else w(e) && e.getNodes().forEach((o) => {
2220
+ n.add(o.getKey());
2221
+ const s = I(o, G);
2222
+ s && n.add(s.getKey());
1036
2223
  });
1037
- const o = e.getEditorState()._nodeMap;
1038
- for (const [, r] of o)
1039
- if (k(r) && r.isAttached() && !n.has(r.getKey())) {
1040
- const c = r.getTextContent();
1041
- if (!c) {
1042
- r.remove();
2224
+ const r = t.getEditorState()._nodeMap;
2225
+ for (const [, o] of r)
2226
+ if (G(o) && o.isAttached() && !n.has(o.getKey())) {
2227
+ const s = o.getTextContent();
2228
+ if (!s) {
2229
+ o.remove();
1043
2230
  continue;
1044
2231
  }
1045
- const a = P(`$$${c}$$`, !1);
1046
- r.replace(a);
2232
+ const u = q(`$$${s}$$`, !1);
2233
+ o.replace(u);
1047
2234
  }
1048
2235
  return !1;
1049
2236
  },
1050
- h
1051
- ), [e]), u(() => e.registerCommand(
1052
- J,
1053
- () => (e.update(() => {
1054
- const s = j();
1055
- ot(s).forEach(({ node: n }) => {
1056
- if (k(n)) {
2237
+ $
2238
+ ), [t]), C(() => t.registerCommand(
2239
+ be,
2240
+ () => (t.update(() => {
2241
+ const a = fe();
2242
+ Pt(a).forEach(({ node: n }) => {
2243
+ if (G(n)) {
1057
2244
  const i = n.getTextContent();
1058
2245
  if (!i) {
1059
2246
  n.remove();
1060
2247
  return;
1061
2248
  }
1062
- const o = P(`$$${i}$$`, !1);
1063
- n.replace(o), $e(null);
2249
+ const r = q(`$$${i}$$`, !1);
2250
+ n.replace(r), Je(null);
1064
2251
  }
1065
2252
  });
1066
2253
  }), !1),
1067
- h
1068
- ), [e]), u(() => e.registerCommand(
1069
- Ve,
2254
+ $
2255
+ ), [t]), C(() => t.registerCommand(
2256
+ Lt,
1070
2257
  () => {
1071
- const t = T();
1072
- if (!N(t))
2258
+ const e = L();
2259
+ if (!w(e))
1073
2260
  return !1;
1074
- const n = t.getNodes()[0], i = I(
2261
+ const n = e.getNodes()[0], i = I(
1075
2262
  n,
1076
- k
2263
+ G
1077
2264
  );
1078
2265
  if (!i)
1079
2266
  return !1;
1080
- const o = i.getLastChild();
1081
- return t.isCollapsed() && (t.anchor.getNode().getKey() === i.getKey() && t.anchor.offset === 0 && i.getChildrenSize() === 0 || o && K(o) && t.anchor.getNode().getKey() === i.getKey() && t.anchor.offset === i.getChildrenSize() || o && Ze(o) && t.anchor.getNode().getKey() === o.getKey() && t.anchor.offset === o.getTextContent().length) ? !1 : (t.insertLineBreak(), !0);
2267
+ const r = i.getLastChild();
2268
+ return e.isCollapsed() && (e.anchor.getNode().getKey() === i.getKey() && e.anchor.offset === 0 && i.getChildrenSize() === 0 || r && te(r) && e.anchor.getNode().getKey() === i.getKey() && e.anchor.offset === i.getChildrenSize() || r && wt(r) && e.anchor.getNode().getKey() === r.getKey() && e.anchor.offset === r.getTextContent().length) ? !1 : (e.insertLineBreak(), !0);
1082
2269
  },
1083
- h
1084
- ), [e]), u(() => e.registerCommand(
1085
- ce,
1086
- (s) => {
1087
- const t = T();
1088
- if (!N(t) || !t.isCollapsed())
2270
+ $
2271
+ ), [t]), C(() => t.registerCommand(
2272
+ Le,
2273
+ (a) => {
2274
+ const e = L();
2275
+ if (!w(e) || !e.isCollapsed())
1089
2276
  return !1;
1090
- const n = ae(t.anchor, !0);
1091
- if (H(n) && !n.isInline()) {
1092
- let o = n.getEquation();
1093
- (o.startsWith("$$") && o.endsWith("$$") || o.startsWith("\\[") && o.endsWith("\\]")) && (o = o.slice(2, -2));
1094
- const r = ie(o);
1095
- return n.replace(r), r.select(), !0;
2277
+ const n = Fe(e.anchor, !0);
2278
+ if (X(n) && !n.isInline()) {
2279
+ let r = n.getEquation();
2280
+ (r.startsWith("$$") && r.endsWith("$$") || r.startsWith("\\[") && r.endsWith("\\]")) && (r = r.slice(2, -2));
2281
+ const o = Te(r);
2282
+ return n.replace(o), o.select(), !0;
1096
2283
  }
1097
2284
  return !1;
1098
2285
  },
1099
- h
1100
- ), [e]), /* @__PURE__ */ l(
1101
- fe,
2286
+ $
2287
+ ), [t]), C(() => t.registerCommand(
2288
+ ke,
2289
+ (a) => {
2290
+ const e = a.clipboardData;
2291
+ if (!e)
2292
+ return !1;
2293
+ const n = L();
2294
+ if (!ft(
2295
+ n,
2296
+ G
2297
+ ))
2298
+ return !1;
2299
+ const r = ht(e);
2300
+ return r ? (a.preventDefault(), n.insertRawText(r), !0) : !1;
2301
+ },
2302
+ $
2303
+ ), [t]), /* @__PURE__ */ h(
2304
+ Oe,
1102
2305
  {
1103
- nodeType: V,
2306
+ nodeType: me,
1104
2307
  eventType: "click",
1105
- eventListener: (s, t, n) => {
1106
- const i = q(n);
2308
+ eventListener: (a, e, n) => {
2309
+ const i = oe(n);
1107
2310
  i && !i.isInline() && i.select();
1108
2311
  }
1109
2312
  }
1110
2313
  );
1111
2314
  }
1112
- const Ln = 3;
1113
- function Mn() {
1114
- const [e] = b();
1115
- return u(() => e.registerNodeTransform(
1116
- Je,
1117
- (t) => {
1118
- const n = t.getParent();
1119
- if (Ne(n)) {
1120
- const i = et();
1121
- t.replace(i), i.selectEnd();
2315
+ const ir = 3;
2316
+ function or() {
2317
+ const [t] = M();
2318
+ return C(() => t.registerNodeTransform(
2319
+ kt,
2320
+ (e) => {
2321
+ const n = e.getParent();
2322
+ if (ze(n)) {
2323
+ const i = It();
2324
+ e.replace(i), i.selectEnd();
1122
2325
  }
1123
2326
  }
1124
- ), [e]), u(() => e.registerNodeTransform(z, (t) => {
1125
- if (!I(t, R) || I(t, R).getFirstDescendant() !== t)
2327
+ ), [t]), C(() => t.registerNodeTransform(ie, (e) => {
2328
+ if (!I(e, V) || I(e, V).getFirstDescendant() !== e)
1126
2329
  return;
1127
- const i = T();
1128
- if (N(i) && i.isCollapsed()) {
1129
- const r = i.anchor.offset;
1130
- t.getTextContent() === "1. " && r === 3 ? (Ce("number"), t.setTextContent("")) : t.getTextContent() === "- " && r === 2 && (Ce("bullet"), t.setTextContent(""));
2330
+ const i = L();
2331
+ if (w(i) && i.isCollapsed()) {
2332
+ const o = i.anchor.offset;
2333
+ e.getTextContent() === "1. " && o === 3 ? (We("number"), e.setTextContent("")) : e.getTextContent() === "- " && o === 2 && (We("bullet"), e.setTextContent(""));
1131
2334
  }
1132
- }), [e]), u(() => e.registerCommand(
1133
- tt,
1134
- (t) => {
1135
- const n = T();
1136
- if (!N(n))
2335
+ }), [t]), C(() => t.registerCommand(
2336
+ Mt,
2337
+ (e) => {
2338
+ const n = L();
2339
+ if (!w(n))
1137
2340
  return !1;
1138
- const i = ee(n), o = I(i, Ne);
1139
- if (!o)
2341
+ const i = ve(n), r = I(i, ze);
2342
+ if (!r)
1140
2343
  return !1;
1141
- const r = o.getIndent();
1142
- if (t.shiftKey) {
1143
- if (r <= 0)
2344
+ const o = r.getIndent();
2345
+ if (e.shiftKey) {
2346
+ if (o <= 0)
1144
2347
  return !1;
1145
- o.setIndent(r - 1);
2348
+ r.setIndent(o - 1);
1146
2349
  } else {
1147
- if (r > Ln)
2350
+ if (o > ir)
1148
2351
  return !1;
1149
- o.setIndent(r + 1);
2352
+ r.setIndent(o + 1);
1150
2353
  }
1151
2354
  return !0;
1152
2355
  },
1153
- h
1154
- ), [e]), null;
2356
+ $
2357
+ ), [t]), null;
1155
2358
  }
1156
- function In() {
1157
- const [e] = b(), s = (t) => {
1158
- t.key === "Tab" && t.preventDefault();
2359
+ function sr() {
2360
+ const [t] = M(), a = (e) => {
2361
+ e.key === "Tab" && e.preventDefault();
1159
2362
  };
1160
- return u(() => e.registerRootListener(
2363
+ return C(() => t.registerRootListener(
1161
2364
  (n, i) => {
1162
- n && n.addEventListener("keydown", s), i && i.removeEventListener("keydown", s);
2365
+ n && n.addEventListener("keydown", a), i && i.removeEventListener("keydown", a);
1163
2366
  }
1164
- ), [e]), null;
2367
+ ), [t]), null;
1165
2368
  }
1166
- function Sn({ editorRef: e }) {
1167
- const [s] = b();
1168
- return u(() => {
1169
- if (e)
1170
- return e.current = s, () => {
1171
- e && (e.current = null);
2369
+ function ar({ editorRef: t }) {
2370
+ const [a] = M();
2371
+ return C(() => {
2372
+ if (t)
2373
+ return t.current = a, () => {
2374
+ t && (t.current = null);
1172
2375
  };
1173
- }, [s, e]), null;
2376
+ }, [a, t]), null;
1174
2377
  }
1175
- function Xn({
1176
- initialConfig: e,
1177
- onChange: s,
1178
- editorRef: t,
2378
+ function Ir({
2379
+ initialConfig: t,
2380
+ onChange: a,
2381
+ editorRef: e,
1179
2382
  blockToolbarGap: n,
1180
2383
  spellCheck: i,
1181
- isHeadingOneFirst: o
2384
+ isHeadingOneFirst: r
1182
2385
  }) {
1183
- return /* @__PURE__ */ $(Ke, { initialConfig: e, children: [
1184
- /* @__PURE__ */ l(
1185
- We,
2386
+ return /* @__PURE__ */ D(yt, { initialConfig: t, children: [
2387
+ /* @__PURE__ */ h(
2388
+ Nt,
1186
2389
  {
1187
- contentEditable: /* @__PURE__ */ l(wt, { spellCheck: i, className: "editor-input" }),
1188
- ErrorBoundary: ze
2390
+ contentEditable: /* @__PURE__ */ h(vn, { spellCheck: i, className: "editor-input" }),
2391
+ ErrorBoundary: Et
1189
2392
  }
1190
2393
  ),
1191
- /* @__PURE__ */ l(Jt, { isHeadingOneFirst: o }),
1192
- /* @__PURE__ */ l(rn, {}),
1193
- /* @__PURE__ */ l(Cn, { toolbarGap: n }),
1194
- /* @__PURE__ */ l(Fe, {}),
1195
- /* @__PURE__ */ l(Ge, {}),
1196
- /* @__PURE__ */ l(En, {}),
1197
- /* @__PURE__ */ l(bn, {}),
1198
- /* @__PURE__ */ l(dn, {}),
1199
- /* @__PURE__ */ l(un, {}),
1200
- /* @__PURE__ */ l(fn, {}),
1201
- /* @__PURE__ */ l(Ht, {}),
1202
- /* @__PURE__ */ l(Mn, {}),
1203
- /* @__PURE__ */ l(In, {}),
1204
- /* @__PURE__ */ l(Rt, { onChange: s }),
1205
- /* @__PURE__ */ l(Sn, { editorRef: t }),
1206
- /* @__PURE__ */ l(Ft, {})
2394
+ /* @__PURE__ */ h(In, { isHeadingOneFirst: r }),
2395
+ /* @__PURE__ */ h(Dn, {}),
2396
+ /* @__PURE__ */ h(Jn, { toolbarGap: n }),
2397
+ /* @__PURE__ */ h(Ct, {}),
2398
+ /* @__PURE__ */ h(xt, {}),
2399
+ /* @__PURE__ */ h(nr, {}),
2400
+ /* @__PURE__ */ h(rr, {}),
2401
+ /* @__PURE__ */ h(Un, {}),
2402
+ /* @__PURE__ */ h(jn, {}),
2403
+ /* @__PURE__ */ h(Zn, {}),
2404
+ /* @__PURE__ */ h(pn, {}),
2405
+ /* @__PURE__ */ h(or, {}),
2406
+ /* @__PURE__ */ h(sr, {}),
2407
+ /* @__PURE__ */ h(bn, { onChange: a }),
2408
+ /* @__PURE__ */ h(ar, { editorRef: e }),
2409
+ /* @__PURE__ */ h(Cn, {})
1207
2410
  ] });
1208
2411
  }
1209
2412
  export {
1210
- Xn as default
2413
+ Ir as default
1211
2414
  };
1212
2415
  //# sourceMappingURL=index.es.js.map