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

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,992 +1,68 @@
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
- import { DecorationSet as Le, Decoration as Dt } from "@tiptap/pm/view";
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({
1
+ import { defineComponent as X, openBlock as w, createBlock as U, unref as A, withCtx as B, createTextVNode as ot, toDisplayString as ne, ref as W, watch as K, createElementBlock as P, Fragment as fe, renderList as pe, withModifiers as ye, normalizeClass as V, createCommentVNode as N, createElementVNode as R, nextTick as oe, isRef as ce, Transition as st, normalizeStyle as rt, createVNode as Y, toRaw as it, computed as M, onMounted as at, onUnmounted as lt, Teleport as ct, toRef as de, onBeforeUnmount as ut, shallowReactive as dt, toValue as ft, provide as pt, renderSlot as O, createSlots as me, normalizeProps as z, guardReactiveProps as F } from "vue";
2
+ import { a as mt, u as ue, W as Ke, D as qe } from "../index2.js";
3
+ import { NodeViewWrapper as Ee, VueRenderer as Ne, VueNodeViewRenderer as _e, NodeViewContent as ht, useEditor as gt, EditorContent as xt } from "@tiptap/vue-3";
4
+ import bt from "@tiptap/extension-document";
5
+ import yt from "@tiptap/extension-paragraph";
6
+ import Tt from "@tiptap/extension-text";
7
+ import vt from "@tiptap/extension-history";
8
+ import Et from "@tiptap/extension-placeholder";
9
+ import _t from "@tiptap/extension-character-count";
10
+ import { h as St, j as Ct, p as At } from "../index4.js";
11
+ import { PluginKey as J, Plugin as Q, TextSelection as D } from "@tiptap/pm/state";
12
+ import { DecorationSet as le, Decoration as He } from "@tiptap/pm/view";
13
+ import { a as Se, c as Ce, o as Ae, f as we, s as ke } from "../floating-ui.dom.js";
14
+ import { _ as Z } from "../_plugin-vue_export-helper.js";
15
+ import { IconAssociate as wt, IconArrowDown as kt } from "@opentiny/tiny-robot-svgs";
16
+ import { s as Lt } from "../useSenderContentRegistration.js";
17
+ import { Node as Le, mergeAttributes as Me, Extension as We } from "@tiptap/core";
18
+ import { u as Mt } from "../useTeleportTarget.js";
19
+ const Pt = /* @__PURE__ */ X({
18
20
  __name: "mention-view",
19
21
  props: {
20
22
  node: {},
21
23
  extension: {}
22
24
  },
23
25
  setup(e) {
24
- return (t, o) => (M(), J(k(lt), {
26
+ return (t, o) => (w(), U(A(Ee), {
25
27
  as: "span",
26
28
  class: "mention",
27
29
  "data-id": e.node.attrs.id,
28
30
  "data-value": e.node.attrs.value
29
31
  }, {
30
- default: j(() => [
31
- ln(he(e.extension.options.char) + he(e.node.attrs.label), 1)
32
+ default: B(() => [
33
+ ot(ne(e.extension.options.char) + ne(e.node.attrs.label), 1)
32
34
  ]),
33
35
  _: 1
34
36
  }, 8, ["data-id", "data-value"]));
35
37
  }
36
- }), In = /* @__PURE__ */ te(Bn, [["__scopeId", "data-v-b42c4fae"]]), je = Math.min, me = Math.max, Ne = Math.round, Oe = Math.floor, ne = (e) => ({
37
- x: e,
38
- y: e
39
- }), $n = {
40
- left: "right",
41
- right: "left",
42
- bottom: "top",
43
- top: "bottom"
44
- };
45
- function jn(e, t, o) {
46
- return me(e, je(t, o));
47
- }
48
- function Fe(e, t) {
49
- return typeof e == "function" ? e(t) : e;
50
- }
51
- function Ee(e) {
52
- return e.split("-")[0];
53
- }
54
- function Ve(e) {
55
- return e.split("-")[1];
56
- }
57
- function It(e) {
58
- return e === "x" ? "y" : "x";
59
- }
60
- function $t(e) {
61
- return e === "y" ? "height" : "width";
62
- }
38
+ }), Dt = /* @__PURE__ */ Z(Pt, [["__scopeId", "data-v-b42c4fae"]]);
63
39
  function re(e) {
64
- const t = e[0];
65
- return t === "t" || t === "b" ? "y" : "x";
66
- }
67
- function jt(e) {
68
- return It(re(e));
69
- }
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
- }
76
- function Wn(e) {
77
- const t = We(e);
78
- return [ot(e), t, ot(t)];
79
- }
80
- function ot(e) {
81
- return e.includes("start") ? e.replace("start", "end") : e.replace("end", "start");
82
- }
83
- const vt = ["left", "right"], Tt = ["right", "left"], Kn = ["top", "bottom"], qn = ["bottom", "top"];
84
- function Hn(e, t, o) {
85
- switch (e) {
86
- case "top":
87
- case "bottom":
88
- return o ? t ? Tt : vt : t ? vt : Tt;
89
- case "left":
90
- case "right":
91
- return t ? Kn : qn;
92
- default:
93
- return [];
94
- }
95
- }
96
- function zn(e, t, o, s) {
97
- const r = Ve(e);
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
- }
101
- function We(e) {
102
- const t = Ee(e);
103
- return $n[t] + e.slice(t.length);
104
- }
105
- function Fn(e) {
106
- var t, o, s, r;
107
- return {
108
- top: (t = e.top) != null ? t : 0,
109
- right: (o = e.right) != null ? o : 0,
110
- bottom: (s = e.bottom) != null ? s : 0,
111
- left: (r = e.left) != null ? r : 0
112
- };
113
- }
114
- function Vn(e) {
115
- return typeof e != "number" ? Fn(e) : {
116
- top: e,
117
- right: e,
118
- bottom: e,
119
- left: e
120
- };
121
- }
122
- function Ke(e) {
123
- const {
124
- x: t,
125
- y: o,
126
- width: s,
127
- height: r
128
- } = e;
129
- return {
130
- width: s,
131
- height: r,
132
- top: o,
133
- left: t,
134
- right: t + s,
135
- bottom: o + r,
136
- x: t,
137
- y: o
138
- };
139
- }
140
- function Et(e, t, o) {
141
- let {
142
- reference: s,
143
- floating: r
144
- } = e;
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
- let h;
147
- switch (a) {
148
- case "top":
149
- h = {
150
- x: d,
151
- y: s.y - r.height
152
- };
153
- break;
154
- case "bottom":
155
- h = {
156
- x: d,
157
- y: s.y + s.height
158
- };
159
- break;
160
- case "right":
161
- h = {
162
- x: s.x + s.width,
163
- y: u
164
- };
165
- break;
166
- case "left":
167
- h = {
168
- x: s.x - r.width,
169
- y: u
170
- };
171
- break;
172
- default:
173
- h = {
174
- x: s.x,
175
- y: s.y
176
- };
177
- }
178
- const C = Ve(t);
179
- return C && (h[l] += g * (C === "end" ? 1 : -1) * (o && c ? -1 : 1)), h;
180
- }
181
- async function Gn(e, t) {
182
- var o;
183
- t === void 0 && (t = {});
184
- const {
185
- x: s,
186
- y: r,
187
- platform: n,
188
- rects: l,
189
- elements: i,
190
- strategy: a
191
- } = e, {
192
- boundary: c = "clippingAncestors",
193
- rootBoundary: d = "viewport",
194
- elementContext: u = "floating",
195
- altBoundary: g = !1,
196
- padding: h = 0
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
- boundary: c,
200
- rootBoundary: d,
201
- strategy: a
202
- })), x = u === "floating" ? {
203
- x: s,
204
- y: r,
205
- width: l.floating.width,
206
- height: l.floating.height
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
- x: 1,
209
- y: 1
210
- }, v = Ke(n.convertOffsetParentRelativeRectToViewportRelativeRect ? await n.convertOffsetParentRelativeRectToViewportRelativeRect({
211
- elements: i,
212
- rect: x,
213
- offsetParent: p,
214
- strategy: a
215
- }) : x);
216
- return {
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
- };
222
- }
223
- const Un = 50, Xn = async (e, t, o) => {
224
- const {
225
- placement: s = "bottom",
226
- strategy: r = "absolute",
227
- middleware: n = [],
228
- platform: l
229
- } = o, i = l.detectOverflow ? l : {
230
- ...l,
231
- detectOverflow: Gn
232
- }, a = await (l.isRTL == null ? void 0 : l.isRTL(t));
233
- let c = await l.getElementRects({
234
- reference: e,
235
- floating: t,
236
- strategy: r
237
- }), {
238
- x: d,
239
- y: u
240
- } = Et(c, s, a), g = s, h = 0;
241
- const C = {};
242
- for (let w = 0; w < n.length; w++) {
243
- const b = n[w];
244
- if (!b)
245
- continue;
246
- const {
247
- name: m,
248
- fn: x
249
- } = b, {
250
- x: p,
251
- y: f,
252
- data: v,
253
- reset: E
254
- } = await x({
255
- x: d,
256
- y: u,
257
- initialPlacement: s,
258
- placement: g,
259
- strategy: r,
260
- middlewareData: C,
261
- rects: c,
262
- platform: i,
263
- elements: {
264
- reference: e,
265
- floating: t
266
- }
267
- });
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
- reference: e,
273
- floating: t,
274
- strategy: r
275
- }) : E.rects), {
276
- x: d,
277
- y: u
278
- } = Et(c, g, a)), w = -1);
279
- }
280
- return {
281
- x: d,
282
- y: u,
283
- placement: g,
284
- strategy: r,
285
- middlewareData: C
286
- };
287
- }, Yn = function(e) {
288
- return e === void 0 && (e = {}), {
289
- name: "flip",
290
- options: e,
291
- async fn(t) {
292
- var o, s;
293
- const {
294
- placement: r,
295
- middlewareData: n,
296
- rects: l,
297
- initialPlacement: i,
298
- platform: a,
299
- elements: c
300
- } = t, {
301
- mainAxis: d = !0,
302
- crossAxis: u = !0,
303
- fallbackPlacements: g,
304
- fallbackStrategy: h = "bestFit",
305
- fallbackAxisSideDirection: C = "none",
306
- flipAlignment: w = !0,
307
- ...b
308
- } = Fe(e, t);
309
- if ((o = n.arrow) != null && o.alignmentOffset)
310
- return {};
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
- }
319
- if (L = [...L, {
320
- placement: r,
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
- // overflows the main axis.
327
- L.every((H) => re(H.placement) === x ? H.overflows[0] > 0 : !0)))
328
- return {
329
- data: {
330
- index: G,
331
- overflows: L
332
- },
333
- reset: {
334
- placement: Je
335
- }
336
- };
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
- if (!_e)
339
- switch (h) {
340
- case "bestFit": {
341
- var Se;
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
- // reading directions favoring greater width.
347
- se === "y";
348
- }
349
- return !0;
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
- break;
353
- }
354
- case "initialPlacement":
355
- _e = i;
356
- break;
357
- }
358
- if (r !== _e)
359
- return {
360
- reset: {
361
- placement: _e
362
- }
363
- };
364
- }
365
- return {};
366
- }
367
- };
368
- }, Zn = /* @__PURE__ */ new Set(["left", "top"]);
369
- async function Jn(e, t) {
370
- const {
371
- placement: o,
372
- platform: s,
373
- elements: r
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
- let {
376
- mainAxis: g,
377
- crossAxis: h,
378
- alignmentAxis: C
379
- } = typeof u == "number" ? {
380
- mainAxis: u,
381
- crossAxis: 0,
382
- alignmentAxis: null
383
- } : {
384
- mainAxis: u.mainAxis || 0,
385
- crossAxis: u.crossAxis || 0,
386
- alignmentAxis: u.alignmentAxis
387
- };
388
- return i && typeof C == "number" && (h = i === "end" ? C * -1 : C), a ? {
389
- x: h * d,
390
- y: g * c
391
- } : {
392
- x: g * c,
393
- y: h * d
394
- };
395
- }
396
- const Qn = function(e) {
397
- return e === void 0 && (e = 0), {
398
- name: "offset",
399
- options: e,
400
- async fn(t) {
401
- var o, s;
402
- const {
403
- x: r,
404
- y: n,
405
- placement: l,
406
- middlewareData: i
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
- x: r + a.x,
410
- y: n + a.y,
411
- data: {
412
- ...a,
413
- placement: l
414
- }
415
- };
416
- }
417
- };
418
- }, eo = function(e) {
419
- return e === void 0 && (e = {}), {
420
- name: "shift",
421
- options: e,
422
- async fn(t) {
423
- const {
424
- x: o,
425
- y: s,
426
- placement: r,
427
- platform: n
428
- } = t, {
429
- mainAxis: l = !0,
430
- crossAxis: i = !1,
431
- limiter: a = {
432
- fn: (x) => {
433
- let {
434
- x: p,
435
- y: f
436
- } = x;
437
- return {
438
- x: p,
439
- y: f
440
- };
441
- }
442
- },
443
- ...c
444
- } = Fe(e, t), d = {
445
- x: o,
446
- y: s
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
- const m = a.fn({
452
- ...t,
453
- [h]: C,
454
- [g]: w
455
- });
456
- return {
457
- ...m,
458
- data: {
459
- x: m.x - o,
460
- y: m.y - s,
461
- enabled: {
462
- [h]: l,
463
- [g]: i
464
- }
465
- }
466
- };
467
- }
468
- };
469
- };
470
- function Ge() {
471
- return typeof window < "u";
472
- }
473
- function Ae(e) {
474
- return Nt(e) ? (e.nodeName || "").toLowerCase() : "#document";
475
- }
476
- function W(e) {
477
- var t;
478
- return (e == null || (t = e.ownerDocument) == null ? void 0 : t.defaultView) || window;
479
- }
480
- function oe(e) {
481
- var t;
482
- return (t = (Nt(e) ? e.ownerDocument : e.document) || window.document) == null ? void 0 : t.documentElement;
483
- }
484
- function Nt(e) {
485
- return Ge() ? e instanceof Node || e instanceof W(e).Node : !1;
486
- }
487
- function Q(e) {
488
- return Ge() ? e instanceof Element || e instanceof W(e).Element : !1;
489
- }
490
- function ce(e) {
491
- return Ge() ? e instanceof HTMLElement || e instanceof W(e).HTMLElement : !1;
492
- }
493
- function wt(e) {
494
- return !Ge() || typeof ShadowRoot > "u" ? !1 : e instanceof ShadowRoot || e instanceof W(e).ShadowRoot;
495
- }
496
- function Ue(e) {
497
- const {
498
- overflow: t,
499
- overflowX: o,
500
- overflowY: s,
501
- display: r
502
- } = ee(e);
503
- return /auto|scroll|overlay|hidden|clip/.test(t + s + o) && r !== "inline" && r !== "contents";
504
- }
505
- function to(e) {
506
- return /^(table|td|th)$/.test(Ae(e));
507
- }
508
- function Xe(e) {
509
- try {
510
- if (e.matches(":popover-open"))
511
- return !0;
512
- } catch {
513
- }
514
- try {
515
- return e.matches(":modal");
516
- } catch {
517
- return !1;
518
- }
519
- }
520
- const no = /transform|translate|scale|rotate|perspective|filter/, oo = /paint|layout|strict|content/, fe = (e) => !!e && e !== "none";
521
- let Qe;
522
- function dt(e) {
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
- }
526
- function so(e) {
527
- let t = xe(e);
528
- for (; ce(t) && !Me(t); ) {
529
- if (dt(t))
530
- return t;
531
- if (Xe(t))
532
- return null;
533
- t = xe(t);
534
- }
535
- return null;
536
- }
537
- function ft() {
538
- return Qe == null && (Qe = typeof CSS < "u" && CSS.supports && CSS.supports("-webkit-backdrop-filter", "none")), Qe;
539
- }
540
- function Me(e) {
541
- return /^(html|body|#document)$/.test(Ae(e));
542
- }
543
- function ee(e) {
544
- return W(e).getComputedStyle(e);
545
- }
546
- function Ye(e) {
547
- return Q(e) ? {
548
- scrollLeft: e.scrollLeft,
549
- scrollTop: e.scrollTop
550
- } : {
551
- scrollLeft: e.scrollX,
552
- scrollTop: e.scrollY
553
- };
554
- }
555
- function xe(e) {
556
- if (Ae(e) === "html")
557
- return e;
558
- const t = (
559
- // Step into the shadow DOM of the parent of a slotted node.
560
- e.assignedSlot || // DOM Element detected.
561
- e.parentNode || // ShadowRoot detected.
562
- wt(e) && e.host || // Fallback.
563
- oe(e)
564
- );
565
- return wt(t) ? t.host : t;
566
- }
567
- function Wt(e) {
568
- const t = xe(e);
569
- return Me(t) ? (e.ownerDocument || e).body : ce(t) && Ue(t) ? t : Wt(t);
570
- }
571
- function Re(e, t, o) {
572
- var s;
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
- const i = st(l);
577
- return t.concat(l, l.visualViewport || [], Ue(r) ? r : [], i && o ? Re(i) : []);
578
- } else
579
- return t.concat(r, Re(r, [], o));
580
- }
581
- function st(e) {
582
- return e.parent && Object.getPrototypeOf(e.parent) ? e.frameElement : null;
583
- }
584
- function Kt(e) {
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
- height: s,
591
- $: i
592
- };
593
- }
594
- function pt(e) {
595
- return Q(e) ? e : e.contextElement;
596
- }
597
- function Te(e) {
598
- const t = pt(e);
599
- if (!ce(t))
600
- return ne(1);
601
- const o = t.getBoundingClientRect(), {
602
- width: s,
603
- height: r,
604
- $: n
605
- } = Kt(t);
606
- let l = (n ? Ne(o.width) : o.width) / s, i = (n ? Ne(o.height) : o.height) / r;
607
- return (!l || !Number.isFinite(l)) && (l = 1), (!i || !Number.isFinite(i)) && (i = 1), {
608
- x: l,
609
- y: i
610
- };
611
- }
612
- const ro = /* @__PURE__ */ ne(0);
613
- function qt(e) {
614
- const t = W(e);
615
- return !ft() || !t.visualViewport ? ro : {
616
- x: t.visualViewport.offsetLeft,
617
- y: t.visualViewport.offsetTop
618
- };
619
- }
620
- function io(e, t, o) {
621
- return t === void 0 && (t = !1), !!o && t && o === W(e);
622
- }
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
- 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 (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
- }
637
- }
638
- return Ke({
639
- width: d,
640
- height: u,
641
- x: a,
642
- y: c
643
- });
644
- }
645
- function Ze(e, t) {
646
- const o = Ye(e).scrollLeft;
647
- return t ? t.left + o : ye(oe(e)).left + o;
648
- }
649
- function Ht(e, t) {
650
- const o = e.getBoundingClientRect(), s = o.left + t.scrollLeft - Ze(e, o), r = o.top + t.scrollTop;
651
- return {
652
- x: s,
653
- y: r
654
- };
655
- }
656
- function lo(e) {
657
- let {
658
- elements: t,
659
- rect: o,
660
- offsetParent: s,
661
- strategy: r
662
- } = e;
663
- const n = r === "fixed", l = oe(s), i = t ? Xe(t.floating) : !1;
664
- if (s === l || i && n)
665
- return o;
666
- let a = {
667
- scrollLeft: 0,
668
- scrollTop: 0
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
- const h = ye(s);
673
- c = Te(s), d.x = h.x + s.clientLeft, d.y = h.y + s.clientTop;
674
- }
675
- const g = l && !u && !n ? Ht(l, a) : ne(0);
676
- return {
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
- };
682
- }
683
- function ao(e) {
684
- return e.getClientRects ? Array.from(e.getClientRects()) : [];
685
- }
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
- const l = -t.scrollTop;
690
- return ee(o).direction === "rtl" && (n += me(e.clientWidth, o.clientWidth) - s), {
691
- width: s,
692
- height: r,
693
- x: n,
694
- y: l
695
- };
696
- }
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
- if (l) {
703
- const g = !ft() || t === "fixed";
704
- s ? g || (c = -l.offsetLeft, d = -l.offsetTop) : (i = l.width, a = l.height, g && (c = l.offsetLeft, d = l.offsetTop));
705
- }
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
- }
710
- return {
711
- width: i,
712
- height: a,
713
- x: c,
714
- y: d
715
- };
716
- }
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
- return {
720
- width: l,
721
- height: i,
722
- x: a,
723
- y: c
724
- };
725
- }
726
- function Ct(e, t, o) {
727
- let s;
728
- if (t === "viewport" || t === "layoutViewport")
729
- s = fo(e, o, t);
730
- else if (t === "document")
731
- s = co(oe(e));
732
- else if (Q(t))
733
- s = po(t, o);
734
- else {
735
- const r = qt(e);
736
- s = {
737
- x: t.x - r.x,
738
- y: t.y - r.y,
739
- width: t.width,
740
- height: t.height
741
- };
742
- }
743
- return Ke(s);
744
- }
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
- !a && (c === "fixed" || c === "absolute" && i.position === "static") ? s = s.filter((u) => u !== l) : r = i, l = xe(l);
755
- }
756
- return t.set(e, s), s;
757
- }
758
- function ho(e) {
759
- let {
760
- element: t,
761
- boundary: o,
762
- rootBoundary: s,
763
- strategy: r
764
- } = e;
765
- const l = [...o === "clippingAncestors" ? Xe(t) ? [] : mo(t, this._c) : [].concat(o), s], i = Ct(t, l[0], r);
766
- let a = i.top, c = i.right, d = i.bottom, u = i.left;
767
- for (let g = 1; g < l.length; g++) {
768
- const h = Ct(t, l[g], r);
769
- a = me(h.top, a), c = je(h.right, c), d = je(h.bottom, d), u = me(h.left, u);
770
- }
771
- return {
772
- width: c - u,
773
- height: d - a,
774
- x: u,
775
- y: a
776
- };
777
- }
778
- function go(e) {
779
- const {
780
- width: t,
781
- height: o
782
- } = Kt(e);
783
- return {
784
- width: t,
785
- height: o
786
- };
787
- }
788
- function xo(e, t, o) {
789
- const s = ce(t), r = oe(t), n = o === "fixed", l = ye(e, !0, n, t);
790
- let i = {
791
- scrollLeft: 0,
792
- scrollTop: 0
793
- };
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
- a.x = g.x + t.clientLeft, a.y = g.y + t.clientTop;
798
- }
799
- !s && r && (a.x = Ze(r));
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
- return {
802
- x: d,
803
- y: u,
804
- width: l.width,
805
- height: l.height
806
- };
807
- }
808
- function et(e) {
809
- return ee(e).position === "static";
810
- }
811
- function At(e, t) {
812
- if (!ce(e) || ee(e).position === "fixed")
813
- return null;
814
- if (t)
815
- return t(e);
816
- let o = e.offsetParent;
817
- return oe(e) === o && (o = o.ownerDocument.body), o;
818
- }
819
- function zt(e, t) {
820
- const o = W(e);
821
- if (Xe(e))
822
- return o;
823
- if (!ce(e)) {
824
- let r = xe(e);
825
- for (; r && !Me(r); ) {
826
- if (Q(r) && !et(r))
827
- return r;
828
- r = xe(r);
829
- }
830
- return o;
831
- }
832
- let s = At(e, t);
833
- for (; s && to(s) && et(s); )
834
- s = At(s, t);
835
- return s && Me(s) && et(s) && !dt(s) ? o : s || so(e) || o;
836
- }
837
- const yo = async function(e) {
838
- const t = this.getOffsetParent || zt, o = this.getDimensions, s = await o(e.floating);
839
- return {
840
- reference: xo(e.reference, await t(e.floating), e.strategy),
841
- floating: {
842
- x: 0,
843
- y: 0,
844
- width: s.width,
845
- height: s.height
846
- }
847
- };
848
- };
849
- function bo(e) {
850
- return ee(e).direction === "rtl";
851
- }
852
- const vo = {
853
- convertOffsetParentRelativeRectToViewportRelativeRect: lo,
854
- getDocumentElement: oe,
855
- getClippingRect: ho,
856
- getOffsetParent: zt,
857
- getElementRects: yo,
858
- getClientRects: ao,
859
- getDimensions: go,
860
- getScale: Te,
861
- isElement: Q,
862
- isRTL: bo
863
- };
864
- function Ft(e, t) {
865
- return e.x === t.x && e.y === t.y && e.width === t.width && e.height === t.height;
866
- }
867
- function To(e, t, o) {
868
- let s = null, r;
869
- const n = oe(e);
870
- function l() {
871
- var d;
872
- clearTimeout(r), (d = s) == null || d.disconnect(), s = null;
873
- }
874
- function i(d, u) {
875
- d === void 0 && (d = !1), u === void 0 && (u = 1), l();
876
- const g = e.getBoundingClientRect(), {
877
- left: h,
878
- top: C,
879
- width: w,
880
- height: b
881
- } = g;
882
- if (d || t(), !w || !b)
883
- return;
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
- };
888
- let T = !0;
889
- function A(y) {
890
- const L = y[0].intersectionRatio;
891
- if (!Ft(g, e.getBoundingClientRect()))
892
- return i();
893
- if (L !== u) {
894
- if (!T)
895
- return i();
896
- L ? i(!1, L) : r = setTimeout(() => {
897
- i(!1, 1e-7);
898
- }, 1e3);
899
- }
900
- T = !1;
901
- }
902
- try {
903
- s = new IntersectionObserver(A, {
904
- ...E,
905
- // Handle <iframe>s
906
- root: n.ownerDocument
907
- });
908
- } catch {
909
- s = new IntersectionObserver(A, E);
910
- }
911
- s.observe(e);
912
- }
913
- const a = W(e), c = () => i(o);
914
- return a.addEventListener("resize", c), i(!0), () => {
915
- a.removeEventListener("resize", c), l();
916
- };
917
- }
918
- function mt(e, t, o, s) {
919
- s === void 0 && (s = {});
920
- const {
921
- ancestorScroll: r = !0,
922
- ancestorResize: n = !0,
923
- elementResize: l = typeof ResizeObserver == "function",
924
- layoutShift: i = typeof IntersectionObserver == "function",
925
- animationFrame: a = !1
926
- } = s, c = pt(e), d = r || n ? [...c ? Re(c) : [], ...t ? Re(t) : []] : [];
927
- d.forEach((m) => {
928
- r && m.addEventListener("scroll", o), n && m.addEventListener("resize", o);
929
- });
930
- const u = c && i ? To(c, o, n) : null;
931
- let g = -1, h = null;
932
- l && (h = new ResizeObserver((m) => {
933
- let [x] = m;
934
- x && x.target === c && h && t && (h.unobserve(t), cancelAnimationFrame(g), g = requestAnimationFrame(() => {
935
- var p;
936
- (p = h) == null || p.observe(t);
937
- })), o();
938
- }), c && !a && h.observe(c), t && h.observe(t));
939
- let C, w = a ? ye(e) : null;
940
- a && b();
941
- function b() {
942
- const m = ye(e);
943
- w && !Ft(w, m) && o(), w = m, C = requestAnimationFrame(b);
944
- }
945
- return o(), () => {
946
- var m;
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
- };
951
- }
952
- const ht = Qn, gt = eo, xt = Yn, yt = (e, t, o) => {
953
- const s = /* @__PURE__ */ new Map(), r = o ?? {}, n = {
954
- ...vo,
955
- ...r.platform,
956
- _c: s
957
- };
958
- return Xn(e, t, {
959
- ...r,
960
- platform: n
961
- });
962
- };
963
- function ve(e) {
964
40
  return `${e}_${Date.now()}_${Math.random().toString(36).slice(2, 9)}`;
965
41
  }
