@opentiny/tiny-robot 0.3.0-alpha.36 → 0.3.0-alpha.38

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