@goodganglabs/lipsync-wasm-v2 0.3.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.
Potentially problematic release.
This version of @goodganglabs/lipsync-wasm-v2 might be problematic. Click here for more details.
- package/README.md +565 -0
- package/lipsync-wasm-wrapper.d.ts +54 -0
- package/lipsync-wasm-wrapper.js +370 -0
- package/lipsync_wasm_v2.d.ts +242 -0
- package/lipsync_wasm_v2.js +918 -0
- package/lipsync_wasm_v2_bg.wasm +0 -0
- package/package.json +27 -0
|
@@ -0,0 +1,918 @@
|
|
|
1
|
+
/* @ts-self-types="./lipsync_wasm_v2.d.ts" */
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Student 모델용 LipSync WASM V2 클래스
|
|
5
|
+
*
|
|
6
|
+
* ONNX 모델이 직접 52-dim ARKit 블렌드쉐입 출력 (중간 변환 없음)
|
|
7
|
+
* 특징 추출: 141차원 @30fps
|
|
8
|
+
* 출력: 52차원 @30fps
|
|
9
|
+
*/
|
|
10
|
+
export class LipSyncWasmV2 {
|
|
11
|
+
__destroy_into_raw() {
|
|
12
|
+
const ptr = this.__wbg_ptr;
|
|
13
|
+
this.__wbg_ptr = 0;
|
|
14
|
+
LipSyncWasmV2Finalization.unregister(this);
|
|
15
|
+
return ptr;
|
|
16
|
+
}
|
|
17
|
+
free() {
|
|
18
|
+
const ptr = this.__destroy_into_raw();
|
|
19
|
+
wasm.__wbg_lipsyncwasmv2_free(ptr, 0);
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* 배치 모드: ONNX 결과 조립 + 후처리
|
|
23
|
+
*
|
|
24
|
+
* JS에서 모든 청크의 ONNX 출력을 연결하여 전달.
|
|
25
|
+
* chunks_info에서 actual_frames를 읽어 패딩 제거 후 후처리 수행.
|
|
26
|
+
* @param {Float32Array} onnx_results
|
|
27
|
+
* @param {any} chunks_info
|
|
28
|
+
* @returns {any}
|
|
29
|
+
*/
|
|
30
|
+
assemble_and_postprocess(onnx_results, chunks_info) {
|
|
31
|
+
const ptr0 = passArrayF32ToWasm0(onnx_results, wasm.__wbindgen_malloc);
|
|
32
|
+
const len0 = WASM_VECTOR_LEN;
|
|
33
|
+
const ret = wasm.lipsyncwasmv2_assemble_and_postprocess(this.__wbg_ptr, ptr0, len0, chunks_info);
|
|
34
|
+
if (ret[2]) {
|
|
35
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
36
|
+
}
|
|
37
|
+
return takeFromExternrefTable0(ret[0]);
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* 프리셋 제거
|
|
41
|
+
*/
|
|
42
|
+
clear_preset() {
|
|
43
|
+
wasm.lipsyncwasmv2_clear_preset(this.__wbg_ptr);
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* 스트리밍 모드 종료
|
|
47
|
+
*/
|
|
48
|
+
end_streaming() {
|
|
49
|
+
wasm.lipsyncwasmv2_end_streaming(this.__wbg_ptr);
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* 141차원 특징 추출 (JS에서 ONNX 추론에 사용)
|
|
53
|
+
*
|
|
54
|
+
* # Arguments
|
|
55
|
+
* * `audio` - 16kHz PCM Float32 오디오 데이터
|
|
56
|
+
*
|
|
57
|
+
* # Returns
|
|
58
|
+
* * `Vec<f32>` - flatten된 특징 데이터 (N * 141)
|
|
59
|
+
* @param {Float32Array} audio
|
|
60
|
+
* @returns {Float32Array}
|
|
61
|
+
*/
|
|
62
|
+
extract_features(audio) {
|
|
63
|
+
const ptr0 = passArrayF32ToWasm0(audio, wasm.__wbindgen_malloc);
|
|
64
|
+
const len0 = WASM_VECTOR_LEN;
|
|
65
|
+
const ret = wasm.lipsyncwasmv2_extract_features(this.__wbg_ptr, ptr0, len0);
|
|
66
|
+
var v2 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
|
|
67
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
68
|
+
return v2;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* 스트리밍: 오디오 청크에서 141차원 특징 추출
|
|
72
|
+
*
|
|
73
|
+
* 반환: flatten features (N * 141)
|
|
74
|
+
* @param {Float32Array} audio
|
|
75
|
+
* @returns {Float32Array}
|
|
76
|
+
*/
|
|
77
|
+
extract_features_chunk(audio) {
|
|
78
|
+
const ptr0 = passArrayF32ToWasm0(audio, wasm.__wbindgen_malloc);
|
|
79
|
+
const len0 = WASM_VECTOR_LEN;
|
|
80
|
+
const ret = wasm.lipsyncwasmv2_extract_features_chunk(this.__wbg_ptr, ptr0, len0);
|
|
81
|
+
var v2 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
|
|
82
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
83
|
+
return v2;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* 스트리밍: 오디오 청크를 입력받아 ONNX 입력 준비
|
|
87
|
+
*
|
|
88
|
+
* 내부 버퍼에 특징을 축적하고, 최소 임계값(10프레임) 도달 시
|
|
89
|
+
* 150프레임 청크(에지 패딩)를 반환.
|
|
90
|
+
* @param {Float32Array} audio
|
|
91
|
+
* @returns {any}
|
|
92
|
+
*/
|
|
93
|
+
feed_audio_chunk(audio) {
|
|
94
|
+
const ptr0 = passArrayF32ToWasm0(audio, wasm.__wbindgen_malloc);
|
|
95
|
+
const len0 = WASM_VECTOR_LEN;
|
|
96
|
+
const ret = wasm.lipsyncwasmv2_feed_audio_chunk(this.__wbg_ptr, ptr0, len0);
|
|
97
|
+
if (ret[2]) {
|
|
98
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
99
|
+
}
|
|
100
|
+
return takeFromExternrefTable0(ret[0]);
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* 스트리밍: ONNX 결과를 후처리하여 블렌드쉐입 반환
|
|
104
|
+
* @param {Float32Array} onnx_output
|
|
105
|
+
* @param {number} actual_frames
|
|
106
|
+
* @param {boolean} is_last
|
|
107
|
+
* @returns {any}
|
|
108
|
+
*/
|
|
109
|
+
feed_onnx_result(onnx_output, actual_frames, is_last) {
|
|
110
|
+
const ptr0 = passArrayF32ToWasm0(onnx_output, wasm.__wbindgen_malloc);
|
|
111
|
+
const len0 = WASM_VECTOR_LEN;
|
|
112
|
+
const ret = wasm.lipsyncwasmv2_feed_onnx_result(this.__wbg_ptr, ptr0, len0, actual_frames, is_last);
|
|
113
|
+
if (ret[2]) {
|
|
114
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
115
|
+
}
|
|
116
|
+
return takeFromExternrefTable0(ret[0]);
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* 스트리밍: 잔여 버퍼 플러시 (마지막 청크에서 호출)
|
|
120
|
+
* @returns {any}
|
|
121
|
+
*/
|
|
122
|
+
flush_audio_buffer() {
|
|
123
|
+
const ret = wasm.lipsyncwasmv2_flush_audio_buffer(this.__wbg_ptr);
|
|
124
|
+
if (ret[2]) {
|
|
125
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
126
|
+
}
|
|
127
|
+
return takeFromExternrefTable0(ret[0]);
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* 특징 프레임 수 계산 유틸리티 (librosa center=True 호환)
|
|
131
|
+
* @param {number} audio_length
|
|
132
|
+
* @returns {number}
|
|
133
|
+
*/
|
|
134
|
+
get_feature_frame_count(audio_length) {
|
|
135
|
+
const ret = wasm.lipsyncwasmv2_get_feature_frame_count(this.__wbg_ptr, audio_length);
|
|
136
|
+
return ret >>> 0;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* 특정 프레임의 블렌드쉐입 추출
|
|
140
|
+
* @param {any} result
|
|
141
|
+
* @param {number} frame_index
|
|
142
|
+
* @returns {Float32Array}
|
|
143
|
+
*/
|
|
144
|
+
get_frame(result, frame_index) {
|
|
145
|
+
const ret = wasm.lipsyncwasmv2_get_frame(this.__wbg_ptr, result, frame_index);
|
|
146
|
+
if (ret[3]) {
|
|
147
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
148
|
+
}
|
|
149
|
+
var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
|
|
150
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
151
|
+
return v1;
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* 마지막 프레임 인덱스 반환 (Python last_frame_idx 호환)
|
|
155
|
+
* @returns {number}
|
|
156
|
+
*/
|
|
157
|
+
get_last_frame_idx() {
|
|
158
|
+
const ret = wasm.lipsyncwasmv2_get_last_frame_idx(this.__wbg_ptr);
|
|
159
|
+
return ret >>> 0;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* 블렌드쉐입 차원 수 반환
|
|
163
|
+
* @returns {number}
|
|
164
|
+
*/
|
|
165
|
+
get_num_blendshapes() {
|
|
166
|
+
const ret = wasm.lipsyncwasmv2_get_num_blendshapes(this.__wbg_ptr);
|
|
167
|
+
return ret >>> 0;
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* 프리셋 로드 여부
|
|
171
|
+
* @returns {boolean}
|
|
172
|
+
*/
|
|
173
|
+
has_preset() {
|
|
174
|
+
const ret = wasm.lipsyncwasmv2_has_preset(this.__wbg_ptr);
|
|
175
|
+
return ret !== 0;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* 스트리밍 모드 여부 조회
|
|
179
|
+
* @returns {boolean}
|
|
180
|
+
*/
|
|
181
|
+
is_streaming() {
|
|
182
|
+
const ret = wasm.lipsyncwasmv2_is_streaming(this.__wbg_ptr);
|
|
183
|
+
return ret !== 0;
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* 내장 기본 프리셋 로드 (jc01)
|
|
187
|
+
*/
|
|
188
|
+
load_default_preset() {
|
|
189
|
+
const ret = wasm.lipsyncwasmv2_load_default_preset(this.__wbg_ptr);
|
|
190
|
+
if (ret[1]) {
|
|
191
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* 프리셋 애니메이션 로드
|
|
196
|
+
* @param {Float32Array} data
|
|
197
|
+
* @param {number} num_frames
|
|
198
|
+
* @param {number} num_dims
|
|
199
|
+
*/
|
|
200
|
+
load_preset(data, num_frames, num_dims) {
|
|
201
|
+
const ptr0 = passArrayF32ToWasm0(data, wasm.__wbindgen_malloc);
|
|
202
|
+
const len0 = WASM_VECTOR_LEN;
|
|
203
|
+
wasm.lipsyncwasmv2_load_preset(this.__wbg_ptr, ptr0, len0, num_frames, num_dims);
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* 새 LipSyncWasmV2 인스턴스 생성
|
|
207
|
+
*/
|
|
208
|
+
constructor() {
|
|
209
|
+
const ret = wasm.lipsyncwasmv2_new();
|
|
210
|
+
if (ret[2]) {
|
|
211
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
212
|
+
}
|
|
213
|
+
this.__wbg_ptr = ret[0] >>> 0;
|
|
214
|
+
LipSyncWasmV2Finalization.register(this, this.__wbg_ptr, this);
|
|
215
|
+
return this;
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* 배치 모드: ONNX 입력 준비 (특징 추출 + 150프레임 청킹 + 에지 패딩)
|
|
219
|
+
*
|
|
220
|
+
* JS에서 각 청크를 ONNX 추론한 뒤 assemble_and_postprocess()로 전달
|
|
221
|
+
* @param {Float32Array} audio
|
|
222
|
+
* @returns {any}
|
|
223
|
+
*/
|
|
224
|
+
prepare_onnx_input(audio) {
|
|
225
|
+
const ptr0 = passArrayF32ToWasm0(audio, wasm.__wbindgen_malloc);
|
|
226
|
+
const len0 = WASM_VECTOR_LEN;
|
|
227
|
+
const ret = wasm.lipsyncwasmv2_prepare_onnx_input(this.__wbg_ptr, ptr0, len0);
|
|
228
|
+
if (ret[2]) {
|
|
229
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
230
|
+
}
|
|
231
|
+
return takeFromExternrefTable0(ret[0]);
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* 52-dim 블렌드쉐입 후처리 (ONNX 추론 결과)
|
|
235
|
+
*
|
|
236
|
+
* # Arguments
|
|
237
|
+
* * `raw_blendshapes` - flatten된 ONNX 출력 (N * 52)
|
|
238
|
+
* * `num_frames` - 프레임 수
|
|
239
|
+
*
|
|
240
|
+
* # Returns
|
|
241
|
+
* * `JsValue` - ProcessResult (blendshapes, frame_count, fps)
|
|
242
|
+
* @param {Float32Array} raw_blendshapes
|
|
243
|
+
* @param {number} num_frames
|
|
244
|
+
* @returns {any}
|
|
245
|
+
*/
|
|
246
|
+
process_blendshapes(raw_blendshapes, num_frames) {
|
|
247
|
+
const ptr0 = passArrayF32ToWasm0(raw_blendshapes, wasm.__wbindgen_malloc);
|
|
248
|
+
const len0 = WASM_VECTOR_LEN;
|
|
249
|
+
const ret = wasm.lipsyncwasmv2_process_blendshapes(this.__wbg_ptr, ptr0, len0, num_frames);
|
|
250
|
+
if (ret[2]) {
|
|
251
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
252
|
+
}
|
|
253
|
+
return takeFromExternrefTable0(ret[0]);
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* 스트리밍: 블렌드쉐입 후처리 (ONNX 추론 결과)
|
|
257
|
+
*
|
|
258
|
+
* # Arguments
|
|
259
|
+
* * `raw_blendshapes` - flatten ONNX output (N * 52)
|
|
260
|
+
* * `num_frames` - 프레임 수
|
|
261
|
+
* * `is_last` - 마지막 청크 여부 (fade_out 적용)
|
|
262
|
+
* @param {Float32Array} raw_blendshapes
|
|
263
|
+
* @param {number} num_frames
|
|
264
|
+
* @param {boolean} is_last
|
|
265
|
+
* @returns {any}
|
|
266
|
+
*/
|
|
267
|
+
process_blendshapes_chunk(raw_blendshapes, num_frames, is_last) {
|
|
268
|
+
const ptr0 = passArrayF32ToWasm0(raw_blendshapes, wasm.__wbindgen_malloc);
|
|
269
|
+
const len0 = WASM_VECTOR_LEN;
|
|
270
|
+
const ret = wasm.lipsyncwasmv2_process_blendshapes_chunk(this.__wbg_ptr, ptr0, len0, num_frames, is_last);
|
|
271
|
+
if (ret[2]) {
|
|
272
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
273
|
+
}
|
|
274
|
+
return takeFromExternrefTable0(ret[0]);
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* 스트리밍: 블렌드쉐입 후처리 + 프리셋 블렌딩
|
|
278
|
+
* @param {Float32Array} raw_blendshapes
|
|
279
|
+
* @param {number} num_frames
|
|
280
|
+
* @param {boolean} is_last
|
|
281
|
+
* @returns {any}
|
|
282
|
+
*/
|
|
283
|
+
process_blendshapes_chunk_with_animation(raw_blendshapes, num_frames, is_last) {
|
|
284
|
+
const ptr0 = passArrayF32ToWasm0(raw_blendshapes, wasm.__wbindgen_malloc);
|
|
285
|
+
const len0 = WASM_VECTOR_LEN;
|
|
286
|
+
const ret = wasm.lipsyncwasmv2_process_blendshapes_chunk_with_animation(this.__wbg_ptr, ptr0, len0, num_frames, is_last);
|
|
287
|
+
if (ret[2]) {
|
|
288
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
289
|
+
}
|
|
290
|
+
return takeFromExternrefTable0(ret[0]);
|
|
291
|
+
}
|
|
292
|
+
/**
|
|
293
|
+
* 52-dim 블렌드쉐입 후처리 + 프리셋 애니메이션 블렌딩
|
|
294
|
+
*
|
|
295
|
+
* Python _blend_with_preset 호환:
|
|
296
|
+
* - 비립싱크 채널(brows, eyes): preset * 0.7 + lipsync * 0.3
|
|
297
|
+
* - 립싱크 채널(jaw, mouth): lipsync * 1.0 (변경 없음)
|
|
298
|
+
* @param {Float32Array} raw_blendshapes
|
|
299
|
+
* @param {number} num_frames
|
|
300
|
+
* @returns {any}
|
|
301
|
+
*/
|
|
302
|
+
process_blendshapes_with_animation(raw_blendshapes, num_frames) {
|
|
303
|
+
const ptr0 = passArrayF32ToWasm0(raw_blendshapes, wasm.__wbindgen_malloc);
|
|
304
|
+
const len0 = WASM_VECTOR_LEN;
|
|
305
|
+
const ret = wasm.lipsyncwasmv2_process_blendshapes_with_animation(this.__wbg_ptr, ptr0, len0, num_frames);
|
|
306
|
+
if (ret[2]) {
|
|
307
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
308
|
+
}
|
|
309
|
+
return takeFromExternrefTable0(ret[0]);
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* 상태 리셋
|
|
313
|
+
*/
|
|
314
|
+
reset() {
|
|
315
|
+
wasm.lipsyncwasmv2_reset(this.__wbg_ptr);
|
|
316
|
+
}
|
|
317
|
+
/**
|
|
318
|
+
* 스트리밍 모드 시작
|
|
319
|
+
*/
|
|
320
|
+
start_streaming() {
|
|
321
|
+
wasm.lipsyncwasmv2_start_streaming(this.__wbg_ptr);
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
if (Symbol.dispose) LipSyncWasmV2.prototype[Symbol.dispose] = LipSyncWasmV2.prototype.free;
|
|
325
|
+
|
|
326
|
+
/**
|
|
327
|
+
* 내장 idle VRMA 원본 바이트 반환
|
|
328
|
+
* @returns {Uint8Array}
|
|
329
|
+
*/
|
|
330
|
+
export function get_idle_vrma_bytes() {
|
|
331
|
+
const ret = wasm.get_idle_vrma_bytes();
|
|
332
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
333
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
334
|
+
return v1;
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
/**
|
|
338
|
+
* [Deprecated] 구 API — 라이선스 없이 모델 접근 불가
|
|
339
|
+
*
|
|
340
|
+
* get_onnx_model_licensed(token, timestamp)를 사용하세요.
|
|
341
|
+
* @returns {Uint8Array}
|
|
342
|
+
*/
|
|
343
|
+
export function get_onnx_model() {
|
|
344
|
+
const ret = wasm.get_onnx_model();
|
|
345
|
+
if (ret[3]) {
|
|
346
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
347
|
+
}
|
|
348
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
349
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
350
|
+
return v1;
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
/**
|
|
354
|
+
* 라이선스 검증 + ONNX 모델 복호화 (원자적 실행)
|
|
355
|
+
*
|
|
356
|
+
* Ed25519 서명 검증 통과 후에만 AES-256-GCM 복호화 수행.
|
|
357
|
+
* 서명 검증과 복호화가 하나의 함수에서 실행되어 중간 가로채기 불가.
|
|
358
|
+
*
|
|
359
|
+
* # Arguments
|
|
360
|
+
* * `token` - 서버에서 발급받은 라이선스 토큰 (EdDSA 서명)
|
|
361
|
+
* * `current_timestamp_secs` - 현재 Unix timestamp (초)
|
|
362
|
+
* @param {string} token
|
|
363
|
+
* @param {number} current_timestamp_secs
|
|
364
|
+
* @returns {Uint8Array}
|
|
365
|
+
*/
|
|
366
|
+
export function get_onnx_model_licensed(token, current_timestamp_secs) {
|
|
367
|
+
const ptr0 = passStringToWasm0(token, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
368
|
+
const len0 = WASM_VECTOR_LEN;
|
|
369
|
+
const ret = wasm.get_onnx_model_licensed(ptr0, len0, current_timestamp_secs);
|
|
370
|
+
if (ret[3]) {
|
|
371
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
372
|
+
}
|
|
373
|
+
var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
374
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
375
|
+
return v2;
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
/**
|
|
379
|
+
* 내장 speaking VRMA 원본 바이트 반환
|
|
380
|
+
* @returns {Uint8Array}
|
|
381
|
+
*/
|
|
382
|
+
export function get_speaking_vrma_bytes() {
|
|
383
|
+
const ret = wasm.get_speaking_vrma_bytes();
|
|
384
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
385
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
386
|
+
return v1;
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
/**
|
|
390
|
+
* WASM 초기화 시 panic hook 설정
|
|
391
|
+
*/
|
|
392
|
+
export function start() {
|
|
393
|
+
wasm.start();
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
function __wbg_get_imports() {
|
|
397
|
+
const import0 = {
|
|
398
|
+
__proto__: null,
|
|
399
|
+
__wbg_Error_ecbf49c1b9d07c30: function(arg0, arg1) {
|
|
400
|
+
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
401
|
+
return ret;
|
|
402
|
+
},
|
|
403
|
+
__wbg_Number_7da99b0afe51b89a: function(arg0) {
|
|
404
|
+
const ret = Number(arg0);
|
|
405
|
+
return ret;
|
|
406
|
+
},
|
|
407
|
+
__wbg_String_8564e559799eccda: function(arg0, arg1) {
|
|
408
|
+
const ret = String(arg1);
|
|
409
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
410
|
+
const len1 = WASM_VECTOR_LEN;
|
|
411
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
412
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
413
|
+
},
|
|
414
|
+
__wbg___wbindgen_boolean_get_4a348b369b009243: function(arg0) {
|
|
415
|
+
const v = arg0;
|
|
416
|
+
const ret = typeof(v) === 'boolean' ? v : undefined;
|
|
417
|
+
return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
|
|
418
|
+
},
|
|
419
|
+
__wbg___wbindgen_debug_string_43c7ccb034739216: function(arg0, arg1) {
|
|
420
|
+
const ret = debugString(arg1);
|
|
421
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
422
|
+
const len1 = WASM_VECTOR_LEN;
|
|
423
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
424
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
425
|
+
},
|
|
426
|
+
__wbg___wbindgen_in_035107858ad0083e: function(arg0, arg1) {
|
|
427
|
+
const ret = arg0 in arg1;
|
|
428
|
+
return ret;
|
|
429
|
+
},
|
|
430
|
+
__wbg___wbindgen_is_function_18bea6e84080c016: function(arg0) {
|
|
431
|
+
const ret = typeof(arg0) === 'function';
|
|
432
|
+
return ret;
|
|
433
|
+
},
|
|
434
|
+
__wbg___wbindgen_is_object_8d3fac158b36498d: function(arg0) {
|
|
435
|
+
const val = arg0;
|
|
436
|
+
const ret = typeof(val) === 'object' && val !== null;
|
|
437
|
+
return ret;
|
|
438
|
+
},
|
|
439
|
+
__wbg___wbindgen_is_undefined_4a711ea9d2e1ef93: function(arg0) {
|
|
440
|
+
const ret = arg0 === undefined;
|
|
441
|
+
return ret;
|
|
442
|
+
},
|
|
443
|
+
__wbg___wbindgen_jsval_loose_eq_1a2067dfb025b5ec: function(arg0, arg1) {
|
|
444
|
+
const ret = arg0 == arg1;
|
|
445
|
+
return ret;
|
|
446
|
+
},
|
|
447
|
+
__wbg___wbindgen_number_get_eed4462ef92e1bed: function(arg0, arg1) {
|
|
448
|
+
const obj = arg1;
|
|
449
|
+
const ret = typeof(obj) === 'number' ? obj : undefined;
|
|
450
|
+
getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
|
|
451
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
452
|
+
},
|
|
453
|
+
__wbg___wbindgen_string_get_d09f733449cbf7a2: function(arg0, arg1) {
|
|
454
|
+
const obj = arg1;
|
|
455
|
+
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
456
|
+
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
457
|
+
var len1 = WASM_VECTOR_LEN;
|
|
458
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
459
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
460
|
+
},
|
|
461
|
+
__wbg___wbindgen_throw_df03e93053e0f4bc: function(arg0, arg1) {
|
|
462
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
463
|
+
},
|
|
464
|
+
__wbg_call_df7a43aecab856a8: function() { return handleError(function (arg0, arg1) {
|
|
465
|
+
const ret = arg0.call(arg1);
|
|
466
|
+
return ret;
|
|
467
|
+
}, arguments); },
|
|
468
|
+
__wbg_debug_5cd215874b9b39cc: function(arg0) {
|
|
469
|
+
console.debug(arg0);
|
|
470
|
+
},
|
|
471
|
+
__wbg_done_0ad70482cae88a68: function(arg0) {
|
|
472
|
+
const ret = arg0.done;
|
|
473
|
+
return ret;
|
|
474
|
+
},
|
|
475
|
+
__wbg_error_51679600615c775d: function(arg0) {
|
|
476
|
+
console.error(arg0);
|
|
477
|
+
},
|
|
478
|
+
__wbg_error_a6fa202b58aa1cd3: function(arg0, arg1) {
|
|
479
|
+
let deferred0_0;
|
|
480
|
+
let deferred0_1;
|
|
481
|
+
try {
|
|
482
|
+
deferred0_0 = arg0;
|
|
483
|
+
deferred0_1 = arg1;
|
|
484
|
+
console.error(getStringFromWasm0(arg0, arg1));
|
|
485
|
+
} finally {
|
|
486
|
+
wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
|
|
487
|
+
}
|
|
488
|
+
},
|
|
489
|
+
__wbg_get_6f5cf69c8f3f094a: function() { return handleError(function (arg0, arg1) {
|
|
490
|
+
const ret = Reflect.get(arg0, arg1);
|
|
491
|
+
return ret;
|
|
492
|
+
}, arguments); },
|
|
493
|
+
__wbg_get_unchecked_3de5bfaaea65f86b: function(arg0, arg1) {
|
|
494
|
+
const ret = arg0[arg1 >>> 0];
|
|
495
|
+
return ret;
|
|
496
|
+
},
|
|
497
|
+
__wbg_get_with_ref_key_6412cf3094599694: function(arg0, arg1) {
|
|
498
|
+
const ret = arg0[arg1];
|
|
499
|
+
return ret;
|
|
500
|
+
},
|
|
501
|
+
__wbg_info_3039b9f214340fcd: function(arg0) {
|
|
502
|
+
console.info(arg0);
|
|
503
|
+
},
|
|
504
|
+
__wbg_instanceof_ArrayBuffer_d8e4e51f1cf7287a: function(arg0) {
|
|
505
|
+
let result;
|
|
506
|
+
try {
|
|
507
|
+
result = arg0 instanceof ArrayBuffer;
|
|
508
|
+
} catch (_) {
|
|
509
|
+
result = false;
|
|
510
|
+
}
|
|
511
|
+
const ret = result;
|
|
512
|
+
return ret;
|
|
513
|
+
},
|
|
514
|
+
__wbg_instanceof_Uint8Array_6e48d83da6091cc8: function(arg0) {
|
|
515
|
+
let result;
|
|
516
|
+
try {
|
|
517
|
+
result = arg0 instanceof Uint8Array;
|
|
518
|
+
} catch (_) {
|
|
519
|
+
result = false;
|
|
520
|
+
}
|
|
521
|
+
const ret = result;
|
|
522
|
+
return ret;
|
|
523
|
+
},
|
|
524
|
+
__wbg_isArray_2efa5973cef6ec32: function(arg0) {
|
|
525
|
+
const ret = Array.isArray(arg0);
|
|
526
|
+
return ret;
|
|
527
|
+
},
|
|
528
|
+
__wbg_isSafeInteger_6709fb28be12d738: function(arg0) {
|
|
529
|
+
const ret = Number.isSafeInteger(arg0);
|
|
530
|
+
return ret;
|
|
531
|
+
},
|
|
532
|
+
__wbg_iterator_e77d2b7575cca5a7: function() {
|
|
533
|
+
const ret = Symbol.iterator;
|
|
534
|
+
return ret;
|
|
535
|
+
},
|
|
536
|
+
__wbg_length_00dd7227fd4626ad: function(arg0) {
|
|
537
|
+
const ret = arg0.length;
|
|
538
|
+
return ret;
|
|
539
|
+
},
|
|
540
|
+
__wbg_length_5e07cf181b2745fb: function(arg0) {
|
|
541
|
+
const ret = arg0.length;
|
|
542
|
+
return ret;
|
|
543
|
+
},
|
|
544
|
+
__wbg_log_91f1dd1dfd5a4ae8: function(arg0) {
|
|
545
|
+
console.log(arg0);
|
|
546
|
+
},
|
|
547
|
+
__wbg_new_227d7c05414eb861: function() {
|
|
548
|
+
const ret = new Error();
|
|
549
|
+
return ret;
|
|
550
|
+
},
|
|
551
|
+
__wbg_new_62f131e968c83d75: function() {
|
|
552
|
+
const ret = new Object();
|
|
553
|
+
return ret;
|
|
554
|
+
},
|
|
555
|
+
__wbg_new_66075f8c2ea6575e: function() {
|
|
556
|
+
const ret = new Array();
|
|
557
|
+
return ret;
|
|
558
|
+
},
|
|
559
|
+
__wbg_new_a0479da6258a0d71: function(arg0) {
|
|
560
|
+
const ret = new Uint8Array(arg0);
|
|
561
|
+
return ret;
|
|
562
|
+
},
|
|
563
|
+
__wbg_next_5428439dfc1d0362: function() { return handleError(function (arg0) {
|
|
564
|
+
const ret = arg0.next();
|
|
565
|
+
return ret;
|
|
566
|
+
}, arguments); },
|
|
567
|
+
__wbg_next_d314789a105729f3: function(arg0) {
|
|
568
|
+
const ret = arg0.next;
|
|
569
|
+
return ret;
|
|
570
|
+
},
|
|
571
|
+
__wbg_prototypesetcall_d1a7133bc8d83aa9: function(arg0, arg1, arg2) {
|
|
572
|
+
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
|
|
573
|
+
},
|
|
574
|
+
__wbg_set_6be42768c690e380: function(arg0, arg1, arg2) {
|
|
575
|
+
arg0[arg1] = arg2;
|
|
576
|
+
},
|
|
577
|
+
__wbg_set_7bf9e2df46e7632c: function(arg0, arg1, arg2) {
|
|
578
|
+
arg0[arg1 >>> 0] = arg2;
|
|
579
|
+
},
|
|
580
|
+
__wbg_stack_3b0d974bbf31e44f: function(arg0, arg1) {
|
|
581
|
+
const ret = arg1.stack;
|
|
582
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
583
|
+
const len1 = WASM_VECTOR_LEN;
|
|
584
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
585
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
586
|
+
},
|
|
587
|
+
__wbg_value_414b42ce7b3eca22: function(arg0) {
|
|
588
|
+
const ret = arg0.value;
|
|
589
|
+
return ret;
|
|
590
|
+
},
|
|
591
|
+
__wbg_warn_52ab87a85aca283f: function(arg0) {
|
|
592
|
+
console.warn(arg0);
|
|
593
|
+
},
|
|
594
|
+
__wbindgen_cast_0000000000000001: function(arg0) {
|
|
595
|
+
// Cast intrinsic for `F64 -> Externref`.
|
|
596
|
+
const ret = arg0;
|
|
597
|
+
return ret;
|
|
598
|
+
},
|
|
599
|
+
__wbindgen_cast_0000000000000002: function(arg0, arg1) {
|
|
600
|
+
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
601
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
602
|
+
return ret;
|
|
603
|
+
},
|
|
604
|
+
__wbindgen_init_externref_table: function() {
|
|
605
|
+
const table = wasm.__wbindgen_externrefs;
|
|
606
|
+
const offset = table.grow(4);
|
|
607
|
+
table.set(0, undefined);
|
|
608
|
+
table.set(offset + 0, undefined);
|
|
609
|
+
table.set(offset + 1, null);
|
|
610
|
+
table.set(offset + 2, true);
|
|
611
|
+
table.set(offset + 3, false);
|
|
612
|
+
},
|
|
613
|
+
};
|
|
614
|
+
return {
|
|
615
|
+
__proto__: null,
|
|
616
|
+
"./lipsync_wasm_v2_bg.js": import0,
|
|
617
|
+
};
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
const LipSyncWasmV2Finalization = (typeof FinalizationRegistry === 'undefined')
|
|
621
|
+
? { register: () => {}, unregister: () => {} }
|
|
622
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_lipsyncwasmv2_free(ptr >>> 0, 1));
|
|
623
|
+
|
|
624
|
+
function addToExternrefTable0(obj) {
|
|
625
|
+
const idx = wasm.__externref_table_alloc();
|
|
626
|
+
wasm.__wbindgen_externrefs.set(idx, obj);
|
|
627
|
+
return idx;
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
function debugString(val) {
|
|
631
|
+
// primitive types
|
|
632
|
+
const type = typeof val;
|
|
633
|
+
if (type == 'number' || type == 'boolean' || val == null) {
|
|
634
|
+
return `${val}`;
|
|
635
|
+
}
|
|
636
|
+
if (type == 'string') {
|
|
637
|
+
return `"${val}"`;
|
|
638
|
+
}
|
|
639
|
+
if (type == 'symbol') {
|
|
640
|
+
const description = val.description;
|
|
641
|
+
if (description == null) {
|
|
642
|
+
return 'Symbol';
|
|
643
|
+
} else {
|
|
644
|
+
return `Symbol(${description})`;
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
if (type == 'function') {
|
|
648
|
+
const name = val.name;
|
|
649
|
+
if (typeof name == 'string' && name.length > 0) {
|
|
650
|
+
return `Function(${name})`;
|
|
651
|
+
} else {
|
|
652
|
+
return 'Function';
|
|
653
|
+
}
|
|
654
|
+
}
|
|
655
|
+
// objects
|
|
656
|
+
if (Array.isArray(val)) {
|
|
657
|
+
const length = val.length;
|
|
658
|
+
let debug = '[';
|
|
659
|
+
if (length > 0) {
|
|
660
|
+
debug += debugString(val[0]);
|
|
661
|
+
}
|
|
662
|
+
for(let i = 1; i < length; i++) {
|
|
663
|
+
debug += ', ' + debugString(val[i]);
|
|
664
|
+
}
|
|
665
|
+
debug += ']';
|
|
666
|
+
return debug;
|
|
667
|
+
}
|
|
668
|
+
// Test for built-in
|
|
669
|
+
const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
|
|
670
|
+
let className;
|
|
671
|
+
if (builtInMatches && builtInMatches.length > 1) {
|
|
672
|
+
className = builtInMatches[1];
|
|
673
|
+
} else {
|
|
674
|
+
// Failed to match the standard '[object ClassName]'
|
|
675
|
+
return toString.call(val);
|
|
676
|
+
}
|
|
677
|
+
if (className == 'Object') {
|
|
678
|
+
// we're a user defined class or Object
|
|
679
|
+
// JSON.stringify avoids problems with cycles, and is generally much
|
|
680
|
+
// easier than looping through ownProperties of `val`.
|
|
681
|
+
try {
|
|
682
|
+
return 'Object(' + JSON.stringify(val) + ')';
|
|
683
|
+
} catch (_) {
|
|
684
|
+
return 'Object';
|
|
685
|
+
}
|
|
686
|
+
}
|
|
687
|
+
// errors
|
|
688
|
+
if (val instanceof Error) {
|
|
689
|
+
return `${val.name}: ${val.message}\n${val.stack}`;
|
|
690
|
+
}
|
|
691
|
+
// TODO we could test for more things here, like `Set`s and `Map`s.
|
|
692
|
+
return className;
|
|
693
|
+
}
|
|
694
|
+
|
|
695
|
+
function getArrayF32FromWasm0(ptr, len) {
|
|
696
|
+
ptr = ptr >>> 0;
|
|
697
|
+
return getFloat32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
|
|
698
|
+
}
|
|
699
|
+
|
|
700
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
701
|
+
ptr = ptr >>> 0;
|
|
702
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
703
|
+
}
|
|
704
|
+
|
|
705
|
+
let cachedDataViewMemory0 = null;
|
|
706
|
+
function getDataViewMemory0() {
|
|
707
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
708
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
709
|
+
}
|
|
710
|
+
return cachedDataViewMemory0;
|
|
711
|
+
}
|
|
712
|
+
|
|
713
|
+
let cachedFloat32ArrayMemory0 = null;
|
|
714
|
+
function getFloat32ArrayMemory0() {
|
|
715
|
+
if (cachedFloat32ArrayMemory0 === null || cachedFloat32ArrayMemory0.byteLength === 0) {
|
|
716
|
+
cachedFloat32ArrayMemory0 = new Float32Array(wasm.memory.buffer);
|
|
717
|
+
}
|
|
718
|
+
return cachedFloat32ArrayMemory0;
|
|
719
|
+
}
|
|
720
|
+
|
|
721
|
+
function getStringFromWasm0(ptr, len) {
|
|
722
|
+
ptr = ptr >>> 0;
|
|
723
|
+
return decodeText(ptr, len);
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
let cachedUint8ArrayMemory0 = null;
|
|
727
|
+
function getUint8ArrayMemory0() {
|
|
728
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
729
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
730
|
+
}
|
|
731
|
+
return cachedUint8ArrayMemory0;
|
|
732
|
+
}
|
|
733
|
+
|
|
734
|
+
function handleError(f, args) {
|
|
735
|
+
try {
|
|
736
|
+
return f.apply(this, args);
|
|
737
|
+
} catch (e) {
|
|
738
|
+
const idx = addToExternrefTable0(e);
|
|
739
|
+
wasm.__wbindgen_exn_store(idx);
|
|
740
|
+
}
|
|
741
|
+
}
|
|
742
|
+
|
|
743
|
+
function isLikeNone(x) {
|
|
744
|
+
return x === undefined || x === null;
|
|
745
|
+
}
|
|
746
|
+
|
|
747
|
+
function passArrayF32ToWasm0(arg, malloc) {
|
|
748
|
+
const ptr = malloc(arg.length * 4, 4) >>> 0;
|
|
749
|
+
getFloat32ArrayMemory0().set(arg, ptr / 4);
|
|
750
|
+
WASM_VECTOR_LEN = arg.length;
|
|
751
|
+
return ptr;
|
|
752
|
+
}
|
|
753
|
+
|
|
754
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
755
|
+
if (realloc === undefined) {
|
|
756
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
757
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
758
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
759
|
+
WASM_VECTOR_LEN = buf.length;
|
|
760
|
+
return ptr;
|
|
761
|
+
}
|
|
762
|
+
|
|
763
|
+
let len = arg.length;
|
|
764
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
765
|
+
|
|
766
|
+
const mem = getUint8ArrayMemory0();
|
|
767
|
+
|
|
768
|
+
let offset = 0;
|
|
769
|
+
|
|
770
|
+
for (; offset < len; offset++) {
|
|
771
|
+
const code = arg.charCodeAt(offset);
|
|
772
|
+
if (code > 0x7F) break;
|
|
773
|
+
mem[ptr + offset] = code;
|
|
774
|
+
}
|
|
775
|
+
if (offset !== len) {
|
|
776
|
+
if (offset !== 0) {
|
|
777
|
+
arg = arg.slice(offset);
|
|
778
|
+
}
|
|
779
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
780
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
781
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
782
|
+
|
|
783
|
+
offset += ret.written;
|
|
784
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
785
|
+
}
|
|
786
|
+
|
|
787
|
+
WASM_VECTOR_LEN = offset;
|
|
788
|
+
return ptr;
|
|
789
|
+
}
|
|
790
|
+
|
|
791
|
+
function takeFromExternrefTable0(idx) {
|
|
792
|
+
const value = wasm.__wbindgen_externrefs.get(idx);
|
|
793
|
+
wasm.__externref_table_dealloc(idx);
|
|
794
|
+
return value;
|
|
795
|
+
}
|
|
796
|
+
|
|
797
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
798
|
+
cachedTextDecoder.decode();
|
|
799
|
+
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
800
|
+
let numBytesDecoded = 0;
|
|
801
|
+
function decodeText(ptr, len) {
|
|
802
|
+
numBytesDecoded += len;
|
|
803
|
+
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
804
|
+
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
805
|
+
cachedTextDecoder.decode();
|
|
806
|
+
numBytesDecoded = len;
|
|
807
|
+
}
|
|
808
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
809
|
+
}
|
|
810
|
+
|
|
811
|
+
const cachedTextEncoder = new TextEncoder();
|
|
812
|
+
|
|
813
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
814
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
815
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
816
|
+
view.set(buf);
|
|
817
|
+
return {
|
|
818
|
+
read: arg.length,
|
|
819
|
+
written: buf.length
|
|
820
|
+
};
|
|
821
|
+
};
|
|
822
|
+
}
|
|
823
|
+
|
|
824
|
+
let WASM_VECTOR_LEN = 0;
|
|
825
|
+
|
|
826
|
+
let wasmModule, wasm;
|
|
827
|
+
function __wbg_finalize_init(instance, module) {
|
|
828
|
+
wasm = instance.exports;
|
|
829
|
+
wasmModule = module;
|
|
830
|
+
cachedDataViewMemory0 = null;
|
|
831
|
+
cachedFloat32ArrayMemory0 = null;
|
|
832
|
+
cachedUint8ArrayMemory0 = null;
|
|
833
|
+
wasm.__wbindgen_start();
|
|
834
|
+
return wasm;
|
|
835
|
+
}
|
|
836
|
+
|
|
837
|
+
async function __wbg_load(module, imports) {
|
|
838
|
+
if (typeof Response === 'function' && module instanceof Response) {
|
|
839
|
+
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
|
840
|
+
try {
|
|
841
|
+
return await WebAssembly.instantiateStreaming(module, imports);
|
|
842
|
+
} catch (e) {
|
|
843
|
+
const validResponse = module.ok && expectedResponseType(module.type);
|
|
844
|
+
|
|
845
|
+
if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
|
|
846
|
+
console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
|
|
847
|
+
|
|
848
|
+
} else { throw e; }
|
|
849
|
+
}
|
|
850
|
+
}
|
|
851
|
+
|
|
852
|
+
const bytes = await module.arrayBuffer();
|
|
853
|
+
return await WebAssembly.instantiate(bytes, imports);
|
|
854
|
+
} else {
|
|
855
|
+
const instance = await WebAssembly.instantiate(module, imports);
|
|
856
|
+
|
|
857
|
+
if (instance instanceof WebAssembly.Instance) {
|
|
858
|
+
return { instance, module };
|
|
859
|
+
} else {
|
|
860
|
+
return instance;
|
|
861
|
+
}
|
|
862
|
+
}
|
|
863
|
+
|
|
864
|
+
function expectedResponseType(type) {
|
|
865
|
+
switch (type) {
|
|
866
|
+
case 'basic': case 'cors': case 'default': return true;
|
|
867
|
+
}
|
|
868
|
+
return false;
|
|
869
|
+
}
|
|
870
|
+
}
|
|
871
|
+
|
|
872
|
+
function initSync(module) {
|
|
873
|
+
if (wasm !== undefined) return wasm;
|
|
874
|
+
|
|
875
|
+
|
|
876
|
+
if (module !== undefined) {
|
|
877
|
+
if (Object.getPrototypeOf(module) === Object.prototype) {
|
|
878
|
+
({module} = module)
|
|
879
|
+
} else {
|
|
880
|
+
console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
|
|
881
|
+
}
|
|
882
|
+
}
|
|
883
|
+
|
|
884
|
+
const imports = __wbg_get_imports();
|
|
885
|
+
if (!(module instanceof WebAssembly.Module)) {
|
|
886
|
+
module = new WebAssembly.Module(module);
|
|
887
|
+
}
|
|
888
|
+
const instance = new WebAssembly.Instance(module, imports);
|
|
889
|
+
return __wbg_finalize_init(instance, module);
|
|
890
|
+
}
|
|
891
|
+
|
|
892
|
+
async function __wbg_init(module_or_path) {
|
|
893
|
+
if (wasm !== undefined) return wasm;
|
|
894
|
+
|
|
895
|
+
|
|
896
|
+
if (module_or_path !== undefined) {
|
|
897
|
+
if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
|
|
898
|
+
({module_or_path} = module_or_path)
|
|
899
|
+
} else {
|
|
900
|
+
console.warn('using deprecated parameters for the initialization function; pass a single object instead')
|
|
901
|
+
}
|
|
902
|
+
}
|
|
903
|
+
|
|
904
|
+
if (module_or_path === undefined) {
|
|
905
|
+
module_or_path = new URL('lipsync_wasm_v2_bg.wasm', import.meta.url);
|
|
906
|
+
}
|
|
907
|
+
const imports = __wbg_get_imports();
|
|
908
|
+
|
|
909
|
+
if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
|
|
910
|
+
module_or_path = fetch(module_or_path);
|
|
911
|
+
}
|
|
912
|
+
|
|
913
|
+
const { instance, module } = await __wbg_load(await module_or_path, imports);
|
|
914
|
+
|
|
915
|
+
return __wbg_finalize_init(instance, module);
|
|
916
|
+
}
|
|
917
|
+
|
|
918
|
+
export { initSync, __wbg_init as default };
|