@opentiny/tiny-robot 0.3.0-alpha.13 → 0.3.0-alpha.15

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