@opentiny/tiny-robot 0.2.2 → 0.2.4

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 X, 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 he, createElementBlock as I, openBlock as k, createCommentVNode as P, createBlock as G, unref as x, withCtx as J, createVNode as U, normalizeClass as oe, resolveDynamicComponent as Ze, createElementVNode as X, mergeModels as _e, useModel as Ge, onMounted as Je, useSlots as Qe, Transition as ge, renderSlot as ne, isRef as Ne, createTextVNode as Te, toDisplayString as se, normalizeStyle as xe, Fragment as Re, renderList as ke, withModifiers as Ye } from "vue";
2
2
  import { I as et } from "../index5.js";
3
3
  import { B as ue } from "../index3.js";
4
- import { T as me } from "../index4.js";
4
+ import { T as De } from "../index4.js";
5
5
  import { i as tt } from "../close.js";
6
- import { I as nt, L as st, v 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), Z = (t) => t.replace(/\u200B/g, ""), me = () => document.createTextNode(Ae), ct = (t) => {
43
+ const b = t.textContent || "", d = Z(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 = me();
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 M = m.target, z = M.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
+ M.selectionStart = M.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 = Z(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 M = s.nextSibling;
152
+ M && M.nodeType === Node.TEXT_NODE && Q(M.textContent || "") ? (m.setStart(M, 0), m.setEnd(M, 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 = Z(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 (Z(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 = Z(_);
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,93 @@ 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 = {
393
+ key: 1,
394
+ class: "action-buttons__cancel"
395
+ }, Le = /* @__PURE__ */ he({
388
396
  __name: "ActionButtons",
389
397
  props: {
390
398
  loading: { type: Boolean, default: !1 },
@@ -402,34 +410,34 @@ const ht = { class: "action-buttons" }, vt = {
402
410
  isOverLimit: { type: Boolean, default: !1 }
403
411
  },
404
412
  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 = () => {
413
+ setup(t, { emit: b }) {
414
+ 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
415
  u.value || S("clear");
408
- }, a = () => {
416
+ }, l = () => {
409
417
  if (!u.value) {
410
418
  const y = !o.speechStatus.isRecording;
411
419
  S("toggle-speech", y);
412
420
  }
413
- }, _ = () => {
414
- l.value || S("submit");
421
+ }, E = () => {
422
+ s.value || S("submit");
415
423
  }, F = () => {
416
424
  u.value || S("cancel");
417
425
  };
418
- return (y, C) => (k(), M("div", ht, [
419
- v.value ? (k(), M("div", vt, [
420
- y.allowFiles && !y.loading ? (k(), Z(T(me), {
426
+ return (y, w) => (k(), I("div", vt, [
427
+ v.value ? (k(), I("div", yt, [
428
+ y.allowFiles && !y.loading ? (k(), G(x(De), {
421
429
  key: 0,
422
430
  content: "上传文件",
423
431
  placement: "top"
424
432
  }, {
425
- default: G(() => [
426
- U(T(ue), {
433
+ default: J(() => [
434
+ U(x(ue), {
427
435
  class: "action-buttons__button action-buttons__file-button",
428
436
  type: "text",
429
437
  disabled: u.value
430
438
  }, {
431
- default: G(() => [
432
- U(T(nt), {
439
+ default: J(() => [
440
+ U(x(nt), {
433
441
  class: "action-buttons__icon",
434
442
  alt: "上传文件"
435
443
  })
@@ -438,73 +446,64 @@ const ht = { class: "action-buttons" }, vt = {
438
446
  }, 8, ["disabled"])
439
447
  ]),
440
448
  _: 1
441
- })) : $("", !0),
442
- r.value && !y.loading ? (k(), Z(T(ue), {
449
+ })) : P("", !0),
450
+ i.value && !y.loading ? (k(), G(x(ue), {
443
451
  key: 1,
444
- class: le(["action-buttons__button action-buttons__speech-button", { "is-recording": p.value }]),
452
+ class: oe(["action-buttons__button action-buttons__speech-button", { "is-recording": f.value }]),
445
453
  type: "text",
446
454
  disabled: u.value,
447
- onClick: a
455
+ onClick: l
448
456
  }, {
449
- default: G(() => [
450
- p.value ? (k(), Z(T(lt), {
457
+ default: J(() => [
458
+ f.value ? (k(), G(x(ot), {
451
459
  key: 1,
452
460
  class: "action-buttons__icon action-buttons__icon--recording",
453
461
  alt: "语音中"
454
- })) : (k(), Z(T(st), {
462
+ })) : (k(), G(x(st), {
455
463
  key: 0,
456
464
  class: "action-buttons__icon",
457
465
  alt: "录音"
458
466
  }))
459
467
  ]),
460
468
  _: 1
461
- }, 8, ["disabled", "class"])) : $("", !0),
462
- y.showClear ? (k(), Z(T(me), {
469
+ }, 8, ["disabled", "class"])) : P("", !0),
470
+ y.showClear ? (k(), G(x(De), {
463
471
  key: 2,
464
472
  content: "清空内容",
465
473
  placement: "top"
466
474
  }, {
467
- default: G(() => [
468
- U(T(ue), {
475
+ default: J(() => [
476
+ U(x(ue), {
469
477
  class: "action-buttons__button action-buttons__clear-button",
470
478
  type: "text",
471
479
  disabled: u.value || !y.hasContent,
472
- onClick: E
480
+ onClick: _
473
481
  }, {
474
- default: G(() => [
475
- (k(), Z(Ue(T(f)), { class: "action-buttons__icon action-buttons__icon--close" }))
482
+ default: J(() => [
483
+ (k(), G(Ze(x(d)), { class: "action-buttons__icon action-buttons__icon--close" }))
476
484
  ]),
477
485
  _: 1
478
486
  }, 8, ["disabled"])
479
487
  ]),
480
488
  _: 1
481
- })) : $("", !0)
482
- ])) : $("", !0),
483
- y.hasContent || y.loading ? (k(), Z(T(ue), {
489
+ })) : P("", !0)
490
+ ])) : P("", !0),
491
+ y.hasContent || y.loading ? (k(), G(x(ue), {
484
492
  key: 1,
485
493
  type: "text",
486
494
  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() : _())
495
+ disabled: y.loading ? u.value : s.value,
496
+ onClick: w[0] || (w[0] = (C) => y.loading ? F() : E())
489
497
  }, {
490
- default: G(() => [
491
- X("div", yt, [
492
- y.loading ? (k(), Z(T(me), {
493
- key: 1,
494
- content: "停止生成",
495
- placement: "top"
496
- }, {
497
- default: G(() => [
498
- X("div", bt, [
499
- U(T(at), {
500
- class: "action-buttons__icon action-buttons__icon--stop",
501
- alt: "加载中"
502
- }),
503
- C[1] || (C[1] = X("span", { class: "action-buttons__cancel-text" }, "停止回答", -1))
504
- ])
505
- ]),
506
- _: 1
507
- })) : (k(), Z(T(ot), {
498
+ default: J(() => [
499
+ X("div", bt, [
500
+ y.loading ? (k(), I("div", Ct, [
501
+ U(x(at), {
502
+ class: "action-buttons__icon action-buttons__icon--stop",
503
+ alt: "加载中"
504
+ }),
505
+ w[1] || (w[1] = X("span", { class: "action-buttons__cancel-text" }, "停止回答", -1))
506
+ ])) : (k(), G(x(lt), {
508
507
  key: 0,
509
508
  class: "action-buttons__icon action-buttons__icon--send",
510
509
  alt: "发送"
@@ -512,511 +511,511 @@ const ht = { class: "action-buttons" }, vt = {
512
511
  ])
513
512
  ]),
514
513
  _: 1
515
- }, 8, ["disabled"])) : $("", !0)
514
+ }, 8, ["disabled"])) : P("", !0)
516
515
  ]));
517
516
  }
518
517
  });
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 += `
518
+ function wt(t, b) {
519
+ const d = O(!1), o = Oe({ ...b }), S = (n) => {
520
+ Object.assign(o, n);
521
+ }, i = (n) => {
522
+ const r = [];
523
+ let e = 0;
524
+ const a = /\[(.*?)\]/g;
525
+ let g;
526
+ for (; (g = a.exec(n)) !== null; )
527
+ 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;
528
+ return e < n.length && r.push({ type: "text", content: n.substring(e) }), r;
529
+ }, f = () => {
530
+ if (!t.value) return "";
531
+ let n = "";
532
+ const r = (e) => {
533
+ let a = "";
534
+ if (e.nodeType === Node.TEXT_NODE) {
535
+ const g = e.textContent || "";
536
+ a += Z(g);
537
+ } else if (e.nodeType === Node.ELEMENT_NODE) {
538
+ const g = e;
539
+ if (g.classList.contains("template-field")) {
540
+ const T = g.textContent || "";
541
+ a += Z(T);
542
+ } else if (g.tagName.toLowerCase() === "span") {
543
+ const T = g.textContent || "";
544
+ a += Z(T);
545
+ } else if (g.tagName.toLowerCase() === "br")
546
+ a += `
548
547
  `;
549
548
  else
550
- for (const N of Array.from(d.childNodes))
551
- s += i(N);
549
+ for (const T of Array.from(g.childNodes))
550
+ a += r(T);
552
551
  }
553
- return s;
552
+ return a;
554
553
  };
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 || "");
554
+ return t.value.childNodes.forEach((e) => {
555
+ n += r(e);
562
556
  }), 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 = "");
557
+ }, u = (n) => o.initialValues && typeof o.initialValues[n] == "string" ? o.initialValues[n] : "", s = (n, r) => {
558
+ const e = document.createElement("span");
559
+ return e.className = "template-field", e.setAttribute("data-placeholder", n), r && (e.textContent = r), W(() => {
560
+ v(e, r || "");
561
+ }), e;
562
+ }, v = (n, r) => {
563
+ const e = Z(r);
564
+ if (!e || e.trim() === "") {
565
+ const a = n.getAttribute("data-placeholder") || "";
566
+ a ? _(n, a, !0) : (n.style.minWidth = "", n.style.width = "");
568
567
  } 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 H = 20;
579
- B > H ? (t.style.setProperty("max-width", `${H}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) => {
568
+ _(n, e, !1);
569
+ Fe(n);
570
+ }, _ = (n, r, e) => {
571
+ const a = document.createElement("span");
572
+ 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);
573
+ const g = getComputedStyle(a), T = a.offsetWidth, A = parseFloat(g.fontSize);
574
+ document.body.removeChild(a);
575
+ const V = e ? 1.5 : 2, H = T / A, B = Math.max(V, Math.ceil(H));
576
+ n.style.setProperty("min-width", `${B}em`, "important");
577
+ const q = 20;
578
+ 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");
579
+ }, l = (n) => {
580
+ const e = (n === void 0 ? f() : n).trim().length > 0;
581
+ d.value !== e && (d.value = e, o.onContentStatusChange(e));
582
+ }, E = (n, r = "inside", e = !1) => {
584
583
  W(() => {
585
- const s = window.getSelection();
586
- if (!s) return;
587
- const d = document.createRange();
588
- switch (i) {
584
+ const a = window.getSelection();
585
+ if (!a) return;
586
+ const g = document.createRange();
587
+ switch (r) {
589
588
  case "before":
590
- d.setStartBefore(t);
589
+ g.setStartBefore(n);
591
590
  break;
592
591
  case "after":
593
- d.setStartAfter(t);
592
+ g.setStartAfter(n);
594
593
  break;
595
594
  case "inside":
596
595
  default:
597
- d.selectNodeContents(t), d.collapse(n);
596
+ g.selectNodeContents(n), g.collapse(e);
598
597
  break;
599
598
  }
600
- s.removeAllRanges(), s.addRange(d), t.focus && t.focus();
599
+ a.removeAllRanges(), a.addRange(g), n.focus && n.focus();
601
600
  });
602
601
  }, F = () => {
603
602
  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();
603
+ const n = t.value;
604
+ if (n) {
605
+ const r = document.createRange(), e = window.getSelection();
606
+ r.selectNodeContents(n), r.collapse(!1), e && (e.removeAllRanges(), e.addRange(r)), n.focus();
608
607
  }
609
608
  });
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);
620
- const V = he();
621
- n.appendChild(V), s || (s = I);
609
+ }, y = (n, r) => {
610
+ const e = t.value;
611
+ if (!e) return null;
612
+ e.innerHTML = "";
613
+ let a = null;
614
+ if (!r || r === o.template)
615
+ n.forEach((g) => {
616
+ if (g.type === "field") {
617
+ const T = u(g.content), A = s(g.content, T);
618
+ e.appendChild(A);
619
+ const V = me();
620
+ e.appendChild(V), a || (a = A);
622
621
  } else
623
- n.appendChild(document.createTextNode(d.content));
622
+ e.appendChild(document.createTextNode(g.content));
624
623
  }), o.initialValues && Object.keys(o.initialValues).length > 0 && W(() => {
625
- const d = p();
626
- d !== o.value && (o.onValueChange(d), o.onInput(d));
624
+ const g = f();
625
+ g !== o.value && (o.onValueChange(g), o.onInput(g));
627
626
  });
628
627
  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);
628
+ const g = w(n, r);
629
+ g.success ? g.elements.forEach((T) => {
630
+ if (e.appendChild(T.node), T.isField) {
631
+ const A = me();
632
+ e.appendChild(A);
634
633
  }
635
- N.isField && !s && (s = N.node);
636
- }) : (n.appendChild(document.createTextNode(i)), s = null);
634
+ T.isField && !a && (a = T.node);
635
+ }) : (e.appendChild(document.createTextNode(r)), a = null);
637
636
  }
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),
637
+ return a;
638
+ }, w = (n, r) => {
639
+ const e = [];
640
+ let a = 0, g = 0, T = !0;
641
+ for (; g < n.length && a <= r.length && T; ) {
642
+ const A = n[g];
643
+ if (A.type === "text")
644
+ r.substring(a).startsWith(A.content) ? (e.push({
645
+ node: document.createTextNode(A.content),
647
646
  isField: !1
648
- }), s += I.content.length, d++) : N = !1;
647
+ }), a += A.content.length, g++) : T = !1;
649
648
  else {
650
649
  let V = "";
651
- const q = t.find((B, H) => H > d && B.type === "text");
652
- if (q) {
653
- const B = i.substring(s), H = B.indexOf(q.content);
654
- H !== -1 ? (V = B.substring(0, H), s += V.length) : N = !1;
650
+ const H = n.find((B, q) => q > g && B.type === "text");
651
+ if (H) {
652
+ const B = r.substring(a), q = B.indexOf(H.content);
653
+ q !== -1 ? (V = B.substring(0, q), a += V.length) : T = !1;
655
654
  } 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++;
655
+ V = r.substring(a), a = r.length;
656
+ if (T) {
657
+ const B = s(A.content, V);
658
+ e.push({ node: B, isField: !0 }), g++;
660
659
  }
661
660
  }
662
661
  }
663
- if (N && d < t.length)
664
- for (let I = d; I < t.length; I++) {
665
- const V = t[I];
662
+ if (T && g < n.length)
663
+ for (let A = g; A < n.length; A++) {
664
+ const V = n[A];
666
665
  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 });
666
+ const H = !o.value || o.value === "" ? u(V.content) : "", B = s(V.content, H);
667
+ e.push({ node: B, isField: !0 });
669
668
  } else
670
- n.push({
669
+ e.push({
671
670
  node: document.createTextNode(V.content),
672
671
  isField: !1
673
672
  });
674
673
  }
675
- return { success: N, elements: n };
676
- }, w = () => {
677
- if (!e.value) return;
674
+ return { success: T, elements: e };
675
+ }, C = () => {
676
+ if (!t.value) return;
678
677
  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);
678
+ const n = i(o.template), r = y(n, o.value);
679
+ l(), W(() => {
680
+ if (h(), r) {
681
+ const e = r.textContent || "", a = Z(e);
682
+ a && a.trim() !== "" ? E(r, "inside", !1) : E(r, "inside", !0);
684
683
  } else
685
684
  F();
686
685
  o.isInternalUpdate = !1;
687
686
  });
688
687
  }, m = () => {
689
688
  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();
689
+ M(), p(), L(), h();
690
+ const n = f();
691
+ 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 || ""))) && M();
693
692
  }, L = () => {
694
- if (!e.value) return;
695
- ct(e.value), e.value.querySelectorAll(".template-field").forEach((i) => {
696
- De(i);
693
+ if (!t.value) return;
694
+ dt(t.value), t.value.querySelectorAll(".template-field").forEach((r) => {
695
+ Fe(r);
697
696
  });
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"))
697
+ }, M = () => {
698
+ if (!t.value) return;
699
+ const n = [];
700
+ t.value.childNodes.forEach((r) => {
701
+ if (r.nodeType === Node.TEXT_NODE) {
702
+ const e = r.textContent || "";
703
+ if (Q(e)) {
704
+ const a = r.previousSibling;
705
+ if (a && a.nodeType === Node.ELEMENT_NODE && a.classList.contains("template-field"))
707
706
  return;
708
707
  }
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);
708
+ (e.trim() === "" || Q(e)) && n.push(r);
709
+ } else r.nodeType === Node.ELEMENT_NODE && r.tagName.toLowerCase() === "br" && n.push(r);
710
+ }), n.forEach((r) => {
711
+ r.parentNode && r.parentNode.removeChild(r);
713
712
  });
714
- }, z = (t) => {
713
+ }, z = (n) => {
715
714
  if (!o.template || !o.initialValues)
716
715
  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)
716
+ for (const [r, e] of Object.entries(o.initialValues))
717
+ if (e === n)
718
+ return r;
719
+ return n.length <= 2 || /^[[\]{}()]+$/.test(n) || n.includes("[") && n.includes("]") ? n : "字段";
720
+ }, j = (n) => {
721
+ const r = n.getAttribute("data-placeholder");
722
+ if (r)
723
+ return r;
724
+ const e = n.getAttribute("title") || n.getAttribute("data-field") || n.getAttribute("data-key") || n.getAttribute("placeholder") || "";
725
+ if (e)
726
+ return e;
727
+ const a = n.textContent || "";
728
+ return z(a);
729
+ }, p = () => {
730
+ if (!t.value) return;
731
+ t.value.querySelectorAll("span").forEach((r) => {
732
+ const e = r, a = e.style, g = e.classList.contains("template-field"), T = e.hasAttribute("data-placeholder");
733
+ if (g && T)
735
734
  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);
735
+ const A = a.backgroundColor && // 标准格式
736
+ (a.backgroundColor === "rgba(0, 0, 0, 0.05)" || a.backgroundColor === "rgba(0, 0, 0, 0.08)" || // 可能的变体格式
737
+ a.backgroundColor.includes("rgba(0, 0, 0, 0.05)") || a.backgroundColor.includes("rgba(0, 0, 0, 0.08)") || // 十六进制或其他可能的格式
738
+ 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;
739
+ if (A || V || T) {
740
+ if (e.className = "template-field", !e.getAttribute("data-placeholder")) {
741
+ const B = j(e);
742
+ B && e.setAttribute("data-placeholder", B);
744
743
  }
745
- n.removeAttribute("style");
746
- const q = n.textContent || "";
747
- v(n, q);
744
+ e.removeAttribute("style");
745
+ const H = e.textContent || "";
746
+ v(e, H);
748
747
  }
749
748
  });
750
749
  }, h = () => {
751
- if (!e.value) return;
752
- e.value.querySelectorAll(".template-field").forEach((i) => {
753
- const n = i.textContent || "";
754
- v(i, n);
750
+ if (!t.value) return;
751
+ t.value.querySelectorAll(".template-field").forEach((r) => {
752
+ const e = r.textContent || "";
753
+ v(r, e);
755
754
  });
756
755
  };
757
756
  return {
758
757
  // 状态
759
- hasContent: f,
758
+ hasContent: d,
760
759
  // 解析和DOM操作
761
- parseTemplateToParts: r,
762
- getValueFromDOM: p,
760
+ parseTemplateToParts: i,
761
+ getValueFromDOM: f,
763
762
  getInitialContentForField: u,
764
- createFieldElement: l,
763
+ createFieldElement: s,
765
764
  // 光标操作
766
- setCursorTo: _,
765
+ setCursorTo: E,
767
766
  setCursorToEnd: F,
768
767
  // DOM更新
769
- updateEditorDOM: w,
768
+ updateEditorDOM: C,
770
769
  renderTemplateToDOM: y,
771
770
  // 事件处理
772
771
  handleInput: m,
773
- checkHasContent: a,
774
- cleanupEmptyTextNodes: A,
772
+ checkHasContent: l,
773
+ cleanupEmptyTextNodes: M,
775
774
  // 推断 placeholder
776
775
  inferPlaceholderForContent: z,
777
776
  extractPlaceholderFromElement: j,
778
777
  // 方法
779
778
  resetFields: () => {
780
- if (!e.value) return;
779
+ if (!t.value) return;
781
780
  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);
781
+ const n = t.value;
782
+ n.innerHTML = "";
783
+ const r = i(o.template);
784
+ let e = "";
785
+ r.forEach((a) => {
786
+ if (a.type === "field") {
787
+ const g = u(a.content), T = s(a.content, g);
788
+ g && (e += g), n.appendChild(T);
790
789
  } else
791
- t.appendChild(document.createTextNode(s.content)), n += s.content;
792
- }), o.onValueChange(n), F(), a(n), W(() => {
790
+ n.appendChild(document.createTextNode(a.content)), e += a.content;
791
+ }), o.onValueChange(e), F(), l(e), W(() => {
793
792
  o.isInternalUpdate = !1;
794
793
  });
795
794
  },
796
795
  activateFirstField: () => {
797
- var i;
798
- const t = (i = e.value) == null ? void 0 : i.querySelector(".template-field");
799
- t ? _(t, "inside", !1) : F();
796
+ var r;
797
+ const n = (r = t.value) == null ? void 0 : r.querySelector(".template-field");
798
+ n ? E(n, "inside", !1) : F();
800
799
  },
801
800
  // 选项更新
802
801
  updateOptions: S
803
802
  };
804
803
  }
805
- const wt = /* @__PURE__ */ ve({
804
+ const St = /* @__PURE__ */ he({
806
805
  __name: "TemplateEditor",
807
- props: /* @__PURE__ */ Ne({
806
+ props: /* @__PURE__ */ _e({
808
807
  value: {},
809
808
  autofocus: { type: Boolean }
810
809
  }, {
811
810
  value: { default: "" },
812
811
  valueModifiers: {}
813
812
  }),
814
- 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, {
813
+ emits: /* @__PURE__ */ _e(["input", "content-status", "submit", "focus", "blur", "empty-content"], ["update:value"]),
814
+ setup(t, { expose: b, emit: d }) {
815
+ 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
816
  template: u.value,
818
817
  value: o.value,
819
- initialValues: l.value,
818
+ initialValues: s.value,
820
819
  isInternalUpdate: v,
821
- isComposing: E,
822
- onValueChange: (g) => {
823
- if (o.value !== g) {
820
+ isComposing: _,
821
+ onValueChange: (p) => {
822
+ if (o.value !== p) {
824
823
  const h = v.value;
825
- v.value = !0, o.value = g, W(() => {
824
+ v.value = !0, o.value = p, W(() => {
826
825
  v.value = h;
827
826
  });
828
827
  }
829
828
  },
830
- onInput: (g) => {
831
- r("input", g);
829
+ onInput: (p) => {
830
+ i("input", p);
832
831
  },
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(([K, t]) => {
844
- const i = `[${K}]`;
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({
832
+ onContentStatusChange: (p) => i("content-status", p),
833
+ onSubmit: (p) => i("submit", p)
834
+ }), E = pt({
835
+ editor: f,
836
+ isComposing: _,
837
+ getValueFromDOM: l.getValueFromDOM,
838
+ handleInput: l.handleInput,
839
+ onSubmit: (p) => i("submit", p)
840
+ }), F = (p, h) => {
841
+ let N = p;
842
+ return Object.entries(h).forEach(([K, n]) => {
843
+ const r = `[${K}]`;
844
+ N = N.replace(new RegExp(r.replace(/[[\]]/g, "\\$&"), "g"), n);
845
+ }), N;
846
+ }, y = (p) => {
847
+ v.value = !0, u.value = p.template, s.value = p.initialValues || {};
848
+ const h = F(u.value, s.value);
849
+ l.updateOptions({
851
850
  template: u.value,
852
851
  value: h,
853
852
  // 使用新生成的内容而不是旧的inputValue
854
- initialValues: l.value
855
- }), a.updateEditorDOM(), o.value = h, W(() => {
853
+ initialValues: s.value
854
+ }), l.updateEditorDOM(), o.value = h, W(() => {
856
855
  v.value = !1;
857
856
  });
858
- }, C = () => {
859
- E.value = !0;
860
857
  }, w = () => {
861
- E.value = !1, a.handleInput();
862
- }, m = (g) => {
858
+ _.value = !0;
859
+ }, C = () => {
860
+ _.value = !1, l.handleInput();
861
+ }, m = (p) => {
863
862
  var K;
864
- if (!p.value) return;
865
- const h = g.target;
866
- let x = null;
867
- if (h.classList.contains("template-field") ? x = h : (K = h.parentElement) != null && K.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());
863
+ if (!f.value) return;
864
+ const h = p.target;
865
+ let N = null;
866
+ if (h.classList.contains("template-field") ? N = h : (K = h.parentElement) != null && K.classList.contains("template-field") && (N = h.parentElement), N && (!N.textContent || N.textContent.trim() === "")) {
867
+ const n = window.getSelection(), r = document.createRange();
868
+ n && (r.selectNodeContents(N), r.collapse(!0), n.removeAllRanges(), n.addRange(r), N.focus(), p.preventDefault(), p.stopPropagation());
870
869
  }
871
- }, L = (g) => {
872
- g.preventDefault();
873
- const h = g.clipboardData;
870
+ }, L = (p) => {
871
+ p.preventDefault();
872
+ const h = p.clipboardData;
874
873
  if (!h) return;
875
- const x = h.getData("text/html"), K = 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 H = a.extractPlaceholderFromElement(d);
889
- H && d.setAttribute("data-placeholder", H);
874
+ const N = h.getData("text/html"), K = h.getData("text/plain");
875
+ if (N) {
876
+ const n = document.createElement("div");
877
+ n.innerHTML = N;
878
+ const r = n.querySelectorAll("span");
879
+ let e = !1;
880
+ if (r.forEach((a) => {
881
+ const g = a, T = g.style, A = g.classList.contains("template-field"), V = g.hasAttribute("data-placeholder"), H = T.backgroundColor && // 标准格式
882
+ (T.backgroundColor === "rgba(0, 0, 0, 0.05)" || T.backgroundColor === "rgba(0, 0, 0, 0.08)" || // 可能的变体格式
883
+ T.backgroundColor.includes("rgba(0, 0, 0, 0.05)") || T.backgroundColor.includes("rgba(0, 0, 0, 0.08)") || // 十六进制或其他可能的格式
884
+ 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";
885
+ if (A || V || H || B) {
886
+ if (e = !0, g.className = "template-field", !g.getAttribute("data-placeholder")) {
887
+ const q = l.extractPlaceholderFromElement(g);
888
+ q && g.setAttribute("data-placeholder", q);
890
889
  }
891
- d.removeAttribute("style");
890
+ g.removeAttribute("style");
892
891
  }
893
- }), n) {
894
- A(t);
892
+ }), e) {
893
+ M(n);
895
894
  return;
896
895
  }
897
896
  }
898
897
  K && z(K);
899
- }, A = (g) => {
898
+ }, M = (p) => {
900
899
  const h = window.getSelection();
901
900
  if (h && h.rangeCount > 0) {
902
- const x = h.getRangeAt(0);
903
- x.deleteContents();
901
+ const N = h.getRangeAt(0);
902
+ N.deleteContents();
904
903
  const K = document.createDocumentFragment();
905
- for (; g.firstChild; )
906
- K.appendChild(g.firstChild);
907
- x.insertNode(K), x.collapse(!1), h.removeAllRanges(), h.addRange(x), j();
904
+ for (; p.firstChild; )
905
+ K.appendChild(p.firstChild);
906
+ N.insertNode(K), N.collapse(!1), h.removeAllRanges(), h.addRange(N), j();
908
907
  }
909
- }, z = (g) => {
908
+ }, z = (p) => {
910
909
  const h = window.getSelection();
911
910
  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();
911
+ const N = h.getRangeAt(0);
912
+ N.deleteContents(), N.insertNode(document.createTextNode(p)), N.collapse(!1), h.removeAllRanges(), h.addRange(N), j();
914
913
  }
915
914
  }, j = () => {
916
- E.value = !1, W(() => {
917
- a.handleInput();
918
- const g = a.getValueFromDOM();
919
- if (g !== o.value) {
915
+ _.value = !1, W(() => {
916
+ l.handleInput();
917
+ const p = l.getValueFromDOM();
918
+ if (p !== o.value) {
920
919
  const h = v.value;
921
- v.value = !0, o.value = g, r("input", g), W(() => {
920
+ v.value = !0, o.value = p, i("input", p), W(() => {
922
921
  v.value = h;
923
922
  });
924
923
  }
925
924
  setTimeout(() => {
926
- const h = a.getValueFromDOM();
927
- h !== o.value && (v.value = !0, o.value = h, r("input", h), W(() => {
925
+ const h = l.getValueFromDOM();
926
+ h !== o.value && (v.value = !0, o.value = h, i("input", h), W(() => {
928
927
  v.value = !1;
929
928
  }));
930
929
  }, 50);
931
930
  });
932
931
  };
933
- return Ge(() => {
934
- u.value && a.updateEditorDOM(), S.autofocus && p.value && a.setCursorToEnd();
932
+ return Je(() => {
933
+ u.value && l.updateEditorDOM(), S.autofocus && f.value && l.setCursorToEnd();
935
934
  }), Y(
936
935
  () => u.value,
937
936
  () => {
938
- v.value || (a.updateOptions({
937
+ v.value || (l.updateOptions({
939
938
  template: u.value,
940
939
  value: o.value,
941
- initialValues: l.value
942
- }), a.updateEditorDOM());
940
+ initialValues: s.value
941
+ }), l.updateEditorDOM());
943
942
  }
944
943
  ), Y(
945
- () => l.value,
944
+ () => s.value,
946
945
  () => {
947
- v.value || (a.updateOptions({
946
+ v.value || (l.updateOptions({
948
947
  template: u.value,
949
948
  value: o.value,
950
- initialValues: l.value
951
- }), a.updateEditorDOM());
949
+ initialValues: s.value
950
+ }), l.updateEditorDOM());
952
951
  },
953
952
  { deep: !0 }
954
953
  ), Y(
955
954
  () => o.value,
956
- (g) => {
957
- v.value || (a.updateOptions({
955
+ (p) => {
956
+ v.value || (l.updateOptions({
958
957
  template: u.value,
959
- value: g,
960
- initialValues: l.value
961
- }), a.updateEditorDOM()), (!g || g.trim() === "") && r("empty-content");
958
+ value: p,
959
+ initialValues: s.value
960
+ }), l.updateEditorDOM()), (!p || p.trim() === "") && i("empty-content");
962
961
  }
963
962
  ), b({
964
963
  focus: () => {
965
- var g;
966
- (g = p.value) == null || g.focus(), a.setCursorToEnd();
964
+ var p;
965
+ (p = f.value) == null || p.focus(), l.setCursorToEnd();
967
966
  },
968
- resetFields: a.resetFields,
969
- activateFirstField: a.activateFirstField,
970
- getValueFromDOM: a.getValueFromDOM,
967
+ resetFields: l.resetFields,
968
+ activateFirstField: l.activateFirstField,
969
+ getValueFromDOM: l.getValueFromDOM,
971
970
  setTemplate: y
972
- }), (g, h) => (k(), M("div", {
971
+ }), (p, h) => (k(), I("div", {
973
972
  class: "template-editor",
974
973
  ref_key: "contentEditableRef",
975
- ref: p,
974
+ ref: f,
976
975
  contenteditable: "true",
977
976
  onInput: h[0] || (h[0] = //@ts-ignore
978
- (...x) => T(a).handleInput && T(a).handleInput(...x)),
977
+ (...N) => x(l).handleInput && x(l).handleInput(...N)),
979
978
  onKeydown: h[1] || (h[1] = //@ts-ignore
980
- (...x) => T(_).handleTemplateKeyDown && T(_).handleTemplateKeyDown(...x)),
979
+ (...N) => x(E).handleTemplateKeyDown && x(E).handleTemplateKeyDown(...N)),
981
980
  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)),
981
+ onCompositionstart: w,
982
+ onCompositionend: C,
983
+ onFocus: h[2] || (h[2] = (N) => p.$emit("focus", N)),
984
+ onBlur: h[3] || (h[3] = (N) => p.$emit("blur", N)),
986
985
  onPaste: L
987
986
  }, null, 544));
988
987
  }
989
- }), St = ["data-theme"], Et = { class: "tiny-sender__container" }, _t = {
988
+ }), Et = ["data-theme"], _t = { class: "tiny-sender__container" }, Nt = {
990
989
  key: 0,
991
990
  class: "tiny-sender__header-slot"
992
- }, Nt = {
991
+ }, Tt = {
993
992
  key: 0,
994
993
  class: "tiny-sender__prefix-slot"
995
- }, Tt = { class: "tiny-sender__content-area" }, xt = {
994
+ }, xt = { class: "tiny-sender__content-area" }, Rt = {
996
995
  key: 0,
997
996
  class: "tiny-sender__decorative-content"
998
- }, Rt = {
997
+ }, kt = {
999
998
  key: 2,
1000
999
  class: "tiny-sender__input-field-wrapper"
1001
- }, kt = {
1000
+ }, Dt = {
1002
1001
  key: 0,
1003
1002
  class: "tiny-sender__completion-placeholder"
1004
- }, Dt = { class: "user-input-mirror" }, Ft = {
1003
+ }, Ft = { class: "user-input-mirror" }, Lt = {
1005
1004
  key: 0,
1006
1005
  class: "tiny-sender__tab-hint"
1007
- }, Lt = {
1006
+ }, Ot = {
1008
1007
  key: 1,
1009
1008
  class: "tiny-sender__actions-slot"
1010
- }, Ot = { class: "tiny-sender__footer-left" }, At = { class: "tiny-sender__footer-right" }, It = { class: "real-word-length" }, Mt = {
1009
+ }, At = { class: "tiny-sender__footer-left" }, It = { class: "tiny-sender__footer-right" }, Mt = { class: "real-word-length" }, Vt = {
1011
1010
  key: 1,
1012
1011
  class: "tiny-sender__toolbar"
1013
- }, Vt = { class: "tiny-sender__buttons-container" }, Bt = {
1012
+ }, Bt = { class: "tiny-sender__buttons-container" }, Wt = {
1014
1013
  key: 1,
1015
1014
  class: "tiny-sender__footer-slot"
1016
- }, Wt = ["onMouseenter", "onMousedown"], $t = { class: "suggestion-item__text" }, Pt = {
1015
+ }, $t = ["onMouseenter", "onMousedown"], Pt = { class: "suggestion-item__text" }, Kt = {
1017
1016
  key: 0,
1018
1017
  class: "tiny-sender__error"
1019
- }, ce = /* @__PURE__ */ ve({
1018
+ }, ce = /* @__PURE__ */ he({
1020
1019
  __name: "index",
1021
1020
  props: {
1022
1021
  autofocus: { type: Boolean, default: !1 },
@@ -1035,90 +1034,90 @@ const wt = /* @__PURE__ */ ve({
1035
1034
  placeholder: { default: "请输入内容..." },
1036
1035
  showWordLimit: { type: Boolean, default: !1 },
1037
1036
  suggestions: { default: () => [] },
1037
+ suggestionPopupWidth: { default: 400 },
1038
1038
  theme: { default: "light" },
1039
1039
  template: { default: "" },
1040
1040
  hasContent: { type: Boolean, default: void 0 },
1041
1041
  templateInitialValues: { default: () => ({}) }
1042
1042
  },
1043
1043
  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), {
1044
+ setup(t, { expose: b, emit: d }) {
1045
+ 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
1046
  showSuggestionsPopup: y,
1047
- highlightedIndex: C,
1048
- completionPlaceholder: w,
1047
+ highlightedIndex: w,
1048
+ completionPlaceholder: C,
1049
1049
  showTabHint: m,
1050
1050
  suggestionsListRef: L,
1051
- filteredSuggestions: A,
1051
+ filteredSuggestions: M,
1052
1052
  activeSuggestion: z,
1053
- updateCompletionPlaceholder: j,
1054
- updateSuggestionsState: g,
1055
- selectSuggestion: h,
1056
- acceptCurrentSuggestion: x,
1057
- closeSuggestionsPopup: K,
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(() => {
1053
+ updateSuggestionsState: j,
1054
+ selectSuggestion: p,
1055
+ acceptCurrentSuggestion: h,
1056
+ closeSuggestionsPopup: N,
1057
+ navigateSuggestions: K,
1058
+ handleSuggestionItemHover: n,
1059
+ highlightSuggestionText: r
1060
+ } = ht(o, S, l, E), e = O(o.mode), a = O(!1), g = () => {
1061
+ e.value === "single" && (e.value = "multiple", W(() => {
1063
1062
  setTimeout(() => {
1064
1063
  const c = document.querySelector(".tiny-textarea__inner");
1065
1064
  if (c) {
1066
1065
  c.style.whiteSpace = "pre-wrap";
1067
- const R = a.value.length;
1066
+ const R = l.value.length;
1068
1067
  c.focus(), c.setSelectionRange(R, R);
1069
1068
  }
1070
1069
  }, 50);
1071
1070
  }));
1072
- }, I = (c, R) => {
1071
+ }, T = (c, R) => {
1073
1072
  const D = document.createElement("span");
1074
1073
  D.style.visibility = "hidden", D.style.position = "absolute", D.style.whiteSpace = "nowrap", D.style.font = R, D.textContent = c, document.body.appendChild(D);
1075
1074
  const ee = D.offsetWidth;
1076
1075
  return document.body.removeChild(D), ee;
1077
- }, V = () => {
1078
- if (o.mode !== "single" || !r.value || d.value) return;
1076
+ }, A = () => {
1077
+ if (o.mode !== "single" || !i.value || a.value) return;
1079
1078
  const R = document.querySelector(".tiny-sender__content-area").querySelector(".tiny-input__inner"), D = v.value || document.querySelector(".tiny-sender__buttons-container");
1080
1079
  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(() => {
1080
+ const ee = window.getComputedStyle(R).font, te = T(l.value, ee), Ue = R.offsetWidth - ((D == null ? void 0 : D.offsetWidth) || 0) - 20;
1081
+ te > Ue && e.value === "single" && (a.value = !0, e.value = "multiple", W(() => {
1082
+ i.value ? setTimeout(() => {
1084
1083
  const re = document.querySelector(".tiny-textarea__inner");
1085
1084
  if (re) {
1086
1085
  re.style.whiteSpace = "pre-wrap";
1087
- const _e = a.value.length;
1088
- re.focus(), re.setSelectionRange(_e, _e);
1086
+ const Ee = l.value.length;
1087
+ re.focus(), re.setSelectionRange(Ee, Ee);
1089
1088
  }
1090
- d.value = !1;
1091
- }, 300) : d.value = !1;
1089
+ a.value = !1;
1090
+ }, 300) : a.value = !1;
1092
1091
  }));
1093
- }, q = () => {
1094
- if (E.value && u.value)
1095
- ye();
1096
- else if (r.value)
1097
- r.value.focus();
1092
+ }, V = () => {
1093
+ if (_.value && u.value)
1094
+ ve();
1095
+ else if (i.value)
1096
+ i.value.focus();
1098
1097
  else {
1099
1098
  const c = document.querySelector(".tiny-input__inner");
1100
1099
  c == null || c.focus();
1101
1100
  }
1102
- }, B = () => {
1103
- E.value = !1, S("reset-template"), W(() => {
1104
- a.value === "" && (s.value = o.mode || "single"), setTimeout(() => {
1105
- q();
1101
+ }, H = () => {
1102
+ _.value = !1, S("reset-template"), W(() => {
1103
+ l.value === "" && (e.value = o.mode || "single"), setTimeout(() => {
1104
+ V();
1106
1105
  }, 50);
1107
1106
  });
1108
- }, H = () => {
1107
+ }, B = () => {
1109
1108
  var c;
1110
- F(), E.value ? B() : (c = p.value) == null || c.focus(), W(() => {
1111
- a.value === "" && (s.value = o.mode || "single");
1112
- }), K();
1113
- }, Ae = (c) => {
1109
+ F(), _.value ? H() : (c = f.value) == null || c.focus(), W(() => {
1110
+ l.value === "" && (e.value = o.mode || "single");
1111
+ }), N();
1112
+ }, q = (c) => {
1114
1113
  S("update:modelValue", c);
1115
- }, ye = () => {
1114
+ }, ve = () => {
1116
1115
  u.value && u.value.activateFirstField();
1117
1116
  }, Ie = (c, R) => {
1118
- E.value = !0, W(() => {
1117
+ _.value = !0, W(() => {
1119
1118
  u.value && u.value.setTemplate({ template: c, initialValues: R });
1120
1119
  });
1121
- }, Me = P(() => {
1120
+ }, Me = $(() => {
1122
1121
  const c = typeof o.speech == "object" ? o.speech : {};
1123
1122
  return {
1124
1123
  ...c,
@@ -1127,249 +1126,254 @@ const wt = /* @__PURE__ */ ve({
1127
1126
  onInterim: (R) => S("speech-interim", R),
1128
1127
  onFinal: (R) => {
1129
1128
  if (c.autoReplace)
1130
- a.value = R;
1129
+ l.value = R;
1131
1130
  else {
1132
- const D = a.value;
1133
- D && R && !D.endsWith(" ") && !R.startsWith(" ") && D.length > 0 ? a.value = D + " " + R : a.value = D + R;
1131
+ const D = l.value;
1132
+ D && R && !D.endsWith(" ") && !R.startsWith(" ") && D.length > 0 ? l.value = D + " " + R : l.value = D + R;
1134
1133
  }
1135
1134
  S("speech-end", R);
1136
1135
  },
1137
1136
  onError: (R) => {
1138
- qe(R.message), S("speech-error", R);
1137
+ ze(R.message), S("speech-error", R);
1139
1138
  }
1140
1139
  };
1141
- }), { speechState: ae, start: be, stop: Ce } = pt(Me.value), de = () => {
1142
- ae.isRecording ? Ce() : be();
1143
- }, { handleKeyPress: Ve, triggerSubmit: fe } = dt(
1140
+ }), { speechState: ae, start: ye, stop: be } = gt(Me.value), de = () => {
1141
+ ae.isRecording ? be() : ye();
1142
+ }, { handleKeyPress: Ve, triggerSubmit: fe } = ft(
1144
1143
  o,
1145
1144
  S,
1146
- a,
1147
- _,
1145
+ l,
1146
+ E,
1148
1147
  ae,
1149
1148
  y,
1150
1149
  z,
1151
- x,
1150
+ h,
1151
+ N,
1152
1152
  K,
1153
- t,
1154
1153
  de,
1155
- s,
1156
- N
1154
+ e,
1155
+ g
1157
1156
  ), 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]));
1157
+ S("focus", c), l.value && M.value.length > 0 && !o.template && (y.value = !0, m.value = !0);
1159
1158
  }, We = (c) => {
1160
- S("blur", c), K();
1161
- }, $e = P(() => s.value === "multiple" ? "textarea" : "text"), Pe = P(
1159
+ S("blur", c), N();
1160
+ }, $e = $(() => e.value === "multiple" ? "textarea" : "text"), Pe = $(
1162
1161
  () => ({
1163
1162
  display: "flex",
1164
1163
  justifyContent: o.showWordLimit && o.maxLength !== 1 / 0 ? "space-between" : "flex-end",
1165
1164
  alignItems: "center"
1166
1165
  })
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(() => ({
1166
+ ), Ke = Qe(), He = $(() => !!Ke.decorativeContent), ie = $(() => o.disabled || He.value), Ce = $(() => o.loading), we = $(() => o.hasContent !== void 0 ? o.hasContent : !!l.value), Xe = $(() => ({
1168
1167
  "is-disabled": ie.value,
1169
- "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();
1168
+ "is-loading": Ce.value,
1169
+ "has-error": !!le.value,
1170
+ "is-auto-switching": a.value
1171
+ })), qe = $(() => ({
1172
+ width: rt(o.suggestionPopupWidth),
1173
+ maxWidth: "100%"
1174
+ // 确保不超出父容器宽度
1175
+ })), le = O(""), ze = (c) => {
1176
+ le.value = c, setTimeout(() => le.value = "", 5e3);
1177
+ }, je = () => {
1178
+ E.value = !1, setTimeout(() => {
1179
+ E.value = !1, j();
1177
1180
  }, 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");
1181
+ }, pe = $(() => o.maxLength !== 1 / 0 && l.value.length > o.maxLength);
1182
+ return Y(l, () => {
1183
+ W(A), l.value === "" && o.mode === "single" && (e.value = "single");
1181
1184
  }), Y(
1182
- () => E.value,
1185
+ () => _.value,
1183
1186
  (c) => {
1184
- c && (s.value = "multiple");
1187
+ c && (e.value = "multiple");
1185
1188
  }
1186
1189
  ), b({
1187
- focus: q,
1190
+ focus: V,
1188
1191
  blur: () => {
1189
- if (r.value)
1190
- r.value.blur();
1192
+ if (i.value)
1193
+ i.value.blur();
1191
1194
  else {
1192
1195
  const c = document.querySelector(".tiny-input__inner");
1193
1196
  c == null || c.blur();
1194
1197
  }
1195
1198
  },
1196
- clear: H,
1199
+ clear: B,
1197
1200
  submit: fe,
1198
- startSpeech: be,
1199
- stopSpeech: Ce,
1200
- activateTemplateFirstField: ye,
1201
+ startSpeech: ye,
1202
+ stopSpeech: be,
1203
+ activateTemplateFirstField: ve,
1201
1204
  setTemplate: Ie
1202
- }), (c, R) => (k(), M("div", {
1205
+ }), (c, R) => (k(), I("div", {
1203
1206
  ref_key: "senderRef",
1204
- ref: p,
1205
- class: le(["tiny-sender", [Xe.value, `theme-${c.theme}`, `mode-${s.value}`]]),
1207
+ ref: f,
1208
+ class: oe(["tiny-sender", [Xe.value, `theme-${c.theme}`, `mode-${e.value}`]]),
1206
1209
  "data-theme": c.theme
1207
1210
  }, [
1208
- X("div", Et, [
1211
+ X("div", _t, [
1209
1212
  X("div", {
1210
1213
  class: "tiny-sender__input-wrapper",
1211
1214
  ref_key: "inputWrapperRef",
1212
- ref: l
1215
+ ref: s
1213
1216
  }, [
1214
1217
  U(ge, { name: "tiny-sender-slide-down" }, {
1215
- default: G(() => [
1216
- c.$slots.header ? (k(), M("div", _t, [
1218
+ default: J(() => [
1219
+ c.$slots.header ? (k(), I("div", Nt, [
1217
1220
  ne(c.$slots, "header")
1218
- ])) : $("", !0)
1221
+ ])) : P("", !0)
1219
1222
  ]),
1220
1223
  _: 3
1221
1224
  }),
1222
1225
  X("div", {
1223
- class: le(["tiny-sender__input-row", { "has-prefix": c.$slots.prefix, "has-header": c.$slots.header }])
1226
+ class: oe(["tiny-sender__input-row", { "has-prefix": c.$slots.prefix, "has-header": c.$slots.header }])
1224
1227
  }, [
1225
- c.$slots.prefix ? (k(), M("div", Nt, [
1228
+ c.$slots.prefix ? (k(), I("div", Tt, [
1226
1229
  ne(c.$slots, "prefix")
1227
- ])) : $("", !0),
1228
- X("div", Tt, [
1229
- c.$slots.decorativeContent ? (k(), M("div", xt, [
1230
+ ])) : P("", !0),
1231
+ X("div", xt, [
1232
+ c.$slots.decorativeContent ? (k(), I("div", Rt, [
1230
1233
  ne(c.$slots, "decorativeContent")
1231
- ])) : $("", !0),
1232
- E.value ? (k(), Z(wt, {
1234
+ ])) : P("", !0),
1235
+ _.value ? (k(), G(St, {
1233
1236
  key: 1,
1234
1237
  ref_key: "templateEditorRef",
1235
1238
  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), {
1239
+ value: x(l),
1240
+ "onUpdate:value": R[0] || (R[0] = (D) => Ne(l) ? l.value = D : null),
1241
+ onInput: q,
1242
+ onEmptyContent: H
1243
+ }, null, 8, ["value"])) : (k(), I("div", kt, [
1244
+ U(x(et), {
1242
1245
  ref_key: "inputRef",
1243
- ref: r,
1246
+ ref: i,
1244
1247
  autosize: c.autoSize,
1245
1248
  type: $e.value,
1246
- readonly: we.value,
1249
+ readonly: Ce.value,
1247
1250
  resize: "none",
1248
- modelValue: T(a),
1249
- "onUpdate:modelValue": R[1] || (R[1] = (D) => Te(a) ? a.value = D : null),
1251
+ modelValue: x(l),
1252
+ "onUpdate:modelValue": R[1] || (R[1] = (D) => Ne(l) ? l.value = D : null),
1250
1253
  disabled: ie.value,
1251
1254
  placeholder: c.placeholder,
1252
1255
  autofocus: c.autofocus,
1253
- onKeydown: T(Ve),
1254
- onCompositionstart: R[2] || (R[2] = (D) => _.value = !0),
1255
- onCompositionend: ze,
1256
+ onKeydown: x(Ve),
1257
+ onCompositionstart: R[2] || (R[2] = (D) => E.value = !0),
1258
+ onCompositionend: je,
1256
1259
  onFocus: Be,
1257
1260
  onBlur: We
1258
1261
  }, null, 8, ["autosize", "type", "readonly", "modelValue", "disabled", "placeholder", "autofocus", "onKeydown"]),
1259
- T(w) && !T(_) ? (k(), M("div", kt, [
1260
- X("span", Dt, se(T(a)), 1),
1261
- xe(se(T(w)) + " ", 1),
1262
- T(m) ? (k(), M("div", Ft, "TAB")) : $("", !0)
1263
- ])) : $("", !0)
1262
+ x(C) && !x(E) ? (k(), I("div", Dt, [
1263
+ X("span", Ft, se(x(l)), 1),
1264
+ Te(se(x(C)) + " ", 1),
1265
+ x(m) ? (k(), I("div", Lt, "TAB")) : P("", !0)
1266
+ ])) : P("", !0)
1264
1267
  ]))
1265
1268
  ]),
1266
- s.value === "single" ? (k(), M("div", Lt, [
1269
+ e.value === "single" ? (k(), I("div", Ot, [
1267
1270
  X("div", {
1268
1271
  class: "tiny-sender__buttons-container",
1269
1272
  ref_key: "buttonsContainerRef",
1270
1273
  ref: v
1271
1274
  }, [
1272
1275
  ne(c.$slots, "actions"),
1273
- U(Fe, {
1276
+ U(Le, {
1274
1277
  "allow-speech": c.allowSpeech,
1275
1278
  "allow-files": c.allowFiles,
1276
1279
  loading: c.loading,
1277
1280
  disabled: ie.value,
1278
1281
  "show-clear": c.clearable,
1279
- "has-content": Se.value,
1280
- "speech-status": T(ae),
1282
+ "has-content": we.value,
1283
+ "speech-status": x(ae),
1281
1284
  "submit-type": c.submitType,
1282
1285
  "is-over-limit": pe.value,
1283
- onClear: H,
1286
+ onClear: B,
1284
1287
  onToggleSpeech: de,
1285
- onSubmit: T(fe),
1288
+ onSubmit: x(fe),
1286
1289
  onCancel: R[3] || (R[3] = (D) => c.$emit("cancel"))
1287
1290
  }, null, 8, ["allow-speech", "allow-files", "loading", "disabled", "show-clear", "has-content", "speech-status", "submit-type", "is-over-limit", "onSubmit"])
1288
1291
  ], 512)
1289
- ])) : $("", !0)
1292
+ ])) : P("", !0)
1290
1293
  ], 2),
1291
1294
  U(ge, { name: "tiny-sender-slide-up" }, {
1292
- default: G(() => [
1293
- s.value === "multiple" ? (k(), M("div", {
1295
+ default: J(() => [
1296
+ e.value === "multiple" ? (k(), I("div", {
1294
1297
  key: 0,
1295
- style: Qe(Pe.value),
1298
+ style: xe(Pe.value),
1296
1299
  class: "tiny-sender__footer-slot tiny-sender__bottom-row"
1297
1300
  }, [
1298
- X("div", Ot, [
1301
+ X("div", At, [
1299
1302
  ne(c.$slots, "footer-left")
1300
1303
  ]),
1301
- X("div", At, [
1304
+ X("div", It, [
1302
1305
  ne(c.$slots, "footer-right"),
1303
- c.showWordLimit && c.maxLength !== 1 / 0 ? (k(), M("div", {
1306
+ c.showWordLimit && c.maxLength !== 1 / 0 ? (k(), I("div", {
1304
1307
  key: 0,
1305
- class: le(["tiny-sender__word-limit", { "is-over-limit": pe.value }])
1308
+ class: oe(["tiny-sender__word-limit", { "is-over-limit": pe.value }])
1306
1309
  }, [
1307
- X("span", It, se(T(a).length), 1),
1308
- xe("/" + se(c.maxLength), 1)
1309
- ], 2)) : $("", !0),
1310
- s.value === "multiple" ? (k(), M("div", Mt, [
1311
- X("div", Vt, [
1312
- U(Fe, {
1310
+ X("span", Mt, se(x(l).length), 1),
1311
+ Te("/" + se(c.maxLength), 1)
1312
+ ], 2)) : P("", !0),
1313
+ e.value === "multiple" ? (k(), I("div", Vt, [
1314
+ X("div", Bt, [
1315
+ U(Le, {
1313
1316
  "allow-speech": c.allowSpeech,
1314
1317
  "allow-files": c.allowFiles,
1315
1318
  loading: c.loading,
1316
1319
  disabled: ie.value,
1317
1320
  "show-clear": c.clearable,
1318
- "has-content": Se.value,
1319
- "speech-status": T(ae),
1321
+ "has-content": we.value,
1322
+ "speech-status": x(ae),
1320
1323
  "submit-type": c.submitType,
1321
1324
  "is-over-limit": pe.value,
1322
- onClear: H,
1325
+ onClear: B,
1323
1326
  onToggleSpeech: de,
1324
- onSubmit: T(fe),
1327
+ onSubmit: x(fe),
1325
1328
  onCancel: R[4] || (R[4] = (D) => c.$emit("cancel"))
1326
1329
  }, null, 8, ["allow-speech", "allow-files", "loading", "disabled", "show-clear", "has-content", "speech-status", "submit-type", "is-over-limit", "onSubmit"])
1327
1330
  ])
1328
- ])) : $("", !0)
1331
+ ])) : P("", !0)
1329
1332
  ])
1330
- ], 4)) : c.$slots.footer ? (k(), M("div", Bt, [
1333
+ ], 4)) : c.$slots.footer ? (k(), I("div", Wt, [
1331
1334
  ne(c.$slots, "footer")
1332
- ])) : $("", !0)
1335
+ ])) : P("", !0)
1333
1336
  ]),
1334
1337
  _: 3
1335
1338
  })
1336
1339
  ], 512)
1337
1340
  ]),
1338
1341
  U(ge, { name: "tiny-sender-slide-up" }, {
1339
- default: G(() => [
1340
- T(y) && T(A).length ? (k(), M("div", {
1342
+ default: J(() => [
1343
+ x(y) && x(M).length ? (k(), I("div", {
1341
1344
  key: 0,
1342
1345
  ref_key: "suggestionsListRef",
1343
1346
  ref: L,
1344
- class: "tiny-sender__suggestions"
1347
+ class: "tiny-sender__suggestions",
1348
+ style: xe(qe.value)
1345
1349
  }, [
1346
- (k(!0), M(Re, null, ke(T(A), (D, ee) => (k(), M("div", {
1350
+ (k(!0), I(Re, null, ke(x(M), (D, ee) => (k(), I("div", {
1347
1351
  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"])
1352
+ class: oe(["suggestion-item", { highlighted: ee === x(w) }]),
1353
+ onMouseenter: (te) => x(n)(ee),
1354
+ onMousedown: Ye((te) => x(p)(D), ["prevent"])
1351
1355
  }, [
1352
- U(T(it), { class: "suggestion-item__icon" }),
1353
- X("span", $t, [
1354
- (k(!0), M(Re, null, ke(T(n)(D, T(a)), (te, Ee) => (k(), M("span", {
1355
- key: Ee,
1356
- class: le({ "suggestion-item__text--match": te.isMatch, "suggestion-item__text--normal": !te.isMatch })
1356
+ U(x(it), { class: "suggestion-item__icon" }),
1357
+ X("span", Pt, [
1358
+ (k(!0), I(Re, null, ke(x(r)(D, x(l)), (te, Se) => (k(), I("span", {
1359
+ key: Se,
1360
+ class: oe({ "suggestion-item__text--match": te.isMatch, "suggestion-item__text--normal": !te.isMatch })
1357
1361
  }, se(te.text), 3))), 128))
1358
1362
  ])
1359
- ], 42, Wt))), 128))
1360
- ], 512)) : $("", !0)
1363
+ ], 42, $t))), 128))
1364
+ ], 4)) : P("", !0)
1361
1365
  ]),
1362
1366
  _: 1
1363
1367
  }),
1364
- oe.value ? (k(), M("div", Pt, se(oe.value), 1)) : $("", !0)
1365
- ], 10, St));
1368
+ le.value ? (k(), I("div", Kt, se(le.value), 1)) : P("", !0)
1369
+ ], 10, Et));
1366
1370
  }
1367
1371
  });
1368
1372
  ce.name = "TrSender";
1369
- const Kt = function(e) {
1370
- e.component(ce.name, ce);
1373
+ const Ht = function(t) {
1374
+ t.component(ce.name, ce);
1371
1375
  };
1372
- ce.install = Kt;
1376
+ ce.install = Ht;
1373
1377
  export {
1374
1378
  ce as default
1375
1379
  };