@opentiny/tiny-robot 0.5.2-alpha.1 → 0.5.2-alpha.10

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,49 +1,49 @@
1
- import { defineComponent as Z, openBlock as M, createBlock as U, unref as k, withCtx as j, createTextVNode as ln, toDisplayString as pe, ref as F, watch as K, createElementBlock as P, Fragment as Ie, renderList as Be, withModifiers as nt, normalizeClass as Q, createCommentVNode as q, createElementVNode as B, nextTick as me, isRef as ke, Transition as an, normalizeStyle as cn, createVNode as se, toRaw as un, computed as R, onMounted as dn, onUnmounted as fn, Teleport as pn, toRef as De, onBeforeUnmount as mn, shallowReactive as hn, toValue as gn, provide as xn, renderSlot as D, createSlots as $e, normalizeProps as he, guardReactiveProps as ge } from "vue";
2
- import { a as yn, u as Pe, W as Rt, D as Pt } from "../index2.js";
3
- import { NodeViewWrapper as lt, VueRenderer as Ot, VueNodeViewRenderer as at, NodeViewContent as bn, useEditor as vn, EditorContent as Tn } from "@tiptap/vue-3";
4
- import En from "@tiptap/extension-document";
5
- import wn from "@tiptap/extension-paragraph";
6
- import Cn from "@tiptap/extension-text";
7
- import An from "@tiptap/extension-history";
8
- import Sn from "@tiptap/extension-placeholder";
9
- import _n from "@tiptap/extension-character-count";
10
- import { h as Ln, j as kn, p as Mn } from "../index4.js";
11
- import { PluginKey as re, Plugin as ie, TextSelection as O } from "@tiptap/pm/state";
1
+ import { defineComponent as V, openBlock as M, createBlock as J, unref as k, withCtx as j, createTextVNode as ln, toDisplayString as he, ref as F, watch as K, createElementBlock as P, Fragment as Be, renderList as Ie, withModifiers as nt, normalizeClass as Y, createCommentVNode as q, createElementVNode as $, nextTick as ge, isRef as ke, Transition as an, normalizeStyle as cn, createVNode as ie, toRaw as un, computed as R, onMounted as dn, onUnmounted as fn, Teleport as pn, h as mn, toRef as De, onBeforeUnmount as hn, shallowReactive as gn, toValue as xn, provide as yn, renderSlot as D, createSlots as $e, normalizeProps as U, guardReactiveProps as X } from "vue";
2
+ import { a as bn, u as Pe, W as Rt, D as Pt } from "../index2.js";
3
+ import { NodeViewWrapper as lt, VueRenderer as Ot, VueNodeViewRenderer as at, NodeViewContent as vn, useEditor as Tn, EditorContent as En } from "@tiptap/vue-3";
4
+ import wn from "@tiptap/extension-document";
5
+ import Cn from "@tiptap/extension-paragraph";
6
+ import An from "@tiptap/extension-text";
7
+ import Sn from "@tiptap/extension-history";
8
+ import _n from "@tiptap/extension-placeholder";
9
+ import Ln from "@tiptap/extension-character-count";
10
+ import { h as kn, j as Mn, p as Rn } from "../index4.js";
11
+ import { PluginKey as le, Plugin as ae, TextSelection as O } from "@tiptap/pm/state";
12
12
  import { DecorationSet as Le, Decoration as Dt } from "@tiptap/pm/view";
