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