966
- function Eo(e, t, o = !1) {
42
+ function Ot(e, t, o = !1) {
967
43
  const { $from: s } = e;
968
44
  if (!e.empty || !s.parent.isTextblock)
969
45
  return null;
970
- const r = s.parent.textBetween(0, s.parentOffset, void 0, ""), n = r.lastIndexOf(t);
46
+ const i = s.parent.textBetween(0, s.parentOffset, void 0, ""), n = i.lastIndexOf(t);
971
47
  if (n === -1)
972
48
  return null;
973
- const l = r.slice(n + t.length);
974
- if (!o && l.includes(" "))
49
+ const a = i.slice(n + t.length);
50
+ if (!o && a.includes(" "))
975
51
  return null;
976
- const i = s.start() + n, a = s.pos;
52
+ const r = s.start() + n, l = s.pos;
977
53
  return {
978
- range: { from: i, to: a },
979
- query: l
54
+ range: { from: r, to: l },
55
+ query: a
980
56
  };
981
57
  }
982
- const be = {
58
+ const se = {
983
59
  /** Template 扩展(包含 TemplateBlock 和 TemplateSelect 子扩展) */
984
60
  TEMPLATE: "template",
985
61
  /** Mention 扩展 */
986
62
  MENTION: "mention",
987
63
  /** Suggestion 扩展 */
988
64
  SUGGESTION: "suggestion"
989
- }, _ = {
65
+ }, T = {
990
66
  /** TemplateBlock 节点类型(可编辑块) */
991
67
  TEMPLATE_BLOCK: "templateBlock",
992
68
  /** TemplateSelect 节点类型(下拉选择) */
@@ -997,7 +73,7 @@ const be = {
997
73
  PARAGRAPH: "paragraph",
998
74
  /** Text 节点类型(ProseMirror 内置) */
999
75
  TEXT: "text"
1000
- }, ue = {
76
+ }, ee = {
1001
77
  /** Mention 插件 */
1002
78
  MENTION: "mention",
1003
79
  /** Suggestion 插件 */
@@ -1014,7 +90,7 @@ const be = {
1014
90
  TEMPLATE_BLOCK_KEYBOARD: "templateBlockKeyboard",
1015
91
  /** Template Block 粘贴处理插件 */
1016
92
  TEMPLATE_BLOCK_PASTE: "templateBlockPaste"
1017
- }, Z = {
93
+ }, G = {
1018
94
  /** 文本类型 */
1019
95
  TEXT: "text",
1020
96
  /** 模板块类型(对应内部的 TemplateBlock 节点) */
@@ -1023,7 +99,7 @@ const be = {
1023
99
  SELECT: "select",
1024
100
  /** Mention 类型 */
1025
101
  MENTION: "mention"
1026
- }, Vt = {
102
+ }, ze = {
1027
103
  /** Enter 键 */
1028
104
  ENTER: "Enter",
1029
105
  /** Escape 键 */
@@ -1044,87 +120,87 @@ const be = {
1044
120
  ARROW_RIGHT: "ArrowRight",
1045
121
  /** 空格键 */
1046
122
  SPACE: " "
1047
- }, B = (e, t) => e.key === Vt[t], we = (e, t) => t.some((o) => e.key === Vt[o]), wo = ["onMousedown", "onMouseenter"], Co = {
123
+ }, I = (e, t) => e.key === ze[t], ie = (e, t) => t.some((o) => e.key === ze[o]), It = ["onMousedown", "onMouseenter"], Rt = {
1048
124
  key: 0,
1049
125
  class: "mention-icon"
1050
- }, Ao = { class: "mention-label" }, So = {
126
+ }, Bt = { class: "mention-label" }, jt = {
1051
127
  key: 0,
1052
128
  class: "mention-empty"
1053
- }, _o = /* @__PURE__ */ V({
129
+ }, $t = /* @__PURE__ */ X({
1054
130
  __name: "mention-list",
1055
131
  props: {
1056
132
  items: {},
1057
133
  command: { type: Function }
1058
134
  },
1059
135
  setup(e, { expose: t }) {
1060
- const o = e, s = F(0), r = F(null);
136
+ const o = e, s = W(0), i = W(null);
1061
137
  K(
1062
138
  () => o.items,
1063
139
  () => {
1064
140
  s.value = 0;
1065
141
  }
1066
142
  );
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;
143
+ function n({ event: u }) {
144
+ return I(u, "ARROW_UP") ? (s.value = Math.max(0, s.value - 1), a(), !0) : I(u, "ARROW_DOWN") ? (s.value = Math.min(o.items.length - 1, s.value + 1), a(), !0) : ie(u, ["ENTER", "TAB"]) ? (r(s.value), !0) : !1;
1069
145
  }
1070
- function l() {
1071
- ge(() => {
1072
- var d;
1073
- const c = (d = r.value) == null ? void 0 : d.querySelector(".mention-item.is-selected");
1074
- c && c.scrollIntoView({
146
+ function a() {
147
+ oe(() => {
148
+ var p;
149
+ const u = (p = i.value) == null ? void 0 : p.querySelector(".mention-item.is-selected");
150
+ u && u.scrollIntoView({
1075
151
  block: "nearest",
1076
152
  behavior: "smooth"
1077
153
  });
1078
154
  });
1079
155
  }
1080
- function i(c) {
1081
- const d = o.items[c];
1082
- d && o.command({
1083
- id: d.id,
1084
- label: d.label,
1085
- value: d.value
156
+ function r(u) {
157
+ const p = o.items[u];
158
+ p && o.command({
159
+ id: p.id,
160
+ label: p.label,
161
+ value: p.value
1086
162
  });
1087
163
  }
1088
- function a(c) {
1089
- s.value = c;
164
+ function l(u) {
165
+ s.value = u;
1090
166
  }
1091
167
  return t({
1092
168
  onKeyDown: n
1093
- }), (c, d) => (M(), P("div", {
169
+ }), (u, p) => (w(), P("div", {
1094
170
  ref_key: "listRef",
1095
- ref: r,
171
+ ref: i,
1096
172
  class: "mention-list"
1097
173
  }, [
1098
- (M(!0), P(Be, null, Ie(e.items, (u, g) => (M(), P("button", {
1099
- key: u.id,
174
+ (w(!0), P(fe, null, pe(e.items, (f, E) => (w(), P("button", {
175
+ key: f.id,
1100
176
  type: "button",
1101
- class: Y(["mention-item", { "is-selected": g === s.value }]),
1102
- onMousedown: nt((h) => i(g), ["prevent"]),
1103
- onMouseenter: (h) => a(g)
177
+ class: V(["mention-item", { "is-selected": E === s.value }]),
178
+ onMousedown: ye((S) => r(E), ["prevent"]),
179
+ onMouseenter: (S) => l(E)
1104
180
  }, [
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
- ])])) : q("", !0)
181
+ f.icon ? (w(), P("span", Rt, ne(f.icon), 1)) : N("", !0),
182
+ R("span", Bt, ne(f.label), 1)
183
+ ], 42, It))), 128)),
184
+ e.items.length === 0 ? (w(), P("div", jt, [...p[0] || (p[0] = [
185
+ R("span", null, "未找到匹配的提及项", -1)
186
+ ])])) : N("", !0)
1111
187
  ], 512));
1112
188
  }
1113
- }), Lo = /* @__PURE__ */ te(_o, [["__scopeId", "data-v-aaa34d1a"]]), pe = new le(ue.MENTION);
1114
- function ko(e, t) {
189
+ }), Kt = /* @__PURE__ */ Z($t, [["__scopeId", "data-v-aaa34d1a"]]), te = new J(ee.MENTION);
190
+ function qt(e, t) {
1115
191
  if (!t)
1116
192
  return e;
1117
193
  const o = t.toLowerCase();
1118
194
  return e.filter((s) => {
1119
- var r;
1120
- return !!(s.label.toLowerCase().includes(o) || (r = s.value) != null && r.toLowerCase().includes(o));
195
+ var i;
196
+ return !!(s.label.toLowerCase().includes(o) || (i = s.value) != null && i.toLowerCase().includes(o));
1121
197
  });
1122
198
  }
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,
199
+ function Nt(e) {
200
+ const { editor: t, char: o, items: s, allowSpaces: i } = e;
201
+ let n = null, a = null, r = null;
202
+ return new Q({
203
+ key: te,
1128
204
  state: {
1129
205
  init() {
1130
206
  return {
@@ -1134,140 +210,140 @@ function Mo(e) {
1134
210
  filteredItems: []
1135
211
  };
1136
212
  },
1137
- apply(a, c) {
1138
- const d = a.getMeta(pe);
1139
- if (d && d.type === "close")
213
+ apply(l, u) {
214
+ const p = l.getMeta(te);
215
+ if (p && p.type === "close")
1140
216
  return {
1141
217
  active: !1,
1142
218
  range: null,
1143
219
  query: "",
1144
220
  filteredItems: []
1145
221
  };
1146
- if (!a.docChanged && !a.selectionSet)
1147
- return c;
1148
- const u = Eo(a.selection, o, r);
1149
- if (!u)
222
+ if (!l.docChanged && !l.selectionSet)
223
+ return u;
224
+ const f = Ot(l.selection, o, i);
225
+ if (!f)
1150
226
  return {
1151
227
  active: !1,
1152
228
  range: null,
1153
229
  query: "",
1154
230
  filteredItems: []
1155
231
  };
1156
- const g = ke(s) ? s.value : s, h = ko(g, u.query);
232
+ const E = ce(s) ? s.value : s, S = qt(E, f.query);
1157
233
  return {
1158
- active: h.length > 0,
1159
- range: u.range,
1160
- query: u.query,
1161
- filteredItems: h
234
+ active: S.length > 0,
235
+ range: f.range,
236
+ query: f.query,
237
+ filteredItems: S
1162
238
  };
1163
239
  }
1164
240
  },
1165
241
  props: {
1166
242
  // 装饰器:高亮触发区域
1167
- decorations(a) {
1168
- const c = this.getState(a);
1169
- if (!(c != null && c.active) || !c.range)
1170
- return Le.empty;
1171
- const d = Dt.inline(c.range.from, c.range.to, {
243
+ decorations(l) {
244
+ const u = this.getState(l);
245
+ if (!(u != null && u.active) || !u.range)
246
+ return le.empty;
247
+ const p = He.inline(u.range.from, u.range.to, {
1172
248
  class: "mention-trigger"
1173
249
  });
1174
- return Le.create(a.doc, [d]);
250
+ return le.create(l.doc, [p]);
1175
251
  },
1176
252
  // 键盘处理
1177
- handleKeyDown(a, c) {
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
- c.preventDefault();
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;
253
+ handleKeyDown(l, u) {
254
+ var f, E, S, j;
255
+ const p = te.getState(l.state);
256
+ if (I(u, "BACKSPACE")) {
257
+ const { selection: L } = l.state, { $from: C } = L;
258
+ if (C.nodeBefore && C.nodeBefore.type.name === T.MENTION) {
259
+ u.preventDefault();
260
+ const { tr: h } = l.state, g = C.pos - C.nodeBefore.nodeSize;
261
+ return h.delete(g, C.pos), h.insertText(o, g), h.setSelection(D.create(h.doc, g + 1)), l.dispatch(h), l.focus(), !0;
1186
262
  }
1187
263
  }
1188
- if (!(d != null && d.active))
264
+ if (!(p != null && p.active))
1189
265
  return !1;
1190
- if (B(c, "ESCAPE")) {
1191
- c.preventDefault();
1192
- const w = a.state.tr;
1193
- return w.setMeta(pe, {
266
+ if (I(u, "ESCAPE")) {
267
+ u.preventDefault();
268
+ const L = l.state.tr;
269
+ return L.setMeta(te, {
1194
270
  type: "close"
1195
- }), a.dispatch(w), n && (i == null || i(), i = null, n.destroy(), n = null), l && (l.remove(), l = null), !0;
271
+ }), l.dispatch(L), n && (r == null || r(), r = null, n.destroy(), n = null), a && (a.remove(), a = null), !0;
1196
272
  }
1197
- if (we(c, ["ENTER", "TAB"])) {
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 }))
273
+ if (ie(u, ["ENTER", "TAB"])) {
274
+ if (u.preventDefault(), (E = (f = n == null ? void 0 : n.ref) == null ? void 0 : f.onKeyDown) == null ? void 0 : E.call(f, { event: u }))
1199
275
  return !0;
1200
- if (d.filteredItems.length > 0 && d.range) {
1201
- const b = d.filteredItems[0];
1202
- return St(a, d.range, b), !0;
276
+ if (p.filteredItems.length > 0 && p.range) {
277
+ const C = p.filteredItems[0];
278
+ return Ie(l, p.range, C), !0;
1203
279
  }
1204
280
  return !0;
1205
281
  }
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;
282
+ return ie(u, ["ARROW_UP", "ARROW_DOWN"]) && ((j = (S = n == null ? void 0 : n.ref) == null ? void 0 : S.onKeyDown) == null ? void 0 : j.call(S, { event: u })) || !1;
1207
283
  }
1208
284
  },
1209
285
  view() {
1210
286
  return {
1211
- update(a) {
1212
- const c = pe.getState(a.state);
1213
- if (c != null && c.active && c.filteredItems.length > 0) {
287
+ update(l) {
288
+ const u = te.getState(l.state);
289
+ if (u != null && u.active && u.filteredItems.length > 0) {
1214
290
  n ? n.updateProps({
1215
- items: c.filteredItems
1216
- }) : (n = new Ot(Lo, {
291
+ items: u.filteredItems
292
+ }) : (n = new Ne(Kt, {
1217
293
  props: {
1218
- items: c.filteredItems,
1219
- command: (u) => {
1220
- const g = {
1221
- id: u.id,
1222
- label: u.label,
1223
- value: u.value || ""
294
+ items: u.filteredItems,
295
+ command: (f) => {
296
+ const E = {
297
+ id: f.id,
298
+ label: f.label,
299
+ value: f.value || ""
1224
300
  };
1225
- c.range && St(a, c.range, g);
301
+ u.range && Ie(l, u.range, E);
1226
302
  }
1227
303
  },
1228
304
  editor: t
1229
- }), l = n.element, l.style.position = "absolute", l.style.zIndex = "1000", document.body.appendChild(l));
1230
- const d = a.dom.querySelector(".mention-trigger");
1231
- d && l && (i == null || i(), i = mt(d, l, () => {
1232
- yt(d, l, {
305
+ }), a = n.element, a.style.position = "absolute", a.style.zIndex = "1000", document.body.appendChild(a));
306
+ const p = l.dom.querySelector(".mention-trigger");
307
+ p && a && (r == null || r(), r = Se(p, a, () => {
308
+ Ce(p, a, {
1233
309
  placement: "bottom-start",
1234
- middleware: [ht(8), xt(), gt({ padding: 8 })]
1235
- }).then((u) => {
1236
- l && Object.assign(l.style, {
1237
- left: `${u.x}px`,
1238
- top: `${u.y}px`
310
+ middleware: [Ae(8), we(), ke({ padding: 8 })]
311
+ }).then((f) => {
312
+ a && Object.assign(a.style, {
313
+ left: `${f.x}px`,
314
+ top: `${f.y}px`
1239
315
  });
1240
316
  });
1241
317
  }));
1242
318
  } else
1243
- n && (i == null || i(), i = null, n.destroy(), n = null), l && (l.remove(), l = null);
319
+ n && (r == null || r(), r = null, n.destroy(), n = null), a && (a.remove(), a = null);
1244
320
  },
1245
321
  destroy() {
1246
- i == null || i(), n == null || n.destroy(), l == null || l.remove();
322
+ r == null || r(), n == null || n.destroy(), a == null || a.remove();
1247
323
  }
1248
324
  };
1249
325
  }
1250
326
  });
1251
327
  }
1252
- function St(e, t, o) {
328
+ function Ie(e, t, o) {
1253
329
  e.focus();
1254
- const { state: s, dispatch: r } = e, { tr: n } = s, l = s.schema.nodes.mention.create({
1255
- id: o.id || ve("mention"),
330
+ const { state: s, dispatch: i } = e, { tr: n } = s, a = s.schema.nodes.mention.create({
331
+ id: o.id || re("mention"),
1256
332
  label: o.label,
1257
333
  value: o.value || ""
1258
- }), i = s.schema.text(" ");
1259
- n.delete(t.from, t.to), n.insert(t.from, [l, i]);
1260
- const a = t.from + 2;
1261
- n.setSelection(O.create(n.doc, a)), n.scrollIntoView(), r(n);
334
+ }), r = s.schema.text(" ");
335
+ n.delete(t.from, t.to), n.insert(t.from, [a, r]);
336
+ const l = t.from + 2;
337
+ n.setSelection(D.create(n.doc, l)), n.scrollIntoView(), i(n);
1262
338
  }
1263
- const Ro = {
339
+ const Ht = {
1264
340
  /**
1265
341
  * 插入 mention 节点
1266
342
  */
1267
343
  insertMention: (e) => ({ commands: t }) => t.insertContent({
1268
- type: _.MENTION,
344
+ type: T.MENTION,
1269
345
  attrs: {
1270
- id: e.id || ve("mention"),
346
+ id: e.id || re("mention"),
1271
347
  label: e.label || "",
1272
348
  value: e.value
1273
349
  }
@@ -1277,13 +353,13 @@ const Ro = {
1277
353
  */
1278
354
  deleteMention: (e) => ({ tr: t, state: o }) => {
1279
355
  let s = !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;
356
+ return o.doc.descendants((i, n) => {
357
+ if (i.type.name === T.MENTION && i.attrs.id === e)
358
+ return t.delete(n, n + i.nodeSize), s = !0, !1;
1283
359
  }), s;
1284
360
  }
1285
- }, Gt = ct.create({
1286
- name: be.MENTION,
361
+ }, Fe = Le.create({
362
+ name: se.MENTION,
1287
363
  // 节点配置
1288
364
  group: "inline",
1289
365
  inline: !0,
@@ -1329,7 +405,7 @@ const Ro = {
1329
405
  renderHTML({ node: e, HTMLAttributes: t }) {
1330
406
  return [
1331
407
  "span",
1332
- ut(this.options.HTMLAttributes || {}, t, {
408
+ Me(this.options.HTMLAttributes || {}, t, {
1333
409
  "data-mention": "",
1334
410
  "data-id": e.attrs.id,
1335
411
  "data-label": e.attrs.label,
@@ -1340,7 +416,7 @@ const Ro = {
1340
416
  },
1341
417
  // 使用 Vue 组件渲染
1342
418
  addNodeView() {
1343
- return at(In);
419
+ return _e(Dt);
1344
420
  },
1345
421
  // 添加 storage 用于存储实例状态
1346
422
  addStorage() {
@@ -1350,11 +426,11 @@ const Ro = {
1350
426
  },
1351
427
  onCreate() {
1352
428
  const { items: e } = this.options;
1353
- ke(e) && (this.storage.watchStopHandle = K(
429
+ ce(e) && (this.storage.watchStopHandle = K(
1354
430
  e,
1355
431
  () => {
1356
432
  const t = this.editor.state.tr;
1357
- t.setMeta(pe, { type: "mention-update" }), this.editor.view.dispatch(t);
433
+ t.setMeta(te, { type: "mention-update" }), this.editor.view.dispatch(t);
1358
434
  },
1359
435
  { deep: !0 }
1360
436
  ));
@@ -1365,7 +441,7 @@ const Ro = {
1365
441
  // 添加 Suggestion 插件
1366
442
  addProseMirrorPlugins() {
1367
443
  return [
1368
- Mo({
444
+ Nt({
1369
445
  editor: this.editor,
1370
446
  char: this.options.char,
1371
447
  items: this.options.items,
@@ -1382,33 +458,33 @@ const Ro = {
1382
458
  },
1383
459
  // 自定义命令
1384
460
  addCommands() {
1385
- return Ro;
461
+ return Ht;
1386
462
  }
1387
463
  });
1388
- function Po(e) {
1389
- var r;
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) || "@";
464
+ function Wt(e) {
465
+ var i;
466
+ const t = e.extensionManager.extensions.find((n) => n.name === se.MENTION), o = ((i = t == null ? void 0 : t.options) == null ? void 0 : i.char) || "@";
1391
467
  let s = "";
1392
468
  return e.state.doc.descendants((n) => {
1393
- n.type.name === _.MENTION ? s += `${o}${n.attrs.label}` : n.type.name === _.TEXT && (s += n.text || "");
469
+ n.type.name === T.MENTION ? s += `${o}${n.attrs.label}` : n.type.name === T.TEXT && (s += n.text || "");
1394
470
  }), s.trim();
1395
471
  }
1396
- function Oo(e) {
472
+ function zt(e) {
1397
473
  const t = [];
1398
- return e.state.doc.descendants((o, s, r) => {
1399
- if (r && r.type.name === _.PARAGRAPH) {
1400
- if (o.type.name === _.MENTION)
474
+ return e.state.doc.descendants((o, s, i) => {
475
+ if (i && i.type.name === T.PARAGRAPH) {
476
+ if (o.type.name === T.MENTION)
1401
477
  t.push({
1402
- type: Z.MENTION,
478
+ type: G.MENTION,
1403
479
  content: o.attrs.label,
1404
480
  value: o.attrs.value || ""
1405
481
  });
1406
- else if (o.type.name === _.TEXT) {
482
+ else if (o.type.name === T.TEXT) {
1407
483
  const n = o.text || "";
1408
484
  if (n) {
1409
- const l = t[t.length - 1];
1410
- l && l.type === Z.TEXT ? l.content = (l.content || "") + n : t.push({
1411
- type: Z.TEXT,
485
+ const a = t[t.length - 1];
486
+ a && a.type === G.TEXT ? a.content = (a.content || "") + n : t.push({
487
+ type: G.TEXT,
1412
488
  content: n
1413
489
  });
1414
490
  }
@@ -1416,59 +492,59 @@ function Oo(e) {
1416
492
  }
1417
493
  }), t;
1418
494
  }
1419
- function Do(e, t = "@", o) {
1420
- return Gt.configure({
495
+ function Ft(e, t = "@", o) {
496
+ return Fe.configure({
1421
497
  items: e,
1422
498
  char: t,
1423
499
  ...o
1424
500
  });
1425
501
  }
1426
- const Ut = (e, t) => {
502
+ const Ve = (e, t) => {
1427
503
  if (!t.length)
1428
504
  return [{ text: e, isMatch: !1 }];
1429
505
  const o = [];
1430
- for (const l of t) {
1431
- if (!l) continue;
1432
- let i = 0;
1433
- const a = e.toLowerCase(), c = l.toLowerCase();
506
+ for (const a of t) {
507
+ if (!a) continue;
508
+ let r = 0;
509
+ const l = e.toLowerCase(), u = a.toLowerCase();
1434
510
  for (; ; ) {
1435
- const d = a.indexOf(c, i);
1436
- if (d === -1) break;
511
+ const p = l.indexOf(u, r);
512
+ if (p === -1) break;
1437
513
  o.push({
1438
- start: d,
1439
- end: d + l.length
1440
- }), i = d + 1;
514
+ start: p,
515
+ end: p + a.length
516
+ }), r = p + 1;
1441
517
  }
1442
518
  }
1443
519
  if (o.length === 0)
1444
520
  return [{ text: e, isMatch: !1 }];
1445
- o.sort((l, i) => l.start - i.start);
521
+ o.sort((a, r) => a.start - r.start);
1446
522
  const s = [];
1447
- for (const l of o)
523
+ for (const a of o)
1448
524
  if (s.length === 0)
1449
- s.push(l);
525
+ s.push(a);
1450
526
  else {
1451
- const i = s[s.length - 1];
1452
- l.start <= i.end ? i.end = Math.max(i.end, l.end) : s.push(l);
527
+ const r = s[s.length - 1];
528
+ a.start <= r.end ? r.end = Math.max(r.end, a.end) : s.push(a);
1453
529
  }
1454
- const r = [];
530
+ const i = [];
1455
531
  let n = 0;
1456
- for (const l of s)
1457
- n < l.start && r.push({
1458
- text: e.substring(n, l.start),
532
+ for (const a of s)
533
+ n < a.start && i.push({
534
+ text: e.substring(n, a.start),
1459
535
  isMatch: !1
1460
- }), r.push({
1461
- text: e.substring(l.start, l.end),
536
+ }), i.push({
537
+ text: e.substring(a.start, a.end),
1462
538
  isMatch: !0
1463
- }), n = l.end;
1464
- return n < e.length && r.push({
539
+ }), n = a.end;
540
+ return n < e.length && i.push({
1465
541
  text: e.substring(n),
1466
542
  isMatch: !1
1467
- }), r;
1468
- }, Bo = (e, t) => !t || !e ? [{ text: e, isMatch: !1 }] : Ut(e, [t]), Io = (e, t) => {
543
+ }), i;
544
+ }, Vt = (e, t) => !t || !e ? [{ text: e, isMatch: !1 }] : Ve(e, [t]), Gt = (e, t) => {
1469
545
  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({
546
+ return typeof s == "function" ? s(o, t) : Array.isArray(s) ? Ve(o, s) : Vt(o, t);
547
+ }, Ut = ["onMouseenter", "onClick"], Xt = { class: "suggestion-list__text" }, Zt = /* @__PURE__ */ X({
1472
548
  __name: "suggestion-list",
1473
549
  props: {
1474
550
  show: { type: Boolean },
@@ -1482,165 +558,165 @@ const Ut = (e, t) => {
1482
558
  onMouseLeave: { type: Function }
1483
559
  },
1484
560
  setup(e) {
1485
- const t = e, o = F(null), s = (i) => i === t.activeKeyboardIndex || i === t.activeMouseIndex, r = (i) => {
1486
- var a;
1487
- (a = t.onMouseEnter) == null || a.call(t, i);
561
+ const t = e, o = W(null), s = (r) => r === t.activeKeyboardIndex || r === t.activeMouseIndex, i = (r) => {
562
+ var l;
563
+ (l = t.onMouseEnter) == null || l.call(t, r);
1488
564
  }, n = () => {
1489
- var i;
1490
- (i = t.onMouseLeave) == null || i.call(t);
1491
- }, l = (i) => {
1492
- var c;
1493
- const a = t.suggestions[i];
1494
- a && ((c = t.onSelect) == null || c.call(t, un(a)));
565
+ var r;
566
+ (r = t.onMouseLeave) == null || r.call(t);
567
+ }, a = (r) => {
568
+ var u;
569
+ const l = t.suggestions[r];
570
+ l && ((u = t.onSelect) == null || u.call(t, it(l)));
1495
571
  };
1496
572
  return K(
1497
573
  () => t.activeKeyboardIndex,
1498
- (i) => {
1499
- if (i !== -1 && o.value) {
1500
- const a = o.value.children[i];
1501
- a && a.scrollIntoView({ block: "nearest" });
574
+ (r) => {
575
+ if (r !== -1 && o.value) {
576
+ const l = o.value.children[r];
577
+ l && l.scrollIntoView({ block: "nearest" });
1502
578
  }
1503
579
  }
1504
- ), (i, a) => (M(), J(an, { name: "suggestion-slide-up" }, {
1505
- default: j(() => [
1506
- t.show && t.suggestions.length ? (M(), P("div", {
580
+ ), (r, l) => (w(), U(st, { name: "suggestion-slide-up" }, {
581
+ default: B(() => [
582
+ t.show && t.suggestions.length ? (w(), P("div", {
1507
583
  key: 0,
1508
584
  ref_key: "suggestionsListRef",
1509
585
  ref: o,
1510
586
  class: "suggestion-list",
1511
- style: cn(t.popupStyle)
587
+ style: rt(t.popupStyle)
1512
588
  }, [
1513
- (M(!0), P(Be, null, Ie(t.suggestions, (c, d) => (M(), P("div", {
1514
- key: d,
1515
- class: Y(["suggestion-list__item", { highlighted: s(d) }]),
1516
- onMouseenter: (u) => r(d),
589
+ (w(!0), P(fe, null, pe(t.suggestions, (u, p) => (w(), P("div", {
590
+ key: p,
591
+ class: V(["suggestion-list__item", { highlighted: s(p) }]),
592
+ onMouseenter: (f) => i(p),
1517
593
  onMouseleave: n,
1518
- onClick: (u) => l(d)
594
+ onClick: (f) => a(p)
1519
595
  }, [
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
- key: g,
1524
- class: Y({
1525
- "suggestion-list__text--match": u.isMatch,
1526
- "suggestion-list__text--normal": !u.isMatch
596
+ Y(A(wt), { class: "suggestion-list__icon" }),
597
+ R("span", Xt, [
598
+ (w(!0), P(fe, null, pe(A(Gt)(u, t.inputValue), (f, E) => (w(), P("span", {
599
+ key: E,
600
+ class: V({
601
+ "suggestion-list__text--match": f.isMatch,
602
+ "suggestion-list__text--normal": !f.isMatch
1527
603
  })
1528
- }, he(u.text), 3))), 128))
604
+ }, ne(f.text), 3))), 128))
1529
605
  ])
1530
- ], 42, $o))), 128))
1531
- ], 4)) : q("", !0)
606
+ ], 42, Ut))), 128))
607
+ ], 4)) : N("", !0)
1532
608
  ]),
1533
609
  _: 1
1534
610
  }));
1535
611
  }
1536
- }), Wo = /* @__PURE__ */ te(No, [["__scopeId", "data-v-76a6f35e"]]), Ko = (e, t) => {
612
+ }), Yt = /* @__PURE__ */ Z(Zt, [["__scopeId", "data-v-76a6f35e"]]), Jt = (e, t) => {
1537
613
  if (!e || !t)
1538
614
  return { text: "", show: !1, showTab: !1 };
1539
615
  const o = e.toLowerCase(), s = t.toLowerCase();
1540
616
  if (!o.startsWith(s))
1541
617
  return { text: "", show: !1, showTab: !1 };
1542
- const r = e.substring(t.length), n = r.length > 0;
618
+ const i = e.substring(t.length), n = i.length > 0;
1543
619
  return {
1544
- text: r,
620
+ text: i,
1545
621
  show: n,
1546
622
  showTab: n
1547
623
  };
1548
- }, z = new le(ue.SUGGESTION);
1549
- function qo(e) {
624
+ }, H = new J(ee.SUGGESTION);
625
+ function Qt(e) {
1550
626
  const {
1551
627
  editor: t,
1552
628
  activeSuggestionKeys: o = ["Enter"],
1553
629
  popupWidth: s = 400,
1554
- showAutoComplete: r = !0,
630
+ showAutoComplete: i = !0,
1555
631
  filterFn: n,
1556
- onSelect: l
632
+ onSelect: a
1557
633
  } = e;
1558
- let i = null, a = null, c = null, d = !1;
1559
- function u() {
1560
- const p = t.extensionManager.extensions.find(
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;
634
+ let r = null, l = null, u = null, p = !1;
635
+ function f() {
636
+ const d = t.extensionManager.extensions.find(
637
+ (_) => _.name === se.SUGGESTION
638
+ ), c = d == null ? void 0 : d.options, b = (c == null ? void 0 : c.items) || (c == null ? void 0 : c.suggestions) || [];
639
+ return b && typeof b == "object" && "value" in b ? b.value : b;
1564
640
  }
1565
- function g(p) {
1566
- const f = u();
1567
- return n ? n(f, p) : f;
641
+ function E(d) {
642
+ const c = f();
643
+ return n ? n(c, d) : c;
1568
644
  }
1569
- function h(p) {
1570
- return p;
645
+ function S(d) {
646
+ return d;
1571
647
  }
1572
- function C(p, f, v) {
1573
- if (p === -1 || !v[p])
648
+ function j(d, c, b) {
649
+ if (d === -1 || !b[d])
1574
650
  return { text: "", show: !1, showTab: !1 };
1575
- const E = v[p];
1576
- return Ko(E.content, f);
651
+ const _ = b[d];
652
+ return Jt(_.content, c);
1577
653
  }
1578
- function w(p, f, v) {
1579
- if (!f) return;
1580
- (l == null ? void 0 : l(v)) !== !1 && t.commands.setContent(v.content), t.commands.focus();
654
+ function L(d, c, b) {
655
+ if (!c) return;
656
+ (a == null ? void 0 : a(b)) !== !1 && t.commands.setContent(b.content), t.commands.focus();
1581
657
  }
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);
658
+ function C(d, c) {
659
+ const b = c.filteredSuggestions[c.selectedIndex];
660
+ b && L(d, c.range, b);
661
+ const _ = d.state.tr;
662
+ _.setMeta(H, { type: "close" }), d.dispatch(_);
1587
663
  }
1588
- function m(p, f) {
1589
- c == null || c();
1590
- const E = p.dom.closest(".tr-sender") || p.dom, T = () => {
664
+ function h(d, c) {
665
+ u == null || u();
666
+ const _ = d.dom.closest(".tr-sender") || d.dom, x = () => {
1591
667
  if (typeof s == "number")
1592
668
  return `${s}px`;
1593
669
  if (typeof s == "string") {
1594
670
  if (s.endsWith("%")) {
1595
- const A = parseFloat(s) / 100;
1596
- return `${E.offsetWidth * A}px`;
671
+ const v = parseFloat(s) / 100;
672
+ return `${_.offsetWidth * v}px`;
1597
673
  }
1598
674
  return s;
1599
675
  }
1600
676
  return "400px";
1601
677
  };
1602
- c = mt(E, f, () => {
1603
- yt(E, f, {
678
+ u = Se(_, c, () => {
679
+ Ce(_, c, {
1604
680
  placement: "top-start",
1605
681
  middleware: [
1606
- ht(8),
1607
- xt({
682
+ Ae(8),
683
+ we({
1608
684
  fallbackPlacements: ["bottom-start", "top-start"]
1609
685
  }),
1610
- gt({ padding: 8 })
686
+ ke({ padding: 8 })
1611
687
  ]
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();
688
+ }).then(({ x: v, y: m }) => {
689
+ c.style.position = "absolute", c.style.left = `${v}px`, c.style.top = `${m}px`, c.style.zIndex = "2000", c.style.width = x();
1614
690
  });
1615
691
  });
1616
692
  }
1617
- function x(p) {
1618
- if (!r || !p.active || !p.autoCompleteText || !p.range)
1619
- return Le.empty;
1620
- const f = t.state.doc, { selection: v } = t.state, E = v.$head.pos;
1621
- if (!(E >= f.content.size - 1))
1622
- return Le.empty;
1623
- const A = Dt.widget(
1624
- E,
693
+ function g(d) {
694
+ if (!i || !d.active || !d.autoCompleteText || !d.range)
695
+ return le.empty;
696
+ const c = t.state.doc, { selection: b } = t.state, _ = b.$head.pos;
697
+ if (!(_ >= c.content.size - 1))
698
+ return le.empty;
699
+ const v = He.widget(
700
+ _,
1625
701
  () => {
1626
- const y = document.createElement("span");
1627
- y.className = "suggestion-autocomplete", y.contentEditable = "false";
1628
- const L = document.createElement("span");
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);
702
+ const m = document.createElement("span");
703
+ m.className = "suggestion-autocomplete", m.contentEditable = "false";
704
+ const k = document.createElement("span");
705
+ if (k.className = "autocomplete-text", k.textContent = d.autoCompleteText, m.appendChild(k), d.showTabIndicator) {
706
+ const $ = document.createElement("span");
707
+ $.className = "tab-hint", $.textContent = "TAB", m.appendChild($);
1632
708
  }
1633
- return y;
709
+ return m;
1634
710
  },
1635
711
  {
1636
712
  side: 1
1637
713
  // 显示在光标右侧
1638
714
  }
1639
715
  );
1640
- return Le.create(f, [A]);
716
+ return le.create(c, [v]);
1641
717
  }
1642
- return new ae({
1643
- key: z,
718
+ return new Q({
719
+ key: H,
1644
720
  state: {
1645
721
  init() {
1646
722
  return {
@@ -1653,12 +729,12 @@ function qo(e) {
1653
729
  showTabIndicator: !1
1654
730
  };
1655
731
  },
1656
- apply(p, f) {
1657
- const v = p.getMeta(z);
1658
- if (v) {
1659
- if (v.type === "close")
1660
- return d = !0, setTimeout(() => {
1661
- d = !1;
732
+ apply(d, c) {
733
+ const b = d.getMeta(H);
734
+ if (b) {
735
+ if (b.type === "close")
736
+ return p = !0, setTimeout(() => {
737
+ p = !1;
1662
738
  }, 0), {
1663
739
  active: !1,
1664
740
  range: null,
@@ -1668,19 +744,19 @@ function qo(e) {
1668
744
  autoCompleteText: "",
1669
745
  showTabIndicator: !1
1670
746
  };
1671
- if (v.type === "updateIndex") {
1672
- const L = { ...f, selectedIndex: v.index }, I = C(v.index, f.query, f.filteredSuggestions);
747
+ if (b.type === "updateIndex") {
748
+ const k = { ...c, selectedIndex: b.index }, $ = j(b.index, c.query, c.filteredSuggestions);
1673
749
  return {
1674
- ...L,
1675
- autoCompleteText: I.text,
1676
- showTabIndicator: I.showTab
750
+ ...k,
751
+ autoCompleteText: $.text,
752
+ showTabIndicator: $.showTab
1677
753
  };
1678
754
  }
1679
755
  }
1680
- if (d || !p.docChanged && !p.selectionSet)
1681
- return f;
1682
- const E = p.doc.textContent.trim(), T = E;
1683
- if (!E)
756
+ if (p || !d.docChanged && !d.selectionSet)
757
+ return c;
758
+ const _ = d.doc.textContent.trim(), x = _;
759
+ if (!_)
1684
760
  return {
1685
761
  active: !1,
1686
762
  range: null,
@@ -1690,8 +766,8 @@ function qo(e) {
1690
766
  autoCompleteText: "",
1691
767
  showTabIndicator: !1
1692
768
  };
1693
- const A = g(T);
1694
- if (A.length === 0)
769
+ const v = E(x);
770
+ if (v.length === 0)
1695
771
  return {
1696
772
  active: !1,
1697
773
  range: null,
@@ -1701,23 +777,23 @@ function qo(e) {
1701
777
  autoCompleteText: "",
1702
778
  showTabIndicator: !1
1703
779
  };
1704
- const y = C(0, T, A);
780
+ const m = j(0, x, v);
1705
781
  return {
1706
782
  active: !0,
1707
- range: { from: 0, to: p.doc.content.size },
1708
- query: T,
1709
- filteredSuggestions: A,
783
+ range: { from: 0, to: d.doc.content.size },
784
+ query: x,
785
+ filteredSuggestions: v,
1710
786
  selectedIndex: 0,
1711
- autoCompleteText: y.text,
1712
- showTabIndicator: y.showTab
787
+ autoCompleteText: m.text,
788
+ showTabIndicator: m.showTab
1713
789
  };
1714
790
  }
1715
791
  },
1716
792
  props: {
1717
- decorations(p) {
1718
- const f = this.getState(p);
1719
- return x(
1720
- f || {
793
+ decorations(d) {
794
+ const c = this.getState(d);
795
+ return g(
796
+ c || {
1721
797
  active: !1,
1722
798
  range: null,
1723
799
  autoCompleteText: "",
@@ -1725,79 +801,79 @@ function qo(e) {
1725
801
  }
1726
802
  );
1727
803
  },
1728
- handleKeyDown(p, f) {
1729
- const v = z.getState(p.state);
1730
- if (!(v != null && v.active))
804
+ handleKeyDown(d, c) {
805
+ const b = H.getState(d.state);
806
+ if (!(b != null && b.active))
1731
807
  return !1;
1732
- if (B(f, "TAB") && v.autoCompleteText)
1733
- return f.preventDefault(), b(p, v), !0;
1734
- if (we(f, ["ARROW_UP", "ARROW_DOWN"])) {
1735
- f.preventDefault();
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, {
808
+ if (I(c, "TAB") && b.autoCompleteText)
809
+ return c.preventDefault(), C(d, b), !0;
810
+ if (ie(c, ["ARROW_UP", "ARROW_DOWN"])) {
811
+ c.preventDefault();
812
+ const _ = I(c, "ARROW_DOWN") ? 1 : -1, x = b.filteredSuggestions.length;
813
+ let v = b.selectedIndex + _;
814
+ v < 0 ? v = x - 1 : v >= x && (v = 0);
815
+ const m = d.state.tr;
816
+ return m.setMeta(H, {
1741
817
  type: "updateIndex",
1742
- index: A
1743
- }), p.dispatch(y), !0;
818
+ index: v
819
+ }), d.dispatch(m), !0;
1744
820
  }
1745
- if (o.includes(f.key))
1746
- return f.preventDefault(), b(p, v), !0;
1747
- if (B(f, "ESCAPE")) {
1748
- f.preventDefault();
1749
- const E = p.state.tr;
1750
- return E.setMeta(z, { type: "close" }), p.dispatch(E), !0;
821
+ if (o.includes(c.key))
822
+ return c.preventDefault(), C(d, b), !0;
823
+ if (I(c, "ESCAPE")) {
824
+ c.preventDefault();
825
+ const _ = d.state.tr;
826
+ return _.setMeta(H, { type: "close" }), d.dispatch(_), !0;
1751
827
  }
1752
828
  return !1;
1753
829
  }
1754
830
  },
1755
831
  view() {
1756
832
  return {
1757
- update(p) {
1758
- const f = z.getState(p.state);
1759
- f != null && f.active && f.filteredSuggestions.length > 0 ? (i ? i.updateProps({
1760
- show: f.active && f.filteredSuggestions.length > 0,
1761
- suggestions: f.filteredSuggestions,
833
+ update(d) {
834
+ const c = H.getState(d.state);
835
+ c != null && c.active && c.filteredSuggestions.length > 0 ? (r ? r.updateProps({
836
+ show: c.active && c.filteredSuggestions.length > 0,
837
+ suggestions: c.filteredSuggestions,
1762
838
  popupStyle: {
1763
839
  // 宽度在 computePosition 回调中动态设置,这里只设置 maxWidth
1764
840
  maxWidth: "100%"
1765
841
  },
1766
- activeKeyboardIndex: f.selectedIndex,
1767
- inputValue: f.query
1768
- }) : (i = new Ot(Wo, {
842
+ activeKeyboardIndex: c.selectedIndex,
843
+ inputValue: c.query
844
+ }) : (r = new Ne(Yt, {
1769
845
  props: {
1770
- show: f.active && f.filteredSuggestions.length > 0,
1771
- suggestions: f.filteredSuggestions,
846
+ show: c.active && c.filteredSuggestions.length > 0,
847
+ suggestions: c.filteredSuggestions,
1772
848
  popupStyle: {
1773
849
  // 宽度在 computePosition 回调中动态设置,这里只设置 maxWidth
1774
850
  maxWidth: "100%"
1775
851
  },
1776
- activeKeyboardIndex: f.selectedIndex,
852
+ activeKeyboardIndex: c.selectedIndex,
1777
853
  activeMouseIndex: -1,
1778
- inputValue: f.query,
1779
- onSelect: (v) => {
1780
- w(p, f.range, v);
1781
- const E = p.state.tr;
1782
- E.setMeta(z, { type: "close" }), p.dispatch(E);
854
+ inputValue: c.query,
855
+ onSelect: (b) => {
856
+ L(d, c.range, b);
857
+ const _ = d.state.tr;
858
+ _.setMeta(H, { type: "close" }), d.dispatch(_);
1783
859
  },
1784
- onMouseEnter: (v) => {
1785
- const E = p.state.tr;
1786
- E.setMeta(z, { type: "updateIndex", index: v }), p.dispatch(E);
860
+ onMouseEnter: (b) => {
861
+ const _ = d.state.tr;
862
+ _.setMeta(H, { type: "updateIndex", index: b }), d.dispatch(_);
1787
863
  }
1788
864
  },
1789
865
  editor: t
1790
- }), a = i.element, document.body.appendChild(a)), a && m(p, a)) : (i && (c == null || c(), c = null, i.destroy(), i = null), a && (a.remove(), a = null));
866
+ }), l = r.element, document.body.appendChild(l)), l && h(d, l)) : (r && (u == null || u(), u = null, r.destroy(), r = null), l && (l.remove(), l = null));
1791
867
  },
1792
868
  destroy() {
1793
- c == null || c(), i == null || i.destroy(), a == null || a.remove();
869
+ u == null || u(), r == null || r.destroy(), l == null || l.remove();
1794
870
  }
1795
871
  };
1796
872
  }
1797
873
  });
1798
874
  }
1799
- const Xt = Bt.create({
1800
- name: be.SUGGESTION,
875
+ const Ge = We.create({
876
+ name: se.SUGGESTION,
1801
877
  addOptions() {
1802
878
  return {
1803
879
  items: [],
@@ -1813,11 +889,11 @@ const Xt = Bt.create({
1813
889
  };
1814
890
  },
1815
891
  onCreate() {
1816
- ke(this.options.items) && (this.storage.watchStopHandle = K(
892
+ ce(this.options.items) && (this.storage.watchStopHandle = K(
1817
893
  this.options.items,
1818
894
  () => {
1819
895
  const e = this.editor.state.tr;
1820
- e.setMeta(z, { type: "update" }), this.editor.view.dispatch(e);
896
+ e.setMeta(H, { type: "update" }), this.editor.view.dispatch(e);
1821
897
  },
1822
898
  { deep: !0 }
1823
899
  ));
@@ -1827,26 +903,26 @@ const Xt = Bt.create({
1827
903
  },
1828
904
  addProseMirrorPlugins() {
1829
905
  return [
1830
- qo({
906
+ Qt({
1831
907
  editor: this.editor,
1832
908
  ...this.options
1833
909
  })
1834
910
  ];
1835
911
  }
1836
912
  });
1837
- function Ho(e, t) {
1838
- return Xt.configure({
913
+ function en(e, t) {
914
+ return Ge.configure({
1839
915
  items: e,
1840
916
  ...t
1841
917
  });
1842
918
  }
1843
- function zo(e) {
919
+ function tn(e) {
1844
920
  const t = [];
1845
921
  return e.state.doc.descendants((o, s) => {
1846
- o.type.name === _.TEMPLATE_BLOCK && t.push({ node: o, pos: s });
922
+ o.type.name === T.TEMPLATE_BLOCK && t.push({ node: o, pos: s });
1847
923
  }), t;
1848
924
  }
1849
- const Fo = {
925
+ const nn = {
1850
926
  /**
1851
927
  * 设置模板数据(批量)
1852
928
  */
@@ -1854,32 +930,32 @@ const Fo = {
1854
930
  t.clearContent();
1855
931
  const o = [];
1856
932
  return e.forEach((s) => {
1857
- s.type === Z.TEXT ? s.content && o.push({
1858
- type: _.TEXT,
933
+ s.type === G.TEXT ? s.content && o.push({
934
+ type: T.TEXT,
1859
935
  text: s.content
1860
- }) : s.type === Z.BLOCK ? o.push({
1861
- type: _.TEMPLATE_BLOCK,
936
+ }) : s.type === G.BLOCK ? o.push({
937
+ type: T.TEMPLATE_BLOCK,
1862
938
  attrs: {
1863
- id: s.id || ve("template"),
939
+ id: s.id || re("template"),
1864
940
  content: s.content
1865
941
  },
1866
942
  content: s.content ? [
1867
943
  {
1868
- type: _.TEXT,
944
+ type: T.TEXT,
1869
945
  text: s.content
1870
946
  }
1871
947
  ] : []
1872
- }) : s.type === Z.SELECT && o.push({
1873
- type: _.TEMPLATE_SELECT,
948
+ }) : s.type === G.SELECT && o.push({
949
+ type: T.TEMPLATE_SELECT,
1874
950
  attrs: {
1875
- id: s.id || ve("select"),
951
+ id: s.id || re("select"),
1876
952
  placeholder: s.placeholder,
1877
953
  options: s.options,
1878
954
  value: s.value || null
1879
955
  }
1880
956
  });
1881
957
  }), o.length > 0 && t.insertContent({
1882
- type: _.PARAGRAPH,
958
+ type: T.PARAGRAPH,
1883
959
  content: o
1884
960
  }), !0;
1885
961
  },
@@ -1889,14 +965,14 @@ const Fo = {
1889
965
  insertTemplate: (e) => ({ commands: t }) => {
1890
966
  const o = e.content || "";
1891
967
  return t.insertContent({
1892
- type: _.TEMPLATE_BLOCK,
968
+ type: T.TEMPLATE_BLOCK,
1893
969
  attrs: {
1894
- id: e.id || ve("template"),
970
+ id: e.id || re("template"),
1895
971
  content: o
1896
972
  },
1897
973
  content: o ? [
1898
974
  {
1899
- type: _.TEXT,
975
+ type: T.TEXT,
1900
976
  text: o
1901
977
  }
1902
978
  ] : []
@@ -1906,22 +982,22 @@ const Fo = {
1906
982
  * 聚焦到第一个模板块
1907
983
  */
1908
984
  focusFirstTemplate: () => ({ editor: e }) => {
1909
- const t = zo(e);
985
+ const t = tn(e);
1910
986
  return setTimeout(() => {
1911
987
  var n;
1912
- const { state: o, view: s } = e, r = o.tr;
988
+ const { state: o, view: s } = e, i = o.tr;
1913
989
  try {
1914
- let l;
990
+ let a;
1915
991
  if (t.length === 0)
1916
- l = o.doc.content.size - 1;
992
+ a = o.doc.content.size - 1;
1917
993
  else {
1918
- const { node: a, pos: c } = t[0], d = ((n = a.textContent) == null ? void 0 : n.length) || 0;
1919
- l = c + 1 + d;
994
+ const { node: l, pos: u } = t[0], p = ((n = l.textContent) == null ? void 0 : n.length) || 0;
995
+ a = u + 1 + p;
1920
996
  }
1921
- const i = O.create(o.doc, l);
1922
- r.setSelection(i), s.dispatch(r), s.focus();
1923
- } catch (l) {
1924
- console.error("[focusFirstTemplate] 设置光标失败", l);
997
+ const r = D.create(o.doc, a);
998
+ i.setSelection(r), s.dispatch(i), s.focus();
999
+ } catch (a) {
1000
+ console.error("[focusFirstTemplate] 设置光标失败", a);
1925
1001
  }
1926
1002
  }, 0), !0;
1927
1003
  },
@@ -1929,40 +1005,40 @@ const Fo = {
1929
1005
  * 插入选择器
1930
1006
  */
1931
1007
  insertTemplateSelect: (e) => ({ commands: t }) => t.insertContent({
1932
- type: _.TEMPLATE_SELECT,
1008
+ type: T.TEMPLATE_SELECT,
1933
1009
  attrs: {
1934
- id: e.id || ve("select"),
1010
+ id: e.id || re("select"),
1935
1011
  placeholder: e.placeholder || "Please select",
1936
1012
  options: e.options || [],
1937
1013
  value: e.value || null
1938
1014
  }
1939
1015
  })
1940
- }, S = "​";
1941
- function tt(e) {
1942
- return Yt(e).map((o) => o.content).join("");
1016
+ }, y = "​";
1017
+ function be(e) {
1018
+ return Ue(e).map((o) => o.content).join("");
1943
1019
  }
1944
- function Yt(e) {
1020
+ function Ue(e) {
1945
1021
  const t = [];
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"), "");
1022
+ return e.state.doc.descendants((o, s, i) => {
1023
+ if (i && i.type.name === T.PARAGRAPH) {
1024
+ if (o.type.name === T.TEMPLATE_BLOCK) {
1025
+ const n = (o.textContent || "").replace(new RegExp(y, "g"), "");
1950
1026
  t.push({
1951
- type: Z.BLOCK,
1027
+ type: G.BLOCK,
1952
1028
  content: n
1953
1029
  });
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) || "";
1030
+ } else if (o.type.name === T.TEMPLATE_SELECT) {
1031
+ const n = o.attrs.options.find((r) => r.value === o.attrs.value), a = (n == null ? void 0 : n.value) || "";
1956
1032
  t.push({
1957
- type: Z.SELECT,
1958
- content: l
1033
+ type: G.SELECT,
1034
+ content: a
1959
1035
  });
1960
- } else if (o.type.name === _.TEXT) {
1961
- const n = (o.text || "").replace(new RegExp(S, "g"), "");
1036
+ } else if (o.type.name === T.TEXT) {
1037
+ const n = (o.text || "").replace(new RegExp(y, "g"), "");
1962
1038
  if (n) {
1963
- const l = t[t.length - 1];
1964
- l && l.type === Z.TEXT ? l.content += n : t.push({
1965
- type: Z.TEXT,
1039
+ const a = t[t.length - 1];
1040
+ a && a.type === G.TEXT ? a.content += n : t.push({
1041
+ type: G.TEXT,
1966
1042
  content: n
1967
1043
  });
1968
1044
  }
@@ -1970,31 +1046,31 @@ function Yt(e) {
1970
1046
  }
1971
1047
  }), t;
1972
1048
  }
1973
- const Vo = /* @__PURE__ */ V({
1049
+ const on = /* @__PURE__ */ X({
1974
1050
  __name: "template-block-view",
1975
1051
  props: {
1976
1052
  node: {}
1977
1053
  },
1978
1054
  setup(e) {
1979
- const t = e, o = R(() => {
1055
+ const t = e, o = M(() => {
1980
1056
  const s = t.node.textContent || "";
1981
- return s.length === 0 || s === S;
1057
+ return s.length === 0 || s === y;
1982
1058
  });
1983
- return (s, r) => (M(), J(k(lt), {
1059
+ return (s, i) => (w(), U(A(Ee), {
1984
1060
  as: "span",
1985
- class: Y(["template-block", { "is-empty": o.value }]),
1061
+ class: V(["template-block", { "is-empty": o.value }]),
1986
1062
  "data-id": e.node.attrs.id
1987
1063
  }, {
1988
- default: j(() => [
1989
- r[0] || (r[0] = $("span", {
1064
+ default: B(() => [
1065
+ i[0] || (i[0] = R("span", {
1990
1066
  contenteditable: "false",
1991
1067
  class: "template-block__prefix"
1992
1068
  }, " ", -1)),
1993
- ie(k(vn), {
1069
+ Y(A(ht), {
1994
1070
  as: "span",
1995
1071
  class: "template-block__content"
1996
1072
  }),
1997
- r[1] || (r[1] = $("span", {
1073
+ i[1] || (i[1] = R("span", {
1998
1074
  contenteditable: "false",
1999
1075
  class: "template-block__suffix"
2000
1076
  }, " ", -1))
@@ -2002,237 +1078,237 @@ const Vo = /* @__PURE__ */ V({
2002
1078
  _: 1
2003
1079
  }, 8, ["class", "data-id"]));
2004
1080
  }
2005
- }), Go = /* @__PURE__ */ te(Vo, [["__scopeId", "data-v-aa55b9db"]]);
2006
- function Uo(e) {
1081
+ }), sn = /* @__PURE__ */ Z(on, [["__scopeId", "data-v-aa55b9db"]]);
1082
+ function rn(e) {
2007
1083
  const t = [];
2008
1084
  let { tr: o } = e;
2009
- return e.doc.descendants((s, r, n) => {
2010
- if (s.type.name === _.PARAGRAPH && s.childCount > 0) {
2011
- const { lastChild: l, firstChild: i } = s;
2012
- if (i && i.type.name === _.TEMPLATE_BLOCK && t.push(r + 1), l && l.type.name === _.TEMPLATE_BLOCK) {
2013
- const a = r + s.nodeSize - 1;
2014
- o.doc.textBetween(a - 1, a, "", "") !== S && t.push(a);
1085
+ return e.doc.descendants((s, i, n) => {
1086
+ if (s.type.name === T.PARAGRAPH && s.childCount > 0) {
1087
+ const { lastChild: a, firstChild: r } = s;
1088
+ if (r && r.type.name === T.TEMPLATE_BLOCK && t.push(i + 1), a && a.type.name === T.TEMPLATE_BLOCK) {
1089
+ const l = i + s.nodeSize - 1;
1090
+ o.doc.textBetween(l - 1, l, "", "") !== y && t.push(l);
2015
1091
  }
2016
- l === i && l && l.isText && l.text === S && t.push(["remove", r + 1]);
1092
+ a === r && a && a.isText && a.text === y && t.push(["remove", i + 1]);
2017
1093
  }
2018
- if (s.type.name === _.TEMPLATE_BLOCK && s.content.size === 0 && t.push(r + 1), s.type.name === _.TEMPLATE_BLOCK && n) {
2019
- let l = -1;
2020
- if (n.forEach((i, a, c) => {
2021
- i === s && (l = c);
2022
- }), l > -1 && l < n.childCount - 1 && n.child(l + 1).type.name === _.TEMPLATE_BLOCK) {
2023
- const a = r + s.nodeSize;
2024
- o.doc.textBetween(a, a + 1, "", "") !== S && t.push(a);
1094
+ if (s.type.name === T.TEMPLATE_BLOCK && s.content.size === 0 && t.push(i + 1), s.type.name === T.TEMPLATE_BLOCK && n) {
1095
+ let a = -1;
1096
+ if (n.forEach((r, l, u) => {
1097
+ r === s && (a = u);
1098
+ }), a > -1 && a < n.childCount - 1 && n.child(a + 1).type.name === T.TEMPLATE_BLOCK) {
1099
+ const l = i + s.nodeSize;
1100
+ o.doc.textBetween(l, l + 1, "", "") !== y && t.push(l);
2025
1101
  }
2026
1102
  }
2027
- }), t.length > 0 ? (t.sort((s, r) => {
1103
+ }), t.length > 0 ? (t.sort((s, i) => {
2028
1104
  const n = Array.isArray(s) ? s[1] : s;
2029
- return (Array.isArray(r) ? r[1] : r) - n;
1105
+ return (Array.isArray(i) ? i[1] : i) - n;
2030
1106
  }).forEach((s) => {
2031
- Array.isArray(s) && s[0] === "remove" ? o = o.delete(s[1], s[1] + 1) : typeof s == "number" && (o = o.insertText(S, s, s));
1107
+ Array.isArray(s) && s[0] === "remove" ? o = o.delete(s[1], s[1] + 1) : typeof s == "number" && (o = o.insertText(y, s, s));
2032
1108
  }), o) : null;
2033
1109
  }
2034
- function Xo() {
2035
- return new ae({
2036
- key: new le(ue.TEMPLATE_BLOCK_ZERO_WIDTH),
1110
+ function an() {
1111
+ return new Q({
1112
+ key: new J(ee.TEMPLATE_BLOCK_ZERO_WIDTH),
2037
1113
  appendTransaction(e, t, o) {
2038
- return e.some((r) => r.docChanged) ? Uo(o) : null;
1114
+ return e.some((i) => i.docChanged) ? rn(o) : null;
2039
1115
  }
2040
1116
  });
2041
1117
  }
2042
- function Yo() {
2043
- return new ae({
2044
- key: new le(ue.TEMPLATE_BLOCK_KEYBOARD),
1118
+ function ln() {
1119
+ return new Q({
1120
+ key: new J(ee.TEMPLATE_BLOCK_KEYBOARD),
2045
1121
  props: {
2046
1122
  handleKeyDown(e, t) {
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
- if (m >= 2) {
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;
1123
+ var r, l, u, p, f, E, S, j, L;
1124
+ const { state: o, dispatch: s } = e, { selection: i } = o, { $from: n } = i;
1125
+ if (I(t, "ARROW_LEFT") && n.nodeBefore && n.nodeBefore.isText && n.nodeBefore.text && n.nodeBefore.text === y) {
1126
+ const C = n.parent, h = n.index();
1127
+ if (h >= 2) {
1128
+ if (C.child(h - 2).type.name === T.TEMPLATE_BLOCK) {
1129
+ const d = n.pos - 2;
1130
+ return s(o.tr.setSelection(D.create(o.doc, d))), t.preventDefault(), !0;
2055
1131
  }
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;
1132
+ } else if (h === 1 && n.pos !== 0) {
1133
+ const g = n.before() - 1;
1134
+ if (g >= 0)
1135
+ return s(o.tr.setSelection(D.create(o.doc, g))), t.preventDefault(), !0;
2060
1136
  }
2061
1137
  }
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;
1138
+ if (I(t, "ARROW_RIGHT") && n.nodeAfter && n.nodeAfter.isText && n.nodeAfter.text === y) {
1139
+ const C = n.parent, h = n.index();
1140
+ if (h < C.childCount - 1) {
1141
+ if (C.child(h + 1).type.name === T.TEMPLATE_BLOCK) {
1142
+ const d = n.pos + 2;
1143
+ return s(o.tr.setSelection(D.create(o.doc, d))), t.preventDefault(), !0;
2068
1144
  }
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;
1145
+ } else if (h === C.childCount - 1 && o.doc.lastChild !== n.node()) {
1146
+ const g = n.after() + 1;
1147
+ return s(o.tr.setSelection(D.create(o.doc, g))), t.preventDefault(), !0;
2072
1148
  }
2073
1149
  }
2074
- const l = n.node();
2075
- if (l.type.name === _.TEMPLATE_BLOCK) {
2076
- const b = l.textContent || "";
2077
- if (b === "" || b === S) {
2078
- if (we(t, ["ARROW_LEFT", "ARROW_RIGHT"])) {
2079
- const m = B(t, "ARROW_LEFT") ? n.before() : n.after();
2080
- if (r.from !== m)
2081
- return s(o.tr.setSelection(O.create(o.doc, m))), t.preventDefault(), !0;
1150
+ const a = n.node();
1151
+ if (a.type.name === T.TEMPLATE_BLOCK) {
1152
+ const C = a.textContent || "";
1153
+ if (C === "" || C === y) {
1154
+ if (ie(t, ["ARROW_LEFT", "ARROW_RIGHT"])) {
1155
+ const h = I(t, "ARROW_LEFT") ? n.before() : n.after();
1156
+ if (i.from !== h)
1157
+ return s(o.tr.setSelection(D.create(o.doc, h))), t.preventDefault(), !0;
2082
1158
  }
2083
1159
  } else {
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;
1160
+ if (I(t, "ARROW_LEFT") && n.pos === n.start()) {
1161
+ const h = n.before();
1162
+ return s(o.tr.setSelection(D.create(o.doc, h))), t.preventDefault(), !0;
2087
1163
  }
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;
1164
+ if (I(t, "ARROW_RIGHT") && n.pos === n.end()) {
1165
+ const h = n.after();
1166
+ return s(o.tr.setSelection(D.create(o.doc, h))), t.preventDefault(), !0;
2091
1167
  }
2092
1168
  }
2093
1169
  }
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;
1170
+ if (I(t, "BACKSPACE") && i.empty) {
1171
+ const C = n.node(), h = n.nodeBefore;
1172
+ if (C.type.name === T.TEMPLATE_BLOCK) {
1173
+ const g = C.textContent || "";
1174
+ if (n.pos === n.end() && g.length === 1 && g !== y) {
1175
+ const d = n.pos - 1;
1176
+ return s(o.tr.insertText(y, d, d + 1)), t.preventDefault(), !0;
2101
1177
  }
2102
- if (x === S) {
2103
- const p = n.before(), f = o.tr.setSelection(O.create(o.doc, p));
2104
- return s(f), t.preventDefault(), !0;
1178
+ if (g === y) {
1179
+ const d = n.before(), c = o.tr.setSelection(D.create(o.doc, d));
1180
+ return s(c), t.preventDefault(), !0;
2105
1181
  }
2106
- if (x === "") {
2107
- const p = n.before(), f = o.tr.setSelection(O.create(o.doc, p));
2108
- return s(f), t.preventDefault(), !0;
1182
+ if (g === "") {
1183
+ const d = n.before(), c = o.tr.setSelection(D.create(o.doc, d));
1184
+ return s(c), t.preventDefault(), !0;
2109
1185
  }
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;
1186
+ if (n.pos === n.start() && g.length > 0 && g !== y) {
1187
+ const d = n.before();
1188
+ return s(o.tr.setSelection(D.create(o.doc, d))), t.preventDefault(), !0;
2113
1189
  }
2114
1190
  return !1;
2115
1191
  }
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;
1192
+ if (h && h.isText && ((r = h.text) == null ? void 0 : r.length) === 1 && h.text !== y && n.nodeAfter && n.nodeAfter.type.name === T.TEMPLATE_BLOCK) {
1193
+ const g = n.pos - h.nodeSize, d = n.pos;
1194
+ let c = o.tr.delete(g, d);
1195
+ return c = c.insertText(y, g, g), s(c), t.preventDefault(), !0;
2120
1196
  }
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);
1197
+ if (h && h.type.name === T.TEMPLATE_BLOCK) {
1198
+ const g = h.textContent || "";
1199
+ if (g.length === 0 || g === y) {
1200
+ const c = n.parent, b = n.index(), _ = n.nodeAfter;
1201
+ let x = n.pos - h.nodeSize, v = n.pos;
1202
+ if (b > 1) {
1203
+ const m = c.child(b - 2);
1204
+ m && m.isText && m.text === y && (x = x - 1);
2129
1205
  }
2130
- return E && E.isText && ((a = E.text) != null && a.startsWith(S)) && (A = A + 1), s(o.tr.delete(T, A)), t.preventDefault(), !0;
1206
+ return _ && _.isText && ((l = _.text) != null && l.startsWith(y)) && (v = v + 1), s(o.tr.delete(x, v)), t.preventDefault(), !0;
2131
1207
  } else {
2132
- const f = n.pos - 1;
2133
- return s(o.tr.setSelection(O.create(o.doc, f))), t.preventDefault(), !0;
1208
+ const c = n.pos - 1;
1209
+ return s(o.tr.setSelection(D.create(o.doc, c))), t.preventDefault(), !0;
2134
1210
  }
2135
1211
  }
2136
- if (m && m.isText) {
2137
- const x = n.parent, p = n.index();
2138
- if (m.text === S) {
2139
- if (p > 1) {
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;
1212
+ if (h && h.isText) {
1213
+ const g = n.parent, d = n.index();
1214
+ if (h.text === y) {
1215
+ if (d > 1) {
1216
+ const c = g.child(d - 2);
1217
+ if (c.type.name === T.TEMPLATE_BLOCK) {
1218
+ const b = c.textContent || "";
1219
+ if (b.length === 0 || b === y) {
1220
+ const x = n.pos - h.nodeSize - c.nodeSize, v = n.nodeAfter;
1221
+ let m = n.pos;
1222
+ return v && v.isText && v.text === y && (m = m + 1), s(o.tr.delete(x, m)), t.preventDefault(), !0;
2147
1223
  } else {
2148
- const T = n.pos - 2;
2149
- if (T >= 0)
2150
- return s(o.tr.setSelection(O.create(o.doc, T))), t.preventDefault(), !0;
1224
+ const x = n.pos - 2;
1225
+ if (x >= 0)
1226
+ return s(o.tr.setSelection(D.create(o.doc, x))), t.preventDefault(), !0;
2151
1227
  }
2152
1228
  }
2153
1229
  }
2154
- } else if (p === 1 && n.pos !== 1 && m.text === S) {
2155
- const f = r.from - 1 - 2;
2156
- if (f >= 0)
2157
- return s(o.tr.delete(f, r.to)), t.preventDefault(), !0;
1230
+ } else if (d === 1 && n.pos !== 1 && h.text === y) {
1231
+ const c = i.from - 1 - 2;
1232
+ if (c >= 0)
1233
+ return s(o.tr.delete(c, i.to)), t.preventDefault(), !0;
2158
1234
  }
2159
1235
  }
2160
1236
  }
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
- return s(f), t.preventDefault(), !0;
1237
+ if (I(t, "BACKSPACE") && !i.empty) {
1238
+ let C = i.from, h = i.to;
1239
+ const g = n.nodeBefore, d = n.nodeAfter;
1240
+ if (g && g.isText && ((u = g.text) != null && u.endsWith(y)) && (C -= 1), d && d.isText && ((p = d.text) != null && p.startsWith(y)) && (h += 1), C !== i.from || h !== i.to) {
1241
+ const c = o.tr.delete(C, h);
1242
+ return s(c), t.preventDefault(), !0;
2167
1243
  }
2168
1244
  }
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;
1245
+ if (I(t, "DELETE") && i.empty) {
1246
+ const C = n.node(), h = n.nodeAfter;
1247
+ if (C.type.name === T.TEMPLATE_BLOCK) {
1248
+ const g = C.textContent || "";
1249
+ if (n.pos === n.start() && g.length === 1 && g !== y) {
1250
+ const d = n.pos;
1251
+ return s(o.tr.insertText(y, d, d + 1)), t.preventDefault(), !0;
2176
1252
  }
2177
- if (x === S) {
2178
- const p = n.after(), f = o.tr.setSelection(O.create(o.doc, p));
2179
- return s(f), t.preventDefault(), !0;
1253
+ if (g === y) {
1254
+ const d = n.after(), c = o.tr.setSelection(D.create(o.doc, d));
1255
+ return s(c), t.preventDefault(), !0;
2180
1256
  }
2181
- if (x === "") {
2182
- const p = n.after(), f = o.tr.setSelection(O.create(o.doc, p));
2183
- return s(f), t.preventDefault(), !0;
1257
+ if (g === "") {
1258
+ const d = n.after(), c = o.tr.setSelection(D.create(o.doc, d));
1259
+ return s(c), t.preventDefault(), !0;
2184
1260
  }
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;
1261
+ if (n.pos === n.end() && g.length > 0 && g !== y) {
1262
+ const d = n.after();
1263
+ return s(o.tr.setSelection(D.create(o.doc, d))), t.preventDefault(), !0;
2188
1264
  }
2189
1265
  return !1;
2190
1266
  }
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;
1267
+ if (h && h.isText && ((f = h.text) == null ? void 0 : f.length) === 1 && h.text !== y && n.nodeBefore && n.nodeBefore.type.name === T.TEMPLATE_BLOCK) {
1268
+ const g = n.pos, d = n.pos + h.nodeSize;
1269
+ let c = o.tr.delete(g, d);
1270
+ return c = c.insertText(y, g, g), s(c), t.preventDefault(), !0;
2195
1271
  }
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);
1272
+ if (h && h.type.name === T.TEMPLATE_BLOCK) {
1273
+ const g = h.textContent || "";
1274
+ if (g.length === 0 || g === y) {
1275
+ const c = n.parent, b = n.index(), _ = n.nodeBefore;
1276
+ let x = n.pos, v = n.pos + h.nodeSize;
1277
+ if (_ && _.isText && _.text === y && (x = x - 1), b < c.childCount - 1) {
1278
+ const m = c.child(b + 1);
1279
+ m && m.isText && m.text === y && (v = v + 1);
2204
1280
  }
2205
- return s(o.tr.delete(T, A)), t.preventDefault(), !0;
1281
+ return s(o.tr.delete(x, v)), t.preventDefault(), !0;
2206
1282
  } else {
2207
- const f = n.pos + 1;
2208
- return s(o.tr.setSelection(O.create(o.doc, f))), t.preventDefault(), !0;
1283
+ const c = n.pos + 1;
1284
+ return s(o.tr.setSelection(D.create(o.doc, c))), t.preventDefault(), !0;
2209
1285
  }
2210
1286
  }
2211
- if (m && m.isText) {
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;
1287
+ if (h && h.isText) {
1288
+ const g = n.parent, d = n.index();
1289
+ if (d < g.childCount - 1) {
1290
+ const c = g.child(d + 1);
1291
+ if (c.type.name === T.TEMPLATE_BLOCK) {
1292
+ const b = c.textContent || "";
1293
+ if (b.length === 0 || b === y) {
1294
+ let x = n.pos;
1295
+ const v = n.pos + h.nodeSize + c.nodeSize, m = n.nodeBefore;
1296
+ return m && m.isText && ((E = m.text) != null && E.endsWith(y)) && (x = x - 1), s(o.tr.delete(x, v)), t.preventDefault(), !0;
2221
1297
  }
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;
1298
+ if (h.text === y || (S = h.text) != null && S.startsWith(y)) {
1299
+ const x = n.pos + 2;
1300
+ return s(o.tr.setSelection(D.create(o.doc, x))), t.preventDefault(), !0;
2225
1301
  }
2226
1302
  }
2227
1303
  }
2228
1304
  }
2229
1305
  }
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
- return s(f), t.preventDefault(), !0;
1306
+ if (I(t, "DELETE") && !i.empty) {
1307
+ let C = i.from, h = i.to;
1308
+ const g = n.nodeBefore, d = n.nodeAfter;
1309
+ if (g && g.isText && ((j = g.text) != null && j.endsWith(y)) && (C -= 1), d && d.isText && ((L = d.text) != null && L.startsWith(y)) && (h += 1), C !== i.from || h !== i.to) {
1310
+ const c = o.tr.delete(C, h);
1311
+ return s(c), t.preventDefault(), !0;
2236
1312
  }
2237
1313
  }
2238
1314
  return !1;
@@ -2240,43 +1316,43 @@ function Yo() {
2240
1316
  }
2241
1317
  });
2242
1318
  }
2243
- function Zo() {
2244
- return new ae({
2245
- key: new le(ue.TEMPLATE_BLOCK_PASTE),
1319
+ function cn() {
1320
+ return new Q({
1321
+ key: new J(ee.TEMPLATE_BLOCK_PASTE),
2246
1322
  props: {
2247
1323
  handlePaste(e, t) {
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");
1324
+ var n, a, r;
1325
+ const o = ((n = t.clipboardData) == null ? void 0 : n.types) || [], s = (a = t.clipboardData) == null ? void 0 : a.getData("text/html");
2250
1326
  if (o.includes("text/html") && (s != null && s.includes("data-template")) || o.includes("application/x-prosemirror-slice"))
2251
1327
  return !1;
2252
- const r = (i = t.clipboardData) == null ? void 0 : i.getData("text/plain");
2253
- if (r) {
2254
- const { state: a, dispatch: c } = e, d = a.selection.$from;
2255
- let u = a.tr;
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
- const g = r.split(`
1328
+ const i = (r = t.clipboardData) == null ? void 0 : r.getData("text/plain");
1329
+ if (i) {
1330
+ const { state: l, dispatch: u } = e, p = l.selection.$from;
1331
+ let f = l.tr;
1332
+ p.nodeBefore && p.nodeBefore.isText && p.nodeBefore.text === y && (f = f.delete(p.pos - p.nodeBefore.nodeSize, p.pos)), p.nodeAfter && p.nodeAfter.isText && p.nodeAfter.text === y && (f = f.delete(p.pos, p.pos + p.nodeAfter.nodeSize));
1333
+ const E = i.split(`
2258
1334
  `);
2259
- let h;
2260
- if (g.length === 1)
2261
- u = u.insertText(g[0], u.selection.from, u.selection.to), h = u.selection.$to.pos;
1335
+ let S;
1336
+ if (E.length === 1)
1337
+ f = f.insertText(E[0], f.selection.from, f.selection.to), S = f.selection.$to.pos;
2262
1338
  else {
2263
- u = u.insertText(g[0], u.selection.from, u.selection.to);
2264
- let C = u.selection.$to.pos;
2265
- for (let w = 1; w < g.length; w++) {
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;
1339
+ f = f.insertText(E[0], f.selection.from, f.selection.to);
1340
+ let j = f.selection.$to.pos;
1341
+ for (let L = 1; L < E.length; L++) {
1342
+ const C = l.schema.nodes.paragraph.create({}, E[L] ? l.schema.text(E[L]) : null);
1343
+ f = f.insert(j, C), j += C.nodeSize;
2268
1344
  }
2269
- h = C;
1345
+ S = j;
2270
1346
  }
2271
- return u = u.setSelection(O.create(u.doc, h)), u = u.scrollIntoView(), c(u), t.preventDefault(), !0;
1347
+ return f = f.setSelection(D.create(f.doc, S)), f = f.scrollIntoView(), u(f), t.preventDefault(), !0;
2272
1348
  }
2273
1349
  return !1;
2274
1350
  }
2275
1351
  }
2276
1352
  });
2277
1353
  }
2278
- const Jo = ct.create({
2279
- name: _.TEMPLATE_BLOCK,
1354
+ const un = Le.create({
1355
+ name: T.TEMPLATE_BLOCK,
2280
1356
  // 节点配置
2281
1357
  group: "inline",
2282
1358
  inline: !0,
@@ -2288,10 +1364,10 @@ const Jo = ct.create({
2288
1364
  draggable: !1,
2289
1365
  onCreate() {
2290
1366
  const { items: e } = this.options;
2291
- e && ke(e) && K(
1367
+ e && ce(e) && K(
2292
1368
  e,
2293
1369
  () => {
2294
- const t = ke(e) ? e.value : e;
1370
+ const t = ce(e) ? e.value : e;
2295
1371
  t != null && (this.editor.commands.setTemplateData(t), this.editor.commands.focusFirstTemplate());
2296
1372
  },
2297
1373
  { deep: !0, immediate: !0 }
@@ -2329,7 +1405,7 @@ const Jo = ct.create({
2329
1405
  const o = e.textContent || "";
2330
1406
  return [
2331
1407
  "span",
2332
- ut(this.options.HTMLAttributes || {}, t, {
1408
+ Me(this.options.HTMLAttributes || {}, t, {
2333
1409
  "data-template": "",
2334
1410
  "data-id": e.attrs.id,
2335
1411
  "data-content": o
@@ -2339,18 +1415,18 @@ const Jo = ct.create({
2339
1415
  },
2340
1416
  // 使用 Vue 组件渲染
2341
1417
  addNodeView() {
2342
- return at(Go);
1418
+ return _e(sn);
2343
1419
  },
2344
1420
  // 添加插件
2345
1421
  addProseMirrorPlugins() {
2346
- return [Xo(), Yo(), Zo()];
1422
+ return [an(), ln(), cn()];
2347
1423
  }
2348
- }), Ce = new le(
2349
- ue.TEMPLATE_SELECT_DROPDOWN
1424
+ }), ae = new J(
1425
+ ee.TEMPLATE_SELECT_DROPDOWN
2350
1426
  );
2351
- function Qo() {
2352
- return new ae({
2353
- key: Ce,
1427
+ function dn() {
1428
+ return new Q({
1429
+ key: ae,
2354
1430
  state: {
2355
1431
  init() {
2356
1432
  return {
@@ -2359,7 +1435,7 @@ function Qo() {
2359
1435
  };
2360
1436
  },
2361
1437
  apply(e, t) {
2362
- const o = e.getMeta(Ce);
1438
+ const o = e.getMeta(ae);
2363
1439
  if (o) {
2364
1440
  if (o.type === "open")
2365
1441
  return {
@@ -2377,70 +1453,70 @@ function Qo() {
2377
1453
  }
2378
1454
  });
2379
1455
  }
2380
- function es() {
2381
- return new ae({
2382
- key: new le(ue.TEMPLATE_SELECT_ZERO_WIDTH),
1456
+ function fn() {
1457
+ return new Q({
1458
+ key: new J(ee.TEMPLATE_SELECT_ZERO_WIDTH),
2383
1459
  appendTransaction(e, t, o) {
2384
- if (!e.some((l) => l.docChanged)) return null;
2385
- const r = [];
1460
+ if (!e.some((a) => a.docChanged)) return null;
1461
+ const i = [];
2386
1462
  let { tr: n } = o;
2387
- return o.doc.descendants((l, i) => {
2388
- if (l.type.name === _.PARAGRAPH && l.childCount > 0) {
2389
- const { lastChild: a, firstChild: c } = l;
2390
- a === c && a && a.isText && a.text === S && r.push(["remove", i + 1]);
1463
+ return o.doc.descendants((a, r) => {
1464
+ if (a.type.name === T.PARAGRAPH && a.childCount > 0) {
1465
+ const { lastChild: l, firstChild: u } = a;
1466
+ l === u && l && l.isText && l.text === y && i.push(["remove", r + 1]);
2391
1467
  }
2392
- }), r.length > 0 ? (r.forEach(([, l]) => {
2393
- n = n.delete(l, l + 1);
1468
+ }), i.length > 0 ? (i.forEach(([, a]) => {
1469
+ n = n.delete(a, a + 1);
2394
1470
  }), n) : null;
2395
1471
  }
2396
1472
  });
2397
1473
  }
2398
- function ts() {
2399
- return new ae({
2400
- key: new le(ue.TEMPLATE_SELECT_KEYBOARD),
1474
+ function pn() {
1475
+ return new Q({
1476
+ key: new J(ee.TEMPLATE_SELECT_KEYBOARD),
2401
1477
  props: {
2402
1478
  handleKeyDown(e, t) {
2403
- const { state: o, dispatch: s } = e, { selection: r } = o, { $from: n } = r, l = Ce.getState(e.state);
2404
- if (l != null && l.isOpen && we(t, ["ENTER", "ARROW_UP", "ARROW_DOWN", "ESCAPE"]))
1479
+ const { state: o, dispatch: s } = e, { selection: i } = o, { $from: n } = i, a = ae.getState(e.state);
1480
+ if (a != null && a.isOpen && ie(t, ["ENTER", "ARROW_UP", "ARROW_DOWN", "ESCAPE"]))
2405
1481
  return !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;
1482
+ if (I(t, "BACKSPACE") && i.empty) {
1483
+ const r = n.nodeBefore, l = n.nodeAfter;
1484
+ if ((r == null ? void 0 : r.type.name) === T.TEMPLATE_SELECT)
1485
+ return s(o.tr.delete(n.pos - r.nodeSize, n.pos)), t.preventDefault(), !0;
1486
+ if (r != null && r.isText && r.text === y) {
1487
+ const u = n.pos - 1, f = o.doc.resolve(u).nodeBefore;
1488
+ if ((f == null ? void 0 : f.type.name) === T.TEMPLATE_SELECT) {
1489
+ const E = u - f.nodeSize, S = n.pos;
1490
+ return s(o.tr.delete(E, S)), t.preventDefault(), !0;
2415
1491
  }
2416
1492
  }
2417
- if ((a == null ? void 0 : a.type.name) === _.TEMPLATE_SELECT) {
2418
- if (i != null && i.isText && i.text !== S)
1493
+ if ((l == null ? void 0 : l.type.name) === T.TEMPLATE_SELECT) {
1494
+ if (r != null && r.isText && r.text !== y)
2419
1495
  return s(o.tr.delete(n.pos - 1, n.pos)), t.preventDefault(), !0;
2420
- if ((i == null ? void 0 : i.type.name) === _.TEMPLATE_BLOCK)
1496
+ if ((r == null ? void 0 : r.type.name) === T.TEMPLATE_BLOCK)
2421
1497
  return !1;
2422
1498
  }
2423
- if (!a && (i != null && i.isText) && i.text !== S)
1499
+ if (!l && (r != null && r.isText) && r.text !== y)
2424
1500
  return s(o.tr.delete(n.pos - 1, n.pos)), t.preventDefault(), !0;
2425
1501
  }
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
- const g = c + u.nodeSize;
2434
- return s(o.tr.delete(n.pos, g)), t.preventDefault(), !0;
1502
+ if (I(t, "DELETE") && i.empty) {
1503
+ const r = n.nodeAfter, l = n.nodeBefore;
1504
+ if ((r == null ? void 0 : r.type.name) === T.TEMPLATE_SELECT)
1505
+ return s(o.tr.delete(n.pos, n.pos + r.nodeSize)), t.preventDefault(), !0;
1506
+ if (r != null && r.isText && r.text === y) {
1507
+ const u = n.pos + 1, f = o.doc.resolve(u).nodeAfter;
1508
+ if ((f == null ? void 0 : f.type.name) === T.TEMPLATE_SELECT) {
1509
+ const E = u + f.nodeSize;
1510
+ return s(o.tr.delete(n.pos, E)), t.preventDefault(), !0;
2435
1511
  }
2436
1512
  }
2437
- if ((a == null ? void 0 : a.type.name) === _.TEMPLATE_SELECT) {
2438
- if (i != null && i.isText && i.text !== S)
1513
+ if ((l == null ? void 0 : l.type.name) === T.TEMPLATE_SELECT) {
1514
+ if (r != null && r.isText && r.text !== y)
2439
1515
  return s(o.tr.delete(n.pos, n.pos + 1)), t.preventDefault(), !0;
2440
- if ((i == null ? void 0 : i.type.name) === _.TEMPLATE_BLOCK)
1516
+ if ((r == null ? void 0 : r.type.name) === T.TEMPLATE_BLOCK)
2441
1517
  return !1;
2442
1518
  }
2443
- if (!a && (i != null && i.isText) && i.text !== S)
1519
+ if (!l && (r != null && r.isText) && r.text !== y)
2444
1520
  return s(o.tr.delete(n.pos, n.pos + 1)), t.preventDefault(), !0;
2445
1521
  }
2446
1522
  return !1;
@@ -2448,9 +1524,9 @@ function ts() {
2448
1524
  }
2449
1525
  });
2450
1526
  }
2451
- function ns(e, t, o) {
2452
- const s = (r) => {
2453
- const n = r.target;
1527
+ function mn(e, t, o) {
1528
+ const s = (i) => {
1529
+ const n = i.target;
2454
1530
  !e.contains(n) && !t.contains(n) && (o(), document.removeEventListener("click", s));
2455
1531
  };
2456
1532
  return setTimeout(() => {
@@ -2459,148 +1535,147 @@ function ns(e, t, o) {
2459
1535
  document.removeEventListener("click", s);
2460
1536
  };
2461
1537
  }
2462
- const os = { class: "template-select__icon" }, ss = ["onMousedown", "onMouseenter"], rs = /* @__PURE__ */ V({
1538
+ const hn = { class: "template-select__icon" }, gn = ["onMousedown", "onMouseenter"], xn = /* @__PURE__ */ X({
2463
1539
  __name: "template-select-view",
2464
1540
  props: {
2465
1541
  node: {},
2466
1542
  updateAttributes: { type: Function },
2467
1543
  editor: {},
2468
- appendTo: {}
1544
+ extension: {}
2469
1545
  },
2470
1546
  setup(e) {
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, {
1547
+ const t = e, o = W(!1), s = W(-1), i = W(), n = W();
1548
+ let a = null, r = null;
1549
+ const l = Mt(i, t.extension.options.appendTo, { fallback: "body" }), u = M(() => {
1550
+ const x = l.value;
1551
+ return x instanceof HTMLElement && x !== document.body;
1552
+ }), p = M(() => t.node.attrs.options.find((x) => x.value === t.node.attrs.value)), f = M(() => {
1553
+ var x;
1554
+ return ((x = p.value) == null ? void 0 : x.label) || t.node.attrs.placeholder;
1555
+ }), E = M(() => !t.node.attrs.value), S = () => {
1556
+ o.value ? L() : j();
1557
+ }, j = async () => {
1558
+ var x;
1559
+ if (o.value = !0, (x = t.editor) != null && x.view) {
1560
+ const v = t.editor.view, m = v.state.tr;
1561
+ m.setMeta(ae, {
2483
1562
  type: "open",
2484
1563
  selectId: t.node.attrs.id
2485
- }), A.dispatch(y);
1564
+ }), v.dispatch(m);
2486
1565
  }
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, {
1566
+ t.node.attrs.value ? s.value = t.node.attrs.options.findIndex((v) => v.value === t.node.attrs.value) : s.value = -1, await oe(), h(), i.value && n.value && (a = mn(i.value, n.value, L));
1567
+ }, L = async () => {
1568
+ var x;
1569
+ if (o.value = !1, s.value = -1, (x = t.editor) != null && x.view) {
1570
+ const v = t.editor.view, m = v.state.tr;
1571
+ m.setMeta(ae, {
2493
1572
  type: "close"
2494
- }), A.dispatch(y);
1573
+ }), v.dispatch(m);
2495
1574
  }
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, {
1575
+ a && (a(), a = null), r && (r(), r = null);
1576
+ }, C = (x) => {
1577
+ t.updateAttributes({ value: x.value }), L();
1578
+ }, h = () => {
1579
+ !i.value || !n.value || (r && (r(), r = null), r = Se(i.value, n.value, () => {
1580
+ !i.value || !n.value || Ce(i.value, n.value, {
2502
1581
  placement: "bottom-start",
2503
- strategy: s.value ? "fixed" : "absolute",
1582
+ // 自定义挂载目标使用 absolute 定位
1583
+ strategy: u.value ? "absolute" : "fixed",
2504
1584
  // 使用 fixed 定位策略,相对于视口
2505
- middleware: [ht(4), xt(), gt({ padding: 8 })]
2506
- }).then(({ x: T, y: A }) => {
2507
- i.value && Object.assign(i.value.style, {
2508
- left: `${T}px`,
2509
- top: `${A}px`
1585
+ middleware: [Ae(4), we(), ke({ padding: 8 })]
1586
+ }).then(({ x, y: v }) => {
1587
+ n.value && Object.assign(n.value.style, {
1588
+ left: `${x}px`,
1589
+ top: `${v}px`
2510
1590
  });
2511
1591
  });
2512
1592
  }));
2513
- }, x = (T) => {
2514
- if (r.value)
2515
- switch (T.key) {
1593
+ }, g = (x) => {
1594
+ if (o.value)
1595
+ switch (x.key) {
2516
1596
  case "ArrowUp":
2517
- T.preventDefault(), p();
1597
+ x.preventDefault(), d();
2518
1598
  break;
2519
1599
  case "ArrowDown":
2520
- T.preventDefault(), f();
1600
+ x.preventDefault(), c();
2521
1601
  break;
2522
1602
  case "Enter":
2523
- T.preventDefault(), E();
1603
+ x.preventDefault(), _();
2524
1604
  break;
2525
1605
  case "Escape":
2526
- T.preventDefault(), w();
1606
+ x.preventDefault(), L();
2527
1607
  break;
2528
1608
  }
2529
- }, p = () => {
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({
1609
+ }, d = () => {
1610
+ s.value === -1 || s.value <= 0 ? s.value = t.node.attrs.options.length - 1 : s.value -= 1, b();
1611
+ }, c = () => {
1612
+ s.value === -1 || s.value >= t.node.attrs.options.length - 1 ? s.value = 0 : s.value += 1, b();
1613
+ }, b = () => {
1614
+ oe(() => {
1615
+ if (!n.value) return;
1616
+ const x = n.value.querySelector(".template-select__option.is-highlighted");
1617
+ x && x.scrollIntoView({
2538
1618
  block: "nearest",
2539
1619
  behavior: "smooth"
2540
1620
  });
2541
1621
  });
2542
- }, E = () => {
2543
- n.value >= 0 && n.value < t.node.attrs.options.length ? b(t.node.attrs.options[n.value]) : w();
1622
+ }, _ = () => {
1623
+ s.value >= 0 && s.value < t.node.attrs.options.length ? C(t.node.attrs.options[s.value]) : L();
2544
1624
  };
2545
- return dn(() => {
2546
- document.addEventListener("keydown", x);
2547
- }), fn(() => {
2548
- document.removeEventListener("keydown", x), a && a(), c && c();
2549
- }), (T, A) => (M(), J(k(lt), {
1625
+ return at(() => {
1626
+ document.addEventListener("keydown", g);
1627
+ }), lt(() => {
1628
+ document.removeEventListener("keydown", g), a && a(), r && r();
1629
+ }), (x, v) => (w(), U(A(Ee), {
2550
1630
  as: "span",
2551
1631
  class: "template-select"
2552
1632
  }, {
2553
- default: j(() => [
2554
- A[0] || (A[0] = $("span", {
1633
+ default: B(() => [
1634
+ v[0] || (v[0] = R("span", {
2555
1635
  contenteditable: "false",
2556
1636
  class: "template-select__prefix"
2557
1637
  }, "​", -1)),
2558
- $("span", {
1638
+ R("span", {
2559
1639
  ref_key: "triggerRef",
2560
- ref: l,
2561
- class: Y(["template-select__trigger", { "is-open": r.value }]),
2562
- onMousedown: nt(h, ["prevent"])
1640
+ ref: i,
1641
+ class: V(["template-select__trigger", { "is-open": o.value }]),
1642
+ onMousedown: ye(S, ["prevent"])
2563
1643
  }, [
2564
- $("span", {
2565
- class: Y(["template-select__text", { "is-placeholder": g.value }])
2566
- }, he(u.value), 3),
2567
- $("span", os, [
2568
- ie(k(On))
1644
+ R("span", {
1645
+ class: V(["template-select__text", { "is-placeholder": E.value }])
1646
+ }, ne(f.value), 3),
1647
+ R("span", hn, [
1648
+ Y(A(kt))
2569
1649
  ])
2570
1650
  ], 34),
2571
- A[1] || (A[1] = $("span", {
1651
+ v[1] || (v[1] = R("span", {
2572
1652
  contenteditable: "false",
2573
1653
  class: "template-select__suffix"
2574
1654
  }, "​", -1)),
2575
- (M(), J(pn, { to: o.value }, [
2576
- r.value ? (M(), P("div", {
1655
+ (w(), U(ct, { to: A(l) }, [
1656
+ o.value ? (w(), P("div", {
2577
1657
  key: 0,
2578
1658
  ref_key: "dropdownRef",
2579
- ref: i,
2580
- class: Y(["template-select__dropdown", { "template-select__dropdown--in-surface": !s.value }])
1659
+ ref: n,
1660
+ class: V(["template-select__dropdown", { "is-absolute": u.value }])
2581
1661
  }, [
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
1662
+ (w(!0), P(fe, null, pe(e.node.attrs.options, (m, k) => (w(), P("div", {
1663
+ key: m.value,
1664
+ class: V(["template-select__option", {
1665
+ "is-highlighted": k === s.value,
1666
+ "is-selected": m.value === e.node.attrs.value
2587
1667
  }]),
2588
- onMousedown: nt((I) => b(y), ["prevent"]),
2589
- onMouseenter: (I) => n.value = L
2590
- }, he(y.label), 43, ss))), 128))
2591
- ], 2)) : q("", !0)
1668
+ onMousedown: ye(($) => C(m), ["prevent"]),
1669
+ onMouseenter: ($) => s.value = k
1670
+ }, ne(m.label), 43, gn))), 128))
1671
+ ], 2)) : N("", !0)
2592
1672
  ], 8, ["to"]))
2593
1673
  ]),
2594
1674
  _: 1
2595
1675
  }));
2596
1676
  }
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
- },
1677
+ }), bn = /* @__PURE__ */ Z(xn, [["__scopeId", "data-v-5bcba48f"]]), yn = Le.create({
1678
+ name: T.TEMPLATE_SELECT,
2604
1679
  // 节点配置
2605
1680
  group: "inline",
2606
1681
  inline: !0,
@@ -2660,19 +1735,19 @@ const os = { class: "template-select__icon" }, ss = ["onMousedown", "onMouseente
2660
1735
  const o = e.attrs.options.find(
2661
1736
  (n) => n.value === e.attrs.value
2662
1737
  ), s = (o == null ? void 0 : o.label) || e.attrs.placeholder;
2663
- let r = "[]";
1738
+ let i = "[]";
2664
1739
  try {
2665
- r = JSON.stringify(e.attrs.options);
1740
+ i = JSON.stringify(e.attrs.options);
2666
1741
  } catch (n) {
2667
1742
  console.error("Failed to stringify template select options in renderHTML:", n);
2668
1743
  }
2669
1744
  return [
2670
1745
  "span",
2671
- ut(t, {
1746
+ Me(t, {
2672
1747
  "data-template-select": "",
2673
1748
  "data-id": e.attrs.id,
2674
1749
  "data-placeholder": e.attrs.placeholder,
2675
- "data-options": r,
1750
+ "data-options": i,
2676
1751
  "data-value": e.attrs.value || ""
2677
1752
  }),
2678
1753
  s
@@ -2680,125 +1755,117 @@ const os = { class: "template-select__icon" }, ss = ["onMousedown", "onMouseente
2680
1755
  },
2681
1756
  // 使用 Vue 组件渲染
2682
1757
  addNodeView() {
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
- );
1758
+ return _e(bn);
2692
1759
  },
2693
1760
  // 添加插件
2694
1761
  addProseMirrorPlugins() {
2695
- return [Qo(), es(), ts()];
1762
+ return [dn(), fn(), pn()];
2696
1763
  }
2697
- }), Zt = Bt.create({
2698
- name: be.TEMPLATE,
1764
+ }), Xe = We.create({
1765
+ name: se.TEMPLATE,
2699
1766
  addExtensions() {
2700
- return [Jo.configure(this.options), ls.configure({ appendTo: this.options.appendTo })];
1767
+ return [un.configure(this.options), yn.configure(this.options)];
2701
1768
  },
2702
1769
  // 添加命令(统一命令入口)
2703
1770
  addCommands() {
2704
- return Fo;
1771
+ return nn;
2705
1772
  }
2706
1773
  });
2707
- function as(e, t) {
2708
- return Zt.configure({
1774
+ function Tn(e, t) {
1775
+ return Xe.configure({
2709
1776
  items: e,
2710
1777
  ...t
2711
1778
  });
2712
1779
  }
2713
- function Jt(e, t = "") {
1780
+ function Ze(e, t = "") {
2714
1781
  let o = (
2715
1782
  /** @type {Array<CategorizedUnicodeRange<T>>} */
2716
1783
  []
2717
- ), s = e.split(",").map((n) => n ? parseInt(n, 36) : 0), r = 0;
1784
+ ), s = e.split(",").map((n) => n ? parseInt(n, 36) : 0), i = 0;
2718
1785
  for (let n = 0; n < s.length; n++)
2719
1786
  n % 2 ? o.push([
2720
- r,
2721
- r + s[n],
1787
+ i,
1788
+ i + s[n],
2722
1789
  /** @type {T} */
2723
1790
  t ? parseInt(t[n >> 1], 36) : 0
2724
- ]) : r = s[n];
1791
+ ]) : i = s[n];
2725
1792
  return o;
2726
1793
  }
2727
- function Qt(e, t, o = 0, s = t.length - 1) {
1794
+ function Ye(e, t, o = 0, s = t.length - 1) {
2728
1795
  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;
2732
- else return r;
1796
+ let i = o + s >>> 1, n = t[i];
1797
+ if (e < n[0]) s = i - 1;
1798
+ else if (e > n[1]) o = i + 1;
1799
+ else return i;
2733
1800
  }
2734
1801
  return -1;
2735
1802
  }
2736
- const rt = Jt(
1803
+ const Te = Ze(
2737
1804
  /** @type {UnicodeDataEncoding} */
2738
1805
  ",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",
2739
1806
  "262122424333333393233393339333333333393393b3b3b3b3b333b33b3bb33333b3b3333333b3b33bb3333b33b3bb33333b3bbb333b333b33333b3b3b3b3333b3b33b3bb39333b33b33b3b3b333b333333b3b333333b33b3b3333b3335dc333333b3b3b33323333b3bb3b33b3b3b3333b3333b3b333bb3b33b3b3b3b3b333b333b3323e2244234444444444444444444444444444444444444444443333333333b3b3bb33333b353b3b3b3b333b3b333b333333b3bb3b3b3bb333232333333333333333b3b3333bb3b393933b3b33bb3b393b3b3b3333b33b33b3bbb33b333b3333bb3933b3b3b333b3b3b3b3b33b3b3b33b3b3b33b3b33b33b3b3b33bb39b9b3b33b3b33b9333b393b3b33b33b3b3b3333393b3b3b33b39bb3b332333b333dd3b33332333323333333333333333333333344444444a44444434444444444444423232"
2740
- ), cs = Jt(
1807
+ ), vn = Ze(
2741
1808
  /** @type {UnicodeDataEncoding} */
2742
1809
  "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"
2743
- ), _t = 65535;
2744
- function* us(e) {
1810
+ ), Re = 65535;
1811
+ function* En(e) {
2745
1812
  let t = e.codePointAt(0);
2746
1813
  if (t == null) return;
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;
1814
+ let o = t <= Re ? 1 : 2, s = e.length, i = Be(t), n = 0, a = 0, r = !1, l = !1, u = !1, p = 0, f = i, E = t;
2748
1815
  for (; o < s; ) {
2749
1816
  t = /** @type {number} */
2750
- e.codePointAt(o), n = Lt(t);
2751
- let h = !0;
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),
2754
- index: d,
1817
+ e.codePointAt(o), n = Be(t);
1818
+ let S = !0;
1819
+ i === 1 ? S = n !== 6 : i === 2 || i === 6 || n === 1 || n === 2 || n === 6 ? S = !0 : n === 3 || n === 14 || n === 11 || i === 9 ? S = !1 : i === 14 && n === 4 ? S = !r : i === 10 && n === 10 ? S = a++ % 2 === 1 : i === 5 ? S = !(n === 5 || n === 13 || n === 7 || n === 8) : ((i === 7 || i === 13) && (n === 13 || n === 12) || (i === 8 || i === 12) && n === 12 || n === 0 && l && u && je(t)) && (S = !1), S ? (yield {
1820
+ segment: e.slice(p, o),
1821
+ index: p,
2755
1822
  input: e,
2756
- _hd: g,
2757
- _catBegin: u,
2758
- _catEnd: r
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;
1823
+ _hd: E,
1824
+ _catBegin: f,
1825
+ _catEnd: i
1826
+ }, r = !1, a = 0, p = o, f = n, E = t) : n === 14 && (i === 3 || i === 4) ? r = !0 : t >= 2325 && (!l && i === 0 && (l = je(E)), l && n === 3 ? u = u || t === 2381 || t === 2509 || t === 2637 || t === 2765 || t === 2893 || t === 3149 || t === 3405 : u = !1), o += t <= Re ? 1 : 2, i = n;
2760
1827
  }
2761
- d < s && (yield {
2762
- segment: e.slice(d),
2763
- index: d,
1828
+ p < s && (yield {
1829
+ segment: e.slice(p),
1830
+ index: p,
2764
1831
  input: e,
2765
- _hd: g,
2766
- _catBegin: u,
2767
- _catEnd: r
1832
+ _hd: E,
1833
+ _catBegin: f,
1834
+ _catEnd: i
2768
1835
  });
2769
1836
  }
2770
- function ds(e) {
1837
+ function _n(e) {
2771
1838
  let t = 0;
2772
- for (let o of us(e)) t += 1;
1839
+ for (let o of En(e)) t += 1;
2773
1840
  return t;
2774
1841
  }
2775
- const en = new Uint8Array(6080), qe = 128, it = 12287, tn = new Uint8Array(1536), He = 40960, nn = 44031, fs = (() => {
1842
+ const Je = new Uint8Array(6080), he = 128, ve = 12287, Qe = new Uint8Array(1536), ge = 40960, et = 44031, Sn = (() => {
2776
1843
  let e = 0;
2777
1844
  for (; ; ) {
2778
- let [t, o, s] = rt[e];
2779
- if (t > nn) break;
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;
1845
+ let [t, o, s] = Te[e];
1846
+ if (t > et) break;
1847
+ if (e++, !(o < he || t > ve && o < ge))
1848
+ for (let i = t; i <= o; i++) {
1849
+ let n, a = 0;
1850
+ i <= ve ? (n = Je, a = i - he >> 1) : (n = Qe, a = i - ge >> 1), n[a] = i & 1 ? n[a] & 15 | s << 4 : n[a] & 240 | s;
2784
1851
  }
2785
1852
  }
2786
1853
  return e;
2787
1854
  })();
2788
- function Lt(e) {
2789
- if (e < qe)
1855
+ function Be(e) {
1856
+ if (e < he)
2790
1857
  return e >= 32 ? 0 : e === 10 ? 6 : e === 13 ? 1 : 2;
2791
- if (e <= it) {
2792
- let o = en[e - qe >> 1];
1858
+ if (e <= ve) {
1859
+ let o = Je[e - he >> 1];
2793
1860
  return (
2794
1861
  /** @type {GraphemeCategoryNum} */
2795
1862
  e & 1 ? o >> 4 : o & 15
2796
1863
  );
2797
1864
  }
2798
- if (e < He)
1865
+ if (e < ge)
2799
1866
  return e < 12336 ? e >= 12330 ? 3 : 0 : e < 12443 ? e === 12336 || e === 12349 ? 4 : e >= 12441 ? 3 : 0 : e === 12951 || e === 12953 ? 4 : 0;
2800
- if (e <= nn) {
2801
- let o = tn[e - He >> 1];
1867
+ if (e <= et) {
1868
+ let o = Qe[e - ge >> 1];
2802
1869
  return (
2803
1870
  /** @type {GraphemeCategoryNum} */
2804
1871
  e & 1 ? o >> 4 : o & 15
@@ -2810,44 +1877,44 @@ function Lt(e) {
2810
1877
  return e <= 55238 ? e >= 55216 ? 13 : 0 : e >= 55243 ? 12 : 0;
2811
1878
  if (e < 65024)
2812
1879
  return e === 64286 ? 3 : 0;
2813
- let t = Qt(e, rt, fs);
2814
- return t < 0 ? 0 : rt[t][2];
1880
+ let t = Ye(e, Te, Sn);
1881
+ return t < 0 ? 0 : Te[t][2];
2815
1882
  }
2816
- function kt(e) {
2817
- return Qt(e, cs) >= 0;
1883
+ function je(e) {
1884
+ return Ye(e, vn) >= 0;
2818
1885
  }
2819
- const Mt = typeof Intl < "u" && typeof Intl.Segmenter == "function" ? new Intl.Segmenter(void 0, { granularity: "grapheme" }) : null;
2820
- function on(e) {
1886
+ const $e = typeof Intl < "u" && typeof Intl.Segmenter == "function" ? new Intl.Segmenter(void 0, { granularity: "grapheme" }) : null;
1887
+ function tt(e) {
2821
1888
  if (!e) return 0;
2822
- if (Mt) {
1889
+ if ($e) {
2823
1890
  let t = 0;
2824
- for (const o of Mt.segment(e))
1891
+ for (const o of $e.segment(e))
2825
1892
  t++;
2826
1893
  return t;
2827
1894
  }
2828
- return ds(e);
1895
+ return _n(e);
2829
1896
  }
2830
- function ps(e, t) {
2831
- const o = F(null), s = De(e, "placeholder"), r = () => {
2832
- var i;
2833
- const l = [
2834
- wn,
2835
- Cn,
2836
- An,
2837
- Sn,
1897
+ function Cn(e, t) {
1898
+ const o = W(null), s = de(e, "placeholder"), i = () => {
1899
+ var r;
1900
+ const a = [
1901
+ bt,
1902
+ yt,
1903
+ Tt,
1904
+ vt,
2838
1905
  // 提供 undo/redo 功能
2839
- _n.configure({
1906
+ Et.configure({
2840
1907
  placeholder: () => s.value || "请输入内容..."
2841
1908
  }),
2842
- Ln.configure({
1909
+ _t.configure({
2843
1910
  mode: "textSize",
2844
- textCounter: on
1911
+ textCounter: tt
2845
1912
  })
2846
1913
  ];
2847
- return (i = e.extensions) != null && i.length && l.push(...e.extensions), l;
2848
- }, n = Tn({
1914
+ return (r = e.extensions) != null && r.length && a.push(...e.extensions), a;
1915
+ }, n = gt({
2849
1916
  content: e.modelValue ?? e.defaultValue ?? "",
2850
- extensions: r(),
1917
+ extensions: i(),
2851
1918
  autofocus: e.autofocus ? "end" : !1,
2852
1919
  editorProps: {
2853
1920
  attributes: {
@@ -2855,315 +1922,315 @@ function ps(e, t) {
2855
1922
  enterkeyhint: e.enterkeyhint
2856
1923
  },
2857
1924
  // 处理粘贴事件 - 只粘贴纯文本
2858
- handlePaste(l, i) {
2859
- var g;
2860
- const a = (g = i.clipboardData) == null ? void 0 : g.getData("text/plain");
2861
- if (!a) return !1;
2862
- const c = e.mode === "single" ? a.replace(/\r?\n/g, " ") : a, { state: d } = l, { tr: u } = d;
2863
- return u.insertText(c), l.dispatch(u), ge(() => {
2864
- var h;
2865
- (h = n.value) == null || h.commands.scrollIntoView();
1925
+ handlePaste(a, r) {
1926
+ var E;
1927
+ const l = (E = r.clipboardData) == null ? void 0 : E.getData("text/plain");
1928
+ if (!l) return !1;
1929
+ const u = e.mode === "single" ? l.replace(/\r?\n/g, " ") : l, { state: p } = a, { tr: f } = p;
1930
+ return f.insertText(u), a.dispatch(f), oe(() => {
1931
+ var S;
1932
+ (S = n.value) == null || S.commands.scrollIntoView();
2866
1933
  }), !0;
2867
1934
  }
2868
1935
  },
2869
- onUpdate: (l) => {
2870
- const i = l.editor.getText();
2871
- t("update:modelValue", i), t("input", i);
1936
+ onUpdate: (a) => {
1937
+ const r = a.editor.getText();
1938
+ t("update:modelValue", r), t("input", r);
2872
1939
  },
2873
- onFocus: (l) => {
2874
- t("focus", l.event);
1940
+ onFocus: (a) => {
1941
+ t("focus", a.event);
2875
1942
  },
2876
- onBlur: (l) => {
2877
- t("blur", l.event);
1943
+ onBlur: (a) => {
1944
+ t("blur", a.event);
2878
1945
  }
2879
1946
  });
2880
1947
  return K(
2881
1948
  () => e.modelValue,
2882
- (l) => {
2883
- n.value && l !== n.value.getText() && n.value.commands.setContent(l ?? "", { emitUpdate: !1 });
1949
+ (a) => {
1950
+ n.value && a !== n.value.getText() && n.value.commands.setContent(a ?? "", { emitUpdate: !1 });
2884
1951
  }
2885
1952
  ), K(
2886
1953
  () => e.placeholder,
2887
1954
  () => {
2888
1955
  if (n.value) {
2889
- const { state: l } = n.value, i = l.tr;
2890
- n.value.view.dispatch(i);
1956
+ const { state: a } = n.value, r = a.tr;
1957
+ n.value.view.dispatch(r);
2891
1958
  }
2892
1959
  }
2893
1960
  ), K(
2894
1961
  () => e.enterkeyhint,
2895
- (l) => {
1962
+ (a) => {
2896
1963
  if (n.value) {
2897
- const i = n.value.view.dom;
2898
- l ? i.setAttribute("enterkeyhint", l) : i.removeAttribute("enterkeyhint");
1964
+ const r = n.value.view.dom;
1965
+ a ? r.setAttribute("enterkeyhint", a) : r.removeAttribute("enterkeyhint");
2899
1966
  }
2900
1967
  }
2901
- ), hn(() => {
2902
- var l;
2903
- (l = n.value) == null || l.destroy();
1968
+ ), ut(() => {
1969
+ var a;
1970
+ (a = n.value) == null || a.destroy();
2904
1971
  }), {
2905
1972
  editor: n,
2906
1973
  editorRef: o
2907
1974
  };
2908
1975
  }
2909
- function ms(e) {
1976
+ function An(e) {
2910
1977
  const { submitType: t } = e;
2911
1978
  return {
2912
- checkSubmitShortcut: (r) => {
2913
- if (!B(r, "ENTER")) return !1;
1979
+ checkSubmitShortcut: (i) => {
1980
+ if (!I(i, "ENTER")) return !1;
2914
1981
  switch (t.value) {
2915
1982
  case "enter":
2916
- return !r.shiftKey && !r.ctrlKey && !r.metaKey;
1983
+ return !i.shiftKey && !i.ctrlKey && !i.metaKey;
2917
1984
  case "ctrlEnter":
2918
- return (r.ctrlKey || r.metaKey) && !r.shiftKey;
1985
+ return (i.ctrlKey || i.metaKey) && !i.shiftKey;
2919
1986
  case "shiftEnter":
2920
- return r.shiftKey && !r.ctrlKey && !r.metaKey;
1987
+ return i.shiftKey && !i.ctrlKey && !i.metaKey;
2921
1988
  default:
2922
1989
  return !1;
2923
1990
  }
2924
1991
  },
2925
- checkNewlineShortcut: (r) => {
2926
- if (!B(r, "ENTER")) return !1;
1992
+ checkNewlineShortcut: (i) => {
1993
+ if (!I(i, "ENTER")) return !1;
2927
1994
  switch (t.value) {
2928
1995
  case "enter":
2929
- return r.shiftKey || r.ctrlKey || r.metaKey;
1996
+ return i.shiftKey || i.ctrlKey || i.metaKey;
2930
1997
  case "ctrlEnter":
2931
1998
  case "shiftEnter":
2932
- return !r.shiftKey && !r.ctrlKey && !r.metaKey;
1999
+ return !i.shiftKey && !i.ctrlKey && !i.metaKey;
2933
2000
  default:
2934
2001
  return !1;
2935
2002
  }
2936
2003
  }
2937
2004
  };
2938
2005
  }
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(
2006
+ function wn(e, t, o) {
2007
+ const s = W(e.mode || "single"), i = W(!1), n = W(e.mode || "single"), { start: a, stop: r } = St(
2941
2008
  () => {
2942
- r.value = !1;
2009
+ i.value = !1;
2943
2010
  },
2944
2011
  300,
2945
2012
  { immediate: !1 }
2946
- ), a = R(() => {
2947
- var u;
2948
- return (u = o.value) == null ? void 0 : u.closest(".tr-sender-main");
2949
- }), c = () => {
2950
- if (n.value !== "single" || r.value || !t.value || !o.value) return;
2951
- const u = o.value.querySelector(".ProseMirror");
2952
- if (!u) return;
2953
- const g = t.value.getText();
2954
- s.value === "single" ? u.scrollWidth > u.clientWidth && d("multiple") : g.length || d("single");
2955
- }, d = (u) => {
2956
- s.value !== u && (r.value = !0, s.value = u, ge(() => {
2957
- t.value && t.value.commands.focus("end"), i(), l();
2013
+ ), l = M(() => {
2014
+ var f;
2015
+ return (f = o.value) == null ? void 0 : f.closest(".tr-sender-main");
2016
+ }), u = () => {
2017
+ if (n.value !== "single" || i.value || !t.value || !o.value) return;
2018
+ const f = o.value.querySelector(".ProseMirror");
2019
+ if (!f) return;
2020
+ const E = t.value.getText();
2021
+ s.value === "single" ? f.scrollWidth > f.clientWidth && p("multiple") : E.length || p("single");
2022
+ }, p = (f) => {
2023
+ s.value !== f && (i.value = !0, s.value = f, oe(() => {
2024
+ t.value && t.value.commands.focus("end"), r(), a();
2958
2025
  }));
2959
2026
  };
2960
- return Mn(a, () => {
2027
+ return Ct(l, () => {
2961
2028
  requestAnimationFrame(() => {
2962
- c();
2029
+ u();
2963
2030
  });
2964
2031
  }), K(
2965
2032
  () => e.mode,
2966
- (u) => {
2967
- u && u !== s.value && (n.value = u, d(u));
2033
+ (f) => {
2034
+ f && f !== s.value && (n.value = f, p(f));
2968
2035
  }
2969
2036
  ), {
2970
2037
  currentMode: s,
2971
- isAutoSwitching: r,
2972
- setMode: d,
2973
- checkOverflow: c
2038
+ isAutoSwitching: i,
2039
+ setMode: p,
2040
+ checkOverflow: u
2974
2041
  };
2975
2042
  }
2976
- function gs(e, t, o) {
2977
- const s = Rn("--tr-sender-line-height", t), r = R(() => {
2978
- const i = s.value;
2979
- if (i) {
2980
- const a = parseFloat(i);
2981
- return isNaN(a) ? 26 : a;
2043
+ function kn(e, t, o) {
2044
+ const s = At("--tr-sender-line-height", t), i = M(() => {
2045
+ const r = s.value;
2046
+ if (r) {
2047
+ const l = parseFloat(r);
2048
+ return isNaN(l) ? 26 : l;
2982
2049
  }
2983
2050
  return 26;
2984
- }), n = R(() => o === !1 || o === void 0 ? null : o === !0 ? {
2051
+ }), n = M(() => o === !1 || o === void 0 ? null : o === !0 ? {
2985
2052
  minRows: 1,
2986
2053
  maxRows: 5
2987
2054
  } : typeof o == "object" ? {
2988
2055
  minRows: o.minRows,
2989
2056
  maxRows: o.maxRows
2990
- } : null), l = () => {
2057
+ } : null), a = () => {
2991
2058
  if (!t.value) return;
2992
- const i = t.value.querySelector(".tr-sender-editor-scroll");
2993
- if (!i) {
2059
+ const r = t.value.querySelector(".tr-sender-editor-scroll");
2060
+ if (!r) {
2994
2061
  console.warn("⚠️ 找不到滚动容器 .tr-sender-editor-scroll");
2995
2062
  return;
2996
2063
  }
2997
- const a = n.value;
2998
- if (e.value === "multiple" && a) {
2999
- const c = r.value * a.minRows, d = r.value * a.maxRows;
3000
- i.style.minHeight = `${c}px`, i.style.maxHeight = `${d}px`, i.style.overflowY = "auto";
2064
+ const l = n.value;
2065
+ if (e.value === "multiple" && l) {
2066
+ const u = i.value * l.minRows, p = i.value * l.maxRows;
2067
+ r.style.minHeight = `${u}px`, r.style.maxHeight = `${p}px`, r.style.overflowY = "auto";
3001
2068
  } else
3002
- i.style.minHeight = "", i.style.maxHeight = "", i.style.overflowY = e.value === "single" ? "hidden" : "auto";
2069
+ r.style.minHeight = "", r.style.maxHeight = "", r.style.overflowY = e.value === "single" ? "hidden" : "auto";
3003
2070
  };
3004
2071
  return K(
3005
2072
  e,
3006
2073
  () => {
3007
- ge(() => {
3008
- l();
2074
+ oe(() => {
2075
+ a();
3009
2076
  });
3010
2077
  },
3011
2078
  { immediate: !0 }
3012
2079
  ), K(
3013
2080
  n,
3014
2081
  () => {
3015
- ge(() => {
3016
- l();
2082
+ oe(() => {
2083
+ a();
3017
2084
  });
3018
2085
  },
3019
2086
  { immediate: !0 }
3020
2087
  ), {
3021
- updateHeight: l
2088
+ updateHeight: a
3022
2089
  };
3023
2090
  }
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))
2091
+ const Ln = (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, Mn = (e, t) => {
2092
+ const o = ft(t);
2093
+ if (Ln(o))
3027
2094
  return {
3028
2095
  source: e,
3029
2096
  payload: o
3030
2097
  };
3031
2098
  };
3032
- function bs() {
3033
- const e = gn(/* @__PURE__ */ new Map()), t = R(() => {
3034
- const r = [];
2099
+ function Pn() {
2100
+ const e = dt(/* @__PURE__ */ new Map()), t = M(() => {
2101
+ const i = [];
3035
2102
  for (const n of e.values()) {
3036
- const l = ys(n.source, n.payload);
3037
- l && r.push(l);
2103
+ const a = Mn(n.source, n.payload);
2104
+ a && i.push(a);
3038
2105
  }
3039
- return r;
2106
+ return i;
3040
2107
  });
3041
2108
  return {
3042
- hasRegisteredContent: R(() => t.value.length > 0),
3043
- registerContent: (r, n) => {
3044
- const l = Symbol("sender-content");
3045
- return e.set(l, { source: r, payload: n }), () => {
3046
- e.delete(l);
2109
+ hasRegisteredContent: M(() => t.value.length > 0),
2110
+ registerContent: (i, n) => {
2111
+ const a = Symbol("sender-content");
2112
+ return e.set(a, { source: i, payload: n }), () => {
2113
+ e.delete(a);
3047
2114
  };
3048
2115
  },
3049
2116
  externalPayloads: t
3050
2117
  };
3051
2118
  }
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);
3056
- }), g = () => {
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);
2119
+ function Dn(e, t) {
2120
+ const { editor: o, editorRef: s } = Cn(e, t), i = M(() => o.value ? be(o.value).trim().length > 0 : !1), { hasRegisteredContent: n, registerContent: a, externalPayloads: r } = Pn(), l = M(() => i.value || n.value || !!e.hasExternalContent), u = M(() => o.value ? tt(be(o.value)) : 0), p = M(() => e.maxLength ? u.value > e.maxLength : !1), f = M(() => {
2121
+ var m, k;
2122
+ return !e.disabled && !e.loading && l.value && !p.value && !((k = (m = e.defaultActions) == null ? void 0 : m.submit) != null && k.disabled);
2123
+ }), E = () => {
2124
+ if (!f.value || !o.value) return;
2125
+ let m, k = "";
2126
+ if (o.value.extensionManager.extensions.some((q) => q.name === se.TEMPLATE)) {
2127
+ const q = Ue(o.value);
2128
+ q.length > 0 && (m = q), k = be(o.value);
2129
+ } else if (o.value.extensionManager.extensions.some((q) => q.name === se.MENTION)) {
2130
+ const q = zt(o.value);
2131
+ q.length > 0 && (m = q), k = Wt(o.value);
3065
2132
  }
3066
- L || (L = o.value.getText());
3067
- const I = i.value.slice();
3068
- if (I.length === 0) {
3069
- t("submit", L, y);
2133
+ k || (k = o.value.getText());
2134
+ const $ = r.value.slice();
2135
+ if ($.length === 0) {
2136
+ t("submit", k, m);
3070
2137
  return;
3071
2138
  }
3072
- t("submit", L, y, {
3073
- externalPayloads: I
2139
+ t("submit", k, m, {
2140
+ externalPayloads: $
3074
2141
  });
3075
- }, { currentMode: h, isAutoSwitching: C, setMode: w, checkOverflow: b } = hs(e, o, s), m = ms({
3076
- submitType: R(() => e.submitType ?? "enter")
2142
+ }, { currentMode: S, isAutoSwitching: j, setMode: L, checkOverflow: C } = wn(e, o, s), h = An({
2143
+ submitType: M(() => e.submitType ?? "enter")
3077
2144
  });
3078
2145
  K(
3079
2146
  o,
3080
- (y) => {
3081
- y && y.setOptions({
2147
+ (m) => {
2148
+ m && m.setOptions({
3082
2149
  editorProps: {
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;
2150
+ ...m.options.editorProps,
2151
+ handleKeyDown: (k, $) => {
2152
+ const q = te.getState(k.state), De = H.getState(k.state), Oe = ae.getState(k.state);
2153
+ return q && q.active || De && De.active || Oe && Oe.isOpen ? !1 : h.checkSubmitShortcut($) ? ($.preventDefault(), E(), !0) : h.checkNewlineShortcut($) ? ($.preventDefault(), S.value === "single" ? (L("multiple"), setTimeout(() => {
2154
+ m.commands.splitBlock(), m.commands.focus();
2155
+ }, 0)) : m.commands.splitBlock(), !0) : !1;
3089
2156
  }
3090
2157
  }
3091
2158
  });
3092
2159
  },
3093
2160
  { immediate: !0 }
3094
- ), gs(h, s, e.autoSize), K(
2161
+ ), kn(S, s, e.autoSize), K(
3095
2162
  () => {
3096
- var y;
3097
- return (y = o.value) == null ? void 0 : y.state.doc.content;
2163
+ var m;
2164
+ return (m = o.value) == null ? void 0 : m.state.doc.content;
3098
2165
  },
3099
2166
  () => {
3100
2167
  setTimeout(() => {
3101
- b();
2168
+ C();
3102
2169
  }, 0);
3103
2170
  },
3104
2171
  { deep: !0 }
3105
2172
  );
3106
- const x = () => {
3107
- var y;
3108
- (y = o.value) == null || y.commands.focus();
3109
- }, p = () => {
3110
- var y, L;
3111
- (y = o.value) == null || y.commands.clearContent(), (L = o.value) == null || L.commands.focus(), t("clear");
3112
- }, f = () => {
2173
+ const g = () => {
2174
+ var m;
2175
+ (m = o.value) == null || m.commands.focus();
2176
+ }, d = () => {
2177
+ var m, k;
2178
+ (m = o.value) == null || m.commands.clearContent(), (k = o.value) == null || k.commands.focus(), t("clear");
2179
+ }, c = () => {
3113
2180
  t("cancel");
3114
- }, v = () => {
3115
- var y;
3116
- (y = o.value) == null || y.commands.blur();
3117
- }, E = (y) => {
3118
- var L;
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 = {
2181
+ }, b = () => {
2182
+ var m;
2183
+ (m = o.value) == null || m.commands.blur();
2184
+ }, _ = (m) => {
2185
+ var k;
2186
+ (k = o.value) == null || k.commands.setContent(m);
2187
+ }, x = () => {
2188
+ var m;
2189
+ return ((m = o.value) == null ? void 0 : m.getText()) || "";
2190
+ }, v = {
3124
2191
  editor: o,
3125
2192
  editorRef: s,
3126
- mode: h,
3127
- isAutoSwitching: C,
3128
- loading: R(() => e.loading ?? !1),
3129
- disabled: R(() => e.disabled ?? !1),
3130
- hasContent: a,
3131
- hasEditorContent: r,
3132
- canSubmit: u,
3133
- isOverLimit: d,
3134
- characterCount: c,
3135
- maxLength: De(e, "maxLength"),
3136
- size: R(() => e.size ?? "normal"),
3137
- showWordLimit: R(() => e.showWordLimit ?? !1),
3138
- clearable: R(() => e.clearable ?? !1),
3139
- defaultActions: De(e, "defaultActions"),
3140
- submitType: R(() => e.submitType ?? "enter"),
3141
- stopText: De(e, "stopText"),
3142
- submit: g,
3143
- clear: p,
3144
- cancel: f,
3145
- focus: x,
3146
- blur: v,
3147
- setContent: E,
3148
- getContent: T
2193
+ mode: S,
2194
+ isAutoSwitching: j,
2195
+ loading: M(() => e.loading ?? !1),
2196
+ disabled: M(() => e.disabled ?? !1),
2197
+ hasContent: l,
2198
+ hasEditorContent: i,
2199
+ canSubmit: f,
2200
+ isOverLimit: p,
2201
+ characterCount: u,
2202
+ maxLength: de(e, "maxLength"),
2203
+ size: M(() => e.size ?? "normal"),
2204
+ showWordLimit: M(() => e.showWordLimit ?? !1),
2205
+ clearable: M(() => e.clearable ?? !1),
2206
+ defaultActions: de(e, "defaultActions"),
2207
+ submitType: M(() => e.submitType ?? "enter"),
2208
+ stopText: de(e, "stopText"),
2209
+ submit: E,
2210
+ clear: d,
2211
+ cancel: c,
2212
+ focus: g,
2213
+ blur: b,
2214
+ setContent: _,
2215
+ getContent: x
3149
2216
  };
3150
- return yn(bn, A), Dn(l), {
3151
- context: A,
2217
+ return pt(mt, v), Lt(a), {
2218
+ context: v,
3152
2219
  expose: {
3153
- submit: g,
3154
- clear: p,
3155
- cancel: f,
3156
- focus: x,
3157
- blur: v,
3158
- setContent: E,
3159
- getContent: T,
2220
+ submit: E,
2221
+ clear: d,
2222
+ cancel: c,
2223
+ focus: g,
2224
+ blur: b,
2225
+ setContent: _,
2226
+ getContent: x,
3160
2227
  editor: o
3161
2228
  }
3162
2229
  };
3163
2230
  }
3164
- function bt() {
3165
- const e = Pe();
3166
- return R(() => ({
2231
+ function Pe() {
2232
+ const e = ue();
2233
+ return M(() => ({
3167
2234
  // 编辑器实例
3168
2235
  editor: e.editor.value,
3169
2236
  // 基础操作
@@ -3190,58 +2257,58 @@ function bt() {
3190
2257
  hasContent: e.hasContent.value
3191
2258
  }));
3192
2259
  }
3193
- const Ts = { class: "tr-sender-editor-scroll" }, Es = /* @__PURE__ */ V({
2260
+ const On = { class: "tr-sender-editor-scroll" }, In = /* @__PURE__ */ X({
3194
2261
  __name: "index",
3195
2262
  setup(e) {
3196
- const { editor: t, editorRef: o } = Pe();
3197
- return (s, r) => (M(), P("div", {
2263
+ const { editor: t, editorRef: o } = ue();
2264
+ return (s, i) => (w(), P("div", {
3198
2265
  ref_key: "editorRef",
3199
2266
  ref: o,
3200
2267
  class: "tr-sender-editor-wrapper"
3201
2268
  }, [
3202
- $("div", Ts, [
3203
- k(t) ? (M(), J(k(En), {
2269
+ R("div", On, [
2270
+ A(t) ? (w(), U(A(xt), {
3204
2271
  key: 0,
3205
- editor: k(t),
2272
+ editor: A(t),
3206
2273
  class: "tr-sender-editor-content"
3207
- }, null, 8, ["editor"])) : q("", !0)
2274
+ }, null, 8, ["editor"])) : N("", !0)
3208
2275
  ])
3209
2276
  ], 512));
3210
2277
  }
3211
- }), sn = /* @__PURE__ */ te(Es, [["__scopeId", "data-v-7f5b51aa"]]), ws = { class: "tr-sender-single-layout" }, Cs = {
2278
+ }), nt = /* @__PURE__ */ Z(In, [["__scopeId", "data-v-7f5b51aa"]]), Rn = { class: "tr-sender-single-layout" }, Bn = {
3212
2279
  key: 0,
3213
2280
  class: "tr-sender-header"
3214
- }, As = { class: "tr-sender-container" }, Ss = { class: "tr-sender-main" }, _s = {
2281
+ }, jn = { class: "tr-sender-container" }, $n = { class: "tr-sender-main" }, Kn = {
3215
2282
  key: 0,
3216
2283
  class: "tr-sender-prefix"
3217
- }, Ls = { class: "tr-sender-content" }, ks = /* @__PURE__ */ V({
2284
+ }, qn = { class: "tr-sender-content" }, Nn = /* @__PURE__ */ X({
3218
2285
  __name: "SingleLineLayout",
3219
2286
  setup(e) {
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, [
3223
- D(i.$slots, "header", {}, void 0, !0)
3224
- ])) : q("", !0),
3225
- $("div", As, [
3226
- $("div", Ss, [
3227
- i.$slots.prefix ? (M(), P("div", _s, [
3228
- D(i.$slots, "prefix", {}, void 0, !0)
3229
- ])) : q("", !0),
3230
- $("div", Ls, [
3231
- D(i.$slots, "content", { editor: k(t) }, () => [
3232
- ie(sn)
2287
+ const { editor: t, hasContent: o, loading: s, showWordLimit: i, maxLength: n } = ue(), a = Pe();
2288
+ return (r, l) => (w(), P("div", Rn, [
2289
+ r.$slots.header ? (w(), P("div", Bn, [
2290
+ O(r.$slots, "header", {}, void 0, !0)
2291
+ ])) : N("", !0),
2292
+ R("div", jn, [
2293
+ R("div", $n, [
2294
+ r.$slots.prefix ? (w(), P("div", Kn, [
2295
+ O(r.$slots, "prefix", {}, void 0, !0)
2296
+ ])) : N("", !0),
2297
+ R("div", qn, [
2298
+ O(r.$slots, "content", { editor: A(t) }, () => [
2299
+ Y(nt)
3233
2300
  ], !0)
3234
2301
  ])
3235
2302
  ]),
3236
- $("div", {
3237
- class: Y(["tr-sender-actions-inline", { "has-content": k(o) || k(s) }])
2303
+ R("div", {
2304
+ class: V(["tr-sender-actions-inline", { "has-content": A(o) || A(s) }])
3238
2305
  }, [
3239
- k(r) && k(n) ? (M(), J(k(Rt), { key: 0 })) : q("", !0),
3240
- ie(k(Pt), null, $e({ _: 2 }, [
3241
- i.$slots["actions-inline"] ? {
2306
+ A(i) && A(n) ? (w(), U(A(Ke), { key: 0 })) : N("", !0),
2307
+ Y(A(qe), null, me({ _: 2 }, [
2308
+ r.$slots["actions-inline"] ? {
3242
2309
  name: "prepend",
3243
- fn: j(() => [
3244
- D(i.$slots, "actions-inline", U(X(k(l))), void 0, !0)
2310
+ fn: B(() => [
2311
+ O(r.$slots, "actions-inline", z(F(A(a))), void 0, !0)
3245
2312
  ]),
3246
2313
  key: "0"
3247
2314
  } : void 0
@@ -3250,69 +2317,69 @@ const Ts = { class: "tr-sender-editor-scroll" }, Es = /* @__PURE__ */ V({
3250
2317
  ])
3251
2318
  ]));
3252
2319
  }
3253
- }), Ms = /* @__PURE__ */ te(ks, [["__scopeId", "data-v-7b0a576c"]]), Rs = {
2320
+ }), Hn = /* @__PURE__ */ Z(Nn, [["__scopeId", "data-v-7b0a576c"]]), Wn = {
3254
2321
  key: 0,
3255
2322
  class: "tr-sender-footer"
3256
- }, Ps = { class: "tr-sender-footer-left" }, Os = { class: "tr-sender-footer-right" }, Ds = /* @__PURE__ */ V({
2323
+ }, zn = { class: "tr-sender-footer-left" }, Fn = { class: "tr-sender-footer-right" }, Vn = /* @__PURE__ */ X({
3257
2324
  __name: "index",
3258
2325
  setup(e) {
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)
2326
+ const { mode: t, showWordLimit: o, maxLength: s } = ue(), i = Pe();
2327
+ return (n, a) => A(t) === "multiple" ? (w(), P("div", Wn, [
2328
+ R("div", zn, [
2329
+ O(n.$slots, "footer", z(F(A(i))), void 0, !0)
3263
2330
  ]),
3264
- $("div", Os, [
3265
- k(o) && k(s) ? (M(), J(k(Rt), { key: 0 })) : q("", !0),
3266
- ie(k(Pt), null, $e({ _: 2 }, [
2331
+ R("div", Fn, [
2332
+ A(o) && A(s) ? (w(), U(A(Ke), { key: 0 })) : N("", !0),
2333
+ Y(A(qe), null, me({ _: 2 }, [
3267
2334
  n.$slots["footer-right"] ? {
3268
2335
  name: "prepend",
3269
- fn: j(() => [
3270
- D(n.$slots, "footer-right", U(X(k(r))), void 0, !0)
2336
+ fn: B(() => [
2337
+ O(n.$slots, "footer-right", z(F(A(i))), void 0, !0)
3271
2338
  ]),
3272
2339
  key: "0"
3273
2340
  } : void 0
3274
2341
  ]), 1024)
3275
2342
  ])
3276
- ])) : q("", !0);
2343
+ ])) : N("", !0);
3277
2344
  }
3278
- }), Bs = /* @__PURE__ */ te(Ds, [["__scopeId", "data-v-ffcdce27"]]), Is = { class: "tr-sender-multi-layout" }, $s = {
2345
+ }), Gn = /* @__PURE__ */ Z(Vn, [["__scopeId", "data-v-ffcdce27"]]), Un = { class: "tr-sender-multi-layout" }, Xn = {
3279
2346
  key: 0,
3280
2347
  class: "tr-sender-header"
3281
- }, js = { class: "tr-sender-main" }, Ns = {
2348
+ }, Zn = { class: "tr-sender-main" }, Yn = {
3282
2349
  key: 0,
3283
2350
  class: "tr-sender-prefix"
3284
- }, Ws = { class: "tr-sender-content" }, Ks = /* @__PURE__ */ V({
2351
+ }, Jn = { class: "tr-sender-content" }, Qn = /* @__PURE__ */ X({
3285
2352
  __name: "MultiLineLayout",
3286
2353
  setup(e) {
3287
- const t = Pe(), o = bt();
3288
- return (s, r) => (M(), P("div", Is, [
3289
- s.$slots.header ? (M(), P("div", $s, [
3290
- D(s.$slots, "header", {}, void 0, !0)
3291
- ])) : q("", !0),
3292
- $("div", js, [
3293
- s.$slots.prefix ? (M(), P("div", Ns, [
3294
- D(s.$slots, "prefix", {}, void 0, !0)
3295
- ])) : q("", !0),
3296
- $("div", Ws, [
3297
- D(s.$slots, "content", {
3298
- editor: k(t).editor
2354
+ const t = ue(), o = Pe();
2355
+ return (s, i) => (w(), P("div", Un, [
2356
+ s.$slots.header ? (w(), P("div", Xn, [
2357
+ O(s.$slots, "header", {}, void 0, !0)
2358
+ ])) : N("", !0),
2359
+ R("div", Zn, [
2360
+ s.$slots.prefix ? (w(), P("div", Yn, [
2361
+ O(s.$slots, "prefix", {}, void 0, !0)
2362
+ ])) : N("", !0),
2363
+ R("div", Jn, [
2364
+ O(s.$slots, "content", {
2365
+ editor: A(t).editor
3299
2366
  }, () => [
3300
- ie(sn)
2367
+ Y(nt)
3301
2368
  ], !0)
3302
2369
  ])
3303
2370
  ]),
3304
- ie(Bs, null, {
3305
- footer: j(() => [
3306
- D(s.$slots, "footer", U(X(k(o))), void 0, !0)
2371
+ Y(Gn, null, {
2372
+ footer: B(() => [
2373
+ O(s.$slots, "footer", z(F(A(o))), void 0, !0)
3307
2374
  ]),
3308
- "footer-right": j(() => [
3309
- D(s.$slots, "footer-right", U(X(k(o))), void 0, !0)
2375
+ "footer-right": B(() => [
2376
+ O(s.$slots, "footer-right", z(F(A(o))), void 0, !0)
3310
2377
  ]),
3311
2378
  _: 3
3312
2379
  })
3313
2380
  ]));
3314
2381
  }
3315
- }), qs = /* @__PURE__ */ te(Ks, [["__scopeId", "data-v-0b507198"]]), Hs = /* @__PURE__ */ V({
2382
+ }), eo = /* @__PURE__ */ Z(Qn, [["__scopeId", "data-v-0b507198"]]), to = /* @__PURE__ */ X({
3316
2383
  __name: "index",
3317
2384
  props: {
3318
2385
  modelValue: {},
@@ -3336,102 +2403,102 @@ const Ts = { class: "tr-sender-editor-scroll" }, Es = /* @__PURE__ */ V({
3336
2403
  },
3337
2404
  emits: ["update:modelValue", "submit", "focus", "blur", "clear", "cancel", "input"],
3338
2405
  setup(e, { expose: t, emit: o }) {
3339
- const s = e, r = o, { context: n, expose: l } = vs(s, r);
3340
- return t(l), (i, a) => (M(), P("div", {
3341
- class: Y([
2406
+ const s = e, i = o, { context: n, expose: a } = Dn(s, i);
2407
+ return t(a), (r, l) => (w(), P("div", {
2408
+ class: V([
3342
2409
  "tr-sender",
3343
- `tr-sender--${k(n).mode.value}`,
3344
- `tr-sender--${k(n).size.value}`,
2410
+ `tr-sender--${A(n).mode.value}`,
2411
+ `tr-sender--${A(n).size.value}`,
3345
2412
  {
3346
- "is-auto-switching": k(n).isAutoSwitching.value,
3347
- "is-disabled": k(n).disabled.value
2413
+ "is-auto-switching": A(n).isAutoSwitching.value,
2414
+ "is-disabled": A(n).disabled.value
3348
2415
  }
3349
2416
  ])
3350
2417
  }, [
3351
- k(n).mode.value === "single" ? (M(), J(Ms, { key: 0 }, $e({ _: 2 }, [
3352
- i.$slots.header ? {
2418
+ A(n).mode.value === "single" ? (w(), U(Hn, { key: 0 }, me({ _: 2 }, [
2419
+ r.$slots.header ? {
3353
2420
  name: "header",
3354
- fn: j(() => [
3355
- D(i.$slots, "header", {}, void 0, !0)
2421
+ fn: B(() => [
2422
+ O(r.$slots, "header", {}, void 0, !0)
3356
2423
  ]),
3357
2424
  key: "0"
3358
2425
  } : void 0,
3359
- i.$slots.prefix ? {
2426
+ r.$slots.prefix ? {
3360
2427
  name: "prefix",
3361
- fn: j(() => [
3362
- D(i.$slots, "prefix", {}, void 0, !0)
2428
+ fn: B(() => [
2429
+ O(r.$slots, "prefix", {}, void 0, !0)
3363
2430
  ]),
3364
2431
  key: "1"
3365
2432
  } : void 0,
3366
- i.$slots.content ? {
2433
+ r.$slots.content ? {
3367
2434
  name: "content",
3368
- fn: j((c) => [
3369
- D(i.$slots, "content", U(X(c)), void 0, !0)
2435
+ fn: B((u) => [
2436
+ O(r.$slots, "content", z(F(u)), void 0, !0)
3370
2437
  ]),
3371
2438
  key: "2"
3372
2439
  } : void 0,
3373
- i.$slots["actions-inline"] ? {
2440
+ r.$slots["actions-inline"] ? {
3374
2441
  name: "actions-inline",
3375
- fn: j((c) => [
3376
- D(i.$slots, "actions-inline", U(X(c)), void 0, !0)
2442
+ fn: B((u) => [
2443
+ O(r.$slots, "actions-inline", z(F(u)), void 0, !0)
3377
2444
  ]),
3378
2445
  key: "3"
3379
2446
  } : void 0
3380
- ]), 1024)) : (M(), J(qs, { key: 1 }, $e({ _: 2 }, [
3381
- i.$slots.header ? {
2447
+ ]), 1024)) : (w(), U(eo, { key: 1 }, me({ _: 2 }, [
2448
+ r.$slots.header ? {
3382
2449
  name: "header",
3383
- fn: j(() => [
3384
- D(i.$slots, "header", {}, void 0, !0)
2450
+ fn: B(() => [
2451
+ O(r.$slots, "header", {}, void 0, !0)
3385
2452
  ]),
3386
2453
  key: "0"
3387
2454
  } : void 0,
3388
- i.$slots.prefix ? {
2455
+ r.$slots.prefix ? {
3389
2456
  name: "prefix",
3390
- fn: j(() => [
3391
- D(i.$slots, "prefix", {}, void 0, !0)
2457
+ fn: B(() => [
2458
+ O(r.$slots, "prefix", {}, void 0, !0)
3392
2459
  ]),
3393
2460
  key: "1"
3394
2461
  } : void 0,
3395
- i.$slots.content ? {
2462
+ r.$slots.content ? {
3396
2463
  name: "content",
3397
- fn: j((c) => [
3398
- D(i.$slots, "content", U(X(c)), void 0, !0)
2464
+ fn: B((u) => [
2465
+ O(r.$slots, "content", z(F(u)), void 0, !0)
3399
2466
  ]),
3400
2467
  key: "2"
3401
2468
  } : void 0,
3402
- i.$slots.footer ? {
2469
+ r.$slots.footer ? {
3403
2470
  name: "footer",
3404
- fn: j((c) => [
3405
- D(i.$slots, "footer", U(X(c)), void 0, !0)
2471
+ fn: B((u) => [
2472
+ O(r.$slots, "footer", z(F(u)), void 0, !0)
3406
2473
  ]),
3407
2474
  key: "3"
3408
2475
  } : void 0,
3409
- i.$slots["footer-right"] ? {
2476
+ r.$slots["footer-right"] ? {
3410
2477
  name: "footer-right",
3411
- fn: j((c) => [
3412
- D(i.$slots, "footer-right", U(X(c)), void 0, !0)
2478
+ fn: B((u) => [
2479
+ O(r.$slots, "footer-right", z(F(u)), void 0, !0)
3413
2480
  ]),
3414
2481
  key: "4"
3415
2482
  } : void 0
3416
2483
  ]), 1024))
3417
2484
  ], 2));
3418
2485
  }
3419
- }), ze = /* @__PURE__ */ te(Hs, [["__scopeId", "data-v-796349fa"]]);
3420
- ze.name = "TrSender";
3421
- const zs = function(e) {
3422
- e.component(ze.name, ze);
3423
- }, lr = Object.assign(ze, {
3424
- install: zs,
2486
+ }), xe = /* @__PURE__ */ Z(to, [["__scopeId", "data-v-796349fa"]]);
2487
+ xe.name = "TrSender";
2488
+ const no = function(e) {
2489
+ e.component(xe.name, xe);
2490
+ }, Eo = Object.assign(xe, {
2491
+ install: no,
3425
2492
  // 扩展类(用于继承)
3426
- Mention: Gt,
3427
- Suggestion: Xt,
3428
- Template: Zt,
2493
+ Mention: Fe,
2494
+ Suggestion: Ge,
2495
+ Template: Xe,
3429
2496
  // 便捷函数(用于简单场景)
3430
- mention: Do,
3431
- suggestion: Ho,
3432
- template: as
2497
+ mention: Ft,
2498
+ suggestion: en,
2499
+ template: Tn
3433
2500
  });
3434
2501
  export {
3435
- lr as default,
3436
- Pe as useSenderContext
2502
+ Eo as default,
2503
+ ue as useSenderContext
3437
2504
  };