@cyte-editor/react 1.3.0 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,121 +1,121 @@
1
- import { jsx as e, jsxs as v, Fragment as Ze } from "react/jsx-runtime";
2
- import Xe, { useRef as B, useState as H, useCallback as A, useEffect as K, useMemo as Te, useLayoutEffect as it, forwardRef as ct, useImperativeHandle as st } from "react";
3
- import { TextSelection as at } from "@tiptap/pm/state";
4
- import { TableMap as lt } from "@tiptap/pm/tables";
5
- import { EditorManager as dt, I18nManager as De, toolbarItemDefs as Je, uploadFile as ut, groupToolbarItems as pt, getToolbarItemDef as ht, adjustMenuPosition as Qe, ScrollSyncManager as ft, showToast as je, getHoverLineVisible as mt, moveCursorToCell as $e, restoreTableSelection as et, clearSavedTableSelection as tt } from "@cyte-editor/core";
6
- import { getLicenseStatus as gt } from "@cyte-editor/license";
1
+ import { jsx as e, jsxs as w, Fragment as nt } from "react/jsx-runtime";
2
+ import tt, { useRef as B, useState as A, useCallback as S, useEffect as z, useMemo as Me, useLayoutEffect as pt, forwardRef as ht, useImperativeHandle as at } from "react";
3
+ import { TextSelection as ft } from "@tiptap/pm/state";
4
+ import { TableMap as dt } from "@tiptap/pm/tables";
5
+ import { EditorManager as mt, I18nManager as Le, toolbarItemDefs as Xe, uploadFile as gt, installToolbarPanelPlacement as wt, groupToolbarItems as vt, getToolbarItemDef as yt, adjustMenuPosition as bt, getVisualBand as xt, ScrollSyncManager as kt, showToast as qe, installTableTouchHandle as Ct, getHoverLineVisible as Ke, installContextMenuTouchTracking as Nt, isTouchOriginatedContextMenu as Mt, moveCursorToCell as je, syncTableSelectionForCell as rt, clearSavedTableSelection as lt, restoreTableSelection as Lt, getCurrentTableCell as Ve, beginTableRangeSelection as Tt, selectTableAll as Dt, selectTableColumn as St, selectTableRow as Ht } from "@cyte-editor/core";
6
+ import { getLicenseStatus as At } from "@cyte-editor/license";
7
7
  import { createPortal as _e } from "react-dom";
8
8
  /*!
9
- * CyteEditor React Adapter v1.3.0 (@cyte-editor/react)
9
+ * CyteEditor React Adapter v1.4.0 (@cyte-editor/react)
10
10
  * (c) 2026 CyteEditor — All Rights Reserved.
11
11
  *
12
12
  * Commercial Software — NOT Open Source.
13
13
  * Licensed under the CyteEditor Commercial License.
14
14
  * SEE LICENSE IN ./LICENSE | Full EULA: https://cyteeditor.com/eula
15
15
  *
16
- * Build: e84a4aa-dirty @ 2026-10-31T08:20:43.064Z
16
+ * Build: 1851043-dirty @ 2026-12-05T08:07:11.684Z
17
17
  * Homepage: https://cyteeditor.com
18
18
  * Contact: legal@cyteeditor.com (legal) / support@cyteeditor.com (support)
19
19
  *
20
20
  * UNAUTHORIZED COPYING, MODIFICATION, REDISTRIBUTION,
21
21
  * REVERSE-ENGINEERING OR REMOVAL OF THIS NOTICE IS STRICTLY PROHIBITED.
22
22
  */
