@opentiny/tiny-robot 0.2.1 → 0.2.3

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