13
- import { _ as J } from "../_plugin-vue_export-helper.js";
14
- import { IconAssociate as Rn, IconArrowDown as Pn } from "@opentiny/tiny-robot-svgs";
15
- import { s as On } from "../useSenderContentRegistration.js";
16
- import { Node as ct, mergeAttributes as ut, Extension as It } from "@tiptap/core";
17
- const Dn = /* @__PURE__ */ Z({
13
+ import { _ as te } from "../_plugin-vue_export-helper.js";
14
+ import { IconAssociate as Pn, IconArrowDown as On } from "@opentiny/tiny-robot-svgs";
15
+ import { s as Dn } from "../useSenderContentRegistration.js";
16
+ import { Node as ct, mergeAttributes as ut, Extension as Bt } from "@tiptap/core";
17
+ const Bn = /* @__PURE__ */ V({
18
18
  __name: "mention-view",
19
19
  props: {
20
20
  node: {},
21
21
  extension: {}
22
22
  },
23
23
  setup(e) {
24
- return (t, n) => (M(), U(k(lt), {
24
+ return (t, o) => (M(), J(k(lt), {
25
25
  as: "span",
26
26
  class: "mention",
27
27
  "data-id": e.node.attrs.id,
28
28
  "data-value": e.node.attrs.value
29
29
  }, {
30
30
  default: j(() => [
31
- ln(pe(e.extension.options.char) + pe(e.node.attrs.label), 1)
31
+ ln(he(e.extension.options.char) + he(e.node.attrs.label), 1)
32
32
  ]),
33
33
  _: 1
34
34
  }, 8, ["data-id", "data-value"]));
35
35
  }
36
- }), In = /* @__PURE__ */ J(Dn, [["__scopeId", "data-v-b42c4fae"]]), je = Math.min, fe = Math.max, Ne = Math.round, Oe = Math.floor, ee = (e) => ({
36
+ }), In = /* @__PURE__ */ te(Bn, [["__scopeId", "data-v-b42c4fae"]]), je = Math.min, me = Math.max, Ne = Math.round, Oe = Math.floor, ne = (e) => ({
37
37
  x: e,
38
38
  y: e
39
- }), Bn = {
39
+ }), $n = {
40
40
  left: "right",
41
41
  right: "left",
42
42
  bottom: "top",
43
43
  top: "bottom"
44
44
  };
45
- function $n(e, t, n) {
46
- return fe(e, je(t, n));
45
+ function jn(e, t, o) {
46
+ return me(e, je(t, o));
47
47
  }
48
48
  function Fe(e, t) {
49
49
  return typeof e == "function" ? e(t) : e;
@@ -54,65 +54,65 @@ function Ee(e) {
54
54
  function Ve(e) {
55
55
  return e.split("-")[1];
56
56
  }
57
- function Bt(e) {
57
+ function It(e) {
58
58
  return e === "x" ? "y" : "x";
59
59
  }
60
60
  function $t(e) {
61
61
  return e === "y" ? "height" : "width";
62
62
  }
63
- function oe(e) {
63
+ function re(e) {
64
64
  const t = e[0];
65
65
  return t === "t" || t === "b" ? "y" : "x";
66
66
  }
67
67
  function jt(e) {
68
- return Bt(oe(e));
68
+ return It(re(e));
69
69
  }
70
- function jn(e, t, n) {
71
- n === void 0 && (n = !1);
72
- const s = Ve(e), r = jt(e), o = $t(r);
73
- let l = r === "x" ? s === (n ? "end" : "start") ? "right" : "left" : s === "start" ? "bottom" : "top";
74
- return t.reference[o] > t.floating[o] && (l = We(l)), [l, We(l)];
70
+ function Nn(e, t, o) {
71
+ o === void 0 && (o = !1);
72
+ const s = Ve(e), r = jt(e), n = $t(r);
73
+ let l = r === "x" ? s === (o ? "end" : "start") ? "right" : "left" : s === "start" ? "bottom" : "top";
74
+ return t.reference[n] > t.floating[n] && (l = We(l)), [l, We(l)];
75
75
  }
76
- function Nn(e) {
76
+ function Wn(e) {
77
77
  const t = We(e);
78
78
  return [ot(e), t, ot(t)];
79
79
  }
80
80
  function ot(e) {
81
81
  return e.includes("start") ? e.replace("start", "end") : e.replace("end", "start");
82
82
  }
83
- const vt = ["left", "right"], Tt = ["right", "left"], Wn = ["top", "bottom"], Kn = ["bottom", "top"];
84
- function qn(e, t, n) {
83
+ const vt = ["left", "right"], Tt = ["right", "left"], Kn = ["top", "bottom"], qn = ["bottom", "top"];
84
+ function Hn(e, t, o) {
85
85
  switch (e) {
86
86
  case "top":
87
87
  case "bottom":
88
- return n ? t ? Tt : vt : t ? vt : Tt;
88
+ return o ? t ? Tt : vt : t ? vt : Tt;
89
89
  case "left":
90
90
  case "right":
91
- return t ? Wn : Kn;
91
+ return t ? Kn : qn;
92
92
  default:
93
93
  return [];
94
94
  }
95
95
  }
96
- function Hn(e, t, n, s) {
96
+ function zn(e, t, o, s) {
97
97
  const r = Ve(e);
98
- let o = qn(Ee(e), n === "start", s);
99
- return r && (o = o.map((l) => l + "-" + r), t && (o = o.concat(o.map(ot)))), o;
98
+ let n = Hn(Ee(e), o === "start", s);
99
+ return r && (n = n.map((l) => l + "-" + r), t && (n = n.concat(n.map(ot)))), n;
100
100
  }
101
101
  function We(e) {
102
102
  const t = Ee(e);
103
- return Bn[t] + e.slice(t.length);
103
+ return $n[t] + e.slice(t.length);
104
104
  }
105
- function zn(e) {
106
- var t, n, s, r;
105
+ function Fn(e) {
106
+ var t, o, s, r;
107
107
  return {
108
108
  top: (t = e.top) != null ? t : 0,
109
- right: (n = e.right) != null ? n : 0,
109
+ right: (o = e.right) != null ? o : 0,
110
110
  bottom: (s = e.bottom) != null ? s : 0,
111
111
  left: (r = e.left) != null ? r : 0
112
112
  };
113
113
  }
114
- function Fn(e) {
115
- return typeof e != "number" ? zn(e) : {
114
+ function Vn(e) {
115
+ return typeof e != "number" ? Fn(e) : {
116
116
  top: e,
117
117
  right: e,
118
118
  bottom: e,
@@ -122,27 +122,27 @@ function Fn(e) {
122
122
  function Ke(e) {
123
123
  const {
124
124
  x: t,
125
- y: n,
125
+ y: o,
126
126
  width: s,
127
127
  height: r
128
128
  } = e;
129
129
  return {
130
130
  width: s,
131
131
  height: r,
132
- top: n,
132
+ top: o,
133
133
  left: t,
134
134
  right: t + s,
135
- bottom: n + r,
135
+ bottom: o + r,
136
136
  x: t,
137
- y: n
137
+ y: o
138
138
  };
139
139
  }
140
- function Et(e, t, n) {
140
+ function Et(e, t, o) {
141
141
  let {
142
142
  reference: s,
143
143
  floating: r
144
144
  } = e;
145
- const o = oe(t), l = jt(t), i = $t(l), a = Ee(t), c = o === "y", d = s.x + s.width / 2 - r.width / 2, u = s.y + s.height / 2 - r.height / 2, g = s[i] / 2 - r[i] / 2;
145
+ const n = re(t), l = jt(t), i = $t(l), a = Ee(t), c = n === "y", d = s.x + s.width / 2 - r.width / 2, u = s.y + s.height / 2 - r.height / 2, g = s[i] / 2 - r[i] / 2;
146
146
  let h;
147
147
  switch (a) {
148
148
  case "top":
@@ -175,16 +175,16 @@ function Et(e, t, n) {
175
175
  y: s.y
176
176
  };
177
177
  }
178
- const E = Ve(t);
179
- return E && (h[l] += g * (E === "end" ? 1 : -1) * (n && c ? -1 : 1)), h;
178
+ const C = Ve(t);
179
+ return C && (h[l] += g * (C === "end" ? 1 : -1) * (o && c ? -1 : 1)), h;
180
180
  }
181
- async function Vn(e, t) {
182
- var n;
181
+ async function Gn(e, t) {
182
+ var o;
183
183
  t === void 0 && (t = {});
184
184
  const {
185
185
  x: s,
186
186
  y: r,
187
- platform: o,
187
+ platform: n,
188
188
  rects: l,
189
189
  elements: i,
190
190
  strategy: a
@@ -194,41 +194,41 @@ async function Vn(e, t) {
194
194
  elementContext: u = "floating",
195
195
  altBoundary: g = !1,
196
196
  padding: h = 0
197
- } = Fe(t, e), E = Fn(h), T = i[g ? u === "floating" ? "reference" : "floating" : u], m = Ke(await o.getClippingRect({
198
- element: (n = await (o.isElement == null ? void 0 : o.isElement(T))) == null || n ? T : T.contextElement || await (o.getDocumentElement == null ? void 0 : o.getDocumentElement(i.floating)),
197
+ } = Fe(t, e), C = Vn(h), b = i[g ? u === "floating" ? "reference" : "floating" : u], m = Ke(await n.getClippingRect({
198
+ element: (o = await (n.isElement == null ? void 0 : n.isElement(b))) == null || o ? b : b.contextElement || await (n.getDocumentElement == null ? void 0 : n.getDocumentElement(i.floating)),
199
199
  boundary: c,
200
200
  rootBoundary: d,
201
201
  strategy: a
202
- })), y = u === "floating" ? {
202
+ })), x = u === "floating" ? {
203
203
  x: s,
204
204
  y: r,
205
205
  width: l.floating.width,
206
206
  height: l.floating.height
207
- } : l.reference, p = await (o.getOffsetParent == null ? void 0 : o.getOffsetParent(i.floating)), f = await (o.isElement == null ? void 0 : o.isElement(p)) && await (o.getScale == null ? void 0 : o.getScale(p)) || {
207
+ } : l.reference, p = await (n.getOffsetParent == null ? void 0 : n.getOffsetParent(i.floating)), f = await (n.isElement == null ? void 0 : n.isElement(p)) && await (n.getScale == null ? void 0 : n.getScale(p)) || {
208
208
  x: 1,
209
209
  y: 1
210
- }, x = Ke(o.convertOffsetParentRelativeRectToViewportRelativeRect ? await o.convertOffsetParentRelativeRectToViewportRelativeRect({
210
+ }, v = Ke(n.convertOffsetParentRelativeRectToViewportRelativeRect ? await n.convertOffsetParentRelativeRectToViewportRelativeRect({
211
211
  elements: i,
212
- rect: y,
212
+ rect: x,
213
213
  offsetParent: p,
214
214
  strategy: a
215
- }) : y);
215
+ }) : x);
216
216
  return {
217
- top: (m.top - x.top + E.top) / f.y,
218
- bottom: (x.bottom - m.bottom + E.bottom) / f.y,
219
- left: (m.left - x.left + E.left) / f.x,
220
- right: (x.right - m.right + E.right) / f.x
217
+ top: (m.top - v.top + C.top) / f.y,
218
+ bottom: (v.bottom - m.bottom + C.bottom) / f.y,
219
+ left: (m.left - v.left + C.left) / f.x,
220
+ right: (v.right - m.right + C.right) / f.x
221
221
  };
222
222
  }
223
- const Gn = 50, Un = async (e, t, n) => {
223
+ const Un = 50, Xn = async (e, t, o) => {
224
224
  const {
225
225
  placement: s = "bottom",
226
226
  strategy: r = "absolute",
227
- middleware: o = [],
227
+ middleware: n = [],
228
228
  platform: l
229
- } = n, i = l.detectOverflow ? l : {
229
+ } = o, i = l.detectOverflow ? l : {
230
230
  ...l,
231
- detectOverflow: Vn
231
+ detectOverflow: Gn
232
232
  }, a = await (l.isRTL == null ? void 0 : l.isRTL(t));
233
233
  let c = await l.getElementRects({
234
234
  reference: e,
@@ -238,26 +238,26 @@ const Gn = 50, Un = async (e, t, n) => {
238
238
  x: d,
239
239
  y: u
240
240
  } = Et(c, s, a), g = s, h = 0;
241
- const E = {};
242
- for (let w = 0; w < o.length; w++) {
243
- const T = o[w];
244
- if (!T)
241
+ const C = {};
242
+ for (let w = 0; w < n.length; w++) {
243
+ const b = n[w];
244
+ if (!b)
245
245
  continue;
246
246
  const {
247
247
  name: m,
248
- fn: y
249
- } = T, {
248
+ fn: x
249
+ } = b, {
250
250
  x: p,
251
251
  y: f,
252
- data: x,
253
- reset: v
254
- } = await y({
252
+ data: v,
253
+ reset: E
254
+ } = await x({
255
255
  x: d,
256
256
  y: u,
257
257
  initialPlacement: s,
258
258
  placement: g,
259
259
  strategy: r,
260
- middlewareData: E,
260
+ middlewareData: C,
261
261
  rects: c,
262
262
  platform: i,
263
263
  elements: {
@@ -265,14 +265,14 @@ const Gn = 50, Un = async (e, t, n) => {
265
265
  floating: t
266
266
  }
267
267
  });
268
- d = p ?? d, u = f ?? u, E[m] = {
269
- ...E[m],
270
- ...x
271
- }, v && h < Gn && (h++, typeof v == "object" && (v.placement && (g = v.placement), v.rects && (c = v.rects === !0 ? await l.getElementRects({
268
+ d = p ?? d, u = f ?? u, C[m] = {
269
+ ...C[m],
270
+ ...v
271
+ }, E && h < Un && (h++, typeof E == "object" && (E.placement && (g = E.placement), E.rects && (c = E.rects === !0 ? await l.getElementRects({
272
272
  reference: e,
273
273
  floating: t,
274
274
  strategy: r
275
- }) : v.rects), {
275
+ }) : E.rects), {
276
276
  x: d,
277
277
  y: u
278
278
  } = Et(c, g, a)), w = -1);
@@ -282,17 +282,17 @@ const Gn = 50, Un = async (e, t, n) => {
282
282
  y: u,
283
283
  placement: g,
284
284
  strategy: r,
285
- middlewareData: E
285
+ middlewareData: C
286
286
  };
287
- }, Xn = function(e) {
287
+ }, Yn = function(e) {
288
288
  return e === void 0 && (e = {}), {
289
289
  name: "flip",
290
290
  options: e,
291
291
  async fn(t) {
292
- var n, s;
292
+ var o, s;
293
293
  const {
294
294
  placement: r,
295
- middlewareData: o,
295
+ middlewareData: n,
296
296
  rects: l,
297
297
  initialPlacement: i,
298
298
  platform: a,
@@ -302,53 +302,53 @@ const Gn = 50, Un = async (e, t, n) => {
302
302
  crossAxis: u = !0,
303
303
  fallbackPlacements: g,
304
304
  fallbackStrategy: h = "bestFit",
305
- fallbackAxisSideDirection: E = "none",
305
+ fallbackAxisSideDirection: C = "none",
306
306
  flipAlignment: w = !0,
307
- ...T
307
+ ...b
308
308
  } = Fe(e, t);
309
- if ((n = o.arrow) != null && n.alignmentOffset)
309
+ if ((o = n.arrow) != null && o.alignmentOffset)
310
310
  return {};
311
- const m = Ee(r), y = oe(i), p = Ee(i) === i, f = await (a.isRTL == null ? void 0 : a.isRTL(c.floating)), x = g || (p || !w ? [We(i)] : Nn(i)), v = E !== "none";
312
- !g && v && x.push(...Hn(i, w, E, f));
313
- const S = [i, ...x], _ = await a.detectOverflow(t, T), b = [];
314
- let L = ((s = o.flip) == null ? void 0 : s.overflows) || [];
315
- if (d && b.push(_[m]), u) {
316
- const V = jn(r, l, f);
317
- b.push(_[V[0]], _[V[1]]);
311
+ const m = Ee(r), x = re(i), p = Ee(i) === i, f = await (a.isRTL == null ? void 0 : a.isRTL(c.floating)), v = g || (p || !w ? [We(i)] : Wn(i)), E = C !== "none";
312
+ !g && E && v.push(...zn(i, w, C, f));
313
+ const T = [i, ...v], A = await a.detectOverflow(t, b), y = [];
314
+ let L = ((s = n.flip) == null ? void 0 : s.overflows) || [];
315
+ if (d && y.push(A[m]), u) {
316
+ const G = Nn(r, l, f);
317
+ y.push(A[G[0]], A[G[1]]);
318
318
  }
319
319
  if (L = [...L, {
320
320
  placement: r,
321
- overflows: b
322
- }], !b.every((V) => V <= 0)) {
323
- var $, N;
324
- const V = ((($ = o.flip) == null ? void 0 : $.index) || 0) + 1, Je = S[V];
325
- if (Je && (!(u === "alignment" ? y !== oe(Je) : !1) || // We leave the current main axis only if every placement on that axis
321
+ overflows: y
322
+ }], !y.every((G) => G <= 0)) {
323
+ var I, N;
324
+ const G = (((I = n.flip) == null ? void 0 : I.index) || 0) + 1, Je = T[G];
325
+ if (Je && (!(u === "alignment" ? x !== re(Je) : !1) || // We leave the current main axis only if every placement on that axis
326
326
  // overflows the main axis.
327
- L.every((H) => oe(H.placement) === y ? H.overflows[0] > 0 : !0)))
327
+ L.every((H) => re(H.placement) === x ? H.overflows[0] > 0 : !0)))
328
328
  return {
329
329
  data: {
330
- index: V,
330
+ index: G,
331
331
  overflows: L
332
332
  },
333
333
  reset: {
334
334
  placement: Je
335
335
  }
336
336
  };
337
- let _e = (N = L.filter((ce) => ce.overflows[0] <= 0).sort((ce, H) => ce.overflows[1] - H.overflows[1])[0]) == null ? void 0 : N.placement;
337
+ let _e = (N = L.filter((de) => de.overflows[0] <= 0).sort((de, H) => de.overflows[1] - H.overflows[1])[0]) == null ? void 0 : N.placement;
338
338
  if (!_e)
339
339
  switch (h) {
340
340
  case "bestFit": {
341
341
  var Se;
342
- const ce = (Se = L.filter((H) => {
343
- if (v) {
344
- const ne = oe(H.placement);
345
- return ne === y || // Create a bias to the `y` side axis due to horizontal
342
+ const de = (Se = L.filter((H) => {
343
+ if (E) {
344
+ const se = re(H.placement);
345
+ return se === x || // Create a bias to the `y` side axis due to horizontal
346
346
  // reading directions favoring greater width.
347
- ne === "y";
347
+ se === "y";
348
348
  }
349
349
  return !0;
350
- }).map((H) => [H.placement, H.overflows.filter((ne) => ne > 0).reduce((ne, rn) => ne + rn, 0)]).sort((H, ne) => H[1] - ne[1])[0]) == null ? void 0 : Se[0];
351
- ce && (_e = ce);
350
+ }).map((H) => [H.placement, H.overflows.filter((se) => se > 0).reduce((se, rn) => se + rn, 0)]).sort((H, se) => H[1] - se[1])[0]) == null ? void 0 : Se[0];
351
+ de && (_e = de);
352
352
  break;
353
353
  }
354
354
  case "initialPlacement":
@@ -365,17 +365,17 @@ const Gn = 50, Un = async (e, t, n) => {
365
365
  return {};
366
366
  }
367
367
  };
368
- }, Yn = /* @__PURE__ */ new Set(["left", "top"]);
369
- async function Zn(e, t) {
368
+ }, Zn = /* @__PURE__ */ new Set(["left", "top"]);
369
+ async function Jn(e, t) {
370
370
  const {
371
- placement: n,
371
+ placement: o,
372
372
  platform: s,
373
373
  elements: r
374
- } = e, o = await (s.isRTL == null ? void 0 : s.isRTL(r.floating)), l = Ee(n), i = Ve(n), a = oe(n) === "y", c = Yn.has(l) ? -1 : 1, d = o && a ? -1 : 1, u = Fe(t, e);
374
+ } = e, n = await (s.isRTL == null ? void 0 : s.isRTL(r.floating)), l = Ee(o), i = Ve(o), a = re(o) === "y", c = Zn.has(l) ? -1 : 1, d = n && a ? -1 : 1, u = Fe(t, e);
375
375
  let {
376
376
  mainAxis: g,
377
377
  crossAxis: h,
378
- alignmentAxis: E
378
+ alignmentAxis: C
379
379
  } = typeof u == "number" ? {
380
380
  mainAxis: u,
381
381
  crossAxis: 0,
@@ -385,7 +385,7 @@ async function Zn(e, t) {
385
385
  crossAxis: u.crossAxis || 0,
386
386
  alignmentAxis: u.alignmentAxis
387
387
  };
388
- return i && typeof E == "number" && (h = i === "end" ? E * -1 : E), a ? {
388
+ return i && typeof C == "number" && (h = i === "end" ? C * -1 : C), a ? {
389
389
  x: h * d,
390
390
  y: g * c
391
391
  } : {
@@ -393,21 +393,21 @@ async function Zn(e, t) {
393
393
  y: h * d
394
394
  };
395
395
  }
396
- const Jn = function(e) {
396
+ const Qn = function(e) {
397
397
  return e === void 0 && (e = 0), {
398
398
  name: "offset",
399
399
  options: e,
400
400
  async fn(t) {
401
- var n, s;
401
+ var o, s;
402
402
  const {
403
403
  x: r,
404
- y: o,
404
+ y: n,
405
405
  placement: l,
406
406
  middlewareData: i
407
- } = t, a = await Zn(t, e);
408
- return l === ((n = i.offset) == null ? void 0 : n.placement) && (s = i.arrow) != null && s.alignmentOffset ? {} : {
407
+ } = t, a = await Jn(t, e);
408
+ return l === ((o = i.offset) == null ? void 0 : o.placement) && (s = i.arrow) != null && s.alignmentOffset ? {} : {
409
409
  x: r + a.x,
410
- y: o + a.y,
410
+ y: n + a.y,
411
411
  data: {
412
412
  ...a,
413
413
  placement: l
@@ -415,25 +415,25 @@ const Jn = function(e) {
415
415
  };
416
416
  }
417
417
  };
418
- }, Qn = function(e) {
418
+ }, eo = function(e) {
419
419
  return e === void 0 && (e = {}), {
420
420
  name: "shift",
421
421
  options: e,
422
422
  async fn(t) {
423
423
  const {
424
- x: n,
424
+ x: o,
425
425
  y: s,
426
426
  placement: r,
427
- platform: o
427
+ platform: n
428
428
  } = t, {
429
429
  mainAxis: l = !0,
430
430
  crossAxis: i = !1,
431
431
  limiter: a = {
432
- fn: (y) => {
432
+ fn: (x) => {
433
433
  let {
434
434
  x: p,
435
435
  y: f
436
- } = y;
436
+ } = x;
437
437
  return {
438
438
  x: p,
439
439
  y: f
@@ -442,21 +442,21 @@ const Jn = function(e) {
442
442
  },
443
443
  ...c
444
444
  } = Fe(e, t), d = {
445
- x: n,
445
+ x: o,
446
446
  y: s
447
- }, u = await o.detectOverflow(t, c), g = oe(r), h = Bt(g);
448
- let E = d[h], w = d[g];
449
- const T = (y, p) => $n(p + u[y === "y" ? "top" : "left"], p, p - u[y === "y" ? "bottom" : "right"]);
450
- l && (E = T(h, E)), i && (w = T(g, w));
447
+ }, u = await n.detectOverflow(t, c), g = re(r), h = It(g);
448
+ let C = d[h], w = d[g];
449
+ const b = (x, p) => jn(p + u[x === "y" ? "top" : "left"], p, p - u[x === "y" ? "bottom" : "right"]);
450
+ l && (C = b(h, C)), i && (w = b(g, w));
451
451
  const m = a.fn({
452
452
  ...t,
453
- [h]: E,
453
+ [h]: C,
454
454
  [g]: w
455
455
  });
456
456
  return {
457
457
  ...m,
458
458
  data: {
459
- x: m.x - n,
459
+ x: m.x - o,
460
460
  y: m.y - s,
461
461
  enabled: {
462
462
  [h]: l,
@@ -477,17 +477,17 @@ function W(e) {
477
477
  var t;
478
478
  return (e == null || (t = e.ownerDocument) == null ? void 0 : t.defaultView) || window;
479
479
  }
480
- function te(e) {
480
+ function oe(e) {
481
481
  var t;
482
482
  return (t = (Nt(e) ? e.ownerDocument : e.document) || window.document) == null ? void 0 : t.documentElement;
483
483
  }
484
484
  function Nt(e) {
485
485
  return Ge() ? e instanceof Node || e instanceof W(e).Node : !1;
486
486
  }
487
- function X(e) {
487
+ function Q(e) {
488
488
  return Ge() ? e instanceof Element || e instanceof W(e).Element : !1;
489
489
  }
490
- function le(e) {
490
+ function ce(e) {
491
491
  return Ge() ? e instanceof HTMLElement || e instanceof W(e).HTMLElement : !1;
492
492
  }
493
493
  function wt(e) {
@@ -496,13 +496,13 @@ function wt(e) {
496
496
  function Ue(e) {
497
497
  const {
498
498
  overflow: t,
499
- overflowX: n,
499
+ overflowX: o,
500
500
  overflowY: s,
501
501
  display: r
502
- } = Y(e);
503
- return /auto|scroll|overlay|hidden|clip/.test(t + s + n) && r !== "inline" && r !== "contents";
502
+ } = ee(e);
503
+ return /auto|scroll|overlay|hidden|clip/.test(t + s + o) && r !== "inline" && r !== "contents";
504
504
  }
505
- function eo(e) {
505
+ function to(e) {
506
506
  return /^(table|td|th)$/.test(Ae(e));
507
507
  }
508
508
  function Xe(e) {
@@ -517,15 +517,15 @@ function Xe(e) {
517
517
  return !1;
518
518
  }
519
519
  }
520
- const to = /transform|translate|scale|rotate|perspective|filter/, no = /paint|layout|strict|content/, ue = (e) => !!e && e !== "none";
520
+ const no = /transform|translate|scale|rotate|perspective|filter/, oo = /paint|layout|strict|content/, fe = (e) => !!e && e !== "none";
521
521
  let Qe;
522
522
  function dt(e) {
523
- const t = X(e) ? Y(e) : e;
524
- return ue(t.transform) || ue(t.translate) || ue(t.scale) || ue(t.rotate) || ue(t.perspective) || !ft() && (ue(t.backdropFilter) || ue(t.filter)) || to.test(t.willChange || "") || no.test(t.contain || "");
523
+ const t = Q(e) ? ee(e) : e;
524
+ return fe(t.transform) || fe(t.translate) || fe(t.scale) || fe(t.rotate) || fe(t.perspective) || !ft() && (fe(t.backdropFilter) || fe(t.filter)) || no.test(t.willChange || "") || oo.test(t.contain || "");
525
525
  }
526
- function oo(e) {
526
+ function so(e) {
527
527
  let t = xe(e);
528
- for (; le(t) && !Me(t); ) {
528
+ for (; ce(t) && !Me(t); ) {
529
529
  if (dt(t))
530
530
  return t;
531
531
  if (Xe(t))
@@ -540,11 +540,11 @@ function ft() {
540
540
  function Me(e) {
541
541
  return /^(html|body|#document)$/.test(Ae(e));
542
542
  }
543
- function Y(e) {
543
+ function ee(e) {
544
544
  return W(e).getComputedStyle(e);
545
545
  }
546
546
  function Ye(e) {
547
- return X(e) ? {
547
+ return Q(e) ? {
548
548
  scrollLeft: e.scrollLeft,
549
549
  scrollTop: e.scrollTop
550
550
  } : {
@@ -560,79 +560,79 @@ function xe(e) {
560
560
  e.assignedSlot || // DOM Element detected.
561
561
  e.parentNode || // ShadowRoot detected.
562
562
  wt(e) && e.host || // Fallback.
563
- te(e)
563
+ oe(e)
564
564
  );
565
565
  return wt(t) ? t.host : t;
566
566
  }
567
567
  function Wt(e) {
568
568
  const t = xe(e);
569
- return Me(t) ? (e.ownerDocument || e).body : le(t) && Ue(t) ? t : Wt(t);
569
+ return Me(t) ? (e.ownerDocument || e).body : ce(t) && Ue(t) ? t : Wt(t);
570
570
  }
571
- function Re(e, t, n) {
571
+ function Re(e, t, o) {
572
572
  var s;
573
- t === void 0 && (t = []), n === void 0 && (n = !0);
574
- const r = Wt(e), o = r === ((s = e.ownerDocument) == null ? void 0 : s.body), l = W(r);
575
- if (o) {
573
+ t === void 0 && (t = []), o === void 0 && (o = !0);
574
+ const r = Wt(e), n = r === ((s = e.ownerDocument) == null ? void 0 : s.body), l = W(r);
575
+ if (n) {
576
576
  const i = st(l);
577
- return t.concat(l, l.visualViewport || [], Ue(r) ? r : [], i && n ? Re(i) : []);
577
+ return t.concat(l, l.visualViewport || [], Ue(r) ? r : [], i && o ? Re(i) : []);
578
578
  } else
579
- return t.concat(r, Re(r, [], n));
579
+ return t.concat(r, Re(r, [], o));
580
580
  }
581
581
  function st(e) {
582
582
  return e.parent && Object.getPrototypeOf(e.parent) ? e.frameElement : null;
583
583
  }
584
584
  function Kt(e) {
585
- const t = Y(e);
586
- let n = parseFloat(t.width) || 0, s = parseFloat(t.height) || 0;
587
- const r = le(e), o = r ? e.offsetWidth : n, l = r ? e.offsetHeight : s, i = Ne(n) !== o || Ne(s) !== l;
588
- return i && (n = o, s = l), {
589
- width: n,
585
+ const t = ee(e);
586
+ let o = parseFloat(t.width) || 0, s = parseFloat(t.height) || 0;
587
+ const r = ce(e), n = r ? e.offsetWidth : o, l = r ? e.offsetHeight : s, i = Ne(o) !== n || Ne(s) !== l;
588
+ return i && (o = n, s = l), {
589
+ width: o,
590
590
  height: s,
591
591
  $: i
592
592
  };
593
593
  }
594
594
  function pt(e) {
595
- return X(e) ? e : e.contextElement;
595
+ return Q(e) ? e : e.contextElement;
596
596
  }
597
597
  function Te(e) {
598
598
  const t = pt(e);
599
- if (!le(t))
600
- return ee(1);
601
- const n = t.getBoundingClientRect(), {
599
+ if (!ce(t))
600
+ return ne(1);
601
+ const o = t.getBoundingClientRect(), {
602
602
  width: s,
603
603
  height: r,
604
- $: o
604
+ $: n
605
605
  } = Kt(t);
606
- let l = (o ? Ne(n.width) : n.width) / s, i = (o ? Ne(n.height) : n.height) / r;
606
+ let l = (n ? Ne(o.width) : o.width) / s, i = (n ? Ne(o.height) : o.height) / r;
607
607
  return (!l || !Number.isFinite(l)) && (l = 1), (!i || !Number.isFinite(i)) && (i = 1), {
608
608
  x: l,
609
609
  y: i
610
610
  };
611
611
  }
612
- const so = /* @__PURE__ */ ee(0);
612
+ const ro = /* @__PURE__ */ ne(0);
613
613
  function qt(e) {
614
614
  const t = W(e);
615
- return !ft() || !t.visualViewport ? so : {
615
+ return !ft() || !t.visualViewport ? ro : {
616
616
  x: t.visualViewport.offsetLeft,
617
617
  y: t.visualViewport.offsetTop
618
618
  };
619
619
  }
620
- function ro(e, t, n) {
621
- return t === void 0 && (t = !1), !!n && t && n === W(e);
620
+ function io(e, t, o) {
621
+ return t === void 0 && (t = !1), !!o && t && o === W(e);
622
622
  }
623
- function ye(e, t, n, s) {
624
- t === void 0 && (t = !1), n === void 0 && (n = !1);
625
- const r = e.getBoundingClientRect(), o = pt(e);
626
- let l = ee(1);
627
- t && (s ? X(s) && (l = Te(s)) : l = Te(e));
628
- const i = ro(o, n, s) ? qt(o) : ee(0);
623
+ function ye(e, t, o, s) {
624
+ t === void 0 && (t = !1), o === void 0 && (o = !1);
625
+ const r = e.getBoundingClientRect(), n = pt(e);
626
+ let l = ne(1);
627
+ t && (s ? Q(s) && (l = Te(s)) : l = Te(e));
628
+ const i = io(n, o, s) ? qt(n) : ne(0);
629
629
  let a = (r.left + i.x) / l.x, c = (r.top + i.y) / l.y, d = r.width / l.x, u = r.height / l.y;
630
- if (o && s) {
631
- const g = W(o), h = X(s) ? W(s) : s;
632
- let E = g, w = st(E);
633
- for (; w && h !== E; ) {
634
- const T = Te(w), m = w.getBoundingClientRect(), y = Y(w), p = m.left + (w.clientLeft + parseFloat(y.paddingLeft)) * T.x, f = m.top + (w.clientTop + parseFloat(y.paddingTop)) * T.y;
635
- a *= T.x, c *= T.y, d *= T.x, u *= T.y, a += p, c += f, E = W(w), w = st(E);
630
+ if (n && s) {
631
+ const g = W(n), h = Q(s) ? W(s) : s;
632
+ let C = g, w = st(C);
633
+ for (; w && h !== C; ) {
634
+ const b = Te(w), m = w.getBoundingClientRect(), x = ee(w), p = m.left + (w.clientLeft + parseFloat(x.paddingLeft)) * b.x, f = m.top + (w.clientTop + parseFloat(x.paddingTop)) * b.y;
635
+ a *= b.x, c *= b.y, d *= b.x, u *= b.y, a += p, c += f, C = W(w), w = st(C);
636
636
  }
637
637
  }
638
638
  return Ke({
@@ -643,69 +643,69 @@ function ye(e, t, n, s) {
643
643
  });
644
644
  }
645
645
  function Ze(e, t) {
646
- const n = Ye(e).scrollLeft;
647
- return t ? t.left + n : ye(te(e)).left + n;
646
+ const o = Ye(e).scrollLeft;
647
+ return t ? t.left + o : ye(oe(e)).left + o;
648
648
  }
649
649
  function Ht(e, t) {
650
- const n = e.getBoundingClientRect(), s = n.left + t.scrollLeft - Ze(e, n), r = n.top + t.scrollTop;
650
+ const o = e.getBoundingClientRect(), s = o.left + t.scrollLeft - Ze(e, o), r = o.top + t.scrollTop;
651
651
  return {
652
652
  x: s,
653
653
  y: r
654
654
  };
655
655
  }
656
- function io(e) {
656
+ function lo(e) {
657
657
  let {
658
658
  elements: t,
659
- rect: n,
659
+ rect: o,
660
660
  offsetParent: s,
661
661
  strategy: r
662
662
  } = e;
663
- const o = r === "fixed", l = te(s), i = t ? Xe(t.floating) : !1;
664
- if (s === l || i && o)
665
- return n;
663
+ const n = r === "fixed", l = oe(s), i = t ? Xe(t.floating) : !1;
664
+ if (s === l || i && n)
665
+ return o;
666
666
  let a = {
667
667
  scrollLeft: 0,
668
668
  scrollTop: 0
669
- }, c = ee(1);
670
- const d = ee(0), u = le(s);
671
- if ((u || !o) && ((Ae(s) !== "body" || Ue(l)) && (a = Ye(s)), u)) {
669
+ }, c = ne(1);
670
+ const d = ne(0), u = ce(s);
671
+ if ((u || !n) && ((Ae(s) !== "body" || Ue(l)) && (a = Ye(s)), u)) {
672
672
  const h = ye(s);
673
673
  c = Te(s), d.x = h.x + s.clientLeft, d.y = h.y + s.clientTop;
674
674
  }
675
- const g = l && !u && !o ? Ht(l, a) : ee(0);
675
+ const g = l && !u && !n ? Ht(l, a) : ne(0);
676
676
  return {
677
- width: n.width * c.x,
678
- height: n.height * c.y,
679
- x: n.x * c.x - a.scrollLeft * c.x + d.x + g.x,
680
- y: n.y * c.y - a.scrollTop * c.y + d.y + g.y
677
+ width: o.width * c.x,
678
+ height: o.height * c.y,
679
+ x: o.x * c.x - a.scrollLeft * c.x + d.x + g.x,
680
+ y: o.y * c.y - a.scrollTop * c.y + d.y + g.y
681
681
  };
682
682
  }
683
- function lo(e) {
683
+ function ao(e) {
684
684
  return e.getClientRects ? Array.from(e.getClientRects()) : [];
685
685
  }
686
- function ao(e) {
687
- const t = Ye(e), n = e.ownerDocument.body, s = fe(e.scrollWidth, e.clientWidth, n.scrollWidth, n.clientWidth), r = fe(e.scrollHeight, e.clientHeight, n.scrollHeight, n.clientHeight);
688
- let o = -t.scrollLeft + Ze(e);
686
+ function co(e) {
687
+ const t = Ye(e), o = e.ownerDocument.body, s = me(e.scrollWidth, e.clientWidth, o.scrollWidth, o.clientWidth), r = me(e.scrollHeight, e.clientHeight, o.scrollHeight, o.clientHeight);
688
+ let n = -t.scrollLeft + Ze(e);
689
689
  const l = -t.scrollTop;
690
- return Y(n).direction === "rtl" && (o += fe(e.clientWidth, n.clientWidth) - s), {
690
+ return ee(o).direction === "rtl" && (n += me(e.clientWidth, o.clientWidth) - s), {
691
691
  width: s,
692
692
  height: r,
693
- x: o,
693
+ x: n,
694
694
  y: l
695
695
  };
696
696
  }
697
- const co = 25;
698
- function uo(e, t, n) {
699
- n === void 0 && (n = "viewport");
700
- const s = n === "layoutViewport", r = W(e), o = te(e), l = r.visualViewport;
701
- let i = o.clientWidth, a = o.clientHeight, c = 0, d = 0;
697
+ const uo = 25;
698
+ function fo(e, t, o) {
699
+ o === void 0 && (o = "viewport");
700
+ const s = o === "layoutViewport", r = W(e), n = oe(e), l = r.visualViewport;
701
+ let i = n.clientWidth, a = n.clientHeight, c = 0, d = 0;
702
702
  if (l) {
703
703
  const g = !ft() || t === "fixed";
704
704
  s ? g || (c = -l.offsetLeft, d = -l.offsetTop) : (i = l.width, a = l.height, g && (c = l.offsetLeft, d = l.offsetTop));
705
705
  }
706
- if (Ze(o) <= 0) {
707
- const g = o.ownerDocument, h = g.body, E = getComputedStyle(h), w = g.compatMode === "CSS1Compat" && parseFloat(E.marginLeft) + parseFloat(E.marginRight) || 0, T = Math.abs(o.clientWidth - h.clientWidth - w), m = getComputedStyle(o).scrollbarGutter === "stable both-edges" ? T / 2 : T;
708
- m <= co && (i -= m);
706
+ if (Ze(n) <= 0) {
707
+ const g = n.ownerDocument, h = g.body, C = getComputedStyle(h), w = g.compatMode === "CSS1Compat" && parseFloat(C.marginLeft) + parseFloat(C.marginRight) || 0, b = Math.abs(n.clientWidth - h.clientWidth - w), m = getComputedStyle(n).scrollbarGutter === "stable both-edges" ? b / 2 : b;
708
+ m <= uo && (i -= m);
709
709
  }
710
710
  return {
711
711
  width: i,
@@ -714,8 +714,8 @@ function uo(e, t, n) {
714
714
  y: d
715
715
  };
716
716
  }
717
- function fo(e, t) {
718
- const n = ye(e, !0, t === "fixed"), s = n.top + e.clientTop, r = n.left + e.clientLeft, o = Te(e), l = e.clientWidth * o.x, i = e.clientHeight * o.y, a = r * o.x, c = s * o.y;
717
+ function po(e, t) {
718
+ const o = ye(e, !0, t === "fixed"), s = o.top + e.clientTop, r = o.left + e.clientLeft, n = Te(e), l = e.clientWidth * n.x, i = e.clientHeight * n.y, a = r * n.x, c = s * n.y;
719
719
  return {
720
720
  width: l,
721
721
  height: i,
@@ -723,14 +723,14 @@ function fo(e, t) {
723
723
  y: c
724
724
  };
725
725
  }
726
- function Ct(e, t, n) {
726
+ function Ct(e, t, o) {
727
727
  let s;
728
728
  if (t === "viewport" || t === "layoutViewport")
729
- s = uo(e, n, t);
729
+ s = fo(e, o, t);
730
730
  else if (t === "document")
731
- s = ao(te(e));
732
- else if (X(t))
733
- s = fo(t, n);
731
+ s = co(oe(e));
732
+ else if (Q(t))
733
+ s = po(t, o);
734
734
  else {
735
735
  const r = qt(e);
736
736
  s = {
@@ -742,31 +742,31 @@ function Ct(e, t, n) {
742
742
  }
743
743
  return Ke(s);
744
744
  }
745
- function po(e, t) {
746
- const n = t.get(e);
747
- if (n)
748
- return n;
749
- let s = Re(e, [], !1).filter((i) => X(i) && Ae(i) !== "body"), r = null;
750
- const o = Y(e).position === "fixed";
751
- let l = o ? xe(e) : e;
752
- for (; X(l) && !Me(l); ) {
753
- const i = Y(l), a = dt(l), c = r ? r.position : o ? "fixed" : "";
745
+ function mo(e, t) {
746
+ const o = t.get(e);
747
+ if (o)
748
+ return o;
749
+ let s = Re(e, [], !1).filter((i) => Q(i) && Ae(i) !== "body"), r = null;
750
+ const n = ee(e).position === "fixed";
751
+ let l = n ? xe(e) : e;
752
+ for (; Q(l) && !Me(l); ) {
753
+ const i = ee(l), a = dt(l), c = r ? r.position : n ? "fixed" : "";
754
754
  !a && (c === "fixed" || c === "absolute" && i.position === "static") ? s = s.filter((u) => u !== l) : r = i, l = xe(l);
755
755
  }
756
756
  return t.set(e, s), s;
757
757
  }
758
- function mo(e) {
758
+ function ho(e) {
759
759
  let {
760
760
  element: t,
761
- boundary: n,
761
+ boundary: o,
762
762
  rootBoundary: s,
763
763
  strategy: r
764
764
  } = e;
765
- const l = [...n === "clippingAncestors" ? Xe(t) ? [] : po(t, this._c) : [].concat(n), s], i = Ct(t, l[0], r);
765
+ const l = [...o === "clippingAncestors" ? Xe(t) ? [] : mo(t, this._c) : [].concat(o), s], i = Ct(t, l[0], r);
766
766
  let a = i.top, c = i.right, d = i.bottom, u = i.left;
767
767
  for (let g = 1; g < l.length; g++) {
768
768
  const h = Ct(t, l[g], r);
769
- a = fe(h.top, a), c = je(h.right, c), d = je(h.bottom, d), u = fe(h.left, u);
769
+ a = me(h.top, a), c = je(h.right, c), d = je(h.bottom, d), u = me(h.left, u);
770
770
  }
771
771
  return {
772
772
  width: c - u,
@@ -775,29 +775,29 @@ function mo(e) {
775
775
  y: a
776
776
  };
777
777
  }
778
- function ho(e) {
778
+ function go(e) {
779
779
  const {
780
780
  width: t,
781
- height: n
781
+ height: o
782
782
  } = Kt(e);
783
783
  return {
784
784
  width: t,
785
- height: n
785
+ height: o
786
786
  };
787
787
  }
788
- function go(e, t, n) {
789
- const s = le(t), r = te(t), o = n === "fixed", l = ye(e, !0, o, t);
788
+ function xo(e, t, o) {
789
+ const s = ce(t), r = oe(t), n = o === "fixed", l = ye(e, !0, n, t);
790
790
  let i = {
791
791
  scrollLeft: 0,
792
792
  scrollTop: 0
793
793
  };
794
- const a = ee(0);
795
- if ((s || !o) && ((Ae(t) !== "body" || Ue(r)) && (i = Ye(t)), s)) {
796
- const g = ye(t, !0, o, t);
794
+ const a = ne(0);
795
+ if ((s || !n) && ((Ae(t) !== "body" || Ue(r)) && (i = Ye(t)), s)) {
796
+ const g = ye(t, !0, n, t);
797
797
  a.x = g.x + t.clientLeft, a.y = g.y + t.clientTop;
798
798
  }
799
799
  !s && r && (a.x = Ze(r));
800
- const c = r && !s && !o ? Ht(r, i) : ee(0), d = l.left + i.scrollLeft - a.x - c.x, u = l.top + i.scrollTop - a.y - c.y;
800
+ const c = r && !s && !n ? Ht(r, i) : ne(0), d = l.left + i.scrollLeft - a.x - c.x, u = l.top + i.scrollTop - a.y - c.y;
801
801
  return {
802
802
  x: d,
803
803
  y: u,
@@ -806,38 +806,38 @@ function go(e, t, n) {
806
806
  };
807
807
  }
808
808
  function et(e) {
809
- return Y(e).position === "static";
809
+ return ee(e).position === "static";
810
810
  }
811
811
  function At(e, t) {
812
- if (!le(e) || Y(e).position === "fixed")
812
+ if (!ce(e) || ee(e).position === "fixed")
813
813
  return null;
814
814
  if (t)
815
815
  return t(e);
816
- let n = e.offsetParent;
817
- return te(e) === n && (n = n.ownerDocument.body), n;
816
+ let o = e.offsetParent;
817
+ return oe(e) === o && (o = o.ownerDocument.body), o;
818
818
  }
819
819
  function zt(e, t) {
820
- const n = W(e);
820
+ const o = W(e);
821
821
  if (Xe(e))
822
- return n;
823
- if (!le(e)) {
822
+ return o;
823
+ if (!ce(e)) {
824
824
  let r = xe(e);
825
825
  for (; r && !Me(r); ) {
826
- if (X(r) && !et(r))
826
+ if (Q(r) && !et(r))
827
827
  return r;
828
828
  r = xe(r);
829
829
  }
830
- return n;
830
+ return o;
831
831
  }
832
832
  let s = At(e, t);
833
- for (; s && eo(s) && et(s); )
833
+ for (; s && to(s) && et(s); )
834
834
  s = At(s, t);
835
- return s && Me(s) && et(s) && !dt(s) ? n : s || oo(e) || n;
835
+ return s && Me(s) && et(s) && !dt(s) ? o : s || so(e) || o;
836
836
  }
837
- const xo = async function(e) {
838
- const t = this.getOffsetParent || zt, n = this.getDimensions, s = await n(e.floating);
837
+ const yo = async function(e) {
838
+ const t = this.getOffsetParent || zt, o = this.getDimensions, s = await o(e.floating);
839
839
  return {
840
- reference: go(e.reference, await t(e.floating), e.strategy),
840
+ reference: xo(e.reference, await t(e.floating), e.strategy),
841
841
  floating: {
842
842
  x: 0,
843
843
  y: 0,
@@ -846,27 +846,27 @@ const xo = async function(e) {
846
846
  }
847
847
  };
848
848
  };
849
- function yo(e) {
850
- return Y(e).direction === "rtl";
849
+ function bo(e) {
850
+ return ee(e).direction === "rtl";
851
851
  }
852
- const bo = {
853
- convertOffsetParentRelativeRectToViewportRelativeRect: io,
854
- getDocumentElement: te,
855
- getClippingRect: mo,
852
+ const vo = {
853
+ convertOffsetParentRelativeRectToViewportRelativeRect: lo,
854
+ getDocumentElement: oe,
855
+ getClippingRect: ho,
856
856
  getOffsetParent: zt,
857
- getElementRects: xo,
858
- getClientRects: lo,
859
- getDimensions: ho,
857
+ getElementRects: yo,
858
+ getClientRects: ao,
859
+ getDimensions: go,
860
860
  getScale: Te,
861
- isElement: X,
862
- isRTL: yo
861
+ isElement: Q,
862
+ isRTL: bo
863
863
  };
864
864
  function Ft(e, t) {
865
865
  return e.x === t.x && e.y === t.y && e.width === t.width && e.height === t.height;
866
866
  }
867
- function vo(e, t, n) {
867
+ function To(e, t, o) {
868
868
  let s = null, r;
869
- const o = te(e);
869
+ const n = oe(e);
870
870
  function l() {
871
871
  var d;
872
872
  clearTimeout(r), (d = s) == null || d.disconnect(), s = null;
@@ -875,105 +875,105 @@ function vo(e, t, n) {
875
875
  d === void 0 && (d = !1), u === void 0 && (u = 1), l();
876
876
  const g = e.getBoundingClientRect(), {
877
877
  left: h,
878
- top: E,
878
+ top: C,
879
879
  width: w,
880
- height: T
880
+ height: b
881
881
  } = g;
882
- if (d || t(), !w || !T)
882
+ if (d || t(), !w || !b)
883
883
  return;
884
- const m = Oe(E), y = Oe(o.clientWidth - (h + w)), p = Oe(o.clientHeight - (E + T)), f = Oe(h), v = {
885
- rootMargin: -m + "px " + -y + "px " + -p + "px " + -f + "px",
886
- threshold: fe(0, je(1, u)) || 1
884
+ const m = Oe(C), x = Oe(n.clientWidth - (h + w)), p = Oe(n.clientHeight - (C + b)), f = Oe(h), E = {
885
+ rootMargin: -m + "px " + -x + "px " + -p + "px " + -f + "px",
886
+ threshold: me(0, je(1, u)) || 1
887
887
  };
888
- let S = !0;
889
- function _(b) {
890
- const L = b[0].intersectionRatio;
888
+ let T = !0;
889
+ function A(y) {
890
+ const L = y[0].intersectionRatio;
891
891
  if (!Ft(g, e.getBoundingClientRect()))
892
892
  return i();
893
893
  if (L !== u) {
894
- if (!S)
894
+ if (!T)
895
895
  return i();
896
896
  L ? i(!1, L) : r = setTimeout(() => {
897
897
  i(!1, 1e-7);
898
898
  }, 1e3);
899
899
  }
900
- S = !1;
900
+ T = !1;
901
901
  }
902
902
  try {
903
- s = new IntersectionObserver(_, {
904
- ...v,
903
+ s = new IntersectionObserver(A, {
904
+ ...E,
905
905
  // Handle <iframe>s
906
- root: o.ownerDocument
906
+ root: n.ownerDocument
907
907
  });
908
908
  } catch {
909
- s = new IntersectionObserver(_, v);
909
+ s = new IntersectionObserver(A, E);
910
910
  }
911
911
  s.observe(e);
912
912
  }
913
- const a = W(e), c = () => i(n);
913
+ const a = W(e), c = () => i(o);
914
914
  return a.addEventListener("resize", c), i(!0), () => {
915
915
  a.removeEventListener("resize", c), l();
916
916
  };
917
917
  }
918
- function mt(e, t, n, s) {
918
+ function mt(e, t, o, s) {
919
919
  s === void 0 && (s = {});
920
920
  const {
921
921
  ancestorScroll: r = !0,
922
- ancestorResize: o = !0,
922
+ ancestorResize: n = !0,
923
923
  elementResize: l = typeof ResizeObserver == "function",
924
924
  layoutShift: i = typeof IntersectionObserver == "function",
925
925
  animationFrame: a = !1
926
- } = s, c = pt(e), d = r || o ? [...c ? Re(c) : [], ...t ? Re(t) : []] : [];
926
+ } = s, c = pt(e), d = r || n ? [...c ? Re(c) : [], ...t ? Re(t) : []] : [];
927
927
  d.forEach((m) => {
928
- r && m.addEventListener("scroll", n), o && m.addEventListener("resize", n);
928
+ r && m.addEventListener("scroll", o), n && m.addEventListener("resize", o);
929
929
  });
930
- const u = c && i ? vo(c, n, o) : null;
930
+ const u = c && i ? To(c, o, n) : null;
931
931
  let g = -1, h = null;
932
932
  l && (h = new ResizeObserver((m) => {
933
- let [y] = m;
934
- y && y.target === c && h && t && (h.unobserve(t), cancelAnimationFrame(g), g = requestAnimationFrame(() => {
933
+ let [x] = m;
934
+ x && x.target === c && h && t && (h.unobserve(t), cancelAnimationFrame(g), g = requestAnimationFrame(() => {
935
935
  var p;
936
936
  (p = h) == null || p.observe(t);
937
- })), n();
937
+ })), o();
938
938
  }), c && !a && h.observe(c), t && h.observe(t));
939
- let E, w = a ? ye(e) : null;
940
- a && T();
941
- function T() {
939
+ let C, w = a ? ye(e) : null;
940
+ a && b();
941
+ function b() {
942
942
  const m = ye(e);
943
- w && !Ft(w, m) && n(), w = m, E = requestAnimationFrame(T);
943
+ w && !Ft(w, m) && o(), w = m, C = requestAnimationFrame(b);
944
944
  }
945
- return n(), () => {
945
+ return o(), () => {
946
946
  var m;
947
- d.forEach((y) => {
948
- r && y.removeEventListener("scroll", n), o && y.removeEventListener("resize", n);
949
- }), u == null || u(), (m = h) == null || m.disconnect(), h = null, a && cancelAnimationFrame(E);
947
+ d.forEach((x) => {
948
+ r && x.removeEventListener("scroll", o), n && x.removeEventListener("resize", o);
949
+ }), u == null || u(), (m = h) == null || m.disconnect(), h = null, a && cancelAnimationFrame(C);
950
950
  };
951
951
  }
952
- const ht = Jn, gt = Qn, xt = Xn, yt = (e, t, n) => {
953
- const s = /* @__PURE__ */ new Map(), r = n ?? {}, o = {
954
- ...bo,
952
+ const ht = Qn, gt = eo, xt = Yn, yt = (e, t, o) => {
953
+ const s = /* @__PURE__ */ new Map(), r = o ?? {}, n = {
954
+ ...vo,
955
955
  ...r.platform,
956
956
  _c: s
957
957
  };
958
- return Un(e, t, {
958
+ return Xn(e, t, {
959
959
  ...r,
960
- platform: o
960
+ platform: n
961
961
  });
962
962
  };
963
963
  function ve(e) {
964
964
  return `${e}_${Date.now()}_${Math.random().toString(36).slice(2, 9)}`;
965
965
  }
966
- function To(e, t, n = !1) {
966
+ function Eo(e, t, o = !1) {
967
967
  const { $from: s } = e;
968
968
  if (!e.empty || !s.parent.isTextblock)
969
969
  return null;
970
- const r = s.parent.textBetween(0, s.parentOffset, void 0, ""), o = r.lastIndexOf(t);
971
- if (o === -1)
970
+ const r = s.parent.textBetween(0, s.parentOffset, void 0, ""), n = r.lastIndexOf(t);
971
+ if (n === -1)
972
972
  return null;
973
- const l = r.slice(o + t.length);
974
- if (!n && l.includes(" "))
973
+ const l = r.slice(n + t.length);
974
+ if (!o && l.includes(" "))
975
975
  return null;
976
- const i = s.start() + o, a = s.pos;
976
+ const i = s.start() + n, a = s.pos;
977
977
  return {
978
978
  range: { from: i, to: a },
979
979
  query: l
@@ -986,7 +986,7 @@ const be = {
986
986
  MENTION: "mention",
987
987
  /** Suggestion 扩展 */
988
988
  SUGGESTION: "suggestion"
989
- }, A = {
989
+ }, _ = {
990
990
  /** TemplateBlock 节点类型(可编辑块) */
991
991
  TEMPLATE_BLOCK: "templateBlock",
992
992
  /** TemplateSelect 节点类型(下拉选择) */
@@ -997,7 +997,7 @@ const be = {
997
997
  PARAGRAPH: "paragraph",
998
998
  /** Text 节点类型(ProseMirror 内置) */
999
999
  TEXT: "text"
1000
- }, ae = {
1000
+ }, ue = {
1001
1001
  /** Mention 插件 */
1002
1002
  MENTION: "mention",
1003
1003
  /** Suggestion 插件 */
@@ -1014,7 +1014,7 @@ const be = {
1014
1014
  TEMPLATE_BLOCK_KEYBOARD: "templateBlockKeyboard",
1015
1015
  /** Template Block 粘贴处理插件 */
1016
1016
  TEMPLATE_BLOCK_PASTE: "templateBlockPaste"
1017
- }, G = {
1017
+ }, Z = {
1018
1018
  /** 文本类型 */
1019
1019
  TEXT: "text",
1020
1020
  /** 模板块类型(对应内部的 TemplateBlock 节点) */
@@ -1044,31 +1044,31 @@ const be = {
1044
1044
  ARROW_RIGHT: "ArrowRight",
1045
1045
  /** 空格键 */
1046
1046
  SPACE: " "
1047
- }, I = (e, t) => e.key === Vt[t], we = (e, t) => t.some((n) => e.key === Vt[n]), Eo = ["onMousedown", "onMouseenter"], wo = {
1047
+ }, B = (e, t) => e.key === Vt[t], we = (e, t) => t.some((o) => e.key === Vt[o]), wo = ["onMousedown", "onMouseenter"], Co = {
1048
1048
  key: 0,
1049
1049
  class: "mention-icon"
1050
- }, Co = { class: "mention-label" }, Ao = {
1050
+ }, Ao = { class: "mention-label" }, So = {
1051
1051
  key: 0,
1052
1052
  class: "mention-empty"
1053
- }, So = /* @__PURE__ */ Z({
1053
+ }, _o = /* @__PURE__ */ V({
1054
1054
  __name: "mention-list",
1055
1055
  props: {
1056
1056
  items: {},
1057
1057
  command: { type: Function }
1058
1058
  },
1059
1059
  setup(e, { expose: t }) {
1060
- const n = e, s = F(0), r = F(null);
1060
+ const o = e, s = F(0), r = F(null);
1061
1061
  K(
1062
- () => n.items,
1062
+ () => o.items,
1063
1063
  () => {
1064
1064
  s.value = 0;
1065
1065
  }
1066
1066
  );
1067
- function o({ event: c }) {
1068
- return I(c, "ARROW_UP") ? (s.value = Math.max(0, s.value - 1), l(), !0) : I(c, "ARROW_DOWN") ? (s.value = Math.min(n.items.length - 1, s.value + 1), l(), !0) : we(c, ["ENTER", "TAB"]) ? (i(s.value), !0) : !1;
1067
+ function n({ event: c }) {
1068
+ return B(c, "ARROW_UP") ? (s.value = Math.max(0, s.value - 1), l(), !0) : B(c, "ARROW_DOWN") ? (s.value = Math.min(o.items.length - 1, s.value + 1), l(), !0) : we(c, ["ENTER", "TAB"]) ? (i(s.value), !0) : !1;
1069
1069
  }
1070
1070
  function l() {
1071
- me(() => {
1071
+ ge(() => {
1072
1072
  var d;
1073
1073
  const c = (d = r.value) == null ? void 0 : d.querySelector(".mention-item.is-selected");
1074
1074
  c && c.scrollIntoView({
@@ -1078,8 +1078,8 @@ const be = {
1078
1078
  });
1079
1079
  }
1080
1080
  function i(c) {
1081
- const d = n.items[c];
1082
- d && n.command({
1081
+ const d = o.items[c];
1082
+ d && o.command({
1083
1083
  id: d.id,
1084
1084
  label: d.label,
1085
1085
  value: d.value
@@ -1089,42 +1089,42 @@ const be = {
1089
1089
  s.value = c;
1090
1090
  }
1091
1091
  return t({
1092
- onKeyDown: o
1092
+ onKeyDown: n
1093
1093
  }), (c, d) => (M(), P("div", {
1094
1094
  ref_key: "listRef",
1095
1095
  ref: r,
1096
1096
  class: "mention-list"
1097
1097
  }, [
1098
- (M(!0), P(Ie, null, Be(e.items, (u, g) => (M(), P("button", {
1098
+ (M(!0), P(Be, null, Ie(e.items, (u, g) => (M(), P("button", {
1099
1099
  key: u.id,
1100
1100
  type: "button",
1101
- class: Q(["mention-item", { "is-selected": g === s.value }]),
1101
+ class: Y(["mention-item", { "is-selected": g === s.value }]),
1102
1102
  onMousedown: nt((h) => i(g), ["prevent"]),
1103
1103
  onMouseenter: (h) => a(g)
1104
1104
  }, [
1105
- u.icon ? (M(), P("span", wo, pe(u.icon), 1)) : q("", !0),
1106
- B("span", Co, pe(u.label), 1)
1107
- ], 42, Eo))), 128)),
1108
- e.items.length === 0 ? (M(), P("div", Ao, [...d[0] || (d[0] = [
1109
- B("span", null, "未找到匹配的提及项", -1)
1105
+ u.icon ? (M(), P("span", Co, he(u.icon), 1)) : q("", !0),
1106
+ $("span", Ao, he(u.label), 1)
1107
+ ], 42, wo))), 128)),
1108
+ e.items.length === 0 ? (M(), P("div", So, [...d[0] || (d[0] = [
1109
+ $("span", null, "未找到匹配的提及项", -1)
1110
1110
  ])])) : q("", !0)
1111
1111
  ], 512));
1112
1112
  }
1113
- }), _o = /* @__PURE__ */ J(So, [["__scopeId", "data-v-aaa34d1a"]]), de = new re(ae.MENTION);
1114
- function Lo(e, t) {
1113
+ }), Lo = /* @__PURE__ */ te(_o, [["__scopeId", "data-v-aaa34d1a"]]), pe = new le(ue.MENTION);
1114
+ function ko(e, t) {
1115
1115
  if (!t)
1116
1116
  return e;
1117
- const n = t.toLowerCase();
1117
+ const o = t.toLowerCase();
1118
1118
  return e.filter((s) => {
1119
1119
  var r;
1120
- return !!(s.label.toLowerCase().includes(n) || (r = s.value) != null && r.toLowerCase().includes(n));
1120
+ return !!(s.label.toLowerCase().includes(o) || (r = s.value) != null && r.toLowerCase().includes(o));
1121
1121
  });
1122
1122
  }
1123
- function ko(e) {
1124
- const { editor: t, char: n, items: s, allowSpaces: r } = e;
1125
- let o = null, l = null, i = null;
1126
- return new ie({
1127
- key: de,
1123
+ function Mo(e) {
1124
+ const { editor: t, char: o, items: s, allowSpaces: r } = e;
1125
+ let n = null, l = null, i = null;
1126
+ return new ae({
1127
+ key: pe,
1128
1128
  state: {
1129
1129
  init() {
1130
1130
  return {
@@ -1135,7 +1135,7 @@ function ko(e) {
1135
1135
  };
1136
1136
  },
1137
1137
  apply(a, c) {
1138
- const d = a.getMeta(de);
1138
+ const d = a.getMeta(pe);
1139
1139
  if (d && d.type === "close")
1140
1140
  return {
1141
1141
  active: !1,
@@ -1145,7 +1145,7 @@ function ko(e) {
1145
1145
  };
1146
1146
  if (!a.docChanged && !a.selectionSet)
1147
1147
  return c;
1148
- const u = To(a.selection, n, r);
1148
+ const u = Eo(a.selection, o, r);
1149
1149
  if (!u)
1150
1150
  return {
1151
1151
  active: !1,
@@ -1153,7 +1153,7 @@ function ko(e) {
1153
1153
  query: "",
1154
1154
  filteredItems: []
1155
1155
  };
1156
- const g = ke(s) ? s.value : s, h = Lo(g, u.query);
1156
+ const g = ke(s) ? s.value : s, h = ko(g, u.query);
1157
1157
  return {
1158
1158
  active: h.length > 0,
1159
1159
  range: u.range,
@@ -1175,45 +1175,45 @@ function ko(e) {
1175
1175
  },
1176
1176
  // 键盘处理
1177
1177
  handleKeyDown(a, c) {
1178
- var u, g, h, E;
1179
- const d = de.getState(a.state);
1180
- if (I(c, "BACKSPACE")) {
1181
- const { selection: w } = a.state, { $from: T } = w;
1182
- if (T.nodeBefore && T.nodeBefore.type.name === A.MENTION) {
1178
+ var u, g, h, C;
1179
+ const d = pe.getState(a.state);
1180
+ if (B(c, "BACKSPACE")) {
1181
+ const { selection: w } = a.state, { $from: b } = w;
1182
+ if (b.nodeBefore && b.nodeBefore.type.name === _.MENTION) {
1183
1183
  c.preventDefault();
1184
- const { tr: m } = a.state, y = T.pos - T.nodeBefore.nodeSize;
1185
- return m.delete(y, T.pos), m.insertText(n, y), m.setSelection(O.create(m.doc, y + 1)), a.dispatch(m), a.focus(), !0;
1184
+ const { tr: m } = a.state, x = b.pos - b.nodeBefore.nodeSize;
1185
+ return m.delete(x, b.pos), m.insertText(o, x), m.setSelection(O.create(m.doc, x + 1)), a.dispatch(m), a.focus(), !0;
1186
1186
  }
1187
1187
  }
1188
1188
  if (!(d != null && d.active))
1189
1189
  return !1;
1190
- if (I(c, "ESCAPE")) {
1190
+ if (B(c, "ESCAPE")) {
1191
1191
  c.preventDefault();
1192
1192
  const w = a.state.tr;
1193
- return w.setMeta(de, {
1193
+ return w.setMeta(pe, {
1194
1194
  type: "close"
1195
- }), a.dispatch(w), o && (i == null || i(), i = null, o.destroy(), o = null), l && (l.remove(), l = null), !0;
1195
+ }), a.dispatch(w), n && (i == null || i(), i = null, n.destroy(), n = null), l && (l.remove(), l = null), !0;
1196
1196
  }
1197
1197
  if (we(c, ["ENTER", "TAB"])) {
1198
- if (c.preventDefault(), (g = (u = o == null ? void 0 : o.ref) == null ? void 0 : u.onKeyDown) == null ? void 0 : g.call(u, { event: c }))
1198
+ if (c.preventDefault(), (g = (u = n == null ? void 0 : n.ref) == null ? void 0 : u.onKeyDown) == null ? void 0 : g.call(u, { event: c }))
1199
1199
  return !0;
1200
1200
  if (d.filteredItems.length > 0 && d.range) {
1201
- const T = d.filteredItems[0];
1202
- return St(a, d.range, T), !0;
1201
+ const b = d.filteredItems[0];
1202
+ return St(a, d.range, b), !0;
1203
1203
  }
1204
1204
  return !0;
1205
1205
  }
1206
- return we(c, ["ARROW_UP", "ARROW_DOWN"]) && ((E = (h = o == null ? void 0 : o.ref) == null ? void 0 : h.onKeyDown) == null ? void 0 : E.call(h, { event: c })) || !1;
1206
+ return we(c, ["ARROW_UP", "ARROW_DOWN"]) && ((C = (h = n == null ? void 0 : n.ref) == null ? void 0 : h.onKeyDown) == null ? void 0 : C.call(h, { event: c })) || !1;
1207
1207
  }
1208
1208
  },
1209
1209
  view() {
1210
1210
  return {
1211
1211
  update(a) {
1212
- const c = de.getState(a.state);
1212
+ const c = pe.getState(a.state);
1213
1213
  if (c != null && c.active && c.filteredItems.length > 0) {
1214
- o ? o.updateProps({
1214
+ n ? n.updateProps({
1215
1215
  items: c.filteredItems
1216
- }) : (o = new Ot(_o, {
1216
+ }) : (n = new Ot(Lo, {
1217
1217
  props: {
1218
1218
  items: c.filteredItems,
1219
1219
  command: (u) => {
@@ -1226,7 +1226,7 @@ function ko(e) {
1226
1226
  }
1227
1227
  },
1228
1228
  editor: t
1229
- }), l = o.element, l.style.position = "absolute", l.style.zIndex = "1000", document.body.appendChild(l));
1229
+ }), l = n.element, l.style.position = "absolute", l.style.zIndex = "1000", document.body.appendChild(l));
1230
1230
  const d = a.dom.querySelector(".mention-trigger");
1231
1231
  d && l && (i == null || i(), i = mt(d, l, () => {
1232
1232
  yt(d, l, {
@@ -1240,32 +1240,32 @@ function ko(e) {
1240
1240
  });
1241
1241
  }));
1242
1242
  } else
1243
- o && (i == null || i(), i = null, o.destroy(), o = null), l && (l.remove(), l = null);
1243
+ n && (i == null || i(), i = null, n.destroy(), n = null), l && (l.remove(), l = null);
1244
1244
  },
1245
1245
  destroy() {
1246
- i == null || i(), o == null || o.destroy(), l == null || l.remove();
1246
+ i == null || i(), n == null || n.destroy(), l == null || l.remove();
1247
1247
  }
1248
1248
  };
1249
1249
  }
1250
1250
  });
1251
1251
  }
1252
- function St(e, t, n) {
1252
+ function St(e, t, o) {
1253
1253
  e.focus();
1254
- const { state: s, dispatch: r } = e, { tr: o } = s, l = s.schema.nodes.mention.create({
1255
- id: n.id || ve("mention"),
1256
- label: n.label,
1257
- value: n.value || ""
1254
+ const { state: s, dispatch: r } = e, { tr: n } = s, l = s.schema.nodes.mention.create({
1255
+ id: o.id || ve("mention"),
1256
+ label: o.label,
1257
+ value: o.value || ""
1258
1258
  }), i = s.schema.text(" ");
1259
- o.delete(t.from, t.to), o.insert(t.from, [l, i]);
1259
+ n.delete(t.from, t.to), n.insert(t.from, [l, i]);
1260
1260
  const a = t.from + 2;
1261
- o.setSelection(O.create(o.doc, a)), o.scrollIntoView(), r(o);
1261
+ n.setSelection(O.create(n.doc, a)), n.scrollIntoView(), r(n);
1262
1262
  }
1263
- const Mo = {
1263
+ const Ro = {
1264
1264
  /**
1265
1265
  * 插入 mention 节点
1266
1266
  */
1267
1267
  insertMention: (e) => ({ commands: t }) => t.insertContent({
1268
- type: A.MENTION,
1268
+ type: _.MENTION,
1269
1269
  attrs: {
1270
1270
  id: e.id || ve("mention"),
1271
1271
  label: e.label || "",
@@ -1275,11 +1275,11 @@ const Mo = {
1275
1275
  /**
1276
1276
  * 删除 mention 节点
1277
1277
  */
1278
- deleteMention: (e) => ({ tr: t, state: n }) => {
1278
+ deleteMention: (e) => ({ tr: t, state: o }) => {
1279
1279
  let s = !1;
1280
- return n.doc.descendants((r, o) => {
1281
- if (r.type.name === A.MENTION && r.attrs.id === e)
1282
- return t.delete(o, o + r.nodeSize), s = !0, !1;
1280
+ return o.doc.descendants((r, n) => {
1281
+ if (r.type.name === _.MENTION && r.attrs.id === e)
1282
+ return t.delete(n, n + r.nodeSize), s = !0, !1;
1283
1283
  }), s;
1284
1284
  }
1285
1285
  }, Gt = ct.create({
@@ -1354,7 +1354,7 @@ const Mo = {
1354
1354
  e,
1355
1355
  () => {
1356
1356
  const t = this.editor.state.tr;
1357
- t.setMeta(de, { type: "mention-update" }), this.editor.view.dispatch(t);
1357
+ t.setMeta(pe, { type: "mention-update" }), this.editor.view.dispatch(t);
1358
1358
  },
1359
1359
  { deep: !0 }
1360
1360
  ));
@@ -1365,7 +1365,7 @@ const Mo = {
1365
1365
  // 添加 Suggestion 插件
1366
1366
  addProseMirrorPlugins() {
1367
1367
  return [
1368
- ko({
1368
+ Mo({
1369
1369
  editor: this.editor,
1370
1370
  char: this.options.char,
1371
1371
  items: this.options.items,
@@ -1382,51 +1382,51 @@ const Mo = {
1382
1382
  },
1383
1383
  // 自定义命令
1384
1384
  addCommands() {
1385
- return Mo;
1385
+ return Ro;
1386
1386
  }
1387
1387
  });
1388
- function Ro(e) {
1388
+ function Po(e) {
1389
1389
  var r;
1390
- const t = e.extensionManager.extensions.find((o) => o.name === be.MENTION), n = ((r = t == null ? void 0 : t.options) == null ? void 0 : r.char) || "@";
1390
+ const t = e.extensionManager.extensions.find((n) => n.name === be.MENTION), o = ((r = t == null ? void 0 : t.options) == null ? void 0 : r.char) || "@";
1391
1391
  let s = "";
1392
- return e.state.doc.descendants((o) => {
1393
- o.type.name === A.MENTION ? s += `${n}${o.attrs.label}` : o.type.name === A.TEXT && (s += o.text || "");
1392
+ return e.state.doc.descendants((n) => {
1393
+ n.type.name === _.MENTION ? s += `${o}${n.attrs.label}` : n.type.name === _.TEXT && (s += n.text || "");
1394
1394
  }), s.trim();
1395
1395
  }
1396
- function Po(e) {
1396
+ function Oo(e) {
1397
1397
  const t = [];
1398
- return e.state.doc.descendants((n, s, r) => {
1399
- if (r && r.type.name === A.PARAGRAPH) {
1400
- if (n.type.name === A.MENTION)
1398
+ return e.state.doc.descendants((o, s, r) => {
1399
+ if (r && r.type.name === _.PARAGRAPH) {
1400
+ if (o.type.name === _.MENTION)
1401
1401
  t.push({
1402
- type: G.MENTION,
1403
- content: n.attrs.label,
1404
- value: n.attrs.value || ""
1402
+ type: Z.MENTION,
1403
+ content: o.attrs.label,
1404
+ value: o.attrs.value || ""
1405
1405
  });
1406
- else if (n.type.name === A.TEXT) {
1407
- const o = n.text || "";
1408
- if (o) {
1406
+ else if (o.type.name === _.TEXT) {
1407
+ const n = o.text || "";
1408
+ if (n) {
1409
1409
  const l = t[t.length - 1];
1410
- l && l.type === G.TEXT ? l.content = (l.content || "") + o : t.push({
1411
- type: G.TEXT,
1412
- content: o
1410
+ l && l.type === Z.TEXT ? l.content = (l.content || "") + n : t.push({
1411
+ type: Z.TEXT,
1412
+ content: n
1413
1413
  });
1414
1414
  }
1415
1415
  }
1416
1416
  }
1417
1417
  }), t;
1418
1418
  }
1419
- function Oo(e, t = "@", n) {
1419
+ function Do(e, t = "@", o) {
1420
1420
  return Gt.configure({
1421
1421
  items: e,
1422
1422
  char: t,
1423
- ...n
1423
+ ...o
1424
1424
  });
1425
1425
  }
1426
1426
  const Ut = (e, t) => {
1427
1427
  if (!t.length)
1428
1428
  return [{ text: e, isMatch: !1 }];
1429
- const n = [];
1429
+ const o = [];
1430
1430
  for (const l of t) {
1431
1431
  if (!l) continue;
1432
1432
  let i = 0;
@@ -1434,17 +1434,17 @@ const Ut = (e, t) => {
1434
1434
  for (; ; ) {
1435
1435
  const d = a.indexOf(c, i);
1436
1436
  if (d === -1) break;
1437
- n.push({
1437
+ o.push({
1438
1438
  start: d,
1439
1439
  end: d + l.length
1440
1440
  }), i = d + 1;
1441
1441
  }
1442
1442
  }
1443
- if (n.length === 0)
1443
+ if (o.length === 0)
1444
1444
  return [{ text: e, isMatch: !1 }];
1445
- n.sort((l, i) => l.start - i.start);
1445
+ o.sort((l, i) => l.start - i.start);
1446
1446
  const s = [];
1447
- for (const l of n)
1447
+ for (const l of o)
1448
1448
  if (s.length === 0)
1449
1449
  s.push(l);
1450
1450
  else {
@@ -1452,23 +1452,23 @@ const Ut = (e, t) => {
1452
1452
  l.start <= i.end ? i.end = Math.max(i.end, l.end) : s.push(l);
1453
1453
  }
1454
1454
  const r = [];
1455
- let o = 0;
1455
+ let n = 0;
1456
1456
  for (const l of s)
1457
- o < l.start && r.push({
1458
- text: e.substring(o, l.start),
1457
+ n < l.start && r.push({
1458
+ text: e.substring(n, l.start),
1459
1459
  isMatch: !1
1460
1460
  }), r.push({
1461
1461
  text: e.substring(l.start, l.end),
1462
1462
  isMatch: !0
1463
- }), o = l.end;
1464
- return o < e.length && r.push({
1465
- text: e.substring(o),
1463
+ }), n = l.end;
1464
+ return n < e.length && r.push({
1465
+ text: e.substring(n),
1466
1466
  isMatch: !1
1467
1467
  }), r;
1468
- }, Do = (e, t) => !t || !e ? [{ text: e, isMatch: !1 }] : Ut(e, [t]), Io = (e, t) => {
1469
- const { content: n, highlights: s } = e;
1470
- return typeof s == "function" ? s(n, t) : Array.isArray(s) ? Ut(n, s) : Do(n, t);
1471
- }, Bo = ["onMouseenter", "onClick"], $o = { class: "suggestion-list__text" }, jo = /* @__PURE__ */ Z({
1468
+ }, Bo = (e, t) => !t || !e ? [{ text: e, isMatch: !1 }] : Ut(e, [t]), Io = (e, t) => {
1469
+ const { content: o, highlights: s } = e;
1470
+ return typeof s == "function" ? s(o, t) : Array.isArray(s) ? Ut(o, s) : Bo(o, t);
1471
+ }, $o = ["onMouseenter", "onClick"], jo = { class: "suggestion-list__text" }, No = /* @__PURE__ */ V({
1472
1472
  __name: "suggestion-list",
1473
1473
  props: {
1474
1474
  show: { type: Boolean },
@@ -1482,10 +1482,10 @@ const Ut = (e, t) => {
1482
1482
  onMouseLeave: { type: Function }
1483
1483
  },
1484
1484
  setup(e) {
1485
- const t = e, n = F(null), s = (i) => i === t.activeKeyboardIndex || i === t.activeMouseIndex, r = (i) => {
1485
+ const t = e, o = F(null), s = (i) => i === t.activeKeyboardIndex || i === t.activeMouseIndex, r = (i) => {
1486
1486
  var a;
1487
1487
  (a = t.onMouseEnter) == null || a.call(t, i);
1488
- }, o = () => {
1488
+ }, n = () => {
1489
1489
  var i;
1490
1490
  (i = t.onMouseLeave) == null || i.call(t);
1491
1491
  }, l = (i) => {
@@ -1496,111 +1496,111 @@ const Ut = (e, t) => {
1496
1496
  return K(
1497
1497
  () => t.activeKeyboardIndex,
1498
1498
  (i) => {
1499
- if (i !== -1 && n.value) {
1500
- const a = n.value.children[i];
1499
+ if (i !== -1 && o.value) {
1500
+ const a = o.value.children[i];
1501
1501
  a && a.scrollIntoView({ block: "nearest" });
1502
1502
  }
1503
1503
  }
1504
- ), (i, a) => (M(), U(an, { name: "suggestion-slide-up" }, {
1504
+ ), (i, a) => (M(), J(an, { name: "suggestion-slide-up" }, {
1505
1505
  default: j(() => [
1506
1506
  t.show && t.suggestions.length ? (M(), P("div", {
1507
1507
  key: 0,
1508
1508
  ref_key: "suggestionsListRef",
1509
- ref: n,
1509
+ ref: o,
1510
1510
  class: "suggestion-list",
1511
1511
  style: cn(t.popupStyle)
1512
1512
  }, [
1513
- (M(!0), P(Ie, null, Be(t.suggestions, (c, d) => (M(), P("div", {
1513
+ (M(!0), P(Be, null, Ie(t.suggestions, (c, d) => (M(), P("div", {
1514
1514
  key: d,
1515
- class: Q(["suggestion-list__item", { highlighted: s(d) }]),
1515
+ class: Y(["suggestion-list__item", { highlighted: s(d) }]),
1516
1516
  onMouseenter: (u) => r(d),
1517
- onMouseleave: o,
1517
+ onMouseleave: n,
1518
1518
  onClick: (u) => l(d)
1519
1519
  }, [
1520
- se(k(Rn), { class: "suggestion-list__icon" }),
1521
- B("span", $o, [
1522
- (M(!0), P(Ie, null, Be(k(Io)(c, t.inputValue), (u, g) => (M(), P("span", {
1520
+ ie(k(Pn), { class: "suggestion-list__icon" }),
1521
+ $("span", jo, [
1522
+ (M(!0), P(Be, null, Ie(k(Io)(c, t.inputValue), (u, g) => (M(), P("span", {
1523
1523
  key: g,
1524
- class: Q({
1524
+ class: Y({
1525
1525
  "suggestion-list__text--match": u.isMatch,
1526
1526
  "suggestion-list__text--normal": !u.isMatch
1527
1527
  })
1528
- }, pe(u.text), 3))), 128))
1528
+ }, he(u.text), 3))), 128))
1529
1529
  ])
1530
- ], 42, Bo))), 128))
1530
+ ], 42, $o))), 128))
1531
1531
  ], 4)) : q("", !0)
1532
1532
  ]),
1533
1533
  _: 1
1534
1534
  }));
1535
1535
  }
1536
- }), No = /* @__PURE__ */ J(jo, [["__scopeId", "data-v-76a6f35e"]]), Wo = (e, t) => {
1536
+ }), Wo = /* @__PURE__ */ te(No, [["__scopeId", "data-v-76a6f35e"]]), Ko = (e, t) => {
1537
1537
  if (!e || !t)
1538
1538
  return { text: "", show: !1, showTab: !1 };
1539
- const n = e.toLowerCase(), s = t.toLowerCase();
1540
- if (!n.startsWith(s))
1539
+ const o = e.toLowerCase(), s = t.toLowerCase();
1540
+ if (!o.startsWith(s))
1541
1541
  return { text: "", show: !1, showTab: !1 };
1542
- const r = e.substring(t.length), o = r.length > 0;
1542
+ const r = e.substring(t.length), n = r.length > 0;
1543
1543
  return {
1544
1544
  text: r,
1545
- show: o,
1546
- showTab: o
1545
+ show: n,
1546
+ showTab: n
1547
1547
  };
1548
- }, z = new re(ae.SUGGESTION);
1549
- function Ko(e) {
1548
+ }, z = new le(ue.SUGGESTION);
1549
+ function qo(e) {
1550
1550
  const {
1551
1551
  editor: t,
1552
- activeSuggestionKeys: n = ["Enter"],
1552
+ activeSuggestionKeys: o = ["Enter"],
1553
1553
  popupWidth: s = 400,
1554
1554
  showAutoComplete: r = !0,
1555
- filterFn: o,
1555
+ filterFn: n,
1556
1556
  onSelect: l
1557
1557
  } = e;
1558
1558
  let i = null, a = null, c = null, d = !1;
1559
1559
  function u() {
1560
1560
  const p = t.extensionManager.extensions.find(
1561
- (v) => v.name === be.SUGGESTION
1562
- ), f = p == null ? void 0 : p.options, x = (f == null ? void 0 : f.items) || (f == null ? void 0 : f.suggestions) || [];
1563
- return x && typeof x == "object" && "value" in x ? x.value : x;
1561
+ (E) => E.name === be.SUGGESTION
1562
+ ), f = p == null ? void 0 : p.options, v = (f == null ? void 0 : f.items) || (f == null ? void 0 : f.suggestions) || [];
1563
+ return v && typeof v == "object" && "value" in v ? v.value : v;
1564
1564
  }
1565
1565
  function g(p) {
1566
1566
  const f = u();
1567
- return o ? o(f, p) : f;
1567
+ return n ? n(f, p) : f;
1568
1568
  }
1569
1569
  function h(p) {
1570
1570
  return p;
1571
1571
  }
1572
- function E(p, f, x) {
1573
- if (p === -1 || !x[p])
1572
+ function C(p, f, v) {
1573
+ if (p === -1 || !v[p])
1574
1574
  return { text: "", show: !1, showTab: !1 };
1575
- const v = x[p];
1576
- return Wo(v.content, f);
1575
+ const E = v[p];
1576
+ return Ko(E.content, f);
1577
1577
  }
1578
- function w(p, f, x) {
1578
+ function w(p, f, v) {
1579
1579
  if (!f) return;
1580
- (l == null ? void 0 : l(x)) !== !1 && t.commands.setContent(x.content), t.commands.focus();
1580
+ (l == null ? void 0 : l(v)) !== !1 && t.commands.setContent(v.content), t.commands.focus();
1581
1581
  }
1582
- function T(p, f) {
1583
- const x = f.filteredSuggestions[f.selectedIndex];
1584
- x && w(p, f.range, x);
1585
- const v = p.state.tr;
1586
- v.setMeta(z, { type: "close" }), p.dispatch(v);
1582
+ function b(p, f) {
1583
+ const v = f.filteredSuggestions[f.selectedIndex];
1584
+ v && w(p, f.range, v);
1585
+ const E = p.state.tr;
1586
+ E.setMeta(z, { type: "close" }), p.dispatch(E);
1587
1587
  }
1588
1588
  function m(p, f) {
1589
1589
  c == null || c();
1590
- const v = p.dom.closest(".tr-sender") || p.dom, S = () => {
1590
+ const E = p.dom.closest(".tr-sender") || p.dom, T = () => {
1591
1591
  if (typeof s == "number")
1592
1592
  return `${s}px`;
1593
1593
  if (typeof s == "string") {
1594
1594
  if (s.endsWith("%")) {
1595
- const _ = parseFloat(s) / 100;
1596
- return `${v.offsetWidth * _}px`;
1595
+ const A = parseFloat(s) / 100;
1596
+ return `${E.offsetWidth * A}px`;
1597
1597
  }
1598
1598
  return s;
1599
1599
  }
1600
1600
  return "400px";
1601
1601
  };
1602
- c = mt(v, f, () => {
1603
- yt(v, f, {
1602
+ c = mt(E, f, () => {
1603
+ yt(E, f, {
1604
1604
  placement: "top-start",
1605
1605
  middleware: [
1606
1606
  ht(8),
@@ -1609,37 +1609,37 @@ function Ko(e) {
1609
1609
  }),
1610
1610
  gt({ padding: 8 })
1611
1611
  ]
1612
- }).then(({ x: _, y: b }) => {
1613
- f.style.position = "absolute", f.style.left = `${_}px`, f.style.top = `${b}px`, f.style.zIndex = "2000", f.style.width = S();
1612
+ }).then(({ x: A, y }) => {
1613
+ f.style.position = "absolute", f.style.left = `${A}px`, f.style.top = `${y}px`, f.style.zIndex = "2000", f.style.width = T();
1614
1614
  });
1615
1615
  });
1616
1616
  }
1617
- function y(p) {
1617
+ function x(p) {
1618
1618
  if (!r || !p.active || !p.autoCompleteText || !p.range)
1619
1619
  return Le.empty;
1620
- const f = t.state.doc, { selection: x } = t.state, v = x.$head.pos;
1621
- if (!(v >= f.content.size - 1))
1620
+ const f = t.state.doc, { selection: v } = t.state, E = v.$head.pos;
1621
+ if (!(E >= f.content.size - 1))
1622
1622
  return Le.empty;
1623
- const _ = Dt.widget(
1624
- v,
1623
+ const A = Dt.widget(
1624
+ E,
1625
1625
  () => {
1626
- const b = document.createElement("span");
1627
- b.className = "suggestion-autocomplete", b.contentEditable = "false";
1626
+ const y = document.createElement("span");
1627
+ y.className = "suggestion-autocomplete", y.contentEditable = "false";
1628
1628
  const L = document.createElement("span");
1629
- if (L.className = "autocomplete-text", L.textContent = p.autoCompleteText, b.appendChild(L), p.showTabIndicator) {
1630
- const $ = document.createElement("span");
1631
- $.className = "tab-hint", $.textContent = "TAB", b.appendChild($);
1629
+ if (L.className = "autocomplete-text", L.textContent = p.autoCompleteText, y.appendChild(L), p.showTabIndicator) {
1630
+ const I = document.createElement("span");
1631
+ I.className = "tab-hint", I.textContent = "TAB", y.appendChild(I);
1632
1632
  }
1633
- return b;
1633
+ return y;
1634
1634
  },
1635
1635
  {
1636
1636
  side: 1
1637
1637
  // 显示在光标右侧
1638
1638
  }
1639
1639
  );
1640
- return Le.create(f, [_]);
1640
+ return Le.create(f, [A]);
1641
1641
  }
1642
- return new ie({
1642
+ return new ae({
1643
1643
  key: z,
1644
1644
  state: {
1645
1645
  init() {
@@ -1654,9 +1654,9 @@ function Ko(e) {
1654
1654
  };
1655
1655
  },
1656
1656
  apply(p, f) {
1657
- const x = p.getMeta(z);
1658
- if (x) {
1659
- if (x.type === "close")
1657
+ const v = p.getMeta(z);
1658
+ if (v) {
1659
+ if (v.type === "close")
1660
1660
  return d = !0, setTimeout(() => {
1661
1661
  d = !1;
1662
1662
  }, 0), {
@@ -1668,19 +1668,19 @@ function Ko(e) {
1668
1668
  autoCompleteText: "",
1669
1669
  showTabIndicator: !1
1670
1670
  };
1671
- if (x.type === "updateIndex") {
1672
- const L = { ...f, selectedIndex: x.index }, $ = E(x.index, f.query, f.filteredSuggestions);
1671
+ if (v.type === "updateIndex") {
1672
+ const L = { ...f, selectedIndex: v.index }, I = C(v.index, f.query, f.filteredSuggestions);
1673
1673
  return {
1674
1674
  ...L,
1675
- autoCompleteText: $.text,
1676
- showTabIndicator: $.showTab
1675
+ autoCompleteText: I.text,
1676
+ showTabIndicator: I.showTab
1677
1677
  };
1678
1678
  }
1679
1679
  }
1680
1680
  if (d || !p.docChanged && !p.selectionSet)
1681
1681
  return f;
1682
- const v = p.doc.textContent.trim(), S = v;
1683
- if (!v)
1682
+ const E = p.doc.textContent.trim(), T = E;
1683
+ if (!E)
1684
1684
  return {
1685
1685
  active: !1,
1686
1686
  range: null,
@@ -1690,8 +1690,8 @@ function Ko(e) {
1690
1690
  autoCompleteText: "",
1691
1691
  showTabIndicator: !1
1692
1692
  };
1693
- const _ = g(S);
1694
- if (_.length === 0)
1693
+ const A = g(T);
1694
+ if (A.length === 0)
1695
1695
  return {
1696
1696
  active: !1,
1697
1697
  range: null,
@@ -1701,22 +1701,22 @@ function Ko(e) {
1701
1701
  autoCompleteText: "",
1702
1702
  showTabIndicator: !1
1703
1703
  };
1704
- const b = E(0, S, _);
1704
+ const y = C(0, T, A);
1705
1705
  return {
1706
1706
  active: !0,
1707
1707
  range: { from: 0, to: p.doc.content.size },
1708
- query: S,
1709
- filteredSuggestions: _,
1708
+ query: T,
1709
+ filteredSuggestions: A,
1710
1710
  selectedIndex: 0,
1711
- autoCompleteText: b.text,
1712
- showTabIndicator: b.showTab
1711
+ autoCompleteText: y.text,
1712
+ showTabIndicator: y.showTab
1713
1713
  };
1714
1714
  }
1715
1715
  },
1716
1716
  props: {
1717
1717
  decorations(p) {
1718
1718
  const f = this.getState(p);
1719
- return y(
1719
+ return x(
1720
1720
  f || {
1721
1721
  active: !1,
1722
1722
  range: null,
@@ -1726,28 +1726,28 @@ function Ko(e) {
1726
1726
  );
1727
1727
  },
1728
1728
  handleKeyDown(p, f) {
1729
- const x = z.getState(p.state);
1730
- if (!(x != null && x.active))
1729
+ const v = z.getState(p.state);
1730
+ if (!(v != null && v.active))
1731
1731
  return !1;
1732
- if (I(f, "TAB") && x.autoCompleteText)
1733
- return f.preventDefault(), T(p, x), !0;
1732
+ if (B(f, "TAB") && v.autoCompleteText)
1733
+ return f.preventDefault(), b(p, v), !0;
1734
1734
  if (we(f, ["ARROW_UP", "ARROW_DOWN"])) {
1735
1735
  f.preventDefault();
1736
- const v = I(f, "ARROW_DOWN") ? 1 : -1, S = x.filteredSuggestions.length;
1737
- let _ = x.selectedIndex + v;
1738
- _ < 0 ? _ = S - 1 : _ >= S && (_ = 0);
1739
- const b = p.state.tr;
1740
- return b.setMeta(z, {
1736
+ const E = B(f, "ARROW_DOWN") ? 1 : -1, T = v.filteredSuggestions.length;
1737
+ let A = v.selectedIndex + E;
1738
+ A < 0 ? A = T - 1 : A >= T && (A = 0);
1739
+ const y = p.state.tr;
1740
+ return y.setMeta(z, {
1741
1741
  type: "updateIndex",
1742
- index: _
1743
- }), p.dispatch(b), !0;
1742
+ index: A
1743
+ }), p.dispatch(y), !0;
1744
1744
  }
1745
- if (n.includes(f.key))
1746
- return f.preventDefault(), T(p, x), !0;
1747
- if (I(f, "ESCAPE")) {
1745
+ if (o.includes(f.key))
1746
+ return f.preventDefault(), b(p, v), !0;
1747
+ if (B(f, "ESCAPE")) {
1748
1748
  f.preventDefault();
1749
- const v = p.state.tr;
1750
- return v.setMeta(z, { type: "close" }), p.dispatch(v), !0;
1749
+ const E = p.state.tr;
1750
+ return E.setMeta(z, { type: "close" }), p.dispatch(E), !0;
1751
1751
  }
1752
1752
  return !1;
1753
1753
  }
@@ -1765,7 +1765,7 @@ function Ko(e) {
1765
1765
  },
1766
1766
  activeKeyboardIndex: f.selectedIndex,
1767
1767
  inputValue: f.query
1768
- }) : (i = new Ot(No, {
1768
+ }) : (i = new Ot(Wo, {
1769
1769
  props: {
1770
1770
  show: f.active && f.filteredSuggestions.length > 0,
1771
1771
  suggestions: f.filteredSuggestions,
@@ -1776,14 +1776,14 @@ function Ko(e) {
1776
1776
  activeKeyboardIndex: f.selectedIndex,
1777
1777
  activeMouseIndex: -1,
1778
1778
  inputValue: f.query,
1779
- onSelect: (x) => {
1780
- w(p, f.range, x);
1781
- const v = p.state.tr;
1782
- v.setMeta(z, { type: "close" }), p.dispatch(v);
1779
+ onSelect: (v) => {
1780
+ w(p, f.range, v);
1781
+ const E = p.state.tr;
1782
+ E.setMeta(z, { type: "close" }), p.dispatch(E);
1783
1783
  },
1784
- onMouseEnter: (x) => {
1785
- const v = p.state.tr;
1786
- v.setMeta(z, { type: "updateIndex", index: x }), p.dispatch(v);
1784
+ onMouseEnter: (v) => {
1785
+ const E = p.state.tr;
1786
+ E.setMeta(z, { type: "updateIndex", index: v }), p.dispatch(E);
1787
1787
  }
1788
1788
  },
1789
1789
  editor: t
@@ -1796,7 +1796,7 @@ function Ko(e) {
1796
1796
  }
1797
1797
  });
1798
1798
  }
1799
- const Xt = It.create({
1799
+ const Xt = Bt.create({
1800
1800
  name: be.SUGGESTION,
1801
1801
  addOptions() {
1802
1802
  return {
@@ -1827,50 +1827,50 @@ const Xt = It.create({
1827
1827
  },
1828
1828
  addProseMirrorPlugins() {
1829
1829
  return [
1830
- Ko({
1830
+ qo({
1831
1831
  editor: this.editor,
1832
1832
  ...this.options
1833
1833
  })
1834
1834
  ];
1835
1835
  }
1836
1836
  });
1837
- function qo(e, t) {
1837
+ function Ho(e, t) {
1838
1838
  return Xt.configure({
1839
1839
  items: e,
1840
1840
  ...t
1841
1841
  });
1842
1842
  }
1843
- function Ho(e) {
1843
+ function zo(e) {
1844
1844
  const t = [];
1845
- return e.state.doc.descendants((n, s) => {
1846
- n.type.name === A.TEMPLATE_BLOCK && t.push({ node: n, pos: s });
1845
+ return e.state.doc.descendants((o, s) => {
1846
+ o.type.name === _.TEMPLATE_BLOCK && t.push({ node: o, pos: s });
1847
1847
  }), t;
1848
1848
  }
1849
- const zo = {
1849
+ const Fo = {
1850
1850
  /**
1851
1851
  * 设置模板数据(批量)
1852
1852
  */
1853
1853
  setTemplateData: (e) => ({ commands: t }) => {
1854
1854
  t.clearContent();
1855
- const n = [];
1855
+ const o = [];
1856
1856
  return e.forEach((s) => {
1857
- s.type === G.TEXT ? s.content && n.push({
1858
- type: A.TEXT,
1857
+ s.type === Z.TEXT ? s.content && o.push({
1858
+ type: _.TEXT,
1859
1859
  text: s.content
1860
- }) : s.type === G.BLOCK ? n.push({
1861
- type: A.TEMPLATE_BLOCK,
1860
+ }) : s.type === Z.BLOCK ? o.push({
1861
+ type: _.TEMPLATE_BLOCK,
1862
1862
  attrs: {
1863
1863
  id: s.id || ve("template"),
1864
1864
  content: s.content
1865
1865
  },
1866
1866
  content: s.content ? [
1867
1867
  {
1868
- type: A.TEXT,
1868
+ type: _.TEXT,
1869
1869
  text: s.content
1870
1870
  }
1871
1871
  ] : []
1872
- }) : s.type === G.SELECT && n.push({
1873
- type: A.TEMPLATE_SELECT,
1872
+ }) : s.type === Z.SELECT && o.push({
1873
+ type: _.TEMPLATE_SELECT,
1874
1874
  attrs: {
1875
1875
  id: s.id || ve("select"),
1876
1876
  placeholder: s.placeholder,
@@ -1878,26 +1878,26 @@ const zo = {
1878
1878
  value: s.value || null
1879
1879
  }
1880
1880
  });
1881
- }), n.length > 0 && t.insertContent({
1882
- type: A.PARAGRAPH,
1883
- content: n
1881
+ }), o.length > 0 && t.insertContent({
1882
+ type: _.PARAGRAPH,
1883
+ content: o
1884
1884
  }), !0;
1885
1885
  },
1886
1886
  /**
1887
1887
  * 插入模板块
1888
1888
  */
1889
1889
  insertTemplate: (e) => ({ commands: t }) => {
1890
- const n = e.content || "";
1890
+ const o = e.content || "";
1891
1891
  return t.insertContent({
1892
- type: A.TEMPLATE_BLOCK,
1892
+ type: _.TEMPLATE_BLOCK,
1893
1893
  attrs: {
1894
1894
  id: e.id || ve("template"),
1895
- content: n
1895
+ content: o
1896
1896
  },
1897
- content: n ? [
1897
+ content: o ? [
1898
1898
  {
1899
- type: A.TEXT,
1900
- text: n
1899
+ type: _.TEXT,
1900
+ text: o
1901
1901
  }
1902
1902
  ] : []
1903
1903
  });
@@ -1906,19 +1906,19 @@ const zo = {
1906
1906
  * 聚焦到第一个模板块
1907
1907
  */
1908
1908
  focusFirstTemplate: () => ({ editor: e }) => {
1909
- const t = Ho(e);
1909
+ const t = zo(e);
1910
1910
  return setTimeout(() => {
1911
- var o;
1912
- const { state: n, view: s } = e, r = n.tr;
1911
+ var n;
1912
+ const { state: o, view: s } = e, r = o.tr;
1913
1913
  try {
1914
1914
  let l;
1915
1915
  if (t.length === 0)
1916
- l = n.doc.content.size - 1;
1916
+ l = o.doc.content.size - 1;
1917
1917
  else {
1918
- const { node: a, pos: c } = t[0], d = ((o = a.textContent) == null ? void 0 : o.length) || 0;
1918
+ const { node: a, pos: c } = t[0], d = ((n = a.textContent) == null ? void 0 : n.length) || 0;
1919
1919
  l = c + 1 + d;
1920
1920
  }
1921
- const i = O.create(n.doc, l);
1921
+ const i = O.create(o.doc, l);
1922
1922
  r.setSelection(i), s.dispatch(r), s.focus();
1923
1923
  } catch (l) {
1924
1924
  console.error("[focusFirstTemplate] 设置光标失败", l);
@@ -1929,7 +1929,7 @@ const zo = {
1929
1929
  * 插入选择器
1930
1930
  */
1931
1931
  insertTemplateSelect: (e) => ({ commands: t }) => t.insertContent({
1932
- type: A.TEMPLATE_SELECT,
1932
+ type: _.TEMPLATE_SELECT,
1933
1933
  attrs: {
1934
1934
  id: e.id || ve("select"),
1935
1935
  placeholder: e.placeholder || "Please select",
@@ -1937,64 +1937,64 @@ const zo = {
1937
1937
  value: e.value || null
1938
1938
  }
1939
1939
  })
1940
- }, C = "​";
1940
+ }, S = "​";
1941
1941
  function tt(e) {
1942
- return Yt(e).map((n) => n.content).join("");
1942
+ return Yt(e).map((o) => o.content).join("");
1943
1943
  }
1944
1944
  function Yt(e) {
1945
1945
  const t = [];
1946
- return e.state.doc.descendants((n, s, r) => {
1947
- if (r && r.type.name === A.PARAGRAPH) {
1948
- if (n.type.name === A.TEMPLATE_BLOCK) {
1949
- const o = (n.textContent || "").replace(new RegExp(C, "g"), "");
1946
+ return e.state.doc.descendants((o, s, r) => {
1947
+ if (r && r.type.name === _.PARAGRAPH) {
1948
+ if (o.type.name === _.TEMPLATE_BLOCK) {
1949
+ const n = (o.textContent || "").replace(new RegExp(S, "g"), "");
1950
1950
  t.push({
1951
- type: G.BLOCK,
1952
- content: o
1951
+ type: Z.BLOCK,
1952
+ content: n
1953
1953
  });
1954
- } else if (n.type.name === A.TEMPLATE_SELECT) {
1955
- const o = n.attrs.options.find((i) => i.value === n.attrs.value), l = (o == null ? void 0 : o.value) || "";
1954
+ } else if (o.type.name === _.TEMPLATE_SELECT) {
1955
+ const n = o.attrs.options.find((i) => i.value === o.attrs.value), l = (n == null ? void 0 : n.value) || "";
1956
1956
  t.push({
1957
- type: G.SELECT,
1957
+ type: Z.SELECT,
1958
1958
  content: l
1959
1959
  });
1960
- } else if (n.type.name === A.TEXT) {
1961
- const o = (n.text || "").replace(new RegExp(C, "g"), "");
1962
- if (o) {
1960
+ } else if (o.type.name === _.TEXT) {
1961
+ const n = (o.text || "").replace(new RegExp(S, "g"), "");
1962
+ if (n) {
1963
1963
  const l = t[t.length - 1];
1964
- l && l.type === G.TEXT ? l.content += o : t.push({
1965
- type: G.TEXT,
1966
- content: o
1964
+ l && l.type === Z.TEXT ? l.content += n : t.push({
1965
+ type: Z.TEXT,
1966
+ content: n
1967
1967
  });
1968
1968
  }
1969
1969
  }
1970
1970
  }
1971
1971
  }), t;
1972
1972
  }
1973
- const Fo = /* @__PURE__ */ Z({
1973
+ const Vo = /* @__PURE__ */ V({
1974
1974
  __name: "template-block-view",
1975
1975
  props: {
1976
1976
  node: {}
1977
1977
  },
1978
1978
  setup(e) {
1979
- const t = e, n = R(() => {
1979
+ const t = e, o = R(() => {
1980
1980
  const s = t.node.textContent || "";
1981
- return s.length === 0 || s === C;
1981
+ return s.length === 0 || s === S;
1982
1982
  });
1983
- return (s, r) => (M(), U(k(lt), {
1983
+ return (s, r) => (M(), J(k(lt), {
1984
1984
  as: "span",
1985
- class: Q(["template-block", { "is-empty": n.value }]),
1985
+ class: Y(["template-block", { "is-empty": o.value }]),
1986
1986
  "data-id": e.node.attrs.id
1987
1987
  }, {
1988
1988
  default: j(() => [
1989
- r[0] || (r[0] = B("span", {
1989
+ r[0] || (r[0] = $("span", {
1990
1990
  contenteditable: "false",
1991
1991
  class: "template-block__prefix"
1992
1992
  }, " ", -1)),
1993
- se(k(bn), {
1993
+ ie(k(vn), {
1994
1994
  as: "span",
1995
1995
  class: "template-block__content"
1996
1996
  }),
1997
- r[1] || (r[1] = B("span", {
1997
+ r[1] || (r[1] = $("span", {
1998
1998
  contenteditable: "false",
1999
1999
  class: "template-block__suffix"
2000
2000
  }, " ", -1))
@@ -2002,236 +2002,236 @@ const Fo = /* @__PURE__ */ Z({
2002
2002
  _: 1
2003
2003
  }, 8, ["class", "data-id"]));
2004
2004
  }
2005
- }), Vo = /* @__PURE__ */ J(Fo, [["__scopeId", "data-v-aa55b9db"]]);
2006
- function Go(e) {
2005
+ }), Go = /* @__PURE__ */ te(Vo, [["__scopeId", "data-v-aa55b9db"]]);
2006
+ function Uo(e) {
2007
2007
  const t = [];
2008
- let { tr: n } = e;
2009
- return e.doc.descendants((s, r, o) => {
2010
- if (s.type.name === A.PARAGRAPH && s.childCount > 0) {
2008
+ let { tr: o } = e;
2009
+ return e.doc.descendants((s, r, n) => {
2010
+ if (s.type.name === _.PARAGRAPH && s.childCount > 0) {
2011
2011
  const { lastChild: l, firstChild: i } = s;
2012
- if (i && i.type.name === A.TEMPLATE_BLOCK && t.push(r + 1), l && l.type.name === A.TEMPLATE_BLOCK) {
2012
+ if (i && i.type.name === _.TEMPLATE_BLOCK && t.push(r + 1), l && l.type.name === _.TEMPLATE_BLOCK) {
2013
2013
  const a = r + s.nodeSize - 1;
2014
- n.doc.textBetween(a - 1, a, "", "") !== C && t.push(a);
2014
+ o.doc.textBetween(a - 1, a, "", "") !== S && t.push(a);
2015
2015
  }
2016
- l === i && l && l.isText && l.text === C && t.push(["remove", r + 1]);
2016
+ l === i && l && l.isText && l.text === S && t.push(["remove", r + 1]);
2017
2017
  }
2018
- if (s.type.name === A.TEMPLATE_BLOCK && s.content.size === 0 && t.push(r + 1), s.type.name === A.TEMPLATE_BLOCK && o) {
2018
+ if (s.type.name === _.TEMPLATE_BLOCK && s.content.size === 0 && t.push(r + 1), s.type.name === _.TEMPLATE_BLOCK && n) {
2019
2019
  let l = -1;
2020
- if (o.forEach((i, a, c) => {
2020
+ if (n.forEach((i, a, c) => {
2021
2021
  i === s && (l = c);
2022
- }), l > -1 && l < o.childCount - 1 && o.child(l + 1).type.name === A.TEMPLATE_BLOCK) {
2022
+ }), l > -1 && l < n.childCount - 1 && n.child(l + 1).type.name === _.TEMPLATE_BLOCK) {
2023
2023
  const a = r + s.nodeSize;
2024
- n.doc.textBetween(a, a + 1, "", "") !== C && t.push(a);
2024
+ o.doc.textBetween(a, a + 1, "", "") !== S && t.push(a);
2025
2025
  }
2026
2026
  }
2027
2027
  }), t.length > 0 ? (t.sort((s, r) => {
2028
- const o = Array.isArray(s) ? s[1] : s;
2029
- return (Array.isArray(r) ? r[1] : r) - o;
2028
+ const n = Array.isArray(s) ? s[1] : s;
2029
+ return (Array.isArray(r) ? r[1] : r) - n;
2030
2030
  }).forEach((s) => {
2031
- Array.isArray(s) && s[0] === "remove" ? n = n.delete(s[1], s[1] + 1) : typeof s == "number" && (n = n.insertText(C, s, s));
2032
- }), n) : null;
2033
- }
2034
- function Uo() {
2035
- return new ie({
2036
- key: new re(ae.TEMPLATE_BLOCK_ZERO_WIDTH),
2037
- appendTransaction(e, t, n) {
2038
- return e.some((r) => r.docChanged) ? Go(n) : null;
2031
+ Array.isArray(s) && s[0] === "remove" ? o = o.delete(s[1], s[1] + 1) : typeof s == "number" && (o = o.insertText(S, s, s));
2032
+ }), o) : null;
2033
+ }
2034
+ function Xo() {
2035
+ return new ae({
2036
+ key: new le(ue.TEMPLATE_BLOCK_ZERO_WIDTH),
2037
+ appendTransaction(e, t, o) {
2038
+ return e.some((r) => r.docChanged) ? Uo(o) : null;
2039
2039
  }
2040
2040
  });
2041
2041
  }
2042
- function Xo() {
2043
- return new ie({
2044
- key: new re(ae.TEMPLATE_BLOCK_KEYBOARD),
2042
+ function Yo() {
2043
+ return new ae({
2044
+ key: new le(ue.TEMPLATE_BLOCK_KEYBOARD),
2045
2045
  props: {
2046
2046
  handleKeyDown(e, t) {
2047
- var i, a, c, d, u, g, h, E, w;
2048
- const { state: n, dispatch: s } = e, { selection: r } = n, { $from: o } = r;
2049
- if (I(t, "ARROW_LEFT") && o.nodeBefore && o.nodeBefore.isText && o.nodeBefore.text && o.nodeBefore.text === C) {
2050
- const T = o.parent, m = o.index();
2047
+ var i, a, c, d, u, g, h, C, w;
2048
+ const { state: o, dispatch: s } = e, { selection: r } = o, { $from: n } = r;
2049
+ if (B(t, "ARROW_LEFT") && n.nodeBefore && n.nodeBefore.isText && n.nodeBefore.text && n.nodeBefore.text === S) {
2050
+ const b = n.parent, m = n.index();
2051
2051
  if (m >= 2) {
2052
- if (T.child(m - 2).type.name === A.TEMPLATE_BLOCK) {
2053
- const p = o.pos - 2;
2054
- return s(n.tr.setSelection(O.create(n.doc, p))), t.preventDefault(), !0;
2052
+ if (b.child(m - 2).type.name === _.TEMPLATE_BLOCK) {
2053
+ const p = n.pos - 2;
2054
+ return s(o.tr.setSelection(O.create(o.doc, p))), t.preventDefault(), !0;
2055
2055
  }
2056
- } else if (m === 1 && o.pos !== 0) {
2057
- const y = o.before() - 1;
2058
- if (y >= 0)
2059
- return s(n.tr.setSelection(O.create(n.doc, y))), t.preventDefault(), !0;
2056
+ } else if (m === 1 && n.pos !== 0) {
2057
+ const x = n.before() - 1;
2058
+ if (x >= 0)
2059
+ return s(o.tr.setSelection(O.create(o.doc, x))), t.preventDefault(), !0;
2060
2060
  }
2061
2061
  }
2062
- if (I(t, "ARROW_RIGHT") && o.nodeAfter && o.nodeAfter.isText && o.nodeAfter.text === C) {
2063
- const T = o.parent, m = o.index();
2064
- if (m < T.childCount - 1) {
2065
- if (T.child(m + 1).type.name === A.TEMPLATE_BLOCK) {
2066
- const p = o.pos + 2;
2067
- return s(n.tr.setSelection(O.create(n.doc, p))), t.preventDefault(), !0;
2062
+ if (B(t, "ARROW_RIGHT") && n.nodeAfter && n.nodeAfter.isText && n.nodeAfter.text === S) {
2063
+ const b = n.parent, m = n.index();
2064
+ if (m < b.childCount - 1) {
2065
+ if (b.child(m + 1).type.name === _.TEMPLATE_BLOCK) {
2066
+ const p = n.pos + 2;
2067
+ return s(o.tr.setSelection(O.create(o.doc, p))), t.preventDefault(), !0;
2068
2068
  }
2069
- } else if (m === T.childCount - 1 && n.doc.lastChild !== o.node()) {
2070
- const y = o.after() + 1;
2071
- return s(n.tr.setSelection(O.create(n.doc, y))), t.preventDefault(), !0;
2069
+ } else if (m === b.childCount - 1 && o.doc.lastChild !== n.node()) {
2070
+ const x = n.after() + 1;
2071
+ return s(o.tr.setSelection(O.create(o.doc, x))), t.preventDefault(), !0;
2072
2072
  }
2073
2073
  }
2074
- const l = o.node();
2075
- if (l.type.name === A.TEMPLATE_BLOCK) {
2076
- const T = l.textContent || "";
2077
- if (T === "" || T === C) {
2074
+ const l = n.node();
2075
+ if (l.type.name === _.TEMPLATE_BLOCK) {
2076
+ const b = l.textContent || "";
2077
+ if (b === "" || b === S) {
2078
2078
  if (we(t, ["ARROW_LEFT", "ARROW_RIGHT"])) {
2079
- const m = I(t, "ARROW_LEFT") ? o.before() : o.after();
2079
+ const m = B(t, "ARROW_LEFT") ? n.before() : n.after();
2080
2080
  if (r.from !== m)
2081
- return s(n.tr.setSelection(O.create(n.doc, m))), t.preventDefault(), !0;
2081
+ return s(o.tr.setSelection(O.create(o.doc, m))), t.preventDefault(), !0;
2082
2082
  }
2083
2083
  } else {
2084
- if (I(t, "ARROW_LEFT") && o.pos === o.start()) {
2085
- const m = o.before();
2086
- return s(n.tr.setSelection(O.create(n.doc, m))), t.preventDefault(), !0;
2084
+ if (B(t, "ARROW_LEFT") && n.pos === n.start()) {
2085
+ const m = n.before();
2086
+ return s(o.tr.setSelection(O.create(o.doc, m))), t.preventDefault(), !0;
2087
2087
  }
2088
- if (I(t, "ARROW_RIGHT") && o.pos === o.end()) {
2089
- const m = o.after();
2090
- return s(n.tr.setSelection(O.create(n.doc, m))), t.preventDefault(), !0;
2088
+ if (B(t, "ARROW_RIGHT") && n.pos === n.end()) {
2089
+ const m = n.after();
2090
+ return s(o.tr.setSelection(O.create(o.doc, m))), t.preventDefault(), !0;
2091
2091
  }
2092
2092
  }
2093
2093
  }
2094
- if (I(t, "BACKSPACE") && r.empty) {
2095
- const T = o.node(), m = o.nodeBefore;
2096
- if (T.type.name === A.TEMPLATE_BLOCK) {
2097
- const y = T.textContent || "";
2098
- if (o.pos === o.end() && y.length === 1 && y !== C) {
2099
- const p = o.pos - 1;
2100
- return s(n.tr.insertText(C, p, p + 1)), t.preventDefault(), !0;
2094
+ if (B(t, "BACKSPACE") && r.empty) {
2095
+ const b = n.node(), m = n.nodeBefore;
2096
+ if (b.type.name === _.TEMPLATE_BLOCK) {
2097
+ const x = b.textContent || "";
2098
+ if (n.pos === n.end() && x.length === 1 && x !== S) {
2099
+ const p = n.pos - 1;
2100
+ return s(o.tr.insertText(S, p, p + 1)), t.preventDefault(), !0;
2101
2101
  }
2102
- if (y === C) {
2103
- const p = o.before(), f = n.tr.setSelection(O.create(n.doc, p));
2102
+ if (x === S) {
2103
+ const p = n.before(), f = o.tr.setSelection(O.create(o.doc, p));
2104
2104
  return s(f), t.preventDefault(), !0;
2105
2105
  }
2106
- if (y === "") {
2107
- const p = o.before(), f = n.tr.setSelection(O.create(n.doc, p));
2106
+ if (x === "") {
2107
+ const p = n.before(), f = o.tr.setSelection(O.create(o.doc, p));
2108
2108
  return s(f), t.preventDefault(), !0;
2109
2109
  }
2110
- if (o.pos === o.start() && y.length > 0 && y !== C) {
2111
- const p = o.before();
2112
- return s(n.tr.setSelection(O.create(n.doc, p))), t.preventDefault(), !0;
2110
+ if (n.pos === n.start() && x.length > 0 && x !== S) {
2111
+ const p = n.before();
2112
+ return s(o.tr.setSelection(O.create(o.doc, p))), t.preventDefault(), !0;
2113
2113
  }
2114
2114
  return !1;
2115
2115
  }
2116
- if (m && m.isText && ((i = m.text) == null ? void 0 : i.length) === 1 && m.text !== C && o.nodeAfter && o.nodeAfter.type.name === A.TEMPLATE_BLOCK) {
2117
- const y = o.pos - m.nodeSize, p = o.pos;
2118
- let f = n.tr.delete(y, p);
2119
- return f = f.insertText(C, y, y), s(f), t.preventDefault(), !0;
2116
+ if (m && m.isText && ((i = m.text) == null ? void 0 : i.length) === 1 && m.text !== S && n.nodeAfter && n.nodeAfter.type.name === _.TEMPLATE_BLOCK) {
2117
+ const x = n.pos - m.nodeSize, p = n.pos;
2118
+ let f = o.tr.delete(x, p);
2119
+ return f = f.insertText(S, x, x), s(f), t.preventDefault(), !0;
2120
2120
  }
2121
- if (m && m.type.name === A.TEMPLATE_BLOCK) {
2122
- const y = m.textContent || "";
2123
- if (y.length === 0 || y === C) {
2124
- const f = o.parent, x = o.index(), v = o.nodeAfter;
2125
- let S = o.pos - m.nodeSize, _ = o.pos;
2126
- if (x > 1) {
2127
- const b = f.child(x - 2);
2128
- b && b.isText && b.text === C && (S = S - 1);
2121
+ if (m && m.type.name === _.TEMPLATE_BLOCK) {
2122
+ const x = m.textContent || "";
2123
+ if (x.length === 0 || x === S) {
2124
+ const f = n.parent, v = n.index(), E = n.nodeAfter;
2125
+ let T = n.pos - m.nodeSize, A = n.pos;
2126
+ if (v > 1) {
2127
+ const y = f.child(v - 2);
2128
+ y && y.isText && y.text === S && (T = T - 1);
2129
2129
  }
2130
- return v && v.isText && ((a = v.text) != null && a.startsWith(C)) && (_ = _ + 1), s(n.tr.delete(S, _)), t.preventDefault(), !0;
2130
+ return E && E.isText && ((a = E.text) != null && a.startsWith(S)) && (A = A + 1), s(o.tr.delete(T, A)), t.preventDefault(), !0;
2131
2131
  } else {
2132
- const f = o.pos - 1;
2133
- return s(n.tr.setSelection(O.create(n.doc, f))), t.preventDefault(), !0;
2132
+ const f = n.pos - 1;
2133
+ return s(o.tr.setSelection(O.create(o.doc, f))), t.preventDefault(), !0;
2134
2134
  }
2135
2135
  }
2136
2136
  if (m && m.isText) {
2137
- const y = o.parent, p = o.index();
2138
- if (m.text === C) {
2137
+ const x = n.parent, p = n.index();
2138
+ if (m.text === S) {
2139
2139
  if (p > 1) {
2140
- const f = y.child(p - 2);
2141
- if (f.type.name === A.TEMPLATE_BLOCK) {
2142
- const x = f.textContent || "";
2143
- if (x.length === 0 || x === C) {
2144
- const S = o.pos - m.nodeSize - f.nodeSize, _ = o.nodeAfter;
2145
- let b = o.pos;
2146
- return _ && _.isText && _.text === C && (b = b + 1), s(n.tr.delete(S, b)), t.preventDefault(), !0;
2140
+ const f = x.child(p - 2);
2141
+ if (f.type.name === _.TEMPLATE_BLOCK) {
2142
+ const v = f.textContent || "";
2143
+ if (v.length === 0 || v === S) {
2144
+ const T = n.pos - m.nodeSize - f.nodeSize, A = n.nodeAfter;
2145
+ let y = n.pos;
2146
+ return A && A.isText && A.text === S && (y = y + 1), s(o.tr.delete(T, y)), t.preventDefault(), !0;
2147
2147
  } else {
2148
- const S = o.pos - 2;
2149
- if (S >= 0)
2150
- return s(n.tr.setSelection(O.create(n.doc, S))), t.preventDefault(), !0;
2148
+ const T = n.pos - 2;
2149
+ if (T >= 0)
2150
+ return s(o.tr.setSelection(O.create(o.doc, T))), t.preventDefault(), !0;
2151
2151
  }
2152
2152
  }
2153
2153
  }
2154
- } else if (p === 1 && o.pos !== 1 && m.text === C) {
2154
+ } else if (p === 1 && n.pos !== 1 && m.text === S) {
2155
2155
  const f = r.from - 1 - 2;
2156
2156
  if (f >= 0)
2157
- return s(n.tr.delete(f, r.to)), t.preventDefault(), !0;
2157
+ return s(o.tr.delete(f, r.to)), t.preventDefault(), !0;
2158
2158
  }
2159
2159
  }
2160
2160
  }
2161
- if (I(t, "BACKSPACE") && !r.empty) {
2162
- let T = r.from, m = r.to;
2163
- const y = o.nodeBefore, p = o.nodeAfter;
2164
- if (y && y.isText && ((c = y.text) != null && c.endsWith(C)) && (T -= 1), p && p.isText && ((d = p.text) != null && d.startsWith(C)) && (m += 1), T !== r.from || m !== r.to) {
2165
- const f = n.tr.delete(T, m);
2161
+ if (B(t, "BACKSPACE") && !r.empty) {
2162
+ let b = r.from, m = r.to;
2163
+ const x = n.nodeBefore, p = n.nodeAfter;
2164
+ if (x && x.isText && ((c = x.text) != null && c.endsWith(S)) && (b -= 1), p && p.isText && ((d = p.text) != null && d.startsWith(S)) && (m += 1), b !== r.from || m !== r.to) {
2165
+ const f = o.tr.delete(b, m);
2166
2166
  return s(f), t.preventDefault(), !0;
2167
2167
  }
2168
2168
  }
2169
- if (I(t, "DELETE") && r.empty) {
2170
- const T = o.node(), m = o.nodeAfter;
2171
- if (T.type.name === A.TEMPLATE_BLOCK) {
2172
- const y = T.textContent || "";
2173
- if (o.pos === o.start() && y.length === 1 && y !== C) {
2174
- const p = o.pos;
2175
- return s(n.tr.insertText(C, p, p + 1)), t.preventDefault(), !0;
2169
+ if (B(t, "DELETE") && r.empty) {
2170
+ const b = n.node(), m = n.nodeAfter;
2171
+ if (b.type.name === _.TEMPLATE_BLOCK) {
2172
+ const x = b.textContent || "";
2173
+ if (n.pos === n.start() && x.length === 1 && x !== S) {
2174
+ const p = n.pos;
2175
+ return s(o.tr.insertText(S, p, p + 1)), t.preventDefault(), !0;
2176
2176
  }
2177
- if (y === C) {
2178
- const p = o.after(), f = n.tr.setSelection(O.create(n.doc, p));
2177
+ if (x === S) {
2178
+ const p = n.after(), f = o.tr.setSelection(O.create(o.doc, p));
2179
2179
  return s(f), t.preventDefault(), !0;
2180
2180
  }
2181
- if (y === "") {
2182
- const p = o.after(), f = n.tr.setSelection(O.create(n.doc, p));
2181
+ if (x === "") {
2182
+ const p = n.after(), f = o.tr.setSelection(O.create(o.doc, p));
2183
2183
  return s(f), t.preventDefault(), !0;
2184
2184
  }
2185
- if (o.pos === o.end() && y.length > 0 && y !== C) {
2186
- const p = o.after();
2187
- return s(n.tr.setSelection(O.create(n.doc, p))), t.preventDefault(), !0;
2185
+ if (n.pos === n.end() && x.length > 0 && x !== S) {
2186
+ const p = n.after();
2187
+ return s(o.tr.setSelection(O.create(o.doc, p))), t.preventDefault(), !0;
2188
2188
  }
2189
2189
  return !1;
2190
2190
  }
2191
- if (m && m.isText && ((u = m.text) == null ? void 0 : u.length) === 1 && m.text !== C && o.nodeBefore && o.nodeBefore.type.name === A.TEMPLATE_BLOCK) {
2192
- const y = o.pos, p = o.pos + m.nodeSize;
2193
- let f = n.tr.delete(y, p);
2194
- return f = f.insertText(C, y, y), s(f), t.preventDefault(), !0;
2191
+ if (m && m.isText && ((u = m.text) == null ? void 0 : u.length) === 1 && m.text !== S && n.nodeBefore && n.nodeBefore.type.name === _.TEMPLATE_BLOCK) {
2192
+ const x = n.pos, p = n.pos + m.nodeSize;
2193
+ let f = o.tr.delete(x, p);
2194
+ return f = f.insertText(S, x, x), s(f), t.preventDefault(), !0;
2195
2195
  }
2196
- if (m && m.type.name === A.TEMPLATE_BLOCK) {
2197
- const y = m.textContent || "";
2198
- if (y.length === 0 || y === C) {
2199
- const f = o.parent, x = o.index(), v = o.nodeBefore;
2200
- let S = o.pos, _ = o.pos + m.nodeSize;
2201
- if (v && v.isText && v.text === C && (S = S - 1), x < f.childCount - 1) {
2202
- const b = f.child(x + 1);
2203
- b && b.isText && b.text === C && (_ = _ + 1);
2196
+ if (m && m.type.name === _.TEMPLATE_BLOCK) {
2197
+ const x = m.textContent || "";
2198
+ if (x.length === 0 || x === S) {
2199
+ const f = n.parent, v = n.index(), E = n.nodeBefore;
2200
+ let T = n.pos, A = n.pos + m.nodeSize;
2201
+ if (E && E.isText && E.text === S && (T = T - 1), v < f.childCount - 1) {
2202
+ const y = f.child(v + 1);
2203
+ y && y.isText && y.text === S && (A = A + 1);
2204
2204
  }
2205
- return s(n.tr.delete(S, _)), t.preventDefault(), !0;
2205
+ return s(o.tr.delete(T, A)), t.preventDefault(), !0;
2206
2206
  } else {
2207
- const f = o.pos + 1;
2208
- return s(n.tr.setSelection(O.create(n.doc, f))), t.preventDefault(), !0;
2207
+ const f = n.pos + 1;
2208
+ return s(o.tr.setSelection(O.create(o.doc, f))), t.preventDefault(), !0;
2209
2209
  }
2210
2210
  }
2211
2211
  if (m && m.isText) {
2212
- const y = o.parent, p = o.index();
2213
- if (p < y.childCount - 1) {
2214
- const f = y.child(p + 1);
2215
- if (f.type.name === A.TEMPLATE_BLOCK) {
2216
- const x = f.textContent || "";
2217
- if (x.length === 0 || x === C) {
2218
- let S = o.pos;
2219
- const _ = o.pos + m.nodeSize + f.nodeSize, b = o.nodeBefore;
2220
- return b && b.isText && ((g = b.text) != null && g.endsWith(C)) && (S = S - 1), s(n.tr.delete(S, _)), t.preventDefault(), !0;
2212
+ const x = n.parent, p = n.index();
2213
+ if (p < x.childCount - 1) {
2214
+ const f = x.child(p + 1);
2215
+ if (f.type.name === _.TEMPLATE_BLOCK) {
2216
+ const v = f.textContent || "";
2217
+ if (v.length === 0 || v === S) {
2218
+ let T = n.pos;
2219
+ const A = n.pos + m.nodeSize + f.nodeSize, y = n.nodeBefore;
2220
+ return y && y.isText && ((g = y.text) != null && g.endsWith(S)) && (T = T - 1), s(o.tr.delete(T, A)), t.preventDefault(), !0;
2221
2221
  }
2222
- if (m.text === C || (h = m.text) != null && h.startsWith(C)) {
2223
- const S = o.pos + 2;
2224
- return s(n.tr.setSelection(O.create(n.doc, S))), t.preventDefault(), !0;
2222
+ if (m.text === S || (h = m.text) != null && h.startsWith(S)) {
2223
+ const T = n.pos + 2;
2224
+ return s(o.tr.setSelection(O.create(o.doc, T))), t.preventDefault(), !0;
2225
2225
  }
2226
2226
  }
2227
2227
  }
2228
2228
  }
2229
2229
  }
2230
- if (I(t, "DELETE") && !r.empty) {
2231
- let T = r.from, m = r.to;
2232
- const y = o.nodeBefore, p = o.nodeAfter;
2233
- if (y && y.isText && ((E = y.text) != null && E.endsWith(C)) && (T -= 1), p && p.isText && ((w = p.text) != null && w.startsWith(C)) && (m += 1), T !== r.from || m !== r.to) {
2234
- const f = n.tr.delete(T, m);
2230
+ if (B(t, "DELETE") && !r.empty) {
2231
+ let b = r.from, m = r.to;
2232
+ const x = n.nodeBefore, p = n.nodeAfter;
2233
+ if (x && x.isText && ((C = x.text) != null && C.endsWith(S)) && (b -= 1), p && p.isText && ((w = p.text) != null && w.startsWith(S)) && (m += 1), b !== r.from || m !== r.to) {
2234
+ const f = o.tr.delete(b, m);
2235
2235
  return s(f), t.preventDefault(), !0;
2236
2236
  }
2237
2237
  }
@@ -2240,20 +2240,20 @@ function Xo() {
2240
2240
  }
2241
2241
  });
2242
2242
  }
2243
- function Yo() {
2244
- return new ie({
2245
- key: new re(ae.TEMPLATE_BLOCK_PASTE),
2243
+ function Zo() {
2244
+ return new ae({
2245
+ key: new le(ue.TEMPLATE_BLOCK_PASTE),
2246
2246
  props: {
2247
2247
  handlePaste(e, t) {
2248
- var o, l, i;
2249
- const n = ((o = t.clipboardData) == null ? void 0 : o.types) || [], s = (l = t.clipboardData) == null ? void 0 : l.getData("text/html");
2250
- if (n.includes("text/html") && (s != null && s.includes("data-template")) || n.includes("application/x-prosemirror-slice"))
2248
+ var n, l, i;
2249
+ const o = ((n = t.clipboardData) == null ? void 0 : n.types) || [], s = (l = t.clipboardData) == null ? void 0 : l.getData("text/html");
2250
+ if (o.includes("text/html") && (s != null && s.includes("data-template")) || o.includes("application/x-prosemirror-slice"))
2251
2251
  return !1;
2252
2252
  const r = (i = t.clipboardData) == null ? void 0 : i.getData("text/plain");
2253
2253
  if (r) {
2254
2254
  const { state: a, dispatch: c } = e, d = a.selection.$from;
2255
2255
  let u = a.tr;
2256
- d.nodeBefore && d.nodeBefore.isText && d.nodeBefore.text === C && (u = u.delete(d.pos - d.nodeBefore.nodeSize, d.pos)), d.nodeAfter && d.nodeAfter.isText && d.nodeAfter.text === C && (u = u.delete(d.pos, d.pos + d.nodeAfter.nodeSize));
2256
+ d.nodeBefore && d.nodeBefore.isText && d.nodeBefore.text === S && (u = u.delete(d.pos - d.nodeBefore.nodeSize, d.pos)), d.nodeAfter && d.nodeAfter.isText && d.nodeAfter.text === S && (u = u.delete(d.pos, d.pos + d.nodeAfter.nodeSize));
2257
2257
  const g = r.split(`
2258
2258
  `);
2259
2259
  let h;
@@ -2261,12 +2261,12 @@ function Yo() {
2261
2261
  u = u.insertText(g[0], u.selection.from, u.selection.to), h = u.selection.$to.pos;
2262
2262
  else {
2263
2263
  u = u.insertText(g[0], u.selection.from, u.selection.to);
2264
- let E = u.selection.$to.pos;
2264
+ let C = u.selection.$to.pos;
2265
2265
  for (let w = 1; w < g.length; w++) {
2266
- const T = a.schema.nodes.paragraph.create({}, g[w] ? a.schema.text(g[w]) : null);
2267
- u = u.insert(E, T), E += T.nodeSize;
2266
+ const b = a.schema.nodes.paragraph.create({}, g[w] ? a.schema.text(g[w]) : null);
2267
+ u = u.insert(C, b), C += b.nodeSize;
2268
2268
  }
2269
- h = E;
2269
+ h = C;
2270
2270
  }
2271
2271
  return u = u.setSelection(O.create(u.doc, h)), u = u.scrollIntoView(), c(u), t.preventDefault(), !0;
2272
2272
  }
@@ -2275,8 +2275,8 @@ function Yo() {
2275
2275
  }
2276
2276
  });
2277
2277
  }
2278
- const Zo = ct.create({
2279
- name: A.TEMPLATE_BLOCK,
2278
+ const Jo = ct.create({
2279
+ name: _.TEMPLATE_BLOCK,
2280
2280
  // 节点配置
2281
2281
  group: "inline",
2282
2282
  inline: !0,
@@ -2326,30 +2326,30 @@ const Zo = ct.create({
2326
2326
  },
2327
2327
  // HTML 渲染
2328
2328
  renderHTML({ node: e, HTMLAttributes: t }) {
2329
- const n = e.textContent || "";
2329
+ const o = e.textContent || "";
2330
2330
  return [
2331
2331
  "span",
2332
2332
  ut(this.options.HTMLAttributes || {}, t, {
2333
2333
  "data-template": "",
2334
2334
  "data-id": e.attrs.id,
2335
- "data-content": n
2335
+ "data-content": o
2336
2336
  }),
2337
- n
2337
+ o
2338
2338
  ];
2339
2339
  },
2340
2340
  // 使用 Vue 组件渲染
2341
2341
  addNodeView() {
2342
- return at(Vo);
2342
+ return at(Go);
2343
2343
  },
2344
2344
  // 添加插件
2345
2345
  addProseMirrorPlugins() {
2346
- return [Uo(), Xo(), Yo()];
2346
+ return [Xo(), Yo(), Zo()];
2347
2347
  }
2348
- }), Ce = new re(
2349
- ae.TEMPLATE_SELECT_DROPDOWN
2348
+ }), Ce = new le(
2349
+ ue.TEMPLATE_SELECT_DROPDOWN
2350
2350
  );
2351
- function Jo() {
2352
- return new ie({
2351
+ function Qo() {
2352
+ return new ae({
2353
2353
  key: Ce,
2354
2354
  state: {
2355
2355
  init() {
@@ -2359,14 +2359,14 @@ function Jo() {
2359
2359
  };
2360
2360
  },
2361
2361
  apply(e, t) {
2362
- const n = e.getMeta(Ce);
2363
- if (n) {
2364
- if (n.type === "open")
2362
+ const o = e.getMeta(Ce);
2363
+ if (o) {
2364
+ if (o.type === "open")
2365
2365
  return {
2366
2366
  isOpen: !0,
2367
- selectId: n.selectId
2367
+ selectId: o.selectId
2368
2368
  };
2369
- if (n.type === "close")
2369
+ if (o.type === "close")
2370
2370
  return {
2371
2371
  isOpen: !1,
2372
2372
  selectId: null
@@ -2377,81 +2377,81 @@ function Jo() {
2377
2377
  }
2378
2378
  });
2379
2379
  }
2380
- function Qo() {
2381
- return new ie({
2382
- key: new re(ae.TEMPLATE_SELECT_ZERO_WIDTH),
2383
- appendTransaction(e, t, n) {
2380
+ function es() {
2381
+ return new ae({
2382
+ key: new le(ue.TEMPLATE_SELECT_ZERO_WIDTH),
2383
+ appendTransaction(e, t, o) {
2384
2384
  if (!e.some((l) => l.docChanged)) return null;
2385
2385
  const r = [];
2386
- let { tr: o } = n;
2387
- return n.doc.descendants((l, i) => {
2388
- if (l.type.name === A.PARAGRAPH && l.childCount > 0) {
2386
+ let { tr: n } = o;
2387
+ return o.doc.descendants((l, i) => {
2388
+ if (l.type.name === _.PARAGRAPH && l.childCount > 0) {
2389
2389
  const { lastChild: a, firstChild: c } = l;
2390
- a === c && a && a.isText && a.text === C && r.push(["remove", i + 1]);
2390
+ a === c && a && a.isText && a.text === S && r.push(["remove", i + 1]);
2391
2391
  }
2392
2392
  }), r.length > 0 ? (r.forEach(([, l]) => {
2393
- o = o.delete(l, l + 1);
2394
- }), o) : null;
2393
+ n = n.delete(l, l + 1);
2394
+ }), n) : null;
2395
2395
  }
2396
2396
  });
2397
2397
  }
2398
- function es() {
2399
- return new ie({
2400
- key: new re(ae.TEMPLATE_SELECT_KEYBOARD),
2398
+ function ts() {
2399
+ return new ae({
2400
+ key: new le(ue.TEMPLATE_SELECT_KEYBOARD),
2401
2401
  props: {
2402
2402
  handleKeyDown(e, t) {
2403
- const { state: n, dispatch: s } = e, { selection: r } = n, { $from: o } = r, l = Ce.getState(e.state);
2403
+ const { state: o, dispatch: s } = e, { selection: r } = o, { $from: n } = r, l = Ce.getState(e.state);
2404
2404
  if (l != null && l.isOpen && we(t, ["ENTER", "ARROW_UP", "ARROW_DOWN", "ESCAPE"]))
2405
2405
  return !0;
2406
- if (I(t, "BACKSPACE") && r.empty) {
2407
- const i = o.nodeBefore, a = o.nodeAfter;
2408
- if ((i == null ? void 0 : i.type.name) === A.TEMPLATE_SELECT)
2409
- return s(n.tr.delete(o.pos - i.nodeSize, o.pos)), t.preventDefault(), !0;
2410
- if (i != null && i.isText && i.text === C) {
2411
- const c = o.pos - 1, u = n.doc.resolve(c).nodeBefore;
2412
- if ((u == null ? void 0 : u.type.name) === A.TEMPLATE_SELECT) {
2413
- const g = c - u.nodeSize, h = o.pos;
2414
- return s(n.tr.delete(g, h)), t.preventDefault(), !0;
2406
+ if (B(t, "BACKSPACE") && r.empty) {
2407
+ const i = n.nodeBefore, a = n.nodeAfter;
2408
+ if ((i == null ? void 0 : i.type.name) === _.TEMPLATE_SELECT)
2409
+ return s(o.tr.delete(n.pos - i.nodeSize, n.pos)), t.preventDefault(), !0;
2410
+ if (i != null && i.isText && i.text === S) {
2411
+ const c = n.pos - 1, u = o.doc.resolve(c).nodeBefore;
2412
+ if ((u == null ? void 0 : u.type.name) === _.TEMPLATE_SELECT) {
2413
+ const g = c - u.nodeSize, h = n.pos;
2414
+ return s(o.tr.delete(g, h)), t.preventDefault(), !0;
2415
2415
  }
2416
2416
  }
2417
- if ((a == null ? void 0 : a.type.name) === A.TEMPLATE_SELECT) {
2418
- if (i != null && i.isText && i.text !== C)
2419
- return s(n.tr.delete(o.pos - 1, o.pos)), t.preventDefault(), !0;
2420
- if ((i == null ? void 0 : i.type.name) === A.TEMPLATE_BLOCK)
2417
+ if ((a == null ? void 0 : a.type.name) === _.TEMPLATE_SELECT) {
2418
+ if (i != null && i.isText && i.text !== S)
2419
+ return s(o.tr.delete(n.pos - 1, n.pos)), t.preventDefault(), !0;
2420
+ if ((i == null ? void 0 : i.type.name) === _.TEMPLATE_BLOCK)
2421
2421
  return !1;
2422
2422
  }
2423
- if (!a && (i != null && i.isText) && i.text !== C)
2424
- return s(n.tr.delete(o.pos - 1, o.pos)), t.preventDefault(), !0;
2423
+ if (!a && (i != null && i.isText) && i.text !== S)
2424
+ return s(o.tr.delete(n.pos - 1, n.pos)), t.preventDefault(), !0;
2425
2425
  }
2426
- if (I(t, "DELETE") && r.empty) {
2427
- const i = o.nodeAfter, a = o.nodeBefore;
2428
- if ((i == null ? void 0 : i.type.name) === A.TEMPLATE_SELECT)
2429
- return s(n.tr.delete(o.pos, o.pos + i.nodeSize)), t.preventDefault(), !0;
2430
- if (i != null && i.isText && i.text === C) {
2431
- const c = o.pos + 1, u = n.doc.resolve(c).nodeAfter;
2432
- if ((u == null ? void 0 : u.type.name) === A.TEMPLATE_SELECT) {
2426
+ if (B(t, "DELETE") && r.empty) {
2427
+ const i = n.nodeAfter, a = n.nodeBefore;
2428
+ if ((i == null ? void 0 : i.type.name) === _.TEMPLATE_SELECT)
2429
+ return s(o.tr.delete(n.pos, n.pos + i.nodeSize)), t.preventDefault(), !0;
2430
+ if (i != null && i.isText && i.text === S) {
2431
+ const c = n.pos + 1, u = o.doc.resolve(c).nodeAfter;
2432
+ if ((u == null ? void 0 : u.type.name) === _.TEMPLATE_SELECT) {
2433
2433
  const g = c + u.nodeSize;
2434
- return s(n.tr.delete(o.pos, g)), t.preventDefault(), !0;
2434
+ return s(o.tr.delete(n.pos, g)), t.preventDefault(), !0;
2435
2435
  }
2436
2436
  }
2437
- if ((a == null ? void 0 : a.type.name) === A.TEMPLATE_SELECT) {
2438
- if (i != null && i.isText && i.text !== C)
2439
- return s(n.tr.delete(o.pos, o.pos + 1)), t.preventDefault(), !0;
2440
- if ((i == null ? void 0 : i.type.name) === A.TEMPLATE_BLOCK)
2437
+ if ((a == null ? void 0 : a.type.name) === _.TEMPLATE_SELECT) {
2438
+ if (i != null && i.isText && i.text !== S)
2439
+ return s(o.tr.delete(n.pos, n.pos + 1)), t.preventDefault(), !0;
2440
+ if ((i == null ? void 0 : i.type.name) === _.TEMPLATE_BLOCK)
2441
2441
  return !1;
2442
2442
  }
2443
- if (!a && (i != null && i.isText) && i.text !== C)
2444
- return s(n.tr.delete(o.pos, o.pos + 1)), t.preventDefault(), !0;
2443
+ if (!a && (i != null && i.isText) && i.text !== S)
2444
+ return s(o.tr.delete(n.pos, n.pos + 1)), t.preventDefault(), !0;
2445
2445
  }
2446
2446
  return !1;
2447
2447
  }
2448
2448
  }
2449
2449
  });
2450
2450
  }
2451
- function ts(e, t, n) {
2451
+ function ns(e, t, o) {
2452
2452
  const s = (r) => {
2453
- const o = r.target;
2454
- !e.contains(o) && !t.contains(o) && (n(), document.removeEventListener("click", s));
2453
+ const n = r.target;
2454
+ !e.contains(n) && !t.contains(n) && (o(), document.removeEventListener("click", s));
2455
2455
  };
2456
2456
  return setTimeout(() => {
2457
2457
  document.addEventListener("click", s);
@@ -2459,142 +2459,148 @@ function ts(e, t, n) {
2459
2459
  document.removeEventListener("click", s);
2460
2460
  };
2461
2461
  }
2462
- const ns = { class: "template-select__icon" }, os = ["onMousedown", "onMouseenter"], ss = /* @__PURE__ */ Z({
2462
+ const os = { class: "template-select__icon" }, ss = ["onMousedown", "onMouseenter"], rs = /* @__PURE__ */ V({
2463
2463
  __name: "template-select-view",
2464
2464
  props: {
2465
2465
  node: {},
2466
2466
  updateAttributes: { type: Function },
2467
- editor: {}
2467
+ editor: {},
2468
+ appendTo: {}
2468
2469
  },
2469
2470
  setup(e) {
2470
- const t = e, n = F(!1), s = F(-1), r = F(), o = F();
2471
- let l = null, i = null;
2472
- const a = R(() => t.node.attrs.options.find((x) => x.value === t.node.attrs.value)), c = R(() => {
2473
- var x;
2474
- return ((x = a.value) == null ? void 0 : x.label) || t.node.attrs.placeholder;
2475
- }), d = R(() => !t.node.attrs.value), u = () => {
2476
- n.value ? h() : g();
2477
- }, g = async () => {
2478
- var x;
2479
- if (n.value = !0, (x = t.editor) != null && x.view) {
2480
- const v = t.editor.view, S = v.state.tr;
2481
- S.setMeta(Ce, {
2471
+ const t = e, o = R(() => t.appendTo ? typeof t.appendTo == "string" ? document.querySelector(t.appendTo) ?? document.body : t.appendTo : document.body), s = R(() => o.value === document.body), r = F(!1), n = F(-1), l = F(), i = F();
2472
+ let a = null, c = null;
2473
+ const d = R(() => t.node.attrs.options.find((T) => T.value === t.node.attrs.value)), u = R(() => {
2474
+ var T;
2475
+ return ((T = d.value) == null ? void 0 : T.label) || t.node.attrs.placeholder;
2476
+ }), g = R(() => !t.node.attrs.value), h = () => {
2477
+ r.value ? w() : C();
2478
+ }, C = async () => {
2479
+ var T;
2480
+ if (r.value = !0, (T = t.editor) != null && T.view) {
2481
+ const A = t.editor.view, y = A.state.tr;
2482
+ y.setMeta(Ce, {
2482
2483
  type: "open",
2483
2484
  selectId: t.node.attrs.id
2484
- }), v.dispatch(S);
2485
+ }), A.dispatch(y);
2485
2486
  }
2486
- t.node.attrs.value ? s.value = t.node.attrs.options.findIndex((v) => v.value === t.node.attrs.value) : s.value = -1, await me(), w(), r.value && o.value && (l = ts(r.value, o.value, h));
2487
- }, h = async () => {
2488
- var x;
2489
- if (n.value = !1, s.value = -1, (x = t.editor) != null && x.view) {
2490
- const v = t.editor.view, S = v.state.tr;
2491
- S.setMeta(Ce, {
2487
+ t.node.attrs.value ? n.value = t.node.attrs.options.findIndex((A) => A.value === t.node.attrs.value) : n.value = -1, await ge(), m(), l.value && i.value && (a = ns(l.value, i.value, w));
2488
+ }, w = async () => {
2489
+ var T;
2490
+ if (r.value = !1, n.value = -1, (T = t.editor) != null && T.view) {
2491
+ const A = t.editor.view, y = A.state.tr;
2492
+ y.setMeta(Ce, {
2492
2493
  type: "close"
2493
- }), v.dispatch(S);
2494
+ }), A.dispatch(y);
2494
2495
  }
2495
- l && (l(), l = null), i && (i(), i = null);
2496
- }, E = (x) => {
2497
- t.updateAttributes({ value: x.value }), h();
2498
- }, w = () => {
2499
- !r.value || !o.value || (i && (i(), i = null), i = mt(r.value, o.value, () => {
2500
- !r.value || !o.value || yt(r.value, o.value, {
2496
+ a && (a(), a = null), c && (c(), c = null);
2497
+ }, b = (T) => {
2498
+ t.updateAttributes({ value: T.value }), w();
2499
+ }, m = () => {
2500
+ !l.value || !i.value || (c && (c(), c = null), c = mt(l.value, i.value, () => {
2501
+ !l.value || !i.value || yt(l.value, i.value, {
2501
2502
  placement: "bottom-start",
2502
- strategy: "fixed",
2503
+ strategy: s.value ? "fixed" : "absolute",
2503
2504
  // 使用 fixed 定位策略,相对于视口
2504
2505
  middleware: [ht(4), xt(), gt({ padding: 8 })]
2505
- }).then(({ x, y: v }) => {
2506
- o.value && Object.assign(o.value.style, {
2507
- left: `${x}px`,
2508
- top: `${v}px`
2506
+ }).then(({ x: T, y: A }) => {
2507
+ i.value && Object.assign(i.value.style, {
2508
+ left: `${T}px`,
2509
+ top: `${A}px`
2509
2510
  });
2510
2511
  });
2511
2512
  }));
2512
- }, T = (x) => {
2513
- if (n.value)
2514
- switch (x.key) {
2513
+ }, x = (T) => {
2514
+ if (r.value)
2515
+ switch (T.key) {
2515
2516
  case "ArrowUp":
2516
- x.preventDefault(), m();
2517
+ T.preventDefault(), p();
2517
2518
  break;
2518
2519
  case "ArrowDown":
2519
- x.preventDefault(), y();
2520
+ T.preventDefault(), f();
2520
2521
  break;
2521
2522
  case "Enter":
2522
- x.preventDefault(), f();
2523
+ T.preventDefault(), E();
2523
2524
  break;
2524
2525
  case "Escape":
2525
- x.preventDefault(), h();
2526
+ T.preventDefault(), w();
2526
2527
  break;
2527
2528
  }
2528
- }, m = () => {
2529
- s.value === -1 || s.value <= 0 ? s.value = t.node.attrs.options.length - 1 : s.value -= 1, p();
2530
- }, y = () => {
2531
- s.value === -1 || s.value >= t.node.attrs.options.length - 1 ? s.value = 0 : s.value += 1, p();
2532
2529
  }, p = () => {
2533
- me(() => {
2534
- if (!o.value) return;
2535
- const x = o.value.querySelector(".template-select__option.is-highlighted");
2536
- x && x.scrollIntoView({
2530
+ n.value === -1 || n.value <= 0 ? n.value = t.node.attrs.options.length - 1 : n.value -= 1, v();
2531
+ }, f = () => {
2532
+ n.value === -1 || n.value >= t.node.attrs.options.length - 1 ? n.value = 0 : n.value += 1, v();
2533
+ }, v = () => {
2534
+ ge(() => {
2535
+ if (!i.value) return;
2536
+ const T = i.value.querySelector(".template-select__option.is-highlighted");
2537
+ T && T.scrollIntoView({
2537
2538
  block: "nearest",
2538
2539
  behavior: "smooth"
2539
2540
  });
2540
2541
  });
2541
- }, f = () => {
2542
- s.value >= 0 && s.value < t.node.attrs.options.length ? E(t.node.attrs.options[s.value]) : h();
2542
+ }, E = () => {
2543
+ n.value >= 0 && n.value < t.node.attrs.options.length ? b(t.node.attrs.options[n.value]) : w();
2543
2544
  };
2544
2545
  return dn(() => {
2545
- document.addEventListener("keydown", T);
2546
+ document.addEventListener("keydown", x);
2546
2547
  }), fn(() => {
2547
- document.removeEventListener("keydown", T), l && l(), i && i();
2548
- }), (x, v) => (M(), U(k(lt), {
2548
+ document.removeEventListener("keydown", x), a && a(), c && c();
2549
+ }), (T, A) => (M(), J(k(lt), {
2549
2550
  as: "span",
2550
2551
  class: "template-select"
2551
2552
  }, {
2552
2553
  default: j(() => [
2553
- v[0] || (v[0] = B("span", {
2554
+ A[0] || (A[0] = $("span", {
2554
2555
  contenteditable: "false",
2555
2556
  class: "template-select__prefix"
2556
2557
  }, "​", -1)),
2557
- B("span", {
2558
+ $("span", {
2558
2559
  ref_key: "triggerRef",
2559
- ref: r,
2560
- class: Q(["template-select__trigger", { "is-open": n.value }]),
2561
- onMousedown: nt(u, ["prevent"])
2560
+ ref: l,
2561
+ class: Y(["template-select__trigger", { "is-open": r.value }]),
2562
+ onMousedown: nt(h, ["prevent"])
2562
2563
  }, [
2563
- B("span", {
2564
- class: Q(["template-select__text", { "is-placeholder": d.value }])
2565
- }, pe(c.value), 3),
2566
- B("span", ns, [
2567
- se(k(Pn))
2564
+ $("span", {
2565
+ class: Y(["template-select__text", { "is-placeholder": g.value }])
2566
+ }, he(u.value), 3),
2567
+ $("span", os, [
2568
+ ie(k(On))
2568
2569
  ])
2569
2570
  ], 34),
2570
- v[1] || (v[1] = B("span", {
2571
+ A[1] || (A[1] = $("span", {
2571
2572
  contenteditable: "false",
2572
2573
  class: "template-select__suffix"
2573
2574
  }, "​", -1)),
2574
- (M(), U(pn, { to: "body" }, [
2575
- n.value ? (M(), P("div", {
2575
+ (M(), J(pn, { to: o.value }, [
2576
+ r.value ? (M(), P("div", {
2576
2577
  key: 0,
2577
2578
  ref_key: "dropdownRef",
2578
- ref: o,
2579
- class: "template-select__dropdown"
2579
+ ref: i,
2580
+ class: Y(["template-select__dropdown", { "template-select__dropdown--in-surface": !s.value }])
2580
2581
  }, [
2581
- (M(!0), P(Ie, null, Be(e.node.attrs.options, (S, _) => (M(), P("div", {
2582
- key: S.value,
2583
- class: Q(["template-select__option", {
2584
- "is-highlighted": _ === s.value,
2585
- "is-selected": S.value === e.node.attrs.value
2582
+ (M(!0), P(Be, null, Ie(e.node.attrs.options, (y, L) => (M(), P("div", {
2583
+ key: y.value,
2584
+ class: Y(["template-select__option", {
2585
+ "is-highlighted": L === n.value,
2586
+ "is-selected": y.value === e.node.attrs.value
2586
2587
  }]),
2587
- onMousedown: nt((b) => E(S), ["prevent"]),
2588
- onMouseenter: (b) => s.value = _
2589
- }, pe(S.label), 43, os))), 128))
2590
- ], 512)) : q("", !0)
2591
- ]))
2588
+ onMousedown: nt((I) => b(y), ["prevent"]),
2589
+ onMouseenter: (I) => n.value = L
2590
+ }, he(y.label), 43, ss))), 128))
2591
+ ], 2)) : q("", !0)
2592
+ ], 8, ["to"]))
2592
2593
  ]),
2593
2594
  _: 1
2594
2595
  }));
2595
2596
  }
2596
- }), rs = /* @__PURE__ */ J(ss, [["__scopeId", "data-v-dbb18436"]]), is = ct.create({
2597
- name: A.TEMPLATE_SELECT,
2597
+ }), is = /* @__PURE__ */ te(rs, [["__scopeId", "data-v-3a76e451"]]), ls = ct.create({
2598
+ name: _.TEMPLATE_SELECT,
2599
+ addOptions() {
2600
+ return {
2601
+ appendTo: void 0
2602
+ };
2603
+ },
2598
2604
  // 节点配置
2599
2605
  group: "inline",
2600
2606
  inline: !0,
@@ -2622,8 +2628,8 @@ const ns = { class: "template-select__icon" }, os = ["onMousedown", "onMouseente
2622
2628
  if (!t) return [];
2623
2629
  try {
2624
2630
  return JSON.parse(t);
2625
- } catch (n) {
2626
- return console.warn("Failed to parse template select options:", n), [];
2631
+ } catch (o) {
2632
+ return console.warn("Failed to parse template select options:", o), [];
2627
2633
  }
2628
2634
  },
2629
2635
  renderHTML: (e) => {
@@ -2651,14 +2657,14 @@ const ns = { class: "template-select__icon" }, os = ["onMousedown", "onMouseente
2651
2657
  },
2652
2658
  // HTML 渲染
2653
2659
  renderHTML({ node: e, HTMLAttributes: t }) {
2654
- const n = e.attrs.options.find(
2655
- (o) => o.value === e.attrs.value
2656
- ), s = (n == null ? void 0 : n.label) || e.attrs.placeholder;
2660
+ const o = e.attrs.options.find(
2661
+ (n) => n.value === e.attrs.value
2662
+ ), s = (o == null ? void 0 : o.label) || e.attrs.placeholder;
2657
2663
  let r = "[]";
2658
2664
  try {
2659
2665
  r = JSON.stringify(e.attrs.options);
2660
- } catch (o) {
2661
- console.error("Failed to stringify template select options in renderHTML:", o);
2666
+ } catch (n) {
2667
+ console.error("Failed to stringify template select options in renderHTML:", n);
2662
2668
  }
2663
2669
  return [
2664
2670
  "span",
@@ -2674,47 +2680,55 @@ const ns = { class: "template-select__icon" }, os = ["onMousedown", "onMouseente
2674
2680
  },
2675
2681
  // 使用 Vue 组件渲染
2676
2682
  addNodeView() {
2677
- return at(rs);
2683
+ const e = this.options.appendTo;
2684
+ return at(
2685
+ V({
2686
+ name: "TemplateSelectNodeView",
2687
+ setup(t) {
2688
+ return () => mn(is, { ...t, appendTo: e });
2689
+ }
2690
+ })
2691
+ );
2678
2692
  },
2679
2693
  // 添加插件
2680
2694
  addProseMirrorPlugins() {
2681
- return [Jo(), Qo(), es()];
2695
+ return [Qo(), es(), ts()];
2682
2696
  }
2683
- }), Zt = It.create({
2697
+ }), Zt = Bt.create({
2684
2698
  name: be.TEMPLATE,
2685
2699
  addExtensions() {
2686
- return [Zo.configure(this.options), is];
2700
+ return [Jo.configure(this.options), ls.configure({ appendTo: this.options.appendTo })];
2687
2701
  },
2688
2702
  // 添加命令(统一命令入口)
2689
2703
  addCommands() {
2690
- return zo;
2704
+ return Fo;
2691
2705
  }
2692
2706
  });
2693
- function ls(e, t) {
2707
+ function as(e, t) {
2694
2708
  return Zt.configure({
2695
2709
  items: e,
2696
2710
  ...t
2697
2711
  });
2698
2712
  }
2699
2713
  function Jt(e, t = "") {
2700
- let n = (
2714
+ let o = (
2701
2715
  /** @type {Array<CategorizedUnicodeRange<T>>} */
2702
2716
  []
2703
- ), s = e.split(",").map((o) => o ? parseInt(o, 36) : 0), r = 0;
2704
- for (let o = 0; o < s.length; o++)
2705
- o % 2 ? n.push([
2717
+ ), s = e.split(",").map((n) => n ? parseInt(n, 36) : 0), r = 0;
2718
+ for (let n = 0; n < s.length; n++)
2719
+ n % 2 ? o.push([
2706
2720
  r,
2707
- r + s[o],
2721
+ r + s[n],
2708
2722
  /** @type {T} */
2709
- t ? parseInt(t[o >> 1], 36) : 0
2710
- ]) : r = s[o];
2711
- return n;
2712
- }
2713
- function Qt(e, t, n = 0, s = t.length - 1) {
2714
- for (; n <= s; ) {
2715
- let r = n + s >>> 1, o = t[r];
2716
- if (e < o[0]) s = r - 1;
2717
- else if (e > o[1]) n = r + 1;
2723
+ t ? parseInt(t[n >> 1], 36) : 0
2724
+ ]) : r = s[n];
2725
+ return o;
2726
+ }
2727
+ function Qt(e, t, o = 0, s = t.length - 1) {
2728
+ for (; o <= s; ) {
2729
+ let r = o + s >>> 1, n = t[r];
2730
+ if (e < n[0]) s = r - 1;
2731
+ else if (e > n[1]) o = r + 1;
2718
2732
  else return r;
2719
2733
  }
2720
2734
  return -1;
@@ -2723,26 +2737,26 @@ const rt = Jt(
2723
2737
  /** @type {UnicodeDataEncoding} */
2724
2738
  ",9,a,,b,1,d,,e,h,3j,w,4p,,4t,,4u,,lc,33,w3,6,13l,18,14v,,14x,1,150,1,153,,16o,5,174,a,17g,,18r,k,19s,,1cm,6,1ct,,1cv,5,1d3,1,1d6,3,1e7,,1e9,,1f4,q,1ie,a,1kb,8,1kt,,1li,3,1ln,8,1lx,2,1m1,4,1nd,2,1ow,1,1p3,8,1qi,n,1r6,,1r7,v,1s3,,1tm,,1tn,,1to,,1tq,2,1tt,7,1u1,3,1u5,,1u6,1,1u9,6,1uq,1,1vl,,1vm,1,1x8,,1xa,,1xb,1,1xd,3,1xj,1,1xn,1,1xp,,1xz,,1ya,1,1z2,,1z5,1,1z7,,20s,,20u,2,20x,1,213,1,217,2,21d,,228,1,22d,,22p,1,22r,,24c,,24e,2,24h,4,24n,1,24p,,24r,1,24t,,25e,1,262,5,269,,26a,1,27w,,27y,1,280,,281,3,287,1,28b,1,28d,,28l,2,28y,1,29u,,2bi,,2bj,,2bk,,2bl,1,2bq,2,2bu,2,2bx,,2c7,,2dc,,2dd,2,2dg,,2f0,,2f2,2,2f5,3,2fa,2,2fe,3,2fp,1,2g2,1,2gx,,2gy,1,2ik,,2im,,2in,1,2ip,,2iq,,2ir,1,2iu,2,2iy,3,2j9,1,2jm,1,2k3,,2kg,1,2ki,1,2m3,1,2m6,,2m7,1,2m9,3,2me,2,2mi,2,2ml,,2mm,,2mv,,2n6,1,2o1,,2o2,1,2q2,,2q7,,2q8,1,2qa,2,2qe,,2qg,6,2qn,,2r6,1,2sx,,2sz,,2t0,6,2tj,7,2wh,,2wj,,2wk,8,2x4,6,2zc,1,305,,307,,309,,30e,1,31t,d,327,,328,4,32e,1,32l,a,32x,z,346,,371,3,375,,376,5,37d,1,37f,1,37h,1,386,1,388,1,38e,2,38x,3,39e,,39g,,39h,1,39p,,3a5,,3cw,2n,3fk,1z,3hk,2f,3tp,2,4k2,3,4ky,2,4lu,1,4mq,1,4ok,1,4om,,4on,6,4ou,7,4p2,,4p3,1,4p5,a,4pp,,4qz,2,4r2,,4r3,,4ud,1,4vd,,4yo,2,4yr,3,4yv,1,4yx,2,4z4,1,4z6,,4z7,5,4zd,2,55j,1,55l,1,55n,,579,,57a,,57b,,57c,6,57k,,57m,,57p,7,57x,5,583,9,58f,,59s,u,5c0,3,5c4,,5dg,9,5dq,3,5du,2,5ez,8,5fk,1,5fm,,5gh,,5gi,3,5gm,1,5go,5,5ie,,5if,,5ig,1,5ii,2,5il,,5im,,5in,4,5k4,7,5kc,7,5kk,1,5km,1,5ow,2,5p0,c,5pd,,5pe,6,5pp,,5pw,,5pz,,5q0,1,5vk,1r,6bv,,6bw,,6bx,,6by,1,6co,6,6d8,,6dl,,6e8,f,6hc,w,6jm,,6k9,,6ms,5,6nd,1,6xm,1,6y0,,70o,,72n,,73d,a,73s,2,79e,,7fu,1,7g6,,7gg,,7i3,3,7i8,5,7if,b,7is,35,7m8,39,7pk,a,7pw,,7py,,7q5,,7q9,,7qg,,7qr,1,7r8,,7rb,,7rg,,7ri,,7rn,2,7rr,,7s3,4,7th,2,7tt,,7u8,,7un,,850,1,8hx,2,8ij,1,8k0,,8k5,,8vj,2,8zj,,928,v,wvj,3,wvo,9,wwu,1,wz4,1,x6q,,x6u,,x6z,,x7n,1,x7p,1,x7r,,x7w,,xa8,1,xbo,f,xc4,1,xcw,h,xdr,,xeu,7,xfr,a,xg2,,xg3,,xgg,s,xhc,2,xhf,,xir,,xis,1,xiu,3,xiy,1,xj0,1,xj2,1,xj4,,xk5,,xm1,5,xm7,1,xm9,1,xmb,1,xmd,1,xmr,,xn0,,xn1,,xoc,,xps,,xpu,2,xpz,1,xq6,1,xq9,,xrf,,xrg,1,xri,1,xrp,,xrq,,xyb,1,xyd,,xye,1,xyg,,xyh,1,xyk,,xyl,,1e68,f,1e74,f,1edb,,1ehq,1,1ek0,b,1eyl,,1f4w,,1f92,4,1gjl,2,1gjp,1,1gjw,3,1gl4,2,1glb,,1gpx,1,1h5w,3,1h7t,4,1hgr,1,1hj0,3,1hl2,a,1hmq,3,1hq8,,1hq9,,1hqa,,1hrs,e,1htc,,1htf,1,1htr,2,1htu,,1hv4,2,1hv7,3,1hvb,1,1hvd,1,1hvh,,1hvm,,1hvx,,1hxc,2,1hyf,4,1hyk,,1hyl,7,1hz9,1,1i0j,,1i0w,1,1i0y,,1i2b,2,1i2e,8,1i2n,,1i2o,,1i2q,1,1i2x,3,1i32,,1i33,,1i5o,2,1i5r,2,1i5u,1,1i5w,3,1i66,,1i69,,1ian,,1iao,2,1iar,7,1ibk,1,1ibm,1,1id7,1,1ida,,1idb,,1idc,,1idd,3,1idj,1,1idn,1,1idp,,1idz,,1iea,1,1iee,6,1ieo,4,1igo,,1igp,1,1igr,5,1igy,,1ih1,,1ih3,2,1ih6,,1ih8,1,1iha,2,1ihd,,1ihe,,1iht,1,1ik5,2,1ik8,7,1ikg,1,1iki,2,1ikl,,1ikm,,1ila,,1ink,,1inl,1,1inn,5,1int,,1inu,,1inv,1,1inx,,1iny,,1inz,1,1io1,,1io2,1,1iun,,1iuo,1,1iuq,3,1iuw,3,1iv0,1,1iv2,,1iv3,1,1ivw,1,1iy8,2,1iyb,7,1iyj,1,1iyl,,1iym,,1iyn,1,1j1n,,1j1o,,1j1p,,1j1q,1,1j1s,7,1j4t,,1j4u,,1j4v,,1j4y,3,1j52,,1j53,4,1jcc,2,1jcf,8,1jco,,1jcp,1,1jjk,,1jjl,4,1jjr,1,1jjv,3,1jjz,,1jk0,,1jk1,,1jk2,,1jk3,,1jo1,2,1jo4,3,1joa,1,1joc,3,1jog,,1jok,,1jpd,9,1jqr,5,1jqx,,1jqy,,1jqz,3,1jrb,,1jrl,5,1jrr,1,1jrt,2,1jt0,5,1jt6,c,1jtj,,1jtk,1,1k4v,,1k4w,6,1k54,5,1k5a,,1k5b,,1k7m,l,1k89,,1k8a,6,1k8h,,1k8i,1,1k8k,,1k8l,1,1kc1,5,1kca,,1kcc,1,1kcf,6,1kcm,,1kcn,,1kei,4,1keo,1,1ker,1,1ket,,1keu,,1kev,,1koj,1,1kol,1,1kow,1,1koy,,1koz,,1kqc,1,1kqe,4,1kqm,1,1kqo,2,1kre,,1ovk,f,1ow0,,1ow7,e,1xr2,b,1xre,2,1xrh,2,1zow,4,1zqo,6,206b,,206f,3,20jz,,20k1,1i,20lr,3,20o4,,20og,1,2ftp,1,2fts,3,2jgg,19,2jhs,m,2jxh,4,2jxp,5,2jxv,7,2jy3,7,2jyd,6,2jze,3,2k3m,2,2lmo,1i,2lob,1d,2lpx,,2lqc,,2lqz,4,2lr5,e,2mtc,6,2mtk,g,2mu3,6,2mub,1,2mue,4,2mxb,,2n1s,6,2nce,,2ne4,3,2nsc,3,2nzi,1,2ok0,6,2on8,6,2pz4,73,2q6l,2,2q7j,,2q98,5,2q9q,1,2qa6,,2qa9,9,2qb1,1k,2qcm,p,2qdd,e,2qe2,,2qen,,2qeq,8,2qf0,3,2qfd,c1,2qrf,4,2qrk,8t,2r0m,7d,2r9c,3j,2rg4,b,2rit,16,2rkc,3,2rm0,7,2rmi,5,2rns,7,2rou,29,2rrg,1a,2rss,9,2rt3,c8,2scg,sd,jny8,v,jnz4,2n,jo1s,3j,jo5c,6n,joc0,2rz",
2725
2739
  "262122424333333393233393339333333333393393b3b3b3b3b333b33b3bb33333b3b3333333b3b33bb3333b33b3bb33333b3bbb333b333b33333b3b3b3b3333b3b33b3bb39333b33b33b3b3b333b333333b3b333333b33b3b3333b3335dc333333b3b3b33323333b3bb3b33b3b3b3333b3333b3b333bb3b33b3b3b3b3b333b333b3323e2244234444444444444444444444444444444444444444443333333333b3b3bb33333b353b3b3b3b333b3b333b333333b3bb3b3b3bb333232333333333333333b3b3333bb3b393933b3b33bb3b393b3b3b3333b33b33b3bbb33b333b3333bb3933b3b3b333b3b3b3b3b33b3b3b33b3b3b33b3b33b33b3b3b33bb39b9b3b33b3b33b9333b393b3b33b33b3b3b3333393b3b3b33b39bb3b332333b333dd3b33332333323333333333333333333333344444444a44444434444444444444423232"
2726
- ), as = Jt(
2740
+ ), cs = Jt(
2727
2741
  /** @type {UnicodeDataEncoding} */
2728
2742
  "1sl,10,1ug,7,1vc,7,1w5,j,1wq,6,1wy,,1x2,3,1y4,1,1y7,,1yo,1,239,j,23u,6,242,1,245,4,261,,26t,j,27e,6,27m,1,27p,4,28s,1,28v,,29d,,2dx,j,2ei,f,2fs,2,2l1,11"
2729
2743
  ), _t = 65535;
2730
- function* cs(e) {
2744
+ function* us(e) {
2731
2745
  let t = e.codePointAt(0);
2732
2746
  if (t == null) return;
2733
- let n = t <= _t ? 1 : 2, s = e.length, r = Lt(t), o = 0, l = 0, i = !1, a = !1, c = !1, d = 0, u = r, g = t;
2734
- for (; n < s; ) {
2747
+ let o = t <= _t ? 1 : 2, s = e.length, r = Lt(t), n = 0, l = 0, i = !1, a = !1, c = !1, d = 0, u = r, g = t;
2748
+ for (; o < s; ) {
2735
2749
  t = /** @type {number} */
2736
- e.codePointAt(n), o = Lt(t);
2750
+ e.codePointAt(o), n = Lt(t);
2737
2751
  let h = !0;
2738
- r === 1 ? h = o !== 6 : r === 2 || r === 6 || o === 1 || o === 2 || o === 6 ? h = !0 : o === 3 || o === 14 || o === 11 || r === 9 ? h = !1 : r === 14 && o === 4 ? h = !i : r === 10 && o === 10 ? h = l++ % 2 === 1 : r === 5 ? h = !(o === 5 || o === 13 || o === 7 || o === 8) : ((r === 7 || r === 13) && (o === 13 || o === 12) || (r === 8 || r === 12) && o === 12 || o === 0 && a && c && kt(t)) && (h = !1), h ? (yield {
2739
- segment: e.slice(d, n),
2752
+ r === 1 ? h = n !== 6 : r === 2 || r === 6 || n === 1 || n === 2 || n === 6 ? h = !0 : n === 3 || n === 14 || n === 11 || r === 9 ? h = !1 : r === 14 && n === 4 ? h = !i : r === 10 && n === 10 ? h = l++ % 2 === 1 : r === 5 ? h = !(n === 5 || n === 13 || n === 7 || n === 8) : ((r === 7 || r === 13) && (n === 13 || n === 12) || (r === 8 || r === 12) && n === 12 || n === 0 && a && c && kt(t)) && (h = !1), h ? (yield {
2753
+ segment: e.slice(d, o),
2740
2754
  index: d,
2741
2755
  input: e,
2742
2756
  _hd: g,
2743
2757
  _catBegin: u,
2744
2758
  _catEnd: r
2745
- }, i = !1, l = 0, d = n, u = o, g = t) : o === 14 && (r === 3 || r === 4) ? i = !0 : t >= 2325 && (!a && r === 0 && (a = kt(g)), a && o === 3 ? c = c || t === 2381 || t === 2509 || t === 2637 || t === 2765 || t === 2893 || t === 3149 || t === 3405 : c = !1), n += t <= _t ? 1 : 2, r = o;
2759
+ }, i = !1, l = 0, d = o, u = n, g = t) : n === 14 && (r === 3 || r === 4) ? i = !0 : t >= 2325 && (!a && r === 0 && (a = kt(g)), a && n === 3 ? c = c || t === 2381 || t === 2509 || t === 2637 || t === 2765 || t === 2893 || t === 3149 || t === 3405 : c = !1), o += t <= _t ? 1 : 2, r = n;
2746
2760
  }
2747
2761
  d < s && (yield {
2748
2762
  segment: e.slice(d),
@@ -2753,20 +2767,20 @@ function* cs(e) {
2753
2767
  _catEnd: r
2754
2768
  });
2755
2769
  }
2756
- function us(e) {
2770
+ function ds(e) {
2757
2771
  let t = 0;
2758
- for (let n of cs(e)) t += 1;
2772
+ for (let o of us(e)) t += 1;
2759
2773
  return t;
2760
2774
  }
2761
- const en = new Uint8Array(6080), qe = 128, it = 12287, tn = new Uint8Array(1536), He = 40960, nn = 44031, ds = (() => {
2775
+ const en = new Uint8Array(6080), qe = 128, it = 12287, tn = new Uint8Array(1536), He = 40960, nn = 44031, fs = (() => {
2762
2776
  let e = 0;
2763
2777
  for (; ; ) {
2764
- let [t, n, s] = rt[e];
2778
+ let [t, o, s] = rt[e];
2765
2779
  if (t > nn) break;
2766
- if (e++, !(n < qe || t > it && n < He))
2767
- for (let r = t; r <= n; r++) {
2768
- let o, l = 0;
2769
- r <= it ? (o = en, l = r - qe >> 1) : (o = tn, l = r - He >> 1), o[l] = r & 1 ? o[l] & 15 | s << 4 : o[l] & 240 | s;
2780
+ if (e++, !(o < qe || t > it && o < He))
2781
+ for (let r = t; r <= o; r++) {
2782
+ let n, l = 0;
2783
+ r <= it ? (n = en, l = r - qe >> 1) : (n = tn, l = r - He >> 1), n[l] = r & 1 ? n[l] & 15 | s << 4 : n[l] & 240 | s;
2770
2784
  }
2771
2785
  }
2772
2786
  return e;
@@ -2775,19 +2789,19 @@ function Lt(e) {
2775
2789
  if (e < qe)
2776
2790
  return e >= 32 ? 0 : e === 10 ? 6 : e === 13 ? 1 : 2;
2777
2791
  if (e <= it) {
2778
- let n = en[e - qe >> 1];
2792
+ let o = en[e - qe >> 1];
2779
2793
  return (
2780
2794
  /** @type {GraphemeCategoryNum} */
2781
- e & 1 ? n >> 4 : n & 15
2795
+ e & 1 ? o >> 4 : o & 15
2782
2796
  );
2783
2797
  }
2784
2798
  if (e < He)
2785
2799
  return e < 12336 ? e >= 12330 ? 3 : 0 : e < 12443 ? e === 12336 || e === 12349 ? 4 : e >= 12441 ? 3 : 0 : e === 12951 || e === 12953 ? 4 : 0;
2786
2800
  if (e <= nn) {
2787
- let n = tn[e - He >> 1];
2801
+ let o = tn[e - He >> 1];
2788
2802
  return (
2789
2803
  /** @type {GraphemeCategoryNum} */
2790
- e & 1 ? n >> 4 : n & 15
2804
+ e & 1 ? o >> 4 : o & 15
2791
2805
  );
2792
2806
  }
2793
2807
  if (e <= 55203)
@@ -2796,42 +2810,42 @@ function Lt(e) {
2796
2810
  return e <= 55238 ? e >= 55216 ? 13 : 0 : e >= 55243 ? 12 : 0;
2797
2811
  if (e < 65024)
2798
2812
  return e === 64286 ? 3 : 0;
2799
- let t = Qt(e, rt, ds);
2813
+ let t = Qt(e, rt, fs);
2800
2814
  return t < 0 ? 0 : rt[t][2];
2801
2815
  }
2802
2816
  function kt(e) {
2803
- return Qt(e, as) >= 0;
2817
+ return Qt(e, cs) >= 0;
2804
2818
  }
2805
2819
  const Mt = typeof Intl < "u" && typeof Intl.Segmenter == "function" ? new Intl.Segmenter(void 0, { granularity: "grapheme" }) : null;
2806
2820
  function on(e) {
2807
2821
  if (!e) return 0;
2808
2822
  if (Mt) {
2809
2823
  let t = 0;
2810
- for (const n of Mt.segment(e))
2824
+ for (const o of Mt.segment(e))
2811
2825
  t++;
2812
2826
  return t;
2813
2827
  }
2814
- return us(e);
2828
+ return ds(e);
2815
2829
  }
2816
- function fs(e, t) {
2817
- const n = F(null), s = De(e, "placeholder"), r = () => {
2830
+ function ps(e, t) {
2831
+ const o = F(null), s = De(e, "placeholder"), r = () => {
2818
2832
  var i;
2819
2833
  const l = [
2820
- En,
2821
2834
  wn,
2822
2835
  Cn,
2823
2836
  An,
2837
+ Sn,
2824
2838
  // 提供 undo/redo 功能
2825
- Sn.configure({
2839
+ _n.configure({
2826
2840
  placeholder: () => s.value || "请输入内容..."
2827
2841
  }),
2828
- _n.configure({
2842
+ Ln.configure({
2829
2843
  mode: "textSize",
2830
2844
  textCounter: on
2831
2845
  })
2832
2846
  ];
2833
2847
  return (i = e.extensions) != null && i.length && l.push(...e.extensions), l;
2834
- }, o = vn({
2848
+ }, n = Tn({
2835
2849
  content: e.modelValue ?? e.defaultValue ?? "",
2836
2850
  extensions: r(),
2837
2851
  autofocus: e.autofocus ? "end" : !1,
@@ -2846,9 +2860,9 @@ function fs(e, t) {
2846
2860
  const a = (g = i.clipboardData) == null ? void 0 : g.getData("text/plain");
2847
2861
  if (!a) return !1;
2848
2862
  const c = e.mode === "single" ? a.replace(/\r?\n/g, " ") : a, { state: d } = l, { tr: u } = d;
2849
- return u.insertText(c), l.dispatch(u), me(() => {
2863
+ return u.insertText(c), l.dispatch(u), ge(() => {
2850
2864
  var h;
2851
- (h = o.value) == null || h.commands.scrollIntoView();
2865
+ (h = n.value) == null || h.commands.scrollIntoView();
2852
2866
  }), !0;
2853
2867
  }
2854
2868
  },
@@ -2866,37 +2880,37 @@ function fs(e, t) {
2866
2880
  return K(
2867
2881
  () => e.modelValue,
2868
2882
  (l) => {
2869
- o.value && l !== o.value.getText() && o.value.commands.setContent(l ?? "", { emitUpdate: !1 });
2883
+ n.value && l !== n.value.getText() && n.value.commands.setContent(l ?? "", { emitUpdate: !1 });
2870
2884
  }
2871
2885
  ), K(
2872
2886
  () => e.placeholder,
2873
2887
  () => {
2874
- if (o.value) {
2875
- const { state: l } = o.value, i = l.tr;
2876
- o.value.view.dispatch(i);
2888
+ if (n.value) {
2889
+ const { state: l } = n.value, i = l.tr;
2890
+ n.value.view.dispatch(i);
2877
2891
  }
2878
2892
  }
2879
2893
  ), K(
2880
2894
  () => e.enterkeyhint,
2881
2895
  (l) => {
2882
- if (o.value) {
2883
- const i = o.value.view.dom;
2896
+ if (n.value) {
2897
+ const i = n.value.view.dom;
2884
2898
  l ? i.setAttribute("enterkeyhint", l) : i.removeAttribute("enterkeyhint");
2885
2899
  }
2886
2900
  }
2887
- ), mn(() => {
2901
+ ), hn(() => {
2888
2902
  var l;
2889
- (l = o.value) == null || l.destroy();
2903
+ (l = n.value) == null || l.destroy();
2890
2904
  }), {
2891
- editor: o,
2892
- editorRef: n
2905
+ editor: n,
2906
+ editorRef: o
2893
2907
  };
2894
2908
  }
2895
- function ps(e) {
2909
+ function ms(e) {
2896
2910
  const { submitType: t } = e;
2897
2911
  return {
2898
2912
  checkSubmitShortcut: (r) => {
2899
- if (!I(r, "ENTER")) return !1;
2913
+ if (!B(r, "ENTER")) return !1;
2900
2914
  switch (t.value) {
2901
2915
  case "enter":
2902
2916
  return !r.shiftKey && !r.ctrlKey && !r.metaKey;
@@ -2909,7 +2923,7 @@ function ps(e) {
2909
2923
  }
2910
2924
  },
2911
2925
  checkNewlineShortcut: (r) => {
2912
- if (!I(r, "ENTER")) return !1;
2926
+ if (!B(r, "ENTER")) return !1;
2913
2927
  switch (t.value) {
2914
2928
  case "enter":
2915
2929
  return r.shiftKey || r.ctrlKey || r.metaKey;
@@ -2922,8 +2936,8 @@ function ps(e) {
2922
2936
  }
2923
2937
  };
2924
2938
  }
2925
- function ms(e, t, n) {
2926
- const s = F(e.mode || "single"), r = F(!1), o = F(e.mode || "single"), { start: l, stop: i } = Ln(
2939
+ function hs(e, t, o) {
2940
+ const s = F(e.mode || "single"), r = F(!1), n = F(e.mode || "single"), { start: l, stop: i } = kn(
2927
2941
  () => {
2928
2942
  r.value = !1;
2929
2943
  },
@@ -2931,26 +2945,26 @@ function ms(e, t, n) {
2931
2945
  { immediate: !1 }
2932
2946
  ), a = R(() => {
2933
2947
  var u;
2934
- return (u = n.value) == null ? void 0 : u.closest(".tr-sender-main");
2948
+ return (u = o.value) == null ? void 0 : u.closest(".tr-sender-main");
2935
2949
  }), c = () => {
2936
- if (o.value !== "single" || r.value || !t.value || !n.value) return;
2937
- const u = n.value.querySelector(".ProseMirror");
2950
+ if (n.value !== "single" || r.value || !t.value || !o.value) return;
2951
+ const u = o.value.querySelector(".ProseMirror");
2938
2952
  if (!u) return;
2939
2953
  const g = t.value.getText();
2940
2954
  s.value === "single" ? u.scrollWidth > u.clientWidth && d("multiple") : g.length || d("single");
2941
2955
  }, d = (u) => {
2942
- s.value !== u && (r.value = !0, s.value = u, me(() => {
2956
+ s.value !== u && (r.value = !0, s.value = u, ge(() => {
2943
2957
  t.value && t.value.commands.focus("end"), i(), l();
2944
2958
  }));
2945
2959
  };
2946
- return kn(a, () => {
2960
+ return Mn(a, () => {
2947
2961
  requestAnimationFrame(() => {
2948
2962
  c();
2949
2963
  });
2950
2964
  }), K(
2951
2965
  () => e.mode,
2952
2966
  (u) => {
2953
- u && u !== s.value && (o.value = u, d(u));
2967
+ u && u !== s.value && (n.value = u, d(u));
2954
2968
  }
2955
2969
  ), {
2956
2970
  currentMode: s,
@@ -2959,20 +2973,20 @@ function ms(e, t, n) {
2959
2973
  checkOverflow: c
2960
2974
  };
2961
2975
  }
2962
- function hs(e, t, n) {
2963
- const s = Mn("--tr-sender-line-height", t), r = R(() => {
2976
+ function gs(e, t, o) {
2977
+ const s = Rn("--tr-sender-line-height", t), r = R(() => {
2964
2978
  const i = s.value;
2965
2979
  if (i) {
2966
2980
  const a = parseFloat(i);
2967
2981
  return isNaN(a) ? 26 : a;
2968
2982
  }
2969
2983
  return 26;
2970
- }), o = R(() => n === !1 || n === void 0 ? null : n === !0 ? {
2984
+ }), n = R(() => o === !1 || o === void 0 ? null : o === !0 ? {
2971
2985
  minRows: 1,
2972
2986
  maxRows: 5
2973
- } : typeof n == "object" ? {
2974
- minRows: n.minRows,
2975
- maxRows: n.maxRows
2987
+ } : typeof o == "object" ? {
2988
+ minRows: o.minRows,
2989
+ maxRows: o.maxRows
2976
2990
  } : null), l = () => {
2977
2991
  if (!t.value) return;
2978
2992
  const i = t.value.querySelector(".tr-sender-editor-scroll");
@@ -2980,7 +2994,7 @@ function hs(e, t, n) {
2980
2994
  console.warn("⚠️ 找不到滚动容器 .tr-sender-editor-scroll");
2981
2995
  return;
2982
2996
  }
2983
- const a = o.value;
2997
+ const a = n.value;
2984
2998
  if (e.value === "multiple" && a) {
2985
2999
  const c = r.value * a.minRows, d = r.value * a.maxRows;
2986
3000
  i.style.minHeight = `${c}px`, i.style.maxHeight = `${d}px`, i.style.overflowY = "auto";
@@ -2990,15 +3004,15 @@ function hs(e, t, n) {
2990
3004
  return K(
2991
3005
  e,
2992
3006
  () => {
2993
- me(() => {
3007
+ ge(() => {
2994
3008
  l();
2995
3009
  });
2996
3010
  },
2997
3011
  { immediate: !0 }
2998
3012
  ), K(
2999
- o,
3013
+ n,
3000
3014
  () => {
3001
- me(() => {
3015
+ ge(() => {
3002
3016
  l();
3003
3017
  });
3004
3018
  },
@@ -3007,110 +3021,110 @@ function hs(e, t, n) {
3007
3021
  updateHeight: l
3008
3022
  };
3009
3023
  }
3010
- const gs = (e) => e == null ? !1 : typeof e == "string" ? e.trim().length > 0 : typeof e == "number" ? Number.isFinite(e) : Array.isArray(e) ? e.length > 0 : typeof e == "object" ? Object.keys(e).length > 0 : !!e, xs = (e, t) => {
3011
- const n = gn(t);
3012
- if (gs(n))
3024
+ const xs = (e) => e == null ? !1 : typeof e == "string" ? e.trim().length > 0 : typeof e == "number" ? Number.isFinite(e) : Array.isArray(e) ? e.length > 0 : typeof e == "object" ? Object.keys(e).length > 0 : !!e, ys = (e, t) => {
3025
+ const o = xn(t);
3026
+ if (xs(o))
3013
3027
  return {
3014
3028
  source: e,
3015
- payload: n
3029
+ payload: o
3016
3030
  };
3017
3031
  };
3018
- function ys() {
3019
- const e = hn(/* @__PURE__ */ new Map()), t = R(() => {
3032
+ function bs() {
3033
+ const e = gn(/* @__PURE__ */ new Map()), t = R(() => {
3020
3034
  const r = [];
3021
- for (const o of e.values()) {
3022
- const l = xs(o.source, o.payload);
3035
+ for (const n of e.values()) {
3036
+ const l = ys(n.source, n.payload);
3023
3037
  l && r.push(l);
3024
3038
  }
3025
3039
  return r;
3026
3040
  });
3027
3041
  return {
3028
3042
  hasRegisteredContent: R(() => t.value.length > 0),
3029
- registerContent: (r, o) => {
3043
+ registerContent: (r, n) => {
3030
3044
  const l = Symbol("sender-content");
3031
- return e.set(l, { source: r, payload: o }), () => {
3045
+ return e.set(l, { source: r, payload: n }), () => {
3032
3046
  e.delete(l);
3033
3047
  };
3034
3048
  },
3035
3049
  externalPayloads: t
3036
3050
  };
3037
3051
  }
3038
- function bs(e, t) {
3039
- const { editor: n, editorRef: s } = fs(e, t), r = R(() => n.value ? tt(n.value).trim().length > 0 : !1), { hasRegisteredContent: o, registerContent: l, externalPayloads: i } = ys(), a = R(() => r.value || o.value || !!e.hasExternalContent), c = R(() => n.value ? on(tt(n.value)) : 0), d = R(() => e.maxLength ? c.value > e.maxLength : !1), u = R(() => {
3040
- var b, L;
3041
- return !e.disabled && !e.loading && a.value && !d.value && !((L = (b = e.defaultActions) == null ? void 0 : b.submit) != null && L.disabled);
3052
+ function vs(e, t) {
3053
+ const { editor: o, editorRef: s } = ps(e, t), r = R(() => o.value ? tt(o.value).trim().length > 0 : !1), { hasRegisteredContent: n, registerContent: l, externalPayloads: i } = bs(), a = R(() => r.value || n.value || !!e.hasExternalContent), c = R(() => o.value ? on(tt(o.value)) : 0), d = R(() => e.maxLength ? c.value > e.maxLength : !1), u = R(() => {
3054
+ var y, L;
3055
+ return !e.disabled && !e.loading && a.value && !d.value && !((L = (y = e.defaultActions) == null ? void 0 : y.submit) != null && L.disabled);
3042
3056
  }), g = () => {
3043
- if (!u.value || !n.value) return;
3044
- let b, L = "";
3045
- if (n.value.extensionManager.extensions.some((N) => N.name === be.TEMPLATE)) {
3046
- const N = Yt(n.value);
3047
- N.length > 0 && (b = N), L = tt(n.value);
3048
- } else if (n.value.extensionManager.extensions.some((N) => N.name === be.MENTION)) {
3049
- const N = Po(n.value);
3050
- N.length > 0 && (b = N), L = Ro(n.value);
3057
+ if (!u.value || !o.value) return;
3058
+ let y, L = "";
3059
+ if (o.value.extensionManager.extensions.some((N) => N.name === be.TEMPLATE)) {
3060
+ const N = Yt(o.value);
3061
+ N.length > 0 && (y = N), L = tt(o.value);
3062
+ } else if (o.value.extensionManager.extensions.some((N) => N.name === be.MENTION)) {
3063
+ const N = Oo(o.value);
3064
+ N.length > 0 && (y = N), L = Po(o.value);
3051
3065
  }
3052
- L || (L = n.value.getText());
3053
- const $ = i.value.slice();
3054
- if ($.length === 0) {
3055
- t("submit", L, b);
3066
+ L || (L = o.value.getText());
3067
+ const I = i.value.slice();
3068
+ if (I.length === 0) {
3069
+ t("submit", L, y);
3056
3070
  return;
3057
3071
  }
3058
- t("submit", L, b, {
3059
- externalPayloads: $
3072
+ t("submit", L, y, {
3073
+ externalPayloads: I
3060
3074
  });
3061
- }, { currentMode: h, isAutoSwitching: E, setMode: w, checkOverflow: T } = ms(e, n, s), m = ps({
3075
+ }, { currentMode: h, isAutoSwitching: C, setMode: w, checkOverflow: b } = hs(e, o, s), m = ms({
3062
3076
  submitType: R(() => e.submitType ?? "enter")
3063
3077
  });
3064
3078
  K(
3065
- n,
3066
- (b) => {
3067
- b && b.setOptions({
3079
+ o,
3080
+ (y) => {
3081
+ y && y.setOptions({
3068
3082
  editorProps: {
3069
- ...b.options.editorProps,
3070
- handleKeyDown: (L, $) => {
3071
- const N = de.getState(L.state), Se = z.getState(L.state), V = Ce.getState(L.state);
3072
- return N && N.active || Se && Se.active || V && V.isOpen ? !1 : m.checkSubmitShortcut($) ? ($.preventDefault(), g(), !0) : m.checkNewlineShortcut($) ? ($.preventDefault(), h.value === "single" ? (w("multiple"), setTimeout(() => {
3073
- b.commands.splitBlock(), b.commands.focus();
3074
- }, 0)) : b.commands.splitBlock(), !0) : !1;
3083
+ ...y.options.editorProps,
3084
+ handleKeyDown: (L, I) => {
3085
+ const N = pe.getState(L.state), Se = z.getState(L.state), G = Ce.getState(L.state);
3086
+ return N && N.active || Se && Se.active || G && G.isOpen ? !1 : m.checkSubmitShortcut(I) ? (I.preventDefault(), g(), !0) : m.checkNewlineShortcut(I) ? (I.preventDefault(), h.value === "single" ? (w("multiple"), setTimeout(() => {
3087
+ y.commands.splitBlock(), y.commands.focus();
3088
+ }, 0)) : y.commands.splitBlock(), !0) : !1;
3075
3089
  }
3076
3090
  }
3077
3091
  });
3078
3092
  },
3079
3093
  { immediate: !0 }
3080
- ), hs(h, s, e.autoSize), K(
3094
+ ), gs(h, s, e.autoSize), K(
3081
3095
  () => {
3082
- var b;
3083
- return (b = n.value) == null ? void 0 : b.state.doc.content;
3096
+ var y;
3097
+ return (y = o.value) == null ? void 0 : y.state.doc.content;
3084
3098
  },
3085
3099
  () => {
3086
3100
  setTimeout(() => {
3087
- T();
3101
+ b();
3088
3102
  }, 0);
3089
3103
  },
3090
3104
  { deep: !0 }
3091
3105
  );
3092
- const y = () => {
3093
- var b;
3094
- (b = n.value) == null || b.commands.focus();
3106
+ const x = () => {
3107
+ var y;
3108
+ (y = o.value) == null || y.commands.focus();
3095
3109
  }, p = () => {
3096
- var b, L;
3097
- (b = n.value) == null || b.commands.clearContent(), (L = n.value) == null || L.commands.focus(), t("clear");
3110
+ var y, L;
3111
+ (y = o.value) == null || y.commands.clearContent(), (L = o.value) == null || L.commands.focus(), t("clear");
3098
3112
  }, f = () => {
3099
3113
  t("cancel");
3100
- }, x = () => {
3101
- var b;
3102
- (b = n.value) == null || b.commands.blur();
3103
- }, v = (b) => {
3114
+ }, v = () => {
3115
+ var y;
3116
+ (y = o.value) == null || y.commands.blur();
3117
+ }, E = (y) => {
3104
3118
  var L;
3105
- (L = n.value) == null || L.commands.setContent(b);
3106
- }, S = () => {
3107
- var b;
3108
- return ((b = n.value) == null ? void 0 : b.getText()) || "";
3109
- }, _ = {
3110
- editor: n,
3119
+ (L = o.value) == null || L.commands.setContent(y);
3120
+ }, T = () => {
3121
+ var y;
3122
+ return ((y = o.value) == null ? void 0 : y.getText()) || "";
3123
+ }, A = {
3124
+ editor: o,
3111
3125
  editorRef: s,
3112
3126
  mode: h,
3113
- isAutoSwitching: E,
3127
+ isAutoSwitching: C,
3114
3128
  loading: R(() => e.loading ?? !1),
3115
3129
  disabled: R(() => e.disabled ?? !1),
3116
3130
  hasContent: a,
@@ -3128,22 +3142,22 @@ function bs(e, t) {
3128
3142
  submit: g,
3129
3143
  clear: p,
3130
3144
  cancel: f,
3131
- focus: y,
3132
- blur: x,
3133
- setContent: v,
3134
- getContent: S
3145
+ focus: x,
3146
+ blur: v,
3147
+ setContent: E,
3148
+ getContent: T
3135
3149
  };
3136
- return xn(yn, _), On(l), {
3137
- context: _,
3150
+ return yn(bn, A), Dn(l), {
3151
+ context: A,
3138
3152
  expose: {
3139
3153
  submit: g,
3140
3154
  clear: p,
3141
3155
  cancel: f,
3142
- focus: y,
3143
- blur: x,
3144
- setContent: v,
3145
- getContent: S,
3146
- editor: n
3156
+ focus: x,
3157
+ blur: v,
3158
+ setContent: E,
3159
+ getContent: T,
3160
+ editor: o
3147
3161
  }
3148
3162
  };
3149
3163
  }
@@ -3157,14 +3171,14 @@ function bt() {
3157
3171
  blur: e.blur,
3158
3172
  // 内容操作(为增强按钮设计)
3159
3173
  insert: (t) => {
3160
- var n;
3161
- (n = e.editor.value) == null || n.commands.insertContent(t + " "), e.focus();
3174
+ var o;
3175
+ (o = e.editor.value) == null || o.commands.insertContent(t + " "), e.focus();
3162
3176
  },
3163
3177
  append: (t) => {
3164
- const n = e.editor.value;
3165
- if (n) {
3166
- const s = n.state.doc.content.size;
3167
- n.chain().focus().insertContentAt(s, t).run();
3178
+ const o = e.editor.value;
3179
+ if (o) {
3180
+ const s = o.state.doc.content.size;
3181
+ o.chain().focus().insertContentAt(s, t).run();
3168
3182
  }
3169
3183
  },
3170
3184
  replace: (t) => {
@@ -3176,17 +3190,17 @@ function bt() {
3176
3190
  hasContent: e.hasContent.value
3177
3191
  }));
3178
3192
  }
3179
- const vs = { class: "tr-sender-editor-scroll" }, Ts = /* @__PURE__ */ Z({
3193
+ const Ts = { class: "tr-sender-editor-scroll" }, Es = /* @__PURE__ */ V({
3180
3194
  __name: "index",
3181
3195
  setup(e) {
3182
- const { editor: t, editorRef: n } = Pe();
3196
+ const { editor: t, editorRef: o } = Pe();
3183
3197
  return (s, r) => (M(), P("div", {
3184
3198
  ref_key: "editorRef",
3185
- ref: n,
3199
+ ref: o,
3186
3200
  class: "tr-sender-editor-wrapper"
3187
3201
  }, [
3188
- B("div", vs, [
3189
- k(t) ? (M(), U(k(Tn), {
3202
+ $("div", Ts, [
3203
+ k(t) ? (M(), J(k(En), {
3190
3204
  key: 0,
3191
3205
  editor: k(t),
3192
3206
  class: "tr-sender-editor-content"
@@ -3194,40 +3208,40 @@ const vs = { class: "tr-sender-editor-scroll" }, Ts = /* @__PURE__ */ Z({
3194
3208
  ])
3195
3209
  ], 512));
3196
3210
  }
3197
- }), sn = /* @__PURE__ */ J(Ts, [["__scopeId", "data-v-7f5b51aa"]]), Es = { class: "tr-sender-single-layout" }, ws = {
3211
+ }), sn = /* @__PURE__ */ te(Es, [["__scopeId", "data-v-7f5b51aa"]]), ws = { class: "tr-sender-single-layout" }, Cs = {
3198
3212
  key: 0,
3199
3213
  class: "tr-sender-header"
3200
- }, Cs = { class: "tr-sender-container" }, As = { class: "tr-sender-main" }, Ss = {
3214
+ }, As = { class: "tr-sender-container" }, Ss = { class: "tr-sender-main" }, _s = {
3201
3215
  key: 0,
3202
3216
  class: "tr-sender-prefix"
3203
- }, _s = { class: "tr-sender-content" }, Ls = /* @__PURE__ */ Z({
3217
+ }, Ls = { class: "tr-sender-content" }, ks = /* @__PURE__ */ V({
3204
3218
  __name: "SingleLineLayout",
3205
3219
  setup(e) {
3206
- const { editor: t, hasContent: n, loading: s, showWordLimit: r, maxLength: o } = Pe(), l = bt();
3207
- return (i, a) => (M(), P("div", Es, [
3208
- i.$slots.header ? (M(), P("div", ws, [
3220
+ const { editor: t, hasContent: o, loading: s, showWordLimit: r, maxLength: n } = Pe(), l = bt();
3221
+ return (i, a) => (M(), P("div", ws, [
3222
+ i.$slots.header ? (M(), P("div", Cs, [
3209
3223
  D(i.$slots, "header", {}, void 0, !0)
3210
3224
  ])) : q("", !0),
3211
- B("div", Cs, [
3212
- B("div", As, [
3213
- i.$slots.prefix ? (M(), P("div", Ss, [
3225
+ $("div", As, [
3226
+ $("div", Ss, [
3227
+ i.$slots.prefix ? (M(), P("div", _s, [
3214
3228
  D(i.$slots, "prefix", {}, void 0, !0)
3215
3229
  ])) : q("", !0),
3216
- B("div", _s, [
3230
+ $("div", Ls, [
3217
3231
  D(i.$slots, "content", { editor: k(t) }, () => [
3218
- se(sn)
3232
+ ie(sn)
3219
3233
  ], !0)
3220
3234
  ])
3221
3235
  ]),
3222
- B("div", {
3223
- class: Q(["tr-sender-actions-inline", { "has-content": k(n) || k(s) }])
3236
+ $("div", {
3237
+ class: Y(["tr-sender-actions-inline", { "has-content": k(o) || k(s) }])
3224
3238
  }, [
3225
- k(r) && k(o) ? (M(), U(k(Rt), { key: 0 })) : q("", !0),
3226
- se(k(Pt), null, $e({ _: 2 }, [
3239
+ k(r) && k(n) ? (M(), J(k(Rt), { key: 0 })) : q("", !0),
3240
+ ie(k(Pt), null, $e({ _: 2 }, [
3227
3241
  i.$slots["actions-inline"] ? {
3228
3242
  name: "prepend",
3229
3243
  fn: j(() => [
3230
- D(i.$slots, "actions-inline", he(ge(k(l))), void 0, !0)
3244
+ D(i.$slots, "actions-inline", U(X(k(l))), void 0, !0)
3231
3245
  ]),
3232
3246
  key: "0"
3233
3247
  } : void 0
@@ -3236,24 +3250,24 @@ const vs = { class: "tr-sender-editor-scroll" }, Ts = /* @__PURE__ */ Z({
3236
3250
  ])
3237
3251
  ]));
3238
3252
  }
3239
- }), ks = /* @__PURE__ */ J(Ls, [["__scopeId", "data-v-7b0a576c"]]), Ms = {
3253
+ }), Ms = /* @__PURE__ */ te(ks, [["__scopeId", "data-v-7b0a576c"]]), Rs = {
3240
3254
  key: 0,
3241
3255
  class: "tr-sender-footer"
3242
- }, Rs = { class: "tr-sender-footer-left" }, Ps = { class: "tr-sender-footer-right" }, Os = /* @__PURE__ */ Z({
3256
+ }, Ps = { class: "tr-sender-footer-left" }, Os = { class: "tr-sender-footer-right" }, Ds = /* @__PURE__ */ V({
3243
3257
  __name: "index",
3244
3258
  setup(e) {
3245
- const { mode: t, showWordLimit: n, maxLength: s } = Pe(), r = bt();
3246
- return (o, l) => k(t) === "multiple" ? (M(), P("div", Ms, [
3247
- B("div", Rs, [
3248
- D(o.$slots, "footer", he(ge(k(r))), void 0, !0)
3259
+ const { mode: t, showWordLimit: o, maxLength: s } = Pe(), r = bt();
3260
+ return (n, l) => k(t) === "multiple" ? (M(), P("div", Rs, [
3261
+ $("div", Ps, [
3262
+ D(n.$slots, "footer", U(X(k(r))), void 0, !0)
3249
3263
  ]),
3250
- B("div", Ps, [
3251
- k(n) && k(s) ? (M(), U(k(Rt), { key: 0 })) : q("", !0),
3252
- se(k(Pt), null, $e({ _: 2 }, [
3253
- o.$slots["footer-right"] ? {
3264
+ $("div", Os, [
3265
+ k(o) && k(s) ? (M(), J(k(Rt), { key: 0 })) : q("", !0),
3266
+ ie(k(Pt), null, $e({ _: 2 }, [
3267
+ n.$slots["footer-right"] ? {
3254
3268
  name: "prepend",
3255
3269
  fn: j(() => [
3256
- D(o.$slots, "footer-right", he(ge(k(r))), void 0, !0)
3270
+ D(n.$slots, "footer-right", U(X(k(r))), void 0, !0)
3257
3271
  ]),
3258
3272
  key: "0"
3259
3273
  } : void 0
@@ -3261,44 +3275,44 @@ const vs = { class: "tr-sender-editor-scroll" }, Ts = /* @__PURE__ */ Z({
3261
3275
  ])
3262
3276
  ])) : q("", !0);
3263
3277
  }
3264
- }), Ds = /* @__PURE__ */ J(Os, [["__scopeId", "data-v-ffcdce27"]]), Is = { class: "tr-sender-multi-layout" }, Bs = {
3278
+ }), Bs = /* @__PURE__ */ te(Ds, [["__scopeId", "data-v-ffcdce27"]]), Is = { class: "tr-sender-multi-layout" }, $s = {
3265
3279
  key: 0,
3266
3280
  class: "tr-sender-header"
3267
- }, $s = { class: "tr-sender-main" }, js = {
3281
+ }, js = { class: "tr-sender-main" }, Ns = {
3268
3282
  key: 0,
3269
3283
  class: "tr-sender-prefix"
3270
- }, Ns = { class: "tr-sender-content" }, Ws = /* @__PURE__ */ Z({
3284
+ }, Ws = { class: "tr-sender-content" }, Ks = /* @__PURE__ */ V({
3271
3285
  __name: "MultiLineLayout",
3272
3286
  setup(e) {
3273
- const t = Pe(), n = bt();
3287
+ const t = Pe(), o = bt();
3274
3288
  return (s, r) => (M(), P("div", Is, [
3275
- s.$slots.header ? (M(), P("div", Bs, [
3289
+ s.$slots.header ? (M(), P("div", $s, [
3276
3290
  D(s.$slots, "header", {}, void 0, !0)
3277
3291
  ])) : q("", !0),
3278
- B("div", $s, [
3279
- s.$slots.prefix ? (M(), P("div", js, [
3292
+ $("div", js, [
3293
+ s.$slots.prefix ? (M(), P("div", Ns, [
3280
3294
  D(s.$slots, "prefix", {}, void 0, !0)
3281
3295
  ])) : q("", !0),
3282
- B("div", Ns, [
3296
+ $("div", Ws, [
3283
3297
  D(s.$slots, "content", {
3284
3298
  editor: k(t).editor
3285
3299
  }, () => [
3286
- se(sn)
3300
+ ie(sn)
3287
3301
  ], !0)
3288
3302
  ])
3289
3303
  ]),
3290
- se(Ds, null, {
3304
+ ie(Bs, null, {
3291
3305
  footer: j(() => [
3292
- D(s.$slots, "footer", he(ge(k(n))), void 0, !0)
3306
+ D(s.$slots, "footer", U(X(k(o))), void 0, !0)
3293
3307
  ]),
3294
3308
  "footer-right": j(() => [
3295
- D(s.$slots, "footer-right", he(ge(k(n))), void 0, !0)
3309
+ D(s.$slots, "footer-right", U(X(k(o))), void 0, !0)
3296
3310
  ]),
3297
3311
  _: 3
3298
3312
  })
3299
3313
  ]));
3300
3314
  }
3301
- }), Ks = /* @__PURE__ */ J(Ws, [["__scopeId", "data-v-0b507198"]]), qs = /* @__PURE__ */ Z({
3315
+ }), qs = /* @__PURE__ */ te(Ks, [["__scopeId", "data-v-0b507198"]]), Hs = /* @__PURE__ */ V({
3302
3316
  __name: "index",
3303
3317
  props: {
3304
3318
  modelValue: {},
@@ -3321,20 +3335,20 @@ const vs = { class: "tr-sender-editor-scroll" }, Ts = /* @__PURE__ */ Z({
3321
3335
  submitType: { default: "enter" }
3322
3336
  },
3323
3337
  emits: ["update:modelValue", "submit", "focus", "blur", "clear", "cancel", "input"],
3324
- setup(e, { expose: t, emit: n }) {
3325
- const s = e, r = n, { context: o, expose: l } = bs(s, r);
3338
+ setup(e, { expose: t, emit: o }) {
3339
+ const s = e, r = o, { context: n, expose: l } = vs(s, r);
3326
3340
  return t(l), (i, a) => (M(), P("div", {
3327
- class: Q([
3341
+ class: Y([
3328
3342
  "tr-sender",
3329
- `tr-sender--${k(o).mode.value}`,
3330
- `tr-sender--${k(o).size.value}`,
3343
+ `tr-sender--${k(n).mode.value}`,
3344
+ `tr-sender--${k(n).size.value}`,
3331
3345
  {
3332
- "is-auto-switching": k(o).isAutoSwitching.value,
3333
- "is-disabled": k(o).disabled.value
3346
+ "is-auto-switching": k(n).isAutoSwitching.value,
3347
+ "is-disabled": k(n).disabled.value
3334
3348
  }
3335
3349
  ])
3336
3350
  }, [
3337
- k(o).mode.value === "single" ? (M(), U(ks, { key: 0 }, $e({ _: 2 }, [
3351
+ k(n).mode.value === "single" ? (M(), J(Ms, { key: 0 }, $e({ _: 2 }, [
3338
3352
  i.$slots.header ? {
3339
3353
  name: "header",
3340
3354
  fn: j(() => [
@@ -3352,18 +3366,18 @@ const vs = { class: "tr-sender-editor-scroll" }, Ts = /* @__PURE__ */ Z({
3352
3366
  i.$slots.content ? {
3353
3367
  name: "content",
3354
3368
  fn: j((c) => [
3355
- D(i.$slots, "content", he(ge(c)), void 0, !0)
3369
+ D(i.$slots, "content", U(X(c)), void 0, !0)
3356
3370
  ]),
3357
3371
  key: "2"
3358
3372
  } : void 0,
3359
3373
  i.$slots["actions-inline"] ? {
3360
3374
  name: "actions-inline",
3361
- fn: j(() => [
3362
- D(i.$slots, "actions-inline", {}, void 0, !0)
3375
+ fn: j((c) => [
3376
+ D(i.$slots, "actions-inline", U(X(c)), void 0, !0)
3363
3377
  ]),
3364
3378
  key: "3"
3365
3379
  } : void 0
3366
- ]), 1024)) : (M(), U(Ks, { key: 1 }, $e({ _: 2 }, [
3380
+ ]), 1024)) : (M(), J(qs, { key: 1 }, $e({ _: 2 }, [
3367
3381
  i.$slots.header ? {
3368
3382
  name: "header",
3369
3383
  fn: j(() => [
@@ -3381,43 +3395,43 @@ const vs = { class: "tr-sender-editor-scroll" }, Ts = /* @__PURE__ */ Z({
3381
3395
  i.$slots.content ? {
3382
3396
  name: "content",
3383
3397
  fn: j((c) => [
3384
- D(i.$slots, "content", he(ge(c)), void 0, !0)
3398
+ D(i.$slots, "content", U(X(c)), void 0, !0)
3385
3399
  ]),
3386
3400
  key: "2"
3387
3401
  } : void 0,
3388
3402
  i.$slots.footer ? {
3389
3403
  name: "footer",
3390
- fn: j(() => [
3391
- D(i.$slots, "footer", {}, void 0, !0)
3404
+ fn: j((c) => [
3405
+ D(i.$slots, "footer", U(X(c)), void 0, !0)
3392
3406
  ]),
3393
3407
  key: "3"
3394
3408
  } : void 0,
3395
3409
  i.$slots["footer-right"] ? {
3396
3410
  name: "footer-right",
3397
- fn: j(() => [
3398
- D(i.$slots, "footer-right", {}, void 0, !0)
3411
+ fn: j((c) => [
3412
+ D(i.$slots, "footer-right", U(X(c)), void 0, !0)
3399
3413
  ]),
3400
3414
  key: "4"
3401
3415
  } : void 0
3402
3416
  ]), 1024))
3403
3417
  ], 2));
3404
3418
  }
3405
- }), ze = /* @__PURE__ */ J(qs, [["__scopeId", "data-v-a15c5d11"]]);
3419
+ }), ze = /* @__PURE__ */ te(Hs, [["__scopeId", "data-v-796349fa"]]);
3406
3420
  ze.name = "TrSender";
3407
- const Hs = function(e) {
3421
+ const zs = function(e) {
3408
3422
  e.component(ze.name, ze);
3409
- }, ir = Object.assign(ze, {
3410
- install: Hs,
3423
+ }, lr = Object.assign(ze, {
3424
+ install: zs,
3411
3425
  // 扩展类(用于继承)
3412
3426
  Mention: Gt,
3413
3427
  Suggestion: Xt,
3414
3428
  Template: Zt,
3415
3429
  // 便捷函数(用于简单场景)
3416
- mention: Oo,
3417
- suggestion: qo,
3418
- template: ls
3430
+ mention: Do,
3431
+ suggestion: Ho,
3432
+ template: as
3419
3433
  });
3420
3434
  export {
3421
- ir as default,
3435
+ lr as default,
3422
3436
  Pe as useSenderContext
3423
3437
  };