@opentiny/tiny-robot 0.3.0-alpha.17 → 0.3.0-alpha.18

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,228 +1,228 @@
1
- import { ref as M, watch as ne, reactive as ot, computed as L, defineComponent as _e, createElementBlock as T, openBlock as m, createCommentVNode as U, normalizeStyle as Fe, createBlock as Z, unref as S, withCtx as de, createElementVNode as z, createVNode as X, normalizeClass as oe, toDisplayString as ce, useAttrs as st, resolveComponent as at, mergeProps as me, Fragment as fe, renderList as be, mergeModels as lt, useModel as rt, onMounted as it, onUnmounted as ut, nextTick as te, Transition as We, withModifiers as ct, useSlots as dt, renderSlot as ue, isRef as ft, createTextVNode as je } from "vue";
1
+ import { ref as M, watch as oe, reactive as ot, computed as L, defineComponent as Ce, createElementBlock as I, openBlock as m, createCommentVNode as N, normalizeStyle as Ve, createBlock as ee, unref as S, withCtx as ye, createElementVNode as U, createVNode as Q, normalizeClass as se, toDisplayString as ce, useAttrs as st, resolveComponent as at, mergeProps as we, Fragment as ve, renderList as Se, mergeModels as lt, useModel as rt, onMounted as it, onUnmounted as ut, nextTick as ne, Transition as We, withModifiers as ct, useSlots as dt, renderSlot as ue, isRef as ft, createTextVNode as je } from "vue";
2
2
  import { I as pt } from "../index6.js";
3
3
  import { d as ht } from "../index3.js";
4
- import { T as Me } from "../index2.js";
4
+ import { T as Fe } from "../index2.js";
5
5
  import { p as yt, u as vt, I as gt, x as mt, i as bt, l as _t, z as wt } from "../tiny-robot-svgs.js";
6
- import { _ as Oe } from "../_plugin-vue_export-helper.js";
6
+ import { _ as Be } from "../_plugin-vue_export-helper.js";
7
7
  import { t as St } from "../utils.js";
