sur-voice 1.0.0
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/.vscode/extensions.json +3 -0
- package/README.md +5 -0
- package/dist/sur-voice.es.js +641 -0
- package/dist/sur-voice.umd.js +32 -0
- package/dist/vite.svg +1 -0
- package/index.html +13 -0
- package/package.json +30 -0
- package/public/vite.svg +1 -0
- package/src/App.vue +30 -0
- package/src/assets/vue.svg +1 -0
- package/src/components/surVoice.vue +391 -0
- package/src/index.ts +18 -0
- package/src/main.ts +5 -0
- package/src/style.css +79 -0
- package/src/utils/ChatUtils.ts +63 -0
- package/src/utils/Recorder.js +628 -0
- package/tsconfig.app.json +16 -0
- package/tsconfig.json +7 -0
- package/tsconfig.node.json +26 -0
- package/vite.config.ts +43 -0
package/README.md
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
# Vue 3 + TypeScript + Vite
|
|
2
|
+
|
|
3
|
+
This template should help get you started developing with Vue 3 and TypeScript in Vite. The template uses Vue 3 `<script setup>` SFCs, check out the [script setup docs](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup) to learn more.
|
|
4
|
+
|
|
5
|
+
Learn more about the recommended Project Setup and IDE Support in the [Vue Docs TypeScript Guide](https://vuejs.org/guide/typescript/overview.html#project-setup).
|
|
@@ -0,0 +1,641 @@
|
|
|
1
|
+
import { createCommentVNode, createElementBlock, createElementVNode, defineComponent, openBlock, ref, renderSlot, toDisplayString, vModelText, watch, withDirectives } from "vue";
|
|
2
|
+
var __commonJSMin = (e, t) => () => (t || e((t = { exports: {} }).exports, t), t.exports), require___vite_browser_external = /* @__PURE__ */ __commonJSMin(((e, t) => {
|
|
3
|
+
t.exports = {};
|
|
4
|
+
})), import_sha256 = (/* @__PURE__ */ __commonJSMin(((e, t) => {
|
|
5
|
+
/**
|
|
6
|
+
* [js-sha256]{@link https://github.com/emn178/js-sha256}
|
|
7
|
+
*
|
|
8
|
+
* @version 0.11.1
|
|
9
|
+
* @author Chen, Yi-Cyuan [emn178@gmail.com]
|
|
10
|
+
* @copyright Chen, Yi-Cyuan 2014-2025
|
|
11
|
+
* @license MIT
|
|
12
|
+
*/
|
|
13
|
+
(function() {
|
|
14
|
+
var e = "input is invalid type", n = typeof window == "object", r = n ? window : {};
|
|
15
|
+
r.JS_SHA256_NO_WINDOW && (n = !1);
|
|
16
|
+
var i = !n && typeof self == "object", a = !r.JS_SHA256_NO_NODE_JS && typeof process == "object" && process.versions && process.versions.node && process.type != "renderer";
|
|
17
|
+
a ? r = global : i && (r = self);
|
|
18
|
+
var o = !r.JS_SHA256_NO_COMMON_JS && typeof t == "object" && t.exports, s = typeof define == "function" && define.amd, c = !r.JS_SHA256_NO_ARRAY_BUFFER && typeof ArrayBuffer < "u", l = "0123456789abcdef".split(""), u = [
|
|
19
|
+
-2147483648,
|
|
20
|
+
8388608,
|
|
21
|
+
32768,
|
|
22
|
+
128
|
|
23
|
+
], d = [
|
|
24
|
+
24,
|
|
25
|
+
16,
|
|
26
|
+
8,
|
|
27
|
+
0
|
|
28
|
+
], p = [
|
|
29
|
+
1116352408,
|
|
30
|
+
1899447441,
|
|
31
|
+
3049323471,
|
|
32
|
+
3921009573,
|
|
33
|
+
961987163,
|
|
34
|
+
1508970993,
|
|
35
|
+
2453635748,
|
|
36
|
+
2870763221,
|
|
37
|
+
3624381080,
|
|
38
|
+
310598401,
|
|
39
|
+
607225278,
|
|
40
|
+
1426881987,
|
|
41
|
+
1925078388,
|
|
42
|
+
2162078206,
|
|
43
|
+
2614888103,
|
|
44
|
+
3248222580,
|
|
45
|
+
3835390401,
|
|
46
|
+
4022224774,
|
|
47
|
+
264347078,
|
|
48
|
+
604807628,
|
|
49
|
+
770255983,
|
|
50
|
+
1249150122,
|
|
51
|
+
1555081692,
|
|
52
|
+
1996064986,
|
|
53
|
+
2554220882,
|
|
54
|
+
2821834349,
|
|
55
|
+
2952996808,
|
|
56
|
+
3210313671,
|
|
57
|
+
3336571891,
|
|
58
|
+
3584528711,
|
|
59
|
+
113926993,
|
|
60
|
+
338241895,
|
|
61
|
+
666307205,
|
|
62
|
+
773529912,
|
|
63
|
+
1294757372,
|
|
64
|
+
1396182291,
|
|
65
|
+
1695183700,
|
|
66
|
+
1986661051,
|
|
67
|
+
2177026350,
|
|
68
|
+
2456956037,
|
|
69
|
+
2730485921,
|
|
70
|
+
2820302411,
|
|
71
|
+
3259730800,
|
|
72
|
+
3345764771,
|
|
73
|
+
3516065817,
|
|
74
|
+
3600352804,
|
|
75
|
+
4094571909,
|
|
76
|
+
275423344,
|
|
77
|
+
430227734,
|
|
78
|
+
506948616,
|
|
79
|
+
659060556,
|
|
80
|
+
883997877,
|
|
81
|
+
958139571,
|
|
82
|
+
1322822218,
|
|
83
|
+
1537002063,
|
|
84
|
+
1747873779,
|
|
85
|
+
1955562222,
|
|
86
|
+
2024104815,
|
|
87
|
+
2227730452,
|
|
88
|
+
2361852424,
|
|
89
|
+
2428436474,
|
|
90
|
+
2756734187,
|
|
91
|
+
3204031479,
|
|
92
|
+
3329325298
|
|
93
|
+
], m = [
|
|
94
|
+
"hex",
|
|
95
|
+
"array",
|
|
96
|
+
"digest",
|
|
97
|
+
"arrayBuffer"
|
|
98
|
+
], h = [];
|
|
99
|
+
(r.JS_SHA256_NO_NODE_JS || !Array.isArray) && (Array.isArray = function(e) {
|
|
100
|
+
return Object.prototype.toString.call(e) === "[object Array]";
|
|
101
|
+
}), c && (r.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW || !ArrayBuffer.isView) && (ArrayBuffer.isView = function(e) {
|
|
102
|
+
return typeof e == "object" && e.buffer && e.buffer.constructor === ArrayBuffer;
|
|
103
|
+
});
|
|
104
|
+
var g = function(e, t) {
|
|
105
|
+
return function(n) {
|
|
106
|
+
return new x(t, !0).update(n)[e]();
|
|
107
|
+
};
|
|
108
|
+
}, _ = function(e) {
|
|
109
|
+
var t = g("hex", e);
|
|
110
|
+
a && (t = v(t, e)), t.create = function() {
|
|
111
|
+
return new x(e);
|
|
112
|
+
}, t.update = function(e) {
|
|
113
|
+
return t.create().update(e);
|
|
114
|
+
};
|
|
115
|
+
for (var n = 0; n < m.length; ++n) {
|
|
116
|
+
var r = m[n];
|
|
117
|
+
t[r] = g(r, e);
|
|
118
|
+
}
|
|
119
|
+
return t;
|
|
120
|
+
}, v = function(t, n) {
|
|
121
|
+
var i = require___vite_browser_external(), a = require___vite_browser_external().Buffer, o = n ? "sha224" : "sha256", s = a.from && !r.JS_SHA256_NO_BUFFER_FROM ? a.from : function(e) {
|
|
122
|
+
return new a(e);
|
|
123
|
+
};
|
|
124
|
+
return function(n) {
|
|
125
|
+
if (typeof n == "string") return i.createHash(o).update(n, "utf8").digest("hex");
|
|
126
|
+
if (n == null) throw Error(e);
|
|
127
|
+
return n.constructor === ArrayBuffer && (n = new Uint8Array(n)), Array.isArray(n) || ArrayBuffer.isView(n) || n.constructor === a ? i.createHash(o).update(s(n)).digest("hex") : t(n);
|
|
128
|
+
};
|
|
129
|
+
}, y = function(e, t) {
|
|
130
|
+
return function(n, r) {
|
|
131
|
+
return new S(n, t, !0).update(r)[e]();
|
|
132
|
+
};
|
|
133
|
+
}, b = function(e) {
|
|
134
|
+
var t = y("hex", e);
|
|
135
|
+
t.create = function(t) {
|
|
136
|
+
return new S(t, e);
|
|
137
|
+
}, t.update = function(e, n) {
|
|
138
|
+
return t.create(e).update(n);
|
|
139
|
+
};
|
|
140
|
+
for (var n = 0; n < m.length; ++n) {
|
|
141
|
+
var r = m[n];
|
|
142
|
+
t[r] = y(r, e);
|
|
143
|
+
}
|
|
144
|
+
return t;
|
|
145
|
+
};
|
|
146
|
+
function x(e, t) {
|
|
147
|
+
t ? (h[0] = h[16] = h[1] = h[2] = h[3] = h[4] = h[5] = h[6] = h[7] = h[8] = h[9] = h[10] = h[11] = h[12] = h[13] = h[14] = h[15] = 0, this.blocks = h) : this.blocks = [
|
|
148
|
+
0,
|
|
149
|
+
0,
|
|
150
|
+
0,
|
|
151
|
+
0,
|
|
152
|
+
0,
|
|
153
|
+
0,
|
|
154
|
+
0,
|
|
155
|
+
0,
|
|
156
|
+
0,
|
|
157
|
+
0,
|
|
158
|
+
0,
|
|
159
|
+
0,
|
|
160
|
+
0,
|
|
161
|
+
0,
|
|
162
|
+
0,
|
|
163
|
+
0,
|
|
164
|
+
0
|
|
165
|
+
], e ? (this.h0 = 3238371032, this.h1 = 914150663, this.h2 = 812702999, this.h3 = 4144912697, this.h4 = 4290775857, this.h5 = 1750603025, this.h6 = 1694076839, this.h7 = 3204075428) : (this.h0 = 1779033703, this.h1 = 3144134277, this.h2 = 1013904242, this.h3 = 2773480762, this.h4 = 1359893119, this.h5 = 2600822924, this.h6 = 528734635, this.h7 = 1541459225), this.block = this.start = this.bytes = this.hBytes = 0, this.finalized = this.hashed = !1, this.first = !0, this.is224 = e;
|
|
166
|
+
}
|
|
167
|
+
x.prototype.update = function(t) {
|
|
168
|
+
if (!this.finalized) {
|
|
169
|
+
var n, r = typeof t;
|
|
170
|
+
if (r !== "string") {
|
|
171
|
+
if (r === "object") {
|
|
172
|
+
if (t === null) throw Error(e);
|
|
173
|
+
if (c && t.constructor === ArrayBuffer) t = new Uint8Array(t);
|
|
174
|
+
else if (!Array.isArray(t) && (!c || !ArrayBuffer.isView(t))) throw Error(e);
|
|
175
|
+
} else throw Error(e);
|
|
176
|
+
n = !0;
|
|
177
|
+
}
|
|
178
|
+
for (var i, a = 0, o, s = t.length, l = this.blocks; a < s;) {
|
|
179
|
+
if (this.hashed && (this.hashed = !1, l[0] = this.block, this.block = l[16] = l[1] = l[2] = l[3] = l[4] = l[5] = l[6] = l[7] = l[8] = l[9] = l[10] = l[11] = l[12] = l[13] = l[14] = l[15] = 0), n) for (o = this.start; a < s && o < 64; ++a) l[o >>> 2] |= t[a] << d[o++ & 3];
|
|
180
|
+
else for (o = this.start; a < s && o < 64; ++a) i = t.charCodeAt(a), i < 128 ? l[o >>> 2] |= i << d[o++ & 3] : i < 2048 ? (l[o >>> 2] |= (192 | i >>> 6) << d[o++ & 3], l[o >>> 2] |= (128 | i & 63) << d[o++ & 3]) : i < 55296 || i >= 57344 ? (l[o >>> 2] |= (224 | i >>> 12) << d[o++ & 3], l[o >>> 2] |= (128 | i >>> 6 & 63) << d[o++ & 3], l[o >>> 2] |= (128 | i & 63) << d[o++ & 3]) : (i = 65536 + ((i & 1023) << 10 | t.charCodeAt(++a) & 1023), l[o >>> 2] |= (240 | i >>> 18) << d[o++ & 3], l[o >>> 2] |= (128 | i >>> 12 & 63) << d[o++ & 3], l[o >>> 2] |= (128 | i >>> 6 & 63) << d[o++ & 3], l[o >>> 2] |= (128 | i & 63) << d[o++ & 3]);
|
|
181
|
+
this.lastByteIndex = o, this.bytes += o - this.start, o >= 64 ? (this.block = l[16], this.start = o - 64, this.hash(), this.hashed = !0) : this.start = o;
|
|
182
|
+
}
|
|
183
|
+
return this.bytes > 4294967295 && (this.hBytes += this.bytes / 4294967296 << 0, this.bytes %= 4294967296), this;
|
|
184
|
+
}
|
|
185
|
+
}, x.prototype.finalize = function() {
|
|
186
|
+
if (!this.finalized) {
|
|
187
|
+
this.finalized = !0;
|
|
188
|
+
var e = this.blocks, t = this.lastByteIndex;
|
|
189
|
+
e[16] = this.block, e[t >>> 2] |= u[t & 3], this.block = e[16], t >= 56 && (this.hashed || this.hash(), e[0] = this.block, e[16] = e[1] = e[2] = e[3] = e[4] = e[5] = e[6] = e[7] = e[8] = e[9] = e[10] = e[11] = e[12] = e[13] = e[14] = e[15] = 0), e[14] = this.hBytes << 3 | this.bytes >>> 29, e[15] = this.bytes << 3, this.hash();
|
|
190
|
+
}
|
|
191
|
+
}, x.prototype.hash = function() {
|
|
192
|
+
var e = this.h0, t = this.h1, n = this.h2, r = this.h3, i = this.h4, a = this.h5, o = this.h6, s = this.h7, c = this.blocks, l, u, d, f, m, h, g, _, v, y, b;
|
|
193
|
+
for (l = 16; l < 64; ++l) m = c[l - 15], u = (m >>> 7 | m << 25) ^ (m >>> 18 | m << 14) ^ m >>> 3, m = c[l - 2], d = (m >>> 17 | m << 15) ^ (m >>> 19 | m << 13) ^ m >>> 10, c[l] = c[l - 16] + u + c[l - 7] + d << 0;
|
|
194
|
+
for (b = t & n, l = 0; l < 64; l += 4) this.first ? (this.is224 ? (_ = 300032, m = c[0] - 1413257819, s = m - 150054599 << 0, r = m + 24177077 << 0) : (_ = 704751109, m = c[0] - 210244248, s = m - 1521486534 << 0, r = m + 143694565 << 0), this.first = !1) : (u = (e >>> 2 | e << 30) ^ (e >>> 13 | e << 19) ^ (e >>> 22 | e << 10), d = (i >>> 6 | i << 26) ^ (i >>> 11 | i << 21) ^ (i >>> 25 | i << 7), _ = e & t, f = _ ^ e & n ^ b, g = i & a ^ ~i & o, m = s + d + g + p[l] + c[l], h = u + f, s = r + m << 0, r = m + h << 0), u = (r >>> 2 | r << 30) ^ (r >>> 13 | r << 19) ^ (r >>> 22 | r << 10), d = (s >>> 6 | s << 26) ^ (s >>> 11 | s << 21) ^ (s >>> 25 | s << 7), v = r & e, f = v ^ r & t ^ _, g = s & i ^ ~s & a, m = o + d + g + p[l + 1] + c[l + 1], h = u + f, o = n + m << 0, n = m + h << 0, u = (n >>> 2 | n << 30) ^ (n >>> 13 | n << 19) ^ (n >>> 22 | n << 10), d = (o >>> 6 | o << 26) ^ (o >>> 11 | o << 21) ^ (o >>> 25 | o << 7), y = n & r, f = y ^ n & e ^ v, g = o & s ^ ~o & i, m = a + d + g + p[l + 2] + c[l + 2], h = u + f, a = t + m << 0, t = m + h << 0, u = (t >>> 2 | t << 30) ^ (t >>> 13 | t << 19) ^ (t >>> 22 | t << 10), d = (a >>> 6 | a << 26) ^ (a >>> 11 | a << 21) ^ (a >>> 25 | a << 7), b = t & n, f = b ^ t & r ^ y, g = a & o ^ ~a & s, m = i + d + g + p[l + 3] + c[l + 3], h = u + f, i = e + m << 0, e = m + h << 0, this.chromeBugWorkAround = !0;
|
|
195
|
+
this.h0 = this.h0 + e << 0, this.h1 = this.h1 + t << 0, this.h2 = this.h2 + n << 0, this.h3 = this.h3 + r << 0, this.h4 = this.h4 + i << 0, this.h5 = this.h5 + a << 0, this.h6 = this.h6 + o << 0, this.h7 = this.h7 + s << 0;
|
|
196
|
+
}, x.prototype.hex = function() {
|
|
197
|
+
this.finalize();
|
|
198
|
+
var e = this.h0, t = this.h1, n = this.h2, r = this.h3, i = this.h4, a = this.h5, o = this.h6, s = this.h7, c = l[e >>> 28 & 15] + l[e >>> 24 & 15] + l[e >>> 20 & 15] + l[e >>> 16 & 15] + l[e >>> 12 & 15] + l[e >>> 8 & 15] + l[e >>> 4 & 15] + l[e & 15] + l[t >>> 28 & 15] + l[t >>> 24 & 15] + l[t >>> 20 & 15] + l[t >>> 16 & 15] + l[t >>> 12 & 15] + l[t >>> 8 & 15] + l[t >>> 4 & 15] + l[t & 15] + l[n >>> 28 & 15] + l[n >>> 24 & 15] + l[n >>> 20 & 15] + l[n >>> 16 & 15] + l[n >>> 12 & 15] + l[n >>> 8 & 15] + l[n >>> 4 & 15] + l[n & 15] + l[r >>> 28 & 15] + l[r >>> 24 & 15] + l[r >>> 20 & 15] + l[r >>> 16 & 15] + l[r >>> 12 & 15] + l[r >>> 8 & 15] + l[r >>> 4 & 15] + l[r & 15] + l[i >>> 28 & 15] + l[i >>> 24 & 15] + l[i >>> 20 & 15] + l[i >>> 16 & 15] + l[i >>> 12 & 15] + l[i >>> 8 & 15] + l[i >>> 4 & 15] + l[i & 15] + l[a >>> 28 & 15] + l[a >>> 24 & 15] + l[a >>> 20 & 15] + l[a >>> 16 & 15] + l[a >>> 12 & 15] + l[a >>> 8 & 15] + l[a >>> 4 & 15] + l[a & 15] + l[o >>> 28 & 15] + l[o >>> 24 & 15] + l[o >>> 20 & 15] + l[o >>> 16 & 15] + l[o >>> 12 & 15] + l[o >>> 8 & 15] + l[o >>> 4 & 15] + l[o & 15];
|
|
199
|
+
return this.is224 || (c += l[s >>> 28 & 15] + l[s >>> 24 & 15] + l[s >>> 20 & 15] + l[s >>> 16 & 15] + l[s >>> 12 & 15] + l[s >>> 8 & 15] + l[s >>> 4 & 15] + l[s & 15]), c;
|
|
200
|
+
}, x.prototype.toString = x.prototype.hex, x.prototype.digest = function() {
|
|
201
|
+
this.finalize();
|
|
202
|
+
var e = this.h0, t = this.h1, n = this.h2, r = this.h3, i = this.h4, a = this.h5, o = this.h6, s = this.h7, c = [
|
|
203
|
+
e >>> 24 & 255,
|
|
204
|
+
e >>> 16 & 255,
|
|
205
|
+
e >>> 8 & 255,
|
|
206
|
+
e & 255,
|
|
207
|
+
t >>> 24 & 255,
|
|
208
|
+
t >>> 16 & 255,
|
|
209
|
+
t >>> 8 & 255,
|
|
210
|
+
t & 255,
|
|
211
|
+
n >>> 24 & 255,
|
|
212
|
+
n >>> 16 & 255,
|
|
213
|
+
n >>> 8 & 255,
|
|
214
|
+
n & 255,
|
|
215
|
+
r >>> 24 & 255,
|
|
216
|
+
r >>> 16 & 255,
|
|
217
|
+
r >>> 8 & 255,
|
|
218
|
+
r & 255,
|
|
219
|
+
i >>> 24 & 255,
|
|
220
|
+
i >>> 16 & 255,
|
|
221
|
+
i >>> 8 & 255,
|
|
222
|
+
i & 255,
|
|
223
|
+
a >>> 24 & 255,
|
|
224
|
+
a >>> 16 & 255,
|
|
225
|
+
a >>> 8 & 255,
|
|
226
|
+
a & 255,
|
|
227
|
+
o >>> 24 & 255,
|
|
228
|
+
o >>> 16 & 255,
|
|
229
|
+
o >>> 8 & 255,
|
|
230
|
+
o & 255
|
|
231
|
+
];
|
|
232
|
+
return this.is224 || c.push(s >>> 24 & 255, s >>> 16 & 255, s >>> 8 & 255, s & 255), c;
|
|
233
|
+
}, x.prototype.array = x.prototype.digest, x.prototype.arrayBuffer = function() {
|
|
234
|
+
this.finalize();
|
|
235
|
+
var e = /* @__PURE__ */ new ArrayBuffer(this.is224 ? 28 : 32), t = new DataView(e);
|
|
236
|
+
return t.setUint32(0, this.h0), t.setUint32(4, this.h1), t.setUint32(8, this.h2), t.setUint32(12, this.h3), t.setUint32(16, this.h4), t.setUint32(20, this.h5), t.setUint32(24, this.h6), this.is224 || t.setUint32(28, this.h7), e;
|
|
237
|
+
};
|
|
238
|
+
function S(t, n, r) {
|
|
239
|
+
var i, a = typeof t;
|
|
240
|
+
if (a === "string") {
|
|
241
|
+
var o = [], s = t.length, l = 0, u;
|
|
242
|
+
for (i = 0; i < s; ++i) u = t.charCodeAt(i), u < 128 ? o[l++] = u : u < 2048 ? (o[l++] = 192 | u >>> 6, o[l++] = 128 | u & 63) : u < 55296 || u >= 57344 ? (o[l++] = 224 | u >>> 12, o[l++] = 128 | u >>> 6 & 63, o[l++] = 128 | u & 63) : (u = 65536 + ((u & 1023) << 10 | t.charCodeAt(++i) & 1023), o[l++] = 240 | u >>> 18, o[l++] = 128 | u >>> 12 & 63, o[l++] = 128 | u >>> 6 & 63, o[l++] = 128 | u & 63);
|
|
243
|
+
t = o;
|
|
244
|
+
} else if (a === "object") {
|
|
245
|
+
if (t === null) throw Error(e);
|
|
246
|
+
if (c && t.constructor === ArrayBuffer) t = new Uint8Array(t);
|
|
247
|
+
else if (!Array.isArray(t) && (!c || !ArrayBuffer.isView(t))) throw Error(e);
|
|
248
|
+
} else throw Error(e);
|
|
249
|
+
t.length > 64 && (t = new x(n, !0).update(t).array());
|
|
250
|
+
var d = [], f = [];
|
|
251
|
+
for (i = 0; i < 64; ++i) {
|
|
252
|
+
var p = t[i] || 0;
|
|
253
|
+
d[i] = 92 ^ p, f[i] = 54 ^ p;
|
|
254
|
+
}
|
|
255
|
+
x.call(this, n, r), this.update(f), this.oKeyPad = d, this.inner = !0, this.sharedMemory = r;
|
|
256
|
+
}
|
|
257
|
+
S.prototype = new x(), S.prototype.finalize = function() {
|
|
258
|
+
if (x.prototype.finalize.call(this), this.inner) {
|
|
259
|
+
this.inner = !1;
|
|
260
|
+
var e = this.array();
|
|
261
|
+
x.call(this, this.is224, this.sharedMemory), this.update(this.oKeyPad), this.update(e), x.prototype.finalize.call(this);
|
|
262
|
+
}
|
|
263
|
+
};
|
|
264
|
+
var C = _();
|
|
265
|
+
C.sha256 = C, C.sha224 = _(!0), C.sha256.hmac = b(), C.sha224.hmac = b(!0), o ? t.exports = C : (r.sha256 = C.sha256, r.sha224 = C.sha224, s && define(function() {
|
|
266
|
+
return C;
|
|
267
|
+
}));
|
|
268
|
+
})();
|
|
269
|
+
})))(), Recorder = class e {
|
|
270
|
+
constructor(e, t) {
|
|
271
|
+
this.config = {
|
|
272
|
+
sampleBits: 16,
|
|
273
|
+
sampleRate: 16e3
|
|
274
|
+
}, this.size = 0, this.buffer = [], this.realtimeBuffer = [], this.audioContext = null, this.mediaStream = null, this.mediaStreamSource = null, this.audioWorkletNode = null, this.scriptProcessor = null, this.isRecording = !1, this.input = function(e) {
|
|
275
|
+
this.buffer.push(new Float32Array(e)), this.size += e.length;
|
|
276
|
+
}, this.onaudioprocess = e, this.showWaveFn = t, this.supportsAudioWorklet = typeof AudioWorkletNode < "u" && typeof OfflineAudioContext < "u";
|
|
277
|
+
}
|
|
278
|
+
setOption(e) {
|
|
279
|
+
Object.assign(this.config, e);
|
|
280
|
+
}
|
|
281
|
+
async ready() {
|
|
282
|
+
try {
|
|
283
|
+
return this.audioContext = new (window.AudioContext || window.webkitAudioContext)(), navigator.mediaDevices ? (this.mediaStream = await navigator.mediaDevices.getUserMedia({ audio: {
|
|
284
|
+
echoCancellation: !1,
|
|
285
|
+
noiseSuppression: !1,
|
|
286
|
+
autoGainControl: !1,
|
|
287
|
+
sampleRate: this.config.sampleRate,
|
|
288
|
+
channelCount: 1
|
|
289
|
+
} }), this.mediaStreamSource = this.audioContext.createMediaStreamSource(this.mediaStream), this.inputSampleRate = this.audioContext.sampleRate, this.inputSampleBits = 16, this.outputSampleRate = this.config.sampleRate, this.oututSampleBits = this.config.sampleBits, Promise.resolve()) : Promise.reject(/* @__PURE__ */ Error("无法发现指定的硬件设备。"));
|
|
290
|
+
} catch (e) {
|
|
291
|
+
return this.handleError(e), Promise.reject(e);
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
async start() {
|
|
295
|
+
try {
|
|
296
|
+
(!this.audioContext || this.audioContext.state === "closed") && await this.ready(), this.audioContext.state === "suspended" && await this.audioContext.resume(), this.buffer.length = 0, this.size = 0, this.isRecording = !0, this.supportsAudioWorklet ? await this.setupAudioWorklet() : this.setupScriptProcessor();
|
|
297
|
+
} catch (t) {
|
|
298
|
+
e.throwError("无法开始录音。异常信息:" + (t.code || t.name));
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
async setupAudioWorklet() {
|
|
302
|
+
try {
|
|
303
|
+
let e = new Blob(["\n class RecorderProcessor extends AudioWorkletProcessor {\n constructor(options) {\n super();\n this.sampleRate = options.processorOptions?.sampleRate || 16000;\n this.isRecording = true;\n \n this.port.onmessage = (event) => {\n if (event.data.type === 'stop') {\n this.isRecording = false;\n }\n };\n }\n\n process(inputs) {\n if (!this.isRecording) return false;\n \n const input = inputs[0];\n if (input && input.length > 0) {\n const channelData = input[0];\n // 发送音频数据到主线程\n this.port.postMessage({\n type: 'audioData',\n audioData: channelData.slice()\n });\n }\n return true;\n }\n }\n\n registerProcessor('recorder-processor', RecorderProcessor);\n "], { type: "application/javascript" }), t = URL.createObjectURL(e);
|
|
304
|
+
try {
|
|
305
|
+
await this.audioContext.audioWorklet.addModule(t);
|
|
306
|
+
} finally {
|
|
307
|
+
URL.revokeObjectURL(t);
|
|
308
|
+
}
|
|
309
|
+
this.audioWorkletNode = new AudioWorkletNode(this.audioContext, "recorder-processor", {
|
|
310
|
+
numberOfInputs: 1,
|
|
311
|
+
numberOfOutputs: 1,
|
|
312
|
+
outputChannelCount: [1],
|
|
313
|
+
processorOptions: { sampleRate: this.config.sampleRate }
|
|
314
|
+
}), this.audioWorkletNode.port.onmessage = (e) => {
|
|
315
|
+
if (!this.isRecording) return;
|
|
316
|
+
let t = e.data;
|
|
317
|
+
t.type === "audioData" && this.handleAudioData(t.audioData);
|
|
318
|
+
}, this.mediaStreamSource.connect(this.audioWorkletNode), this.audioWorkletNode.connect(this.audioContext.destination);
|
|
319
|
+
} catch (e) {
|
|
320
|
+
console.warn("AudioWorklet 初始化失败,降级使用 ScriptProcessorNode:", e), this.setupScriptProcessor();
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
setupScriptProcessor() {
|
|
324
|
+
console.warn("使用 ScriptProcessorNode(已废弃,建议升级浏览器)");
|
|
325
|
+
try {
|
|
326
|
+
this.scriptProcessor = (this.audioContext.createScriptProcessor || this.audioContext.createJavaScriptNode).call(this.audioContext, 4096, 1, 1), this.scriptProcessor.onaudioprocess = (e) => {
|
|
327
|
+
if (!this.isRecording) return;
|
|
328
|
+
let t = e.inputBuffer.getChannelData(0);
|
|
329
|
+
this.handleAudioData(t);
|
|
330
|
+
}, this.mediaStreamSource.connect(this.scriptProcessor), this.scriptProcessor.connect(this.audioContext.destination);
|
|
331
|
+
} catch (t) {
|
|
332
|
+
e.throwError("无法创建音频处理器: " + t.message);
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
handleAudioData(e) {
|
|
336
|
+
this.isRecording && (this.input(e), this.onaudioprocess && this.onaudioprocess(this.encodePCMFragment(e)), this.showWaveFn && this.toWaveData(e));
|
|
337
|
+
}
|
|
338
|
+
stop() {
|
|
339
|
+
this.isRecording = !1, this.audioWorkletNode &&= (this.audioWorkletNode.port.postMessage({ type: "stop" }), this.audioWorkletNode.disconnect(), null), this.scriptProcessor &&= (this.scriptProcessor.disconnect(), null), this.mediaStreamSource && this.mediaStreamSource.disconnect(), this.mediaStream && this.mediaStream.getTracks().forEach((e) => {
|
|
340
|
+
e.stop();
|
|
341
|
+
});
|
|
342
|
+
}
|
|
343
|
+
close() {
|
|
344
|
+
this.stop(), this.audioContext && this.audioContext.state !== "closed" && this.audioContext.close(), this.audioContext = null, this.mediaStream = null, this.mediaStreamSource = null;
|
|
345
|
+
}
|
|
346
|
+
handleError(t) {
|
|
347
|
+
console.error("录音错误:", t);
|
|
348
|
+
let n = {
|
|
349
|
+
PERMISSION_DENIED: "用户拒绝提供信息。",
|
|
350
|
+
PermissionDeniedError: "用户拒绝提供信息。",
|
|
351
|
+
NOT_SUPPORTED_ERROR: "浏览器不支持硬件设备。",
|
|
352
|
+
NotSupportedError: "浏览器不支持硬件设备。",
|
|
353
|
+
MANDATORY_UNSATISFIED_ERROR: "无法发现指定的硬件设备。",
|
|
354
|
+
MandatoryUnsatisfiedError: "无法发现指定的硬件设备。",
|
|
355
|
+
NotAllowedError: "请在浏览器设置中开启麦克风权限!",
|
|
356
|
+
NotFoundError: "无法发现指定的硬件设备。",
|
|
357
|
+
8: "无法发现指定的硬件设备。"
|
|
358
|
+
}[t.code || t.name] || `无法打开麦克风。异常信息: ${t.code || t.name || t.message}`;
|
|
359
|
+
e.throwError(n);
|
|
360
|
+
}
|
|
361
|
+
play(e) {
|
|
362
|
+
if (!e) return;
|
|
363
|
+
let t = this.getWAVBlob();
|
|
364
|
+
t && (e.src = URL.createObjectURL(t));
|
|
365
|
+
}
|
|
366
|
+
getPCM() {
|
|
367
|
+
return this.stop(), this.encodePCM();
|
|
368
|
+
}
|
|
369
|
+
getPCMBlob() {
|
|
370
|
+
let e = this.getPCM();
|
|
371
|
+
return e ? new Blob([e]) : null;
|
|
372
|
+
}
|
|
373
|
+
getWAV(e = !0) {
|
|
374
|
+
return this.stop(), this.encodeWAV(e);
|
|
375
|
+
}
|
|
376
|
+
getWAVBlob() {
|
|
377
|
+
let e = this.getWAV(!0);
|
|
378
|
+
return e ? new Blob([e], { type: "audio/wav" }) : null;
|
|
379
|
+
}
|
|
380
|
+
SRC(e, t, n) {
|
|
381
|
+
if (e == null) throw Error("Error: 输入音频为空数组");
|
|
382
|
+
if (t <= 1 || n <= 1) throw Error("Error: 输入或输出音频采样率不合法");
|
|
383
|
+
let r = e.length, i = Math.round(r * n / t), a = new Float32Array(i), o = new Float32Array(r), s = new Float32Array(i);
|
|
384
|
+
for (let t = 0; t < r; t++) o[t] = e[t] / 32768;
|
|
385
|
+
let c = (r - 1) / (i - 1), l = 0, u = 0, d = 0;
|
|
386
|
+
a[0] = e[0];
|
|
387
|
+
for (let e = 1; e < i; e++) l = c * e, u = Math.ceil(l), d = Math.floor(l), u >= r && d < r ? u = d : u >= r && d >= r && (u = r - 1, d = r - 1), s[e] = o[d] + (l - d) * (o[u] - o[d]);
|
|
388
|
+
for (let e = 1; e < i; e++) a[e] = s[e] * 32768;
|
|
389
|
+
return a;
|
|
390
|
+
}
|
|
391
|
+
compress(e = !1) {
|
|
392
|
+
if (this.buffer.length === 0) return new Float32Array();
|
|
393
|
+
for (var t = new Float32Array(this.size), n = 0, r = 0; r < this.buffer.length; r++) t.set(this.buffer[r], n), n += this.buffer[r].length;
|
|
394
|
+
return this.SRC(t, this.inputSampleRate, this.outputSampleRate);
|
|
395
|
+
}
|
|
396
|
+
encodePCM(e = !1) {
|
|
397
|
+
let t = this.compress(e);
|
|
398
|
+
if (!t || t.length === 0) return null;
|
|
399
|
+
let n = Math.min(this.inputSampleBits, e ? this.inputSampleBits : this.oututSampleBits), r = 0, i = t.length * (n / 8), a = new ArrayBuffer(i), o = new DataView(a);
|
|
400
|
+
if (n === 8) for (var s = 0; s < t.length; s++, r++) {
|
|
401
|
+
var c = Math.max(-1, Math.min(1, t[s])), l = c < 0 ? c * 128 : c * 127;
|
|
402
|
+
l = parseInt(l + 128), o.setInt8(r, l, !0);
|
|
403
|
+
}
|
|
404
|
+
else for (var s = 0; s < t.length; s++, r += 2) {
|
|
405
|
+
var c = Math.max(-1, Math.min(1, t[s]));
|
|
406
|
+
o.setInt16(r, c < 0 ? c * 32768 : c * 32767, !0);
|
|
407
|
+
}
|
|
408
|
+
return o;
|
|
409
|
+
}
|
|
410
|
+
encodePCMFragment(e) {
|
|
411
|
+
if (!e || e.length === 0) return null;
|
|
412
|
+
let t = new Float32Array(e), n = this.SRC(t, this.inputSampleRate, this.outputSampleRate);
|
|
413
|
+
if (!n || n.length === 0) return null;
|
|
414
|
+
let r = Math.min(this.inputSampleBits, this.oututSampleBits), i = 0, a = n.length * (r / 8), o = new ArrayBuffer(a), s = new DataView(o);
|
|
415
|
+
if (r === 8) for (var c = 0; c < n.length; c++, i++) {
|
|
416
|
+
var l = Math.max(-1, Math.min(1, n[c])), u = l < 0 ? l * 128 : l * 127;
|
|
417
|
+
u = parseInt(u + 128), s.setInt8(i, u, !0);
|
|
418
|
+
}
|
|
419
|
+
else for (var c = 0; c < n.length; c++, i += 2) {
|
|
420
|
+
var l = Math.max(-1, Math.min(1, n[c]));
|
|
421
|
+
s.setInt16(i, l < 0 ? l * 32768 : l * 32767, !0);
|
|
422
|
+
}
|
|
423
|
+
return s;
|
|
424
|
+
}
|
|
425
|
+
encodeWAV(e = !1) {
|
|
426
|
+
let t = this.encodePCM(e);
|
|
427
|
+
if (!t) return null;
|
|
428
|
+
let n = this.outputSampleRate, r = Math.min(this.inputSampleBits, e ? this.inputSampleBits : this.oututSampleBits), i = /* @__PURE__ */ new ArrayBuffer(44), a = new DataView(i), o = 0;
|
|
429
|
+
return writeString(a, o, "RIFF"), o += 4, a.setUint32(o, 36 + t.byteLength, !0), o += 4, writeString(a, o, "WAVE"), o += 4, writeString(a, o, "fmt "), o += 4, a.setUint32(o, 16, !0), o += 4, a.setUint16(o, 1, !0), o += 2, a.setUint16(o, 1, !0), o += 2, a.setUint32(o, n, !0), o += 4, a.setUint32(o, 1 * n * (r / 8), !0), o += 4, a.setUint16(o, 1 * (r / 8), !0), o += 2, a.setUint16(o, r, !0), o += 2, writeString(a, o, "data"), o += 4, a.setUint32(o, t.byteLength, !0), o += 4, a = combineDataView(DataView, a, t), a;
|
|
430
|
+
}
|
|
431
|
+
toWaveData(e) {
|
|
432
|
+
if (!(!e || e.length === 0)) {
|
|
433
|
+
for (var t = function(e, t) {
|
|
434
|
+
var n = e / t || 0;
|
|
435
|
+
return n < 1251 ? Math.round(n / 1250 * 10) : Math.round(Math.min(100, Math.max(0, (1 + Math.log(n / 1e4) / Math.log(10)) * 100)));
|
|
436
|
+
}, n = e.length, r = new Int16Array(n), i = 0, a = 0; a < n; a++) {
|
|
437
|
+
var o = Math.max(-1, Math.min(1, e[a]));
|
|
438
|
+
o = o < 0 ? o * 32768 : o * 32767, r[a] = o, i += Math.abs(o);
|
|
439
|
+
}
|
|
440
|
+
var s = [];
|
|
441
|
+
s.push(r);
|
|
442
|
+
var c = (this.recSize || 0) + r.length;
|
|
443
|
+
this.recSize = c;
|
|
444
|
+
var l = this.inputSampleRate, u = t(i, r.length), d = Math.round(c / l * 1e3);
|
|
445
|
+
this.showWaveFn && this.showWaveFn(s, u, d, l);
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
getState() {
|
|
449
|
+
return {
|
|
450
|
+
isRecording: this.isRecording,
|
|
451
|
+
supportsAudioWorklet: this.supportsAudioWorklet,
|
|
452
|
+
bufferSize: this.size,
|
|
453
|
+
duration: this.size > 0 ? Math.round(this.size / this.inputSampleRate * 1e3) : 0
|
|
454
|
+
};
|
|
455
|
+
}
|
|
456
|
+
static throwError(e) {
|
|
457
|
+
throw Error(e);
|
|
458
|
+
}
|
|
459
|
+
static checkCompatibility() {
|
|
460
|
+
let e = !!(navigator.mediaDevices && navigator.mediaDevices.getUserMedia), t = !!(window.AudioContext || window.webkitAudioContext), n = !!(window.AudioWorkletNode && window.OfflineAudioContext);
|
|
461
|
+
return {
|
|
462
|
+
hasGetUserMedia: e,
|
|
463
|
+
hasAudioContext: t,
|
|
464
|
+
hasAudioWorklet: n,
|
|
465
|
+
isCompatible: e && t,
|
|
466
|
+
recommendedBrowser: n ? "modern" : "legacy"
|
|
467
|
+
};
|
|
468
|
+
}
|
|
469
|
+
};
|
|
470
|
+
function writeString(e, t, n) {
|
|
471
|
+
for (var r = 0; r < n.length; r++) e.setUint8(t + r, n.charCodeAt(r));
|
|
472
|
+
}
|
|
473
|
+
function combineDataView(e, ...t) {
|
|
474
|
+
let n = 0, r = 0;
|
|
475
|
+
for (let e of t) n += e.length || e.byteLength;
|
|
476
|
+
let i = new e(new ArrayBuffer(n));
|
|
477
|
+
for (let e of t) for (let t = 0, n = e.byteLength; t < n; ++t) i.setInt8(r, e.getInt8(t)), r += 1;
|
|
478
|
+
return i;
|
|
479
|
+
}
|
|
480
|
+
var Recorder_default = Recorder, _hoisted_1 = {
|
|
481
|
+
key: 0,
|
|
482
|
+
class: "surVoice"
|
|
483
|
+
}, VOICE_FLUSH_INTERVAL_MS = 40, VOICE_MAX_QUEUE_BYTES = 1024 * 1024, VOICE_MAX_BUFFERED_AMOUNT = 512 * 1024, surVoice_default = /* @__PURE__ */ defineComponent({
|
|
484
|
+
__name: "surVoice",
|
|
485
|
+
emits: ["update:inputText"],
|
|
486
|
+
setup(r, { emit: d }) {
|
|
487
|
+
let f = d, m = ref(""), h = ref(!1), g = ref(null);
|
|
488
|
+
watch(m, (e) => {
|
|
489
|
+
f("update:inputText", e);
|
|
490
|
+
}, { immediate: !0 });
|
|
491
|
+
let S = ref(0), C, w, T = ref(!1), E = ref(""), D = ref([]), O = null, k = 0, A = [], j = 0, M = null, N = [], P = () => {
|
|
492
|
+
g.value = "start", !T.value && (F(), T.value = !0, C = setInterval(() => {
|
|
493
|
+
S.value += 1, S.value > 60 && U();
|
|
494
|
+
}, 1e3), I());
|
|
495
|
+
};
|
|
496
|
+
function F() {
|
|
497
|
+
k = 0, N = [], D.value = [], E.value = "", A.length = 0, j = 0;
|
|
498
|
+
}
|
|
499
|
+
function I() {
|
|
500
|
+
z(), w = new Recorder_default(L), w.ready().then(() => {
|
|
501
|
+
w.start();
|
|
502
|
+
}, () => {
|
|
503
|
+
O?.close();
|
|
504
|
+
});
|
|
505
|
+
}
|
|
506
|
+
function L(e) {
|
|
507
|
+
T.value && O && O.readyState === WebSocket.OPEN && (k++, R(e));
|
|
508
|
+
}
|
|
509
|
+
function R(e) {
|
|
510
|
+
if (!e) return;
|
|
511
|
+
let t = e instanceof DataView || ArrayBuffer.isView(e) ? e : e instanceof ArrayBuffer ? new Uint8Array(e) : null;
|
|
512
|
+
if (t && (A.push(t), j += t.byteLength, j > VOICE_MAX_QUEUE_BYTES)) {
|
|
513
|
+
let e = Math.floor(A.length / 2), t = 0;
|
|
514
|
+
for (let n = 0; n < e; n++) t += A[n]?.byteLength || 0;
|
|
515
|
+
A.splice(0, e), j -= t;
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
let z = () => {
|
|
519
|
+
let e = +/* @__PURE__ */ new Date(), t = "3k5jkbo5jsngmjmij7fy77xyrcoud5xkinbaqnik", n = (0, import_sha256.sha256)(`${t}${e}01a1fe93e03bbfb775ad1a6482a130c2`).toUpperCase();
|
|
520
|
+
try {
|
|
521
|
+
O?.close();
|
|
522
|
+
} catch {}
|
|
523
|
+
O = new WebSocket(`wss://ws-osasr.hivoice.cn/v1/asr?appkey=${t}&time=${e}&sign=${n}`), O.onopen = () => {
|
|
524
|
+
O && (B(), O.send(JSON.stringify({
|
|
525
|
+
type: "start",
|
|
526
|
+
sha: "256",
|
|
527
|
+
data: {
|
|
528
|
+
lang: "cn",
|
|
529
|
+
appkey: t,
|
|
530
|
+
userId: "demoUser",
|
|
531
|
+
udid: "demoWebDevice"
|
|
532
|
+
}
|
|
533
|
+
})), V(!0));
|
|
534
|
+
}, O.onmessage = (e) => {
|
|
535
|
+
let t;
|
|
536
|
+
try {
|
|
537
|
+
t = typeof e.data == "string" ? JSON.parse(e.data) : e.data;
|
|
538
|
+
} catch {
|
|
539
|
+
return;
|
|
540
|
+
}
|
|
541
|
+
if (typeof t?.code == "number" && t.code !== 0) {
|
|
542
|
+
console.warn("ASR 错误:", t);
|
|
543
|
+
return;
|
|
544
|
+
}
|
|
545
|
+
let n = t?.showText ?? t?.text ?? "";
|
|
546
|
+
if (n && (E.value = n, N.length > 0 && N[N.length - 1]?.type !== "fixed" ? N[N.length - 1] = t : N.push(t), D.value = [...N], m.value = D.value.map((e) => e?.showText ?? e?.text ?? "").join("")), t?.end === !0) {
|
|
547
|
+
g.value = "finish";
|
|
548
|
+
let e = D.value.map((e) => e?.text ?? e?.showText ?? "").join("");
|
|
549
|
+
setTimeout(() => {
|
|
550
|
+
m.value = e, E.value = e, G();
|
|
551
|
+
}, 500);
|
|
552
|
+
try {
|
|
553
|
+
O?.close();
|
|
554
|
+
} catch {}
|
|
555
|
+
}
|
|
556
|
+
}, O.onerror = (e) => {}, O.onclose = () => {
|
|
557
|
+
G(), A.length = 0, j = 0, O = null;
|
|
558
|
+
};
|
|
559
|
+
};
|
|
560
|
+
function B() {
|
|
561
|
+
M ||= window.setInterval(() => {
|
|
562
|
+
V(!1);
|
|
563
|
+
}, VOICE_FLUSH_INTERVAL_MS);
|
|
564
|
+
}
|
|
565
|
+
function V(e) {
|
|
566
|
+
if (!(!O || O.readyState !== WebSocket.OPEN) && !(j <= 0) && !(!e && O.bufferedAmount > VOICE_MAX_BUFFERED_AMOUNT)) try {
|
|
567
|
+
let e = new Blob(A);
|
|
568
|
+
O.send(e), A.length = 0, j = 0;
|
|
569
|
+
} catch (e) {
|
|
570
|
+
console.error("flushVoiceQueue 发送失败:", e);
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
let H = () => {
|
|
574
|
+
T.value && U();
|
|
575
|
+
};
|
|
576
|
+
function U() {
|
|
577
|
+
clearInterval(C), T.value = !1, S.value = 0;
|
|
578
|
+
try {
|
|
579
|
+
w?.stop();
|
|
580
|
+
} catch {}
|
|
581
|
+
g.value = "loading";
|
|
582
|
+
try {
|
|
583
|
+
W();
|
|
584
|
+
} catch (e) {
|
|
585
|
+
console.error("发送 ASR end 失败:", e);
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
function W() {
|
|
589
|
+
!O || O.readyState !== WebSocket.OPEN || (V(!0), O.send(JSON.stringify({ type: "end" })));
|
|
590
|
+
}
|
|
591
|
+
function G() {
|
|
592
|
+
M &&= (clearInterval(M), null);
|
|
593
|
+
}
|
|
594
|
+
return (r, a) => h.value ? createCommentVNode("", !0) : (openBlock(), createElementBlock("div", _hoisted_1, [
|
|
595
|
+
withDirectives(createElementVNode("input", {
|
|
596
|
+
style: {
|
|
597
|
+
width: "800px",
|
|
598
|
+
height: "40px",
|
|
599
|
+
padding: "0 10px"
|
|
600
|
+
},
|
|
601
|
+
"onUpdate:modelValue": a[0] ||= (e) => m.value = e,
|
|
602
|
+
placeholder: "请输入内容…"
|
|
603
|
+
}, null, 512), [[vModelText, m.value]]),
|
|
604
|
+
T.value ? createCommentVNode("", !0) : renderSlot(r.$slots, "start-record", {
|
|
605
|
+
key: 0,
|
|
606
|
+
start: P,
|
|
607
|
+
recording: T.value,
|
|
608
|
+
textLoading: g.value,
|
|
609
|
+
inputText: m.value
|
|
610
|
+
}, () => [createElementVNode("img", {
|
|
611
|
+
style: {
|
|
612
|
+
width: "40px",
|
|
613
|
+
height: "40px"
|
|
614
|
+
},
|
|
615
|
+
src: "https://qiniu2.xuandou.vip/voice2.png",
|
|
616
|
+
class: "voice",
|
|
617
|
+
onClick: a[1] ||= (e) => P()
|
|
618
|
+
})]),
|
|
619
|
+
T.value ? renderSlot(r.$slots, "stop-record", {
|
|
620
|
+
key: 1,
|
|
621
|
+
stop: H,
|
|
622
|
+
recording: T.value,
|
|
623
|
+
textLoading: g.value,
|
|
624
|
+
inputText: m.value
|
|
625
|
+
}, () => [createElementVNode("img", {
|
|
626
|
+
style: {
|
|
627
|
+
width: "40px",
|
|
628
|
+
height: "40px"
|
|
629
|
+
},
|
|
630
|
+
src: "https://qiniu2.xuandou.vip/searchforSound.png",
|
|
631
|
+
class: "voice",
|
|
632
|
+
onClick: a[2] ||= (e) => H()
|
|
633
|
+
})]) : createCommentVNode("", !0),
|
|
634
|
+
createElementVNode("div", null, toDisplayString(g.value ? "" : "点击开始录音"), 1),
|
|
635
|
+
createElementVNode("div", null, toDisplayString(g.value == "start" ? "正在录音" : ""), 1),
|
|
636
|
+
createElementVNode("div", null, toDisplayString(g.value == "loading" ? "文字转化中..." : ""), 1),
|
|
637
|
+
createElementVNode("div", null, toDisplayString(g.value == "finish" ? "文字转换完成" : ""), 1)
|
|
638
|
+
]));
|
|
639
|
+
}
|
|
640
|
+
});
|
|
641
|
+
export { surVoice_default as surVoice };
|