23
- function wt(t) {
24
- var m, T;
25
- const o = B(null), c = B(null), [p, i] = H(!1), [s, h] = H(!1), [d, u] = H(!0), f = B(!1), y = B(t);
26
- y.current = t;
27
- const N = A((w, M) => {
28
- if (!(f.current || !c.current)) {
23
+ function Et(t) {
24
+ var p, T;
25
+ const r = B(null), a = B(null), [h, c] = A(!1), [s, m] = A(!1), [d, u] = A(!0), f = B(!1), v = B(t);
26
+ v.current = t;
27
+ const L = S((b, M) => {
28
+ if (!(f.current || !a.current)) {
29
29
  if (M !== void 0) {
30
- const n = JSON.stringify(c.current.getJSON()), r = JSON.stringify(M);
31
- if (n === r) return;
32
- c.current.setJSON(M);
30
+ const g = JSON.stringify(a.current.getJSON()), o = JSON.stringify(M);
31
+ if (g === o) return;
32
+ a.current.setJSON(M);
33
33
  return;
34
34
  }
35
- if (w !== void 0) {
36
- if (w === c.current.getHTML()) return;
37
- c.current.setContent(w);
35
+ if (b !== void 0) {
36
+ if (b === a.current.getHTML()) return;
37
+ a.current.setContent(b);
38
38
  }
39
39
  }
40
40
  }, []);
41
- K(() => {
42
- var n, r;
43
- const w = o.current;
44
- if (!w) return;
45
- const M = dt.create(w, y.current.config);
46
- return c.current = M, u(M.isEmpty()), M.on("update", ({ html: k }) => {
47
- var g, l;
48
- u(M.isEmpty()), f.current = !0, (l = (g = y.current).onUpdate) == null || l.call(g, k, M.getJSON()), Promise.resolve().then(() => {
41
+ z(() => {
42
+ var g, o;
43
+ const b = r.current;
44
+ if (!b) return;
45
+ const M = mt.create(b, v.current.config);
46
+ return a.current = M, u(M.isEmpty()), M.on("update", ({ html: x }) => {
47
+ var i, l;
48
+ u(M.isEmpty()), f.current = !0, (l = (i = v.current).onUpdate) == null || l.call(i, x, M.getJSON()), Promise.resolve().then(() => {
49
49
  f.current = !1;
50
50
  });
51
- }), M.on("focus", ({ event: k }) => {
52
- var g, l;
53
- h(!0), (l = (g = y.current).onFocus) == null || l.call(g, k);
54
- }), M.on("blur", ({ event: k }) => {
55
- var g, l;
56
- h(!1), (l = (g = y.current).onBlur) == null || l.call(g, k);
57
- }), i(!0), (r = (n = y.current).onReady) == null || r.call(n, M), () => {
58
- M.destroy(), c.current = null, i(!1);
51
+ }), M.on("focus", ({ event: x }) => {
52
+ var i, l;
53
+ m(!0), (l = (i = v.current).onFocus) == null || l.call(i, x);
54
+ }), M.on("blur", ({ event: x }) => {
55
+ var i, l;
56
+ m(!1), (l = (i = v.current).onBlur) == null || l.call(i, x);
57
+ }), c(!0), (o = (g = v.current).onReady) == null || o.call(g, M), () => {
58
+ M.destroy(), a.current = null, c(!1);
59
59
  };
60
- }, []), K(() => {
61
- const w = c.current;
62
- w && t.config.readonly !== void 0 && w.setReadonly(t.config.readonly);
63
- }, [t.config.readonly, t.config.disabled]), K(() => {
64
- t.config.locale && De.getInstance().setLocale(t.config.locale);
60
+ }, []), z(() => {
61
+ const b = a.current;
62
+ b && t.config.readonly !== void 0 && b.setReadonly(t.config.readonly);
63
+ }, [t.config.readonly, t.config.disabled]), z(() => {
64
+ t.config.locale && Le.getInstance().setLocale(t.config.locale);
65
65
  }, [t.config.locale]);
66
- const S = B((m = t.config.license) == null ? void 0 : m.key);
67
- return K(() => {
66
+ const H = B((p = t.config.license) == null ? void 0 : p.key);
67
+ return z(() => {
68
68
  var M;
69
- const w = (M = t.config.license) == null ? void 0 : M.key;
70
- w !== S.current && (S.current = w, w && c.current && c.current.updateLicense(t.config.license));
69
+ const b = (M = t.config.license) == null ? void 0 : M.key;
70
+ b !== H.current && (H.current = b, b && a.current && a.current.updateLicense(t.config.license));
71
71
  }, [(T = t.config.license) == null ? void 0 : T.key]), {
72
- manager: c.current,
73
- isReady: p,
72
+ manager: a.current,
73
+ isReady: h,
74
74
  isFocused: s,
75
75
  isEmpty: d,
76
- containerRef: o,
77
- setContentFromProp: N
76
+ containerRef: r,
77
+ setContentFromProp: L
78
78
  };
79
79
  }
80
- function vt(t) {
81
- const [o, c] = H({}), [p, i] = H({}), s = A(async () => {
80
+ function Rt(t) {
81
+ const [r, a] = A({}), [h, c] = A({}), s = S(async () => {
82
82
  if (!t) return;
83
- const h = t.getEditor(), d = {}, u = {};
84
- for (const [S, m] of Object.entries(Je))
85
- m.isActive && (d[S] = m.isActive(h)), m.isDisabled && (u[S] = m.isDisabled(h));
86
- const f = gt(), y = f === "valid" || f === "expiring_soon", N = await t.hasSnapshots();
87
- if (u.compare = !N || !y, !y)
88
- for (const [S, m] of Object.entries(Je))
89
- m.requiredTier && S !== "compare" && (u[S] = !0);
90
- for (const [S, m] of Object.entries(Je))
91
- m.requiresPlugin && !t.hasProPlugin(m.requiresPlugin) && (u[S] = !0);
92
- c(d), i(u);
83
+ const m = t.getEditor(), d = {}, u = {};
84
+ for (const [H, p] of Object.entries(Xe))
85
+ p.isActive && (d[H] = p.isActive(m)), p.isDisabled && (u[H] = p.isDisabled(m));
86
+ const f = At(), v = f === "valid" || f === "expiring_soon", L = await t.hasSnapshots();
87
+ if (u.compare = !L || !v, !v)
88
+ for (const [H, p] of Object.entries(Xe))
89
+ p.requiredTier && H !== "compare" && (u[H] = !0);
90
+ for (const [H, p] of Object.entries(Xe))
91
+ p.requiresPlugin && !t.hasProPlugin(p.requiresPlugin) && (u[H] = !0);
92
+ a(d), c(u);
93
93
  }, [t]);
94
- return K(() => {
94
+ return z(() => {
95
95
  if (t)
96
96
  return t.on("selectionUpdate", s), t.on("update", s), t.on("transaction", s), t.on("snapshot-created", s), s(), () => {
97
97
  t.off("selectionUpdate", s), t.off("update", s), t.off("transaction", s), t.off("snapshot-created", s);
98
98
  };
99
99
  }, [t, s]), {
100
- activeStates: o,
101
- disabledStates: p,
100
+ activeStates: r,
101
+ disabledStates: h,
102
102
  refresh: s
103
103
  };
104
104
  }
105
105
  function fe() {
106
- const t = De.getInstance(), [o, c] = H(0);
107
- K(() => t.onChange(() => {
108
- c((s) => s + 1);
106
+ const t = Le.getInstance(), [r, a] = A(0);
107
+ z(() => t.onChange(() => {
108
+ a((s) => s + 1);
109
109
  }), [t]);
110
- function p(i, s) {
111
- return t.t(i, s);
110
+ function h(c, s) {
111
+ return t.t(c, s);
112
112
  }
113
113
  return {
114
- t: p,
114
+ t: h,
115
115
  locale: t.getLocale()
116
116
  };
117
117
  }
118
- const yt = {
118
+ const $t = {
119
119
  undo: '<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M3 7v6h6"/><path d="M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13"/></svg>',
120
120
  redo: '<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 7v6h-6"/><path d="M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3L21 13"/></svg>',
121
121
  bold: '<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M6 4h8a4 4 0 0 1 4 4 4 4 0 0 1-4 4H6z"/><path d="M6 12h9a4 4 0 0 1 4 4 4 4 0 0 1-4 4H6z"/></svg>',
@@ -159,122 +159,122 @@ const yt = {
159
159
  structure: '<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polygon points="12 2.5 20 7 20 17 12 21.5 4 17 4 7"/><circle cx="12" cy="12" r="4"/></svg>',
160
160
  autoFormat: '<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M15 4V2"/><path d="M15 16v-2"/><path d="M8 9h2"/><path d="M20 9h2"/><path d="M17.8 11.8 19 13"/><path d="M17.8 6.2 19 5"/><path d="M3 21l9-9"/><path d="M12.2 6.2 11 5"/></svg>'
161
161
  };
162
- function ke(t) {
163
- return yt[t] || "";
162
+ function be(t) {
163
+ return $t[t] || "";
164
164
  }
165
- const bt = ({
165
+ const _t = ({
166
166
  visible: t,
167
- targetRect: o,
168
- editor: c,
169
- savedSelection: p,
170
- initialUrl: i,
167
+ targetRect: r,
168
+ editor: a,
169
+ savedSelection: h,
170
+ initialUrl: c,
171
171
  isEditing: s,
172
- onConfirm: h,
172
+ onConfirm: m,
173
173
  onCancel: d,
174
174
  onClose: u
175
175
  }) => {
176
- const { t: f } = fe(), [y, N] = H(i || ""), [S, m] = H(!1), T = B(null), [w, M] = H(null), [n, r] = H(""), k = () => {
177
- if (c && p)
176
+ const { t: f } = fe(), [v, L] = A(c || ""), [H, p] = A(!1), T = B(null), [b, M] = A(null), [g, o] = A(""), x = () => {
177
+ if (a && h)
178
178
  try {
179
- const { from: b, to: E } = p, $ = c.view.coordsAtPos(b), P = c.view.coordsAtPos(E);
180
- if ($ && P) {
181
- M(new DOMRect($.left, $.top, P.left - $.left, $.bottom - $.top));
179
+ const { from: k, to: D } = h, E = a.view.coordsAtPos(k), P = a.view.coordsAtPos(D);
180
+ if (E && P) {
181
+ M(new DOMRect(E.left, E.top, P.left - E.left, E.bottom - E.top));
182
182
  return;
183
183
  }
184
184
  } catch {
185
185
  }
186
- M(o || null);
186
+ M(r || null);
187
187
  };
188
- K(() => {
189
- const b = () => {
190
- t && k();
188
+ z(() => {
189
+ const k = () => {
190
+ t && x();
191
191
  };
192
- return window.addEventListener("scroll", b, !0), window.addEventListener("resize", b), () => {
193
- window.removeEventListener("scroll", b, !0), window.removeEventListener("resize", b);
192
+ return window.addEventListener("scroll", k, !0), window.addEventListener("resize", k), () => {
193
+ window.removeEventListener("scroll", k, !0), window.removeEventListener("resize", k);
194
194
  };
195
- }, [t, c, p, o]), K(() => {
196
- t && (N(i || ""), r(""), k(), setTimeout(() => {
197
- var b, E;
198
- (b = T.current) == null || b.focus(), (E = T.current) == null || E.select();
195
+ }, [t, a, h, r]), z(() => {
196
+ t && (L(c || ""), o(""), x(), setTimeout(() => {
197
+ var k, D;
198
+ (k = T.current) == null || k.focus(), (D = T.current) == null || D.select();
199
199
  }, 0));
200
200
  }, [t]);
201
- const g = Te(() => {
202
- const b = w;
203
- if (!b) return {};
204
- const E = 180, $ = 8, P = window.innerHeight, G = window.innerWidth;
205
- let O = b.bottom + $, j = !1;
206
- O + E > P && (O = b.top - E - $, j = !0), m(j);
207
- let W = b.left + b.width / 2;
208
- const I = 320;
209
- return W + I / 2 > G && (W = G - I / 2 - 16), W < I / 2 + 16 && (W = I / 2 + 16), { top: `${O}px`, left: `${W}px` };
210
- }, [w]), l = (b) => {
201
+ const i = Me(() => {
202
+ const k = b;
203
+ if (!k) return {};
204
+ const D = 180, E = 8, P = window.innerHeight, V = window.innerWidth;
205
+ let O = k.bottom + E, K = !1;
206
+ O + D > P && (O = k.top - D - E, K = !0), p(K);
207
+ let j = k.left + k.width / 2;
208
+ const _ = 320;
209
+ return j + _ / 2 > V && (j = V - _ / 2 - 16), j < _ / 2 + 16 && (j = _ / 2 + 16), { top: `${O}px`, left: `${j}px` };
210
+ }, [b]), l = (k) => {
211
211
  try {
212
- const E = new URL(b);
213
- return E.protocol === "http:" || E.protocol === "https:";
212
+ const D = new URL(k);
213
+ return D.protocol === "http:" || D.protocol === "https:";
214
214
  } catch {
215
215
  return !1;
216
216
  }
217
- }, x = () => {
218
- const b = y.trim();
219
- if (s && b === "") {
220
- h(""), u();
217
+ }, y = () => {
218
+ const k = v.trim();
219
+ if (s && k === "") {
220
+ m(""), u();
221
221
  return;
222
222
  }
223
- if (!b) {
224
- r(f("link.urlRequired"));
223
+ if (!k) {
224
+ o(f("link.urlRequired"));
225
225
  return;
226
226
  }
227
- if (!l(b)) {
228
- r(f("link.invalidUrl"));
227
+ if (!l(k)) {
228
+ o(f("link.invalidUrl"));
229
229
  return;
230
230
  }
231
- h(b), u();
232
- }, _ = () => {
233
- h(""), u();
234
- }, V = () => {
231
+ m(k), u();
232
+ }, $ = () => {
233
+ m(""), u();
234
+ }, W = () => {
235
235
  d(), u();
236
236
  };
237
237
  return t ? /* @__PURE__ */ e(
238
238
  "div",
239
239
  {
240
240
  style: { position: "fixed", top: 0, left: 0, right: 0, bottom: 0, zIndex: 9998, background: "transparent" },
241
- onMouseDown: (b) => {
242
- b.target === b.currentTarget && V();
241
+ onMouseDown: (k) => {
242
+ k.target === k.currentTarget && W();
243
243
  },
244
- children: /* @__PURE__ */ v(
244
+ children: /* @__PURE__ */ w(
245
245
  "div",
246
246
  {
247
- className: `tp-link-popover${S ? " is-above" : ""}`,
248
- style: g,
249
- onMouseDown: (b) => b.stopPropagation(),
250
- onKeyDown: (b) => {
251
- b.key === "Enter" ? (b.preventDefault(), x()) : b.key === "Escape" && (b.preventDefault(), V());
247
+ className: `tp-link-popover${H ? " is-above" : ""}`,
248
+ style: i,
249
+ onMouseDown: (k) => k.stopPropagation(),
250
+ onKeyDown: (k) => {
251
+ k.key === "Enter" ? (k.preventDefault(), y()) : k.key === "Escape" && (k.preventDefault(), W());
252
252
  },
253
253
  children: [
254
254
  /* @__PURE__ */ e("div", { className: "tp-popover-arrow" }),
255
- /* @__PURE__ */ v("div", { className: "tp-popover-content", children: [
255
+ /* @__PURE__ */ w("div", { className: "tp-popover-content", children: [
256
256
  /* @__PURE__ */ e("div", { className: "tp-popover-header", children: /* @__PURE__ */ e("span", { className: "tp-popover-title", children: f(s ? "link.editLink" : "link.insertLink") }) }),
257
- /* @__PURE__ */ v("div", { className: "tp-popover-body", children: [
257
+ /* @__PURE__ */ w("div", { className: "tp-popover-body", children: [
258
258
  /* @__PURE__ */ e("label", { className: "tp-popover-label", children: f("link.url") }),
259
- /* @__PURE__ */ v("div", { className: "tp-popover-input-row", children: [
259
+ /* @__PURE__ */ w("div", { className: "tp-popover-input-row", children: [
260
260
  /* @__PURE__ */ e(
261
261
  "input",
262
262
  {
263
263
  ref: T,
264
264
  type: "url",
265
- className: `tp-popover-input${n ? " is-error" : ""}`,
266
- value: y,
265
+ className: `tp-popover-input${g ? " is-error" : ""}`,
266
+ value: v,
267
267
  placeholder: f("link.url"),
268
- onChange: (b) => N(b.target.value),
269
- onKeyDown: (b) => {
270
- b.key === "Enter" ? (b.preventDefault(), x()) : b.key === "Escape" && (b.preventDefault(), V());
268
+ onChange: (k) => L(k.target.value),
269
+ onKeyDown: (k) => {
270
+ k.key === "Enter" ? (k.preventDefault(), y()) : k.key === "Escape" && (k.preventDefault(), W());
271
271
  }
272
272
  }
273
273
  ),
274
- /* @__PURE__ */ e("button", { className: "tp-popover-btn-confirm", onClick: x, children: f("common.confirm") }),
275
- s && /* @__PURE__ */ e("button", { className: "tp-popover-btn-unlink", onClick: _, children: f("link.unlink") })
274
+ /* @__PURE__ */ e("button", { className: "tp-popover-btn-confirm", onClick: y, children: f("common.confirm") }),
275
+ s && /* @__PURE__ */ e("button", { className: "tp-popover-btn-unlink", onClick: $, children: f("link.unlink") })
276
276
  ] }),
277
- n && /* @__PURE__ */ e("div", { className: "tp-link-error-message", children: n })
277
+ g && /* @__PURE__ */ e("div", { className: "tp-link-error-message", children: g })
278
278
  ] })
279
279
  ] })
280
280
  ]
@@ -282,48 +282,48 @@ const bt = ({
282
282
  )
283
283
  }
284
284
  ) : null;
285
- }, xt = "#b4d5fe", kt = ({ def: t, editor: o, active: c, disabled: p, onCustomClick: i }) => {
286
- const { t: s } = fe(), [h, d] = H(!1), u = B(null), f = B(null), y = B(""), N = B(!1), S = (n) => {
287
- var r;
288
- if (n.preventDefault(), t.name === "link") {
289
- const { from: k, to: g } = o.state.selection;
290
- if (k !== g || o.isActive("link")) {
291
- if (u.current = { from: k, to: g }, o.isActive("link")) {
292
- const l = o.state.selection.$head.marks().find((x) => x.type.name === "link");
293
- y.current = ((r = l == null ? void 0 : l.attrs) == null ? void 0 : r.href) || "", N.current = !0;
285
+ }, Bt = "#b4d5fe", Pt = ({ def: t, editor: r, active: a, disabled: h, onCustomClick: c }) => {
286
+ const { t: s } = fe(), [m, d] = A(!1), u = B(null), f = B(null), v = B(""), L = B(!1), H = (g) => {
287
+ var o;
288
+ if (g.preventDefault(), t.name === "link") {
289
+ const { from: x, to: i } = r.state.selection;
290
+ if (x !== i || r.isActive("link")) {
291
+ if (u.current = { from: x, to: i }, r.isActive("link")) {
292
+ const l = r.state.selection.$head.marks().find((y) => y.type.name === "link");
293
+ v.current = ((o = l == null ? void 0 : l.attrs) == null ? void 0 : o.href) || "", L.current = !0;
294
294
  } else
295
- y.current = "", N.current = !1;
296
- if (!o.isActive("link")) {
295
+ v.current = "", L.current = !1;
296
+ if (!r.isActive("link")) {
297
297
  const l = window.getSelection();
298
298
  if (l && l.rangeCount > 0) {
299
- const _ = l.getRangeAt(0).getBoundingClientRect();
300
- _.width > 0 && _.height > 0 && (f.current = _);
299
+ const $ = l.getRangeAt(0).getBoundingClientRect();
300
+ $.width > 0 && $.height > 0 && (f.current = $);
301
301
  }
302
302
  }
303
303
  }
304
304
  }
305
- }, m = () => {
306
- var r, k;
307
- const n = t.name;
308
- if (n === "getHTML" || n === "getJSON" || n === "importWord" || n === "importMarkdown" || n === "exportWord" || n === "exportMarkdown" || n === "snapshot" || n === "compare" || n === "fullscreen" || n === "autoFormat") {
309
- i == null || i(n);
305
+ }, p = () => {
306
+ var o, x;
307
+ const g = t.name;
308
+ if (g === "getHTML" || g === "getJSON" || g === "importWord" || g === "importMarkdown" || g === "exportWord" || g === "exportMarkdown" || g === "snapshot" || g === "compare" || g === "fullscreen" || g === "autoFormat") {
309
+ c == null || c(g);
310
310
  return;
311
311
  }
312
- if (n === "link") {
313
- if (o.isActive("link")) {
312
+ if (g === "link") {
313
+ if (r.isActive("link")) {
314
314
  if (!u.current) {
315
- const { from: l, to: x } = o.state.selection;
316
- u.current = { from: l, to: x };
315
+ const { from: l, to: y } = r.state.selection;
316
+ u.current = { from: l, to: y };
317
317
  }
318
- const g = o.state.selection.$head.marks().find((l) => l.type.name === "link");
319
- if (y.current = ((r = g == null ? void 0 : g.attrs) == null ? void 0 : r.href) || "", N.current = !0, !f.current && u.current)
318
+ const i = r.state.selection.$head.marks().find((l) => l.type.name === "link");
319
+ if (v.current = ((o = i == null ? void 0 : i.attrs) == null ? void 0 : o.href) || "", L.current = !0, !f.current && u.current)
320
320
  try {
321
- const { from: l, to: x } = u.current, _ = o.view.coordsAtPos(l), V = o.view.coordsAtPos(x);
322
- _ && V && (f.current = new DOMRect(
323
- _.left,
324
- _.top,
325
- V.left - _.left,
326
- V.bottom - _.top
321
+ const { from: l, to: y } = u.current, $ = r.view.coordsAtPos(l), W = r.view.coordsAtPos(y);
322
+ $ && W && (f.current = new DOMRect(
323
+ $.left,
324
+ $.top,
325
+ W.left - $.left,
326
+ W.bottom - $.top
327
327
  ));
328
328
  } catch {
329
329
  }
@@ -331,70 +331,70 @@ const bt = ({
331
331
  return;
332
332
  }
333
333
  if (!u.current) {
334
- const { from: g, to: l } = o.state.selection;
335
- if (g === l) return;
336
- u.current = { from: g, to: l };
334
+ const { from: i, to: l } = r.state.selection;
335
+ if (i === l) return;
336
+ u.current = { from: i, to: l };
337
337
  }
338
- if (y.current = "", N.current = !1, !f.current && u.current)
338
+ if (v.current = "", L.current = !1, !f.current && u.current)
339
339
  try {
340
- const { from: g, to: l } = u.current, x = o.view.coordsAtPos(g), _ = o.view.coordsAtPos(l);
341
- x && _ && (f.current = new DOMRect(
342
- x.left,
343
- x.top,
344
- _.left - x.left,
345
- x.bottom - x.top
340
+ const { from: i, to: l } = u.current, y = r.view.coordsAtPos(i), $ = r.view.coordsAtPos(l);
341
+ y && $ && (f.current = new DOMRect(
342
+ y.left,
343
+ y.top,
344
+ $.left - y.left,
345
+ y.bottom - y.top
346
346
  ));
347
347
  } catch {
348
348
  }
349
349
  if (u.current) {
350
- const { from: g, to: l } = u.current;
351
- o.chain().focus().setTextSelection({ from: g, to: l }).setHighlight({ color: xt }).run();
350
+ const { from: i, to: l } = u.current;
351
+ r.chain().focus().setTextSelection({ from: i, to: l }).setHighlight({ color: Bt }).run();
352
352
  }
353
353
  d(!0);
354
354
  return;
355
355
  }
356
- (k = t.command) == null || k.call(t, o);
357
- }, T = (n) => {
356
+ (x = t.command) == null || x.call(t, r);
357
+ }, T = (g) => {
358
358
  if (u.current) {
359
- const { from: r, to: k } = u.current, g = o.chain().focus().setTextSelection({ from: r, to: k }).unsetHighlight();
360
- n ? g.setLink({ href: n }).run() : g.unsetLink().run();
359
+ const { from: o, to: x } = u.current, i = r.chain().focus().setTextSelection({ from: o, to: x }).unsetHighlight();
360
+ g ? i.setLink({ href: g }).run() : i.unsetLink().run();
361
361
  }
362
- u.current = null, f.current = null, y.current = "", N.current = !1;
363
- }, w = () => {
362
+ u.current = null, f.current = null, v.current = "", L.current = !1;
363
+ }, b = () => {
364
364
  if (u.current) {
365
- const { from: n, to: r } = u.current;
366
- o.chain().focus().setTextSelection({ from: n, to: r }).unsetHighlight().run();
365
+ const { from: g, to: o } = u.current;
366
+ r.chain().focus().setTextSelection({ from: g, to: o }).unsetHighlight().run();
367
367
  }
368
- u.current = null, f.current = null, y.current = "", N.current = !1;
368
+ u.current = null, f.current = null, v.current = "", L.current = !1;
369
369
  }, M = t.name === "getHTML" || t.name === "getJSON";
370
- return /* @__PURE__ */ v(Ze, { children: [
370
+ return /* @__PURE__ */ w(nt, { children: [
371
371
  /* @__PURE__ */ e(
372
372
  "button",
373
373
  {
374
- className: `tp-toolbar-btn${c ? " is-active" : ""}${M ? " is-text-btn" : ""}`,
375
- disabled: p,
374
+ className: `tp-toolbar-btn${a ? " is-active" : ""}${M ? " is-text-btn" : ""}`,
375
+ disabled: h,
376
376
  title: s(t.titleKey),
377
- onMouseDown: S,
378
- onClick: m,
379
- children: t.name === "getHTML" ? /* @__PURE__ */ e("span", { className: "tp-toolbar-text", children: "HTML" }) : t.name === "getJSON" ? /* @__PURE__ */ e("span", { className: "tp-toolbar-text", children: "JSON" }) : /* @__PURE__ */ e("span", { className: "tp-toolbar-icon", dangerouslySetInnerHTML: { __html: ke(t.name) } })
377
+ onMouseDown: H,
378
+ onClick: p,
379
+ children: t.name === "getHTML" ? /* @__PURE__ */ e("span", { className: "tp-toolbar-text", children: "HTML" }) : t.name === "getJSON" ? /* @__PURE__ */ e("span", { className: "tp-toolbar-text", children: "JSON" }) : /* @__PURE__ */ e("span", { className: "tp-toolbar-icon", dangerouslySetInnerHTML: { __html: be(t.name) } })
380
380
  }
381
381
  ),
382
382
  /* @__PURE__ */ e(
383
- bt,
383
+ _t,
384
384
  {
385
- visible: h,
385
+ visible: m,
386
386
  targetRect: f.current,
387
- editor: o,
387
+ editor: r,
388
388
  savedSelection: u.current,
389
- initialUrl: y.current,
390
- isEditing: N.current,
389
+ initialUrl: v.current,
390
+ isEditing: L.current,
391
391
  onConfirm: T,
392
- onCancel: w,
392
+ onCancel: b,
393
393
  onClose: () => d(!1)
394
394
  }
395
395
  )
396
396
  ] });
397
- }, nt = {
397
+ }, st = {
398
398
  SimSun: ["SimSun", "宋体"],
399
399
  宋体: ["SimSun", "宋体"],
400
400
  "Microsoft YaHei": ["Microsoft YaHei", "微软雅黑"],
@@ -403,63 +403,63 @@ const bt = ({
403
403
  黑体: ["SimHei", "黑体"],
404
404
  KaiTi: ["KaiTi", "楷体"],
405
405
  楷体: ["KaiTi", "楷体"]
406
- }, Ct = ({ def: t, editor: o, active: c, disabled: p, onCustomClick: i }) => {
406
+ }, It = ({ def: t, editor: r, active: a, disabled: h, onCustomClick: c }) => {
407
407
  var M;
408
- const { t: s } = fe(), [h, d] = H(!1), [u, f] = H(0), y = B(null), N = Te(() => {
409
- var n;
410
- return (n = t.getCurrentValue) == null ? void 0 : n.call(t, o);
411
- }, [u, t, o]), S = (n) => {
412
- const r = String(N), k = String(n);
408
+ const { t: s } = fe(), [m, d] = A(!1), [u, f] = A(0), v = B(null), L = Me(() => {
409
+ var g;
410
+ return (g = t.getCurrentValue) == null ? void 0 : g.call(t, r);
411
+ }, [u, t, r]), H = (g) => {
412
+ const o = String(L), x = String(g);
413
413
  if (t.name === "fontFamily") {
414
- const g = nt[r], l = nt[k];
415
- if (g) return g.includes(k);
416
- if (l) return l.includes(r);
414
+ const i = st[o], l = st[x];
415
+ if (i) return i.includes(x);
416
+ if (l) return l.includes(o);
417
417
  }
418
- return r === k;
419
- }, m = (n) => {
420
- const r = Number(n);
421
- return r === 0 ? "tp-heading-preview-paragraph" : r >= 1 && r <= 6 ? `tp-heading-preview-h${r}` : "";
418
+ return o === x;
419
+ }, p = (g) => {
420
+ const o = Number(g);
421
+ return o === 0 ? "tp-heading-preview-paragraph" : o >= 1 && o <= 6 ? `tp-heading-preview-h${o}` : "";
422
422
  }, T = () => {
423
- p || (d(!h), h || f((n) => n + 1));
424
- }, w = (n) => {
425
- var r;
426
- t.isActionMenu ? i == null || i(String(n)) : (r = t.command) == null || r.call(t, o, n), d(!1);
423
+ h || (d(!m), m || f((g) => g + 1));
424
+ }, b = (g) => {
425
+ var o;
426
+ t.isActionMenu ? c == null || c(String(g)) : (o = t.command) == null || o.call(t, r, g), d(!1);
427
427
  };
428
- return K(() => {
429
- const n = (k) => {
430
- y.current && !y.current.contains(k.target) && d(!1);
431
- }, r = () => f((k) => k + 1);
432
- return document.addEventListener("pointerdown", n), o.on("transaction", r), () => {
433
- document.removeEventListener("pointerdown", n), o.off("transaction", r);
428
+ return z(() => {
429
+ const g = (x) => {
430
+ v.current && !v.current.contains(x.target) && d(!1);
431
+ }, o = () => f((x) => x + 1);
432
+ return document.addEventListener("pointerdown", g), r.on("transaction", o), () => {
433
+ document.removeEventListener("pointerdown", g), r.off("transaction", o);
434
434
  };
435
- }, [o]), /* @__PURE__ */ v("div", { ref: y, className: "tp-toolbar-dropdown", children: [
436
- /* @__PURE__ */ v(
435
+ }, [r]), /* @__PURE__ */ w("div", { ref: v, className: "tp-toolbar-dropdown", children: [
436
+ /* @__PURE__ */ w(
437
437
  "button",
438
438
  {
439
- className: `tp-toolbar-dropdown-trigger${c ? " is-active" : ""}${p ? " is-disabled" : ""}`,
439
+ className: `tp-toolbar-dropdown-trigger${a ? " is-active" : ""}${h ? " is-disabled" : ""}`,
440
440
  title: s(t.tooltipKey || t.titleKey),
441
- disabled: p,
442
- onMouseDown: (n) => n.preventDefault(),
441
+ disabled: h,
442
+ onMouseDown: (g) => g.preventDefault(),
443
443
  onClick: T,
444
444
  children: [
445
- /* @__PURE__ */ e("span", { className: "tp-toolbar-icon", dangerouslySetInnerHTML: { __html: ke(t.name) } }),
445
+ /* @__PURE__ */ e("span", { className: "tp-toolbar-icon", dangerouslySetInnerHTML: { __html: be(t.name) } }),
446
446
  !t.hideLabel && /* @__PURE__ */ e("span", { className: "tp-toolbar-dropdown-label", children: s(t.titleKey) }),
447
447
  /* @__PURE__ */ e("span", { className: "tp-toolbar-dropdown-arrow", children: "▾" })
448
448
  ]
449
449
  }
450
450
  ),
451
- h && /* @__PURE__ */ e("div", { className: "tp-toolbar-dropdown-menu", children: (M = t.options) == null ? void 0 : M.map((n) => /* @__PURE__ */ e(
451
+ m && /* @__PURE__ */ e("div", { className: "tp-toolbar-dropdown-menu", children: (M = t.options) == null ? void 0 : M.map((g) => /* @__PURE__ */ e(
452
452
  "button",
453
453
  {
454
- className: `tp-toolbar-dropdown-item${S(n.value) ? " is-active" : ""}${t.name === "heading" ? " " + m(n.value) : ""}`,
455
- onMouseDown: (r) => r.preventDefault(),
456
- onClick: () => w(n.value),
457
- children: n.labelKey ? s(n.labelKey) : n.label
454
+ className: `tp-toolbar-dropdown-item${H(g.value) ? " is-active" : ""}${t.name === "heading" ? " " + p(g.value) : ""}`,
455
+ onMouseDown: (o) => o.preventDefault(),
456
+ onClick: () => b(g.value),
457
+ children: g.labelKey ? s(g.labelKey) : g.label
458
458
  },
459
- String(n.value)
459
+ String(g.value)
460
460
  )) })
461
461
  ] });
462
- }, Nt = [
462
+ }, Ft = [
463
463
  "#ffffff",
464
464
  "#f3f3f3",
465
465
  "#fce5cd",
@@ -520,44 +520,44 @@ const bt = ({
520
520
  "#20124d",
521
521
  "#073763",
522
522
  "#7f6000"
523
- ], Mt = ["#ff0000", "#ff5e00", "#ff9900", "#ffff00", "#00ff00", "#00a8a8", "#00ffff", "#0000ff", "#5f00ff", "#9900ff"], Lt = ({ def: t, editor: o, disabled: c }) => {
524
- const { t: p } = fe(), [i, s] = H(!1), h = B(null), [d, u] = H(""), [f, y] = H(""), N = t.name === "color", S = N ? d : f, m = () => {
525
- const M = o.getAttributes("textStyle");
523
+ ], Ot = ["#ff0000", "#ff5e00", "#ff9900", "#ffff00", "#00ff00", "#00a8a8", "#00ffff", "#0000ff", "#5f00ff", "#9900ff"], Wt = ({ def: t, editor: r, disabled: a }) => {
524
+ const { t: h } = fe(), [c, s] = A(!1), m = B(null), [d, u] = A(""), [f, v] = A(""), L = t.name === "color", H = L ? d : f, p = () => {
525
+ const M = r.getAttributes("textStyle");
526
526
  u((M == null ? void 0 : M.color) || "");
527
- const n = o.getAttributes("highlight");
528
- y((n == null ? void 0 : n.color) || "");
527
+ const g = r.getAttributes("highlight");
528
+ v((g == null ? void 0 : g.color) || "");
529
529
  };
530
- K(() => {
531
- const M = (n) => {
532
- h.current && !h.current.contains(n.target) && s(!1);
530
+ z(() => {
531
+ const M = (g) => {
532
+ m.current && !m.current.contains(g.target) && s(!1);
533
533
  };
534
- return document.addEventListener("pointerdown", M), o.on("transaction", m), o.on("selectionUpdate", m), m(), () => {
535
- document.removeEventListener("pointerdown", M), o.off("transaction", m), o.off("selectionUpdate", m);
534
+ return document.addEventListener("pointerdown", M), r.on("transaction", p), r.on("selectionUpdate", p), p(), () => {
535
+ document.removeEventListener("pointerdown", M), r.off("transaction", p), r.off("selectionUpdate", p);
536
536
  };
537
- }, [o]);
537
+ }, [r]);
538
538
  const T = (M) => {
539
- var n;
540
- (n = t.command) == null || n.call(t, o, M), setTimeout(m, 0), s(!1);
541
- }, w = () => {
539
+ var g;
540
+ (g = t.command) == null || g.call(t, r, M), setTimeout(p, 0), s(!1);
541
+ }, b = () => {
542
542
  var M;
543
- (M = t.command) == null || M.call(t, o, void 0), y(""), s(!1);
543
+ (M = t.command) == null || M.call(t, r, void 0), v(""), s(!1);
544
544
  };
545
- return /* @__PURE__ */ v("div", { ref: h, className: "tp-toolbar-dropdown", children: [
546
- /* @__PURE__ */ v(
545
+ return /* @__PURE__ */ w("div", { ref: m, className: "tp-toolbar-dropdown", children: [
546
+ /* @__PURE__ */ w(
547
547
  "button",
548
548
  {
549
- className: `tp-toolbar-dropdown-trigger${c ? " is-disabled" : ""}`,
550
- title: p(t.titleKey),
551
- disabled: c,
549
+ className: `tp-toolbar-dropdown-trigger${a ? " is-disabled" : ""}`,
550
+ title: h(t.titleKey),
551
+ disabled: a,
552
552
  onMouseDown: (M) => M.preventDefault(),
553
553
  onClick: () => {
554
- c || s(!i);
554
+ a || s(!c);
555
555
  },
556
556
  children: [
557
- /* @__PURE__ */ e("span", { className: N ? "tp-color-picker-icon" : "tp-bgcolor-picker-icon", children: N ? /* @__PURE__ */ v("svg", { xmlns: "http://www.w3.org/2000/svg", width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
557
+ /* @__PURE__ */ e("span", { className: L ? "tp-color-picker-icon" : "tp-bgcolor-picker-icon", children: L ? /* @__PURE__ */ w("svg", { xmlns: "http://www.w3.org/2000/svg", width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
558
558
  /* @__PURE__ */ e("text", { x: "4", y: "17", fontSize: "24", fill: "currentColor", stroke: "none", fontFamily: "serif", fontWeight: "bold", children: "A" }),
559
559
  /* @__PURE__ */ e("line", { x1: "4", y1: "22", x2: "20", y2: "22", strokeWidth: "5", stroke: d || "#000000" })
560
- ] }) : /* @__PURE__ */ v("svg", { xmlns: "http://www.w3.org/2000/svg", width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
560
+ ] }) : /* @__PURE__ */ w("svg", { xmlns: "http://www.w3.org/2000/svg", width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
561
561
  /* @__PURE__ */ e("rect", { x: "3", y: "3", width: "18", height: "18", rx: "2", fill: f || "transparent" }),
562
562
  /* @__PURE__ */ e("rect", { x: "3", y: "3", width: "18", height: "18", rx: "2" }),
563
563
  /* @__PURE__ */ e("text", { x: "6", y: "17", fontSize: "16", fill: "currentColor", stroke: "none", fontFamily: "serif", fontWeight: "bold", children: "A" })
@@ -566,118 +566,118 @@ const bt = ({
566
566
  ]
567
567
  }
568
568
  ),
569
- i && /* @__PURE__ */ v("div", { className: "tp-color-picker-panel", children: [
570
- /* @__PURE__ */ e("button", { className: "tp-color-default-btn", onMouseDown: (M) => M.preventDefault(), onClick: w, children: p("common.default") }),
571
- /* @__PURE__ */ e("div", { className: "tp-color-grid tp-theme-colors", children: Nt.map((M, n) => /* @__PURE__ */ e(
569
+ c && /* @__PURE__ */ w("div", { className: "tp-color-picker-panel", children: [
570
+ /* @__PURE__ */ e("button", { className: "tp-color-default-btn", onMouseDown: (M) => M.preventDefault(), onClick: b, children: h("common.default") }),
571
+ /* @__PURE__ */ e("div", { className: "tp-color-grid tp-theme-colors", children: Ft.map((M, g) => /* @__PURE__ */ e(
572
572
  "button",
573
573
  {
574
- className: `tp-color-swatch${S === M ? " tp-color-swatch-selected" : ""}`,
574
+ className: `tp-color-swatch${H === M ? " tp-color-swatch-selected" : ""}`,
575
575
  style: { backgroundColor: M },
576
576
  title: M,
577
- onMouseDown: (r) => r.preventDefault(),
577
+ onMouseDown: (o) => o.preventDefault(),
578
578
  onClick: () => T(M)
579
579
  },
580
- `theme-${n}`
580
+ `theme-${g}`
581
581
  )) }),
582
- /* @__PURE__ */ e("div", { className: "tp-color-section-label", children: p("common.standardColor") }),
583
- /* @__PURE__ */ e("div", { className: "tp-color-grid tp-standard-colors", children: Mt.map((M, n) => /* @__PURE__ */ e(
582
+ /* @__PURE__ */ e("div", { className: "tp-color-section-label", children: h("common.standardColor") }),
583
+ /* @__PURE__ */ e("div", { className: "tp-color-grid tp-standard-colors", children: Ot.map((M, g) => /* @__PURE__ */ e(
584
584
  "button",
585
585
  {
586
- className: `tp-color-swatch${S === M ? " tp-color-swatch-selected" : ""}`,
586
+ className: `tp-color-swatch${H === M ? " tp-color-swatch-selected" : ""}`,
587
587
  style: { backgroundColor: M },
588
588
  title: M,
589
- onMouseDown: (r) => r.preventDefault(),
589
+ onMouseDown: (o) => o.preventDefault(),
590
590
  onClick: () => T(M)
591
591
  },
592
- `std-${n}`
592
+ `std-${g}`
593
593
  )) })
594
594
  ] })
595
595
  ] });
596
- }, ot = () => /* @__PURE__ */ e("div", { className: "tp-toolbar-separator" }), Tt = ({
596
+ }, it = () => /* @__PURE__ */ e("div", { className: "tp-toolbar-separator" }), jt = ({
597
597
  visible: t,
598
- editor: o,
599
- uploadUrl: c,
600
- uploadHeaders: p,
601
- onUpload: i,
598
+ editor: r,
599
+ uploadUrl: a,
600
+ uploadHeaders: h,
601
+ onUpload: c,
602
602
  initialTab: s,
603
- onClose: h
603
+ onClose: m
604
604
  }) => {
605
- const { t: d } = fe(), [u, f] = H(s || "upload"), [y, N] = H(""), [S, m] = H(!1), [T, w] = H(!1), [M, n] = H(0), [r, k] = H(""), g = B(null);
606
- K(() => (t ? (N(""), k(""), f(s || "upload"), n(0), document.body.style.overflow = "hidden") : document.body.style.overflow = "", () => {
605
+ const { t: d } = fe(), [u, f] = A(s || "upload"), [v, L] = A(""), [H, p] = A(!1), [T, b] = A(!1), [M, g] = A(0), [o, x] = A(""), i = B(null);
606
+ z(() => (t ? (L(""), x(""), f(s || "upload"), g(0), document.body.style.overflow = "hidden") : document.body.style.overflow = "", () => {
607
607
  document.body.style.overflow = "";
608
608
  }), [t, s]);
609
- const l = (b) => new Promise((E, $) => {
609
+ const l = (k) => new Promise((D, E) => {
610
610
  const P = new FileReader();
611
- P.onload = () => E(P.result), P.onerror = $, P.readAsDataURL(b);
612
- }), x = (b) => {
613
- o.chain().focus().setImage({ src: b }).run();
614
- }, _ = async (b) => {
615
- w(!0), n(0), k("");
611
+ P.onload = () => D(P.result), P.onerror = E, P.readAsDataURL(k);
612
+ }), y = (k) => {
613
+ r.chain().focus().setImage({ src: k }).run();
614
+ }, $ = async (k) => {
615
+ b(!0), g(0), x("");
616
616
  try {
617
- let E;
618
- i ? E = await i(b) : c ? E = await ut(b, { url: c, headers: p, onProgress: n }) : E = await l(b), x(E), h();
619
- } catch (E) {
620
- k(E instanceof Error ? E.message : d("imageUpload.uploadFailed"));
617
+ let D;
618
+ c ? D = await c(k) : a ? D = await gt(k, { url: a, headers: h, onProgress: g }) : D = await l(k), y(D), m();
619
+ } catch (D) {
620
+ x(D instanceof Error ? D.message : d("imageUpload.uploadFailed"));
621
621
  } finally {
622
- w(!1), n(0);
622
+ b(!1), g(0);
623
623
  }
624
- }, V = () => {
625
- const b = y.trim();
626
- if (!b) {
627
- k(d("imageUpload.urlRequired"));
624
+ }, W = () => {
625
+ const k = v.trim();
626
+ if (!k) {
627
+ x(d("imageUpload.urlRequired"));
628
628
  return;
629
629
  }
630
630
  try {
631
- new URL(b);
631
+ new URL(k);
632
632
  } catch {
633
- k(d("imageUpload.invalidUrl"));
633
+ x(d("imageUpload.invalidUrl"));
634
634
  return;
635
635
  }
636
- x(b), h();
636
+ y(k), m();
637
637
  };
638
- return t ? /* @__PURE__ */ e("div", { className: "tp-image-upload-overlay", onMouseDown: (b) => {
639
- b.target === b.currentTarget && h();
640
- }, children: /* @__PURE__ */ v("div", { className: "tp-image-upload-dialog", onMouseDown: (b) => b.stopPropagation(), children: [
641
- /* @__PURE__ */ v("div", { className: "tp-dialog-header", children: [
638
+ return t ? /* @__PURE__ */ e("div", { className: "tp-image-upload-overlay", onMouseDown: (k) => {
639
+ k.target === k.currentTarget && m();
640
+ }, children: /* @__PURE__ */ w("div", { className: "tp-image-upload-dialog", onMouseDown: (k) => k.stopPropagation(), children: [
641
+ /* @__PURE__ */ w("div", { className: "tp-dialog-header", children: [
642
642
  /* @__PURE__ */ e("span", { className: "tp-dialog-title", children: d("image.upload") }),
643
- /* @__PURE__ */ e("button", { className: "tp-dialog-close", onClick: h, children: "×" })
643
+ /* @__PURE__ */ e("button", { className: "tp-dialog-close", onClick: m, children: "×" })
644
644
  ] }),
645
- /* @__PURE__ */ v("div", { className: "tp-dialog-tabs", children: [
645
+ /* @__PURE__ */ w("div", { className: "tp-dialog-tabs", children: [
646
646
  /* @__PURE__ */ e("button", { className: `tp-tab-btn${u === "upload" ? " is-active" : ""}`, onClick: () => f("upload"), children: d("imageUpload.uploadLocal") }),
647
647
  /* @__PURE__ */ e("button", { className: `tp-tab-btn${u === "url" ? " is-active" : ""}`, onClick: () => f("url"), children: d("imageUpload.inputUrl") })
648
648
  ] }),
649
- /* @__PURE__ */ v("div", { className: "tp-dialog-body", children: [
650
- u === "upload" && /* @__PURE__ */ v("div", { className: "tp-upload-tab", children: [
649
+ /* @__PURE__ */ w("div", { className: "tp-dialog-body", children: [
650
+ u === "upload" && /* @__PURE__ */ w("div", { className: "tp-upload-tab", children: [
651
651
  /* @__PURE__ */ e(
652
652
  "div",
653
653
  {
654
- className: `tp-dropzone${S ? " is-dragging" : ""}${T ? " is-uploading" : ""}`,
655
- onDragEnter: (b) => {
656
- b.preventDefault(), m(!0);
654
+ className: `tp-dropzone${H ? " is-dragging" : ""}${T ? " is-uploading" : ""}`,
655
+ onDragEnter: (k) => {
656
+ k.preventDefault(), p(!0);
657
657
  },
658
- onDragLeave: (b) => {
659
- b.preventDefault(), m(!1);
658
+ onDragLeave: (k) => {
659
+ k.preventDefault(), p(!1);
660
660
  },
661
- onDragOver: (b) => b.preventDefault(),
662
- onDrop: (b) => {
663
- var $, P;
664
- b.preventDefault(), m(!1);
665
- const E = (P = ($ = b.dataTransfer) == null ? void 0 : $.files) == null ? void 0 : P[0];
666
- E != null && E.type.startsWith("image/") ? _(E) : k(d("imageUpload.invalidType"));
661
+ onDragOver: (k) => k.preventDefault(),
662
+ onDrop: (k) => {
663
+ var E, P;
664
+ k.preventDefault(), p(!1);
665
+ const D = (P = (E = k.dataTransfer) == null ? void 0 : E.files) == null ? void 0 : P[0];
666
+ D != null && D.type.startsWith("image/") ? $(D) : x(d("imageUpload.invalidType"));
667
667
  },
668
668
  onClick: () => {
669
- var b;
670
- return (b = g.current) == null ? void 0 : b.click();
669
+ var k;
670
+ return (k = i.current) == null ? void 0 : k.click();
671
671
  },
672
- children: T ? /* @__PURE__ */ v("div", { className: "tp-upload-progress", children: [
672
+ children: T ? /* @__PURE__ */ w("div", { className: "tp-upload-progress", children: [
673
673
  /* @__PURE__ */ e("div", { className: "tp-progress-bar", children: /* @__PURE__ */ e("div", { className: "tp-progress-fill", style: { width: M + "%" } }) }),
674
- /* @__PURE__ */ v("span", { className: "tp-progress-text", children: [
674
+ /* @__PURE__ */ w("span", { className: "tp-progress-text", children: [
675
675
  d("imageUpload.uploading"),
676
676
  " ",
677
677
  M,
678
678
  "%"
679
679
  ] })
680
- ] }) : /* @__PURE__ */ v("div", { className: "tp-dropzone-content", children: [
680
+ ] }) : /* @__PURE__ */ w("div", { className: "tp-dropzone-content", children: [
681
681
  /* @__PURE__ */ e("span", { className: "tp-dropzone-icon", children: "📁" }),
682
682
  /* @__PURE__ */ e("span", { className: "tp-dropzone-text", children: d("imageUpload.selectFile") }),
683
683
  /* @__PURE__ */ e("span", { className: "tp-dropzone-hint", children: d("imageUpload.dragHint") })
@@ -687,142 +687,142 @@ const bt = ({
687
687
  /* @__PURE__ */ e(
688
688
  "input",
689
689
  {
690
- ref: g,
690
+ ref: i,
691
691
  type: "file",
692
692
  accept: "image/*",
693
693
  style: { display: "none" },
694
- onChange: (b) => {
695
- var $;
696
- const E = ($ = b.target.files) == null ? void 0 : $[0];
697
- E && _(E), b.target.value = "";
694
+ onChange: (k) => {
695
+ var E;
696
+ const D = (E = k.target.files) == null ? void 0 : E[0];
697
+ D && $(D), k.target.value = "";
698
698
  }
699
699
  }
700
700
  )
701
701
  ] }),
702
- u === "url" && /* @__PURE__ */ v("div", { className: "tp-url-tab", children: [
702
+ u === "url" && /* @__PURE__ */ w("div", { className: "tp-url-tab", children: [
703
703
  /* @__PURE__ */ e("label", { className: "tp-input-label", children: d("imageUpload.url") }),
704
- /* @__PURE__ */ v("div", { className: "tp-input-row", children: [
704
+ /* @__PURE__ */ w("div", { className: "tp-input-row", children: [
705
705
  /* @__PURE__ */ e(
706
706
  "input",
707
707
  {
708
708
  className: "tp-url-input",
709
709
  type: "url",
710
- value: y,
710
+ value: v,
711
711
  placeholder: d("imageUpload.placeholder"),
712
- onChange: (b) => N(b.target.value),
713
- onKeyDown: (b) => {
714
- b.key === "Enter" && V(), b.key === "Escape" && h();
712
+ onChange: (k) => L(k.target.value),
713
+ onKeyDown: (k) => {
714
+ k.key === "Enter" && W(), k.key === "Escape" && m();
715
715
  }
716
716
  }
717
717
  ),
718
- /* @__PURE__ */ e("button", { className: "tp-confirm-btn", onClick: V, children: d("common.confirm") })
718
+ /* @__PURE__ */ e("button", { className: "tp-confirm-btn", onClick: W, children: d("common.confirm") })
719
719
  ] })
720
720
  ] }),
721
- r && /* @__PURE__ */ e("div", { className: "tp-error-message", children: r })
721
+ o && /* @__PURE__ */ e("div", { className: "tp-error-message", children: o })
722
722
  ] })
723
723
  ] }) }) : null;
724
- }, Dt = ({ def: t, editor: o, manager: c, active: p, disabled: i }) => {
725
- var n, r, k, g;
726
- const { t: s } = fe(), [h, d] = H(!1), [u, f] = H(!1), [y, N] = H("upload"), S = B(null), m = (n = c == null ? void 0 : c.getConfig().upload) == null ? void 0 : n.url, T = (r = c == null ? void 0 : c.getConfig().upload) == null ? void 0 : r.headers, w = (k = c == null ? void 0 : c.getConfig().upload) == null ? void 0 : k.onUpload;
727
- K(() => {
728
- const l = (x) => {
729
- S.current && !S.current.contains(x.target) && d(!1);
724
+ }, Ut = ({ def: t, editor: r, manager: a, active: h, disabled: c }) => {
725
+ var g, o, x, i;
726
+ const { t: s } = fe(), [m, d] = A(!1), [u, f] = A(!1), [v, L] = A("upload"), H = B(null), p = (g = a == null ? void 0 : a.getConfig().upload) == null ? void 0 : g.url, T = (o = a == null ? void 0 : a.getConfig().upload) == null ? void 0 : o.headers, b = (x = a == null ? void 0 : a.getConfig().upload) == null ? void 0 : x.onUpload;
727
+ z(() => {
728
+ const l = (y) => {
729
+ H.current && !H.current.contains(y.target) && d(!1);
730
730
  };
731
731
  return document.addEventListener("pointerdown", l), () => document.removeEventListener("pointerdown", l);
732
732
  }, []);
733
733
  const M = (l) => {
734
- d(!1), l === "upload" ? (N("upload"), f(!0)) : l === "url" && (N("url"), f(!0));
734
+ d(!1), l === "upload" ? (L("upload"), f(!0)) : l === "url" && (L("url"), f(!0));
735
735
  };
736
- return /* @__PURE__ */ v("div", { ref: S, className: "tp-toolbar-dropdown", children: [
737
- /* @__PURE__ */ v(
736
+ return /* @__PURE__ */ w("div", { ref: H, className: "tp-toolbar-dropdown", children: [
737
+ /* @__PURE__ */ w(
738
738
  "button",
739
739
  {
740
- className: `tp-toolbar-dropdown-trigger${p ? " is-active" : ""}${i ? " is-disabled" : ""}`,
740
+ className: `tp-toolbar-dropdown-trigger${h ? " is-active" : ""}${c ? " is-disabled" : ""}`,
741
741
  title: s(t.titleKey),
742
- disabled: i,
742
+ disabled: c,
743
743
  onMouseDown: (l) => l.preventDefault(),
744
744
  onClick: () => {
745
- i || d(!h);
745
+ c || d(!m);
746
746
  },
747
747
  children: [
748
- /* @__PURE__ */ e("span", { className: "tp-toolbar-icon", dangerouslySetInnerHTML: { __html: ke(t.name) } }),
748
+ /* @__PURE__ */ e("span", { className: "tp-toolbar-icon", dangerouslySetInnerHTML: { __html: be(t.name) } }),
749
749
  /* @__PURE__ */ e("span", { className: "tp-toolbar-dropdown-arrow", children: "▾" })
750
750
  ]
751
751
  }
752
752
  ),
753
- h && /* @__PURE__ */ e("div", { className: "tp-toolbar-dropdown-menu", children: (g = t.options) == null ? void 0 : g.map((l) => /* @__PURE__ */ e(
753
+ m && /* @__PURE__ */ e("div", { className: "tp-toolbar-dropdown-menu", children: (i = t.options) == null ? void 0 : i.map((l) => /* @__PURE__ */ e(
754
754
  "button",
755
755
  {
756
756
  className: "tp-toolbar-dropdown-item",
757
- onMouseDown: (x) => x.preventDefault(),
757
+ onMouseDown: (y) => y.preventDefault(),
758
758
  onClick: () => M(l.value),
759
759
  children: l.labelKey ? s(l.labelKey) : l.label
760
760
  },
761
761
  String(l.value)
762
762
  )) }),
763
763
  /* @__PURE__ */ e(
764
- Tt,
764
+ jt,
765
765
  {
766
766
  visible: u,
767
- editor: o,
768
- uploadUrl: m,
767
+ editor: r,
768
+ uploadUrl: p,
769
769
  uploadHeaders: T,
770
- onUpload: w,
771
- initialTab: y,
770
+ onUpload: b,
771
+ initialTab: v,
772
772
  onClose: () => f(!1)
773
773
  }
774
774
  )
775
775
  ] });
776
- }, St = ({ visible: t, editor: o, onSuccess: c, onCancel: p, onClose: i }) => {
777
- const { t: s } = fe(), [h, d] = H(""), [u, f] = H(""), y = B(null);
778
- K(() => (t ? (d(""), f(""), document.body.style.overflow = "hidden", setTimeout(() => {
779
- var w;
780
- return (w = y.current) == null ? void 0 : w.focus();
776
+ }, zt = ({ visible: t, editor: r, onSuccess: a, onCancel: h, onClose: c }) => {
777
+ const { t: s } = fe(), [m, d] = A(""), [u, f] = A(""), v = B(null);
778
+ z(() => (t ? (d(""), f(""), document.body.style.overflow = "hidden", setTimeout(() => {
779
+ var b;
780
+ return (b = v.current) == null ? void 0 : b.focus();
781
781
  }, 100)) : document.body.style.overflow = "", () => {
782
782
  document.body.style.overflow = "";
783
783
  }), [t]);
784
- const N = A(() => {
785
- const w = h.trim();
786
- if (!w) {
784
+ const L = S(() => {
785
+ const b = m.trim();
786
+ if (!b) {
787
787
  f(s("video.urlRequired"));
788
788
  return;
789
789
  }
790
790
  try {
791
- new URL(w);
791
+ new URL(b);
792
792
  } catch {
793
793
  f(s("video.invalidUrl"));
794
794
  return;
795
795
  }
796
- o.chain().focus().setVideo({ src: w }).run(), c == null || c(w), i();
797
- }, [h, o, s, c, i]), S = A(() => {
798
- p == null || p(), i();
799
- }, [p, i]), m = A((w) => {
800
- w.target === w.currentTarget && S();
801
- }, [S]), T = A((w) => {
802
- w.key === "Enter" ? (w.preventDefault(), N()) : w.key === "Escape" && (w.preventDefault(), S());
803
- }, [N, S]);
796
+ r.chain().focus().setVideo({ src: b }).run(), a == null || a(b), c();
797
+ }, [m, r, s, a, c]), H = S(() => {
798
+ h == null || h(), c();
799
+ }, [h, c]), p = S((b) => {
800
+ b.target === b.currentTarget && H();
801
+ }, [H]), T = S((b) => {
802
+ b.key === "Enter" ? (b.preventDefault(), L()) : b.key === "Escape" && (b.preventDefault(), H());
803
+ }, [L, H]);
804
804
  return t ? _e(
805
- /* @__PURE__ */ e("div", { className: "tp-video-dialog-overlay", onMouseDown: m, children: /* @__PURE__ */ v("div", { className: "tp-video-dialog", onMouseDown: (w) => w.stopPropagation(), onKeyDown: T, children: [
806
- /* @__PURE__ */ v("div", { className: "tp-dialog-header", children: [
805
+ /* @__PURE__ */ e("div", { className: "tp-video-dialog-overlay", onMouseDown: p, children: /* @__PURE__ */ w("div", { className: "tp-video-dialog", onMouseDown: (b) => b.stopPropagation(), onKeyDown: T, children: [
806
+ /* @__PURE__ */ w("div", { className: "tp-dialog-header", children: [
807
807
  /* @__PURE__ */ e("span", { className: "tp-dialog-title", children: s("video.title") }),
808
- /* @__PURE__ */ e("button", { className: "tp-dialog-close", onClick: S, children: "×" })
808
+ /* @__PURE__ */ e("button", { className: "tp-dialog-close", onClick: H, children: "×" })
809
809
  ] }),
810
- /* @__PURE__ */ v("div", { className: "tp-dialog-body", children: [
810
+ /* @__PURE__ */ w("div", { className: "tp-dialog-body", children: [
811
811
  /* @__PURE__ */ e("label", { className: "tp-input-label", children: s("video.url") }),
812
- /* @__PURE__ */ v("div", { className: "tp-input-row", children: [
812
+ /* @__PURE__ */ w("div", { className: "tp-input-row", children: [
813
813
  /* @__PURE__ */ e(
814
814
  "input",
815
815
  {
816
- ref: y,
816
+ ref: v,
817
817
  type: "url",
818
818
  className: "tp-url-input",
819
819
  placeholder: s("video.placeholder"),
820
- value: h,
821
- onChange: (w) => d(w.target.value),
820
+ value: m,
821
+ onChange: (b) => d(b.target.value),
822
822
  onKeyDown: T
823
823
  }
824
824
  ),
825
- /* @__PURE__ */ e("button", { className: "tp-confirm-btn", onClick: N, children: s("common.confirm") })
825
+ /* @__PURE__ */ e("button", { className: "tp-confirm-btn", onClick: L, children: s("common.confirm") })
826
826
  ] }),
827
827
  /* @__PURE__ */ e("p", { className: "tp-hint", children: s("video.hint") }),
828
828
  u && /* @__PURE__ */ e("div", { className: "tp-error-message", children: u })
@@ -830,558 +830,571 @@ const bt = ({
830
830
  ] }) }),
831
831
  document.body
832
832
  ) : null;
833
- }, At = ({ def: t, editor: o, active: c, disabled: p }) => {
834
- const { t: i } = fe(), [s, h] = H(!1), d = () => {
835
- p || h(!0);
833
+ }, Kt = ({ def: t, editor: r, active: a, disabled: h }) => {
834
+ const { t: c } = fe(), [s, m] = A(!1), d = () => {
835
+ h || m(!0);
836
836
  };
837
- return /* @__PURE__ */ v("div", { className: "tp-toolbar-video-btn", children: [
837
+ return /* @__PURE__ */ w("div", { className: "tp-toolbar-video-btn", children: [
838
838
  /* @__PURE__ */ e(
839
839
  "button",
840
840
  {
841
- className: `tp-toolbar-btn${c ? " is-active" : ""}${p ? " is-disabled" : ""}`,
842
- title: i(t.titleKey),
843
- disabled: p,
841
+ className: `tp-toolbar-btn${a ? " is-active" : ""}${h ? " is-disabled" : ""}`,
842
+ title: c(t.titleKey),
843
+ disabled: h,
844
844
  onMouseDown: (u) => u.preventDefault(),
845
845
  onClick: d,
846
- children: /* @__PURE__ */ e("span", { className: "tp-toolbar-icon", dangerouslySetInnerHTML: { __html: ke(t.name) } })
846
+ children: /* @__PURE__ */ e("span", { className: "tp-toolbar-icon", dangerouslySetInnerHTML: { __html: be(t.name) } })
847
847
  }
848
848
  ),
849
849
  /* @__PURE__ */ e(
850
- St,
850
+ zt,
851
851
  {
852
852
  visible: s,
853
- editor: o,
853
+ editor: r,
854
854
  onSuccess: () => {
855
855
  },
856
- onClose: () => h(!1)
856
+ onClose: () => m(!1)
857
857
  }
858
858
  )
859
859
  ] });
860
- }, Ht = 10, Et = 10, Rt = ({ def: t, editor: o, active: c, disabled: p }) => {
861
- const { t: i } = fe(), [s, h] = H(!1), [d, u] = H({ row: 0, col: 0 }), f = B(null), y = () => {
862
- p || (h(!s), u({ row: 0, col: 0 }));
863
- }, N = (m, T) => {
864
- u({ row: m, col: T });
865
- }, S = (m, T) => {
866
- o.chain().focus().insertTable({ rows: m, cols: T, withHeaderRow: !0 }).run(), h(!1), u({ row: 0, col: 0 });
860
+ }, Vt = 10, Jt = 10, qt = ({ def: t, editor: r, active: a, disabled: h }) => {
861
+ const { t: c } = fe(), [s, m] = A(!1), [d, u] = A({ row: 0, col: 0 }), f = B(null), v = () => {
862
+ h || (m(!s), u({ row: 0, col: 0 }));
863
+ }, L = (p, T) => {
864
+ u({ row: p, col: T });
865
+ }, H = (p, T) => {
866
+ r.chain().focus().insertTable({ rows: p, cols: T, withHeaderRow: !0 }).run(), m(!1), u({ row: 0, col: 0 });
867
867
  };
868
- return K(() => {
869
- const m = (T) => {
870
- f.current && !f.current.contains(T.target) && (h(!1), u({ row: 0, col: 0 }));
868
+ return z(() => {
869
+ const p = (T) => {
870
+ f.current && !f.current.contains(T.target) && (m(!1), u({ row: 0, col: 0 }));
871
871
  };
872
- return document.addEventListener("pointerdown", m), () => document.removeEventListener("pointerdown", m);
873
- }, []), /* @__PURE__ */ v("div", { ref: f, className: "tp-toolbar-dropdown", children: [
874
- /* @__PURE__ */ v(
872
+ return document.addEventListener("pointerdown", p), () => document.removeEventListener("pointerdown", p);
873
+ }, []), /* @__PURE__ */ w("div", { ref: f, className: "tp-toolbar-dropdown", children: [
874
+ /* @__PURE__ */ w(
875
875
  "button",
876
876
  {
877
- className: `tp-toolbar-dropdown-trigger${c ? " is-active" : ""}${p ? " is-disabled" : ""}`,
878
- title: i(t.titleKey),
879
- disabled: p,
880
- onMouseDown: (m) => m.preventDefault(),
881
- onClick: y,
877
+ className: `tp-toolbar-dropdown-trigger${a ? " is-active" : ""}${h ? " is-disabled" : ""}`,
878
+ title: c(t.titleKey),
879
+ disabled: h,
880
+ onMouseDown: (p) => p.preventDefault(),
881
+ onClick: v,
882
882
  children: [
883
- /* @__PURE__ */ e("span", { className: "tp-toolbar-icon", dangerouslySetInnerHTML: { __html: ke(t.name) } }),
883
+ /* @__PURE__ */ e("span", { className: "tp-toolbar-icon", dangerouslySetInnerHTML: { __html: be(t.name) } }),
884
884
  /* @__PURE__ */ e("span", { className: "tp-toolbar-dropdown-arrow", children: "▾" })
885
885
  ]
886
886
  }
887
887
  ),
888
- s && /* @__PURE__ */ v("div", { className: "tp-table-grid-dropdown", children: [
889
- /* @__PURE__ */ e("div", { className: "tp-table-grid-header", children: d.row > 0 ? `${d.row} × ${d.col}` : i("table.insertHint") }),
890
- /* @__PURE__ */ e("div", { className: "tp-table-grid", children: Array.from({ length: Ht }, (m, T) => /* @__PURE__ */ e("div", { className: "tp-table-grid-row", children: Array.from({ length: Et }, (w, M) => {
891
- const n = T + 1, r = M + 1;
888
+ s && /* @__PURE__ */ w("div", { className: "tp-table-grid-dropdown", children: [
889
+ /* @__PURE__ */ e("div", { className: "tp-table-grid-header", children: d.row > 0 ? `${d.row} × ${d.col}` : c("table.insertHint") }),
890
+ /* @__PURE__ */ e("div", { className: "tp-table-grid", children: Array.from({ length: Vt }, (p, T) => /* @__PURE__ */ e("div", { className: "tp-table-grid-row", children: Array.from({ length: Jt }, (b, M) => {
891
+ const g = T + 1, o = M + 1;
892
892
  return /* @__PURE__ */ e(
893
893
  "div",
894
894
  {
895
- className: `tp-table-grid-cell${n <= d.row && r <= d.col ? " is-hovered" : ""}${n === d.row && r === d.col ? " is-selected" : ""}`,
896
- onMouseEnter: () => N(n, r),
897
- onClick: () => S(n, r)
895
+ className: `tp-table-grid-cell${g <= d.row && o <= d.col ? " is-hovered" : ""}${g === d.row && o === d.col ? " is-selected" : ""}`,
896
+ onMouseEnter: () => L(g, o),
897
+ onClick: () => H(g, o)
898
898
  },
899
- `${n}-${r}`
899
+ `${g}-${o}`
900
900
  );
901
901
  }) }, T)) })
902
902
  ] })
903
903
  ] });
904
- }, $t = ({ editor: t, disabled: o = !1 }) => {
905
- const { t: c } = fe(), p = B("none"), [i, s] = H("none"), h = B([]), d = B(null), u = B(null), f = B(null), y = B(void 0), N = B(null), S = B(0), m = B(!1), T = i !== "none", w = A(() => {
906
- const { from: E, to: $ } = t.state.selection;
904
+ }, Yt = ({ editor: t, disabled: r = !1 }) => {
905
+ const { t: a } = fe(), h = B("none"), [c, s] = A("none"), m = B([]), d = B(null), u = B(null), f = B(null), v = B(void 0), L = B(null), H = B(0), p = B(!1), T = c !== "none", b = S(() => {
906
+ const { from: D, to: E } = t.state.selection;
907
907
  if (t.isActive("orderedList")) return "orderedList";
908
908
  if (t.isActive("bulletList")) return "bulletList";
909
- const P = Math.min(E + 1, $), G = t.state.doc.resolve(P);
910
- if (G.parent.type.name === "listItem")
911
- for (let j = G.depth; j > 0; j--) {
912
- const W = G.node(j);
913
- if (W.type.name === "orderedList") return "orderedList";
914
- if (W.type.name === "bulletList") return "bulletList";
909
+ const P = Math.min(D + 1, E), V = t.state.doc.resolve(P);
910
+ if (V.parent.type.name === "listItem")
911
+ for (let K = V.depth; K > 0; K--) {
912
+ const j = V.node(K);
913
+ if (j.type.name === "orderedList") return "orderedList";
914
+ if (j.type.name === "bulletList") return "bulletList";
915
915
  }
916
916
  return null;
917
- }, [t]), M = A(() => {
918
- const { from: E, to: $ } = t.state.selection;
917
+ }, [t]), M = S(() => {
918
+ const { from: D, to: E } = t.state.selection;
919
919
  if (t.isActive("orderedList") || t.isActive("bulletList")) return;
920
- for (let j = 1; j <= 6; j++)
921
- if (t.isActive("heading", { level: j })) return j;
922
- const P = Math.min(E + 1, $);
920
+ for (let K = 1; K <= 6; K++)
921
+ if (t.isActive("heading", { level: K })) return K;
922
+ const P = Math.min(D + 1, E);
923
923
  if (t.state.doc.resolve(P).parent.type.name === "paragraph") return null;
924
- }, [t]), n = A(() => {
925
- const { from: E, to: $, empty: P } = t.state.selection;
924
+ }, [t]), g = S(() => {
925
+ const { from: D, to: E, empty: P } = t.state.selection;
926
926
  if (P) return !1;
927
- const O = t.state.doc.resolve(Math.min(E + 1, $)).marks();
928
- h.current = [...O];
929
- const j = w();
930
- d.current = j;
931
- const W = t.getAttributes("textStyle");
927
+ const O = t.state.doc.resolve(Math.min(D + 1, E)).marks();
928
+ m.current = [...O];
929
+ const K = b();
930
+ d.current = K;
931
+ const j = t.getAttributes("textStyle");
932
932
  u.current = {
933
- color: W.color,
934
- fontFamily: W.fontFamily,
935
- fontSize: W.fontSize
933
+ color: j.color,
934
+ fontFamily: j.fontFamily,
935
+ fontSize: j.fontSize
936
936
  };
937
- const I = t.getAttributes("paragraph"), F = t.getAttributes("heading");
937
+ const _ = t.getAttributes("paragraph"), I = t.getAttributes("heading");
938
938
  f.current = {
939
- textAlign: I.textAlign || F.textAlign,
940
- lineHeight: I.lineHeight || F.lineHeight
941
- }, y.current = M();
942
- const z = O.length > 0, q = !!W.color || !!W.fontFamily || !!W.fontSize, ee = !!f.current.textAlign || !!f.current.lineHeight;
943
- return z || q || ee || j !== null || y.current !== void 0;
944
- }, [t, w, M]), r = A(() => {
939
+ textAlign: _.textAlign || I.textAlign,
940
+ lineHeight: _.lineHeight || I.lineHeight
941
+ }, v.current = M();
942
+ const F = O.length > 0, U = !!j.color || !!j.fontFamily || !!j.fontSize, Q = !!f.current.textAlign || !!f.current.lineHeight;
943
+ return F || U || Q || K !== null || v.current !== void 0;
944
+ }, [t, b, M]), o = S(() => {
945
945
  if (!d.current) return;
946
- const E = t.chain().focus();
946
+ const D = t.chain().focus();
947
947
  switch (d.current) {
948
948
  case "orderedList":
949
- t.isActive("orderedList") || (t.isActive("bulletList") && E.toggleBulletList(), E.toggleOrderedList().run());
949
+ t.isActive("orderedList") || (t.isActive("bulletList") && D.toggleBulletList(), D.toggleOrderedList().run());
950
950
  break;
951
951
  case "bulletList":
952
- t.isActive("bulletList") || (t.isActive("orderedList") && E.toggleOrderedList(), E.toggleBulletList().run());
952
+ t.isActive("bulletList") || (t.isActive("orderedList") && D.toggleOrderedList(), D.toggleBulletList().run());
953
953
  break;
954
954
  }
955
- }, [t]), k = A(() => {
956
- if (y.current === void 0) return;
957
- const E = t.chain().focus();
958
- if (y.current === null)
959
- E.setParagraph().run();
955
+ }, [t]), x = S(() => {
956
+ if (v.current === void 0) return;
957
+ const D = t.chain().focus();
958
+ if (v.current === null)
959
+ D.setParagraph().run();
960
960
  else {
961
- const { schema: $ } = t.state;
962
- $.nodes.heading && E.setNode("heading", { level: y.current }).run();
961
+ const { schema: E } = t.state;
962
+ E.nodes.heading && D.setNode("heading", { level: v.current }).run();
963
963
  }
964
- }, [t]), g = A(() => {
965
- let { state: E } = t, { from: $, to: P, empty: G } = E.selection;
966
- if (G) return !1;
967
- const { schema: O } = E;
968
- if (d.current ? r() : y.current !== void 0 && k(), f.current) {
969
- const z = t.chain().focus();
970
- f.current.textAlign && z.setTextAlign(f.current.textAlign), f.current.lineHeight && z.setLineHeight(f.current.lineHeight), z.run();
964
+ }, [t]), i = S(() => {
965
+ let { state: D } = t, { from: E, to: P, empty: V } = D.selection;
966
+ if (V) return !1;
967
+ const { schema: O } = D;
968
+ if (d.current ? o() : v.current !== void 0 && x(), f.current) {
969
+ const F = t.chain().focus();
970
+ f.current.textAlign && F.setTextAlign(f.current.textAlign), f.current.lineHeight && F.setLineHeight(f.current.lineHeight), F.run();
971
971
  }
972
- E = t.state;
973
- const j = E.selection;
974
- if ($ = j.from, P = j.to, h.current.length === 0 && !u.current)
975
- return d.current !== null || f.current !== null || y.current !== void 0;
976
- const W = E.tr, I = [];
977
- if (h.current.forEach((z) => {
978
- const q = z.type.name;
979
- ["bold", "italic", "underline", "strike", "superscript", "subscript"].includes(q) && I.push(z);
972
+ D = t.state;
973
+ const K = D.selection;
974
+ if (E = K.from, P = K.to, m.current.length === 0 && !u.current)
975
+ return d.current !== null || f.current !== null || v.current !== void 0;
976
+ const j = D.tr, _ = [];
977
+ if (m.current.forEach((F) => {
978
+ const U = F.type.name;
979
+ ["bold", "italic", "underline", "strike", "superscript", "subscript"].includes(U) && _.push(F);
980
980
  }), u.current) {
981
- const { color: z, fontFamily: q, fontSize: ee } = u.current, te = {};
982
- if (z && (te.color = z), q && (te.fontFamily = q), ee && (te.fontSize = ee), Object.keys(te).length > 0 && O.marks.textStyle) {
983
- const ve = O.marks.textStyle.create(te);
984
- I.push(ve);
981
+ const { color: F, fontFamily: U, fontSize: Q } = u.current, ee = {};
982
+ if (F && (ee.color = F), U && (ee.fontFamily = U), Q && (ee.fontSize = Q), Object.keys(ee).length > 0 && O.marks.textStyle) {
983
+ const we = O.marks.textStyle.create(ee);
984
+ _.push(we);
985
985
  }
986
986
  }
987
- const F = h.current.find((z) => z.type.name === "highlight");
988
- return F && I.push(F), I.length === 0 || (E.doc.nodesBetween($, P, (z, q) => {
989
- if (z.isText && q < P && q + z.nodeSize > $) {
990
- const ee = Math.max(q, $), te = Math.min(q + z.nodeSize, P);
987
+ const I = m.current.find((F) => F.type.name === "highlight");
988
+ return I && _.push(I), _.length === 0 || (D.doc.nodesBetween(E, P, (F, U) => {
989
+ if (F.isText && U < P && U + F.nodeSize > E) {
990
+ const Q = Math.max(U, E), ee = Math.min(U + F.nodeSize, P);
991
991
  ["bold", "italic", "underline", "strike", "superscript", "subscript", "textStyle", "highlight"].forEach((ne) => {
992
992
  const ue = O.marks[ne];
993
- ue && z.marks.some((ae) => ae.type === ue) && W.removeMark(ee, te, ue);
994
- }), I.forEach((ne) => {
995
- W.addMark(ee, te, ne);
993
+ ue && F.marks.some((ae) => ae.type === ue) && j.removeMark(Q, ee, ue);
994
+ }), _.forEach((ne) => {
995
+ j.addMark(Q, ee, ne);
996
996
  });
997
997
  }
998
- }), W.docChanged && t.view.dispatch(W)), !0;
999
- }, [t, r, k]), l = A(() => {
1000
- p.current = "none", s("none"), h.current = [], d.current = null, u.current = null, f.current = null, y.current = void 0;
1001
- }, []), x = A(() => {
1002
- if (p.current === "none") return;
1003
- const { empty: E } = t.state.selection;
1004
- E || (g(), p.current === "single" && l());
1005
- }, [t, g, l]), _ = A(() => {
1006
- if (p.current === "single" || p.current === "multiple") {
998
+ }), j.docChanged && t.view.dispatch(j)), !0;
999
+ }, [t, o, x]), l = S(() => {
1000
+ h.current = "none", s("none"), m.current = [], d.current = null, u.current = null, f.current = null, v.current = void 0;
1001
+ }, []), y = S(() => {
1002
+ if (h.current === "none") return;
1003
+ const { empty: D } = t.state.selection;
1004
+ D || (i(), h.current === "single" && l());
1005
+ }, [t, i, l]), $ = S(() => {
1006
+ if (h.current === "single" || h.current === "multiple") {
1007
1007
  l();
1008
1008
  return;
1009
1009
  }
1010
- n() && (p.current = "single", s("single"));
1011
- }, [n, l]), V = A(() => {
1012
- if (p.current === "multiple") {
1010
+ g() && (h.current = "single", s("single"));
1011
+ }, [g, l]), W = S(() => {
1012
+ if (h.current === "multiple") {
1013
1013
  l();
1014
1014
  return;
1015
1015
  }
1016
- n() && (p.current = "multiple", s("multiple"));
1017
- }, [n, l]), b = A(() => {
1018
- o || (S.current++, S.current === 1 ? N.current = window.setTimeout(() => {
1019
- _(), S.current = 0, N.current = null;
1020
- }, 250) : S.current === 2 && (N.current && (clearTimeout(N.current), N.current = null), V(), S.current = 0));
1021
- }, [_, V]);
1022
- return K(() => {
1023
- o && (l(), N.current && (clearTimeout(N.current), N.current = null), S.current = 0);
1024
- }, [o, l]), K(() => {
1025
- const E = (O) => {
1026
- p.current === "none" || O.target.closest(".tp-toolbar-btn") || (m.current = !0);
1027
- }, $ = (O) => {
1028
- !m.current || (m.current = !1, p.current === "none") || O.target.closest(".tp-toolbar-btn") || requestAnimationFrame(() => x());
1016
+ g() && (h.current = "multiple", s("multiple"));
1017
+ }, [g, l]), k = S(() => {
1018
+ r || (H.current++, H.current === 1 ? L.current = window.setTimeout(() => {
1019
+ $(), H.current = 0, L.current = null;
1020
+ }, 250) : H.current === 2 && (L.current && (clearTimeout(L.current), L.current = null), W(), H.current = 0));
1021
+ }, [$, W]);
1022
+ return z(() => {
1023
+ r && (l(), L.current && (clearTimeout(L.current), L.current = null), H.current = 0);
1024
+ }, [r, l]), z(() => {
1025
+ const D = (O) => {
1026
+ h.current === "none" || O.target.closest(".tp-toolbar-btn") || (p.current = !0);
1027
+ }, E = (O) => {
1028
+ !p.current || (p.current = !1, h.current === "none") || O.target.closest(".tp-toolbar-btn") || requestAnimationFrame(() => y());
1029
1029
  }, P = (O) => {
1030
- O.key === "Escape" && p.current !== "none" && l();
1031
- }, G = (O) => {
1032
- if (p.current === "none") return;
1033
- const j = ["ArrowLeft", "ArrowRight", "ArrowUp", "ArrowDown", "Home", "End", "PageUp", "PageDown"];
1034
- O.shiftKey && j.includes(O.key) && x();
1030
+ O.key === "Escape" && h.current !== "none" && l();
1031
+ }, V = (O) => {
1032
+ if (h.current === "none") return;
1033
+ const K = ["ArrowLeft", "ArrowRight", "ArrowUp", "ArrowDown", "Home", "End", "PageUp", "PageDown"];
1034
+ O.shiftKey && K.includes(O.key) && y();
1035
1035
  };
1036
- return document.addEventListener("mousedown", E), document.addEventListener("mouseup", $), document.addEventListener("keydown", P), document.addEventListener("keyup", G), () => {
1037
- document.removeEventListener("mousedown", E), document.removeEventListener("mouseup", $), document.removeEventListener("keydown", P), document.removeEventListener("keyup", G), N.current && clearTimeout(N.current);
1036
+ return document.addEventListener("mousedown", D), document.addEventListener("mouseup", E), document.addEventListener("keydown", P), document.addEventListener("keyup", V), () => {
1037
+ document.removeEventListener("mousedown", D), document.removeEventListener("mouseup", E), document.removeEventListener("keydown", P), document.removeEventListener("keyup", V), L.current && clearTimeout(L.current);
1038
1038
  };
1039
- }, [x, l]), /* @__PURE__ */ v(
1039
+ }, [y, l]), /* @__PURE__ */ w(
1040
1040
  "button",
1041
1041
  {
1042
- className: `tp-toolbar-btn${T ? " is-active" : ""}${i === "multiple" ? " is-locked" : ""}${o ? " is-disabled" : ""}`,
1043
- disabled: o,
1044
- title: c("toolbar.formatPainter"),
1045
- onClick: b,
1042
+ className: `tp-toolbar-btn${T ? " is-active" : ""}${c === "multiple" ? " is-locked" : ""}${r ? " is-disabled" : ""}`,
1043
+ disabled: r,
1044
+ title: a("toolbar.formatPainter"),
1045
+ onClick: k,
1046
1046
  style: { position: "relative" },
1047
1047
  children: [
1048
- /* @__PURE__ */ e("span", { className: "tp-toolbar-icon", dangerouslySetInnerHTML: { __html: ke("formatPainter") } }),
1049
- i === "multiple" && /* @__PURE__ */ e("span", { className: "tp-format-painter-indicator", children: "🔒" })
1048
+ /* @__PURE__ */ e("span", { className: "tp-toolbar-icon", dangerouslySetInnerHTML: { __html: be("formatPainter") } }),
1049
+ c === "multiple" && /* @__PURE__ */ e("span", { className: "tp-format-painter-indicator", children: "🔒" })
1050
1050
  ]
1051
1051
  }
1052
1052
  );
1053
- }, _t = [
1053
+ }, Gt = [
1054
1054
  { type: "decimal", lines: ["1.", "2.", "3."] },
1055
1055
  { type: "decimal-leading-zero", lines: ["01.", "02.", "03."] },
1056
1056
  { type: "lower-roman", lines: ["i.", "ii.", "iii."] },
1057
1057
  { type: "upper-roman", lines: ["I.", "II.", "III."] },
1058
1058
  { type: "lower-alpha", lines: ["a.", "b.", "c."] },
1059
1059
  { type: "upper-alpha", lines: ["A.", "B.", "C."] }
1060
- ], Bt = ({ def: t, editor: o, active: c, disabled: p }) => {
1061
- const { t: i } = fe(), [s, h] = H(!1), [d, u] = H(0), f = B(null), y = () => {
1062
- const { state: g } = o, l = g.selection.$from;
1063
- let x = null, _ = 0;
1064
- for (let V = l.depth; V >= 0; V--) {
1065
- const b = l.node(V);
1066
- b.type.name === "orderedList" && (x || (x = b), _++);
1060
+ ], Xt = ({ def: t, editor: r, active: a, disabled: h }) => {
1061
+ const { t: c } = fe(), [s, m] = A(!1), [d, u] = A(0), f = B(null), v = () => {
1062
+ const { state: i } = r, l = i.selection.$from;
1063
+ let y = null, $ = 0;
1064
+ for (let W = l.depth; W >= 0; W--) {
1065
+ const k = l.node(W);
1066
+ k.type.name === "orderedList" && (y || (y = k), $++);
1067
1067
  }
1068
- return { node: x, depth: _ };
1069
- }, N = (() => {
1070
- const { node: g, depth: l } = y();
1071
- return g && g.attrs.listStyleType ? g.attrs.listStyleType : l <= 1 ? "decimal" : l === 2 ? "lower-alpha" : "lower-roman";
1072
- })(), S = (() => {
1073
- const { node: g } = y(), l = g == null ? void 0 : g.attrs.start;
1068
+ return { node: y, depth: $ };
1069
+ }, L = (() => {
1070
+ const { node: i, depth: l } = v();
1071
+ return i && i.attrs.listStyleType ? i.attrs.listStyleType : l <= 1 ? "decimal" : l === 2 ? "lower-alpha" : "lower-roman";
1072
+ })(), H = (() => {
1073
+ const { node: i } = v(), l = i == null ? void 0 : i.attrs.start;
1074
1074
  return l != null ? Number(l) : 1;
1075
- })(), m = (() => {
1076
- const { node: g } = y();
1077
- return !!(g != null && g.attrs.reversed);
1078
- })(), T = A(() => {
1079
- var g;
1080
- (g = t.command) == null || g.call(t, o);
1081
- }, [t, o]), w = A(() => {
1082
- p || h((g) => !g);
1083
- }, [p]), M = A((g) => {
1084
- o.commands.createStyledOrderedList({ listStyleType: g }), o.commands.focus(), h(!1);
1085
- }, [o]), n = A((g) => {
1086
- const l = parseInt(g.target.value, 10);
1087
- isNaN(l) || o.commands.setOrderedListAttrs({ start: l });
1088
- }, [o]), r = A((g) => {
1089
- ["Backspace", "Delete", "ArrowLeft", "ArrowRight", "ArrowUp", "ArrowDown", "Tab", "Home", "End"].includes(g.key) || g.key === "-" || g.key === "Minus" || g.key >= "0" && g.key <= "9" || g.ctrlKey || g.metaKey || g.preventDefault();
1090
- }, []), k = A(() => {
1091
- const g = !m;
1092
- o.commands.setOrderedListAttrs({ reversed: g || null });
1093
- }, [o, m]);
1094
- return K(() => {
1095
- const g = (x) => {
1096
- f.current && !f.current.contains(x.target) && h(!1);
1097
- }, l = () => u((x) => x + 1);
1098
- return document.addEventListener("pointerdown", g), o.on("transaction", l), () => {
1099
- document.removeEventListener("pointerdown", g), o.off("transaction", l);
1075
+ })(), p = (() => {
1076
+ const { node: i } = v();
1077
+ return !!(i != null && i.attrs.reversed);
1078
+ })(), T = S(() => {
1079
+ var i;
1080
+ (i = t.command) == null || i.call(t, r);
1081
+ }, [t, r]), b = S(() => {
1082
+ h || m((i) => !i);
1083
+ }, [h]), M = S((i) => {
1084
+ r.commands.createStyledOrderedList({ listStyleType: i }), r.commands.focus(), m(!1);
1085
+ }, [r]), g = S((i) => {
1086
+ const l = parseInt(i.target.value, 10);
1087
+ isNaN(l) || r.commands.setOrderedListAttrs({ start: l });
1088
+ }, [r]), o = S((i) => {
1089
+ ["Backspace", "Delete", "ArrowLeft", "ArrowRight", "ArrowUp", "ArrowDown", "Tab", "Home", "End"].includes(i.key) || i.key === "-" || i.key === "Minus" || i.key >= "0" && i.key <= "9" || i.ctrlKey || i.metaKey || i.preventDefault();
1090
+ }, []), x = S(() => {
1091
+ const i = !p;
1092
+ r.commands.setOrderedListAttrs({ reversed: i || null });
1093
+ }, [r, p]);
1094
+ return z(() => {
1095
+ const i = (y) => {
1096
+ f.current && !f.current.contains(y.target) && m(!1);
1097
+ }, l = () => u((y) => y + 1);
1098
+ return document.addEventListener("pointerdown", i), r.on("transaction", l), () => {
1099
+ document.removeEventListener("pointerdown", i), r.off("transaction", l);
1100
1100
  };
1101
- }, [o]), /* @__PURE__ */ v("div", { ref: f, className: "tp-toolbar-split-btn", children: [
1101
+ }, [r]), /* @__PURE__ */ w("div", { ref: f, className: "tp-toolbar-split-btn", children: [
1102
1102
  /* @__PURE__ */ e(
1103
1103
  "button",
1104
1104
  {
1105
- className: `tp-toolbar-split-main${c ? " is-active" : ""}`,
1106
- title: i(t.titleKey),
1107
- disabled: p,
1108
- onMouseDown: (g) => g.preventDefault(),
1105
+ className: `tp-toolbar-split-main${a ? " is-active" : ""}`,
1106
+ title: c(t.titleKey),
1107
+ disabled: h,
1108
+ onMouseDown: (i) => i.preventDefault(),
1109
1109
  onClick: T,
1110
- children: /* @__PURE__ */ e("span", { className: "tp-toolbar-icon", dangerouslySetInnerHTML: { __html: ke(t.name) } })
1110
+ children: /* @__PURE__ */ e("span", { className: "tp-toolbar-icon", dangerouslySetInnerHTML: { __html: be(t.name) } })
1111
1111
  }
1112
1112
  ),
1113
1113
  /* @__PURE__ */ e(
1114
1114
  "button",
1115
1115
  {
1116
1116
  className: `tp-toolbar-split-arrow${s ? " is-open" : ""}`,
1117
- disabled: p,
1118
- onMouseDown: (g) => g.preventDefault(),
1119
- onClick: w,
1117
+ disabled: h,
1118
+ onMouseDown: (i) => i.preventDefault(),
1119
+ onClick: b,
1120
1120
  children: "▾"
1121
1121
  }
1122
1122
  ),
1123
- s && /* @__PURE__ */ v("div", { className: "tp-ol-panel", children: [
1124
- /* @__PURE__ */ e("div", { className: "tp-ol-style-grid", children: _t.map((g) => /* @__PURE__ */ e(
1123
+ s && /* @__PURE__ */ w("div", { className: "tp-ol-panel", children: [
1124
+ /* @__PURE__ */ e("div", { className: "tp-ol-style-grid", children: Gt.map((i) => /* @__PURE__ */ e(
1125
1125
  "button",
1126
1126
  {
1127
- className: `tp-ol-style-item${N === g.type ? " is-active" : ""}`,
1127
+ className: `tp-ol-style-item${L === i.type ? " is-active" : ""}`,
1128
1128
  onMouseDown: (l) => l.preventDefault(),
1129
- onClick: () => M(g.type),
1130
- children: g.lines.map((l, x) => /* @__PURE__ */ v("span", { className: "tp-ol-style-line", children: [
1129
+ onClick: () => M(i.type),
1130
+ children: i.lines.map((l, y) => /* @__PURE__ */ w("span", { className: "tp-ol-style-line", children: [
1131
1131
  /* @__PURE__ */ e("span", { className: "tp-ol-style-marker", children: l }),
1132
1132
  /* @__PURE__ */ e("span", { className: "tp-ol-style-bar" })
1133
- ] }, x))
1133
+ ] }, y))
1134
1134
  },
1135
- g.type
1135
+ i.type
1136
1136
  )) }),
1137
- /* @__PURE__ */ v("div", { className: "tp-ol-properties", children: [
1138
- /* @__PURE__ */ e("div", { className: "tp-ol-prop-title", children: i("orderedList.properties") }),
1139
- /* @__PURE__ */ v("div", { className: "tp-ol-prop-row", children: [
1140
- /* @__PURE__ */ e("label", { children: i("orderedList.startAt") }),
1137
+ /* @__PURE__ */ w("div", { className: "tp-ol-properties", children: [
1138
+ /* @__PURE__ */ e("div", { className: "tp-ol-prop-title", children: c("orderedList.properties") }),
1139
+ /* @__PURE__ */ w("div", { className: "tp-ol-prop-row", children: [
1140
+ /* @__PURE__ */ e("label", { children: c("orderedList.startAt") }),
1141
1141
  /* @__PURE__ */ e(
1142
1142
  "input",
1143
1143
  {
1144
1144
  type: "number",
1145
1145
  className: "tp-ol-start-input",
1146
- defaultValue: S,
1147
- onChange: n,
1148
- onKeyDown: r,
1149
- onMouseDown: (g) => g.stopPropagation()
1146
+ defaultValue: H,
1147
+ onChange: g,
1148
+ onKeyDown: o,
1149
+ onMouseDown: (i) => i.stopPropagation()
1150
1150
  }
1151
1151
  )
1152
1152
  ] }),
1153
- /* @__PURE__ */ v("div", { className: "tp-ol-prop-row", children: [
1154
- /* @__PURE__ */ e("label", { children: i("orderedList.reversed") }),
1153
+ /* @__PURE__ */ w("div", { className: "tp-ol-prop-row", children: [
1154
+ /* @__PURE__ */ e("label", { children: c("orderedList.reversed") }),
1155
1155
  /* @__PURE__ */ e(
1156
1156
  "button",
1157
1157
  {
1158
- className: `tp-ol-toggle${m ? " is-on" : ""}`,
1159
- onMouseDown: (g) => g.preventDefault(),
1160
- onClick: k
1158
+ className: `tp-ol-toggle${p ? " is-on" : ""}`,
1159
+ onMouseDown: (i) => i.preventDefault(),
1160
+ onClick: x
1161
1161
  }
1162
1162
  )
1163
1163
  ] })
1164
1164
  ] })
1165
1165
  ] })
1166
1166
  ] });
1167
- }, It = [
1167
+ }, Zt = [
1168
1168
  { type: "disc", marker: "●" },
1169
1169
  { type: "circle", marker: "○" },
1170
1170
  { type: "square", marker: "■" },
1171
1171
  { type: "none", marker: "—" }
1172
- ], Pt = ({ def: t, editor: o, active: c, disabled: p }) => {
1173
- const { t: i } = fe(), [s, h] = H(!1), [d, u] = H(0), f = B(null), y = (() => {
1174
- const { state: T } = o, w = T.selection.$from;
1175
- let M = null, n = 0;
1176
- for (let r = w.depth; r >= 0; r--) {
1177
- const k = w.node(r);
1178
- k.type.name === "bulletList" && (M || (M = k), n++);
1172
+ ], Qt = ({ def: t, editor: r, active: a, disabled: h }) => {
1173
+ const { t: c } = fe(), [s, m] = A(!1), [d, u] = A(0), f = B(null), v = (() => {
1174
+ const { state: T } = r, b = T.selection.$from;
1175
+ let M = null, g = 0;
1176
+ for (let o = b.depth; o >= 0; o--) {
1177
+ const x = b.node(o);
1178
+ x.type.name === "bulletList" && (M || (M = x), g++);
1179
1179
  }
1180
- return M && M.attrs.listStyleType ? M.attrs.listStyleType : n <= 1 ? "disc" : n === 2 ? "circle" : "square";
1181
- })(), N = A(() => {
1180
+ return M && M.attrs.listStyleType ? M.attrs.listStyleType : g <= 1 ? "disc" : g === 2 ? "circle" : "square";
1181
+ })(), L = S(() => {
1182
1182
  var T;
1183
- (T = t.command) == null || T.call(t, o);
1184
- }, [t, o]), S = A(() => {
1185
- p || h((T) => !T);
1186
- }, [p]), m = A((T) => {
1187
- o.commands.createStyledBulletList({ listStyleType: T }), o.commands.focus(), h(!1);
1188
- }, [o]);
1189
- return K(() => {
1183
+ (T = t.command) == null || T.call(t, r);
1184
+ }, [t, r]), H = S(() => {
1185
+ h || m((T) => !T);
1186
+ }, [h]), p = S((T) => {
1187
+ r.commands.createStyledBulletList({ listStyleType: T }), r.commands.focus(), m(!1);
1188
+ }, [r]);
1189
+ return z(() => {
1190
1190
  const T = (M) => {
1191
- f.current && !f.current.contains(M.target) && h(!1);
1192
- }, w = () => u((M) => M + 1);
1193
- return document.addEventListener("pointerdown", T), o.on("transaction", w), () => {
1194
- document.removeEventListener("pointerdown", T), o.off("transaction", w);
1191
+ f.current && !f.current.contains(M.target) && m(!1);
1192
+ }, b = () => u((M) => M + 1);
1193
+ return document.addEventListener("pointerdown", T), r.on("transaction", b), () => {
1194
+ document.removeEventListener("pointerdown", T), r.off("transaction", b);
1195
1195
  };
1196
- }, [o]), /* @__PURE__ */ v("div", { ref: f, className: "tp-toolbar-split-btn", children: [
1196
+ }, [r]), /* @__PURE__ */ w("div", { ref: f, className: "tp-toolbar-split-btn", children: [
1197
1197
  /* @__PURE__ */ e(
1198
1198
  "button",
1199
1199
  {
1200
- className: `tp-toolbar-split-main${c ? " is-active" : ""}`,
1201
- title: i(t.titleKey),
1202
- disabled: p,
1200
+ className: `tp-toolbar-split-main${a ? " is-active" : ""}`,
1201
+ title: c(t.titleKey),
1202
+ disabled: h,
1203
1203
  onMouseDown: (T) => T.preventDefault(),
1204
- onClick: N,
1205
- children: /* @__PURE__ */ e("span", { className: "tp-toolbar-icon", dangerouslySetInnerHTML: { __html: ke(t.name) } })
1204
+ onClick: L,
1205
+ children: /* @__PURE__ */ e("span", { className: "tp-toolbar-icon", dangerouslySetInnerHTML: { __html: be(t.name) } })
1206
1206
  }
1207
1207
  ),
1208
1208
  /* @__PURE__ */ e(
1209
1209
  "button",
1210
1210
  {
1211
1211
  className: `tp-toolbar-split-arrow${s ? " is-open" : ""}`,
1212
- disabled: p,
1212
+ disabled: h,
1213
1213
  onMouseDown: (T) => T.preventDefault(),
1214
- onClick: S,
1214
+ onClick: H,
1215
1215
  children: "▾"
1216
1216
  }
1217
1217
  ),
1218
- s && /* @__PURE__ */ e("div", { className: "tp-ol-panel", children: /* @__PURE__ */ e("div", { className: "tp-ol-style-grid tp-ul-style-grid", children: It.map((T) => /* @__PURE__ */ e(
1218
+ s && /* @__PURE__ */ e("div", { className: "tp-ol-panel", children: /* @__PURE__ */ e("div", { className: "tp-ol-style-grid tp-ul-style-grid", children: Zt.map((T) => /* @__PURE__ */ e(
1219
1219
  "button",
1220
1220
  {
1221
- className: `tp-ol-style-item${y === T.type ? " is-active" : ""}`,
1222
- onMouseDown: (w) => w.preventDefault(),
1223
- onClick: () => m(T.type),
1224
- children: [0, 1, 2].map((w) => /* @__PURE__ */ v("span", { className: "tp-ol-style-line", children: [
1221
+ className: `tp-ol-style-item${v === T.type ? " is-active" : ""}`,
1222
+ onMouseDown: (b) => b.preventDefault(),
1223
+ onClick: () => p(T.type),
1224
+ children: [0, 1, 2].map((b) => /* @__PURE__ */ w("span", { className: "tp-ol-style-line", children: [
1225
1225
  /* @__PURE__ */ e("span", { className: "tp-ul-style-marker", children: T.marker }),
1226
1226
  /* @__PURE__ */ e("span", { className: "tp-ol-style-bar" })
1227
- ] }, w))
1227
+ ] }, b))
1228
1228
  },
1229
1229
  T.type
1230
1230
  )) }) })
1231
1231
  ] });
1232
1232
  };
1233
- function rt(t) {
1233
+ function ct(t) {
1234
1234
  return t === "meta-left" ? "tp-toolbar-capsule tp-toolbar-capsule-left" : t === "meta-io" ? "tp-toolbar-capsule tp-toolbar-capsule-io" : t === "meta-view" ? "tp-toolbar-capsule tp-toolbar-capsule-view" : "";
1235
1235
  }
1236
- const Ft = ({
1236
+ const en = ({
1237
1237
  items: t,
1238
- manager: o,
1239
- activeStates: c,
1240
- disabledStates: p,
1241
- viewMode: i = "normal",
1238
+ manager: r,
1239
+ activeStates: a,
1240
+ disabledStates: h,
1241
+ viewMode: c = "normal",
1242
1242
  onToggleViewMode: s,
1243
- onToolbarClick: h,
1243
+ onToolbarClick: m,
1244
1244
  prepend: d,
1245
1245
  append: u
1246
1246
  }) => {
1247
- const f = () => o.getEditor(), y = A((n) => {
1248
- if (n === "getHTML") {
1247
+ const f = () => r.getEditor(), v = B(null);
1248
+ z(() => wt(v.current, { getEditor: f }), []);
1249
+ const L = S((o) => {
1250
+ if (o === "getHTML") {
1249
1251
  s == null || s("html");
1250
1252
  return;
1251
1253
  }
1252
- if (n === "getJSON") {
1254
+ if (o === "getJSON") {
1253
1255
  s == null || s("json");
1254
1256
  return;
1255
1257
  }
1256
- h == null || h(n);
1257
- }, [s, h]), N = (n) => i !== "normal" ? n === "getHTML" ? i === "html" : n === "getJSON" ? i === "json" : !1 : n === "getHTML" || n === "getJSON" ? !1 : c[n] ?? !1, S = (n) => i !== "normal" ? n !== "getHTML" && n !== "getJSON" : p[n] ?? !1, m = Te(() => pt(t), [t]), T = m.filter((n) => n.category === "meta-left" || n.category === "content"), w = m.filter((n) => n.category === "meta-io" || n.category === "meta-view");
1258
- function M(n) {
1259
- const r = ht(n);
1260
- if (!r) return null;
1261
- const k = f();
1262
- return n === "imageUpload" ? /* @__PURE__ */ e(Dt, { def: r, editor: k, manager: o, active: N(n), disabled: S(n) }, n) : n === "video" ? /* @__PURE__ */ e(At, { def: r, editor: k, active: N(n), disabled: S(n) }, n) : n === "insertTable" ? /* @__PURE__ */ e(Rt, { def: r, editor: k, active: N(n), disabled: S(n) }, n) : n === "formatPainter" ? /* @__PURE__ */ e($t, { editor: k, disabled: S(n) }, n) : n === "orderedList" ? /* @__PURE__ */ e(Bt, { def: r, editor: k, active: N(n), disabled: S(n) }, n) : n === "bulletList" ? /* @__PURE__ */ e(Pt, { def: r, editor: k, active: N(n), disabled: S(n) }, n) : r.type === "button" ? /* @__PURE__ */ e(kt, { def: r, editor: k, active: N(n), disabled: S(n), onCustomClick: y }, n) : r.type === "dropdown" ? /* @__PURE__ */ e(Ct, { def: r, editor: k, active: N(n), disabled: S(n), onCustomClick: y }, n) : r.type === "color-picker" ? /* @__PURE__ */ e(Lt, { def: r, editor: k, disabled: S(n) }, n) : null;
1258
+ m == null || m(o);
1259
+ }, [s, m]), H = (o) => c !== "normal" ? o === "getHTML" ? c === "html" : o === "getJSON" ? c === "json" : !1 : o === "getHTML" || o === "getJSON" ? !1 : a[o] ?? !1, p = (o) => c !== "normal" ? o !== "getHTML" && o !== "getJSON" : h[o] ?? !1, T = Me(() => vt(t), [t]), b = T.filter((o) => o.category === "meta-left" || o.category === "content"), M = T.filter((o) => o.category === "meta-io" || o.category === "meta-view");
1260
+ function g(o) {
1261
+ const x = yt(o);
1262
+ if (!x) return null;
1263
+ const i = f();
1264
+ return o === "imageUpload" ? /* @__PURE__ */ e(Ut, { def: x, editor: i, manager: r, active: H(o), disabled: p(o) }, o) : o === "video" ? /* @__PURE__ */ e(Kt, { def: x, editor: i, active: H(o), disabled: p(o) }, o) : o === "insertTable" ? /* @__PURE__ */ e(qt, { def: x, editor: i, active: H(o), disabled: p(o) }, o) : o === "formatPainter" ? /* @__PURE__ */ e(Yt, { editor: i, disabled: p(o) }, o) : o === "orderedList" ? /* @__PURE__ */ e(Xt, { def: x, editor: i, active: H(o), disabled: p(o) }, o) : o === "bulletList" ? /* @__PURE__ */ e(Qt, { def: x, editor: i, active: H(o), disabled: p(o) }, o) : x.type === "button" ? /* @__PURE__ */ e(Pt, { def: x, editor: i, active: H(o), disabled: p(o), onCustomClick: L }, o) : x.type === "dropdown" ? /* @__PURE__ */ e(It, { def: x, editor: i, active: H(o), disabled: p(o), onCustomClick: L }, o) : x.type === "color-picker" ? /* @__PURE__ */ e(Wt, { def: x, editor: i, disabled: p(o) }, o) : null;
1263
1265
  }
1264
- return /* @__PURE__ */ v("div", { className: "tp-toolbar", children: [
1266
+ return /* @__PURE__ */ w("div", { className: "tp-toolbar", ref: v, children: [
1265
1267
  d,
1266
- T.map((n, r) => /* @__PURE__ */ v(Xe.Fragment, { children: [
1267
- r > 0 && /* @__PURE__ */ e(ot, {}),
1268
- n.category !== "content" ? /* @__PURE__ */ e("div", { className: rt(n.category), children: n.items.map(M) }) : /* @__PURE__ */ e(Ze, { children: n.items.map(M) })
1269
- ] }, `g-${r}`)),
1270
- w.length > 0 && /* @__PURE__ */ e("div", { className: "tp-toolbar-right", children: w.map((n, r) => /* @__PURE__ */ v(Xe.Fragment, { children: [
1271
- r > 0 && /* @__PURE__ */ e(ot, {}),
1272
- /* @__PURE__ */ e("div", { className: rt(n.category), children: n.items.map(M) })
1273
- ] }, `r-${r}`)) }),
1268
+ b.map((o, x) => /* @__PURE__ */ w(tt.Fragment, { children: [
1269
+ x > 0 && /* @__PURE__ */ e(it, {}),
1270
+ o.category !== "content" ? /* @__PURE__ */ e("div", { className: ct(o.category), children: o.items.map(g) }) : /* @__PURE__ */ e(nt, { children: o.items.map(g) })
1271
+ ] }, `g-${x}`)),
1272
+ M.length > 0 && /* @__PURE__ */ e("div", { className: "tp-toolbar-right", children: M.map((o, x) => /* @__PURE__ */ w(tt.Fragment, { children: [
1273
+ x > 0 && /* @__PURE__ */ e(it, {}),
1274
+ /* @__PURE__ */ e("div", { className: ct(o.category), children: o.items.map(g) })
1275
+ ] }, `r-${x}`)) }),
1274
1276
  u
1275
1277
  ] });
1276
- }, Ot = ({
1278
+ }, tn = ({
1277
1279
  editor: t,
1278
- visible: o,
1279
- position: c,
1280
- targetCell: p,
1281
- onVisibleChange: i,
1280
+ visible: r,
1281
+ position: a,
1282
+ targetCell: h,
1283
+ onVisibleChange: c,
1282
1284
  onAction: s
1283
1285
  }) => {
1284
- const h = B(null), [d, u] = H({ x: 0, y: 0 }), [f, y] = H(!1), [N, S] = H(!1), m = B({ x: 0, y: 0 }), T = De.getInstance(), w = (r) => T.t(r), M = A((r) => {
1285
- if (!h.current) return r;
1286
- const k = h.current.getBoundingClientRect();
1287
- return k.width === 0 || k.height === 0 ? r : Qe({
1288
- x: r.x,
1289
- y: r.y,
1290
- width: k.width,
1291
- height: k.height
1286
+ const m = B(null), [d, u] = A({ x: 0, y: 0 }), [f, v] = A(0), [L, H] = A(!1), [p, T] = A(!1), b = B({ x: 0, y: 0 }), M = Le.getInstance(), g = (i) => M.t(i), o = S((i) => {
1287
+ if (!m.current) return null;
1288
+ const l = m.current, y = l.getBoundingClientRect(), $ = l.offsetHeight - l.clientHeight, W = Math.max(y.height, l.scrollHeight + $);
1289
+ return y.width === 0 || W === 0 ? null : bt({
1290
+ x: i.x,
1291
+ y: i.y,
1292
+ width: y.width,
1293
+ height: W
1292
1294
  });
1293
1295
  }, []);
1294
- K(() => {
1295
- if (o) {
1296
- if (u({ x: c.x, y: c.y }), p) {
1297
- const r = p.getBoundingClientRect();
1298
- m.current = {
1299
- x: c.x - r.left,
1300
- y: c.y - r.top
1296
+ z(() => {
1297
+ if (r) {
1298
+ if (u({ x: a.x, y: a.y }), h) {
1299
+ const i = h.getBoundingClientRect();
1300
+ b.current = {
1301
+ x: a.x - i.left,
1302
+ y: a.y - i.top
1301
1303
  };
1302
1304
  }
1303
- y(t.can().mergeCells()), S(t.can().splitCell());
1305
+ H(t.can().mergeCells()), T(t.can().splitCell());
1304
1306
  }
1305
- }, [o, c, p, t]), it(() => {
1306
- if (!o || !h.current) return;
1307
- const r = h.current.getBoundingClientRect();
1308
- if (r.width === 0 || r.height === 0) return;
1309
- const k = Qe({
1310
- x: d.x,
1311
- y: d.y,
1312
- width: r.width,
1313
- height: r.height
1314
- });
1315
- (k.x !== d.x || k.y !== d.y) && u({ x: k.x, y: k.y });
1316
- }, [o, d.x, d.y]), K(() => {
1317
- const r = () => {
1318
- if (!o || !p) return;
1319
- const g = p.getBoundingClientRect();
1320
- if (g.bottom < 0 || g.top > window.innerHeight) {
1321
- i(!1);
1307
+ }, [r, a, h, t]), pt(() => {
1308
+ if (!r || !m.current) return;
1309
+ const i = o(d);
1310
+ i && ((i.x !== d.x || i.y !== d.y) && u({ x: i.x, y: i.y }), v(i.maxHeight));
1311
+ }, [r, d, o]), z(() => {
1312
+ var W, k;
1313
+ const i = () => {
1314
+ if (!r || !h) return;
1315
+ const D = h.getBoundingClientRect(), E = xt();
1316
+ if (D.bottom < E.top || D.top > E.bottom) {
1317
+ c(!1);
1322
1318
  return;
1323
1319
  }
1324
- const l = {
1325
- x: g.left + m.current.x,
1326
- y: g.top + m.current.y
1327
- }, x = M(l);
1328
- u({ x: x.x, y: x.y });
1329
- }, k = () => {
1330
- o && r();
1320
+ const P = {
1321
+ x: D.left + b.current.x,
1322
+ y: D.top + b.current.y
1323
+ }, V = o(P);
1324
+ V && (u({ x: V.x, y: V.y }), v(V.maxHeight));
1325
+ }, l = (D) => {
1326
+ const E = D.target;
1327
+ return !!E && typeof E.closest == "function" && !!E.closest(".tp-table-context-menu");
1328
+ }, y = (D) => {
1329
+ r && !l(D) && i();
1330
+ }, $ = () => {
1331
+ r && i();
1331
1332
  };
1332
- return window.addEventListener("scroll", k, !0), window.addEventListener("wheel", k, { passive: !0 }), () => {
1333
- window.removeEventListener("scroll", k, !0), window.removeEventListener("wheel", k);
1333
+ return window.addEventListener("scroll", y, !0), window.addEventListener("wheel", y, { passive: !0 }), window.addEventListener("resize", $), (W = window.visualViewport) == null || W.addEventListener("resize", $), (k = window.visualViewport) == null || k.addEventListener("scroll", $), () => {
1334
+ var D, E;
1335
+ window.removeEventListener("scroll", y, !0), window.removeEventListener("wheel", y), window.removeEventListener("resize", $), (D = window.visualViewport) == null || D.removeEventListener("resize", $), (E = window.visualViewport) == null || E.removeEventListener("scroll", $);
1334
1336
  };
1335
- }, [o, p, i, M]), K(() => {
1336
- const r = (g) => {
1337
- h.current && !h.current.contains(g.target) && i(!1);
1338
- }, k = (g) => {
1339
- g.key === "Escape" && i(!1);
1337
+ }, [r, h, c, o]), z(() => {
1338
+ const i = (y) => {
1339
+ m.current && !m.current.contains(y.target) && c(!1);
1340
+ }, l = (y) => {
1341
+ y.key === "Escape" && c(!1);
1340
1342
  };
1341
- return document.addEventListener("click", r), document.addEventListener("keydown", k), () => {
1342
- document.removeEventListener("click", r), document.removeEventListener("keydown", k);
1343
+ return document.addEventListener("click", i), document.addEventListener("keydown", l), () => {
1344
+ document.removeEventListener("click", i), document.removeEventListener("keydown", l);
1343
1345
  };
1344
- }, [i]);
1345
- const n = A((r) => {
1346
- s(r), i(!1);
1347
- }, [s, i]);
1348
- return o ? _e(
1349
- /* @__PURE__ */ v(
1346
+ }, [c]);
1347
+ const x = S((i) => {
1348
+ s(i), c(!1);
1349
+ }, [s, c]);
1350
+ return r ? _e(
1351
+ /* @__PURE__ */ w(
1350
1352
  "div",
1351
1353
  {
1352
- ref: h,
1354
+ ref: m,
1353
1355
  className: "tp-table-context-menu",
1354
- style: { left: d.x, top: d.y },
1355
- onClick: (r) => r.stopPropagation(),
1356
+ style: {
1357
+ left: d.x,
1358
+ top: d.y,
1359
+ maxHeight: f > 0 ? f : void 0
1360
+ },
1361
+ onClick: (i) => i.stopPropagation(),
1356
1362
  children: [
1357
- /* @__PURE__ */ v("div", { className: "tp-table-menu-section", children: [
1358
- /* @__PURE__ */ e("div", { className: "tp-table-menu-item", onClick: () => n("addRowBefore"), children: w("table.addRowBefore") }),
1359
- /* @__PURE__ */ e("div", { className: "tp-table-menu-item", onClick: () => n("addRowAfter"), children: w("table.addRowAfter") }),
1360
- /* @__PURE__ */ e("div", { className: "tp-table-menu-item", onClick: () => n("addColumnBefore"), children: w("table.addColumnBefore") }),
1361
- /* @__PURE__ */ e("div", { className: "tp-table-menu-item", onClick: () => n("addColumnAfter"), children: w("table.addColumnAfter") })
1363
+ /* @__PURE__ */ w("div", { className: "tp-table-menu-section", children: [
1364
+ /* @__PURE__ */ e("div", { className: "tp-table-menu-item", onClick: () => x("addRowBefore"), children: g("table.addRowBefore") }),
1365
+ /* @__PURE__ */ e("div", { className: "tp-table-menu-item", onClick: () => x("addRowAfter"), children: g("table.addRowAfter") }),
1366
+ /* @__PURE__ */ e("div", { className: "tp-table-menu-item", onClick: () => x("addColumnBefore"), children: g("table.addColumnBefore") }),
1367
+ /* @__PURE__ */ e("div", { className: "tp-table-menu-item", onClick: () => x("addColumnAfter"), children: g("table.addColumnAfter") })
1362
1368
  ] }),
1363
1369
  /* @__PURE__ */ e("div", { className: "tp-table-menu-divider" }),
1364
- /* @__PURE__ */ v("div", { className: "tp-table-menu-section", children: [
1365
- /* @__PURE__ */ e("div", { className: `tp-table-menu-item${f ? "" : " disabled"}`, onClick: () => f && n("mergeCells"), children: w("table.mergeCells") }),
1366
- /* @__PURE__ */ e("div", { className: `tp-table-menu-item${N ? "" : " disabled"}`, onClick: () => N && n("splitCell"), children: w("table.splitCell") })
1370
+ /* @__PURE__ */ w("div", { className: "tp-table-menu-section", children: [
1371
+ /* @__PURE__ */ e("div", { className: "tp-table-menu-item", onClick: () => x("selectRow"), children: g("table.selectRow") }),
1372
+ /* @__PURE__ */ e("div", { className: "tp-table-menu-item", onClick: () => x("selectColumn"), children: g("table.selectColumn") }),
1373
+ /* @__PURE__ */ e("div", { className: "tp-table-menu-item", onClick: () => x("selectTable"), children: g("table.selectTable") }),
1374
+ /* @__PURE__ */ e("div", { className: "tp-table-menu-item", onClick: () => x("extendSelection"), children: g("table.extendSelection") })
1367
1375
  ] }),
1368
1376
  /* @__PURE__ */ e("div", { className: "tp-table-menu-divider" }),
1369
- /* @__PURE__ */ v("div", { className: "tp-table-menu-section", children: [
1370
- /* @__PURE__ */ e("div", { className: "tp-table-menu-item", onClick: () => n("deleteRow"), children: w("table.deleteRow") }),
1371
- /* @__PURE__ */ e("div", { className: "tp-table-menu-item", onClick: () => n("deleteColumn"), children: w("table.deleteColumn") }),
1372
- /* @__PURE__ */ e("div", { className: "tp-table-menu-item tp-table-menu-item-danger", onClick: () => n("deleteTable"), children: w("table.deleteTable") })
1377
+ /* @__PURE__ */ w("div", { className: "tp-table-menu-section", children: [
1378
+ /* @__PURE__ */ e("div", { className: `tp-table-menu-item${L ? "" : " disabled"}`, onClick: () => L && x("mergeCells"), children: g("table.mergeCells") }),
1379
+ /* @__PURE__ */ e("div", { className: `tp-table-menu-item${p ? "" : " disabled"}`, onClick: () => p && x("splitCell"), children: g("table.splitCell") })
1373
1380
  ] }),
1374
1381
  /* @__PURE__ */ e("div", { className: "tp-table-menu-divider" }),
1375
- /* @__PURE__ */ v("div", { className: "tp-table-menu-section", children: [
1376
- /* @__PURE__ */ e("div", { className: "tp-table-menu-item", onClick: () => n("tableSettings"), children: w("table.tableSettings") }),
1377
- /* @__PURE__ */ e("div", { className: "tp-table-menu-item", onClick: () => n("cellSettings"), children: w("table.cellSettings") })
1382
+ /* @__PURE__ */ w("div", { className: "tp-table-menu-section", children: [
1383
+ /* @__PURE__ */ e("div", { className: "tp-table-menu-item", onClick: () => x("deleteRow"), children: g("table.deleteRow") }),
1384
+ /* @__PURE__ */ e("div", { className: "tp-table-menu-item", onClick: () => x("deleteColumn"), children: g("table.deleteColumn") }),
1385
+ /* @__PURE__ */ e("div", { className: "tp-table-menu-item tp-table-menu-item-danger", onClick: () => x("deleteTable"), children: g("table.deleteTable") })
1386
+ ] }),
1387
+ /* @__PURE__ */ e("div", { className: "tp-table-menu-divider" }),
1388
+ /* @__PURE__ */ w("div", { className: "tp-table-menu-section", children: [
1389
+ /* @__PURE__ */ e("div", { className: "tp-table-menu-item", onClick: () => x("tableSettings"), children: g("table.tableSettings") }),
1390
+ /* @__PURE__ */ e("div", { className: "tp-table-menu-item", onClick: () => x("cellSettings"), children: g("table.cellSettings") })
1378
1391
  ] })
1379
1392
  ]
1380
1393
  }
1381
1394
  ),
1382
1395
  document.body
1383
1396
  ) : null;
1384
- }, Wt = [
1397
+ }, nn = [
1385
1398
  "#000000",
1386
1399
  "#1a1a1a",
1387
1400
  "#333333",
@@ -1404,7 +1417,7 @@ const Ft = ({
1404
1417
  "#cc0000",
1405
1418
  "#e06666",
1406
1419
  "#660000"
1407
- ], jt = [
1420
+ ], on = [
1408
1421
  "#ffffff",
1409
1422
  "#f8f9fa",
1410
1423
  "#f1f3f4",
@@ -1428,124 +1441,124 @@ const Ft = ({
1428
1441
  "#f5aca6",
1429
1442
  "#f28b82"
1430
1443
  ];
1431
- function Ut(t) {
1432
- const o = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);
1433
- return o ? { r: parseInt(o[1], 16), g: parseInt(o[2], 16), b: parseInt(o[3], 16) } : null;
1444
+ function rn(t) {
1445
+ const r = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);
1446
+ return r ? { r: parseInt(r[1], 16), g: parseInt(r[2], 16), b: parseInt(r[3], 16) } : null;
1434
1447
  }
1435
- function qe(t, o, c) {
1436
- return "#" + [t, o, c].map((p) => {
1437
- const i = Math.round(Math.max(0, Math.min(255, p))).toString(16);
1438
- return i.length === 1 ? "0" + i : i;
1448
+ function Ze(t, r, a) {
1449
+ return "#" + [t, r, a].map((h) => {
1450
+ const c = Math.round(Math.max(0, Math.min(255, h))).toString(16);
1451
+ return c.length === 1 ? "0" + c : c;
1439
1452
  }).join("");
1440
1453
  }
1441
- function Ye(t, o, c) {
1442
- t /= 255, o /= 255, c /= 255;
1443
- const p = Math.max(t, o, c), i = Math.min(t, o, c);
1444
- let s = 0, h = 0;
1445
- const d = (p + i) / 2;
1446
- if (p !== i) {
1447
- const u = p - i;
1448
- switch (h = d > 0.5 ? u / (2 - p - i) : u / (p + i), p) {
1454
+ function Qe(t, r, a) {
1455
+ t /= 255, r /= 255, a /= 255;
1456
+ const h = Math.max(t, r, a), c = Math.min(t, r, a);
1457
+ let s = 0, m = 0;
1458
+ const d = (h + c) / 2;
1459
+ if (h !== c) {
1460
+ const u = h - c;
1461
+ switch (m = d > 0.5 ? u / (2 - h - c) : u / (h + c), h) {
1449
1462
  case t:
1450
- s = ((o - c) / u + (o < c ? 6 : 0)) / 6;
1463
+ s = ((r - a) / u + (r < a ? 6 : 0)) / 6;
1451
1464
  break;
1452
- case o:
1453
- s = ((c - t) / u + 2) / 6;
1465
+ case r:
1466
+ s = ((a - t) / u + 2) / 6;
1454
1467
  break;
1455
- case c:
1456
- s = ((t - o) / u + 4) / 6;
1468
+ case a:
1469
+ s = ((t - r) / u + 4) / 6;
1457
1470
  break;
1458
1471
  }
1459
1472
  }
1460
- return { h: Math.round(s * 360), s: Math.round(h * 100), l: Math.round(d * 100) };
1473
+ return { h: Math.round(s * 360), s: Math.round(m * 100), l: Math.round(d * 100) };
1461
1474
  }
1462
- function Ge(t, o, c) {
1463
- t /= 255, o /= 255, c /= 255;
1464
- const p = Math.max(t, o, c), i = Math.min(t, o, c);
1475
+ function et(t, r, a) {
1476
+ t /= 255, r /= 255, a /= 255;
1477
+ const h = Math.max(t, r, a), c = Math.min(t, r, a);
1465
1478
  let s = 0;
1466
- const h = p, d = p - i, u = p === 0 ? 0 : d / p;
1467
- if (p !== i)
1468
- switch (p) {
1479
+ const m = h, d = h - c, u = h === 0 ? 0 : d / h;
1480
+ if (h !== c)
1481
+ switch (h) {
1469
1482
  case t:
1470
- s = ((o - c) / d + (o < c ? 6 : 0)) / 6;
1483
+ s = ((r - a) / d + (r < a ? 6 : 0)) / 6;
1471
1484
  break;
1472
- case o:
1473
- s = ((c - t) / d + 2) / 6;
1485
+ case r:
1486
+ s = ((a - t) / d + 2) / 6;
1474
1487
  break;
1475
- case c:
1476
- s = ((t - o) / d + 4) / 6;
1488
+ case a:
1489
+ s = ((t - r) / d + 4) / 6;
1477
1490
  break;
1478
1491
  }
1479
- return { h: Math.round(s * 360), s: Math.round(u * 100), v: Math.round(h * 100) };
1492
+ return { h: Math.round(s * 360), s: Math.round(u * 100), v: Math.round(m * 100) };
1480
1493
  }
1481
- function Kt(t, o, c) {
1482
- o /= 100, c /= 100;
1483
- const p = Math.floor(t / 60) % 6, i = t / 60 - Math.floor(t / 60), s = c * (1 - o), h = c * (1 - i * o), d = c * (1 - (1 - i) * o);
1484
- let u = 0, f = 0, y = 0;
1485
- switch (p) {
1494
+ function ln(t, r, a) {
1495
+ r /= 100, a /= 100;
1496
+ const h = Math.floor(t / 60) % 6, c = t / 60 - Math.floor(t / 60), s = a * (1 - r), m = a * (1 - c * r), d = a * (1 - (1 - c) * r);
1497
+ let u = 0, f = 0, v = 0;
1498
+ switch (h) {
1486
1499
  case 0:
1487
- u = c, f = d, y = s;
1500
+ u = a, f = d, v = s;
1488
1501
  break;
1489
1502
  case 1:
1490
- u = h, f = c, y = s;
1503
+ u = m, f = a, v = s;
1491
1504
  break;
1492
1505
  case 2:
1493
- u = s, f = c, y = d;
1506
+ u = s, f = a, v = d;
1494
1507
  break;
1495
1508
  case 3:
1496
- u = s, f = h, y = c;
1509
+ u = s, f = m, v = a;
1497
1510
  break;
1498
1511
  case 4:
1499
- u = d, f = s, y = c;
1512
+ u = d, f = s, v = a;
1500
1513
  break;
1501
1514
  case 5:
1502
- u = c, f = s, y = h;
1515
+ u = a, f = s, v = m;
1503
1516
  break;
1504
1517
  }
1505
- return { r: Math.round(u * 255), g: Math.round(f * 255), b: Math.round(y * 255) };
1518
+ return { r: Math.round(u * 255), g: Math.round(f * 255), b: Math.round(v * 255) };
1506
1519
  }
1507
- function zt(t, o, c) {
1508
- t /= 360, o /= 100, c /= 100;
1509
- let p, i, s;
1510
- if (o === 0)
1511
- p = i = s = c;
1520
+ function sn(t, r, a) {
1521
+ t /= 360, r /= 100, a /= 100;
1522
+ let h, c, s;
1523
+ if (r === 0)
1524
+ h = c = s = a;
1512
1525
  else {
1513
- const h = (f, y, N) => (N < 0 && (N += 1), N > 1 && (N -= 1), N < 0.16666666666666666 ? f + (y - f) * 6 * N : N < 0.5 ? y : N < 0.6666666666666666 ? f + (y - f) * (0.6666666666666666 - N) * 6 : f), d = c < 0.5 ? c * (1 + o) : c + o - c * o, u = 2 * c - d;
1514
- p = h(u, d, t + 1 / 3), i = h(u, d, t), s = h(u, d, t - 1 / 3);
1526
+ const m = (f, v, L) => (L < 0 && (L += 1), L > 1 && (L -= 1), L < 0.16666666666666666 ? f + (v - f) * 6 * L : L < 0.5 ? v : L < 0.6666666666666666 ? f + (v - f) * (0.6666666666666666 - L) * 6 : f), d = a < 0.5 ? a * (1 + r) : a + r - a * r, u = 2 * a - d;
1527
+ h = m(u, d, t + 1 / 3), c = m(u, d, t), s = m(u, d, t - 1 / 3);
1515
1528
  }
1516
- return { r: Math.round(p * 255), g: Math.round(i * 255), b: Math.round(s * 255) };
1529
+ return { r: Math.round(h * 255), g: Math.round(c * 255), b: Math.round(s * 255) };
1517
1530
  }
1518
- const Ue = ct(
1519
- ({ value: t, onChange: o, placeholder: c, mode: p = "border", beforeOpen: i, onClose: s }, h) => {
1520
- const [d, u] = H(!1), f = B(null), y = B(null), N = B(null), S = B(null), m = B(null), [T, w] = H(-1e4), [M, n] = H(-1e4), [r, k] = H(t), [g, l] = H(t), x = B(t), [_, V] = H("hex"), [b, E] = H({ h: 0, s: 100, v: 100 }), [$, P] = H({ r: 0, g: 0, b: 0 }), [G, O] = H({ h: 0, s: 0, l: 0 }), [j, W] = H(!1), [I, F] = H(!1), [z, q] = H(!1), ee = A(() => {
1521
- let L = 0;
1531
+ const Ye = ht(
1532
+ ({ value: t, onChange: r, placeholder: a, mode: h = "border", beforeOpen: c, onClose: s }, m) => {
1533
+ const [d, u] = A(!1), f = B(null), v = B(null), L = B(null), H = B(null), p = B(null), [T, b] = A(-1e4), [M, g] = A(-1e4), [o, x] = A(t), [i, l] = A(t), y = B(t), [$, W] = A("hex"), [k, D] = A({ h: 0, s: 100, v: 100 }), [E, P] = A({ r: 0, g: 0, b: 0 }), [V, O] = A({ h: 0, s: 0, l: 0 }), [K, j] = A(!1), [_, I] = A(!1), [F, U] = A(!1), Q = S(() => {
1534
+ let n = 0;
1522
1535
  const R = 3, Z = () => {
1523
- if (L >= R * 2) {
1524
- q(!1);
1536
+ if (n >= R * 2) {
1537
+ U(!1);
1525
1538
  return;
1526
1539
  }
1527
- q((ce) => !ce), L++, setTimeout(Z, 100);
1540
+ U((pe) => !pe), n++, setTimeout(Z, 100);
1528
1541
  };
1529
1542
  Z();
1530
1543
  }, []);
1531
- st(h, () => ({
1532
- triggerButtonFlash: ee
1544
+ at(m, () => ({
1545
+ triggerButtonFlash: Q
1533
1546
  }));
1534
- const te = Te(() => p === "background" ? jt : Wt, [p]), ve = g || "#d9d9d9", ne = A((L) => {
1535
- k(L), l(L);
1536
- const R = Ut(L);
1537
- R && (P(R), O(Ye(R.r, R.g, R.b)), E(Ge(R.r, R.g, R.b)));
1538
- }, []), ue = A(() => {
1539
- const L = Kt(b.h, b.s, b.v), R = qe(L.r, L.g, L.b);
1540
- P(L), O(Ye(L.r, L.g, L.b)), k(R), l(R);
1541
- }, [b]);
1542
- K(() => {
1547
+ const ee = Me(() => h === "background" ? on : nn, [h]), we = i || "#d9d9d9", ne = S((n) => {
1548
+ x(n), l(n);
1549
+ const R = rn(n);
1550
+ R && (P(R), O(Qe(R.r, R.g, R.b)), D(et(R.r, R.g, R.b)));
1551
+ }, []), ue = S(() => {
1552
+ const n = ln(k.h, k.s, k.v), R = Ze(n.r, n.g, n.b);
1553
+ P(n), O(Qe(n.r, n.g, n.b)), x(R), l(R);
1554
+ }, [k]);
1555
+ z(() => {
1543
1556
  ne(t);
1544
- }, [t, ne]), K(() => {
1557
+ }, [t, ne]), z(() => {
1545
1558
  ue();
1546
- }, [b, ue]);
1547
- const ae = A((L) => {
1548
- let R = L.parentElement;
1559
+ }, [k, ue]);
1560
+ const ae = S((n) => {
1561
+ let R = n.parentElement;
1549
1562
  for (; R; ) {
1550
1563
  const Z = window.getComputedStyle(R);
1551
1564
  if (Z.overflowY === "auto" || Z.overflowY === "scroll")
@@ -1553,292 +1566,292 @@ const Ue = ct(
1553
1566
  R = R.parentElement;
1554
1567
  }
1555
1568
  return null;
1556
- }, []), Y = A(() => {
1557
- if (!d || !y.current || !N.current || !f.current) return;
1558
- const L = y.current, R = N.current, Z = f.current, ce = L.getBoundingClientRect(), de = R.getBoundingClientRect(), Pe = Z.getBoundingClientRect();
1559
- if (Pe.width === 0 && Pe.height === 0) {
1560
- requestAnimationFrame(Y);
1569
+ }, []), q = S(() => {
1570
+ if (!d || !v.current || !L.current || !f.current) return;
1571
+ const n = v.current, R = L.current, Z = f.current, pe = n.getBoundingClientRect(), he = R.getBoundingClientRect(), ke = Z.getBoundingClientRect();
1572
+ if (ke.width === 0 && ke.height === 0) {
1573
+ requestAnimationFrame(q);
1561
1574
  return;
1562
1575
  }
1563
- const Ae = window.innerWidth, He = window.innerHeight, le = 8, Oe = 10, ze = Oe / 2, Ee = ce.width || 260, be = ce.height || 348;
1564
- L.style.maxHeight = "", L.style.overflowY = "";
1565
- let Re = de.top, Me, C = "right";
1566
- if (de.right + le + Ee <= Ae - le)
1567
- Me = de.right + le, C = "right";
1568
- else if (de.left - Ee - le >= le)
1569
- Me = de.left - Ee - le, C = "left";
1576
+ const He = window.innerWidth, Ie = window.innerHeight, ce = 8, Ae = 10, Ee = Ae / 2, Re = pe.width || 260, Fe = pe.height || 348;
1577
+ n.style.maxHeight = "", n.style.overflowY = "";
1578
+ let $e = he.top, ve, Ce = "right";
1579
+ if (he.right + ce + Re <= He - ce)
1580
+ ve = he.right + ce, Ce = "right";
1581
+ else if (he.left - Re - ce >= ce)
1582
+ ve = he.left - Re - ce, Ce = "left";
1570
1583
  else {
1571
- const he = Ae - de.right - le, pe = de.left - le;
1572
- he >= pe ? (Me = Math.max(le, Ae - Ee - le), C = "right") : (Me = le, C = "left");
1584
+ const oe = He - he.right - ce, X = he.left - ce;
1585
+ oe >= X ? (ve = Math.max(ce, He - Re - ce), Ce = "right") : (ve = ce, Ce = "left");
1573
1586
  }
1574
- Re + be > He - le && (Re = Math.max(le, He - be - le)), w(Re), n(Me), L.dataset.placement = C;
1575
- let U = de.top + de.height / 2 - Re - ze;
1576
- const se = le, re = Math.max(se, be - Oe - le);
1577
- U = Math.max(se, Math.min(re, U)), L.style.setProperty("--triangle-top", `${U}px`);
1587
+ $e + Fe > Ie - ce && ($e = Math.max(ce, Ie - Fe - ce)), b($e), g(ve), n.dataset.placement = Ce;
1588
+ let C = he.top + he.height / 2 - $e - Ee;
1589
+ const N = ce, Y = Math.max(N, Fe - Ae - ce);
1590
+ C = Math.max(N, Math.min(Y, C)), n.style.setProperty("--triangle-top", `${C}px`);
1578
1591
  }, [d]);
1579
- K(() => {
1592
+ z(() => {
1580
1593
  if (!d) return;
1581
- const L = requestAnimationFrame(Y), R = y.current, Z = R ? ae(R) : null, ce = () => requestAnimationFrame(Y);
1582
- return Z && Z.addEventListener("scroll", ce, !0), () => {
1583
- cancelAnimationFrame(L), Z && Z.removeEventListener("scroll", ce, !0);
1594
+ const n = requestAnimationFrame(q), R = v.current, Z = R ? ae(R) : null, pe = () => requestAnimationFrame(q);
1595
+ return Z && Z.addEventListener("scroll", pe, !0), () => {
1596
+ cancelAnimationFrame(n), Z && Z.removeEventListener("scroll", pe, !0);
1584
1597
  };
1585
- }, [d, Y, ae]), K(() => {
1586
- d && requestAnimationFrame(Y);
1587
- }, [_, d, Y]);
1588
- const oe = A(() => {
1598
+ }, [d, q, ae]), z(() => {
1599
+ d && requestAnimationFrame(q);
1600
+ }, [$, d, q]);
1601
+ const te = S(() => {
1589
1602
  if (d)
1590
1603
  s == null || s();
1591
1604
  else {
1592
- if (i && i() === !1) return;
1593
- x.current = t, l(t), ne(t);
1605
+ if (c && c() === !1) return;
1606
+ y.current = t, l(t), ne(t);
1594
1607
  }
1595
1608
  u(!d);
1596
- }, [d, t, ne, i, s]), J = A((L) => {
1597
- ne(L);
1598
- }, [ne]), X = A((L) => {
1599
- const R = L.target.value;
1600
- k(R), (/^#[0-9A-Fa-f]{6}$/.test(R) || /^#[0-9A-Fa-f]{3}$/.test(R)) && ne(R);
1601
- }, [ne]), ge = A(() => {
1602
- r !== g && (/^#[0-9A-Fa-f]{6}$/.test(r) || /^#[0-9A-Fa-f]{3}$/.test(r) ? ne(r) : (k(g), ne(g)));
1603
- }, [r, g, ne]), Be = A(() => {
1604
- const L = qe($.r, $.g, $.b);
1605
- k(L), l(L), O(Ye($.r, $.g, $.b)), E(Ge($.r, $.g, $.b));
1606
- }, [$]), ye = A(() => {
1607
- const L = zt(G.h, G.s, G.l), R = qe(L.r, L.g, L.b);
1608
- k(R), l(R), P(L), E(Ge(L.r, L.g, L.b));
1609
- }, [G]), Ce = A((L) => {
1610
- if (!S.current) return;
1611
- const R = S.current.getBoundingClientRect();
1612
- let Z = Math.max(0, Math.min(100, (L.clientX - R.left) / R.width * 100)), ce = Math.max(0, Math.min(100, (L.clientY - R.top) / R.height * 100));
1613
- E((de) => ({ ...de, s: Z, v: 100 - ce }));
1614
- }, []), Se = A((L) => {
1615
- W(!0), Ce(L.nativeEvent);
1616
- }, [Ce]), Ne = A((L) => {
1617
- if (!m.current) return;
1618
- const R = m.current.getBoundingClientRect();
1619
- let Z = Math.max(0, Math.min(360, (L.clientX - R.left) / R.width * 360));
1620
- E((ce) => ({ ...ce, h: Z }));
1621
- }, []), Ie = A((L) => {
1622
- F(!0), Ne(L.nativeEvent);
1623
- }, [Ne]);
1624
- K(() => {
1625
- const L = (Z) => {
1626
- j && Ce(Z), I && Ne(Z);
1609
+ }, [d, t, ne, c, s]), J = S((n) => {
1610
+ ne(n);
1611
+ }, [ne]), G = S((n) => {
1612
+ const R = n.target.value;
1613
+ x(R), (/^#[0-9A-Fa-f]{6}$/.test(R) || /^#[0-9A-Fa-f]{3}$/.test(R)) && ne(R);
1614
+ }, [ne]), me = S(() => {
1615
+ o !== i && (/^#[0-9A-Fa-f]{6}$/.test(o) || /^#[0-9A-Fa-f]{3}$/.test(o) ? ne(o) : (x(i), ne(i)));
1616
+ }, [o, i, ne]), Te = S(() => {
1617
+ const n = Ze(E.r, E.g, E.b);
1618
+ x(n), l(n), O(Qe(E.r, E.g, E.b)), D(et(E.r, E.g, E.b));
1619
+ }, [E]), Be = S(() => {
1620
+ const n = sn(V.h, V.s, V.l), R = Ze(n.r, n.g, n.b);
1621
+ x(R), l(R), P(n), D(et(n.r, n.g, n.b));
1622
+ }, [V]), De = S((n) => {
1623
+ if (!H.current) return;
1624
+ const R = H.current.getBoundingClientRect();
1625
+ let Z = Math.max(0, Math.min(100, (n.clientX - R.left) / R.width * 100)), pe = Math.max(0, Math.min(100, (n.clientY - R.top) / R.height * 100));
1626
+ D((he) => ({ ...he, s: Z, v: 100 - pe }));
1627
+ }, []), ye = S((n) => {
1628
+ j(!0), De(n.nativeEvent);
1629
+ }, [De]), xe = S((n) => {
1630
+ if (!p.current) return;
1631
+ const R = p.current.getBoundingClientRect();
1632
+ let Z = Math.max(0, Math.min(360, (n.clientX - R.left) / R.width * 360));
1633
+ D((pe) => ({ ...pe, h: Z }));
1634
+ }, []), Se = S((n) => {
1635
+ I(!0), xe(n.nativeEvent);
1636
+ }, [xe]);
1637
+ z(() => {
1638
+ const n = (Z) => {
1639
+ K && De(Z), _ && xe(Z);
1627
1640
  }, R = () => {
1628
- W(!1), F(!1);
1641
+ j(!1), I(!1);
1629
1642
  };
1630
- return document.addEventListener("mousemove", L), document.addEventListener("mouseup", R), () => {
1631
- document.removeEventListener("mousemove", L), document.removeEventListener("mouseup", R);
1643
+ return document.addEventListener("mousemove", n), document.addEventListener("mouseup", R), () => {
1644
+ document.removeEventListener("mousemove", n), document.removeEventListener("mouseup", R);
1632
1645
  };
1633
- }, [j, I, Ce, Ne]), K(() => {
1634
- const L = (Z) => {
1646
+ }, [K, _, De, xe]), z(() => {
1647
+ const n = (Z) => {
1635
1648
  if (f.current && !f.current.contains(Z.target) && d) {
1636
- const ce = Z.target, de = ce.closest ? ce.closest(".tp-color-picker-input") : null;
1637
- if (de && de !== f.current) return;
1638
- Z.stopPropagation(), Z.preventDefault(), ee();
1649
+ const pe = Z.target, he = pe.closest ? pe.closest(".tp-color-picker-input") : null;
1650
+ if (he && he !== f.current) return;
1651
+ Z.stopPropagation(), Z.preventDefault(), Q();
1639
1652
  }
1640
1653
  }, R = () => {
1641
- d && requestAnimationFrame(Y);
1654
+ d && requestAnimationFrame(q);
1642
1655
  };
1643
- return document.addEventListener("pointerdown", L, !0), window.addEventListener("resize", R), window.addEventListener("scroll", R, !0), () => {
1644
- document.removeEventListener("pointerdown", L, !0), window.removeEventListener("resize", R), window.removeEventListener("scroll", R, !0);
1656
+ return document.addEventListener("pointerdown", n, !0), window.addEventListener("resize", R), window.addEventListener("scroll", R, !0), () => {
1657
+ document.removeEventListener("pointerdown", n, !0), window.removeEventListener("resize", R), window.removeEventListener("scroll", R, !0);
1645
1658
  };
1646
- }, [d, Y]);
1647
- const Ke = A(() => {
1648
- o(g), u(!1), s == null || s();
1649
- }, [g, o, s]), a = A(() => {
1650
- l(x.current), ne(x.current), u(!1), s == null || s();
1651
- }, [ne, s]), Q = A((L) => {
1652
- L.stopPropagation();
1659
+ }, [d, q]);
1660
+ const Ue = S(() => {
1661
+ r(i), u(!1), s == null || s();
1662
+ }, [i, r, s]), Pe = S(() => {
1663
+ l(y.current), ne(y.current), u(!1), s == null || s();
1664
+ }, [ne, s]), se = S((n) => {
1665
+ n.stopPropagation();
1653
1666
  }, []);
1654
- return /* @__PURE__ */ v("div", { ref: f, className: `tp-color-picker-input${d ? " tp-color-picker-input-open" : ""}`, onClick: Q, children: [
1667
+ return /* @__PURE__ */ w("div", { ref: f, className: `tp-color-picker-input${d ? " tp-color-picker-input-open" : ""}`, onClick: se, children: [
1655
1668
  /* @__PURE__ */ e(
1656
1669
  "button",
1657
1670
  {
1658
- ref: N,
1671
+ ref: L,
1659
1672
  type: "button",
1660
1673
  className: "tp-color-preview",
1661
- style: { backgroundColor: ve },
1662
- onMouseDown: (L) => L.preventDefault(),
1663
- onClick: oe
1674
+ style: { backgroundColor: we },
1675
+ onMouseDown: (n) => n.preventDefault(),
1676
+ onClick: te
1664
1677
  }
1665
1678
  ),
1666
1679
  /* @__PURE__ */ e(
1667
1680
  "input",
1668
1681
  {
1669
- value: r,
1682
+ value: o,
1670
1683
  type: "text",
1671
1684
  className: "tp-color-text-input",
1672
- placeholder: c || "#d9d9d9",
1673
- onChange: X,
1674
- onBlur: ge,
1675
- onMouseDown: Q,
1676
- onClick: Q
1685
+ placeholder: a || "#d9d9d9",
1686
+ onChange: G,
1687
+ onBlur: me,
1688
+ onMouseDown: se,
1689
+ onClick: se
1677
1690
  }
1678
1691
  ),
1679
- d && /* @__PURE__ */ v("div", { ref: y, className: "tp-color-panel", style: { position: "fixed", top: `${T}px`, left: `${M}px` }, onClick: Q, children: [
1692
+ d && /* @__PURE__ */ w("div", { ref: v, className: "tp-color-panel", style: { position: "fixed", top: `${T}px`, left: `${M}px` }, onClick: se, children: [
1680
1693
  /* @__PURE__ */ e(
1681
1694
  "div",
1682
1695
  {
1683
- ref: S,
1696
+ ref: H,
1684
1697
  className: "tp-sv-area",
1685
1698
  style: {
1686
- background: `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, transparent), hsl(${b.h}, 100%, 50%)`
1699
+ background: `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, transparent), hsl(${k.h}, 100%, 50%)`
1687
1700
  },
1688
- onMouseDown: Se,
1701
+ onMouseDown: ye,
1689
1702
  children: /* @__PURE__ */ e(
1690
1703
  "div",
1691
1704
  {
1692
1705
  className: "tp-sv-indicator",
1693
- style: { left: `${b.s}%`, top: `${100 - b.v}%` }
1706
+ style: { left: `${k.s}%`, top: `${100 - k.v}%` }
1694
1707
  }
1695
1708
  )
1696
1709
  }
1697
1710
  ),
1698
- /* @__PURE__ */ e("div", { ref: m, className: "tp-hue-bar", onMouseDown: Ie, children: /* @__PURE__ */ e(
1711
+ /* @__PURE__ */ e("div", { ref: p, className: "tp-hue-bar", onMouseDown: Se, children: /* @__PURE__ */ e(
1699
1712
  "div",
1700
1713
  {
1701
1714
  className: "tp-hue-indicator",
1702
- style: { left: `${b.h / 360 * 100}%` }
1715
+ style: { left: `${k.h / 360 * 100}%` }
1703
1716
  }
1704
1717
  ) }),
1705
1718
  /* @__PURE__ */ e("div", { className: "tp-color-section-label", children: "常用颜色" }),
1706
- /* @__PURE__ */ e("div", { className: "tp-color-grid tp-common-colors", children: te.map((L) => /* @__PURE__ */ e(
1719
+ /* @__PURE__ */ e("div", { className: "tp-color-grid tp-common-colors", children: ee.map((n) => /* @__PURE__ */ e(
1707
1720
  "button",
1708
1721
  {
1709
1722
  type: "button",
1710
- className: `tp-color-swatch${t === L ? " tp-color-swatch-selected" : ""}`,
1711
- style: { backgroundColor: L },
1712
- title: L,
1723
+ className: `tp-color-swatch${t === n ? " tp-color-swatch-selected" : ""}`,
1724
+ style: { backgroundColor: n },
1725
+ title: n,
1713
1726
  onMouseDown: (R) => R.preventDefault(),
1714
- onClick: () => J(L)
1727
+ onClick: () => J(n)
1715
1728
  },
1716
- L
1729
+ n
1717
1730
  )) }),
1718
- /* @__PURE__ */ e("div", { className: "tp-input-mode-tabs", children: ["hex", "rgb", "hsl"].map((L) => /* @__PURE__ */ e(
1731
+ /* @__PURE__ */ e("div", { className: "tp-input-mode-tabs", children: ["hex", "rgb", "hsl"].map((n) => /* @__PURE__ */ e(
1719
1732
  "button",
1720
1733
  {
1721
1734
  type: "button",
1722
- className: `tp-mode-tab${_ === L ? " active" : ""}`,
1723
- onClick: () => V(L),
1724
- children: L.toUpperCase()
1735
+ className: `tp-mode-tab${$ === n ? " active" : ""}`,
1736
+ onClick: () => W(n),
1737
+ children: n.toUpperCase()
1725
1738
  },
1726
- L
1739
+ n
1727
1740
  )) }),
1728
- _ === "hex" && /* @__PURE__ */ v("div", { className: "tp-color-input-row", children: [
1741
+ $ === "hex" && /* @__PURE__ */ w("div", { className: "tp-color-input-row", children: [
1729
1742
  /* @__PURE__ */ e("label", { children: "HEX" }),
1730
1743
  /* @__PURE__ */ e(
1731
1744
  "input",
1732
1745
  {
1733
- value: r,
1746
+ value: o,
1734
1747
  type: "text",
1735
1748
  className: "tp-color-input-field",
1736
1749
  placeholder: "#000000",
1737
- onChange: X,
1738
- onBlur: ge,
1739
- onMouseDown: Q,
1740
- onClick: Q
1750
+ onChange: G,
1751
+ onBlur: me,
1752
+ onMouseDown: se,
1753
+ onClick: se
1741
1754
  }
1742
1755
  )
1743
1756
  ] }),
1744
- _ === "rgb" && /* @__PURE__ */ v("div", { className: "tp-color-input-row tp-rgb-inline-row", children: [
1757
+ $ === "rgb" && /* @__PURE__ */ w("div", { className: "tp-color-input-row tp-rgb-inline-row", children: [
1745
1758
  /* @__PURE__ */ e("label", { children: "R" }),
1746
- /* @__PURE__ */ e("input", { type: "number", min: 0, max: 255, className: "tp-color-input-field", value: $.r, onChange: (L) => {
1747
- P((R) => ({ ...R, r: Number(L.target.value) })), setTimeout(Be, 0);
1748
- }, onMouseDown: Q, onClick: Q }),
1759
+ /* @__PURE__ */ e("input", { type: "number", min: 0, max: 255, className: "tp-color-input-field", value: E.r, onChange: (n) => {
1760
+ P((R) => ({ ...R, r: Number(n.target.value) })), setTimeout(Te, 0);
1761
+ }, onMouseDown: se, onClick: se }),
1749
1762
  /* @__PURE__ */ e("label", { children: "G" }),
1750
- /* @__PURE__ */ e("input", { type: "number", min: 0, max: 255, className: "tp-color-input-field", value: $.g, onChange: (L) => {
1751
- P((R) => ({ ...R, g: Number(L.target.value) })), setTimeout(Be, 0);
1752
- }, onMouseDown: Q, onClick: Q }),
1763
+ /* @__PURE__ */ e("input", { type: "number", min: 0, max: 255, className: "tp-color-input-field", value: E.g, onChange: (n) => {
1764
+ P((R) => ({ ...R, g: Number(n.target.value) })), setTimeout(Te, 0);
1765
+ }, onMouseDown: se, onClick: se }),
1753
1766
  /* @__PURE__ */ e("label", { children: "B" }),
1754
- /* @__PURE__ */ e("input", { type: "number", min: 0, max: 255, className: "tp-color-input-field", value: $.b, onChange: (L) => {
1755
- P((R) => ({ ...R, b: Number(L.target.value) })), setTimeout(Be, 0);
1756
- }, onMouseDown: Q, onClick: Q })
1767
+ /* @__PURE__ */ e("input", { type: "number", min: 0, max: 255, className: "tp-color-input-field", value: E.b, onChange: (n) => {
1768
+ P((R) => ({ ...R, b: Number(n.target.value) })), setTimeout(Te, 0);
1769
+ }, onMouseDown: se, onClick: se })
1757
1770
  ] }),
1758
- _ === "hsl" && /* @__PURE__ */ v("div", { className: "tp-color-input-row tp-hsl-inline-row", children: [
1771
+ $ === "hsl" && /* @__PURE__ */ w("div", { className: "tp-color-input-row tp-hsl-inline-row", children: [
1759
1772
  /* @__PURE__ */ e("label", { children: "H" }),
1760
- /* @__PURE__ */ e("input", { type: "number", min: 0, max: 360, className: "tp-color-input-field", value: G.h, onChange: (L) => {
1761
- O((R) => ({ ...R, h: Number(L.target.value) })), setTimeout(ye, 0);
1762
- }, onMouseDown: Q, onClick: Q }),
1773
+ /* @__PURE__ */ e("input", { type: "number", min: 0, max: 360, className: "tp-color-input-field", value: V.h, onChange: (n) => {
1774
+ O((R) => ({ ...R, h: Number(n.target.value) })), setTimeout(Be, 0);
1775
+ }, onMouseDown: se, onClick: se }),
1763
1776
  /* @__PURE__ */ e("span", { className: "tp-input-unit", children: "°" }),
1764
1777
  /* @__PURE__ */ e("label", { children: "S" }),
1765
- /* @__PURE__ */ e("input", { type: "number", min: 0, max: 100, className: "tp-color-input-field", value: G.s, onChange: (L) => {
1766
- O((R) => ({ ...R, s: Number(L.target.value) })), setTimeout(ye, 0);
1767
- }, onMouseDown: Q, onClick: Q }),
1778
+ /* @__PURE__ */ e("input", { type: "number", min: 0, max: 100, className: "tp-color-input-field", value: V.s, onChange: (n) => {
1779
+ O((R) => ({ ...R, s: Number(n.target.value) })), setTimeout(Be, 0);
1780
+ }, onMouseDown: se, onClick: se }),
1768
1781
  /* @__PURE__ */ e("span", { className: "tp-input-unit", children: "%" }),
1769
1782
  /* @__PURE__ */ e("label", { children: "L" }),
1770
- /* @__PURE__ */ e("input", { type: "number", min: 0, max: 100, className: "tp-color-input-field", value: G.l, onChange: (L) => {
1771
- O((R) => ({ ...R, l: Number(L.target.value) })), setTimeout(ye, 0);
1772
- }, onMouseDown: Q, onClick: Q }),
1783
+ /* @__PURE__ */ e("input", { type: "number", min: 0, max: 100, className: "tp-color-input-field", value: V.l, onChange: (n) => {
1784
+ O((R) => ({ ...R, l: Number(n.target.value) })), setTimeout(Be, 0);
1785
+ }, onMouseDown: se, onClick: se }),
1773
1786
  /* @__PURE__ */ e("span", { className: "tp-input-unit", children: "%" })
1774
1787
  ] }),
1775
- /* @__PURE__ */ v("div", { className: "tp-color-footer-row", children: [
1788
+ /* @__PURE__ */ w("div", { className: "tp-color-footer-row", children: [
1776
1789
  /* @__PURE__ */ e("div", { className: "tp-color-preview-label", children: "当前颜色" }),
1777
- /* @__PURE__ */ e("div", { className: "tp-color-preview-box", style: { backgroundColor: ve } }),
1778
- /* @__PURE__ */ v("div", { className: "tp-color-actions", children: [
1779
- /* @__PURE__ */ e("button", { type: "button", className: `tp-color-btn tp-color-btn-cancel${z ? " tp-color-btn-flash" : ""}`, title: "取消", onMouseDown: (L) => L.preventDefault(), onClick: a, children: "✕" }),
1780
- /* @__PURE__ */ e("button", { type: "button", className: `tp-color-btn tp-color-btn-confirm${z ? " tp-color-btn-flash" : ""}`, title: "确认", onMouseDown: (L) => L.preventDefault(), onClick: Ke, children: "✓" })
1790
+ /* @__PURE__ */ e("div", { className: "tp-color-preview-box", style: { backgroundColor: we } }),
1791
+ /* @__PURE__ */ w("div", { className: "tp-color-actions", children: [
1792
+ /* @__PURE__ */ e("button", { type: "button", className: `tp-color-btn tp-color-btn-cancel${F ? " tp-color-btn-flash" : ""}`, title: "取消", onMouseDown: (n) => n.preventDefault(), onClick: Pe, children: "✕" }),
1793
+ /* @__PURE__ */ e("button", { type: "button", className: `tp-color-btn tp-color-btn-confirm${F ? " tp-color-btn-flash" : ""}`, title: "确认", onMouseDown: (n) => n.preventDefault(), onClick: Ue, children: "✓" })
1781
1794
  ] })
1782
1795
  ] })
1783
1796
  ] })
1784
1797
  ] });
1785
1798
  }
1786
1799
  );
1787
- Ue.displayName = "ColorPickerInput";
1788
- const Vt = ({ editor: t, visible: o, onVisibleChange: c }) => {
1789
- const p = De.getInstance(), i = (m) => p.t(m), [s, h] = H({ borderColor: "#d9d9d9", borderWidth: 1 }), [d, u] = H("");
1790
- K(() => {
1791
- if (o) {
1800
+ Ye.displayName = "ColorPickerInput";
1801
+ const cn = ({ editor: t, visible: r, onVisibleChange: a }) => {
1802
+ const h = Le.getInstance(), c = (p) => h.t(p), [s, m] = A({ borderColor: "#d9d9d9", borderWidth: 1 }), [d, u] = A("");
1803
+ z(() => {
1804
+ if (r) {
1792
1805
  document.body.style.overflow = "hidden";
1793
- const { state: m } = t, { $from: T } = m.selection;
1794
- let w = null;
1795
- m.doc.nodesBetween(T.start(), T.end(), (M) => M.type.name === "table" ? (w = M, !1) : !0), h(w ? {
1796
- borderColor: w.attrs.borderColor || "#d9d9d9",
1797
- borderWidth: w.attrs.borderWidth ? parseInt(w.attrs.borderWidth, 10) : 1
1806
+ const { state: p } = t, { $from: T } = p.selection;
1807
+ let b = null;
1808
+ p.doc.nodesBetween(T.start(), T.end(), (M) => M.type.name === "table" ? (b = M, !1) : !0), m(b ? {
1809
+ borderColor: b.attrs.borderColor || "#d9d9d9",
1810
+ borderWidth: b.attrs.borderWidth ? parseInt(b.attrs.borderWidth, 10) : 1
1798
1811
  } : { borderColor: "#d9d9d9", borderWidth: 1 });
1799
1812
  } else
1800
1813
  document.body.style.overflow = "";
1801
1814
  return () => {
1802
1815
  document.body.style.overflow = "";
1803
1816
  };
1804
- }, [o, t]);
1805
- const f = A(() => {
1817
+ }, [r, t]);
1818
+ const f = S(() => {
1806
1819
  u("");
1807
- }, []), y = A((m) => (u(m), !0), []), N = A(() => {
1808
- d || (t.commands.focus(), c(!1));
1809
- }, [d, t, c]), S = A(() => {
1820
+ }, []), v = S((p) => (u(p), !0), []), L = S(() => {
1821
+ d || (t.commands.focus(), a(!1));
1822
+ }, [d, t, a]), H = S(() => {
1810
1823
  d || (t.chain().focus().setTableBorder({
1811
1824
  color: s.borderColor,
1812
1825
  width: `${s.borderWidth}px`,
1813
1826
  style: "solid"
1814
- }).run(), c(!1));
1815
- }, [d, t, s, c]);
1816
- return o ? _e(
1817
- /* @__PURE__ */ e("div", { className: "tp-modal-overlay", onMouseDown: (m) => {
1818
- m.target === m.currentTarget && N();
1819
- }, children: /* @__PURE__ */ v("div", { className: "tp-modal", onMouseDown: (m) => m.stopPropagation(), children: [
1820
- /* @__PURE__ */ v("div", { className: "tp-modal-header", children: [
1821
- /* @__PURE__ */ e("h3", { className: "tp-modal-title", children: i("table.tableSettings") }),
1822
- /* @__PURE__ */ e("button", { className: "tp-modal-close", onClick: N, children: "×" })
1827
+ }).run(), a(!1));
1828
+ }, [d, t, s, a]);
1829
+ return r ? _e(
1830
+ /* @__PURE__ */ e("div", { className: "tp-modal-overlay", onMouseDown: (p) => {
1831
+ p.target === p.currentTarget && L();
1832
+ }, children: /* @__PURE__ */ w("div", { className: "tp-modal", onMouseDown: (p) => p.stopPropagation(), children: [
1833
+ /* @__PURE__ */ w("div", { className: "tp-modal-header", children: [
1834
+ /* @__PURE__ */ e("h3", { className: "tp-modal-title", children: c("table.tableSettings") }),
1835
+ /* @__PURE__ */ e("button", { className: "tp-modal-close", onClick: L, children: "×" })
1823
1836
  ] }),
1824
- /* @__PURE__ */ v("div", { className: "tp-modal-body", children: [
1825
- /* @__PURE__ */ v("div", { className: "tp-form-item", children: [
1826
- /* @__PURE__ */ e("label", { className: "tp-form-label", children: i("table.borderColor") }),
1837
+ /* @__PURE__ */ w("div", { className: "tp-modal-body", children: [
1838
+ /* @__PURE__ */ w("div", { className: "tp-form-item", children: [
1839
+ /* @__PURE__ */ e("label", { className: "tp-form-label", children: c("table.borderColor") }),
1827
1840
  /* @__PURE__ */ e(
1828
- Ue,
1841
+ Ye,
1829
1842
  {
1830
1843
  value: s.borderColor,
1831
- onChange: (m) => h((T) => ({ ...T, borderColor: m })),
1844
+ onChange: (p) => m((T) => ({ ...T, borderColor: p })),
1832
1845
  mode: "border",
1833
1846
  placeholder: "#d9d9d9",
1834
- beforeOpen: () => y("border"),
1847
+ beforeOpen: () => v("border"),
1835
1848
  onClose: f
1836
1849
  }
1837
1850
  )
1838
1851
  ] }),
1839
- /* @__PURE__ */ v("div", { className: "tp-form-item", children: [
1840
- /* @__PURE__ */ e("label", { className: "tp-form-label", children: i("table.borderWidth") }),
1841
- /* @__PURE__ */ v("div", { className: "tp-input-with-suffix", children: [
1852
+ /* @__PURE__ */ w("div", { className: "tp-form-item", children: [
1853
+ /* @__PURE__ */ e("label", { className: "tp-form-label", children: c("table.borderWidth") }),
1854
+ /* @__PURE__ */ w("div", { className: "tp-input-with-suffix", children: [
1842
1855
  /* @__PURE__ */ e(
1843
1856
  "input",
1844
1857
  {
@@ -1847,39 +1860,39 @@ const Vt = ({ editor: t, visible: o, onVisibleChange: c }) => {
1847
1860
  min: 0,
1848
1861
  max: 10,
1849
1862
  value: s.borderWidth,
1850
- onChange: (m) => h((T) => ({ ...T, borderWidth: Number(m.target.value) }))
1863
+ onChange: (p) => m((T) => ({ ...T, borderWidth: Number(p.target.value) }))
1851
1864
  }
1852
1865
  ),
1853
1866
  /* @__PURE__ */ e("span", { className: "tp-input-suffix", children: "px" })
1854
1867
  ] })
1855
1868
  ] })
1856
1869
  ] }),
1857
- /* @__PURE__ */ v("div", { className: "tp-modal-footer", children: [
1858
- /* @__PURE__ */ e("button", { className: "tp-btn tp-btn-default", onClick: N, children: i("common.cancel") }),
1859
- /* @__PURE__ */ e("button", { className: "tp-btn tp-btn-primary", onClick: S, children: i("common.confirm") })
1870
+ /* @__PURE__ */ w("div", { className: "tp-modal-footer", children: [
1871
+ /* @__PURE__ */ e("button", { className: "tp-btn tp-btn-default", onClick: L, children: c("common.cancel") }),
1872
+ /* @__PURE__ */ e("button", { className: "tp-btn tp-btn-primary", onClick: H, children: c("common.confirm") })
1860
1873
  ] })
1861
1874
  ] }) }),
1862
1875
  document.body
1863
1876
  ) : null;
1864
- }, Jt = [
1877
+ }, an = [
1865
1878
  { value: "left", labelKey: "table.alignLeft" },
1866
1879
  { value: "center", labelKey: "table.alignCenter" },
1867
1880
  { value: "right", labelKey: "table.alignRight" },
1868
1881
  { value: "justify", labelKey: "table.alignJustify" }
1869
- ], qt = [
1882
+ ], dn = [
1870
1883
  { value: "top", labelKey: "table.valignTop" },
1871
1884
  { value: "middle", labelKey: "table.valignMiddle" },
1872
1885
  { value: "bottom", labelKey: "table.valignBottom" }
1873
1886
  ];
1874
- function Yt(t) {
1875
- const o = t.attrs.borderWidth || "1px", c = t.attrs.borderStyle || "solid", p = t.attrs.borderColor || "#d9d9d9";
1876
- return `${o} ${c} ${p}`;
1887
+ function un(t) {
1888
+ const r = t.attrs.borderWidth || "1px", a = t.attrs.borderStyle || "solid", h = t.attrs.borderColor || "#d9d9d9";
1889
+ return `${r} ${a} ${h}`;
1877
1890
  }
1878
- function we(t, o, c, p, i, s) {
1879
- const h = t === 0, d = t + p >= i.height, u = o === 0, f = o + c >= i.width;
1891
+ function ge(t, r, a, h, c, s) {
1892
+ const m = t === 0, d = t + h >= c.height, u = r === 0, f = r + a >= c.width;
1880
1893
  switch (s) {
1881
1894
  case "top":
1882
- return h;
1895
+ return m;
1883
1896
  case "bottom":
1884
1897
  return d;
1885
1898
  case "left":
@@ -1890,281 +1903,281 @@ function we(t, o, c, p, i, s) {
1890
1903
  return !1;
1891
1904
  }
1892
1905
  }
1893
- function We(t, o, c, p, i, s, h, d) {
1894
- const u = t.attrs.colspan || 1, f = t.attrs.rowspan || 1, y = { ...t.attrs };
1895
- switch (h) {
1906
+ function Je(t, r, a, h, c, s, m, d) {
1907
+ const u = t.attrs.colspan || 1, f = t.attrs.rowspan || 1, v = { ...t.attrs };
1908
+ switch (m) {
1896
1909
  case "left":
1897
- y.borderLeft = d;
1910
+ v.borderLeft = d;
1898
1911
  break;
1899
1912
  case "right":
1900
- y.borderRight = d;
1913
+ v.borderRight = d;
1901
1914
  break;
1902
1915
  case "top":
1903
- y.borderTop = d;
1916
+ v.borderTop = d;
1904
1917
  break;
1905
1918
  case "bottom":
1906
- y.borderBottom = d;
1919
+ v.borderBottom = d;
1907
1920
  break;
1908
1921
  }
1909
- return y.borderLeft || (y.borderLeft = we(o, c, u, f, p, "left") && i ? i : s), y.borderRight || (y.borderRight = we(o, c, u, f, p, "right") && i ? i : s), y.borderTop || (y.borderTop = we(o, c, u, f, p, "top") && i ? i : s), y.borderBottom || (y.borderBottom = we(o, c, u, f, p, "bottom") && i ? i : s), y;
1922
+ return v.borderLeft || (v.borderLeft = ge(r, a, u, f, h, "left") && c ? c : s), v.borderRight || (v.borderRight = ge(r, a, u, f, h, "right") && c ? c : s), v.borderTop || (v.borderTop = ge(r, a, u, f, h, "top") && c ? c : s), v.borderBottom || (v.borderBottom = ge(r, a, u, f, h, "bottom") && c ? c : s), v;
1910
1923
  }
1911
- function Gt(t, o, c, p, i, s, h, d, u, f) {
1912
- const y = t.attrs.colspan || 1, N = t.attrs.rowspan || 1;
1924
+ function pn(t, r, a, h, c, s, m, d, u, f) {
1925
+ const v = t.attrs.colspan || 1, L = t.attrs.rowspan || 1;
1913
1926
  return f ? {
1914
1927
  ...t.attrs,
1915
- borderLeft: we(o, c, y, N, p, "left") && i ? i : s,
1916
- borderRight: we(o, c, y, N, p, "right") && i ? i : s,
1917
- borderTop: we(o, c, y, N, p, "top") && i ? i : s,
1918
- borderBottom: we(o, c, y, N, p, "bottom") && i ? i : s,
1919
- backgroundColor: h,
1928
+ borderLeft: ge(r, a, v, L, h, "left") && c ? c : s,
1929
+ borderRight: ge(r, a, v, L, h, "right") && c ? c : s,
1930
+ borderTop: ge(r, a, v, L, h, "top") && c ? c : s,
1931
+ borderBottom: ge(r, a, v, L, h, "bottom") && c ? c : s,
1932
+ backgroundColor: m,
1920
1933
  textAlign: d,
1921
1934
  verticalAlign: u
1922
- } : { ...t.attrs, backgroundColor: h, textAlign: d, verticalAlign: u };
1935
+ } : { ...t.attrs, backgroundColor: m, textAlign: d, verticalAlign: u };
1923
1936
  }
1924
- const Xt = ({ editor: t, visible: o, onVisibleChange: c }) => {
1925
- const p = De.getInstance(), i = (r) => p.t(r), [s, h] = H({
1937
+ const hn = ({ editor: t, visible: r, onVisibleChange: a }) => {
1938
+ const h = Le.getInstance(), c = (o) => h.t(o), [s, m] = A({
1926
1939
  borderColor: "#d9d9d9",
1927
1940
  borderWidth: 1,
1928
1941
  backgroundColor: "#ffffff",
1929
1942
  textAlign: "left",
1930
1943
  verticalAlign: "top"
1931
- }), [d, u] = H({ borderColor: "#d9d9d9", borderWidth: 1 }), [f, y] = H(""), N = B(null), S = B(null), m = A(() => {
1932
- const r = f === "border" ? N.current : S.current;
1933
- r == null || r.triggerButtonFlash();
1934
- }, [f]), T = A((r) => f && f !== r ? (m(), !1) : (y(r), !0), [f, m]), w = A(() => {
1935
- const { state: r } = t, { selection: k } = r;
1936
- if ("$anchorCell" in k && k.$anchorCell) {
1937
- const x = k.$anchorCell;
1938
- let _ = null;
1939
- return r.doc.nodesBetween(x.pos, x.pos + 1, (V) => V.type.name === "tableCell" || V.type.name === "tableHeader" ? (_ = V, !1) : !0), (_ == null ? void 0 : _.attrs) || null;
1944
+ }), [d, u] = A({ borderColor: "#d9d9d9", borderWidth: 1 }), [f, v] = A(""), L = B(null), H = B(null), p = S(() => {
1945
+ const o = f === "border" ? L.current : H.current;
1946
+ o == null || o.triggerButtonFlash();
1947
+ }, [f]), T = S((o) => f && f !== o ? (p(), !1) : (v(o), !0), [f, p]), b = S(() => {
1948
+ const { state: o } = t, { selection: x } = o;
1949
+ if ("$anchorCell" in x && x.$anchorCell) {
1950
+ const y = x.$anchorCell;
1951
+ let $ = null;
1952
+ return o.doc.nodesBetween(y.pos, y.pos + 1, (W) => W.type.name === "tableCell" || W.type.name === "tableHeader" ? ($ = W, !1) : !0), ($ == null ? void 0 : $.attrs) || null;
1940
1953
  }
1941
- const { $from: g } = k;
1954
+ const { $from: i } = x;
1942
1955
  let l = null;
1943
- return r.doc.nodesBetween(g.pos, g.pos + 1, (x) => x.type.name === "tableCell" || x.type.name === "tableHeader" ? (l = x, !1) : !0), (l == null ? void 0 : l.attrs) || null;
1956
+ return o.doc.nodesBetween(i.pos, i.pos + 1, (y) => y.type.name === "tableCell" || y.type.name === "tableHeader" ? (l = y, !1) : !0), (l == null ? void 0 : l.attrs) || null;
1944
1957
  }, [t]);
1945
- K(() => {
1946
- var r, k, g, l;
1947
- if (o) {
1958
+ z(() => {
1959
+ var o, x, i, l;
1960
+ if (r) {
1948
1961
  document.body.style.overflow = "hidden";
1949
- const x = w();
1950
- if (x) {
1951
- const _ = {
1952
- borderColor: ((k = (r = x.borderLeft) == null ? void 0 : r.match(/#\w+/)) == null ? void 0 : k[0]) || "#d9d9d9",
1953
- borderWidth: (l = (g = x.borderLeft) == null ? void 0 : g.match(/(\d+)px/)) != null && l[1] ? parseInt(x.borderLeft.match(/(\d+)px/)[1], 10) : 1,
1954
- backgroundColor: x.backgroundColor || "#ffffff",
1955
- textAlign: x.textAlign || "left",
1956
- verticalAlign: x.verticalAlign || "middle"
1962
+ const y = b();
1963
+ if (y) {
1964
+ const $ = {
1965
+ borderColor: ((x = (o = y.borderLeft) == null ? void 0 : o.match(/#\w+/)) == null ? void 0 : x[0]) || "#d9d9d9",
1966
+ borderWidth: (l = (i = y.borderLeft) == null ? void 0 : i.match(/(\d+)px/)) != null && l[1] ? parseInt(y.borderLeft.match(/(\d+)px/)[1], 10) : 1,
1967
+ backgroundColor: y.backgroundColor || "#ffffff",
1968
+ textAlign: y.textAlign || "left",
1969
+ verticalAlign: y.verticalAlign || "middle"
1957
1970
  };
1958
- h(_), u({ borderColor: _.borderColor, borderWidth: _.borderWidth });
1971
+ m($), u({ borderColor: $.borderColor, borderWidth: $.borderWidth });
1959
1972
  } else
1960
- h({ borderColor: "#d9d9d9", borderWidth: 1, backgroundColor: "#ffffff", textAlign: "left", verticalAlign: "middle" }), u({ borderColor: "#d9d9d9", borderWidth: 1 });
1973
+ m({ borderColor: "#d9d9d9", borderWidth: 1, backgroundColor: "#ffffff", textAlign: "left", verticalAlign: "middle" }), u({ borderColor: "#d9d9d9", borderWidth: 1 });
1961
1974
  } else
1962
1975
  document.body.style.overflow = "";
1963
1976
  return () => {
1964
1977
  document.body.style.overflow = "";
1965
1978
  };
1966
- }, [o, w]);
1967
- const M = A(() => {
1968
- f || (t.commands.focus(), c(!1));
1969
- }, [f, t, c]), n = A(() => {
1979
+ }, [r, b]);
1980
+ const M = S(() => {
1981
+ f || (t.commands.focus(), a(!1));
1982
+ }, [f, t, a]), g = S(() => {
1970
1983
  if (f)
1971
1984
  return;
1972
- const { state: r, dispatch: k } = t.view, { selection: g } = r, l = g, x = r.tr;
1973
- let _ = !1;
1974
- const V = s.borderColor !== d.borderColor || s.borderWidth !== d.borderWidth, b = `${s.borderWidth}px solid ${s.borderColor}`, E = (j, W, I, F, z, q) => {
1975
- const ee = z + 1, te = Gt(j, I.row, I.col, F, q, b, s.backgroundColor, s.textAlign, s.verticalAlign, V);
1976
- if (x.setNodeMarkup(W, null, te), _ = !0, !V) return;
1977
- const ve = j.attrs.colspan || 1, ne = j.attrs.rowspan || 1, ue = "1px solid #d9d9d9", ae = /* @__PURE__ */ new Map();
1978
- for (let Y = 0; Y < F.height; Y++)
1979
- for (let oe = 0; oe < F.width; oe++) {
1980
- const J = F.map[Y * F.width + oe];
1981
- ae.has(J) || ae.set(J, { row: Y, col: oe });
1985
+ const { state: o, dispatch: x } = t.view, { selection: i } = o, l = i, y = o.tr;
1986
+ let $ = !1;
1987
+ const W = s.borderColor !== d.borderColor || s.borderWidth !== d.borderWidth, k = `${s.borderWidth}px solid ${s.borderColor}`, D = (K, j, _, I, F, U) => {
1988
+ const Q = F + 1, ee = pn(K, _.row, _.col, I, U, k, s.backgroundColor, s.textAlign, s.verticalAlign, W);
1989
+ if (y.setNodeMarkup(j, null, ee), $ = !0, !W) return;
1990
+ const we = K.attrs.colspan || 1, ne = K.attrs.rowspan || 1, ue = "1px solid #d9d9d9", ae = /* @__PURE__ */ new Map();
1991
+ for (let q = 0; q < I.height; q++)
1992
+ for (let te = 0; te < I.width; te++) {
1993
+ const J = I.map[q * I.width + te];
1994
+ ae.has(J) || ae.set(J, { row: q, col: te });
1982
1995
  }
1983
- if (I.col > 0) {
1984
- const Y = F.map[I.row * F.width + I.col - 1], oe = ee + Y, J = x.doc.nodeAt(oe);
1996
+ if (_.col > 0) {
1997
+ const q = I.map[_.row * I.width + _.col - 1], te = Q + q, J = y.doc.nodeAt(te);
1985
1998
  if (J && (J.type.name === "tableCell" || J.type.name === "tableHeader")) {
1986
- const X = ae.get(Y);
1987
- if (X && !we(X.row, X.col, J.attrs.colspan || 1, J.attrs.rowspan || 1, F, "right")) {
1988
- const ge = We(J, X.row, X.col, F, q, ue, "right", te.borderLeft);
1989
- x.setNodeMarkup(oe, null, ge);
1999
+ const G = ae.get(q);
2000
+ if (G && !ge(G.row, G.col, J.attrs.colspan || 1, J.attrs.rowspan || 1, I, "right")) {
2001
+ const me = Je(J, G.row, G.col, I, U, ue, "right", ee.borderLeft);
2002
+ y.setNodeMarkup(te, null, me);
1990
2003
  }
1991
2004
  }
1992
2005
  }
1993
- if (I.row > 0) {
1994
- const Y = F.map[(I.row - 1) * F.width + I.col], oe = ee + Y, J = x.doc.nodeAt(oe);
2006
+ if (_.row > 0) {
2007
+ const q = I.map[(_.row - 1) * I.width + _.col], te = Q + q, J = y.doc.nodeAt(te);
1995
2008
  if (J && (J.type.name === "tableCell" || J.type.name === "tableHeader")) {
1996
- const X = ae.get(Y);
1997
- if (X && !we(X.row, X.col, J.attrs.colspan || 1, J.attrs.rowspan || 1, F, "bottom")) {
1998
- const ge = We(J, X.row, X.col, F, q, ue, "bottom", te.borderTop);
1999
- x.setNodeMarkup(oe, null, ge);
2009
+ const G = ae.get(q);
2010
+ if (G && !ge(G.row, G.col, J.attrs.colspan || 1, J.attrs.rowspan || 1, I, "bottom")) {
2011
+ const me = Je(J, G.row, G.col, I, U, ue, "bottom", ee.borderTop);
2012
+ y.setNodeMarkup(te, null, me);
2000
2013
  }
2001
2014
  }
2002
2015
  }
2003
- if (I.col + (j.attrs.colspan || 1) < F.width) {
2004
- const Y = F.map[I.row * F.width + I.col + ve], oe = ee + Y, J = x.doc.nodeAt(oe);
2016
+ if (_.col + (K.attrs.colspan || 1) < I.width) {
2017
+ const q = I.map[_.row * I.width + _.col + we], te = Q + q, J = y.doc.nodeAt(te);
2005
2018
  if (J && (J.type.name === "tableCell" || J.type.name === "tableHeader")) {
2006
- const X = ae.get(Y);
2007
- if (X && !we(X.row, X.col, J.attrs.colspan || 1, J.attrs.rowspan || 1, F, "left")) {
2008
- const ge = We(J, X.row, X.col, F, q, ue, "left", te.borderRight);
2009
- x.setNodeMarkup(oe, null, ge);
2019
+ const G = ae.get(q);
2020
+ if (G && !ge(G.row, G.col, J.attrs.colspan || 1, J.attrs.rowspan || 1, I, "left")) {
2021
+ const me = Je(J, G.row, G.col, I, U, ue, "left", ee.borderRight);
2022
+ y.setNodeMarkup(te, null, me);
2010
2023
  }
2011
2024
  }
2012
2025
  }
2013
- if (I.row + (j.attrs.rowspan || 1) < F.height) {
2014
- const Y = F.map[(I.row + ne) * F.width + I.col], oe = ee + Y, J = x.doc.nodeAt(oe);
2026
+ if (_.row + (K.attrs.rowspan || 1) < I.height) {
2027
+ const q = I.map[(_.row + ne) * I.width + _.col], te = Q + q, J = y.doc.nodeAt(te);
2015
2028
  if (J && (J.type.name === "tableCell" || J.type.name === "tableHeader")) {
2016
- const X = ae.get(Y);
2017
- if (X && !we(X.row, X.col, J.attrs.colspan || 1, J.attrs.rowspan || 1, F, "top")) {
2018
- const ge = We(J, X.row, X.col, F, q, ue, "top", te.borderBottom);
2019
- x.setNodeMarkup(oe, null, ge);
2029
+ const G = ae.get(q);
2030
+ if (G && !ge(G.row, G.col, J.attrs.colspan || 1, J.attrs.rowspan || 1, I, "top")) {
2031
+ const me = Je(J, G.row, G.col, I, U, ue, "top", ee.borderBottom);
2032
+ y.setNodeMarkup(te, null, me);
2020
2033
  }
2021
2034
  }
2022
2035
  }
2023
- }, { $from: $, $to: P } = g;
2024
- let G = -1, O = null;
2025
- if (r.doc.nodesBetween($.pos, P.pos, (j, W) => j.type.name === "table" ? (G = W, O = j, !1) : !0), O && G >= 0) {
2026
- const j = Yt(O), W = lt.get(O), I = G + 1, F = /* @__PURE__ */ new Map();
2027
- for (let z = 0; z < W.height; z++)
2028
- for (let q = 0; q < W.width; q++) {
2029
- const ee = W.map[z * W.width + q];
2030
- F.has(ee) || F.set(ee, { row: z, col: q });
2036
+ }, { $from: E, $to: P } = i;
2037
+ let V = -1, O = null;
2038
+ if (o.doc.nodesBetween(E.pos, P.pos, (K, j) => K.type.name === "table" ? (V = j, O = K, !1) : !0), O && V >= 0) {
2039
+ const K = un(O), j = dt.get(O), _ = V + 1, I = /* @__PURE__ */ new Map();
2040
+ for (let F = 0; F < j.height; F++)
2041
+ for (let U = 0; U < j.width; U++) {
2042
+ const Q = j.map[F * j.width + U];
2043
+ I.has(Q) || I.set(Q, { row: F, col: U });
2031
2044
  }
2032
- if ("$anchorCell" in g && g.$anchorCell) {
2033
- const z = g.$anchorCell, q = g.$headCell, ee = z.pos - I, te = q.pos - I, ve = W.rectBetween(ee, te);
2034
- W.cellsInRect(ve).forEach((ue) => {
2035
- const ae = I + ue, Y = r.doc.nodeAt(ae);
2036
- if (Y && (Y.type.name === "tableCell" || Y.type.name === "tableHeader")) {
2037
- const oe = F.get(ue);
2038
- oe && E(Y, ae, oe, W, G, j);
2045
+ if ("$anchorCell" in i && i.$anchorCell) {
2046
+ const F = i.$anchorCell, U = i.$headCell, Q = F.pos - _, ee = U.pos - _, we = j.rectBetween(Q, ee);
2047
+ j.cellsInRect(we).forEach((ue) => {
2048
+ const ae = _ + ue, q = o.doc.nodeAt(ae);
2049
+ if (q && (q.type.name === "tableCell" || q.type.name === "tableHeader")) {
2050
+ const te = I.get(ue);
2051
+ te && D(q, ae, te, j, V, K);
2039
2052
  }
2040
2053
  });
2041
2054
  } else
2042
- r.doc.nodesBetween($.pos, P.pos, (z, q) => {
2043
- if (z.type.name === "tableCell" || z.type.name === "tableHeader") {
2044
- const ee = q - I, te = F.get(ee);
2045
- te && E(z, q, te, W, G, j);
2055
+ o.doc.nodesBetween(E.pos, P.pos, (F, U) => {
2056
+ if (F.type.name === "tableCell" || F.type.name === "tableHeader") {
2057
+ const Q = U - _, ee = I.get(Q);
2058
+ ee && D(F, U, ee, j, V, K);
2046
2059
  }
2047
2060
  return !0;
2048
2061
  });
2049
2062
  }
2050
- _ && k && (x.setSelection(l.map(x.doc, x.mapping)), k(x), t.commands.focus()), c(!1);
2051
- }, [f, t, s, d, c]);
2052
- return o ? _e(
2053
- /* @__PURE__ */ e("div", { className: "tp-modal-overlay", onMouseDown: (r) => {
2054
- r.target === r.currentTarget && M();
2055
- }, children: /* @__PURE__ */ v("div", { className: "tp-modal", onMouseDown: (r) => r.stopPropagation(), children: [
2056
- /* @__PURE__ */ v("div", { className: "tp-modal-header", children: [
2057
- /* @__PURE__ */ e("h3", { className: "tp-modal-title", children: i("table.cellSettings") }),
2063
+ $ && x && (y.setSelection(l.map(y.doc, y.mapping)), x(y), t.commands.focus()), a(!1);
2064
+ }, [f, t, s, d, a]);
2065
+ return r ? _e(
2066
+ /* @__PURE__ */ e("div", { className: "tp-modal-overlay", onMouseDown: (o) => {
2067
+ o.target === o.currentTarget && M();
2068
+ }, children: /* @__PURE__ */ w("div", { className: "tp-modal", onMouseDown: (o) => o.stopPropagation(), children: [
2069
+ /* @__PURE__ */ w("div", { className: "tp-modal-header", children: [
2070
+ /* @__PURE__ */ e("h3", { className: "tp-modal-title", children: c("table.cellSettings") }),
2058
2071
  /* @__PURE__ */ e("button", { className: "tp-modal-close", onClick: M, children: "×" })
2059
2072
  ] }),
2060
- /* @__PURE__ */ v("div", { className: "tp-modal-body", children: [
2061
- /* @__PURE__ */ v("div", { className: "tp-form-item", children: [
2062
- /* @__PURE__ */ e("label", { className: "tp-form-label", children: i("table.borderColor") }),
2073
+ /* @__PURE__ */ w("div", { className: "tp-modal-body", children: [
2074
+ /* @__PURE__ */ w("div", { className: "tp-form-item", children: [
2075
+ /* @__PURE__ */ e("label", { className: "tp-form-label", children: c("table.borderColor") }),
2063
2076
  /* @__PURE__ */ e(
2064
- Ue,
2077
+ Ye,
2065
2078
  {
2066
- ref: N,
2079
+ ref: L,
2067
2080
  value: s.borderColor,
2068
- onChange: (r) => h((k) => ({ ...k, borderColor: r })),
2081
+ onChange: (o) => m((x) => ({ ...x, borderColor: o })),
2069
2082
  mode: "border",
2070
2083
  placeholder: "#d9d9d9",
2071
2084
  beforeOpen: () => T("border"),
2072
- onClose: () => y("")
2085
+ onClose: () => v("")
2073
2086
  }
2074
2087
  )
2075
2088
  ] }),
2076
- /* @__PURE__ */ v("div", { className: "tp-form-item", children: [
2077
- /* @__PURE__ */ e("label", { className: "tp-form-label", children: i("table.borderWidth") }),
2078
- /* @__PURE__ */ v("div", { className: "tp-input-with-suffix", children: [
2079
- /* @__PURE__ */ e("input", { type: "number", className: "tp-text-input", min: 0, max: 10, value: s.borderWidth, onChange: (r) => h((k) => ({ ...k, borderWidth: Number(r.target.value) })) }),
2089
+ /* @__PURE__ */ w("div", { className: "tp-form-item", children: [
2090
+ /* @__PURE__ */ e("label", { className: "tp-form-label", children: c("table.borderWidth") }),
2091
+ /* @__PURE__ */ w("div", { className: "tp-input-with-suffix", children: [
2092
+ /* @__PURE__ */ e("input", { type: "number", className: "tp-text-input", min: 0, max: 10, value: s.borderWidth, onChange: (o) => m((x) => ({ ...x, borderWidth: Number(o.target.value) })) }),
2080
2093
  /* @__PURE__ */ e("span", { className: "tp-input-suffix", children: "px" })
2081
2094
  ] })
2082
2095
  ] }),
2083
- /* @__PURE__ */ v("div", { className: "tp-form-item", children: [
2084
- /* @__PURE__ */ e("label", { className: "tp-form-label", children: i("table.backgroundColor") }),
2096
+ /* @__PURE__ */ w("div", { className: "tp-form-item", children: [
2097
+ /* @__PURE__ */ e("label", { className: "tp-form-label", children: c("table.backgroundColor") }),
2085
2098
  /* @__PURE__ */ e(
2086
- Ue,
2099
+ Ye,
2087
2100
  {
2088
- ref: S,
2101
+ ref: H,
2089
2102
  value: s.backgroundColor,
2090
- onChange: (r) => h((k) => ({ ...k, backgroundColor: r })),
2103
+ onChange: (o) => m((x) => ({ ...x, backgroundColor: o })),
2091
2104
  mode: "background",
2092
2105
  placeholder: "transparent",
2093
2106
  beforeOpen: () => T("background"),
2094
- onClose: () => y("")
2107
+ onClose: () => v("")
2095
2108
  }
2096
2109
  )
2097
2110
  ] }),
2098
- /* @__PURE__ */ v("div", { className: "tp-form-item", children: [
2099
- /* @__PURE__ */ e("label", { className: "tp-form-label", children: i("table.textAlign") }),
2100
- /* @__PURE__ */ e("div", { className: "tp-align-options", children: Jt.map((r) => /* @__PURE__ */ v("button", { className: `tp-align-btn${s.textAlign === r.value ? " active" : ""}`, onClick: () => h((k) => ({ ...k, textAlign: r.value })), children: [
2101
- /* @__PURE__ */ v("span", { className: "tp-align-icon tp-align-icon-svg", children: [
2102
- r.value === "left" && /* @__PURE__ */ v("svg", { xmlns: "http://www.w3.org/2000/svg", width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", children: [
2111
+ /* @__PURE__ */ w("div", { className: "tp-form-item", children: [
2112
+ /* @__PURE__ */ e("label", { className: "tp-form-label", children: c("table.textAlign") }),
2113
+ /* @__PURE__ */ e("div", { className: "tp-align-options", children: an.map((o) => /* @__PURE__ */ w("button", { className: `tp-align-btn${s.textAlign === o.value ? " active" : ""}`, onClick: () => m((x) => ({ ...x, textAlign: o.value })), children: [
2114
+ /* @__PURE__ */ w("span", { className: "tp-align-icon tp-align-icon-svg", children: [
2115
+ o.value === "left" && /* @__PURE__ */ w("svg", { xmlns: "http://www.w3.org/2000/svg", width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", children: [
2103
2116
  /* @__PURE__ */ e("rect", { x: "3", y: "3", width: "18", height: "18", rx: "2" }),
2104
2117
  /* @__PURE__ */ e("line", { x1: "6", y1: "8", x2: "14", y2: "8" }),
2105
2118
  /* @__PURE__ */ e("line", { x1: "6", y1: "12", x2: "11", y2: "12" }),
2106
2119
  /* @__PURE__ */ e("line", { x1: "6", y1: "16", x2: "16", y2: "16" })
2107
2120
  ] }),
2108
- r.value === "center" && /* @__PURE__ */ v("svg", { xmlns: "http://www.w3.org/2000/svg", width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", children: [
2121
+ o.value === "center" && /* @__PURE__ */ w("svg", { xmlns: "http://www.w3.org/2000/svg", width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", children: [
2109
2122
  /* @__PURE__ */ e("rect", { x: "3", y: "3", width: "18", height: "18", rx: "2" }),
2110
2123
  /* @__PURE__ */ e("line", { x1: "7", y1: "8", x2: "17", y2: "8" }),
2111
2124
  /* @__PURE__ */ e("line", { x1: "9", y1: "12", x2: "15", y2: "12" }),
2112
2125
  /* @__PURE__ */ e("line", { x1: "8", y1: "16", x2: "16", y2: "16" })
2113
2126
  ] }),
2114
- r.value === "right" && /* @__PURE__ */ v("svg", { xmlns: "http://www.w3.org/2000/svg", width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", children: [
2127
+ o.value === "right" && /* @__PURE__ */ w("svg", { xmlns: "http://www.w3.org/2000/svg", width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", children: [
2115
2128
  /* @__PURE__ */ e("rect", { x: "3", y: "3", width: "18", height: "18", rx: "2" }),
2116
2129
  /* @__PURE__ */ e("line", { x1: "10", y1: "8", x2: "18", y2: "8" }),
2117
2130
  /* @__PURE__ */ e("line", { x1: "13", y1: "12", x2: "18", y2: "12" }),
2118
2131
  /* @__PURE__ */ e("line", { x1: "8", y1: "16", x2: "18", y2: "16" })
2119
2132
  ] }),
2120
- r.value === "justify" && /* @__PURE__ */ v("svg", { xmlns: "http://www.w3.org/2000/svg", width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", children: [
2133
+ o.value === "justify" && /* @__PURE__ */ w("svg", { xmlns: "http://www.w3.org/2000/svg", width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", children: [
2121
2134
  /* @__PURE__ */ e("rect", { x: "3", y: "3", width: "18", height: "18", rx: "2" }),
2122
2135
  /* @__PURE__ */ e("line", { x1: "6", y1: "8", x2: "18", y2: "8" }),
2123
2136
  /* @__PURE__ */ e("line", { x1: "6", y1: "12", x2: "18", y2: "12" }),
2124
2137
  /* @__PURE__ */ e("line", { x1: "6", y1: "16", x2: "18", y2: "16" })
2125
2138
  ] })
2126
2139
  ] }),
2127
- /* @__PURE__ */ e("span", { className: "tp-align-label", children: i(r.labelKey) })
2128
- ] }, r.value)) })
2140
+ /* @__PURE__ */ e("span", { className: "tp-align-label", children: c(o.labelKey) })
2141
+ ] }, o.value)) })
2129
2142
  ] }),
2130
- /* @__PURE__ */ v("div", { className: "tp-form-item", children: [
2131
- /* @__PURE__ */ e("label", { className: "tp-form-label", children: i("table.verticalAlign") }),
2132
- /* @__PURE__ */ e("div", { className: "tp-align-options", children: qt.map((r) => /* @__PURE__ */ v("button", { className: `tp-align-btn${s.verticalAlign === r.value ? " active" : ""}`, onClick: () => h((k) => ({ ...k, verticalAlign: r.value })), children: [
2133
- /* @__PURE__ */ v("span", { className: "tp-align-icon tp-align-icon-svg", children: [
2134
- r.value === "top" && /* @__PURE__ */ v("svg", { xmlns: "http://www.w3.org/2000/svg", width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", children: [
2143
+ /* @__PURE__ */ w("div", { className: "tp-form-item", children: [
2144
+ /* @__PURE__ */ e("label", { className: "tp-form-label", children: c("table.verticalAlign") }),
2145
+ /* @__PURE__ */ e("div", { className: "tp-align-options", children: dn.map((o) => /* @__PURE__ */ w("button", { className: `tp-align-btn${s.verticalAlign === o.value ? " active" : ""}`, onClick: () => m((x) => ({ ...x, verticalAlign: o.value })), children: [
2146
+ /* @__PURE__ */ w("span", { className: "tp-align-icon tp-align-icon-svg", children: [
2147
+ o.value === "top" && /* @__PURE__ */ w("svg", { xmlns: "http://www.w3.org/2000/svg", width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", children: [
2135
2148
  /* @__PURE__ */ e("rect", { x: "3", y: "3", width: "18", height: "18", rx: "2" }),
2136
2149
  /* @__PURE__ */ e("line", { x1: "6", y1: "7", x2: "18", y2: "7" })
2137
2150
  ] }),
2138
- r.value === "middle" && /* @__PURE__ */ v("svg", { xmlns: "http://www.w3.org/2000/svg", width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", children: [
2151
+ o.value === "middle" && /* @__PURE__ */ w("svg", { xmlns: "http://www.w3.org/2000/svg", width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", children: [
2139
2152
  /* @__PURE__ */ e("rect", { x: "3", y: "3", width: "18", height: "18", rx: "2" }),
2140
2153
  /* @__PURE__ */ e("line", { x1: "6", y1: "12", x2: "18", y2: "12" })
2141
2154
  ] }),
2142
- r.value === "bottom" && /* @__PURE__ */ v("svg", { xmlns: "http://www.w3.org/2000/svg", width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", children: [
2155
+ o.value === "bottom" && /* @__PURE__ */ w("svg", { xmlns: "http://www.w3.org/2000/svg", width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", children: [
2143
2156
  /* @__PURE__ */ e("rect", { x: "3", y: "3", width: "18", height: "18", rx: "2" }),
2144
2157
  /* @__PURE__ */ e("line", { x1: "6", y1: "17", x2: "18", y2: "17" })
2145
2158
  ] })
2146
2159
  ] }),
2147
- /* @__PURE__ */ e("span", { className: "tp-align-label", children: i(r.labelKey) })
2148
- ] }, r.value)) })
2160
+ /* @__PURE__ */ e("span", { className: "tp-align-label", children: c(o.labelKey) })
2161
+ ] }, o.value)) })
2149
2162
  ] })
2150
2163
  ] }),
2151
- /* @__PURE__ */ v("div", { className: "tp-modal-footer", children: [
2152
- /* @__PURE__ */ e("button", { className: "tp-btn tp-btn-default", onClick: M, children: i("common.cancel") }),
2153
- /* @__PURE__ */ e("button", { className: "tp-btn tp-btn-primary", onClick: n, children: i("common.confirm") })
2164
+ /* @__PURE__ */ w("div", { className: "tp-modal-footer", children: [
2165
+ /* @__PURE__ */ e("button", { className: "tp-btn tp-btn-default", onClick: M, children: c("common.cancel") }),
2166
+ /* @__PURE__ */ e("button", { className: "tp-btn tp-btn-primary", onClick: g, children: c("common.confirm") })
2154
2167
  ] })
2155
2168
  ] }) }),
2156
2169
  document.body
2157
2170
  ) : null;
2158
- }, Zt = ({ manager: t, visible: o, onVisibleChange: c }) => {
2159
- const p = De.getInstance(), [i, s] = H([]), [h, d] = H(""), [u, f] = H(null), [y, N] = H(!1), S = B(null), m = B(null), T = B(null), w = A((l, x) => p.t(l, x) || l, [p]), M = A((l) => {
2171
+ }, fn = ({ manager: t, visible: r, onVisibleChange: a }) => {
2172
+ const h = Le.getInstance(), [c, s] = A([]), [m, d] = A(""), [u, f] = A(null), [v, L] = A(!1), H = B(null), p = B(null), T = B(null), b = S((l, y) => h.t(l, y) || l, [h]), M = S((l) => {
2160
2173
  try {
2161
- const x = new Date(l), V = (/* @__PURE__ */ new Date()).getTime() - x.getTime(), b = Math.floor(V / 6e4), E = Math.floor(V / 36e5), $ = Math.floor(V / 864e5);
2162
- return b < 1 ? w("compare.justNow") : b < 60 ? w("compare.minutesAgo", { n: String(b) }) : E < 24 ? w("compare.hoursAgo", { n: String(E) }) : $ < 7 ? w("compare.daysAgo", { n: String($) }) : x.toLocaleDateString() + " " + x.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" });
2174
+ const y = new Date(l), W = (/* @__PURE__ */ new Date()).getTime() - y.getTime(), k = Math.floor(W / 6e4), D = Math.floor(W / 36e5), E = Math.floor(W / 864e5);
2175
+ return k < 1 ? b("compare.justNow") : k < 60 ? b("compare.minutesAgo", { n: String(k) }) : D < 24 ? b("compare.hoursAgo", { n: String(D) }) : E < 7 ? b("compare.daysAgo", { n: String(E) }) : y.toLocaleDateString() + " " + y.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" });
2163
2176
  } catch {
2164
2177
  return l;
2165
2178
  }
2166
- }, [w]), n = A((l) => {
2167
- const x = {
2179
+ }, [b]), g = S((l) => {
2180
+ const y = {
2168
2181
  blur: "compare.sourceBlur",
2169
2182
  baseline: "compare.sourceBaseline",
2170
2183
  paste: "compare.sourcePaste",
@@ -2173,132 +2186,132 @@ const Xt = ({ editor: t, visible: o, onVisibleChange: c }) => {
2173
2186
  interval: "compare.sourceInterval",
2174
2187
  imported: "compare.sourceImported"
2175
2188
  };
2176
- return x[l] ? w(x[l]) : l;
2177
- }, [w]), r = A((l, x) => `v${i.length - x}.0 - ${M(l.timestamp)} (${n(l.source)})${l.label ? ` - ${l.label}` : ""}`, [M, n, i]);
2178
- K(() => {
2179
- if (!o) {
2189
+ return y[l] ? b(y[l]) : l;
2190
+ }, [b]), o = S((l, y) => `v${c.length - y}.0 - ${M(l.timestamp)} (${g(l.source)})${l.label ? ` - ${l.label}` : ""}`, [M, g, c]);
2191
+ z(() => {
2192
+ if (!r) {
2180
2193
  d(""), f(null);
2181
2194
  return;
2182
2195
  }
2183
2196
  let l = !1;
2184
- return N(!0), t.listVersions().then((x) => {
2185
- l || (s(x), !h && x.length > 0 && d(x[0].id), N(!1));
2197
+ return L(!0), t.listVersions().then((y) => {
2198
+ l || (s(y), !m && y.length > 0 && d(y[0].id), L(!1));
2186
2199
  }).catch(() => {
2187
- l || (s([]), N(!1));
2200
+ l || (s([]), L(!1));
2188
2201
  }), () => {
2189
2202
  l = !0;
2190
2203
  };
2191
- }, [o, t]), K(() => {
2192
- if (!h || !t) {
2204
+ }, [r, t]), z(() => {
2205
+ if (!m || !t) {
2193
2206
  f(null);
2194
2207
  return;
2195
2208
  }
2196
- t.compareWithVersion(h).then(f).catch(() => f(null));
2197
- }, [h, t]), K(() => {
2198
- var l, x;
2199
- if (u && S.current && m.current) {
2209
+ t.compareWithVersion(m).then(f).catch(() => f(null));
2210
+ }, [m, t]), z(() => {
2211
+ var l, y;
2212
+ if (u && H.current && p.current) {
2200
2213
  (l = T.current) == null || l.detach();
2201
- const _ = new ft(S.current, m.current);
2202
- _.attach();
2203
- const V = setTimeout(() => _.refresh(), 0);
2204
- return T.current = _, () => {
2205
- clearTimeout(V), _.detach();
2214
+ const $ = new kt(H.current, p.current);
2215
+ $.attach();
2216
+ const W = setTimeout(() => $.refresh(), 0);
2217
+ return T.current = $, () => {
2218
+ clearTimeout(W), $.detach();
2206
2219
  };
2207
2220
  } else
2208
- (x = T.current) == null || x.detach(), T.current = null;
2209
- }, [u]), K(() => {
2210
- const l = (x) => {
2211
- x.key === "Escape" && o && c(!1);
2221
+ (y = T.current) == null || y.detach(), T.current = null;
2222
+ }, [u]), z(() => {
2223
+ const l = (y) => {
2224
+ y.key === "Escape" && r && a(!1);
2212
2225
  };
2213
2226
  return document.addEventListener("keydown", l), () => document.removeEventListener("keydown", l);
2214
- }, [o, c]);
2215
- const k = A(async () => {
2216
- const l = await t.createSnapshot(w("compare.createSnapshot"));
2217
- l ? je(w("compare.snapshotCreated").replace("{time}", l.label || l.timestamp)) : je({ message: w("compare.snapshotFailed"), type: "error" });
2218
- const x = await t.listVersions();
2219
- s(x);
2220
- }, [t, w]), g = A(() => {
2221
- c(!1);
2222
- }, [c]);
2223
- return o ? /* @__PURE__ */ v("div", { className: "cyte-compare-overlay", children: [
2224
- /* @__PURE__ */ v("div", { className: "cyte-compare-header", children: [
2225
- /* @__PURE__ */ v("div", { className: "cyte-compare-header__title", children: [
2226
- /* @__PURE__ */ v("svg", { className: "cyte-compare-header__title-icon", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
2227
+ }, [r, a]);
2228
+ const x = S(async () => {
2229
+ const l = await t.createSnapshot(b("compare.createSnapshot"));
2230
+ l ? qe(b("compare.snapshotCreated").replace("{time}", l.label || l.timestamp)) : qe({ message: b("compare.snapshotFailed"), type: "error" });
2231
+ const y = await t.listVersions();
2232
+ s(y);
2233
+ }, [t, b]), i = S(() => {
2234
+ a(!1);
2235
+ }, [a]);
2236
+ return r ? /* @__PURE__ */ w("div", { className: "cyte-compare-overlay", children: [
2237
+ /* @__PURE__ */ w("div", { className: "cyte-compare-header", children: [
2238
+ /* @__PURE__ */ w("div", { className: "cyte-compare-header__title", children: [
2239
+ /* @__PURE__ */ w("svg", { className: "cyte-compare-header__title-icon", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
2227
2240
  /* @__PURE__ */ e("rect", { x: "3", y: "3", width: "7", height: "18", rx: "1" }),
2228
2241
  /* @__PURE__ */ e("rect", { x: "14", y: "3", width: "7", height: "18", rx: "1" }),
2229
2242
  /* @__PURE__ */ e("line", { x1: "10", y1: "8", x2: "14", y2: "8" }),
2230
2243
  /* @__PURE__ */ e("line", { x1: "10", y1: "12", x2: "14", y2: "12" }),
2231
2244
  /* @__PURE__ */ e("line", { x1: "10", y1: "16", x2: "14", y2: "16" })
2232
2245
  ] }),
2233
- w("compare.title")
2246
+ b("compare.title")
2234
2247
  ] }),
2235
- /* @__PURE__ */ v("div", { className: "cyte-compare-header__actions", children: [
2236
- /* @__PURE__ */ v("div", { className: "cyte-compare-version-selector", children: [
2237
- /* @__PURE__ */ v("span", { className: "cyte-compare-version-selector__label", children: [
2238
- w("compare.selectVersion"),
2248
+ /* @__PURE__ */ w("div", { className: "cyte-compare-header__actions", children: [
2249
+ /* @__PURE__ */ w("div", { className: "cyte-compare-version-selector", children: [
2250
+ /* @__PURE__ */ w("span", { className: "cyte-compare-version-selector__label", children: [
2251
+ b("compare.selectVersion"),
2239
2252
  ":"
2240
2253
  ] }),
2241
- /* @__PURE__ */ v(
2254
+ /* @__PURE__ */ w(
2242
2255
  "select",
2243
2256
  {
2244
- value: h,
2257
+ value: m,
2245
2258
  onChange: (l) => d(l.target.value),
2246
2259
  className: "cyte-compare-version-selector__select",
2247
2260
  children: [
2248
- /* @__PURE__ */ e("option", { value: "", disabled: !0, children: w("compare.selectVersion") }),
2249
- i.map((l, x) => /* @__PURE__ */ e("option", { value: l.id, children: r(l, x) }, l.id))
2261
+ /* @__PURE__ */ e("option", { value: "", disabled: !0, children: b("compare.selectVersion") }),
2262
+ c.map((l, y) => /* @__PURE__ */ e("option", { value: l.id, children: o(l, y) }, l.id))
2250
2263
  ]
2251
2264
  }
2252
2265
  )
2253
2266
  ] }),
2254
- /* @__PURE__ */ e("button", { className: "cyte-compare-btn--close", onClick: g, title: w("compare.close"), children: "✕" })
2267
+ /* @__PURE__ */ e("button", { className: "cyte-compare-btn--close", onClick: i, title: b("compare.close"), children: "✕" })
2255
2268
  ] })
2256
2269
  ] }),
2257
- u && /* @__PURE__ */ v("div", { className: "cyte-compare-stats", children: [
2258
- /* @__PURE__ */ v("div", { className: "cyte-compare-stats__item", children: [
2259
- /* @__PURE__ */ v("span", { className: "cyte-compare-stats__badge", children: [
2270
+ u && /* @__PURE__ */ w("div", { className: "cyte-compare-stats", children: [
2271
+ /* @__PURE__ */ w("div", { className: "cyte-compare-stats__item", children: [
2272
+ /* @__PURE__ */ w("span", { className: "cyte-compare-stats__badge", children: [
2260
2273
  /* @__PURE__ */ e("span", { className: "cyte-compare-stats__dot cyte-compare-stats__dot--added" }),
2261
2274
  /* @__PURE__ */ e("span", { className: "cyte-compare-stats__count cyte-compare-stats__count--added", children: u.stats.added })
2262
2275
  ] }),
2263
- /* @__PURE__ */ e("span", { className: "cyte-compare-stats__label", children: w("compare.statsAdded") })
2276
+ /* @__PURE__ */ e("span", { className: "cyte-compare-stats__label", children: b("compare.statsAdded") })
2264
2277
  ] }),
2265
- /* @__PURE__ */ v("div", { className: "cyte-compare-stats__item", children: [
2266
- /* @__PURE__ */ v("span", { className: "cyte-compare-stats__badge", children: [
2278
+ /* @__PURE__ */ w("div", { className: "cyte-compare-stats__item", children: [
2279
+ /* @__PURE__ */ w("span", { className: "cyte-compare-stats__badge", children: [
2267
2280
  /* @__PURE__ */ e("span", { className: "cyte-compare-stats__dot cyte-compare-stats__dot--removed" }),
2268
2281
  /* @__PURE__ */ e("span", { className: "cyte-compare-stats__count cyte-compare-stats__count--removed", children: u.stats.removed })
2269
2282
  ] }),
2270
- /* @__PURE__ */ e("span", { className: "cyte-compare-stats__label", children: w("compare.statsRemoved") })
2283
+ /* @__PURE__ */ e("span", { className: "cyte-compare-stats__label", children: b("compare.statsRemoved") })
2271
2284
  ] }),
2272
- /* @__PURE__ */ v("div", { className: "cyte-compare-stats__item", children: [
2273
- /* @__PURE__ */ v("span", { className: "cyte-compare-stats__badge", children: [
2285
+ /* @__PURE__ */ w("div", { className: "cyte-compare-stats__item", children: [
2286
+ /* @__PURE__ */ w("span", { className: "cyte-compare-stats__badge", children: [
2274
2287
  /* @__PURE__ */ e("span", { className: "cyte-compare-stats__dot cyte-compare-stats__dot--modified" }),
2275
2288
  /* @__PURE__ */ e("span", { className: "cyte-compare-stats__count cyte-compare-stats__count--modified", children: u.stats.modified })
2276
2289
  ] }),
2277
- /* @__PURE__ */ e("span", { className: "cyte-compare-stats__label", children: w("compare.statsModified") })
2290
+ /* @__PURE__ */ e("span", { className: "cyte-compare-stats__label", children: b("compare.statsModified") })
2278
2291
  ] }),
2279
- /* @__PURE__ */ v("div", { className: "cyte-compare-stats__item cyte-compare-stats__item--unchanged", children: [
2280
- /* @__PURE__ */ v("span", { className: "cyte-compare-stats__badge", children: [
2292
+ /* @__PURE__ */ w("div", { className: "cyte-compare-stats__item cyte-compare-stats__item--unchanged", children: [
2293
+ /* @__PURE__ */ w("span", { className: "cyte-compare-stats__badge", children: [
2281
2294
  /* @__PURE__ */ e("span", { className: "cyte-compare-stats__dot cyte-compare-stats__dot--unchanged" }),
2282
2295
  /* @__PURE__ */ e("span", { className: "cyte-compare-stats__count", children: u.stats.unchanged })
2283
2296
  ] }),
2284
- /* @__PURE__ */ e("span", { className: "cyte-compare-stats__label", children: w("compare.statsUnchanged") })
2297
+ /* @__PURE__ */ e("span", { className: "cyte-compare-stats__label", children: b("compare.statsUnchanged") })
2285
2298
  ] })
2286
2299
  ] }),
2287
- /* @__PURE__ */ v("div", { className: "cyte-compare-content", children: [
2288
- i.length === 0 && !y && /* @__PURE__ */ v("div", { className: "cyte-compare-empty", children: [
2289
- /* @__PURE__ */ v("svg", { className: "cyte-compare-empty__icon", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", children: [
2300
+ /* @__PURE__ */ w("div", { className: "cyte-compare-content", children: [
2301
+ c.length === 0 && !v && /* @__PURE__ */ w("div", { className: "cyte-compare-empty", children: [
2302
+ /* @__PURE__ */ w("svg", { className: "cyte-compare-empty__icon", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", children: [
2290
2303
  /* @__PURE__ */ e("circle", { cx: "12", cy: "12", r: "10" }),
2291
2304
  /* @__PURE__ */ e("path", { d: "M8 12h8M12 8v8" })
2292
2305
  ] }),
2293
- /* @__PURE__ */ e("div", { className: "cyte-compare-empty__text", children: w("compare.noVersions") }),
2294
- /* @__PURE__ */ e("div", { className: "cyte-compare-empty__hint", children: w("compare.noVersionsHint") }),
2295
- /* @__PURE__ */ e("button", { className: "cyte-compare-btn cyte-compare-btn--primary cyte-compare-snapshot-btn", onClick: k, children: w("compare.createSnapshot") })
2306
+ /* @__PURE__ */ e("div", { className: "cyte-compare-empty__text", children: b("compare.noVersions") }),
2307
+ /* @__PURE__ */ e("div", { className: "cyte-compare-empty__hint", children: b("compare.noVersionsHint") }),
2308
+ /* @__PURE__ */ e("button", { className: "cyte-compare-btn cyte-compare-btn--primary cyte-compare-snapshot-btn", onClick: x, children: b("compare.createSnapshot") })
2296
2309
  ] }),
2297
- u && /* @__PURE__ */ v(Ze, { children: [
2298
- /* @__PURE__ */ v("div", { ref: S, className: "cyte-compare-pane", children: [
2310
+ u && /* @__PURE__ */ w(nt, { children: [
2311
+ /* @__PURE__ */ w("div", { ref: H, className: "cyte-compare-pane", children: [
2299
2312
  /* @__PURE__ */ e("div", { className: "cyte-compare-pane__header", children: (() => {
2300
- const l = i.findIndex((x) => x.id === h);
2301
- return l === -1 ? w("compare.leftLabel") : `${w("compare.leftLabel")} - ${r(i[l], l)}`;
2313
+ const l = c.findIndex((y) => y.id === m);
2314
+ return l === -1 ? b("compare.leftLabel") : `${b("compare.leftLabel")} - ${o(c[l], l)}`;
2302
2315
  })() }),
2303
2316
  /* @__PURE__ */ e("div", { className: "cyte-compare-pane__body", children: u.left.map((l) => /* @__PURE__ */ e(
2304
2317
  "div",
@@ -2308,8 +2321,8 @@ const Xt = ({ editor: t, visible: o, onVisibleChange: c }) => {
2308
2321
  l.key
2309
2322
  )) })
2310
2323
  ] }),
2311
- /* @__PURE__ */ v("div", { ref: m, className: "cyte-compare-pane", children: [
2312
- /* @__PURE__ */ e("div", { className: "cyte-compare-pane__header", children: w("compare.rightLabel") }),
2324
+ /* @__PURE__ */ w("div", { ref: p, className: "cyte-compare-pane", children: [
2325
+ /* @__PURE__ */ e("div", { className: "cyte-compare-pane__header", children: b("compare.rightLabel") }),
2313
2326
  /* @__PURE__ */ e("div", { className: "cyte-compare-pane__body", children: u.right.map((l) => /* @__PURE__ */ e(
2314
2327
  "div",
2315
2328
  {
@@ -2319,45 +2332,45 @@ const Xt = ({ editor: t, visible: o, onVisibleChange: c }) => {
2319
2332
  )) })
2320
2333
  ] })
2321
2334
  ] }),
2322
- i.length > 0 && !h && !u && /* @__PURE__ */ e("div", { className: "cyte-compare-empty", children: /* @__PURE__ */ e("div", { className: "cyte-compare-empty__text", children: w("compare.selectVersion") }) })
2335
+ c.length > 0 && !m && !u && /* @__PURE__ */ e("div", { className: "cyte-compare-empty", children: /* @__PURE__ */ e("div", { className: "cyte-compare-empty__text", children: b("compare.selectVersion") }) })
2323
2336
  ] })
2324
2337
  ] }) : null;
2325
- }, Qt = ({ visible: t, defaultFilename: o, onConfirm: c, onCancel: p, onClose: i }) => {
2326
- const { t: s } = fe(), [h, d] = H(""), u = B(null);
2327
- K(() => (t ? (d(o || "document"), document.body.style.overflow = "hidden", setTimeout(() => {
2328
- var m, T;
2329
- (m = u.current) == null || m.focus(), (T = u.current) == null || T.select();
2338
+ }, mn = ({ visible: t, defaultFilename: r, onConfirm: a, onCancel: h, onClose: c }) => {
2339
+ const { t: s } = fe(), [m, d] = A(""), u = B(null);
2340
+ z(() => (t ? (d(r || "document"), document.body.style.overflow = "hidden", setTimeout(() => {
2341
+ var p, T;
2342
+ (p = u.current) == null || p.focus(), (T = u.current) == null || T.select();
2330
2343
  }, 100)) : document.body.style.overflow = "", () => {
2331
2344
  document.body.style.overflow = "";
2332
- }), [t, o]);
2333
- const f = A(() => {
2334
- const m = h.trim() || "document";
2335
- c(m), i();
2336
- }, [h, c, i]), y = A(() => {
2337
- p == null || p(), i();
2338
- }, [p, i]), N = A((m) => {
2339
- m.target === m.currentTarget && y();
2340
- }, [y]), S = A((m) => {
2341
- m.key === "Enter" ? (m.preventDefault(), f()) : m.key === "Escape" && (m.preventDefault(), y());
2342
- }, [f, y]);
2345
+ }), [t, r]);
2346
+ const f = S(() => {
2347
+ const p = m.trim() || "document";
2348
+ a(p), c();
2349
+ }, [m, a, c]), v = S(() => {
2350
+ h == null || h(), c();
2351
+ }, [h, c]), L = S((p) => {
2352
+ p.target === p.currentTarget && v();
2353
+ }, [v]), H = S((p) => {
2354
+ p.key === "Enter" ? (p.preventDefault(), f()) : p.key === "Escape" && (p.preventDefault(), v());
2355
+ }, [f, v]);
2343
2356
  return t ? _e(
2344
- /* @__PURE__ */ e("div", { className: "tp-export-dialog-overlay", onMouseDown: N, children: /* @__PURE__ */ v("div", { className: "tp-export-dialog", onMouseDown: (m) => m.stopPropagation(), onKeyDown: S, children: [
2345
- /* @__PURE__ */ v("div", { className: "tp-dialog-header", children: [
2357
+ /* @__PURE__ */ e("div", { className: "tp-export-dialog-overlay", onMouseDown: L, children: /* @__PURE__ */ w("div", { className: "tp-export-dialog", onMouseDown: (p) => p.stopPropagation(), onKeyDown: H, children: [
2358
+ /* @__PURE__ */ w("div", { className: "tp-dialog-header", children: [
2346
2359
  /* @__PURE__ */ e("span", { className: "tp-dialog-title", children: s("toolbar.exportWord") }),
2347
- /* @__PURE__ */ e("button", { className: "tp-dialog-close", onClick: y, children: "×" })
2360
+ /* @__PURE__ */ e("button", { className: "tp-dialog-close", onClick: v, children: "×" })
2348
2361
  ] }),
2349
- /* @__PURE__ */ v("div", { className: "tp-dialog-body", children: [
2362
+ /* @__PURE__ */ w("div", { className: "tp-dialog-body", children: [
2350
2363
  /* @__PURE__ */ e("label", { className: "tp-input-label", children: s("toolbar.exportWordFilename") }),
2351
- /* @__PURE__ */ v("div", { className: "tp-input-row", children: [
2364
+ /* @__PURE__ */ w("div", { className: "tp-input-row", children: [
2352
2365
  /* @__PURE__ */ e(
2353
2366
  "input",
2354
2367
  {
2355
2368
  ref: u,
2356
2369
  type: "text",
2357
2370
  className: "tp-filename-input",
2358
- value: h,
2359
- onChange: (m) => d(m.target.value),
2360
- onKeyDown: S
2371
+ value: m,
2372
+ onChange: (p) => d(p.target.value),
2373
+ onKeyDown: H
2361
2374
  }
2362
2375
  ),
2363
2376
  /* @__PURE__ */ e("span", { className: "tp-filename-suffix", children: ".docx" }),
@@ -2367,42 +2380,42 @@ const Xt = ({ editor: t, visible: o, onVisibleChange: c }) => {
2367
2380
  ] }) }),
2368
2381
  document.body
2369
2382
  ) : null;
2370
- }, en = ({ visible: t, defaultFilename: o, onConfirm: c, onCancel: p, onClose: i }) => {
2371
- const { t: s } = fe(), [h, d] = H(""), u = B(null);
2372
- K(() => (t ? (d(o || "document"), document.body.style.overflow = "hidden", setTimeout(() => {
2373
- var m, T;
2374
- (m = u.current) == null || m.focus(), (T = u.current) == null || T.select();
2383
+ }, gn = ({ visible: t, defaultFilename: r, onConfirm: a, onCancel: h, onClose: c }) => {
2384
+ const { t: s } = fe(), [m, d] = A(""), u = B(null);
2385
+ z(() => (t ? (d(r || "document"), document.body.style.overflow = "hidden", setTimeout(() => {
2386
+ var p, T;
2387
+ (p = u.current) == null || p.focus(), (T = u.current) == null || T.select();
2375
2388
  }, 100)) : document.body.style.overflow = "", () => {
2376
2389
  document.body.style.overflow = "";
2377
- }), [t, o]);
2378
- const f = A(() => {
2379
- const m = h.trim() || "document";
2380
- c(m), i();
2381
- }, [h, c, i]), y = A(() => {
2382
- p == null || p(), i();
2383
- }, [p, i]), N = A((m) => {
2384
- m.target === m.currentTarget && y();
2385
- }, [y]), S = A((m) => {
2386
- m.key === "Enter" ? (m.preventDefault(), f()) : m.key === "Escape" && (m.preventDefault(), y());
2387
- }, [f, y]);
2390
+ }), [t, r]);
2391
+ const f = S(() => {
2392
+ const p = m.trim() || "document";
2393
+ a(p), c();
2394
+ }, [m, a, c]), v = S(() => {
2395
+ h == null || h(), c();
2396
+ }, [h, c]), L = S((p) => {
2397
+ p.target === p.currentTarget && v();
2398
+ }, [v]), H = S((p) => {
2399
+ p.key === "Enter" ? (p.preventDefault(), f()) : p.key === "Escape" && (p.preventDefault(), v());
2400
+ }, [f, v]);
2388
2401
  return t ? _e(
2389
- /* @__PURE__ */ e("div", { className: "tp-export-dialog-overlay", onMouseDown: N, children: /* @__PURE__ */ v("div", { className: "tp-export-dialog", onMouseDown: (m) => m.stopPropagation(), onKeyDown: S, children: [
2390
- /* @__PURE__ */ v("div", { className: "tp-dialog-header", children: [
2402
+ /* @__PURE__ */ e("div", { className: "tp-export-dialog-overlay", onMouseDown: L, children: /* @__PURE__ */ w("div", { className: "tp-export-dialog", onMouseDown: (p) => p.stopPropagation(), onKeyDown: H, children: [
2403
+ /* @__PURE__ */ w("div", { className: "tp-dialog-header", children: [
2391
2404
  /* @__PURE__ */ e("span", { className: "tp-dialog-title", children: s("toolbar.exportMarkdown") }),
2392
- /* @__PURE__ */ e("button", { className: "tp-dialog-close", onClick: y, children: "×" })
2405
+ /* @__PURE__ */ e("button", { className: "tp-dialog-close", onClick: v, children: "×" })
2393
2406
  ] }),
2394
- /* @__PURE__ */ v("div", { className: "tp-dialog-body", children: [
2407
+ /* @__PURE__ */ w("div", { className: "tp-dialog-body", children: [
2395
2408
  /* @__PURE__ */ e("label", { className: "tp-input-label", children: s("toolbar.exportMarkdownFilename") }),
2396
- /* @__PURE__ */ v("div", { className: "tp-input-row", children: [
2409
+ /* @__PURE__ */ w("div", { className: "tp-input-row", children: [
2397
2410
  /* @__PURE__ */ e(
2398
2411
  "input",
2399
2412
  {
2400
2413
  ref: u,
2401
2414
  type: "text",
2402
2415
  className: "tp-filename-input",
2403
- value: h,
2404
- onChange: (m) => d(m.target.value),
2405
- onKeyDown: S
2416
+ value: m,
2417
+ onChange: (p) => d(p.target.value),
2418
+ onKeyDown: H
2406
2419
  }
2407
2420
  ),
2408
2421
  /* @__PURE__ */ e("span", { className: "tp-filename-suffix", children: ".md" }),
@@ -2412,35 +2425,40 @@ const Xt = ({ editor: t, visible: o, onVisibleChange: c }) => {
2412
2425
  ] }) }),
2413
2426
  document.body
2414
2427
  ) : null;
2415
- }, tn = Xe.forwardRef((t, o) => {
2428
+ }, wn = tt.forwardRef((t, r) => {
2416
2429
  const {
2417
- html: c,
2418
- json: p,
2419
- config: i,
2430
+ html: a,
2431
+ json: h,
2432
+ config: c,
2420
2433
  height: s = "300px",
2421
- minHeight: h,
2434
+ minHeight: m,
2422
2435
  maxHeight: d,
2423
2436
  autoHeight: u = !1,
2424
2437
  placeholder: f,
2425
- toolbar: y,
2426
- readonly: N = !1,
2427
- disabled: S = !1,
2428
- autofocus: m = !1,
2438
+ toolbar: v,
2439
+ readonly: L = !1,
2440
+ disabled: H = !1,
2441
+ autofocus: p = !1,
2429
2442
  locale: T,
2430
- pasteMode: w,
2443
+ pasteMode: b,
2431
2444
  uploadUrl: M,
2432
- onChange: n,
2433
- onFocus: r,
2434
- onBlur: k,
2435
- onReady: g,
2445
+ onChange: g,
2446
+ onFocus: o,
2447
+ onBlur: x,
2448
+ onReady: i,
2436
2449
  onViewModeChange: l,
2437
- onToolbarClick: x,
2438
- onFullscreenChange: _,
2439
- toolbarRender: V
2440
- } = t, [b, E] = H("normal"), $ = B(""), P = B(null), [G, O] = H(!1), [j, W] = H({ x: 0, y: 0 }), [I, F] = H(null), [z, q] = H(!1), [ee, te] = H(!1), [ve, ne] = H(!1), [ue, ae] = H(!1), [Y, oe] = H("document"), [J, X] = H(!1), [ge, Be] = H("document"), [ye, Ce] = H(!1), Se = De.getInstance(), Ne = A((C) => Se.t(C) || C, [Se]), Ie = Te(() => {
2441
- const D = { ...i || {} };
2442
- return s !== void 0 && (D.height = s), h !== void 0 && (D.minHeight = h), d !== void 0 && (D.maxHeight = d), u !== void 0 && (D.autoHeight = u), f !== void 0 && (D.placeholder = f), y !== void 0 && (D.toolbar = y), N !== void 0 && (D.readonly = N), S !== void 0 && (D.disabled = S), m !== void 0 && (D.autofocus = m), T !== void 0 && (D.locale = T), w !== void 0 && (D.paste = { ...D.paste, mode: w }), M !== void 0 && (D.upload = { ...D.upload, url: M }), D;
2443
- }, [i, s, h, d, u, f, y, N, S, m, T, w, M]), Ke = Te(() => Ie.toolbar || [
2450
+ onToolbarClick: y,
2451
+ onFullscreenChange: $,
2452
+ toolbarRender: W
2453
+ } = t, [k, D] = A("normal"), E = B(""), P = B(null), [V, O] = A(!1), [K, j] = A({ x: 0, y: 0 }), [_, I] = A(null), F = B(null), U = B(null);
2454
+ z(() => () => {
2455
+ var C, N;
2456
+ (C = F.current) == null || C.call(F), F.current = null, (N = U.current) == null || N.call(U), U.current = null;
2457
+ }, []);
2458
+ const [Q, ee] = A(!1), [we, ne] = A(!1), [ue, ae] = A(!1), [q, te] = A(!1), [J, G] = A("document"), [me, Te] = A(!1), [Be, De] = A("document"), [ye, xe] = A(!1), Se = Le.getInstance(), Ue = S((C) => Se.t(C) || C, [Se]), Pe = Me(() => {
2459
+ const N = { ...c || {} };
2460
+ return s !== void 0 && (N.height = s), m !== void 0 && (N.minHeight = m), d !== void 0 && (N.maxHeight = d), u !== void 0 && (N.autoHeight = u), f !== void 0 && (N.placeholder = f), v !== void 0 && (N.toolbar = v), L !== void 0 && (N.readonly = L), H !== void 0 && (N.disabled = H), p !== void 0 && (N.autofocus = p), T !== void 0 && (N.locale = T), b !== void 0 && (N.paste = { ...N.paste, mode: b }), M !== void 0 && (N.upload = { ...N.upload, url: M }), N;
2461
+ }, [c, s, m, d, u, f, v, L, H, p, T, b, M]), se = Me(() => Pe.toolbar || [
2444
2462
  // A: 历史操作
2445
2463
  "undo",
2446
2464
  "redo",
@@ -2488,207 +2506,240 @@ const Xt = ({ editor: t, visible: o, onVisibleChange: c }) => {
2488
2506
  "getJSON",
2489
2507
  "|",
2490
2508
  // H: 视图/版本 (meta-view)
2491
- "fullscreen",
2492
2509
  "snapshot",
2493
2510
  "compare",
2494
- "autoFormat"
2495
- ], [Ie.toolbar]), { manager: a, isReady: Q, isFocused: L, isEmpty: R, containerRef: Z, setContentFromProp: ce } = wt({
2496
- config: Ie,
2497
- onUpdate(C, D) {
2498
- n == null || n({ html: C, json: D });
2511
+ "autoFormat",
2512
+ "fullscreen"
2513
+ ], [Pe.toolbar]), { manager: n, isReady: R, isFocused: Z, isEmpty: pe, containerRef: he, setContentFromProp: ke } = Et({
2514
+ config: Pe,
2515
+ onUpdate(C, N) {
2516
+ g == null || g({ html: C, json: N });
2499
2517
  },
2500
2518
  onFocus(C) {
2501
- r == null || r(C);
2519
+ o == null || o(C);
2502
2520
  },
2503
2521
  onBlur(C) {
2504
- k == null || k(C);
2522
+ x == null || x(C);
2505
2523
  },
2506
2524
  onReady(C) {
2507
- c ? C.setContent(c) : p && C.setJSON(p), Oe(C), g == null || g(C);
2525
+ a ? C.setContent(a) : h && C.setJSON(h), Re(C), i == null || i(C);
2508
2526
  }
2509
- }), { activeStates: de, disabledStates: Pe } = vt(a);
2510
- K(() => {
2511
- c !== void 0 && ce(c);
2512
- }, [c, ce]), K(() => {
2513
- p !== void 0 && ce(void 0, p);
2514
- }, [p, ce]);
2515
- const Ae = A((C) => {
2516
- let D = "", U = 0;
2517
- const se = " ", he = C.replace(/>\s+</g, "><").trim().split(/(<\/?[^>]+>)/g).filter((pe) => pe.trim() !== "");
2518
- for (let pe = 0; pe < he.length; pe++) {
2519
- const me = he[pe];
2520
- if (me.match(/^<\/\w/))
2521
- U = Math.max(0, U - 1), D += se.repeat(U) + me + `
2527
+ }), { activeStates: He, disabledStates: Ie } = Rt(n);
2528
+ z(() => {
2529
+ a !== void 0 && ke(a);
2530
+ }, [a, ke]), z(() => {
2531
+ h !== void 0 && ke(void 0, h);
2532
+ }, [h, ke]);
2533
+ const ce = S((C) => {
2534
+ let N = "", Y = 0;
2535
+ const oe = " ", re = C.replace(/>\s+</g, "><").trim().split(/(<\/?[^>]+>)/g).filter((de) => de.trim() !== "");
2536
+ for (let de = 0; de < re.length; de++) {
2537
+ const le = re[de];
2538
+ if (le.match(/^<\/\w/))
2539
+ Y = Math.max(0, Y - 1), N += oe.repeat(Y) + le + `
2522
2540
  `;
2523
- else if (me.match(/^<\w[^>]*[^\/]>$/)) {
2524
- D += se.repeat(U) + me + `
2541
+ else if (le.match(/^<\w[^>]*[^\/]>$/)) {
2542
+ N += oe.repeat(Y) + le + `
2525
2543
  `;
2526
- const ie = he[pe + 1];
2527
- ie && !ie.match(/^<\/\w/) && U++;
2528
- } else if (me.match(/^<\w[^>]*\/>$/))
2529
- D += se.repeat(U) + me + `
2544
+ const ie = re[de + 1];
2545
+ ie && !ie.match(/^<\/\w/) && Y++;
2546
+ } else if (le.match(/^<\w[^>]*\/>$/))
2547
+ N += oe.repeat(Y) + le + `
2530
2548
  `;
2531
- else if (me.match(/^<\w/))
2532
- D += se.repeat(U) + me + `
2549
+ else if (le.match(/^<\w/))
2550
+ N += oe.repeat(Y) + le + `
2533
2551
  `;
2534
2552
  else {
2535
- const ie = me.trim();
2536
- ie && (D += se.repeat(U) + ie + `
2553
+ const ie = le.trim();
2554
+ ie && (N += oe.repeat(Y) + ie + `
2537
2555
  `);
2538
2556
  }
2539
2557
  }
2540
- return D.trim();
2541
- }, []), He = A((C) => {
2542
- if (!a) return;
2543
- const D = a.getEditor();
2544
- if (b === C) {
2545
- le();
2558
+ return N.trim();
2559
+ }, []), Ae = S((C) => {
2560
+ if (!n) return;
2561
+ const N = n.getEditor();
2562
+ if (k === C) {
2563
+ Ee();
2546
2564
  return;
2547
2565
  }
2548
- b !== "normal" ? le() : ($.current = a.getHTML(), P.current = a.getJSON());
2549
- const U = C === "html" ? a.getHTML() : JSON.stringify(a.getJSON(), null, 2), se = C === "html" ? Ae(U) : U;
2550
- D.commands.clearContent(), D.commands.insertContent({ type: "codeBlock", attrs: { language: C === "html" ? "html" : "json" }, content: [{ type: "text", text: se }] }), E(C), l == null || l(C);
2551
- }, [a, b, Ae, l]), le = A(() => {
2552
- if (!a) return;
2553
- const C = a.getEditor();
2554
- if (b !== "normal") {
2555
- const D = C.getText(), U = b;
2556
- if (D)
2566
+ k !== "normal" ? Ee() : (E.current = n.getHTML(), P.current = n.getJSON());
2567
+ const Y = C === "html" ? n.getHTML() : JSON.stringify(n.getJSON(), null, 2), oe = C === "html" ? ce(Y) : Y;
2568
+ N.commands.clearContent(), N.commands.insertContent({ type: "codeBlock", attrs: { language: C === "html" ? "html" : "json" }, content: [{ type: "text", text: oe }] }), D(C), l == null || l(C);
2569
+ }, [n, k, ce, l]), Ee = S(() => {
2570
+ if (!n) return;
2571
+ const C = n.getEditor();
2572
+ if (k !== "normal") {
2573
+ const N = C.getText(), Y = k;
2574
+ if (N)
2557
2575
  try {
2558
- if (U === "html") {
2559
- const se = document.createElement("div");
2560
- se.innerHTML = D, C.commands.setContent(D);
2561
- } else if (U === "json") {
2562
- const se = JSON.parse(D);
2563
- C.commands.setContent(se);
2576
+ if (Y === "html") {
2577
+ const oe = document.createElement("div");
2578
+ oe.innerHTML = N, C.commands.setContent(N);
2579
+ } else if (Y === "json") {
2580
+ const oe = JSON.parse(N);
2581
+ C.commands.setContent(oe);
2564
2582
  }
2565
2583
  } catch {
2566
- alert(U === "html" ? "HTML 格式错误,请检查输入内容" : "JSON 格式错误,请检查输入内容");
2584
+ alert(Y === "html" ? "HTML 格式错误,请检查输入内容" : "JSON 格式错误,请检查输入内容");
2567
2585
  return;
2568
2586
  }
2569
2587
  else
2570
- P.current ? C.commands.setContent(P.current) : $.current && C.commands.setContent($.current);
2588
+ P.current ? C.commands.setContent(P.current) : E.current && C.commands.setContent(E.current);
2571
2589
  } else
2572
- P.current ? C.commands.setContent(P.current) : $.current && C.commands.setContent($.current);
2573
- E("normal"), l == null || l("normal");
2574
- }, [a, b, l]), Oe = A((C) => {
2575
- const D = C.getEditor();
2576
- D.view.dom.addEventListener("contextmenu", (U) => {
2577
- const re = U.target.closest("td, th");
2578
- if (!mt())
2579
- if (re) {
2580
- U.preventDefault();
2581
- const he = D.state.selection;
2582
- if ("$anchorCell" in he) {
2583
- let Le = !1;
2590
+ P.current ? C.commands.setContent(P.current) : E.current && C.commands.setContent(E.current);
2591
+ D("normal"), l == null || l("normal");
2592
+ }, [n, k, l]), Re = S((C) => {
2593
+ var oe, X;
2594
+ const N = C.getEditor(), Y = (re, de) => {
2595
+ Ke() || (rt(N, re), I(re), O(!1), setTimeout(() => {
2596
+ j({ x: de.right, y: de.bottom + 6 }), I(re), O(!0);
2597
+ }, 0));
2598
+ };
2599
+ (oe = F.current) == null || oe.call(F), F.current = Ct(N, {
2600
+ onOpen: Y,
2601
+ shouldShow: () => !Ke(),
2602
+ shouldOpen: () => !Ke()
2603
+ }), (X = U.current) == null || X.call(U), U.current = Nt(N.view.dom), N.view.dom.addEventListener("contextmenu", (re) => {
2604
+ if (Mt()) {
2605
+ O(!1);
2606
+ return;
2607
+ }
2608
+ const le = re.target.closest("td, th");
2609
+ if (!Ke())
2610
+ if (le) {
2611
+ re.preventDefault();
2612
+ const ie = N.state.selection;
2613
+ if ("$anchorCell" in ie) {
2614
+ let ze = !1;
2584
2615
  try {
2585
- he.forEachCell((Fe, Ve) => {
2586
- const xe = D.view.nodeDOM(Ve);
2587
- xe && xe instanceof HTMLElement && (xe === re || xe.contains(re) || re.contains(xe)) && (Le = !0);
2616
+ ie.forEachCell((Ge, ut) => {
2617
+ const We = N.view.nodeDOM(ut);
2618
+ We && We instanceof HTMLElement && (We === le || We.contains(le) || le.contains(We)) && (ze = !0);
2588
2619
  });
2589
2620
  } catch {
2590
2621
  }
2591
- Le || $e(D, re), W({ x: U.clientX, y: U.clientY }), F(re), O(!0);
2622
+ ze || je(N, le), j({ x: re.clientX, y: re.clientY }), I(le), O(!0);
2592
2623
  return;
2593
2624
  }
2594
- et(D) || $e(D, re);
2595
- const ie = G;
2596
- ie && O(!1), setTimeout(() => {
2597
- W({ x: U.clientX, y: U.clientY }), F(re), O(!0);
2598
- }, ie ? 0 : 50);
2625
+ rt(N, le);
2626
+ const Ne = V;
2627
+ Ne && O(!1), setTimeout(() => {
2628
+ j({ x: re.clientX, y: re.clientY }), I(le), O(!0);
2629
+ }, Ne ? 0 : 50);
2599
2630
  } else
2600
- O(!1), F(null), tt();
2631
+ O(!1), I(null), lt();
2601
2632
  });
2602
- }, [G]), ze = A((C) => {
2603
- if (x == null || x(C), C === "snapshot") {
2604
- a == null || a.createSnapshot().then((D) => {
2605
- D ? je(Se.t("compare.snapshotCreated", { time: D.label || D.timestamp })) : je({ message: Se.t("compare.snapshotFailed"), type: "error" });
2633
+ }, [V]), Fe = S((C) => {
2634
+ if (y == null || y(C), C === "snapshot") {
2635
+ n == null || n.createSnapshot().then((N) => {
2636
+ N ? qe(Se.t("compare.snapshotCreated", { time: N.label || N.timestamp })) : qe({ message: Se.t("compare.snapshotFailed"), type: "error" });
2606
2637
  });
2607
2638
  return;
2608
2639
  }
2609
- if (C === "compare" && ne(!0), C === "fullscreen" && be(), C === "autoFormat" && (a == null || a.toggleAutoFormatPanel()), C === "importWord") {
2610
- const D = document.createElement("input");
2611
- D.type = "file", D.accept = ".docx,application/vnd.openxmlformats-officedocument.wordprocessingml.document", D.onchange = async (U) => {
2612
- var re;
2613
- const se = (re = U.target.files) == null ? void 0 : re[0];
2614
- se && await (a == null ? void 0 : a.importWordFile(se));
2615
- }, D.click();
2640
+ if (C === "compare" && ae(!0), C === "fullscreen" && ve(), C === "autoFormat" && (n == null || n.toggleAutoFormatPanel()), C === "importWord") {
2641
+ const N = document.createElement("input");
2642
+ N.type = "file", N.accept = ".docx,application/vnd.openxmlformats-officedocument.wordprocessingml.document", N.onchange = async (Y) => {
2643
+ var X;
2644
+ const oe = (X = Y.target.files) == null ? void 0 : X[0];
2645
+ oe && await (n == null ? void 0 : n.importWordFile(oe));
2646
+ }, N.click();
2616
2647
  }
2617
2648
  if (C === "importMarkdown") {
2618
- const D = document.createElement("input");
2619
- D.type = "file", D.accept = ".md,.markdown,text/markdown", D.onchange = async (U) => {
2620
- var re;
2621
- const se = (re = U.target.files) == null ? void 0 : re[0];
2622
- se && await (a == null ? void 0 : a.importMarkdownFile(se));
2623
- }, D.click();
2649
+ const N = document.createElement("input");
2650
+ N.type = "file", N.accept = ".md,.markdown,text/markdown", N.onchange = async (Y) => {
2651
+ var X;
2652
+ const oe = (X = Y.target.files) == null ? void 0 : X[0];
2653
+ oe && await (n == null ? void 0 : n.importMarkdownFile(oe));
2654
+ }, N.click();
2624
2655
  }
2625
- C === "exportWord" && (oe((a == null ? void 0 : a.getDocumentTitle()) || "document"), ae(!0)), C === "exportMarkdown" && (Be((a == null ? void 0 : a.getDocumentTitle()) || "document"), X(!0));
2626
- }, [x, a]), Ee = A((C) => {
2627
- if (!a) return;
2628
- const D = a.getEditor();
2629
- switch ("$anchorCell" in D.state.selection || (et(D), tt()), C) {
2656
+ C === "exportWord" && (G((n == null ? void 0 : n.getDocumentTitle()) || "document"), te(!0)), C === "exportMarkdown" && (De((n == null ? void 0 : n.getDocumentTitle()) || "document"), Te(!0));
2657
+ }, [y, n]), $e = S((C) => {
2658
+ if (!n) return;
2659
+ const N = n.getEditor();
2660
+ switch ("$anchorCell" in N.state.selection || (Lt(N), lt()), C) {
2630
2661
  case "addRowBefore":
2631
- a.addTableRowBefore();
2662
+ n.addTableRowBefore();
2632
2663
  break;
2633
2664
  case "addRowAfter":
2634
- a.addTableRowAfter();
2665
+ n.addTableRowAfter();
2635
2666
  break;
2636
2667
  case "addColumnBefore":
2637
- a.addTableColumnBefore();
2668
+ n.addTableColumnBefore();
2638
2669
  break;
2639
2670
  case "addColumnAfter":
2640
- a.addTableColumnAfter();
2671
+ n.addTableColumnAfter();
2672
+ break;
2673
+ case "selectRow": {
2674
+ const X = _ ?? Ve(N);
2675
+ X && Ht(N, X);
2676
+ break;
2677
+ }
2678
+ case "selectColumn": {
2679
+ const X = _ ?? Ve(N);
2680
+ X && St(N, X);
2681
+ break;
2682
+ }
2683
+ case "selectTable": {
2684
+ const X = _ ?? Ve(N);
2685
+ X && Dt(N, X);
2686
+ break;
2687
+ }
2688
+ case "extendSelection": {
2689
+ const X = _ ?? Ve(N);
2690
+ Tt(N, X ?? void 0);
2641
2691
  break;
2692
+ }
2642
2693
  case "mergeCells":
2643
- D.chain().mergeCells().run(), setTimeout(() => {
2644
- if (I)
2645
- if (document.contains(I))
2646
- $e(D, I);
2694
+ N.chain().mergeCells().run(), setTimeout(() => {
2695
+ if (_)
2696
+ if (document.contains(_))
2697
+ je(N, _);
2647
2698
  else {
2648
- const { state: re } = D, { selection: he } = re;
2649
- if ("$anchorCell" in he) {
2650
- const pe = he.$anchorCell.pos;
2651
- if (re.doc.nodeAt(pe)) {
2652
- const ie = D.view.nodeDOM(pe);
2653
- ie && $e(D, ie);
2699
+ const { state: X } = N, { selection: re } = X;
2700
+ if ("$anchorCell" in re) {
2701
+ const de = re.$anchorCell.pos;
2702
+ if (X.doc.nodeAt(de)) {
2703
+ const ie = N.view.nodeDOM(de);
2704
+ ie && je(N, ie);
2654
2705
  }
2655
2706
  }
2656
2707
  }
2657
2708
  }, 0);
2658
2709
  break;
2659
2710
  case "splitCell": {
2660
- const re = I;
2661
- let he = null;
2662
- if (re)
2711
+ const X = _;
2712
+ let re = null;
2713
+ if (X)
2663
2714
  try {
2664
- he = D.view.posAtDOM(re, 0);
2715
+ re = N.view.posAtDOM(X, 0);
2665
2716
  } catch {
2666
2717
  }
2667
- D.chain().splitCell().run(), setTimeout(() => {
2668
- const { state: pe } = D, { selection: me } = pe;
2669
- if (me instanceof at) {
2670
- D.commands.focus();
2718
+ N.chain().splitCell().run(), setTimeout(() => {
2719
+ const { state: de } = N, { selection: le } = de;
2720
+ if (le instanceof ft) {
2721
+ N.commands.focus();
2671
2722
  return;
2672
2723
  }
2673
- if (he !== null)
2724
+ if (re !== null)
2674
2725
  try {
2675
- const ie = D.view.nodeDOM(he);
2726
+ const ie = N.view.nodeDOM(re);
2676
2727
  if (ie && document.contains(ie)) {
2677
- $e(D, ie);
2728
+ je(N, ie);
2678
2729
  return;
2679
2730
  }
2680
2731
  } catch {
2681
2732
  }
2682
2733
  try {
2683
2734
  let ie = null;
2684
- if (pe.doc.descendants((Le, Fe) => Le.type.name === "table" ? (ie = Fe, !1) : !0), ie !== null) {
2685
- const Le = pe.doc.nodeAt(ie);
2686
- if (Le) {
2687
- const Fe = lt.get(Le);
2688
- if (Fe.map.length > 0) {
2689
- const Ve = Fe.map[0] + ie + 1, xe = D.view.nodeDOM(Ve);
2690
- if (xe) {
2691
- $e(D, xe);
2735
+ if (de.doc.descendants((Oe, Ne) => Oe.type.name === "table" ? (ie = Ne, !1) : !0), ie !== null) {
2736
+ const Oe = de.doc.nodeAt(ie);
2737
+ if (Oe) {
2738
+ const Ne = dt.get(Oe);
2739
+ if (Ne.map.length > 0) {
2740
+ const ze = Ne.map[0] + ie + 1, Ge = N.view.nodeDOM(ze);
2741
+ if (Ge) {
2742
+ je(N, Ge);
2692
2743
  return;
2693
2744
  }
2694
2745
  }
@@ -2696,174 +2747,174 @@ const Xt = ({ editor: t, visible: o, onVisibleChange: c }) => {
2696
2747
  }
2697
2748
  } catch {
2698
2749
  }
2699
- D.commands.focus();
2750
+ N.commands.focus();
2700
2751
  }, 0);
2701
2752
  break;
2702
2753
  }
2703
2754
  case "deleteRow":
2704
- a.deleteTableRow();
2755
+ n.deleteTableRow();
2705
2756
  break;
2706
2757
  case "deleteColumn":
2707
- a.deleteTableColumn();
2758
+ n.deleteTableColumn();
2708
2759
  break;
2709
2760
  case "deleteTable":
2710
- a.deleteTable();
2761
+ n.deleteTable();
2711
2762
  break;
2712
2763
  case "tableSettings":
2713
- q(!0);
2764
+ ee(!0);
2714
2765
  break;
2715
2766
  case "cellSettings":
2716
- te(!0);
2767
+ ne(!0);
2717
2768
  break;
2718
2769
  }
2719
- }, [a, I]), be = A(() => {
2720
- Ce((C) => {
2721
- const D = !C;
2722
- return _ == null || _(D), D;
2770
+ }, [n, _]), ve = S(() => {
2771
+ xe((C) => {
2772
+ const N = !C;
2773
+ return $ == null || $(N), N;
2723
2774
  });
2724
- }, [_]), Re = A((C) => {
2725
- C.key === "Escape" && ye && (Ce(!1), _ == null || _(!1));
2726
- }, [ye, _]), Me = Te(() => {
2775
+ }, [$]), Ce = S((C) => {
2776
+ C.key === "Escape" && ye && (xe(!1), $ == null || $(!1));
2777
+ }, [ye, $]), ot = Me(() => {
2727
2778
  const C = {};
2728
- return u ? (h && (C.minHeight = typeof h == "number" ? `${h}px` : h), d && (C.maxHeight = typeof d == "number" ? `${d}px` : d)) : (s && (C.height = typeof s == "number" ? `${s}px` : s), h && (C.minHeight = typeof h == "number" ? `${h}px` : h)), C;
2729
- }, [u, s, h, d]);
2730
- return st(o, () => ({
2731
- getEditorManager: () => a,
2732
- getHTML: () => (a == null ? void 0 : a.getHTML()) ?? "",
2733
- getJSON: () => (a == null ? void 0 : a.getJSON()) ?? { type: "doc", content: [] },
2734
- getText: () => (a == null ? void 0 : a.getText()) ?? "",
2735
- setContent: (C) => a == null ? void 0 : a.setContent(C),
2736
- setJSON: (C) => a == null ? void 0 : a.setJSON(C),
2737
- insertHTML: (C) => a == null ? void 0 : a.insertHTML(C),
2738
- insertText: (C) => a == null ? void 0 : a.insertText(C),
2739
- focus: () => a == null ? void 0 : a.focus(),
2740
- blur: () => a == null ? void 0 : a.blur(),
2741
- isEmpty: () => (a == null ? void 0 : a.isEmpty()) ?? !0,
2742
- clear: () => a == null ? void 0 : a.clear(),
2743
- undo: () => a == null ? void 0 : a.undo(),
2744
- redo: () => a == null ? void 0 : a.redo(),
2745
- setReadonly: (C) => a == null ? void 0 : a.setReadonly(C),
2746
- insertTable: (C, D, U) => a == null ? void 0 : a.insertTable(C, D, U),
2747
- insertImage: (C, D, U) => a == null ? void 0 : a.insertImage(C, D, U),
2748
- insertVideo: (C, D, U) => a == null ? void 0 : a.insertVideo(C, D, U),
2749
- exportMarkdown: () => (a == null ? void 0 : a.exportMarkdown()) ?? "",
2750
- exportHTMLDocument: (C) => (a == null ? void 0 : a.exportHTMLDocument(C)) ?? "",
2779
+ return u ? (m && (C.minHeight = typeof m == "number" ? `${m}px` : m), d && (C.maxHeight = typeof d == "number" ? `${d}px` : d)) : (s && (C.height = typeof s == "number" ? `${s}px` : s), m && (C.minHeight = typeof m == "number" ? `${m}px` : m)), C;
2780
+ }, [u, s, m, d]);
2781
+ return at(r, () => ({
2782
+ getEditorManager: () => n,
2783
+ getHTML: () => (n == null ? void 0 : n.getHTML()) ?? "",
2784
+ getJSON: () => (n == null ? void 0 : n.getJSON()) ?? { type: "doc", content: [] },
2785
+ getText: () => (n == null ? void 0 : n.getText()) ?? "",
2786
+ setContent: (C) => n == null ? void 0 : n.setContent(C),
2787
+ setJSON: (C) => n == null ? void 0 : n.setJSON(C),
2788
+ insertHTML: (C) => n == null ? void 0 : n.insertHTML(C),
2789
+ insertText: (C) => n == null ? void 0 : n.insertText(C),
2790
+ focus: () => n == null ? void 0 : n.focus(),
2791
+ blur: () => n == null ? void 0 : n.blur(),
2792
+ isEmpty: () => (n == null ? void 0 : n.isEmpty()) ?? !0,
2793
+ clear: () => n == null ? void 0 : n.clear(),
2794
+ undo: () => n == null ? void 0 : n.undo(),
2795
+ redo: () => n == null ? void 0 : n.redo(),
2796
+ setReadonly: (C) => n == null ? void 0 : n.setReadonly(C),
2797
+ insertTable: (C, N, Y) => n == null ? void 0 : n.insertTable(C, N, Y),
2798
+ insertImage: (C, N, Y) => n == null ? void 0 : n.insertImage(C, N, Y),
2799
+ insertVideo: (C, N, Y) => n == null ? void 0 : n.insertVideo(C, N, Y),
2800
+ exportMarkdown: () => (n == null ? void 0 : n.exportMarkdown()) ?? "",
2801
+ exportHTMLDocument: (C) => (n == null ? void 0 : n.exportHTMLDocument(C)) ?? "",
2751
2802
  exportWordFile: async (C) => {
2752
- await (a == null ? void 0 : a.exportWordFile(C));
2803
+ await (n == null ? void 0 : n.exportWordFile(C));
2753
2804
  },
2754
- exportMarkdownFile: (C) => (a == null ? void 0 : a.exportMarkdownFile(C)) ?? Promise.resolve(),
2755
- importMarkdown: (C) => a == null ? void 0 : a.importMarkdown(C),
2756
- importHTMLFile: (C) => (a == null ? void 0 : a.importHTMLFile(C)) ?? Promise.resolve(),
2757
- importMarkdownFile: (C) => (a == null ? void 0 : a.importMarkdownFile(C)) ?? Promise.resolve(),
2758
- importWordFile: (C) => (a == null ? void 0 : a.importWordFile(C)) ?? Promise.resolve({ messages: [] }),
2759
- parseHTML: (C) => a == null ? void 0 : a.parseHTML(C),
2760
- addSnapshot: (C, D) => (a == null ? void 0 : a.addSnapshot(C, D)) ?? Promise.resolve(null),
2761
- toggleViewMode: He,
2762
- restoreOriginalContent: le,
2763
- getViewMode: () => b,
2764
- toggleFullscreen: be,
2805
+ exportMarkdownFile: (C) => (n == null ? void 0 : n.exportMarkdownFile(C)) ?? Promise.resolve(),
2806
+ importMarkdown: (C) => n == null ? void 0 : n.importMarkdown(C),
2807
+ importHTMLFile: (C) => (n == null ? void 0 : n.importHTMLFile(C)) ?? Promise.resolve(),
2808
+ importMarkdownFile: (C) => (n == null ? void 0 : n.importMarkdownFile(C)) ?? Promise.resolve(),
2809
+ importWordFile: (C) => (n == null ? void 0 : n.importWordFile(C)) ?? Promise.resolve({ messages: [] }),
2810
+ parseHTML: (C) => n == null ? void 0 : n.parseHTML(C),
2811
+ addSnapshot: (C, N) => (n == null ? void 0 : n.addSnapshot(C, N)) ?? Promise.resolve(null),
2812
+ toggleViewMode: Ae,
2813
+ restoreOriginalContent: Ee,
2814
+ getViewMode: () => k,
2815
+ toggleFullscreen: ve,
2765
2816
  isFullscreen: () => ye
2766
- }), [a, He, le, b, be, ye]), /* @__PURE__ */ v(
2817
+ }), [n, Ae, Ee, k, ve, ye]), /* @__PURE__ */ w(
2767
2818
  "div",
2768
2819
  {
2769
- className: `cyte-editor${S ? " is-disabled" : ""}${N ? " is-readonly" : ""}${L ? " is-focused" : ""}${R ? " is-empty" : ""}${u ? " is-auto-height" : ""}${u && d ? " is-auto-height-limited" : ""}${ye ? " is-fullscreen" : ""}`,
2770
- style: Me,
2771
- onKeyDown: Re,
2820
+ className: `cyte-editor${H ? " is-disabled" : ""}${L ? " is-readonly" : ""}${Z ? " is-focused" : ""}${pe ? " is-empty" : ""}${u ? " is-auto-height" : ""}${u && d ? " is-auto-height-limited" : ""}${ye ? " is-fullscreen" : ""}`,
2821
+ style: ot,
2822
+ onKeyDown: Ce,
2772
2823
  children: [
2773
- ye && /* @__PURE__ */ v("div", { className: "cyte-fullscreen-header", children: [
2774
- /* @__PURE__ */ v("div", { className: "cyte-fullscreen-header__title", children: [
2775
- /* @__PURE__ */ v("svg", { className: "cyte-fullscreen-header__title-icon", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
2824
+ ye && /* @__PURE__ */ w("div", { className: "cyte-fullscreen-header", children: [
2825
+ /* @__PURE__ */ w("div", { className: "cyte-fullscreen-header__title", children: [
2826
+ /* @__PURE__ */ w("svg", { className: "cyte-fullscreen-header__title-icon", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
2776
2827
  /* @__PURE__ */ e("path", { d: "M8 4H4V8M4 4L10 10" }),
2777
2828
  /* @__PURE__ */ e("path", { d: "M16 4H20V8M20 4L14 10" }),
2778
2829
  /* @__PURE__ */ e("path", { d: "M4 16V20H8M4 20L10 14" }),
2779
2830
  /* @__PURE__ */ e("path", { d: "M20 16V20H16M20 20L14 14" })
2780
2831
  ] }),
2781
- Ne("toolbar.fullscreenTitle")
2832
+ Ue("toolbar.fullscreenTitle")
2782
2833
  ] }),
2783
- /* @__PURE__ */ v("button", { className: "cyte-fullscreen-header__close", onClick: be, children: [
2834
+ /* @__PURE__ */ w("button", { className: "cyte-fullscreen-header__close", onClick: ve, children: [
2784
2835
  "✕ ",
2785
- Ne("toolbar.exitFullscreen")
2836
+ Ue("toolbar.exitFullscreen")
2786
2837
  ] })
2787
2838
  ] }),
2788
- V ? V({ manager: a, activeStates: de, disabledStates: Pe, isReady: Q }) : Q && a && /* @__PURE__ */ e(
2789
- Ft,
2839
+ W ? W({ manager: n, activeStates: He, disabledStates: Ie, isReady: R }) : R && n && /* @__PURE__ */ e(
2840
+ en,
2790
2841
  {
2791
- items: Ke,
2792
- manager: a,
2793
- activeStates: de,
2794
- disabledStates: Pe,
2795
- viewMode: b,
2796
- onToggleViewMode: He,
2797
- onToolbarClick: ze
2842
+ items: se,
2843
+ manager: n,
2844
+ activeStates: He,
2845
+ disabledStates: Ie,
2846
+ viewMode: k,
2847
+ onToggleViewMode: Ae,
2848
+ onToolbarClick: Fe
2798
2849
  }
2799
2850
  ),
2800
- /* @__PURE__ */ e("div", { ref: Z, className: "tp-editor-content" }),
2801
- Q && a && /* @__PURE__ */ e(
2802
- Ot,
2851
+ /* @__PURE__ */ e("div", { ref: he, className: "tp-editor-content" }),
2852
+ R && n && /* @__PURE__ */ e(
2853
+ tn,
2803
2854
  {
2804
- editor: a.getEditor(),
2805
- visible: G,
2806
- position: j,
2807
- targetCell: I,
2855
+ editor: n.getEditor(),
2856
+ visible: V,
2857
+ position: K,
2858
+ targetCell: _,
2808
2859
  onVisibleChange: O,
2809
- onAction: Ee
2860
+ onAction: $e
2810
2861
  }
2811
2862
  ),
2812
- Q && a && /* @__PURE__ */ e(
2813
- Vt,
2863
+ R && n && /* @__PURE__ */ e(
2864
+ cn,
2814
2865
  {
2815
- editor: a.getEditor(),
2816
- visible: z,
2817
- onVisibleChange: q
2866
+ editor: n.getEditor(),
2867
+ visible: Q,
2868
+ onVisibleChange: ee
2818
2869
  }
2819
2870
  ),
2820
- Q && a && /* @__PURE__ */ e(
2821
- Xt,
2871
+ R && n && /* @__PURE__ */ e(
2872
+ hn,
2822
2873
  {
2823
- editor: a.getEditor(),
2824
- visible: ee,
2825
- onVisibleChange: te
2874
+ editor: n.getEditor(),
2875
+ visible: we,
2876
+ onVisibleChange: ne
2826
2877
  }
2827
2878
  ),
2828
- Q && a && /* @__PURE__ */ e(
2829
- Zt,
2879
+ R && n && /* @__PURE__ */ e(
2880
+ fn,
2830
2881
  {
2831
- manager: a,
2832
- visible: ve,
2833
- onVisibleChange: ne
2882
+ manager: n,
2883
+ visible: ue,
2884
+ onVisibleChange: ae
2834
2885
  }
2835
2886
  ),
2836
2887
  /* @__PURE__ */ e(
2837
- Qt,
2888
+ mn,
2838
2889
  {
2839
- visible: ue,
2840
- defaultFilename: Y,
2841
- onConfirm: (C) => a == null ? void 0 : a.exportWordFile(C),
2842
- onClose: () => ae(!1)
2890
+ visible: q,
2891
+ defaultFilename: J,
2892
+ onConfirm: (C) => n == null ? void 0 : n.exportWordFile(C),
2893
+ onClose: () => te(!1)
2843
2894
  }
2844
2895
  ),
2845
2896
  /* @__PURE__ */ e(
2846
- en,
2897
+ gn,
2847
2898
  {
2848
- visible: J,
2849
- defaultFilename: ge,
2850
- onConfirm: (C) => a == null ? void 0 : a.exportMarkdownFile(C),
2851
- onClose: () => X(!1)
2899
+ visible: me,
2900
+ defaultFilename: Be,
2901
+ onConfirm: (C) => n == null ? void 0 : n.exportMarkdownFile(C),
2902
+ onClose: () => Te(!1)
2852
2903
  }
2853
2904
  )
2854
2905
  ]
2855
2906
  }
2856
2907
  );
2857
2908
  });
2858
- tn.displayName = "CyteEditor";
2909
+ wn.displayName = "CyteEditor";
2859
2910
  export {
2860
- Xt as CellSettingsModal,
2861
- Ue as ColorPickerInput,
2862
- Zt as CompareOverlay,
2863
- tn as CyteEditor,
2864
- Ot as TableContextMenu,
2865
- Vt as TableSettingsModal,
2866
- wt as useEditor,
2911
+ hn as CellSettingsModal,
2912
+ Ye as ColorPickerInput,
2913
+ fn as CompareOverlay,
2914
+ wn as CyteEditor,
2915
+ tn as TableContextMenu,
2916
+ cn as TableSettingsModal,
2917
+ Et as useEditor,
2867
2918
  fe as useI18n,
2868
- vt as useToolbarState
2919
+ Rt as useToolbarState
2869
2920
  };