8
- function Ct(l, u) {
8
+ function Ct(l, c) {
9
9
  const s = M(l.modelValue || l.defaultValue || ""), i = M(null);
10
- ne(
10
+ oe(
11
11
  () => l.modelValue,
12
- (p) => {
13
- p !== void 0 && p !== s.value && (s.value = p);
12
+ (h) => {
13
+ h !== void 0 && h !== s.value && (s.value = h);
14
14
  }
15
- ), ne(
15
+ ), oe(
16
16
  () => s.value,
17
- (p) => {
18
- u("update:modelValue", p);
17
+ (h) => {
18
+ c("update:modelValue", h);
19
19
  }
20
20
  );
21
- const y = (p) => {
22
- s.value = p, u("update:modelValue", p);
23
- }, _ = (p) => {
24
- p == null || p.preventDefault();
21
+ const v = (h) => {
22
+ s.value = h, c("update:modelValue", h);
23
+ }, w = (h) => {
24
+ h == null || h.preventDefault();
25
25
  const b = s.value;
26
- !l.disabled && !l.loading && b.trim() && u("submit", b);
26
+ !l.disabled && !l.loading && b.trim() && c("submit", b);
27
27
  }, a = () => {
28
- s.value = "", u("update:modelValue", ""), u("clear");
28
+ s.value = "", c("update:modelValue", ""), c("clear");
29
29
  }, d = M(!1);
30
30
  return {
31
31
  inputValue: s,
32
32
  inputWrapper: i,
33
33
  isComposing: d,
34
- handleChange: y,
35
- handleSubmit: _,
34
+ handleChange: v,
35
+ handleSubmit: w,
36
36
  handleClear: a,
37
37
  clearInput: () => {
38
38
  a();
39
39
  }
40
40
  };
41
41
  }
42
- function xt(l, u, s, i, y, _, a, d, C, p, b, h, A, V, P, W) {
43
- const k = () => {
44
- h.value && (P != null && P.value && (W == null || W()), u("submit", s.value.trim()));
45
- }, v = (g, E) => {
46
- if (!(g.key === "Enter")) return !1;
47
- switch (E) {
42
+ function xt(l, c, s, i, v, w, a, d, C, h, b, y, K, W, F, P) {
43
+ const T = () => {
44
+ y.value && (F != null && F.value && (P == null || P()), c("submit", s.value.trim()));
45
+ }, g = (p, Y) => {
46
+ if (!(p.key === "Enter")) return !1;
47
+ switch (Y) {
48
48
  case "enter":
49
- return !g.shiftKey && !g.ctrlKey && !g.metaKey;
49
+ return !p.shiftKey && !p.ctrlKey && !p.metaKey;
50
50
  case "ctrlEnter":
51
- return (g.ctrlKey || g.metaKey) && !g.shiftKey;
51
+ return (p.ctrlKey || p.metaKey) && !p.shiftKey;
52
52
  case "shiftEnter":
53
- return g.shiftKey && !g.ctrlKey && !g.metaKey;
53
+ return p.shiftKey && !p.ctrlKey && !p.metaKey;
54
54
  default:
55
55
  return !1;
56
56
  }
57
57
  };
58
58
  return {
59
- handleKeyPress: (g) => {
59
+ handleKeyPress: (p) => {
60
60
  if (i.value) return;
61
- if (g.key === "Enter" && g.shiftKey && (A == null ? void 0 : A.value) === "single" && V) {
62
- g.preventDefault(), V();
63
- const q = g.target, Q = q.selectionStart, F = s.value;
64
- s.value = F.substring(0, Q) + `
65
- ` + F.substring(Q), setTimeout(() => {
66
- q.selectionStart = q.selectionEnd = Q + 1;
61
+ if (p.key === "Enter" && p.shiftKey && (K == null ? void 0 : K.value) === "single" && W) {
62
+ p.preventDefault(), W();
63
+ const B = p.target, q = B.selectionStart, te = s.value;
64
+ s.value = te.substring(0, q) + `
65
+ ` + te.substring(q), setTimeout(() => {
66
+ B.selectionStart = B.selectionEnd = q + 1;
67
67
  }, 0);
68
68
  return;
69
69
  }
70
- if (g.key === "Tab" && _.value && a.value) {
71
- g.preventDefault(), d();
70
+ if (p.key === "Tab" && w.value && a.value) {
71
+ p.preventDefault(), d();
72
72
  return;
73
73
  }
74
- if (_.value) {
75
- if (g.key === "ArrowDown") {
76
- g.preventDefault(), p("down");
74
+ if (w.value) {
75
+ if (p.key === "ArrowDown") {
76
+ p.preventDefault(), h("down");
77
77
  return;
78
78
  }
79
- if (g.key === "ArrowUp") {
80
- g.preventDefault(), p("up");
79
+ if (p.key === "ArrowUp") {
80
+ p.preventDefault(), h("up");
81
81
  return;
82
82
  }
83
- if (g.key === "Enter" && a.value) {
84
- g.preventDefault(), d();
83
+ if (p.key === "Enter" && a.value) {
84
+ p.preventDefault(), d();
85
85
  return;
86
86
  }
87
87
  }
88
- if (g.key === "Escape") {
89
- _.value ? (C(), g.preventDefault()) : y.isRecording && (b(), g.preventDefault()), u("escape-press");
88
+ if (p.key === "Escape") {
89
+ w.value ? (C(), p.preventDefault()) : v.isRecording && (b(), p.preventDefault()), c("escape-press");
90
90
  return;
91
91
  }
92
- v(g, l.submitType) && (g.preventDefault(), h.value && k());
92
+ g(p, l.submitType) && (p.preventDefault(), y.value && T());
93
93
  },
94
- triggerSubmit: k
94
+ triggerSubmit: T
95
95
  };
96
96
  }
97
97
  function kt(l) {
98
- const u = ot({
98
+ const c = ot({
99
99
  isRecording: !1,
100
100
  isSupported: typeof window < "u" && "webkitSpeechRecognition" in window || "SpeechRecognition" in window,
101
101
  error: void 0
102
- }), s = u.isSupported ? new (window.webkitSpeechRecognition || window.SpeechRecognition)() : void 0;
102
+ }), s = c.isSupported ? new (window.webkitSpeechRecognition || window.SpeechRecognition)() : void 0;
103
103
  s !== void 0 && (s.continuous = l.continuous ?? !1, s.interimResults = l.interimResults ?? !0, s.lang = l.lang ?? navigator.language, s.onstart = () => {
104
104
  var a;
105
- u.isRecording = !0, u.error = void 0, (a = l.onStart) == null || a.call(l);
105
+ c.isRecording = !0, c.error = void 0, (a = l.onStart) == null || a.call(l);
106
106
  }, s.onend = () => {
107
107
  var a;
108
- u.isRecording = !1, (a = l.onEnd) == null || a.call(l);
108
+ c.isRecording = !1, (a = l.onEnd) == null || a.call(l);
109
109
  }, s.onresult = (a) => {
110
- var C, p;
110
+ var C, h;
111
111
  const d = Array.from(a.results).map((b) => b[0].transcript).join("");
112
- a.results[0].isFinal ? (C = l.onFinal) == null || C.call(l, d) : (p = l.onInterim) == null || p.call(l, d);
112
+ a.results[0].isFinal ? (C = l.onFinal) == null || C.call(l, d) : (h = l.onInterim) == null || h.call(l, d);
113
113
  }, s.onerror = (a) => {
114
114
  var d;
115
- u.error = new Error(a.error), u.isRecording = !1, (d = l.onError) == null || d.call(l, u.error);
115
+ c.error = new Error(a.error), c.isRecording = !1, (d = l.onError) == null || d.call(l, c.error);
116
116
  });
117
117
  const i = () => {
118
118
  var a;
119
119
  if (!s) {
120
120
  const d = new Error("浏览器不支持语音识别");
121
- u.error = d, (a = l.onError) == null || a.call(l, d);
121
+ c.error = d, (a = l.onError) == null || a.call(l, d);
122
122
  return;
123
123
  }
124
- if (u.isRecording) {
124
+ if (c.isRecording) {
125
125
  try {
126
126
  s.stop(), setTimeout(() => {
127
127
  try {
128
128
  s.start();
129
129
  } catch (d) {
130
- _(d);
130
+ w(d);
131
131
  }
132
132
  }, 100);
133
133
  } catch (d) {
134
- _(d);
134
+ w(d);
135
135
  }
136
136
  return;
137
137
  }
138
138
  try {
139
139
  s.start();
140
140
  } catch (d) {
141
- _(d);
141
+ w(d);
142
142
  }
143
- }, y = () => {
144
- if (s && u.isRecording)
143
+ }, v = () => {
144
+ if (s && c.isRecording)
145
145
  try {
146
146
  s.stop();
147
147
  } catch (a) {
148
- _(a);
148
+ w(a);
149
149
  }
150
- }, _ = (a) => {
150
+ }, w = (a) => {
151
151
  var d;
152
- u.error = a instanceof Error ? a : new Error("语音识别操作失败"), u.isRecording = !1, (d = l.onError) == null || d.call(l, u.error);
152
+ c.error = a instanceof Error ? a : new Error("语音识别操作失败"), c.isRecording = !1, (d = l.onError) == null || d.call(l, c.error);
153
153
  };
154
154
  return {
155
- speechState: u,
155
+ speechState: c,
156
156
  start: i,
157
- stop: y
157
+ stop: v
158
158
  };
159
159
  }
160
- function It(l, u, s, i, y, _) {
161
- const a = M(!1), d = M(-1), C = M(-1), p = M(null), b = M(""), h = M(!1), A = L(() => {
162
- var G, j;
163
- if (!((G = l.value) != null && G.length)) return "";
164
- const B = p.value === "mouse" ? C.value : d.value;
165
- return ((j = l.value[B]) == null ? void 0 : j.content) || "";
166
- }), V = (B) => {
167
- b.value = B, h.value = !0;
168
- }, P = () => {
169
- b.value = "", h.value = !1;
170
- }, W = (B) => {
171
- const G = B || A.value;
172
- if (!G || !u.value) {
173
- P();
160
+ function It(l, c, s, i, v, w) {
161
+ const a = M(!1), d = M(-1), C = M(-1), h = M(null), b = M(""), y = M(!1), K = L(() => {
162
+ var j, J;
163
+ if (!((j = l.value) != null && j.length)) return "";
164
+ const x = h.value === "mouse" ? C.value : d.value;
165
+ return ((J = l.value[x]) == null ? void 0 : J.content) || "";
166
+ }), W = (x) => {
167
+ b.value = x, y.value = !0;
168
+ }, F = () => {
169
+ b.value = "", y.value = !1;
170
+ }, P = (x) => {
171
+ const j = x || K.value;
172
+ if (!j || !c.value) {
173
+ F();
174
174
  return;
175
175
  }
176
- const j = G.substring(u.value.length);
177
- G.toLowerCase().startsWith(u.value.toLowerCase()) && j ? V(j) : P();
178
- }, k = () => {
179
- d.value = -1, C.value = -1, p.value = null;
180
- }, v = () => {
181
- a.value = !0, W();
182
- }, R = () => {
183
- a.value = !1, k(), P();
184
- }, g = L(() => {
185
- var B;
186
- return s.value ? !0 : !!(u.value && ((B = l.value) == null ? void 0 : B.length) > 0 && !i.value);
187
- }), E = (B) => {
188
- R(), u.value = B, y(B), _(B);
189
- }, q = () => {
190
- A.value && E(A.value);
191
- }, Q = (B) => {
192
- !a.value || !l.value || (p.value = "keyboard", d.value === -1 ? d.value = B === "down" ? 0 : l.value.length - 1 : B === "down" ? d.value = (d.value + 1) % l.value.length : d.value = (d.value - 1 + l.value.length) % l.value.length, W());
193
- }, F = (B) => {
194
- l.value && (p.value = "mouse", C.value = B, W());
195
- }, N = () => {
196
- l.value && (C.value = -1, d.value !== -1 ? p.value = "keyboard" : p.value = null, W());
176
+ const J = j.substring(c.value.length);
177
+ j.toLowerCase().startsWith(c.value.toLowerCase()) && J ? W(J) : F();
178
+ }, T = () => {
179
+ d.value = -1, C.value = -1, h.value = null;
180
+ }, g = () => {
181
+ a.value = !0, P();
182
+ }, O = () => {
183
+ a.value = !1, T(), F();
184
+ }, p = L(() => {
185
+ var x;
186
+ return s.value ? !0 : !!(c.value && ((x = l.value) == null ? void 0 : x.length) > 0 && !i.value);
187
+ }), Y = (x) => {
188
+ O(), c.value = x, v(x), w(x);
189
+ }, B = () => {
190
+ K.value && Y(K.value);
191
+ }, q = (x) => {
192
+ !a.value || !l.value || (h.value = "keyboard", d.value === -1 ? d.value = x === "down" ? 0 : l.value.length - 1 : x === "down" ? d.value = (d.value + 1) % l.value.length : d.value = (d.value - 1 + l.value.length) % l.value.length, P());
193
+ }, te = (x) => {
194
+ l.value && (h.value = "mouse", C.value = x, P());
195
+ }, H = () => {
196
+ l.value && (C.value = -1, d.value !== -1 ? h.value = "keyboard" : h.value = null, P());
197
197
  };
198
- return ne(g, (B) => {
199
- B ? a.value || v() : a.value && R();
198
+ return oe(p, (x) => {
199
+ x ? a.value || g() : a.value && O();
200
200
  }), {
201
201
  // 弹窗控制
202
202
  isPopupVisible: a,
203
- openPopup: v,
204
- closePopup: R,
203
+ openPopup: g,
204
+ closePopup: O,
205
205
  // 自动完成占位符
206
206
  autoCompleteText: b,
207
- showTabIndicator: h,
208
- syncAutoComplete: W,
207
+ showTabIndicator: y,
208
+ syncAutoComplete: P,
209
209
  // 选中控制层
210
- activeSuggestion: A,
210
+ activeSuggestion: K,
211
211
  activeKeyboardIndex: d,
212
212
  activeMouseIndex: C,
213
213
  // 交互处理
214
- navigateWithKeyboard: Q,
215
- handleMouseEnter: F,
216
- handleMouseLeave: N,
214
+ navigateWithKeyboard: q,
215
+ handleMouseEnter: te,
216
+ handleMouseLeave: H,
217
217
  // 业务操作
218
- applySuggestion: E,
219
- confirmSelection: q
218
+ applySuggestion: Y,
219
+ confirmSelection: B
220
220
  };
221
221
  }
222
- const Rt = { class: "action-buttons" }, Tt = { class: "action-buttons__submit-content" }, Ot = {
222
+ const Tt = { class: "action-buttons" }, Rt = { class: "action-buttons__submit-content" }, Ot = {
223
223
  key: 0,
224
224
  class: "action-buttons__cancel-text"
225
- }, Et = /* @__PURE__ */ _e({
225
+ }, Et = /* @__PURE__ */ Ce({
226
226
  __name: "ActionButtons",
227
227
  props: {
228
228
  loading: { type: Boolean, default: !1 },
@@ -242,144 +242,144 @@ const Rt = { class: "action-buttons" }, Tt = { class: "action-buttons__submit-co
242
242
  stopText: { default: void 0 }
243
243
  },
244
244
  emits: ["clear", "toggle-speech", "submit", "cancel", "trigger-select"],
245
- setup(l, { emit: u }) {
246
- const s = l, i = u, y = L(() => {
247
- var R, g;
248
- const v = (g = (R = s.buttonGroup) == null ? void 0 : R.file) == null ? void 0 : g.tooltips;
249
- if (typeof v == "string" && v)
250
- return () => v;
251
- if (typeof v == "function")
252
- return v;
253
- }), _ = L(() => {
254
- var R, g;
255
- const v = (g = (R = s.buttonGroup) == null ? void 0 : R.submit) == null ? void 0 : g.tooltips;
256
- if (typeof v == "string" && v)
257
- return () => v;
258
- if (typeof v == "function")
259
- return v;
260
- }), a = L(() => s.allowSpeech), d = L(() => s.speechStatus.isRecording), C = L(() => s.disabled), p = L(() => {
261
- var v, R;
262
- return C.value || s.isOverLimit || ((R = (v = s.buttonGroup) == null ? void 0 : v.submit) == null ? void 0 : R.disabled);
263
- }), b = L(() => s.allowFiles || s.allowSpeech || s.showClear), h = () => {
245
+ setup(l, { emit: c }) {
246
+ const s = l, i = c, v = L(() => {
247
+ var O, p;
248
+ const g = (p = (O = s.buttonGroup) == null ? void 0 : O.file) == null ? void 0 : p.tooltips;
249
+ if (typeof g == "string" && g)
250
+ return () => g;
251
+ if (typeof g == "function")
252
+ return g;
253
+ }), w = L(() => {
254
+ var O, p;
255
+ const g = (p = (O = s.buttonGroup) == null ? void 0 : O.submit) == null ? void 0 : p.tooltips;
256
+ if (typeof g == "string" && g)
257
+ return () => g;
258
+ if (typeof g == "function")
259
+ return g;
260
+ }), a = L(() => s.allowSpeech), d = L(() => s.speechStatus.isRecording), C = L(() => s.disabled), h = L(() => {
261
+ var g, O;
262
+ return C.value || s.isOverLimit || ((O = (g = s.buttonGroup) == null ? void 0 : g.submit) == null ? void 0 : O.disabled);
263
+ }), b = L(() => s.allowFiles || s.allowSpeech || s.showClear), y = () => {
264
264
  C.value || i("clear");
265
- }, A = () => {
265
+ }, K = () => {
266
266
  if (!C.value) {
267
- const v = !s.speechStatus.isRecording;
268
- i("toggle-speech", v);
267
+ const g = !s.speechStatus.isRecording;
268
+ i("toggle-speech", g);
269
269
  }
270
- }, V = () => {
271
- p.value || i("submit");
272
- }, P = () => {
270
+ }, W = () => {
271
+ h.value || i("submit");
272
+ }, F = () => {
273
273
  C.value || i("cancel");
274
- }, W = L(() => {
275
- var v, R;
276
- return C.value || ((R = (v = s.buttonGroup) == null ? void 0 : v.file) == null ? void 0 : R.disabled);
277
- }), k = () => {
278
- W.value || i("trigger-select");
274
+ }, P = L(() => {
275
+ var g, O;
276
+ return C.value || ((O = (g = s.buttonGroup) == null ? void 0 : g.file) == null ? void 0 : O.disabled);
277
+ }), T = () => {
278
+ P.value || i("trigger-select");
279
279
  };
280
- return (v, R) => (m(), T("div", Rt, [
281
- b.value ? (m(), T("div", {
280
+ return (g, O) => (m(), I("div", Tt, [
281
+ b.value ? (m(), I("div", {
282
282
  key: 0,
283
283
  class: "action-buttons__utility",
284
- style: Fe({ "padding-right": v.hasContent || v.loading ? "0" : "6px" })
284
+ style: Ve({ "padding-right": g.hasContent || g.loading ? "0" : "6px" })
285
285
  }, [
286
- v.allowFiles && !v.loading ? (m(), Z(S(Me), {
286
+ g.allowFiles && !g.loading ? (m(), ee(S(Fe), {
287
287
  key: 0,
288
288
  effect: "light",
289
289
  placement: "top",
290
- "render-content": y.value,
290
+ "render-content": v.value,
291
291
  "visible-arrow": !1
292
292
  }, {
293
- default: de(() => [
294
- z("div", {
293
+ default: ye(() => [
294
+ U("div", {
295
295
  class: "action-buttons__button",
296
- onClick: k
296
+ onClick: T
297
297
  }, [
298
- X(S(yt), {
299
- class: oe(["action-buttons__icon", "action-buttons__icon--upload", { "is-disabled": W.value }]),
298
+ Q(S(yt), {
299
+ class: se(["action-buttons__icon", "action-buttons__icon--upload", { "is-disabled": P.value }]),
300
300
  alt: "上传文件"
301
301
  }, null, 8, ["class"])
302
302
  ])
303
303
  ]),
304
304
  _: 1
305
- }, 8, ["render-content"])) : U("", !0),
306
- a.value && !v.loading ? (m(), T("div", {
305
+ }, 8, ["render-content"])) : N("", !0),
306
+ a.value && !g.loading ? (m(), I("div", {
307
307
  key: 1,
308
- class: oe(["action-buttons__button", { "is-recording": d.value }]),
309
- onClick: A
308
+ class: se(["action-buttons__button", { "is-recording": d.value }]),
309
+ onClick: K
310
310
  }, [
311
- d.value ? (m(), Z(S(gt), {
311
+ d.value ? (m(), ee(S(gt), {
312
312
  key: 1,
313
313
  class: "action-buttons__icon action-buttons__icon--recording",
314
314
  alt: "语音中"
315
- })) : (m(), Z(S(vt), {
315
+ })) : (m(), ee(S(vt), {
316
316
  key: 0,
317
317
  class: "action-buttons__icon",
318
318
  alt: "录音"
319
319
  }))
320
- ], 2)) : U("", !0),
321
- v.showClear ? (m(), Z(S(Me), {
320
+ ], 2)) : N("", !0),
321
+ g.showClear ? (m(), ee(S(Fe), {
322
322
  key: 2,
323
323
  content: "清空内容",
324
324
  placement: "top"
325
325
  }, {
326
- default: de(() => [
327
- z("div", {
326
+ default: ye(() => [
327
+ U("div", {
328
328
  class: "action-buttons__button",
329
- onClick: h
329
+ onClick: y
330
330
  }, [
331
- X(S(mt), { class: "action-buttons__icon action-buttons__icon--clear" })
331
+ Q(S(mt), { class: "action-buttons__icon action-buttons__icon--clear" })
332
332
  ])
333
333
  ]),
334
334
  _: 1
335
- })) : U("", !0)
336
- ], 4)) : U("", !0),
337
- v.hasContent || v.loading ? (m(), T("div", {
335
+ })) : N("", !0)
336
+ ], 4)) : N("", !0),
337
+ g.hasContent || g.loading ? (m(), I("div", {
338
338
  key: 1,
339
339
  class: "action-buttons__button action-buttons__submit",
340
- onClick: R[0] || (R[0] = (g) => v.loading ? P() : V())
340
+ onClick: O[0] || (O[0] = (p) => g.loading ? F() : W())
341
341
  }, [
342
- z("div", Tt, [
343
- v.loading ? (m(), T("div", {
342
+ U("div", Rt, [
343
+ g.loading ? (m(), I("div", {
344
344
  key: 1,
345
- class: oe(["action-buttons__cancel", { "action-buttons__cancel--icon-only": !v.stopText }])
345
+ class: se(["action-buttons__cancel", { "action-buttons__cancel--icon-only": !g.stopText }])
346
346
  }, [
347
- X(S(_t), {
347
+ Q(S(_t), {
348
348
  class: "action-buttons__icon action-buttons__icon--cancel",
349
349
  alt: "停止"
350
350
  }),
351
- v.stopText ? (m(), T("span", Ot, ce(v.stopText), 1)) : U("", !0)
352
- ], 2)) : (m(), Z(S(Me), {
351
+ g.stopText ? (m(), I("span", Ot, ce(g.stopText), 1)) : N("", !0)
352
+ ], 2)) : (m(), ee(S(Fe), {
353
353
  key: 0,
354
354
  effect: "light",
355
355
  placement: "top",
356
- "render-content": _.value,
356
+ "render-content": w.value,
357
357
  "visible-arrow": !1
358
358
  }, {
359
- default: de(() => [
360
- X(S(bt), {
361
- class: oe(["action-buttons__icon", "action-buttons__icon--send", { "is-disabled": p.value }]),
359
+ default: ye(() => [
360
+ Q(S(bt), {
361
+ class: se(["action-buttons__icon", "action-buttons__icon--send", { "is-disabled": h.value }]),
362
362
  alt: "发送"
363
363
  }, null, 8, ["class"])
364
364
  ]),
365
365
  _: 1
366
366
  }, 8, ["render-content"]))
367
367
  ])
368
- ])) : U("", !0)
368
+ ])) : N("", !0)
369
369
  ]));
370
370
  }
371
- }), Je = /* @__PURE__ */ Oe(Et, [["__scopeId", "data-v-a9e0fa92"]]);
372
- function $t(l, u = {}) {
373
- let s = [], i = [], y = l;
371
+ }), Je = /* @__PURE__ */ Be(Et, [["__scopeId", "data-v-a9e0fa92"]]);
372
+ function $t(l, c = {}) {
373
+ let s = [], i = [], v = l;
374
374
  return { commit: (b) => {
375
- var h;
376
- s.push(y), y = b, i.length && ((h = u.onRemoveHistory) == null || h.call(u, i)), i = [];
377
- }, undo: () => s.length ? (i.push(y), y = s.pop(), y) : null, redo: () => i.length ? (s.push(y), y = i.pop(), y) : null, clear: () => {
378
- var b, h;
379
- s.length && ((b = u.onRemoveHistory) == null || b.call(u, s)), i.length && ((h = u.onRemoveHistory) == null || h.call(u, i)), s = [], i = [];
380
- }, get: () => y };
375
+ var y;
376
+ s.push(v), v = b, i.length && ((y = c.onRemoveHistory) == null || y.call(c, i)), i = [];
377
+ }, undo: () => s.length ? (i.push(v), v = s.pop(), v) : null, redo: () => i.length ? (s.push(v), v = i.pop(), v) : null, clear: () => {
378
+ var b, y;
379
+ s.length && ((b = c.onRemoveHistory) == null || b.call(c, s)), i.length && ((y = c.onRemoveHistory) == null || y.call(c, i)), s = [], i = [];
380
+ }, get: () => v };
381
381
  }
382
- const Bt = ["data-id", "data-type"], Lt = ["data-id", "data-type"], Dt = /* @__PURE__ */ _e({
382
+ const Bt = ["data-id", "data-type"], Lt = ["data-id", "data-type"], Dt = /* @__PURE__ */ Ce({
383
383
  inheritAttrs: !1,
384
384
  __name: "Block",
385
385
  props: {
@@ -390,54 +390,62 @@ const Bt = ["data-id", "data-type"], Lt = ["data-id", "data-type"], Dt = /* @__P
390
390
  asChild: { type: Boolean }
391
391
  },
392
392
  setup(l) {
393
- const u = l, s = st();
394
- return (i, y) => {
395
- const _ = at("Block", !0);
396
- return u.type !== "block" ? (m(), T("span", me({
393
+ const c = l, s = st();
394
+ return (i, v) => {
395
+ const w = at("Block", !0);
396
+ return c.type !== "block" ? (m(), I("span", we({
397
397
  key: 0,
398
- "data-id": u.id,
399
- "data-type": u.type
400
- }, S(s)), ce(u.content), 17, Bt)) : (m(), T(fe, { key: 1 }, [
401
- u.asChild ? (m(!0), T(fe, { key: 0 }, be(u.content, (a) => (m(), Z(_, me({
398
+ "data-id": c.id,
399
+ "data-type": c.type
400
+ }, S(s)), ce(c.content), 17, Bt)) : (m(), I(ve, { key: 1 }, [
401
+ c.asChild ? (m(!0), I(ve, { key: 0 }, Se(c.content, (a) => (m(), ee(w, we({
402
402
  key: `${a.id}-${a.type}`
403
- }, { ref_for: !0 }, a), null, 16))), 128)) : (m(), T("span", me({
403
+ }, { ref_for: !0 }, a), null, 16))), 128)) : (m(), I("span", we({
404
404
  key: 1,
405
- "data-id": u.id,
406
- "data-type": u.type
405
+ "data-id": c.id,
406
+ "data-type": c.type
407
407
  }, S(s)), [
408
- (m(!0), T(fe, null, be(u.content, (a) => (m(), Z(_, me({
408
+ (m(!0), I(ve, null, Se(c.content, (a) => (m(), ee(w, we({
409
409
  key: `${a.id}-${a.type}`
410
410
  }, { ref_for: !0 }, a), null, 16))), 128))
411
411
  ], 16, Lt))
412
412
  ], 64));
413
413
  };
414
414
  }
415
- }), At = /* @__PURE__ */ Oe(Dt, [["__scopeId", "data-v-13862606"]]), Kt = { class: "editor-container" }, Pe = "​", Mt = /* @__PURE__ */ _e({
415
+ }), At = /* @__PURE__ */ Be(Dt, [["__scopeId", "data-v-13862606"]]), Kt = { class: "editor-container" }, Pe = "​", Mt = /* @__PURE__ */ Ce({
416
416
  __name: "TemplateEditor",
417
417
  props: {
418
418
  modelValue: { default: () => [] },
419
419
  modelModifiers: {}
420
420
  },
421
421
  emits: /* @__PURE__ */ lt(["submit"], ["update:modelValue"]),
422
- setup(l, { expose: u, emit: s }) {
423
- const i = typeof window.ShadowRoot.prototype.getSelection == "function", y = typeof window.Selection.prototype.getComposedRanges == "function";
424
- function _() {
422
+ setup(l, { expose: c, emit: s }) {
423
+ const i = typeof window.ShadowRoot.prototype.getSelection == "function", v = typeof window.Selection.prototype.getComposedRanges == "function";
424
+ function w() {
425
425
  const e = navigator.userAgent;
426
426
  return e.includes("Safari") && !e.includes("Chrome") && !e.includes("Chromium") && !e.includes("CriOS");
427
427
  }
428
- const a = _(), d = () => Math.random().toString(36).substring(2, 15), C = Pe, p = Pe, b = Pe, h = rt(l, "modelValue"), A = s, V = M(0), P = (e) => e.map((t) => ({
428
+ const a = w(), d = () => Math.random().toString(36).substring(2, 15), C = Pe, h = Pe, b = Pe, y = rt(l, "modelValue"), K = s, W = M(0), F = (e) => e.map((t) => ({
429
429
  id: t.id || d(),
430
- ...t.type === "template" ? { ...t, prefix: p, suffix: b } : t
431
- })), W = (e) => e.map((t) => ({ id: t.id, type: t.type, content: t.content })), k = M(P(h.value || [])), v = (e) => {
432
- const t = [], o = [];
433
- e.length > 0 && e[0].type === "template" && t.push({ type: "text", content: C, id: d() }), e.length > 0 && e[e.length - 1].type === "template" && o.push({ type: "text", content: C, id: d() });
434
- const r = new RegExp(C, "g");
435
- e.length > 0 && (e[0].content !== C && (e[0].content = e[0].content.replace(r, "")), e[e.length - 1].content !== C && (e[e.length - 1].content = e[e.length - 1].content.replace(r, ""))), k.value = t.concat(e).concat(o);
436
- }, R = L(() => k.value.map((e) => e.type === "template" ? [
430
+ ...t.type === "template" ? { ...t, prefix: h, suffix: b } : t
431
+ })), P = (e) => e.map((t) => ({ id: t.id, type: t.type, content: t.content })), T = M(F(y.value || [])), g = (e) => {
432
+ T.value = e;
433
+ }, O = L(() => {
434
+ const e = [], t = [], n = T.value;
435
+ if (n.length >= 2) {
436
+ const r = n[0], f = n[1];
437
+ r.type === "text" && r.content.length === 0 && f.type === "template" && e.push({ ...r, content: C });
438
+ const _ = n[n.length - 1], E = n[n.length - 2];
439
+ _.type === "text" && _.content.length === 0 && E.type === "template" && t.push({ ..._, content: C });
440
+ }
441
+ n.length > 0 && n[0].type === "template" && e.push({ type: "text", content: C, id: d() }), n.length > 0 && n[n.length - 1].type === "template" && t.push({ type: "text", content: C, id: d() });
442
+ const u = new RegExp(C, "g");
443
+ return n.length > 0 && (n[0].content !== C && (n[0].content = n[0].content.replace(u, "")), n[n.length - 1].content !== C && (n[n.length - 1].content = n[n.length - 1].content.replace(u, ""))), e.concat(n).concat(t);
444
+ }), p = L(() => T.value.map((e) => e.type === "template" ? [
437
445
  { id: e.id, type: "prefix", content: e.prefix },
438
446
  { id: e.id, type: "template", content: e.content },
439
447
  { id: e.id, type: "suffix", content: e.suffix }
440
- ] : [e]).flat()), g = L(() => k.value.map((e) => e.type === "text" ? e : a ? {
448
+ ] : [e]).flat()), Y = L(() => O.value.map((e) => e.type === "text" ? e : a ? {
441
449
  id: e.id,
442
450
  type: "block",
443
451
  asChild: !0,
@@ -467,92 +475,92 @@ const Bt = ["data-id", "data-type"], Lt = ["data-id", "data-type"], Dt = /* @__P
467
475
  },
468
476
  { id: e.id, type: "suffix", content: e.suffix }
469
477
  ]
470
- })), E = M(null), q = (e) => {
471
- const t = Date.now(), o = JSON.stringify(e);
472
- return `${t}:${o}`;
473
- }, Q = (e) => {
474
- const t = parseInt(e.slice(0, 13)), o = JSON.parse(e.slice(14));
478
+ })), B = M(null), q = (e) => {
479
+ const t = Date.now(), n = JSON.stringify(e);
480
+ return `${t}:${n}`;
481
+ }, te = (e) => {
482
+ const t = parseInt(e.slice(0, 13)), n = JSON.parse(e.slice(14));
475
483
  return {
476
484
  timestamp: t,
477
- data: o
485
+ data: n
478
486
  };
479
- }, F = /* @__PURE__ */ new Map(), N = $t(q(k.value), {
487
+ }, H = /* @__PURE__ */ new Map(), x = $t(q(T.value), {
480
488
  onRemoveHistory: (e) => {
481
489
  for (const t of e)
482
- F.delete(t);
490
+ H.delete(t);
483
491
  }
484
492
  });
485
- ne(
486
- () => h.value,
493
+ oe(
494
+ () => y.value,
487
495
  (e) => {
488
- const t = P(e || []);
489
- if (JSON.stringify(t) !== JSON.stringify(k.value)) {
490
- if (E.value) {
491
- const r = j(E.value);
492
- r && F.set(N.get(), J(r));
496
+ const t = F(e || []);
497
+ if (JSON.stringify(t) !== JSON.stringify(T.value)) {
498
+ if (B.value) {
499
+ const u = re(B.value);
500
+ u && H.set(x.get(), X(u));
493
501
  }
494
- v(t), N.commit(q(k.value));
502
+ g(t), x.commit(q(T.value));
495
503
  }
496
504
  },
497
505
  { deep: !0 }
498
506
  );
499
- const B = (e, t = document.body) => t.contains(e) ? e instanceof HTMLElement && e.dataset.id ? e : e.parentElement ? B(e.parentElement, t) : null : null, G = (e) => e === E.value, j = (e) => {
507
+ const j = (e, t = document.body) => t.contains(e) ? e instanceof HTMLElement && e.dataset.id ? e : e.parentElement ? j(e.parentElement, t) : null : null, J = (e) => e === B.value, re = (e) => {
500
508
  const t = window.getSelection();
501
509
  if (!t)
502
510
  return null;
503
- const o = t.rangeCount > 0 ? t.getRangeAt(0) : null, r = e.getRootNode();
504
- if (!(r instanceof ShadowRoot))
505
- return o;
506
- if (y) {
507
- const c = t.getComposedRanges(a ? r : { shadowRoots: [r] });
508
- return (c == null ? void 0 : c[0]) ?? null;
511
+ const n = t.rangeCount > 0 ? t.getRangeAt(0) : null, u = e.getRootNode();
512
+ if (!(u instanceof ShadowRoot))
513
+ return n;
514
+ if (v) {
515
+ const r = t.getComposedRanges(a ? u : { shadowRoots: [u] });
516
+ return (r == null ? void 0 : r[0]) ?? null;
509
517
  }
510
518
  if (i) {
511
- const c = r.getSelection();
512
- return c.rangeCount > 0 ? c.getRangeAt(0) : null;
519
+ const r = u.getSelection();
520
+ return r.rangeCount > 0 ? r.getRangeAt(0) : null;
513
521
  }
514
- return o;
515
- }, pe = (e, t) => {
516
- var r;
522
+ return n;
523
+ }, V = (e, t) => {
524
+ var u;
517
525
  if (!e.firstChild || e.firstChild.nodeType !== Node.TEXT_NODE)
518
526
  return { node: e, offset: 0 };
519
- const o = ((r = e.firstChild.textContent) == null ? void 0 : r.length) ?? 0;
520
- return t > o && console.warn("offset is too large", { offset: t, el: e }), { node: e.firstChild, offset: Math.min(t, o) };
521
- }, K = (e, t, o, r) => {
522
- const c = window.getSelection();
523
- if (!c)
527
+ const n = ((u = e.firstChild.textContent) == null ? void 0 : u.length) ?? 0;
528
+ return { node: e.firstChild, offset: Math.min(t, n) };
529
+ }, z = (e, t, n, u) => {
530
+ const r = window.getSelection();
531
+ if (!r)
524
532
  return;
525
- const { node: f, offset: I } = pe(e, t);
526
- if (!o) {
527
- c.setBaseAndExtent(f, I, f, I);
533
+ const { node: f, offset: _ } = V(e, t);
534
+ if (!n) {
535
+ r.setBaseAndExtent(f, _, f, _);
528
536
  return;
529
537
  }
530
- const { node: O, offset: w } = pe(o, r ?? 0);
531
- c.setBaseAndExtent(f, I, O, w);
532
- }, Y = (e, t) => {
533
- const o = d(), r = { id: o, type: "text", content: e };
538
+ const { node: E, offset: G } = V(n, u ?? 0);
539
+ r.setBaseAndExtent(f, _, E, G);
540
+ }, ge = (e, t) => {
541
+ const n = d(), u = { id: n, type: "text", content: e };
534
542
  if (t) {
535
- const c = k.value.findIndex((f) => f.id === t);
536
- c !== -1 ? (v(
537
- k.value.slice(0, c + 1).concat(r).concat(k.value.slice(c + 1))
538
- ), N.commit(q(k.value))) : console.warn(`can not find item with id: ${t}`);
543
+ const r = T.value.findIndex((f) => f.id === t);
544
+ r !== -1 ? (g(
545
+ T.value.slice(0, r + 1).concat(u).concat(T.value.slice(r + 1))
546
+ ), x.commit(q(T.value))) : console.warn(`can not find item with id: ${t}`);
539
547
  } else
540
- v([r].concat(k.value)), N.commit(q(k.value));
541
- te(() => {
548
+ g([u].concat(T.value)), x.commit(q(T.value));
549
+ ne(() => {
542
550
  var f;
543
- const c = (f = E.value) == null ? void 0 : f.querySelector(`[data-id="${o}"][data-type="text"]`);
544
- c && K(c, e.length);
545
- }), h.value = W(k.value);
546
- }, se = M({
551
+ const r = (f = B.value) == null ? void 0 : f.querySelector(`[data-id="${n}"][data-type="text"]`);
552
+ r && z(r, e.length);
553
+ }), y.value = P(T.value);
554
+ }, ae = M({
547
555
  hasStarted: !1,
548
556
  range: null
549
- }), Ee = (e) => {
550
- var O;
557
+ }), xe = (e) => {
558
+ var E;
551
559
  const t = e;
552
560
  e.preventDefault();
553
- const { inputType: o } = t, r = (t.data || ((O = t.dataTransfer) == null ? void 0 : O.getData("text/plain")) || "").replace(p, "").replace(b, ""), c = t.getTargetRanges()[0];
554
- if (!c) {
555
- console.warn("range is null", c);
561
+ const { inputType: n } = t, u = (t.data || ((E = t.dataTransfer) == null ? void 0 : E.getData("text/plain")) || "").replace(h, "").replace(b, ""), r = t.getTargetRanges()[0];
562
+ if (!r) {
563
+ console.warn("range is null", r);
556
564
  return;
557
565
  }
558
566
  const f = [
@@ -566,278 +574,288 @@ const Bt = ["data-id", "data-type"], Lt = ["data-id", "data-type"], Dt = /* @__P
566
574
  "deleteSoftLineBackward",
567
575
  "deleteSoftLineForward",
568
576
  "deleteByCut"
569
- ], I = j(E.value);
570
- if (f.includes(o)) {
571
- if (r && G(c.startContainer) && G(c.endContainer)) {
572
- I && F.set(N.get(), J(I)), Y(r);
577
+ ], _ = re(B.value);
578
+ if (f.includes(n)) {
579
+ if (u && J(r.startContainer) && J(r.endContainer)) {
580
+ _ && H.set(x.get(), X(_)), ge(u);
573
581
  return;
574
582
  }
575
- const w = J(c);
576
- w.startId && w.endId ? (I && F.set(N.get(), J(I)), we(w, o, r)) : console.warn("range is not valid, range:", w);
577
- } else o === "insertCompositionText" && se.value.hasStarted && (se.value = { hasStarted: !1, range: J(c) });
578
- }, J = (e) => {
579
- const t = B(e.startContainer, E.value), o = B(e.endContainer, E.value);
583
+ const G = X(r);
584
+ G.startId && G.endId ? (_ && H.set(x.get(), X(_)), de(G, n, u)) : console.warn("range is not valid, range:", G);
585
+ } else n === "insertCompositionText" && ae.value.hasStarted && (ae.value = { hasStarted: !1, range: X(r) });
586
+ }, X = (e) => {
587
+ const t = j(e.startContainer, B.value), n = j(e.endContainer, B.value);
580
588
  return {
581
589
  collapsed: e.collapsed,
582
590
  endContainer: e.endContainer,
583
- endId: o == null ? void 0 : o.dataset.id,
584
- endEl: o,
591
+ endId: n == null ? void 0 : n.dataset.id,
592
+ endEl: n,
585
593
  endOffset: e.endOffset,
586
- endType: o == null ? void 0 : o.dataset.type,
594
+ endType: n == null ? void 0 : n.dataset.type,
587
595
  startContainer: e.startContainer,
588
596
  startId: t == null ? void 0 : t.dataset.id,
589
597
  startEl: t,
590
598
  startOffset: e.startOffset,
591
599
  startType: t == null ? void 0 : t.dataset.type
592
600
  };
593
- }, he = (e, t, o, r) => e.slice(0, o) + t + e.slice(r), we = (e, t, o) => {
594
- const r = ve(e);
595
- if (!Array.isArray(r) || r.length === 0)
601
+ }, ke = (e, t, n, u) => e.slice(0, n) + t + e.slice(u), de = (e, t, n) => {
602
+ const u = Le(e);
603
+ if (!Array.isArray(u) || u.length === 0)
596
604
  return;
597
- const c = $e(r, e, t, o);
598
- if (c.some((w) => w.tag === "new")) {
599
- const { afterId: w, content: $ } = c[0];
600
- Y($, w);
605
+ const r = De(u, e, t, n);
606
+ if (r.some((R) => R.tag === "new")) {
607
+ const { afterId: R, content: $ } = r[0];
608
+ ge($, R);
601
609
  return;
602
610
  }
603
- const f = c, I = [];
604
- for (const [w, $] of f.entries()) {
605
- const H = k.value.find((Ae) => Ae.id === $.id), le = w === 0 ? o : "";
606
- H ? H.type === "text" ? H.content = he(H.content, le, $.startOffset, $.endOffset) : H.type === "template" ? $.type === "prefix" || $.type === "suffix" ? $.startOffset === 0 && $.endOffset === 1 && le.length === 0 ? H[$.type] = "" : console.warn(`${$.type} can not be inserted text. it only can be deleted`, $) : $.startOffset < 0 || $.endOffset > H.content.length ? I.push(H.id) : H.content = he(H.content, le, $.startOffset, $.endOffset) : console.warn("dataItem.type is not text or template", H) : console.warn("can not find dataItem", $);
607
- }
608
- let O = k.value.filter((w) => !I.includes(w.id));
609
- if (O = O.filter((w) => !(w.type === "template" && [w.prefix, w.suffix, w.content].join("").length === 0)), O.length >= 2) {
610
- const w = O[0], $ = O[1];
611
- w.type === "text" && w.content.length === 0 && $.type === "template" && (w.content = C);
612
- const H = O[O.length - 1], le = O[O.length - 2];
613
- H.type === "text" && H.content.length === 0 && le.type === "template" && (H.content = C);
611
+ const f = r, _ = [];
612
+ for (const [R, $] of f.entries()) {
613
+ const A = T.value.find((o) => o.id === $.id), Z = R === 0 ? n : "";
614
+ A ? A.type === "text" ? A.content = ke(A.content, Z, $.startOffset, $.endOffset) : A.type === "template" ? $.type === "prefix" || $.type === "suffix" ? $.startOffset === 0 && $.endOffset === 1 && Z.length === 0 ? A[$.type] = "" : console.warn(`${$.type} can not be inserted text. it only can be deleted`, $) : $.startOffset < 0 || $.endOffset > A.content.length ? _.push(A.id) : A.content = ke(A.content, Z, $.startOffset, $.endOffset) : console.warn("dataItem.type is not text or template", A) : console.warn("can not find dataItem", $);
614
615
  }
615
- O = O.filter((w) => !(w.type === "text" && w.content.length === 0));
616
- for (const w of O.filter(($) => $.type === "template"))
617
- w.prefix.length === 0 && (w.prefix = p), w.suffix.length === 0 && (w.suffix = b);
618
- v(O), N.commit(q(k.value)), f.length > 0 && ye(f, o), h.value = W(k.value);
619
- }, ye = (e, t) => {
620
- const o = e[0], r = `[data-id="${o.id}"][data-type="${o.type}"]`, c = e.slice(1).map((f) => `[data-id="${f.id}"][data-type="${f.type}"]`);
621
- te(() => {
622
- var I, O;
623
- const f = (I = E.value) == null ? void 0 : I.querySelector(r);
616
+ let E = T.value.filter((R) => !_.includes(R.id));
617
+ E = E.filter((R) => !(R.type === "template" && [R.prefix, R.suffix, R.content].join("").length === 0));
618
+ const G = /* @__PURE__ */ new Set();
619
+ E.forEach((R, $, A) => {
620
+ if (A.length >= 2) {
621
+ if ($ === 0 || $ === 1) {
622
+ const Z = A[0], o = A[1];
623
+ if (Z.type === "text" && Z.content.length === 0 && o.type === "template")
624
+ return;
625
+ }
626
+ if ($ === A.length - 2 || $ === A.length - 1) {
627
+ const Z = A[A.length - 1], o = A[A.length - 2];
628
+ if (Z.type === "text" && Z.content.length === 0 && o.type === "template")
629
+ return;
630
+ }
631
+ }
632
+ R.type === "text" && R.content.length === 0 && G.add(R.id);
633
+ }), E = E.filter((R) => !G.has(R.id));
634
+ for (const R of E.filter(($) => $.type === "template"))
635
+ R.prefix.length === 0 && (R.prefix = h), R.suffix.length === 0 && (R.suffix = b);
636
+ g(E), x.commit(q(T.value)), f.length > 0 && me(f, n), y.value = P(T.value);
637
+ }, me = (e, t) => {
638
+ const n = e[0], u = `[data-id="${n.id}"][data-type="${n.type}"]`, r = e.slice(1).map((f) => `[data-id="${f.id}"][data-type="${f.type}"]`);
639
+ ne(() => {
640
+ var _, E;
641
+ const f = (_ = B.value) == null ? void 0 : _.querySelector(u);
624
642
  if (f)
625
- K(f, o.startOffset + t.length);
643
+ z(f, n.startOffset + t.length);
626
644
  else if (t.length === 0)
627
- for (const w of c) {
628
- const $ = (O = E.value) == null ? void 0 : O.querySelector(w);
629
- if ($) {
630
- K($, 0);
645
+ for (const G of r) {
646
+ const R = (E = B.value) == null ? void 0 : E.querySelector(G);
647
+ if (R) {
648
+ z(R, 0);
631
649
  break;
632
650
  }
633
651
  }
634
652
  else
635
- console.warn(`can not find el with selector: ${r}`);
653
+ console.warn(`can not find el with selector: ${u}`);
636
654
  });
637
- }, ve = (e) => {
638
- const t = R.value.findIndex((I) => I.id === e.startId && I.type === e.startType), o = R.value.findIndex((I) => I.id === e.endId && I.type === e.endType);
639
- if (t === -1 || o === -1 || t > o)
655
+ }, Le = (e) => {
656
+ const t = p.value.findIndex((_) => _.id === e.startId && _.type === e.startType), n = p.value.findIndex((_) => _.id === e.endId && _.type === e.endType);
657
+ if (t === -1 || n === -1 || t > n)
640
658
  return console.warn("startIndex or endIndex is -1, or startIndex > endIndex. ", { range: e }), null;
641
- const r = R.value[t], c = R.value[o];
642
- if (t === o)
659
+ const u = p.value[t], r = p.value[n];
660
+ if (t === n)
643
661
  return [
644
662
  {
645
- id: r.id,
646
- type: r.type,
663
+ id: u.id,
664
+ type: u.type,
647
665
  startOffset: e.startOffset,
648
666
  endOffset: e.endOffset
649
667
  }
650
668
  ];
651
669
  const f = [
652
670
  {
653
- id: r.id,
654
- type: r.type,
671
+ id: u.id,
672
+ type: u.type,
655
673
  startOffset: e.startOffset,
656
- endOffset: r.content.length
674
+ endOffset: u.content.length
657
675
  }
658
676
  ];
659
- for (let I = t + 1; I < o; I++) {
660
- const O = R.value[I];
677
+ for (let _ = t + 1; _ < n; _++) {
678
+ const E = p.value[_];
661
679
  f.push({
662
- id: O.id,
663
- type: O.type,
680
+ id: E.id,
681
+ type: E.type,
664
682
  startOffset: 0,
665
- endOffset: O.content.length
683
+ endOffset: E.content.length
666
684
  });
667
685
  }
668
686
  return f.push({
669
- id: c.id,
670
- type: c.type,
687
+ id: r.id,
688
+ type: r.type,
671
689
  startOffset: 0,
672
690
  endOffset: e.endOffset
673
691
  }), f;
674
- }, $e = (e, t, o, r) => {
675
- const c = e[0];
676
- if (c.type !== "prefix" && c.type !== "suffix")
692
+ }, De = (e, t, n, u) => {
693
+ const r = e[0];
694
+ if (r.type !== "prefix" && r.type !== "suffix")
677
695
  return e;
678
696
  if (e.length === 1) {
679
697
  if (t.collapsed)
680
698
  if (t.startOffset === 0) {
681
- const f = ge(c, r);
699
+ const f = le(r, u);
682
700
  return f ? [f] : [];
683
701
  } else {
684
- const f = ae(c, r);
702
+ const f = fe(r, u);
685
703
  return f ? [f] : [];
686
704
  }
687
- if (o.startsWith("insert"))
705
+ if (n.startsWith("insert"))
688
706
  if (a) {
689
- const f = ge(c, r);
707
+ const f = le(r, u);
690
708
  return f ? [f] : [];
691
709
  } else {
692
- const f = ae(c, r);
710
+ const f = fe(r, u);
693
711
  return f ? [f] : [];
694
712
  }
695
- if (o.startsWith("delete")) {
696
- if (o.includes("Backward")) {
697
- const f = ge(c, r, 1);
713
+ if (n.startsWith("delete")) {
714
+ if (n.includes("Backward")) {
715
+ const f = le(r, u, 1);
698
716
  return f ? [f] : [];
699
- } else if (o.includes("Forward")) {
700
- const f = ae(c, r, 1);
717
+ } else if (n.includes("Forward")) {
718
+ const f = fe(r, u, 1);
701
719
  return f ? [f] : [];
702
720
  }
703
721
  }
704
722
  }
705
- return r.length > 0 ? e.slice(1) : e;
706
- }, ge = (e, t, o = 0) => {
707
- const r = R.value.findIndex((c) => c.id === e.id && c.type === e.type);
708
- if (r > 0) {
709
- const c = R.value[r - 1], { id: f, type: I, content: O } = c;
710
- if (I === "text" || I === "template")
723
+ return u.length > 0 ? e.slice(1) : e;
724
+ }, le = (e, t, n = 0) => {
725
+ const u = p.value.findIndex((r) => r.id === e.id && r.type === e.type);
726
+ if (u > 0) {
727
+ const r = p.value[u - 1], { id: f, type: _, content: E } = r;
728
+ if (_ === "text" || _ === "template")
711
729
  return {
712
730
  id: f,
713
- type: I,
714
- startOffset: O.length - o,
715
- endOffset: O.length
731
+ type: _,
732
+ startOffset: E.length - n,
733
+ endOffset: E.length
716
734
  };
717
735
  if (t.length > 0)
718
736
  return { tag: "new", afterId: f, type: "text", content: t };
719
- if (console.warn("the previous item is not text or template", { current: e, previous: c }), o === 1)
737
+ if (console.warn("the previous item is not text or template", { current: e, previous: r }), n === 1)
720
738
  return { ...e, endOffset: e.startOffset };
721
739
  } else return t.length > 0 ? { tag: "new", type: "text", content: t } : (console.warn("the previous item of current is not found", { current: e }), null);
722
740
  return e;
723
- }, ae = (e, t, o = 0) => {
724
- const r = R.value.findIndex((c) => c.id === e.id && c.type === e.type);
725
- if (r < R.value.length - 1) {
726
- const c = R.value[r + 1], { id: f, type: I } = c;
727
- if (I === "text" || I === "template")
741
+ }, fe = (e, t, n = 0) => {
742
+ const u = p.value.findIndex((r) => r.id === e.id && r.type === e.type);
743
+ if (u < p.value.length - 1) {
744
+ const r = p.value[u + 1], { id: f, type: _ } = r;
745
+ if (_ === "text" || _ === "template")
728
746
  return {
729
747
  id: f,
730
- type: I,
748
+ type: _,
731
749
  startOffset: 0,
732
- endOffset: 0 + o
750
+ endOffset: 0 + n
733
751
  };
734
752
  if (t.length > 0)
735
753
  return { tag: "new", afterId: e.id, type: "text", content: t };
736
- if (console.warn("the next item is not text or template", { current: e, next: c }), o === 1)
754
+ if (console.warn("the next item is not text or template", { current: e, next: r }), n === 1)
737
755
  return { ...e, startOffset: e.endOffset };
738
756
  } else return t.length > 0 ? { tag: "new", afterId: e.id, type: "text", content: t } : (console.warn("the next item of current is not found", { current: e }), null);
739
757
  return e;
740
- }, Se = () => {
741
- se.value = { hasStarted: !0, range: null };
742
- }, Ce = (e) => {
743
- const t = se.value.range;
744
- t ? (e.data && G(t.startContainer) && G(t.endContainer) ? (F.set(N.get(), J(t)), Y(e.data)) : t.startId && t.endId ? (F.set(N.get(), J(t)), we(t, "insertCompositionText", e.data)) : console.warn("range is not valid, range:", t), V.value++) : console.warn("range is null, compositionEnd:", e), se.value = { hasStarted: !1, range: null };
745
- }, ee = (() => {
758
+ }, Ie = () => {
759
+ ae.value = { hasStarted: !0, range: null };
760
+ }, be = (e) => {
761
+ const t = ae.value.range;
762
+ t ? (e.data && J(t.startContainer) && J(t.endContainer) ? (H.set(x.get(), X(t)), ge(e.data)) : t.startId && t.endId ? (H.set(x.get(), X(t)), de(t, "insertCompositionText", e.data)) : console.warn("range is not valid, range:", t), W.value++) : console.warn("range is null, compositionEnd:", e), ae.value = { hasStarted: !1, range: null };
763
+ }, pe = (() => {
746
764
  const e = navigator.userAgent.toLowerCase();
747
765
  return /macintosh|mac os x|iphone|ipad|ipod/.test(e);
748
- })(), Be = (e) => {
749
- const t = ee && e.metaKey && !e.shiftKey && e.key.toLowerCase() === "z" || // Cmd+Z
750
- !ee && e.ctrlKey && !e.shiftKey && e.key.toLowerCase() === "z", o = ee && e.metaKey && e.shiftKey && e.key.toLowerCase() === "z" || // Cmd+Shift+z
751
- !ee && e.ctrlKey && (e.key.toLowerCase() === "y" || e.shiftKey && e.key.toLowerCase() === "z"), r = e.key.toLowerCase() === "enter";
766
+ })(), he = (e) => {
767
+ const t = pe && e.metaKey && !e.shiftKey && e.key.toLowerCase() === "z" || // Cmd+Z
768
+ !pe && e.ctrlKey && !e.shiftKey && e.key.toLowerCase() === "z", n = pe && e.metaKey && e.shiftKey && e.key.toLowerCase() === "z" || // Cmd+Shift+z
769
+ !pe && e.ctrlKey && (e.key.toLowerCase() === "y" || e.shiftKey && e.key.toLowerCase() === "z"), u = e.key.toLowerCase() === "enter";
752
770
  if (t) {
753
771
  e.preventDefault();
754
- const c = j(E.value);
755
- c && F.set(N.get(), J(c));
756
- const f = N.undo();
757
- f && re(f);
772
+ const r = re(B.value);
773
+ r && H.set(x.get(), X(r));
774
+ const f = x.undo();
775
+ f && Te(f);
758
776
  }
759
- if (o) {
777
+ if (n) {
760
778
  e.preventDefault();
761
- const c = N.redo();
762
- c && re(c);
779
+ const r = x.redo();
780
+ r && Te(r);
763
781
  }
764
- r && (e.preventDefault(), A("submit"));
765
- }, re = (e) => {
766
- const { data: t } = Q(e);
767
- if (v(t), F.has(e)) {
768
- const o = F.get(e);
769
- te(() => {
770
- const r = E.value.querySelector(`[data-id="${o.startId}"][data-type="${o.startType}"]`), c = E.value.querySelector(`[data-id="${o.endId}"][data-type="${o.endType}"]`);
771
- r && K(r, o.startOffset, c, o.endOffset);
782
+ u && (e.preventDefault(), K("submit"));
783
+ }, Te = (e) => {
784
+ const { data: t } = te(e);
785
+ if (g(t), H.has(e)) {
786
+ const n = H.get(e);
787
+ ne(() => {
788
+ const u = B.value.querySelector(`[data-id="${n.startId}"][data-type="${n.startType}"]`), r = B.value.querySelector(`[data-id="${n.endId}"][data-type="${n.endType}"]`);
789
+ u && z(u, n.startOffset, r, n.endOffset);
772
790
  });
773
791
  }
774
- h.value = W(k.value);
775
- }, Le = () => {
776
- E.value && te(() => {
777
- var t, o;
778
- const e = k.value.find((r) => r.type === "template");
792
+ y.value = P(T.value);
793
+ }, Ae = () => {
794
+ B.value && ne(() => {
795
+ var t, n;
796
+ const e = T.value.find((u) => u.type === "template");
779
797
  if (e) {
780
- const r = (t = E.value) == null ? void 0 : t.querySelector(`[data-id="${e.id}"][data-type="template"]`);
781
- if (r) {
782
- const c = ((o = r.textContent) == null ? void 0 : o.length) || 0;
783
- K(r, c);
798
+ const u = (t = B.value) == null ? void 0 : t.querySelector(`[data-id="${e.id}"][data-type="template"]`);
799
+ if (u) {
800
+ const r = ((n = u.textContent) == null ? void 0 : n.length) || 0;
801
+ z(u, r);
784
802
  }
785
803
  }
786
804
  });
787
- }, De = () => {
788
- N.clear(), F.clear();
789
- }, ke = () => {
790
- if (!E.value || se.value.range)
805
+ }, Ke = () => {
806
+ x.clear(), H.clear();
807
+ }, Re = () => {
808
+ if (!B.value || ae.value.range)
791
809
  return;
792
- const e = j(E.value);
793
- if (e != null && e.collapsed && k.value.length > 0) {
794
- const t = J(e), o = k.value[0];
795
- if (t.startEl && t.startId === o.id && t.startOffset === 0 && o.content === C && o.type === "text") {
796
- K(t.startEl, 1);
810
+ const e = re(B.value);
811
+ if (e != null && e.collapsed && O.value.length > 0) {
812
+ const t = X(e), n = O.value[0];
813
+ if (t.startEl && t.startId === n.id && t.startOffset === 0 && n.content === C && n.type === "text") {
814
+ z(t.startEl, 1);
797
815
  return;
798
816
  }
799
- const r = k.value[k.value.length - 1];
800
- if (t.endEl && t.endId === r.id && t.endOffset === 1 && r.content === C && r.type === "text") {
801
- K(t.endEl, 0);
817
+ const u = O.value[O.value.length - 1];
818
+ if (t.endEl && t.endId === u.id && t.endOffset === 1 && u.content === C && u.type === "text") {
819
+ z(t.endEl, 0);
802
820
  return;
803
821
  }
804
822
  }
805
823
  };
806
824
  return it(() => {
807
- document.addEventListener("selectionchange", ke);
825
+ document.addEventListener("selectionchange", Re);
808
826
  }), ut(() => {
809
- document.removeEventListener("selectionchange", ke);
810
- }), u({
811
- clearHistory: De,
812
- activateFirstField: Le
813
- }), (e, t) => (m(), T("div", Kt, [
814
- (m(), T("div", {
827
+ document.removeEventListener("selectionchange", Re);
828
+ }), c({
829
+ clearHistory: Ke,
830
+ activateFirstField: Ae
831
+ }), (e, t) => (m(), I("div", Kt, [
832
+ (m(), I("div", {
815
833
  contenteditable: "true",
816
834
  ref_key: "editorRef",
817
- ref: E,
818
- key: V.value,
835
+ ref: B,
836
+ key: W.value,
819
837
  class: "editor",
820
- onBeforeinput: Ee,
821
- onCompositionstart: Se,
822
- onCompositionend: Ce,
823
- onKeydown: Be
838
+ onBeforeinput: xe,
839
+ onCompositionstart: Ie,
840
+ onCompositionend: be,
841
+ onKeydown: he
824
842
  }, [
825
- (m(!0), T(fe, null, be(g.value, (o) => (m(), Z(At, me({
826
- key: `${o.id}-${o.type}`
827
- }, { ref_for: !0 }, o), null, 16))), 128))
843
+ (m(!0), I(ve, null, Se(Y.value, (n) => (m(), ee(At, we({
844
+ key: `${n.id}-${n.type}`
845
+ }, { ref_for: !0 }, n), null, 16))), 128))
828
846
  ], 32))
829
847
  ]));
830
848
  }
831
- }), Pt = /* @__PURE__ */ Oe(Mt, [["__scopeId", "data-v-63d29cf5"]]), Xe = (l, u) => {
832
- if (!u.length)
849
+ }), Ft = /* @__PURE__ */ Be(Mt, [["__scopeId", "data-v-e84f9c21"]]), Xe = (l, c) => {
850
+ if (!c.length)
833
851
  return [{ text: l, isMatch: !1 }];
834
852
  const s = [];
835
- for (const a of u) {
853
+ for (const a of c) {
836
854
  if (!a) continue;
837
855
  let d = 0;
838
- const C = l.toLowerCase(), p = a.toLowerCase();
856
+ const C = l.toLowerCase(), h = a.toLowerCase();
839
857
  for (; ; ) {
840
- const b = C.indexOf(p, d);
858
+ const b = C.indexOf(h, d);
841
859
  if (b === -1) break;
842
860
  s.push({
843
861
  start: b,
@@ -856,24 +874,24 @@ const Bt = ["data-id", "data-type"], Lt = ["data-id", "data-type"], Dt = /* @__P
856
874
  const d = i[i.length - 1];
857
875
  a.start <= d.end ? d.end = Math.max(d.end, a.end) : i.push(a);
858
876
  }
859
- const y = [];
860
- let _ = 0;
877
+ const v = [];
878
+ let w = 0;
861
879
  for (const a of i)
862
- _ < a.start && y.push({
863
- text: l.substring(_, a.start),
880
+ w < a.start && v.push({
881
+ text: l.substring(w, a.start),
864
882
  isMatch: !1
865
- }), y.push({
883
+ }), v.push({
866
884
  text: l.substring(a.start, a.end),
867
885
  isMatch: !0
868
- }), _ = a.end;
869
- return _ < l.length && y.push({
870
- text: l.substring(_),
886
+ }), w = a.end;
887
+ return w < l.length && v.push({
888
+ text: l.substring(w),
871
889
  isMatch: !1
872
- }), y;
873
- }, Wt = (l, u) => !u || !l ? [{ text: l, isMatch: !1 }] : Xe(l, [u]), Ft = (l, u) => {
890
+ }), v;
891
+ }, Pt = (l, c) => !c || !l ? [{ text: l, isMatch: !1 }] : Xe(l, [c]), Wt = (l, c) => {
874
892
  const { content: s, highlights: i } = l;
875
- return typeof i == "function" ? i(s, u) : Array.isArray(i) ? Xe(s, i) : Wt(s, u);
876
- }, Vt = ["onMouseenter", "onMousedown"], Nt = { class: "suggestion-list__text" }, Ht = /* @__PURE__ */ _e({
893
+ return typeof i == "function" ? i(s, c) : Array.isArray(i) ? Xe(s, i) : Pt(s, c);
894
+ }, Vt = ["onMouseenter", "onMousedown"], Nt = { class: "suggestion-list__text" }, Ht = /* @__PURE__ */ Ce({
877
895
  __name: "SuggestionList",
878
896
  props: {
879
897
  show: { type: Boolean },
@@ -884,55 +902,55 @@ const Bt = ["data-id", "data-type"], Lt = ["data-id", "data-type"], Dt = /* @__P
884
902
  inputValue: {}
885
903
  },
886
904
  emits: ["select", "mouse-enter", "mouse-leave"],
887
- setup(l, { emit: u }) {
888
- const s = l, i = u, y = M(null), _ = (p) => p === s.activeKeyboardIndex || p === s.activeMouseIndex, a = (p) => {
889
- i("mouse-enter", p);
905
+ setup(l, { emit: c }) {
906
+ const s = l, i = c, v = M(null), w = (h) => h === s.activeKeyboardIndex || h === s.activeMouseIndex, a = (h) => {
907
+ i("mouse-enter", h);
890
908
  }, d = () => {
891
909
  i("mouse-leave");
892
- }, C = (p) => {
893
- i("select", p);
910
+ }, C = (h) => {
911
+ i("select", h);
894
912
  };
895
- return ne(
913
+ return oe(
896
914
  () => s.activeKeyboardIndex,
897
- (p) => {
898
- if (p !== -1 && y.value) {
899
- const b = y.value.children[p];
915
+ (h) => {
916
+ if (h !== -1 && v.value) {
917
+ const b = v.value.children[h];
900
918
  b && b.scrollIntoView({ block: "nearest" });
901
919
  }
902
920
  }
903
- ), (p, b) => (m(), Z(We, { name: "tiny-sender-slide-up" }, {
904
- default: de(() => [
905
- s.show && s.suggestions.length ? (m(), T("div", {
921
+ ), (h, b) => (m(), ee(We, { name: "tiny-sender-slide-up" }, {
922
+ default: ye(() => [
923
+ s.show && s.suggestions.length ? (m(), I("div", {
906
924
  key: 0,
907
925
  ref_key: "suggestionsListRef",
908
- ref: y,
926
+ ref: v,
909
927
  class: "suggestion-list",
910
- style: Fe(s.popupStyle)
928
+ style: Ve(s.popupStyle)
911
929
  }, [
912
- (m(!0), T(fe, null, be(s.suggestions, (h, A) => (m(), T("div", {
913
- key: A,
914
- class: oe(["suggestion-list__item", { highlighted: _(A) }]),
915
- onMouseenter: (V) => a(A),
930
+ (m(!0), I(ve, null, Se(s.suggestions, (y, K) => (m(), I("div", {
931
+ key: K,
932
+ class: se(["suggestion-list__item", { highlighted: w(K) }]),
933
+ onMouseenter: (W) => a(K),
916
934
  onMouseleave: d,
917
- onMousedown: ct((V) => C(h.content), ["prevent"])
935
+ onMousedown: ct((W) => C(y.content), ["prevent"])
918
936
  }, [
919
- X(S(wt), { class: "suggestion-list__icon" }),
920
- z("span", Nt, [
921
- (m(!0), T(fe, null, be(S(Ft)(h, s.inputValue), (V, P) => (m(), T("span", {
922
- key: P,
923
- class: oe({
924
- "suggestion-list__text--match": V.isMatch,
925
- "suggestion-list__text--normal": !V.isMatch
937
+ Q(S(wt), { class: "suggestion-list__icon" }),
938
+ U("span", Nt, [
939
+ (m(!0), I(ve, null, Se(S(Wt)(y, s.inputValue), (W, F) => (m(), I("span", {
940
+ key: F,
941
+ class: se({
942
+ "suggestion-list__text--match": W.isMatch,
943
+ "suggestion-list__text--normal": !W.isMatch
926
944
  })
927
- }, ce(V.text), 3))), 128))
945
+ }, ce(W.text), 3))), 128))
928
946
  ])
929
947
  ], 42, Vt))), 128))
930
- ], 4)) : U("", !0)
948
+ ], 4)) : N("", !0)
931
949
  ]),
932
950
  _: 1
933
951
  }));
934
952
  }
935
- }), Ut = /* @__PURE__ */ Oe(Ht, [["__scopeId", "data-v-e0ec9fe3"]]), qt = ["data-theme"], zt = { class: "tiny-sender__container" }, Gt = {
953
+ }), Ut = /* @__PURE__ */ Be(Ht, [["__scopeId", "data-v-e0ec9fe3"]]), qt = ["data-theme"], zt = { class: "tiny-sender__container" }, Gt = {
936
954
  key: 0,
937
955
  class: "tiny-sender__header-slot"
938
956
  }, jt = {
@@ -959,7 +977,7 @@ const Bt = ["data-id", "data-type"], Lt = ["data-id", "data-type"], Dt = /* @__P
959
977
  }, ln = { class: "tiny-sender__buttons-container" }, rn = {
960
978
  key: 1,
961
979
  class: "tiny-sender__footer-slot"
962
- }, Te = /* @__PURE__ */ _e({
980
+ }, $e = /* @__PURE__ */ Ce({
963
981
  __name: "index",
964
982
  props: {
965
983
  autofocus: { type: Boolean, default: !1 },
@@ -985,359 +1003,359 @@ const Bt = ["data-id", "data-type"], Lt = ["data-id", "data-type"], Dt = /* @__P
985
1003
  stopText: { default: "" }
986
1004
  },
987
1005
  emits: ["update:modelValue", "update:templateData", "submit", "clear", "speech-start", "speech-end", "speech-interim", "speech-error", "suggestion-select", "focus", "blur", "escape-press", "cancel", "reset-template", "files-selected"],
988
- setup(l, { expose: u, emit: s }) {
989
- var Ve;
990
- const i = l, y = s, _ = M(null), a = M(null), d = M(null), C = M(null), p = M(null), b = L(() => i.templateData && i.templateData.length > 0), { inputValue: h, isComposing: A, clearInput: V } = Ct(i, y), P = L(() => !!h.value.trim()), W = L(() => {
991
- var n, x;
992
- return !(i.disabled || i.loading || !P.value || ee.value || (x = (n = i.buttonGroup) == null ? void 0 : n.submit) != null && x.disabled);
1006
+ setup(l, { expose: c, emit: s }) {
1007
+ var Z;
1008
+ const i = l, v = s, w = M(null), a = M(null), d = M(null), C = M(null), h = M(null), b = L(() => i.templateData && i.templateData.length > 0), { inputValue: y, isComposing: K, clearInput: W } = Ct(i, v), F = L(() => !!y.value.trim()), P = L(() => {
1009
+ var o, k;
1010
+ return !(i.disabled || i.loading || !F.value || _e.value || (k = (o = i.buttonGroup) == null ? void 0 : o.submit) != null && k.disabled);
993
1011
  }), {
994
- isPopupVisible: k,
995
- activeSuggestion: v,
996
- activeKeyboardIndex: R,
997
- activeMouseIndex: g,
998
- autoCompleteText: E,
999
- showTabIndicator: q,
1000
- syncAutoComplete: Q,
1001
- closePopup: F,
1002
- applySuggestion: N,
1003
- confirmSelection: B,
1004
- navigateWithKeyboard: G,
1005
- handleMouseEnter: j,
1006
- handleMouseLeave: pe
1012
+ isPopupVisible: T,
1013
+ activeSuggestion: g,
1014
+ activeKeyboardIndex: O,
1015
+ activeMouseIndex: p,
1016
+ autoCompleteText: Y,
1017
+ showTabIndicator: B,
1018
+ syncAutoComplete: q,
1019
+ closePopup: te,
1020
+ applySuggestion: H,
1021
+ confirmSelection: x,
1022
+ navigateWithKeyboard: j,
1023
+ handleMouseEnter: J,
1024
+ handleMouseLeave: re
1007
1025
  } = It(
1008
1026
  L(() => i.suggestions),
1009
- h,
1010
- A,
1027
+ y,
1028
+ K,
1011
1029
  b,
1012
- (n) => y("update:modelValue", n),
1013
- (n) => y("suggestion-select", n)
1014
- ), K = M(i.mode), Y = M(!1), se = () => {
1015
- K.value === "single" && (K.value = "multiple", te(() => {
1030
+ (o) => v("update:modelValue", o),
1031
+ (o) => v("suggestion-select", o)
1032
+ ), V = M(i.mode), z = M(!1), ge = () => {
1033
+ V.value === "single" && (V.value = "multiple", ne(() => {
1016
1034
  setTimeout(() => {
1017
- const n = document.querySelector(".tiny-textarea__inner");
1018
- if (n) {
1019
- n.style.whiteSpace = "pre-wrap";
1020
- const x = h.value.length;
1021
- n.focus(), n.setSelectionRange(x, x);
1035
+ const o = document.querySelector(".tiny-textarea__inner");
1036
+ if (o) {
1037
+ o.style.whiteSpace = "pre-wrap";
1038
+ const k = y.value.length;
1039
+ o.focus(), o.setSelectionRange(k, k);
1022
1040
  }
1023
1041
  }, 50);
1024
1042
  }));
1025
- }, Ee = (n, x) => {
1043
+ }, ae = (o, k) => {
1026
1044
  const D = document.createElement("span");
1027
- D.style.visibility = "hidden", D.style.position = "absolute", D.style.whiteSpace = "nowrap", D.style.font = x, D.textContent = n, document.body.appendChild(D);
1045
+ D.style.visibility = "hidden", D.style.position = "absolute", D.style.whiteSpace = "nowrap", D.style.font = k, D.textContent = o, document.body.appendChild(D);
1028
1046
  const ie = D.offsetWidth;
1029
1047
  return document.body.removeChild(D), ie;
1030
- }, J = () => {
1031
- var Ie, Ue, qe;
1032
- if (i.mode !== "single" || !_.value || Y.value || !a.value || !C.value) return;
1033
- const n = a.value.querySelector(".tiny-sender__content-area");
1034
- if (!n) return;
1035
- const x = ((Ue = (Ie = _.value) == null ? void 0 : Ie.querySelector) == null ? void 0 : Ue.call(Ie, ".tiny-input__inner")) || n.querySelector(".tiny-input__inner"), D = p.value || a.value.querySelector(".tiny-sender__buttons-container");
1036
- if (!x) {
1048
+ }, xe = () => {
1049
+ var Oe, Ue, qe;
1050
+ if (i.mode !== "single" || !w.value || z.value || !a.value || !C.value) return;
1051
+ const o = a.value.querySelector(".tiny-sender__content-area");
1052
+ if (!o) return;
1053
+ const k = ((Ue = (Oe = w.value) == null ? void 0 : Oe.querySelector) == null ? void 0 : Ue.call(Oe, ".tiny-input__inner")) || o.querySelector(".tiny-input__inner"), D = h.value || a.value.querySelector(".tiny-sender__buttons-container");
1054
+ if (!k) {
1037
1055
  console.warn("Cannot find input element for overflow check");
1038
1056
  return;
1039
1057
  }
1040
- const ie = x.getBoundingClientRect(), Ke = D == null ? void 0 : D.getBoundingClientRect();
1058
+ const ie = k.getBoundingClientRect(), Me = D == null ? void 0 : D.getBoundingClientRect();
1041
1059
  if (ie.width === 0) {
1042
- setTimeout(() => J(), 50);
1060
+ setTimeout(() => xe(), 50);
1043
1061
  return;
1044
1062
  }
1045
- const Ze = window.getComputedStyle(x).font, Qe = Ee(h.value, Ze), Ne = (qe = a.value) == null ? void 0 : qe.classList.contains("tr-sender-compact"), Ye = Ne ? 12 : 20, et = ie.width, tt = (Ke == null ? void 0 : Ke.width) || 0, He = et - tt - Ye, nt = Ne ? 50 : 80;
1046
- Qe > He && He > nt && K.value === "single" && (Y.value = !0, K.value = "multiple", te(() => {
1047
- _.value ? setTimeout(() => {
1063
+ const Ze = window.getComputedStyle(k).font, Qe = ae(y.value, Ze), Ne = (qe = a.value) == null ? void 0 : qe.classList.contains("tr-sender-compact"), Ye = Ne ? 12 : 20, et = ie.width, tt = (Me == null ? void 0 : Me.width) || 0, He = et - tt - Ye, nt = Ne ? 50 : 80;
1064
+ Qe > He && He > nt && V.value === "single" && (z.value = !0, V.value = "multiple", ne(() => {
1065
+ w.value ? setTimeout(() => {
1048
1066
  var ze;
1049
- const Re = (ze = a.value) == null ? void 0 : ze.querySelector(".tiny-textarea__inner");
1050
- if (Re) {
1051
- Re.style.whiteSpace = "pre-wrap";
1052
- const Ge = h.value.length;
1053
- Re.focus(), Re.setSelectionRange(Ge, Ge);
1067
+ const Ee = (ze = a.value) == null ? void 0 : ze.querySelector(".tiny-textarea__inner");
1068
+ if (Ee) {
1069
+ Ee.style.whiteSpace = "pre-wrap";
1070
+ const Ge = y.value.length;
1071
+ Ee.focus(), Ee.setSelectionRange(Ge, Ge);
1054
1072
  }
1055
- Y.value = !1;
1056
- }, 300) : Y.value = !1;
1073
+ z.value = !1;
1074
+ }, 300) : z.value = !1;
1057
1075
  }));
1058
- }, he = () => {
1076
+ }, X = () => {
1059
1077
  if (b.value && d.value)
1060
- w();
1061
- else if (_.value)
1062
- _.value.focus();
1078
+ E();
1079
+ else if (w.value)
1080
+ w.value.focus();
1063
1081
  else {
1064
- const n = document.querySelector(".tiny-input__inner");
1065
- n == null || n.focus();
1082
+ const o = document.querySelector(".tiny-input__inner");
1083
+ o == null || o.focus();
1066
1084
  }
1067
- }, we = () => {
1068
- if (_.value)
1069
- _.value.blur();
1085
+ }, ke = () => {
1086
+ if (w.value)
1087
+ w.value.blur();
1070
1088
  else {
1071
- const n = document.querySelector(".tiny-input__inner");
1072
- n == null || n.blur();
1089
+ const o = document.querySelector(".tiny-input__inner");
1090
+ o == null || o.blur();
1073
1091
  }
1074
- }, ye = () => {
1075
- var n;
1076
- y("update:templateData", []), (n = d.value) == null || n.clearHistory(), te(() => {
1077
- h.value === "" && (K.value = i.mode || "single"), setTimeout(() => {
1078
- he();
1092
+ }, de = () => {
1093
+ var o;
1094
+ v("update:templateData", []), (o = d.value) == null || o.clearHistory(), ne(() => {
1095
+ y.value === "" && (V.value = i.mode || "single"), setTimeout(() => {
1096
+ X();
1079
1097
  }, 50);
1080
1098
  });
1081
- }, ve = () => {
1082
- var n;
1083
- V(), b.value ? ye() : (n = a.value) == null || n.focus(), te(() => {
1084
- h.value === "" && (K.value = i.mode || "single");
1099
+ }, me = () => {
1100
+ var o;
1101
+ W(), b.value ? de() : (o = a.value) == null || o.focus(), ne(() => {
1102
+ y.value === "" && (V.value = i.mode || "single");
1085
1103
  });
1086
- }, $e = (n) => {
1087
- const x = (ie) => ie.type === "text" && ie.content === "​";
1088
- if (n.length === 0 || n.every(x)) {
1089
- ye();
1104
+ }, Le = (o) => {
1105
+ const k = (ie) => ie.type === "text" && ie.content === "​";
1106
+ if (o.length === 0 || o.every(k)) {
1107
+ de();
1090
1108
  return;
1091
1109
  }
1092
- y("update:templateData", n);
1110
+ v("update:templateData", o);
1093
1111
  };
1094
- ne(
1112
+ oe(
1095
1113
  () => i.templateData,
1096
1114
  () => {
1097
- h.value = i.templateData.map((n) => n.content).join("");
1115
+ y.value = i.templateData.map((o) => o.content).join("");
1098
1116
  },
1099
1117
  { deep: !0 }
1100
1118
  );
1101
- const ge = L(() => {
1102
- const n = typeof i.speech == "object" ? i.speech : {};
1119
+ const De = L(() => {
1120
+ const o = typeof i.speech == "object" ? i.speech : {};
1103
1121
  return {
1104
- ...n,
1105
- onStart: () => y("speech-start"),
1106
- onEnd: (x) => y("speech-end", x),
1107
- onInterim: (x) => y("speech-interim", x),
1108
- onFinal: (x) => {
1109
- if (n.autoReplace)
1110
- h.value = x;
1122
+ ...o,
1123
+ onStart: () => v("speech-start"),
1124
+ onEnd: (k) => v("speech-end", k),
1125
+ onInterim: (k) => v("speech-interim", k),
1126
+ onFinal: (k) => {
1127
+ if (o.autoReplace)
1128
+ y.value = k;
1111
1129
  else {
1112
- const D = h.value;
1113
- D && x && !D.endsWith(" ") && !x.startsWith(" ") && D.length > 0 ? h.value = D + " " + x : h.value = D + x;
1130
+ const D = y.value;
1131
+ D && k && !D.endsWith(" ") && !k.startsWith(" ") && D.length > 0 ? y.value = D + " " + k : y.value = D + k;
1114
1132
  }
1115
- y("speech-end", x);
1133
+ v("speech-end", k);
1116
1134
  },
1117
- onError: (x) => {
1118
- y("speech-error", x);
1135
+ onError: (k) => {
1136
+ v("speech-error", k);
1119
1137
  }
1120
1138
  };
1121
- }), { speechState: ae, start: Se, stop: Ce } = kt(ge.value), xe = () => {
1122
- ae.isRecording ? Ce() : Se();
1123
- }, ee = L(() => i.maxLength !== 1 / 0 && h.value.length > i.maxLength), { handleKeyPress: Be, triggerSubmit: re } = xt(
1139
+ }), { speechState: le, start: fe, stop: Ie } = kt(De.value), be = () => {
1140
+ le.isRecording ? Ie() : fe();
1141
+ }, _e = L(() => i.maxLength !== 1 / 0 && y.value.length > i.maxLength), { handleKeyPress: pe, triggerSubmit: he } = xt(
1124
1142
  i,
1125
- y,
1126
- h,
1127
- A,
1128
- ae,
1129
- k,
1130
1143
  v,
1131
- B,
1132
- F,
1133
- G,
1134
- xe,
1135
- W,
1144
+ y,
1136
1145
  K,
1137
- se,
1146
+ le,
1147
+ T,
1148
+ g,
1149
+ x,
1150
+ te,
1151
+ j,
1152
+ be,
1153
+ P,
1154
+ V,
1155
+ ge,
1138
1156
  b,
1139
- ye
1140
- ), Le = (n) => {
1141
- y("focus", n), h.value && !b.value && (k.value = !0);
1142
- }, De = (n) => {
1143
- y("blur", n), F();
1144
- }, ke = L(() => K.value === "multiple" ? "textarea" : "text"), e = L(
1157
+ de
1158
+ ), Te = (o) => {
1159
+ v("focus", o), y.value && !b.value && (T.value = !0);
1160
+ }, Ae = (o) => {
1161
+ v("blur", o), te();
1162
+ }, Ke = L(() => V.value === "multiple" ? "textarea" : "text"), Re = L(
1145
1163
  () => ({
1146
1164
  display: "flex",
1147
1165
  justifyContent: i.showWordLimit && i.maxLength !== 1 / 0 ? "space-between" : "flex-end",
1148
1166
  alignItems: "center"
1149
1167
  })
1150
- ), t = dt(), o = L(() => !!t.decorativeContent), r = L(() => i.disabled || o.value), c = L(() => i.loading), f = L(() => ({
1151
- "is-disabled": r.value,
1152
- "is-loading": c.value,
1153
- "is-auto-switching": Y.value
1154
- })), I = L(() => ({
1168
+ ), e = dt(), t = L(() => !!e.decorativeContent), n = L(() => i.disabled || t.value), u = L(() => i.loading), r = L(() => ({
1169
+ "is-disabled": n.value,
1170
+ "is-loading": u.value,
1171
+ "is-auto-switching": z.value
1172
+ })), f = L(() => ({
1155
1173
  width: St(i.suggestionPopupWidth),
1156
1174
  maxWidth: "100%"
1157
1175
  // 确保不超出父容器宽度
1158
- })), O = () => {
1159
- A.value = !1;
1176
+ })), _ = () => {
1177
+ K.value = !1;
1160
1178
  };
1161
- ne(h, () => {
1162
- te(J), h.value === "" && i.mode === "single" && (K.value = "single"), Q();
1163
- }), ne(
1179
+ oe(y, () => {
1180
+ ne(xe), y.value === "" && i.mode === "single" && (V.value = "single"), q();
1181
+ }), oe(
1164
1182
  () => b.value,
1165
- (n) => {
1166
- n && (K.value = "multiple");
1183
+ (o) => {
1184
+ o && (V.value = "multiple");
1167
1185
  }
1168
1186
  );
1169
- const w = () => {
1187
+ const E = () => {
1170
1188
  d.value && d.value.activateFirstField();
1171
- }, { accept: $ = "*", multiple: H = !0 } = ((Ve = i.buttonGroup) == null ? void 0 : Ve.file) || {}, { open: le, files: Ae } = ht({ accept: $, multiple: H });
1172
- return ne(Ae, (n) => {
1173
- n && n.length > 0 && y("files-selected", Array.from(n));
1174
- }), u({
1175
- focus: he,
1176
- blur: we,
1177
- clear: ve,
1178
- submit: re,
1179
- startSpeech: Se,
1180
- stopSpeech: Ce,
1181
- activateTemplateFirstField: w
1182
- }), (n, x) => (m(), T("div", {
1189
+ }, { accept: G = "*", multiple: R = !0 } = ((Z = i.buttonGroup) == null ? void 0 : Z.file) || {}, { open: $, files: A } = ht({ accept: G, multiple: R });
1190
+ return oe(A, (o) => {
1191
+ o && o.length > 0 && v("files-selected", Array.from(o));
1192
+ }), c({
1193
+ focus: X,
1194
+ blur: ke,
1195
+ clear: me,
1196
+ submit: he,
1197
+ startSpeech: fe,
1198
+ stopSpeech: Ie,
1199
+ activateTemplateFirstField: E
1200
+ }), (o, k) => (m(), I("div", {
1183
1201
  ref_key: "senderRef",
1184
1202
  ref: a,
1185
- class: oe(["tiny-sender", [f.value, `theme-${n.theme}`, `mode-${K.value}`]]),
1186
- "data-theme": n.theme
1203
+ class: se(["tiny-sender", [r.value, `theme-${o.theme}`, `mode-${V.value}`]]),
1204
+ "data-theme": o.theme
1187
1205
  }, [
1188
- z("div", zt, [
1189
- z("div", {
1206
+ U("div", zt, [
1207
+ U("div", {
1190
1208
  class: "tiny-sender__input-wrapper",
1191
1209
  ref_key: "inputWrapperRef",
1192
1210
  ref: C
1193
1211
  }, [
1194
- X(We, { name: "tiny-sender-slide-down" }, {
1195
- default: de(() => [
1196
- n.$slots.header ? (m(), T("div", Gt, [
1197
- ue(n.$slots, "header")
1198
- ])) : U("", !0)
1212
+ Q(We, { name: "tiny-sender-slide-down" }, {
1213
+ default: ye(() => [
1214
+ o.$slots.header ? (m(), I("div", Gt, [
1215
+ ue(o.$slots, "header")
1216
+ ])) : N("", !0)
1199
1217
  ]),
1200
1218
  _: 3
1201
1219
  }),
1202
- z("div", {
1203
- class: oe(["tiny-sender__input-row", { "has-prefix": n.$slots.prefix, "has-header": n.$slots.header }])
1220
+ U("div", {
1221
+ class: se(["tiny-sender__input-row", { "has-prefix": o.$slots.prefix, "has-header": o.$slots.header }])
1204
1222
  }, [
1205
- n.$slots.prefix ? (m(), T("div", jt, [
1206
- ue(n.$slots, "prefix")
1207
- ])) : U("", !0),
1208
- z("div", Jt, [
1209
- n.$slots.decorativeContent ? (m(), T("div", Xt, [
1210
- ue(n.$slots, "decorativeContent")
1211
- ])) : U("", !0),
1212
- b.value ? (m(), Z(Pt, {
1223
+ o.$slots.prefix ? (m(), I("div", jt, [
1224
+ ue(o.$slots, "prefix")
1225
+ ])) : N("", !0),
1226
+ U("div", Jt, [
1227
+ o.$slots.decorativeContent ? (m(), I("div", Xt, [
1228
+ ue(o.$slots, "decorativeContent")
1229
+ ])) : N("", !0),
1230
+ b.value ? (m(), ee(Ft, {
1213
1231
  key: 1,
1214
1232
  ref_key: "templateEditorRef",
1215
1233
  ref: d,
1216
1234
  "model-value": i.templateData,
1217
- "onUpdate:modelValue": $e,
1218
- onSubmit: S(re)
1219
- }, null, 8, ["model-value", "onSubmit"])) : (m(), T("div", Zt, [
1220
- X(S(pt), {
1235
+ "onUpdate:modelValue": Le,
1236
+ onSubmit: S(he)
1237
+ }, null, 8, ["model-value", "onSubmit"])) : (m(), I("div", Zt, [
1238
+ Q(S(pt), {
1221
1239
  ref_key: "inputRef",
1222
- ref: _,
1223
- autosize: n.autoSize,
1224
- type: ke.value,
1240
+ ref: w,
1241
+ autosize: o.autoSize,
1242
+ type: Ke.value,
1225
1243
  resize: "none",
1226
- modelValue: S(h),
1227
- "onUpdate:modelValue": x[0] || (x[0] = (D) => ft(h) ? h.value = D : null),
1228
- disabled: r.value,
1229
- placeholder: n.placeholder,
1230
- autofocus: n.autofocus,
1231
- onKeydown: S(Be),
1232
- onCompositionstart: x[1] || (x[1] = (D) => A.value = !0),
1233
- onCompositionend: O,
1234
- onFocus: Le,
1235
- onBlur: De
1244
+ modelValue: S(y),
1245
+ "onUpdate:modelValue": k[0] || (k[0] = (D) => ft(y) ? y.value = D : null),
1246
+ disabled: n.value,
1247
+ placeholder: o.placeholder,
1248
+ autofocus: o.autofocus,
1249
+ onKeydown: S(pe),
1250
+ onCompositionstart: k[1] || (k[1] = (D) => K.value = !0),
1251
+ onCompositionend: _,
1252
+ onFocus: Te,
1253
+ onBlur: Ae
1236
1254
  }, null, 8, ["autosize", "type", "modelValue", "disabled", "placeholder", "autofocus", "onKeydown"]),
1237
- S(E) && !S(A) ? (m(), T("div", Qt, [
1238
- z("span", Yt, ce(S(h)), 1),
1239
- je(ce(S(E)) + " ", 1),
1240
- S(q) ? (m(), T("div", en, "TAB")) : U("", !0)
1241
- ])) : U("", !0)
1255
+ S(Y) && !S(K) ? (m(), I("div", Qt, [
1256
+ U("span", Yt, ce(S(y)), 1),
1257
+ je(ce(S(Y)) + " ", 1),
1258
+ S(B) ? (m(), I("div", en, "TAB")) : N("", !0)
1259
+ ])) : N("", !0)
1242
1260
  ]))
1243
1261
  ]),
1244
- K.value === "single" ? (m(), T("div", tn, [
1245
- z("div", {
1262
+ V.value === "single" ? (m(), I("div", tn, [
1263
+ U("div", {
1246
1264
  class: "tiny-sender__buttons-container",
1247
1265
  ref_key: "buttonsContainerRef",
1248
- ref: p
1266
+ ref: h
1249
1267
  }, [
1250
- ue(n.$slots, "actions"),
1251
- X(Je, {
1252
- "allow-speech": n.allowSpeech,
1253
- "allow-files": n.allowFiles,
1254
- loading: n.loading,
1255
- disabled: r.value,
1256
- "show-clear": n.clearable,
1257
- "has-content": P.value,
1258
- "speech-status": S(ae),
1259
- "button-group": n.buttonGroup,
1260
- "submit-type": n.submitType,
1261
- "is-over-limit": ee.value,
1262
- "stop-text": n.stopText,
1263
- onClear: ve,
1264
- onToggleSpeech: xe,
1265
- onSubmit: S(re),
1266
- onCancel: x[2] || (x[2] = (D) => n.$emit("cancel")),
1267
- onTriggerSelect: S(le)
1268
+ ue(o.$slots, "actions"),
1269
+ Q(Je, {
1270
+ "allow-speech": o.allowSpeech,
1271
+ "allow-files": o.allowFiles,
1272
+ loading: o.loading,
1273
+ disabled: n.value,
1274
+ "show-clear": o.clearable,
1275
+ "has-content": F.value,
1276
+ "speech-status": S(le),
1277
+ "button-group": o.buttonGroup,
1278
+ "submit-type": o.submitType,
1279
+ "is-over-limit": _e.value,
1280
+ "stop-text": o.stopText,
1281
+ onClear: me,
1282
+ onToggleSpeech: be,
1283
+ onSubmit: S(he),
1284
+ onCancel: k[2] || (k[2] = (D) => o.$emit("cancel")),
1285
+ onTriggerSelect: S($)
1268
1286
  }, null, 8, ["allow-speech", "allow-files", "loading", "disabled", "show-clear", "has-content", "speech-status", "button-group", "submit-type", "is-over-limit", "stop-text", "onSubmit", "onTriggerSelect"])
1269
1287
  ], 512)
1270
- ])) : U("", !0)
1288
+ ])) : N("", !0)
1271
1289
  ], 2),
1272
- X(We, { name: "tiny-sender-slide-up" }, {
1273
- default: de(() => [
1274
- K.value === "multiple" ? (m(), T("div", {
1290
+ Q(We, { name: "tiny-sender-slide-up" }, {
1291
+ default: ye(() => [
1292
+ V.value === "multiple" ? (m(), I("div", {
1275
1293
  key: 0,
1276
- style: Fe(e.value),
1294
+ style: Ve(Re.value),
1277
1295
  class: "tiny-sender__footer-slot tiny-sender__bottom-row"
1278
1296
  }, [
1279
- z("div", nn, [
1280
- ue(n.$slots, "footer-left")
1297
+ U("div", nn, [
1298
+ ue(o.$slots, "footer-left")
1281
1299
  ]),
1282
- z("div", on, [
1283
- ue(n.$slots, "footer-right"),
1284
- n.showWordLimit && n.maxLength !== 1 / 0 ? (m(), T("div", {
1300
+ U("div", on, [
1301
+ ue(o.$slots, "footer-right"),
1302
+ o.showWordLimit && o.maxLength !== 1 / 0 ? (m(), I("div", {
1285
1303
  key: 0,
1286
- class: oe(["tiny-sender__word-limit", { "is-over-limit": ee.value }])
1304
+ class: se(["tiny-sender__word-limit", { "is-over-limit": _e.value }])
1287
1305
  }, [
1288
- z("span", sn, ce(S(h).length), 1),
1289
- je("/" + ce(n.maxLength), 1)
1290
- ], 2)) : U("", !0),
1291
- K.value === "multiple" ? (m(), T("div", an, [
1292
- z("div", ln, [
1293
- X(Je, {
1294
- "allow-speech": n.allowSpeech,
1295
- "allow-files": n.allowFiles,
1296
- loading: n.loading,
1297
- disabled: r.value,
1298
- "show-clear": n.clearable,
1299
- "has-content": P.value,
1300
- "speech-status": S(ae),
1301
- "button-group": n.buttonGroup,
1302
- "submit-type": n.submitType,
1303
- "is-over-limit": ee.value,
1304
- "stop-text": n.stopText,
1305
- onClear: ve,
1306
- onToggleSpeech: xe,
1307
- onSubmit: S(re),
1308
- onCancel: x[3] || (x[3] = (D) => n.$emit("cancel")),
1309
- onTriggerSelect: S(le)
1306
+ U("span", sn, ce(S(y).length), 1),
1307
+ je("/" + ce(o.maxLength), 1)
1308
+ ], 2)) : N("", !0),
1309
+ V.value === "multiple" ? (m(), I("div", an, [
1310
+ U("div", ln, [
1311
+ Q(Je, {
1312
+ "allow-speech": o.allowSpeech,
1313
+ "allow-files": o.allowFiles,
1314
+ loading: o.loading,
1315
+ disabled: n.value,
1316
+ "show-clear": o.clearable,
1317
+ "has-content": F.value,
1318
+ "speech-status": S(le),
1319
+ "button-group": o.buttonGroup,
1320
+ "submit-type": o.submitType,
1321
+ "is-over-limit": _e.value,
1322
+ "stop-text": o.stopText,
1323
+ onClear: me,
1324
+ onToggleSpeech: be,
1325
+ onSubmit: S(he),
1326
+ onCancel: k[3] || (k[3] = (D) => o.$emit("cancel")),
1327
+ onTriggerSelect: S($)
1310
1328
  }, null, 8, ["allow-speech", "allow-files", "loading", "disabled", "show-clear", "has-content", "speech-status", "button-group", "submit-type", "is-over-limit", "stop-text", "onSubmit", "onTriggerSelect"])
1311
1329
  ])
1312
- ])) : U("", !0)
1330
+ ])) : N("", !0)
1313
1331
  ])
1314
- ], 4)) : n.$slots.footer ? (m(), T("div", rn, [
1315
- ue(n.$slots, "footer")
1316
- ])) : U("", !0)
1332
+ ], 4)) : o.$slots.footer ? (m(), I("div", rn, [
1333
+ ue(o.$slots, "footer")
1334
+ ])) : N("", !0)
1317
1335
  ]),
1318
1336
  _: 3
1319
1337
  })
1320
1338
  ], 512)
1321
1339
  ]),
1322
- X(Ut, {
1323
- show: S(k),
1324
- suggestions: n.suggestions,
1325
- "popup-style": I.value,
1326
- "active-keyboard-index": S(R),
1327
- "active-mouse-index": S(g),
1328
- "input-value": S(h),
1329
- onSelect: S(N),
1330
- onMouseEnter: S(j),
1331
- onMouseLeave: S(pe)
1340
+ Q(Ut, {
1341
+ show: S(T),
1342
+ suggestions: o.suggestions,
1343
+ "popup-style": f.value,
1344
+ "active-keyboard-index": S(O),
1345
+ "active-mouse-index": S(p),
1346
+ "input-value": S(y),
1347
+ onSelect: S(H),
1348
+ onMouseEnter: S(J),
1349
+ onMouseLeave: S(re)
1332
1350
  }, null, 8, ["show", "suggestions", "popup-style", "active-keyboard-index", "active-mouse-index", "input-value", "onSelect", "onMouseEnter", "onMouseLeave"])
1333
1351
  ], 10, qt));
1334
1352
  }
1335
1353
  });
1336
- Te.name = "TrSender";
1354
+ $e.name = "TrSender";
1337
1355
  const un = function(l) {
1338
- l.component(Te.name, Te);
1356
+ l.component($e.name, $e);
1339
1357
  };
1340
- Te.install = un;
1358
+ $e.install = un;
1341
1359
  export {
1342
- Te as default
1360
+ $e as default
1343
1361
  };