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

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