opus-codec 0.0.55 → 0.0.56

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/native/index.js CHANGED
@@ -5,1868 +5,7 @@ var Module = (() => {
5
5
  return (
6
6
  function(Module = {}) {
7
7
 
8
- // include: shell.js
9
- // The Module object: Our interface to the outside world. We import
10
- // and export values on it. There are various ways Module can be used:
11
- // 1. Not defined. We create it here
12
- // 2. A function parameter, function(Module) { ..generated code.. }
13
- // 3. pre-run appended it, var Module = {}; ..generated code..
14
- // 4. External script tag defines var Module.
15
- // We need to check if Module already exists (e.g. case 3 above).
16
- // Substitution will be replaced with actual code on later stage of the build,
17
- // this way Closure Compiler will not mangle it (e.g. case 4. above).
18
- // Note that if you want to run closure, and also to use Module
19
- // after the generated code, you will need to define var Module = {};
20
- // before the code. Then that object will be used in the code, and you
21
- // can continue to use Module afterwards as well.
22
- var Module = typeof Module != 'undefined' ? Module : {};
23
-
24
- // Set up the promise that indicates the Module is initialized
25
- var readyPromiseResolve, readyPromiseReject;
26
- Module['ready'] = new Promise(function(resolve, reject) {
27
- readyPromiseResolve = resolve;
28
- readyPromiseReject = reject;
29
- });
30
- ["_size_of_int","_size_of_void_ptr","_malloc","_free","_opus_decoder_create","_opus_decoder_destroy","_opus_decode_float","_opus_encoder_create","_opus_encoder_destroy","_opus_encoder_ctl","_opus_encode_float","_opus_set_complexity","_opus_get_complexity","_opus_set_bitrate","_opus_get_bitrate","_opus_set_vbr","_opus_get_vbr","_opus_set_vbr_constraint","_opus_get_vbr_constraint","_opus_set_force_channels","_opus_get_force_channels","_opus_set_max_bandwidth","_opus_get_max_bandwidth","_opus_set_bandwidth","_opus_set_signal","_opus_get_signal","_opus_set_application","_opus_get_application","_opus_get_lookahead","_opus_set_inband_fec","_opus_get_inband_fec","_opus_set_packet_loss_perc","_opus_get_packet_loss_perc","_opus_set_dtx","_opus_get_dtx","_opus_set_lsb_depth","_opus_get_lsb_depth","_opus_set_expert_frame_duration","_opus_get_expert_frame_duration","_opus_set_prediction_disabled","_opus_get_prediction_disabled","_opus_get_bandwidth","_opus_get_sample_rate","_opus_set_phase_inversion_disabled","_opus_get_phase_inversion_disabled","_opus_get_in_dtx","_opus_set_gain","_opus_get_gain","_opus_get_last_packet_duration","_opus_get_pitch","_fflush","onRuntimeInitialized"].forEach((prop) => {
31
- if (!Object.getOwnPropertyDescriptor(Module['ready'], prop)) {
32
- Object.defineProperty(Module['ready'], prop, {
33
- get: () => abort('You are getting ' + prop + ' on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js'),
34
- set: () => abort('You are setting ' + prop + ' on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js'),
35
- });
36
- }
37
- });
38
-
39
- // --pre-jses are emitted after the Module integration code, so that they can
40
- // refer to Module (if they choose; they can also define Module)
41
-
42
-
43
- // Sometimes an existing Module object exists with properties
44
- // meant to overwrite the default module functionality. Here
45
- // we collect those properties and reapply _after_ we configure
46
- // the current environment's defaults to avoid having to be so
47
- // defensive during initialization.
48
- var moduleOverrides = Object.assign({}, Module);
49
-
50
- var arguments_ = [];
51
- var thisProgram = './this.program';
52
- var quit_ = (status, toThrow) => {
53
- throw toThrow;
54
- };
55
-
56
- // Determine the runtime environment we are in. You can customize this by
57
- // setting the ENVIRONMENT setting at compile time (see settings.js).
58
-
59
- // Attempt to auto-detect the environment
60
- var ENVIRONMENT_IS_WEB = typeof window == 'object';
61
- var ENVIRONMENT_IS_WORKER = typeof importScripts == 'function';
62
- // N.b. Electron.js environment is simultaneously a NODE-environment, but
63
- // also a web environment.
64
- var ENVIRONMENT_IS_NODE = typeof process == 'object' && typeof process.versions == 'object' && typeof process.versions.node == 'string';
65
- var ENVIRONMENT_IS_SHELL = !ENVIRONMENT_IS_WEB && !ENVIRONMENT_IS_NODE && !ENVIRONMENT_IS_WORKER;
66
-
67
- if (Module['ENVIRONMENT']) {
68
- throw new Error('Module.ENVIRONMENT has been deprecated. To force the environment, use the ENVIRONMENT compile-time option (for example, -sENVIRONMENT=web or -sENVIRONMENT=node)');
69
- }
70
-
71
- // `/` should be present at the end if `scriptDirectory` is not empty
72
- var scriptDirectory = '';
73
- function locateFile(path) {
74
- if (Module['locateFile']) {
75
- return Module['locateFile'](path, scriptDirectory);
76
- }
77
- return scriptDirectory + path;
78
- }
79
-
80
- // Hooks that are implemented differently in different runtime environments.
81
- var read_,
82
- readAsync,
83
- readBinary,
84
- setWindowTitle;
85
-
86
- if (ENVIRONMENT_IS_NODE) {
87
- if (typeof process == 'undefined' || !process.release || process.release.name !== 'node') throw new Error('not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)');
88
-
89
- var nodeVersion = process.versions.node;
90
- var numericVersion = nodeVersion.split('.').slice(0, 3);
91
- numericVersion = (numericVersion[0] * 10000) + (numericVersion[1] * 100) + numericVersion[2] * 1;
92
- var minVersion = 101900;
93
- if (numericVersion < 101900) {
94
- throw new Error('This emscripten-generated code requires node v10.19.19.0 (detected v' + nodeVersion + ')');
95
- }
96
-
97
- // `require()` is no-op in an ESM module, use `createRequire()` to construct
98
- // the require()` function. This is only necessary for multi-environment
99
- // builds, `-sENVIRONMENT=node` emits a static import declaration instead.
100
- // TODO: Swap all `require()`'s with `import()`'s?
101
- // These modules will usually be used on Node.js. Load them eagerly to avoid
102
- // the complexity of lazy-loading.
103
- var fs = require('fs');
104
- var nodePath = require('path');
105
-
106
- if (ENVIRONMENT_IS_WORKER) {
107
- scriptDirectory = nodePath.dirname(scriptDirectory) + '/';
108
- } else {
109
- scriptDirectory = __dirname + '/';
110
- }
111
-
112
- // include: node_shell_read.js
113
- read_ = (filename, binary) => {
114
- // We need to re-wrap `file://` strings to URLs. Normalizing isn't
115
- // necessary in that case, the path should already be absolute.
116
- filename = isFileURI(filename) ? new URL(filename) : nodePath.normalize(filename);
117
- return fs.readFileSync(filename, binary ? undefined : 'utf8');
118
- };
119
-
120
- readBinary = (filename) => {
121
- var ret = read_(filename, true);
122
- if (!ret.buffer) {
123
- ret = new Uint8Array(ret);
124
- }
125
- assert(ret.buffer);
126
- return ret;
127
- };
128
-
129
- readAsync = (filename, onload, onerror) => {
130
- // See the comment in the `read_` function.
131
- filename = isFileURI(filename) ? new URL(filename) : nodePath.normalize(filename);
132
- fs.readFile(filename, function(err, data) {
133
- if (err) onerror(err);
134
- else onload(data.buffer);
135
- });
136
- };
137
-
138
- // end include: node_shell_read.js
139
- if (process.argv.length > 1) {
140
- thisProgram = process.argv[1].replace(/\\/g, '/');
141
- }
142
-
143
- arguments_ = process.argv.slice(2);
144
-
145
- // MODULARIZE will export the module in the proper place outside, we don't need to export here
146
-
147
- quit_ = (status, toThrow) => {
148
- process.exitCode = status;
149
- throw toThrow;
150
- };
151
-
152
- Module['inspect'] = function () { return '[Emscripten Module object]'; };
153
-
154
- } else
155
- if (ENVIRONMENT_IS_SHELL) {
156
-
157
- if ((typeof process == 'object' && typeof require === 'function') || typeof window == 'object' || typeof importScripts == 'function') throw new Error('not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)');
158
-
159
- if (typeof read != 'undefined') {
160
- read_ = function shell_read(f) {
161
- return read(f);
162
- };
163
- }
164
-
165
- readBinary = function readBinary(f) {
166
- let data;
167
- if (typeof readbuffer == 'function') {
168
- return new Uint8Array(readbuffer(f));
169
- }
170
- data = read(f, 'binary');
171
- assert(typeof data == 'object');
172
- return data;
173
- };
174
-
175
- readAsync = function readAsync(f, onload, onerror) {
176
- setTimeout(() => onload(readBinary(f)), 0);
177
- };
178
-
179
- if (typeof clearTimeout == 'undefined') {
180
- globalThis.clearTimeout = (id) => {};
181
- }
182
-
183
- if (typeof scriptArgs != 'undefined') {
184
- arguments_ = scriptArgs;
185
- } else if (typeof arguments != 'undefined') {
186
- arguments_ = arguments;
187
- }
188
-
189
- if (typeof quit == 'function') {
190
- quit_ = (status, toThrow) => {
191
- // Unlike node which has process.exitCode, d8 has no such mechanism. So we
192
- // have no way to set the exit code and then let the program exit with
193
- // that code when it naturally stops running (say, when all setTimeouts
194
- // have completed). For that reason, we must call `quit` - the only way to
195
- // set the exit code - but quit also halts immediately. To increase
196
- // consistency with node (and the web) we schedule the actual quit call
197
- // using a setTimeout to give the current stack and any exception handlers
198
- // a chance to run. This enables features such as addOnPostRun (which
199
- // expected to be able to run code after main returns).
200
- setTimeout(() => {
201
- if (!(toThrow instanceof ExitStatus)) {
202
- let toLog = toThrow;
203
- if (toThrow && typeof toThrow == 'object' && toThrow.stack) {
204
- toLog = [toThrow, toThrow.stack];
205
- }
206
- err('exiting due to exception: ' + toLog);
207
- }
208
- quit(status);
209
- });
210
- throw toThrow;
211
- };
212
- }
213
-
214
- if (typeof print != 'undefined') {
215
- // Prefer to use print/printErr where they exist, as they usually work better.
216
- if (typeof console == 'undefined') console = /** @type{!Console} */({});
217
- console.log = /** @type{!function(this:Console, ...*): undefined} */ (print);
218
- console.warn = console.error = /** @type{!function(this:Console, ...*): undefined} */ (typeof printErr != 'undefined' ? printErr : print);
219
- }
220
-
221
- } else
222
-
223
- // Note that this includes Node.js workers when relevant (pthreads is enabled).
224
- // Node.js workers are detected as a combination of ENVIRONMENT_IS_WORKER and
225
- // ENVIRONMENT_IS_NODE.
226
- if (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER) {
227
- if (ENVIRONMENT_IS_WORKER) { // Check worker, not web, since window could be polyfilled
228
- scriptDirectory = self.location.href;
229
- } else if (typeof document != 'undefined' && document.currentScript) { // web
230
- scriptDirectory = document.currentScript.src;
231
- }
232
- // When MODULARIZE, this JS may be executed later, after document.currentScript
233
- // is gone, so we saved it, and we use it here instead of any other info.
234
- if (_scriptDir) {
235
- scriptDirectory = _scriptDir;
236
- }
237
- // blob urls look like blob:http://site.com/etc/etc and we cannot infer anything from them.
238
- // otherwise, slice off the final part of the url to find the script directory.
239
- // if scriptDirectory does not contain a slash, lastIndexOf will return -1,
240
- // and scriptDirectory will correctly be replaced with an empty string.
241
- // If scriptDirectory contains a query (starting with ?) or a fragment (starting with #),
242
- // they are removed because they could contain a slash.
243
- if (scriptDirectory.indexOf('blob:') !== 0) {
244
- scriptDirectory = scriptDirectory.substr(0, scriptDirectory.replace(/[?#].*/, "").lastIndexOf('/')+1);
245
- } else {
246
- scriptDirectory = '';
247
- }
248
-
249
- if (!(typeof window == 'object' || typeof importScripts == 'function')) throw new Error('not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)');
250
-
251
- // Differentiate the Web Worker from the Node Worker case, as reading must
252
- // be done differently.
253
- {
254
- // include: web_or_worker_shell_read.js
255
- read_ = (url) => {
256
- var xhr = new XMLHttpRequest();
257
- xhr.open('GET', url, false);
258
- xhr.send(null);
259
- return xhr.responseText;
260
- }
261
-
262
- if (ENVIRONMENT_IS_WORKER) {
263
- readBinary = (url) => {
264
- var xhr = new XMLHttpRequest();
265
- xhr.open('GET', url, false);
266
- xhr.responseType = 'arraybuffer';
267
- xhr.send(null);
268
- return new Uint8Array(/** @type{!ArrayBuffer} */(xhr.response));
269
- };
270
- }
271
-
272
- readAsync = (url, onload, onerror) => {
273
- var xhr = new XMLHttpRequest();
274
- xhr.open('GET', url, true);
275
- xhr.responseType = 'arraybuffer';
276
- xhr.onload = () => {
277
- if (xhr.status == 200 || (xhr.status == 0 && xhr.response)) { // file URLs can return 0
278
- onload(xhr.response);
279
- return;
280
- }
281
- onerror();
282
- };
283
- xhr.onerror = onerror;
284
- xhr.send(null);
285
- }
286
-
287
- // end include: web_or_worker_shell_read.js
288
- }
289
-
290
- setWindowTitle = (title) => document.title = title;
291
- } else
292
- {
293
- throw new Error('environment detection error');
294
- }
295
-
296
- var out = Module['print'] || console.log.bind(console);
297
- var err = Module['printErr'] || console.warn.bind(console);
298
-
299
- // Merge back in the overrides
300
- Object.assign(Module, moduleOverrides);
301
- // Free the object hierarchy contained in the overrides, this lets the GC
302
- // reclaim data used e.g. in memoryInitializerRequest, which is a large typed array.
303
- moduleOverrides = null;
304
- checkIncomingModuleAPI();
305
-
306
- // Emit code to handle expected values on the Module object. This applies Module.x
307
- // to the proper local x. This has two benefits: first, we only emit it if it is
308
- // expected to arrive, and second, by using a local everywhere else that can be
309
- // minified.
310
-
311
- if (Module['arguments']) arguments_ = Module['arguments'];legacyModuleProp('arguments', 'arguments_');
312
-
313
- if (Module['thisProgram']) thisProgram = Module['thisProgram'];legacyModuleProp('thisProgram', 'thisProgram');
314
-
315
- if (Module['quit']) quit_ = Module['quit'];legacyModuleProp('quit', 'quit_');
316
-
317
- // perform assertions in shell.js after we set up out() and err(), as otherwise if an assertion fails it cannot print the message
318
- // Assertions on removed incoming Module JS APIs.
319
- assert(typeof Module['memoryInitializerPrefixURL'] == 'undefined', 'Module.memoryInitializerPrefixURL option was removed, use Module.locateFile instead');
320
- assert(typeof Module['pthreadMainPrefixURL'] == 'undefined', 'Module.pthreadMainPrefixURL option was removed, use Module.locateFile instead');
321
- assert(typeof Module['cdInitializerPrefixURL'] == 'undefined', 'Module.cdInitializerPrefixURL option was removed, use Module.locateFile instead');
322
- assert(typeof Module['filePackagePrefixURL'] == 'undefined', 'Module.filePackagePrefixURL option was removed, use Module.locateFile instead');
323
- assert(typeof Module['read'] == 'undefined', 'Module.read option was removed (modify read_ in JS)');
324
- assert(typeof Module['readAsync'] == 'undefined', 'Module.readAsync option was removed (modify readAsync in JS)');
325
- assert(typeof Module['readBinary'] == 'undefined', 'Module.readBinary option was removed (modify readBinary in JS)');
326
- assert(typeof Module['setWindowTitle'] == 'undefined', 'Module.setWindowTitle option was removed (modify setWindowTitle in JS)');
327
- assert(typeof Module['TOTAL_MEMORY'] == 'undefined', 'Module.TOTAL_MEMORY has been renamed Module.INITIAL_MEMORY');
328
- legacyModuleProp('read', 'read_');
329
- legacyModuleProp('readAsync', 'readAsync');
330
- legacyModuleProp('readBinary', 'readBinary');
331
- legacyModuleProp('setWindowTitle', 'setWindowTitle');
332
- var IDBFS = 'IDBFS is no longer included by default; build with -lidbfs.js';
333
- var PROXYFS = 'PROXYFS is no longer included by default; build with -lproxyfs.js';
334
- var WORKERFS = 'WORKERFS is no longer included by default; build with -lworkerfs.js';
335
- var NODEFS = 'NODEFS is no longer included by default; build with -lnodefs.js';
336
-
337
- assert(!ENVIRONMENT_IS_WEB, "web environment detected but not enabled at build time. Add 'web' to `-sENVIRONMENT` to enable.");
338
-
339
- assert(!ENVIRONMENT_IS_SHELL, "shell environment detected but not enabled at build time. Add 'shell' to `-sENVIRONMENT` to enable.");
340
-
341
-
342
- // end include: shell.js
343
- // include: preamble.js
344
- // === Preamble library stuff ===
345
-
346
- // Documentation for the public APIs defined in this file must be updated in:
347
- // site/source/docs/api_reference/preamble.js.rst
348
- // A prebuilt local version of the documentation is available at:
349
- // site/build/text/docs/api_reference/preamble.js.txt
350
- // You can also build docs locally as HTML or other formats in site/
351
- // An online HTML version (which may be of a different version of Emscripten)
352
- // is up at http://kripken.github.io/emscripten-site/docs/api_reference/preamble.js.html
353
-
354
- var wasmBinary;
355
- if (Module['wasmBinary']) wasmBinary = Module['wasmBinary'];legacyModuleProp('wasmBinary', 'wasmBinary');
356
- var noExitRuntime = Module['noExitRuntime'] || true;legacyModuleProp('noExitRuntime', 'noExitRuntime');
357
-
358
- if (typeof WebAssembly != 'object') {
359
- abort('no native wasm support detected');
360
- }
361
-
362
- // Wasm globals
363
-
364
- var wasmMemory;
365
-
366
- //========================================
367
- // Runtime essentials
368
- //========================================
369
-
370
- // whether we are quitting the application. no code should run after this.
371
- // set in exit() and abort()
372
- var ABORT = false;
373
-
374
- // set by exit() and abort(). Passed to 'onExit' handler.
375
- // NOTE: This is also used as the process return code code in shell environments
376
- // but only when noExitRuntime is false.
377
- var EXITSTATUS;
378
-
379
- /** @type {function(*, string=)} */
380
- function assert(condition, text) {
381
- if (!condition) {
382
- abort('Assertion failed' + (text ? ': ' + text : ''));
383
- }
384
- }
385
-
386
- // We used to include malloc/free by default in the past. Show a helpful error in
387
- // builds with assertions.
388
-
389
- // include: runtime_strings.js
390
- // runtime_strings.js: String related runtime functions that are part of both
391
- // MINIMAL_RUNTIME and regular runtime.
392
-
393
- var UTF8Decoder = typeof TextDecoder != 'undefined' ? new TextDecoder('utf8') : undefined;
394
-
395
- /**
396
- * Given a pointer 'idx' to a null-terminated UTF8-encoded string in the given
397
- * array that contains uint8 values, returns a copy of that string as a
398
- * Javascript String object.
399
- * heapOrArray is either a regular array, or a JavaScript typed array view.
400
- * @param {number} idx
401
- * @param {number=} maxBytesToRead
402
- * @return {string}
403
- */
404
- function UTF8ArrayToString(heapOrArray, idx, maxBytesToRead) {
405
- var endIdx = idx + maxBytesToRead;
406
- var endPtr = idx;
407
- // TextDecoder needs to know the byte length in advance, it doesn't stop on
408
- // null terminator by itself. Also, use the length info to avoid running tiny
409
- // strings through TextDecoder, since .subarray() allocates garbage.
410
- // (As a tiny code save trick, compare endPtr against endIdx using a negation,
411
- // so that undefined means Infinity)
412
- while (heapOrArray[endPtr] && !(endPtr >= endIdx)) ++endPtr;
413
-
414
- if (endPtr - idx > 16 && heapOrArray.buffer && UTF8Decoder) {
415
- return UTF8Decoder.decode(heapOrArray.subarray(idx, endPtr));
416
- }
417
- var str = '';
418
- // If building with TextDecoder, we have already computed the string length
419
- // above, so test loop end condition against that
420
- while (idx < endPtr) {
421
- // For UTF8 byte structure, see:
422
- // http://en.wikipedia.org/wiki/UTF-8#Description
423
- // https://www.ietf.org/rfc/rfc2279.txt
424
- // https://tools.ietf.org/html/rfc3629
425
- var u0 = heapOrArray[idx++];
426
- if (!(u0 & 0x80)) { str += String.fromCharCode(u0); continue; }
427
- var u1 = heapOrArray[idx++] & 63;
428
- if ((u0 & 0xE0) == 0xC0) { str += String.fromCharCode(((u0 & 31) << 6) | u1); continue; }
429
- var u2 = heapOrArray[idx++] & 63;
430
- if ((u0 & 0xF0) == 0xE0) {
431
- u0 = ((u0 & 15) << 12) | (u1 << 6) | u2;
432
- } else {
433
- if ((u0 & 0xF8) != 0xF0) warnOnce('Invalid UTF-8 leading byte ' + ptrToString(u0) + ' encountered when deserializing a UTF-8 string in wasm memory to a JS string!');
434
- u0 = ((u0 & 7) << 18) | (u1 << 12) | (u2 << 6) | (heapOrArray[idx++] & 63);
435
- }
436
-
437
- if (u0 < 0x10000) {
438
- str += String.fromCharCode(u0);
439
- } else {
440
- var ch = u0 - 0x10000;
441
- str += String.fromCharCode(0xD800 | (ch >> 10), 0xDC00 | (ch & 0x3FF));
442
- }
443
- }
444
- return str;
445
- }
446
-
447
- /**
448
- * Given a pointer 'ptr' to a null-terminated UTF8-encoded string in the
449
- * emscripten HEAP, returns a copy of that string as a Javascript String object.
450
- *
451
- * @param {number} ptr
452
- * @param {number=} maxBytesToRead - An optional length that specifies the
453
- * maximum number of bytes to read. You can omit this parameter to scan the
454
- * string until the first \0 byte. If maxBytesToRead is passed, and the string
455
- * at [ptr, ptr+maxBytesToReadr[ contains a null byte in the middle, then the
456
- * string will cut short at that byte index (i.e. maxBytesToRead will not
457
- * produce a string of exact length [ptr, ptr+maxBytesToRead[) N.B. mixing
458
- * frequent uses of UTF8ToString() with and without maxBytesToRead may throw
459
- * JS JIT optimizations off, so it is worth to consider consistently using one
460
- * @return {string}
461
- */
462
- function UTF8ToString(ptr, maxBytesToRead) {
463
- assert(typeof ptr == 'number');
464
- return ptr ? UTF8ArrayToString(HEAPU8, ptr, maxBytesToRead) : '';
465
- }
466
-
467
- /**
468
- * Copies the given Javascript String object 'str' to the given byte array at
469
- * address 'outIdx', encoded in UTF8 form and null-terminated. The copy will
470
- * require at most str.length*4+1 bytes of space in the HEAP. Use the function
471
- * lengthBytesUTF8 to compute the exact number of bytes (excluding null
472
- * terminator) that this function will write.
473
- *
474
- * @param {string} str - The Javascript string to copy.
475
- * @param {ArrayBufferView|Array<number>} heap - The array to copy to. Each
476
- * index in this array is assumed
477
- * to be one 8-byte element.
478
- * @param {number} outIdx - The starting offset in the array to begin the copying.
479
- * @param {number} maxBytesToWrite - The maximum number of bytes this function
480
- * can write to the array. This count should
481
- * include the null terminator, i.e. if
482
- * maxBytesToWrite=1, only the null terminator
483
- * will be written and nothing else.
484
- * maxBytesToWrite=0 does not write any bytes
485
- * to the output, not even the null
486
- * terminator.
487
- * @return {number} The number of bytes written, EXCLUDING the null terminator.
488
- */
489
- function stringToUTF8Array(str, heap, outIdx, maxBytesToWrite) {
490
- // Parameter maxBytesToWrite is not optional. Negative values, 0, null,
491
- // undefined and false each don't write out any bytes.
492
- if (!(maxBytesToWrite > 0))
493
- return 0;
494
-
495
- var startIdx = outIdx;
496
- var endIdx = outIdx + maxBytesToWrite - 1; // -1 for string null terminator.
497
- for (var i = 0; i < str.length; ++i) {
498
- // Gotcha: charCodeAt returns a 16-bit word that is a UTF-16 encoded code
499
- // unit, not a Unicode code point of the character! So decode
500
- // UTF16->UTF32->UTF8.
501
- // See http://unicode.org/faq/utf_bom.html#utf16-3
502
- // For UTF8 byte structure, see http://en.wikipedia.org/wiki/UTF-8#Description
503
- // and https://www.ietf.org/rfc/rfc2279.txt
504
- // and https://tools.ietf.org/html/rfc3629
505
- var u = str.charCodeAt(i); // possibly a lead surrogate
506
- if (u >= 0xD800 && u <= 0xDFFF) {
507
- var u1 = str.charCodeAt(++i);
508
- u = 0x10000 + ((u & 0x3FF) << 10) | (u1 & 0x3FF);
509
- }
510
- if (u <= 0x7F) {
511
- if (outIdx >= endIdx) break;
512
- heap[outIdx++] = u;
513
- } else if (u <= 0x7FF) {
514
- if (outIdx + 1 >= endIdx) break;
515
- heap[outIdx++] = 0xC0 | (u >> 6);
516
- heap[outIdx++] = 0x80 | (u & 63);
517
- } else if (u <= 0xFFFF) {
518
- if (outIdx + 2 >= endIdx) break;
519
- heap[outIdx++] = 0xE0 | (u >> 12);
520
- heap[outIdx++] = 0x80 | ((u >> 6) & 63);
521
- heap[outIdx++] = 0x80 | (u & 63);
522
- } else {
523
- if (outIdx + 3 >= endIdx) break;
524
- if (u > 0x10FFFF) warnOnce('Invalid Unicode code point ' + ptrToString(u) + ' encountered when serializing a JS string to a UTF-8 string in wasm memory! (Valid unicode code points should be in range 0-0x10FFFF).');
525
- heap[outIdx++] = 0xF0 | (u >> 18);
526
- heap[outIdx++] = 0x80 | ((u >> 12) & 63);
527
- heap[outIdx++] = 0x80 | ((u >> 6) & 63);
528
- heap[outIdx++] = 0x80 | (u & 63);
529
- }
530
- }
531
- // Null-terminate the pointer to the buffer.
532
- heap[outIdx] = 0;
533
- return outIdx - startIdx;
534
- }
535
-
536
- /**
537
- * Copies the given Javascript String object 'str' to the emscripten HEAP at
538
- * address 'outPtr', null-terminated and encoded in UTF8 form. The copy will
539
- * require at most str.length*4+1 bytes of space in the HEAP.
540
- * Use the function lengthBytesUTF8 to compute the exact number of bytes
541
- * (excluding null terminator) that this function will write.
542
- *
543
- * @return {number} The number of bytes written, EXCLUDING the null terminator.
544
- */
545
- function stringToUTF8(str, outPtr, maxBytesToWrite) {
546
- assert(typeof maxBytesToWrite == 'number', 'stringToUTF8(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!');
547
- return stringToUTF8Array(str, HEAPU8,outPtr, maxBytesToWrite);
548
- }
549
-
550
- /**
551
- * Returns the number of bytes the given Javascript string takes if encoded as a
552
- * UTF8 byte array, EXCLUDING the null terminator byte.
553
- *
554
- * @param {string} str - JavaScript string to operator on
555
- * @return {number} Length, in bytes, of the UTF8 encoded string.
556
- */
557
- function lengthBytesUTF8(str) {
558
- var len = 0;
559
- for (var i = 0; i < str.length; ++i) {
560
- // Gotcha: charCodeAt returns a 16-bit word that is a UTF-16 encoded code
561
- // unit, not a Unicode code point of the character! So decode
562
- // UTF16->UTF32->UTF8.
563
- // See http://unicode.org/faq/utf_bom.html#utf16-3
564
- var c = str.charCodeAt(i); // possibly a lead surrogate
565
- if (c <= 0x7F) {
566
- len++;
567
- } else if (c <= 0x7FF) {
568
- len += 2;
569
- } else if (c >= 0xD800 && c <= 0xDFFF) {
570
- len += 4; ++i;
571
- } else {
572
- len += 3;
573
- }
574
- }
575
- return len;
576
- }
577
-
578
- // end include: runtime_strings.js
579
- // Memory management
580
-
581
- var HEAP,
582
- /** @type {!Int8Array} */
583
- HEAP8,
584
- /** @type {!Uint8Array} */
585
- HEAPU8,
586
- /** @type {!Int16Array} */
587
- HEAP16,
588
- /** @type {!Uint16Array} */
589
- HEAPU16,
590
- /** @type {!Int32Array} */
591
- HEAP32,
592
- /** @type {!Uint32Array} */
593
- HEAPU32,
594
- /** @type {!Float32Array} */
595
- HEAPF32,
596
- /** @type {!Float64Array} */
597
- HEAPF64;
598
-
599
- function updateMemoryViews() {
600
- var b = wasmMemory.buffer;
601
- Module['HEAP8'] = HEAP8 = new Int8Array(b);
602
- Module['HEAP16'] = HEAP16 = new Int16Array(b);
603
- Module['HEAP32'] = HEAP32 = new Int32Array(b);
604
- Module['HEAPU8'] = HEAPU8 = new Uint8Array(b);
605
- Module['HEAPU16'] = HEAPU16 = new Uint16Array(b);
606
- Module['HEAPU32'] = HEAPU32 = new Uint32Array(b);
607
- Module['HEAPF32'] = HEAPF32 = new Float32Array(b);
608
- Module['HEAPF64'] = HEAPF64 = new Float64Array(b);
609
- }
610
-
611
- assert(!Module['STACK_SIZE'], 'STACK_SIZE can no longer be set at runtime. Use -sSTACK_SIZE at link time')
612
-
613
- assert(typeof Int32Array != 'undefined' && typeof Float64Array !== 'undefined' && Int32Array.prototype.subarray != undefined && Int32Array.prototype.set != undefined,
614
- 'JS engine does not provide full typed array support');
615
-
616
- // If memory is defined in wasm, the user can't provide it, or set INITIAL_MEMORY
617
- assert(!Module['wasmMemory'], 'Use of `wasmMemory` detected. Use -sIMPORTED_MEMORY to define wasmMemory externally');
618
- assert(!Module['INITIAL_MEMORY'], 'Detected runtime INITIAL_MEMORY setting. Use -sIMPORTED_MEMORY to define wasmMemory dynamically');
619
-
620
- // include: runtime_init_table.js
621
- // In regular non-RELOCATABLE mode the table is exported
622
- // from the wasm module and this will be assigned once
623
- // the exports are available.
624
- var wasmTable;
625
-
626
- // end include: runtime_init_table.js
627
- // include: runtime_stack_check.js
628
- // Initializes the stack cookie. Called at the startup of main and at the startup of each thread in pthreads mode.
629
- function writeStackCookie() {
630
- var max = _emscripten_stack_get_end();
631
- assert((max & 3) == 0);
632
- // If the stack ends at address zero we write our cookies 4 bytes into the
633
- // stack. This prevents interference with the (separate) address-zero check
634
- // below.
635
- if (max == 0) {
636
- max += 4;
637
- }
638
- // The stack grow downwards towards _emscripten_stack_get_end.
639
- // We write cookies to the final two words in the stack and detect if they are
640
- // ever overwritten.
641
- HEAPU32[((max)>>2)] = 0x02135467;
642
- HEAPU32[(((max)+(4))>>2)] = 0x89BACDFE;
643
- // Also test the global address 0 for integrity.
644
- HEAPU32[0] = 0x63736d65; /* 'emsc' */
645
- }
646
-
647
- function checkStackCookie() {
648
- if (ABORT) return;
649
- var max = _emscripten_stack_get_end();
650
- // See writeStackCookie().
651
- if (max == 0) {
652
- max += 4;
653
- }
654
- var cookie1 = HEAPU32[((max)>>2)];
655
- var cookie2 = HEAPU32[(((max)+(4))>>2)];
656
- if (cookie1 != 0x02135467 || cookie2 != 0x89BACDFE) {
657
- abort('Stack overflow! Stack cookie has been overwritten at ' + ptrToString(max) + ', expected hex dwords 0x89BACDFE and 0x2135467, but received ' + ptrToString(cookie2) + ' ' + ptrToString(cookie1));
658
- }
659
- // Also test the global address 0 for integrity.
660
- if (HEAPU32[0] !== 0x63736d65 /* 'emsc' */) {
661
- abort('Runtime error: The application has corrupted its heap memory area (address zero)!');
662
- }
663
- }
664
-
665
- // end include: runtime_stack_check.js
666
- // include: runtime_assertions.js
667
- // Endianness check
668
- (function() {
669
- var h16 = new Int16Array(1);
670
- var h8 = new Int8Array(h16.buffer);
671
- h16[0] = 0x6373;
672
- if (h8[0] !== 0x73 || h8[1] !== 0x63) throw 'Runtime error: expected the system to be little-endian! (Run with -sSUPPORT_BIG_ENDIAN to bypass)';
673
- })();
674
-
675
- // end include: runtime_assertions.js
676
- var __ATPRERUN__ = []; // functions called before the runtime is initialized
677
- var __ATINIT__ = []; // functions called during startup
678
- var __ATEXIT__ = []; // functions called during shutdown
679
- var __ATPOSTRUN__ = []; // functions called after the main() is called
680
-
681
- var runtimeInitialized = false;
682
-
683
- var runtimeKeepaliveCounter = 0;
684
-
685
- function keepRuntimeAlive() {
686
- return noExitRuntime || runtimeKeepaliveCounter > 0;
687
- }
688
-
689
- function preRun() {
690
- if (Module['preRun']) {
691
- if (typeof Module['preRun'] == 'function') Module['preRun'] = [Module['preRun']];
692
- while (Module['preRun'].length) {
693
- addOnPreRun(Module['preRun'].shift());
694
- }
695
- }
696
- callRuntimeCallbacks(__ATPRERUN__);
697
- }
698
-
699
- function initRuntime() {
700
- assert(!runtimeInitialized);
701
- runtimeInitialized = true;
702
-
703
- checkStackCookie();
704
-
705
-
706
- callRuntimeCallbacks(__ATINIT__);
707
- }
708
-
709
- function postRun() {
710
- checkStackCookie();
711
-
712
- if (Module['postRun']) {
713
- if (typeof Module['postRun'] == 'function') Module['postRun'] = [Module['postRun']];
714
- while (Module['postRun'].length) {
715
- addOnPostRun(Module['postRun'].shift());
716
- }
717
- }
718
-
719
- callRuntimeCallbacks(__ATPOSTRUN__);
720
- }
721
-
722
- function addOnPreRun(cb) {
723
- __ATPRERUN__.unshift(cb);
724
- }
725
-
726
- function addOnInit(cb) {
727
- __ATINIT__.unshift(cb);
728
- }
729
-
730
- function addOnExit(cb) {
731
- }
732
-
733
- function addOnPostRun(cb) {
734
- __ATPOSTRUN__.unshift(cb);
735
- }
736
-
737
- // include: runtime_math.js
738
- // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/imul
739
-
740
- // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/fround
741
-
742
- // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/clz32
743
-
744
- // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/trunc
745
-
746
- assert(Math.imul, 'This browser does not support Math.imul(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill');
747
- assert(Math.fround, 'This browser does not support Math.fround(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill');
748
- assert(Math.clz32, 'This browser does not support Math.clz32(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill');
749
- assert(Math.trunc, 'This browser does not support Math.trunc(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill');
750
-
751
- // end include: runtime_math.js
752
- // A counter of dependencies for calling run(). If we need to
753
- // do asynchronous work before running, increment this and
754
- // decrement it. Incrementing must happen in a place like
755
- // Module.preRun (used by emcc to add file preloading).
756
- // Note that you can add dependencies in preRun, even though
757
- // it happens right before run - run will be postponed until
758
- // the dependencies are met.
759
- var runDependencies = 0;
760
- var runDependencyWatcher = null;
761
- var dependenciesFulfilled = null; // overridden to take different actions when all run dependencies are fulfilled
762
- var runDependencyTracking = {};
763
-
764
- function getUniqueRunDependency(id) {
765
- var orig = id;
766
- while (1) {
767
- if (!runDependencyTracking[id]) return id;
768
- id = orig + Math.random();
769
- }
770
- }
771
-
772
- function addRunDependency(id) {
773
- runDependencies++;
774
-
775
- if (Module['monitorRunDependencies']) {
776
- Module['monitorRunDependencies'](runDependencies);
777
- }
778
-
779
- if (id) {
780
- assert(!runDependencyTracking[id]);
781
- runDependencyTracking[id] = 1;
782
- if (runDependencyWatcher === null && typeof setInterval != 'undefined') {
783
- // Check for missing dependencies every few seconds
784
- runDependencyWatcher = setInterval(function() {
785
- if (ABORT) {
786
- clearInterval(runDependencyWatcher);
787
- runDependencyWatcher = null;
788
- return;
789
- }
790
- var shown = false;
791
- for (var dep in runDependencyTracking) {
792
- if (!shown) {
793
- shown = true;
794
- err('still waiting on run dependencies:');
795
- }
796
- err('dependency: ' + dep);
797
- }
798
- if (shown) {
799
- err('(end of list)');
800
- }
801
- }, 10000);
802
- }
803
- } else {
804
- err('warning: run dependency added without ID');
805
- }
806
- }
807
-
808
- function removeRunDependency(id) {
809
- runDependencies--;
810
-
811
- if (Module['monitorRunDependencies']) {
812
- Module['monitorRunDependencies'](runDependencies);
813
- }
814
-
815
- if (id) {
816
- assert(runDependencyTracking[id]);
817
- delete runDependencyTracking[id];
818
- } else {
819
- err('warning: run dependency removed without ID');
820
- }
821
- if (runDependencies == 0) {
822
- if (runDependencyWatcher !== null) {
823
- clearInterval(runDependencyWatcher);
824
- runDependencyWatcher = null;
825
- }
826
- if (dependenciesFulfilled) {
827
- var callback = dependenciesFulfilled;
828
- dependenciesFulfilled = null;
829
- callback(); // can add another dependenciesFulfilled
830
- }
831
- }
832
- }
833
-
834
- /** @param {string|number=} what */
835
- function abort(what) {
836
- if (Module['onAbort']) {
837
- Module['onAbort'](what);
838
- }
839
-
840
- what = 'Aborted(' + what + ')';
841
- // TODO(sbc): Should we remove printing and leave it up to whoever
842
- // catches the exception?
843
- err(what);
844
-
845
- ABORT = true;
846
- EXITSTATUS = 1;
847
-
848
- // Use a wasm runtime error, because a JS error might be seen as a foreign
849
- // exception, which means we'd run destructors on it. We need the error to
850
- // simply make the program stop.
851
- // FIXME This approach does not work in Wasm EH because it currently does not assume
852
- // all RuntimeErrors are from traps; it decides whether a RuntimeError is from
853
- // a trap or not based on a hidden field within the object. So at the moment
854
- // we don't have a way of throwing a wasm trap from JS. TODO Make a JS API that
855
- // allows this in the wasm spec.
856
-
857
- // Suppress closure compiler warning here. Closure compiler's builtin extern
858
- // defintion for WebAssembly.RuntimeError claims it takes no arguments even
859
- // though it can.
860
- // TODO(https://github.com/google/closure-compiler/pull/3913): Remove if/when upstream closure gets fixed.
861
- /** @suppress {checkTypes} */
862
- var e = new WebAssembly.RuntimeError(what);
863
-
864
- readyPromiseReject(e);
865
- // Throw the error whether or not MODULARIZE is set because abort is used
866
- // in code paths apart from instantiation where an exception is expected
867
- // to be thrown when abort is called.
868
- throw e;
869
- }
870
-
871
- // include: memoryprofiler.js
872
- // end include: memoryprofiler.js
873
- // show errors on likely calls to FS when it was not included
874
- var FS = {
875
- error: function() {
876
- abort('Filesystem support (FS) was not included. The problem is that you are using files from JS, but files were not used from C/C++, so filesystem support was not auto-included. You can force-include filesystem support with -sFORCE_FILESYSTEM');
877
- },
878
- init: function() { FS.error() },
879
- createDataFile: function() { FS.error() },
880
- createPreloadedFile: function() { FS.error() },
881
- createLazyFile: function() { FS.error() },
882
- open: function() { FS.error() },
883
- mkdev: function() { FS.error() },
884
- registerDevice: function() { FS.error() },
885
- analyzePath: function() { FS.error() },
886
- loadFilesFromDB: function() { FS.error() },
887
-
888
- ErrnoError: function ErrnoError() { FS.error() },
889
- };
890
- Module['FS_createDataFile'] = FS.createDataFile;
891
- Module['FS_createPreloadedFile'] = FS.createPreloadedFile;
892
-
893
- // include: URIUtils.js
894
- // Prefix of data URIs emitted by SINGLE_FILE and related options.
895
- var dataURIPrefix = 'data:application/octet-stream;base64,';
896
-
897
- // Indicates whether filename is a base64 data URI.
898
- function isDataURI(filename) {
899
- // Prefix of data URIs emitted by SINGLE_FILE and related options.
900
- return filename.startsWith(dataURIPrefix);
901
- }
902
-
903
- // Indicates whether filename is delivered via file protocol (as opposed to http/https)
904
- function isFileURI(filename) {
905
- return filename.startsWith('file://');
906
- }
907
-
908
- // end include: URIUtils.js
909
- /** @param {boolean=} fixedasm */
910
- function createExportWrapper(name, fixedasm) {
911
- return function() {
912
- var displayName = name;
913
- var asm = fixedasm;
914
- if (!fixedasm) {
915
- asm = Module['asm'];
916
- }
917
- assert(runtimeInitialized, 'native function `' + displayName + '` called before runtime initialization');
918
- if (!asm[name]) {
919
- assert(asm[name], 'exported native function `' + displayName + '` not found');
920
- }
921
- return asm[name].apply(null, arguments);
922
- };
923
- }
924
-
925
- // include: runtime_exceptions.js
926
- // end include: runtime_exceptions.js
927
- var wasmBinaryFile;
928
- wasmBinaryFile = 'index.wasm';
929
- if (!isDataURI(wasmBinaryFile)) {
930
- wasmBinaryFile = locateFile(wasmBinaryFile);
931
- }
932
-
933
- function getBinary(file) {
934
- try {
935
- if (file == wasmBinaryFile && wasmBinary) {
936
- return new Uint8Array(wasmBinary);
937
- }
938
- if (readBinary) {
939
- return readBinary(file);
940
- }
941
- throw "both async and sync fetching of the wasm failed";
942
- }
943
- catch (err) {
944
- abort(err);
945
- }
946
- }
947
-
948
- function getBinaryPromise(binaryFile) {
949
- // If we don't have the binary yet, try to to load it asynchronously.
950
- // Fetch has some additional restrictions over XHR, like it can't be used on a file:// url.
951
- // See https://github.com/github/fetch/pull/92#issuecomment-140665932
952
- // Cordova or Electron apps are typically loaded from a file:// url.
953
- // So use fetch if it is available and the url is not a file, otherwise fall back to XHR.
954
- if (!wasmBinary && (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER)) {
955
- if (typeof fetch == 'function'
956
- ) {
957
- return fetch(binaryFile, { credentials: 'same-origin' }).then(function(response) {
958
- if (!response['ok']) {
959
- throw "failed to load wasm binary file at '" + binaryFile + "'";
960
- }
961
- return response['arrayBuffer']();
962
- }).catch(function () {
963
- return getBinary(binaryFile);
964
- });
965
- }
966
- }
967
-
968
- // Otherwise, getBinary should be able to get it synchronously
969
- return Promise.resolve().then(function() { return getBinary(binaryFile); });
970
- }
971
-
972
- function instantiateArrayBuffer(binaryFile, imports, receiver) {
973
- return getBinaryPromise(binaryFile).then(function(binary) {
974
- return WebAssembly.instantiate(binary, imports);
975
- }).then(function (instance) {
976
- return instance;
977
- }).then(receiver, function(reason) {
978
- err('failed to asynchronously prepare wasm: ' + reason);
979
-
980
- // Warn on some common problems.
981
- if (isFileURI(wasmBinaryFile)) {
982
- err('warning: Loading from a file URI (' + wasmBinaryFile + ') is not supported in most browsers. See https://emscripten.org/docs/getting_started/FAQ.html#how-do-i-run-a-local-webserver-for-testing-why-does-my-program-stall-in-downloading-or-preparing');
983
- }
984
- abort(reason);
985
- });
986
- }
987
-
988
- function instantiateAsync(binary, binaryFile, imports, callback) {
989
- if (!binary &&
990
- typeof WebAssembly.instantiateStreaming == 'function' &&
991
- !isDataURI(binaryFile) &&
992
- // Avoid instantiateStreaming() on Node.js environment for now, as while
993
- // Node.js v18.1.0 implements it, it does not have a full fetch()
994
- // implementation yet.
995
- //
996
- // Reference:
997
- // https://github.com/emscripten-core/emscripten/pull/16917
998
- !ENVIRONMENT_IS_NODE &&
999
- typeof fetch == 'function') {
1000
- return fetch(binaryFile, { credentials: 'same-origin' }).then(function(response) {
1001
- // Suppress closure warning here since the upstream definition for
1002
- // instantiateStreaming only allows Promise<Repsponse> rather than
1003
- // an actual Response.
1004
- // TODO(https://github.com/google/closure-compiler/pull/3913): Remove if/when upstream closure is fixed.
1005
- /** @suppress {checkTypes} */
1006
- var result = WebAssembly.instantiateStreaming(response, imports);
1007
-
1008
- return result.then(
1009
- callback,
1010
- function(reason) {
1011
- // We expect the most common failure cause to be a bad MIME type for the binary,
1012
- // in which case falling back to ArrayBuffer instantiation should work.
1013
- err('wasm streaming compile failed: ' + reason);
1014
- err('falling back to ArrayBuffer instantiation');
1015
- return instantiateArrayBuffer(binaryFile, imports, callback);
1016
- });
1017
- });
1018
- } else {
1019
- return instantiateArrayBuffer(binaryFile, imports, callback);
1020
- }
1021
- }
1022
-
1023
- // Create the wasm instance.
1024
- // Receives the wasm imports, returns the exports.
1025
- function createWasm() {
1026
- // prepare imports
1027
- var info = {
1028
- 'env': wasmImports,
1029
- 'wasi_snapshot_preview1': wasmImports,
1030
- };
1031
- // Load the wasm module and create an instance of using native support in the JS engine.
1032
- // handle a generated wasm instance, receiving its exports and
1033
- // performing other necessary setup
1034
- /** @param {WebAssembly.Module=} module*/
1035
- function receiveInstance(instance, module) {
1036
- var exports = instance.exports;
1037
-
1038
- Module['asm'] = exports;
1039
-
1040
- wasmMemory = Module['asm']['memory'];
1041
- assert(wasmMemory, "memory not found in wasm exports");
1042
- // This assertion doesn't hold when emscripten is run in --post-link
1043
- // mode.
1044
- // TODO(sbc): Read INITIAL_MEMORY out of the wasm file in post-link mode.
1045
- //assert(wasmMemory.buffer.byteLength === 16777216);
1046
- updateMemoryViews();
1047
-
1048
- wasmTable = Module['asm']['__indirect_function_table'];
1049
- assert(wasmTable, "table not found in wasm exports");
1050
-
1051
- addOnInit(Module['asm']['__wasm_call_ctors']);
1052
-
1053
- removeRunDependency('wasm-instantiate');
1054
-
1055
- return exports;
1056
- }
1057
- // wait for the pthread pool (if any)
1058
- addRunDependency('wasm-instantiate');
1059
-
1060
- // Prefer streaming instantiation if available.
1061
- // Async compilation can be confusing when an error on the page overwrites Module
1062
- // (for example, if the order of elements is wrong, and the one defining Module is
1063
- // later), so we save Module and check it later.
1064
- var trueModule = Module;
1065
- function receiveInstantiationResult(result) {
1066
- // 'result' is a ResultObject object which has both the module and instance.
1067
- // receiveInstance() will swap in the exports (to Module.asm) so they can be called
1068
- assert(Module === trueModule, 'the Module object should not be replaced during async compilation - perhaps the order of HTML elements is wrong?');
1069
- trueModule = null;
1070
- // TODO: Due to Closure regression https://github.com/google/closure-compiler/issues/3193, the above line no longer optimizes out down to the following line.
1071
- // When the regression is fixed, can restore the above PTHREADS-enabled path.
1072
- receiveInstance(result['instance']);
1073
- }
1074
-
1075
- // User shell pages can write their own Module.instantiateWasm = function(imports, successCallback) callback
1076
- // to manually instantiate the Wasm module themselves. This allows pages to run the instantiation parallel
1077
- // to any other async startup actions they are performing.
1078
- // Also pthreads and wasm workers initialize the wasm instance through this path.
1079
- if (Module['instantiateWasm']) {
1080
- try {
1081
- return Module['instantiateWasm'](info, receiveInstance);
1082
- } catch(e) {
1083
- err('Module.instantiateWasm callback failed with error: ' + e);
1084
- // If instantiation fails, reject the module ready promise.
1085
- readyPromiseReject(e);
1086
- }
1087
- }
1088
-
1089
- // If instantiation fails, reject the module ready promise.
1090
- instantiateAsync(wasmBinary, wasmBinaryFile, info, receiveInstantiationResult).catch(readyPromiseReject);
1091
- return {}; // no exports yet; we'll fill them in later
1092
- }
1093
-
1094
- // Globals used by JS i64 conversions (see makeSetValue)
1095
- var tempDouble;
1096
- var tempI64;
1097
-
1098
- // include: runtime_debug.js
1099
- function legacyModuleProp(prop, newName) {
1100
- if (!Object.getOwnPropertyDescriptor(Module, prop)) {
1101
- Object.defineProperty(Module, prop, {
1102
- configurable: true,
1103
- get: function() {
1104
- abort('Module.' + prop + ' has been replaced with plain ' + newName + ' (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)');
1105
- }
1106
- });
1107
- }
1108
- }
1109
-
1110
- function ignoredModuleProp(prop) {
1111
- if (Object.getOwnPropertyDescriptor(Module, prop)) {
1112
- abort('`Module.' + prop + '` was supplied but `' + prop + '` not included in INCOMING_MODULE_JS_API');
1113
- }
1114
- }
1115
-
1116
- // forcing the filesystem exports a few things by default
1117
- function isExportedByForceFilesystem(name) {
1118
- return name === 'FS_createPath' ||
1119
- name === 'FS_createDataFile' ||
1120
- name === 'FS_createPreloadedFile' ||
1121
- name === 'FS_unlink' ||
1122
- name === 'addRunDependency' ||
1123
- // The old FS has some functionality that WasmFS lacks.
1124
- name === 'FS_createLazyFile' ||
1125
- name === 'FS_createDevice' ||
1126
- name === 'removeRunDependency';
1127
- }
1128
-
1129
- function missingGlobal(sym, msg) {
1130
- if (typeof globalThis !== 'undefined') {
1131
- Object.defineProperty(globalThis, sym, {
1132
- configurable: true,
1133
- get: function() {
1134
- warnOnce('`' + sym + '` is not longer defined by emscripten. ' + msg);
1135
- return undefined;
1136
- }
1137
- });
1138
- }
1139
- }
1140
-
1141
- missingGlobal('buffer', 'Please use HEAP8.buffer or wasmMemory.buffer');
1142
-
1143
- function missingLibrarySymbol(sym) {
1144
- if (typeof globalThis !== 'undefined' && !Object.getOwnPropertyDescriptor(globalThis, sym)) {
1145
- Object.defineProperty(globalThis, sym, {
1146
- configurable: true,
1147
- get: function() {
1148
- // Can't `abort()` here because it would break code that does runtime
1149
- // checks. e.g. `if (typeof SDL === 'undefined')`.
1150
- var msg = '`' + sym + '` is a library symbol and not included by default; add it to your library.js __deps or to DEFAULT_LIBRARY_FUNCS_TO_INCLUDE on the command line';
1151
- // DEFAULT_LIBRARY_FUNCS_TO_INCLUDE requires the name as it appears in
1152
- // library.js, which means $name for a JS name with no prefix, or name
1153
- // for a JS name like _name.
1154
- var librarySymbol = sym;
1155
- if (!librarySymbol.startsWith('_')) {
1156
- librarySymbol = '$' + sym;
1157
- }
1158
- msg += " (e.g. -sDEFAULT_LIBRARY_FUNCS_TO_INCLUDE=" + librarySymbol + ")";
1159
- if (isExportedByForceFilesystem(sym)) {
1160
- msg += '. Alternatively, forcing filesystem support (-sFORCE_FILESYSTEM) can export this for you';
1161
- }
1162
- warnOnce(msg);
1163
- return undefined;
1164
- }
1165
- });
1166
- }
1167
- // Any symbol that is not included from the JS libary is also (by definition)
1168
- // not exported on the Module object.
1169
- unexportedRuntimeSymbol(sym);
1170
- }
1171
-
1172
- function unexportedRuntimeSymbol(sym) {
1173
- if (!Object.getOwnPropertyDescriptor(Module, sym)) {
1174
- Object.defineProperty(Module, sym, {
1175
- configurable: true,
1176
- get: function() {
1177
- var msg = "'" + sym + "' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)";
1178
- if (isExportedByForceFilesystem(sym)) {
1179
- msg += '. Alternatively, forcing filesystem support (-sFORCE_FILESYSTEM) can export this for you';
1180
- }
1181
- abort(msg);
1182
- }
1183
- });
1184
- }
1185
- }
1186
-
1187
- // Used by XXXXX_DEBUG settings to output debug messages.
1188
- function dbg(text) {
1189
- // TODO(sbc): Make this configurable somehow. Its not always convenient for
1190
- // logging to show up as errors.
1191
- console.error(text);
1192
- }
1193
-
1194
- // end include: runtime_debug.js
1195
- // === Body ===
1196
-
1197
-
1198
- // end include: preamble.js
1199
-
1200
- /** @constructor */
1201
- function ExitStatus(status) {
1202
- this.name = 'ExitStatus';
1203
- this.message = 'Program terminated with exit(' + status + ')';
1204
- this.status = status;
1205
- }
1206
-
1207
- function callRuntimeCallbacks(callbacks) {
1208
- while (callbacks.length > 0) {
1209
- // Pass the module as the first argument.
1210
- callbacks.shift()(Module);
1211
- }
1212
- }
1213
-
1214
-
1215
- /**
1216
- * @param {number} ptr
1217
- * @param {string} type
1218
- */
1219
- function getValue(ptr, type = 'i8') {
1220
- if (type.endsWith('*')) type = '*';
1221
- switch (type) {
1222
- case 'i1': return HEAP8[((ptr)>>0)];
1223
- case 'i8': return HEAP8[((ptr)>>0)];
1224
- case 'i16': return HEAP16[((ptr)>>1)];
1225
- case 'i32': return HEAP32[((ptr)>>2)];
1226
- case 'i64': return HEAP32[((ptr)>>2)];
1227
- case 'float': return HEAPF32[((ptr)>>2)];
1228
- case 'double': return HEAPF64[((ptr)>>3)];
1229
- case '*': return HEAPU32[((ptr)>>2)];
1230
- default: abort('invalid type for getValue: ' + type);
1231
- }
1232
- }
1233
-
1234
- function ptrToString(ptr) {
1235
- assert(typeof ptr === 'number');
1236
- return '0x' + ptr.toString(16).padStart(8, '0');
1237
- }
1238
-
1239
-
1240
- /**
1241
- * @param {number} ptr
1242
- * @param {number} value
1243
- * @param {string} type
1244
- */
1245
- function setValue(ptr, value, type = 'i8') {
1246
- if (type.endsWith('*')) type = '*';
1247
- switch (type) {
1248
- case 'i1': HEAP8[((ptr)>>0)] = value; break;
1249
- case 'i8': HEAP8[((ptr)>>0)] = value; break;
1250
- case 'i16': HEAP16[((ptr)>>1)] = value; break;
1251
- case 'i32': HEAP32[((ptr)>>2)] = value; break;
1252
- case 'i64': (tempI64 = [value>>>0,(tempDouble=value,(+(Math.abs(tempDouble))) >= 1.0 ? (tempDouble > 0.0 ? ((Math.min((+(Math.floor((tempDouble)/4294967296.0))), 4294967295.0))|0)>>>0 : (~~((+(Math.ceil((tempDouble - +(((~~(tempDouble)))>>>0))/4294967296.0)))))>>>0) : 0)],HEAP32[((ptr)>>2)] = tempI64[0],HEAP32[(((ptr)+(4))>>2)] = tempI64[1]); break;
1253
- case 'float': HEAPF32[((ptr)>>2)] = value; break;
1254
- case 'double': HEAPF64[((ptr)>>3)] = value; break;
1255
- case '*': HEAPU32[((ptr)>>2)] = value; break;
1256
- default: abort('invalid type for setValue: ' + type);
1257
- }
1258
- }
1259
-
1260
- function warnOnce(text) {
1261
- if (!warnOnce.shown) warnOnce.shown = {};
1262
- if (!warnOnce.shown[text]) {
1263
- warnOnce.shown[text] = 1;
1264
- if (ENVIRONMENT_IS_NODE) text = 'warning: ' + text;
1265
- err(text);
1266
- }
1267
- }
1268
-
1269
- function _abort() {
1270
- abort('native code called abort()');
1271
- }
1272
-
1273
- function _emscripten_memcpy_big(dest, src, num) {
1274
- HEAPU8.copyWithin(dest, src, src + num);
1275
- }
1276
-
1277
- function getHeapMax() {
1278
- return HEAPU8.length;
1279
- }
1280
-
1281
- function abortOnCannotGrowMemory(requestedSize) {
1282
- abort('Cannot enlarge memory arrays to size ' + requestedSize + ' bytes (OOM). Either (1) compile with -sINITIAL_MEMORY=X with X higher than the current value ' + HEAP8.length + ', (2) compile with -sALLOW_MEMORY_GROWTH which allows increasing the size at runtime, or (3) if you want malloc to return NULL (0) instead of this abort, compile with -sABORTING_MALLOC=0');
1283
- }
1284
- function _emscripten_resize_heap(requestedSize) {
1285
- var oldSize = HEAPU8.length;
1286
- requestedSize = requestedSize >>> 0;
1287
- abortOnCannotGrowMemory(requestedSize);
1288
- }
1289
-
1290
- var SYSCALLS = {varargs:undefined,get:function() {
1291
- assert(SYSCALLS.varargs != undefined);
1292
- SYSCALLS.varargs += 4;
1293
- var ret = HEAP32[(((SYSCALLS.varargs)-(4))>>2)];
1294
- return ret;
1295
- },getStr:function(ptr) {
1296
- var ret = UTF8ToString(ptr);
1297
- return ret;
1298
- }};
1299
- function _fd_close(fd) {
1300
- abort('fd_close called without SYSCALLS_REQUIRE_FILESYSTEM');
1301
- }
1302
-
1303
- function convertI32PairToI53Checked(lo, hi) {
1304
- assert(lo == (lo >>> 0) || lo == (lo|0)); // lo should either be a i32 or a u32
1305
- assert(hi === (hi|0)); // hi should be a i32
1306
- return ((hi + 0x200000) >>> 0 < 0x400001 - !!lo) ? (lo >>> 0) + hi * 4294967296 : NaN;
1307
- }
1308
-
1309
-
1310
-
1311
-
1312
- function _fd_seek(fd, offset_low, offset_high, whence, newOffset) {
1313
- return 70;
1314
- }
1315
-
1316
- var printCharBuffers = [null,[],[]];
1317
- function printChar(stream, curr) {
1318
- var buffer = printCharBuffers[stream];
1319
- assert(buffer);
1320
- if (curr === 0 || curr === 10) {
1321
- (stream === 1 ? out : err)(UTF8ArrayToString(buffer, 0));
1322
- buffer.length = 0;
1323
- } else {
1324
- buffer.push(curr);
1325
- }
1326
- }
1327
-
1328
- function flush_NO_FILESYSTEM() {
1329
- // flush anything remaining in the buffers during shutdown
1330
- _fflush(0);
1331
- if (printCharBuffers[1].length) printChar(1, 10);
1332
- if (printCharBuffers[2].length) printChar(2, 10);
1333
- }
1334
-
1335
-
1336
- function _fd_write(fd, iov, iovcnt, pnum) {
1337
- // hack to support printf in SYSCALLS_REQUIRE_FILESYSTEM=0
1338
- var num = 0;
1339
- for (var i = 0; i < iovcnt; i++) {
1340
- var ptr = HEAPU32[((iov)>>2)];
1341
- var len = HEAPU32[(((iov)+(4))>>2)];
1342
- iov += 8;
1343
- for (var j = 0; j < len; j++) {
1344
- printChar(fd, HEAPU8[ptr+j]);
1345
- }
1346
- num += len;
1347
- }
1348
- HEAPU32[((pnum)>>2)] = num;
1349
- return 0;
1350
- }
1351
- function checkIncomingModuleAPI() {
1352
- ignoredModuleProp('fetchSettings');
1353
- }
1354
- var wasmImports = {
1355
- "abort": _abort,
1356
- "emscripten_memcpy_big": _emscripten_memcpy_big,
1357
- "emscripten_resize_heap": _emscripten_resize_heap,
1358
- "fd_close": _fd_close,
1359
- "fd_seek": _fd_seek,
1360
- "fd_write": _fd_write
1361
- };
1362
- var asm = createWasm();
1363
- /** @type {function(...*):?} */
1364
- var ___wasm_call_ctors = createExportWrapper("__wasm_call_ctors");
1365
- /** @type {function(...*):?} */
1366
- var _opus_decoder_create = Module["_opus_decoder_create"] = createExportWrapper("opus_decoder_create");
1367
- /** @type {function(...*):?} */
1368
- var _opus_decode_float = Module["_opus_decode_float"] = createExportWrapper("opus_decode_float");
1369
- /** @type {function(...*):?} */
1370
- var _opus_decoder_destroy = Module["_opus_decoder_destroy"] = createExportWrapper("opus_decoder_destroy");
1371
- /** @type {function(...*):?} */
1372
- var _opus_encoder_create = Module["_opus_encoder_create"] = createExportWrapper("opus_encoder_create");
1373
- /** @type {function(...*):?} */
1374
- var _opus_encode_float = Module["_opus_encode_float"] = createExportWrapper("opus_encode_float");
1375
- /** @type {function(...*):?} */
1376
- var _opus_encoder_ctl = Module["_opus_encoder_ctl"] = createExportWrapper("opus_encoder_ctl");
1377
- /** @type {function(...*):?} */
1378
- var _opus_encoder_destroy = Module["_opus_encoder_destroy"] = createExportWrapper("opus_encoder_destroy");
1379
- /** @type {function(...*):?} */
1380
- var _size_of_int = Module["_size_of_int"] = createExportWrapper("size_of_int");
1381
- /** @type {function(...*):?} */
1382
- var _size_of_void_ptr = Module["_size_of_void_ptr"] = createExportWrapper("size_of_void_ptr");
1383
- /** @type {function(...*):?} */
1384
- var _opus_set_complexity = Module["_opus_set_complexity"] = createExportWrapper("opus_set_complexity");
1385
- /** @type {function(...*):?} */
1386
- var _opus_get_complexity = Module["_opus_get_complexity"] = createExportWrapper("opus_get_complexity");
1387
- /** @type {function(...*):?} */
1388
- var _opus_set_bitrate = Module["_opus_set_bitrate"] = createExportWrapper("opus_set_bitrate");
1389
- /** @type {function(...*):?} */
1390
- var _opus_get_bitrate = Module["_opus_get_bitrate"] = createExportWrapper("opus_get_bitrate");
1391
- /** @type {function(...*):?} */
1392
- var _opus_set_vbr = Module["_opus_set_vbr"] = createExportWrapper("opus_set_vbr");
1393
- /** @type {function(...*):?} */
1394
- var _opus_get_vbr = Module["_opus_get_vbr"] = createExportWrapper("opus_get_vbr");
1395
- /** @type {function(...*):?} */
1396
- var _opus_set_vbr_constraint = Module["_opus_set_vbr_constraint"] = createExportWrapper("opus_set_vbr_constraint");
1397
- /** @type {function(...*):?} */
1398
- var _opus_get_vbr_constraint = Module["_opus_get_vbr_constraint"] = createExportWrapper("opus_get_vbr_constraint");
1399
- /** @type {function(...*):?} */
1400
- var _opus_set_force_channels = Module["_opus_set_force_channels"] = createExportWrapper("opus_set_force_channels");
1401
- /** @type {function(...*):?} */
1402
- var _opus_get_force_channels = Module["_opus_get_force_channels"] = createExportWrapper("opus_get_force_channels");
1403
- /** @type {function(...*):?} */
1404
- var _opus_set_max_bandwidth = Module["_opus_set_max_bandwidth"] = createExportWrapper("opus_set_max_bandwidth");
1405
- /** @type {function(...*):?} */
1406
- var _opus_get_max_bandwidth = Module["_opus_get_max_bandwidth"] = createExportWrapper("opus_get_max_bandwidth");
1407
- /** @type {function(...*):?} */
1408
- var _opus_set_bandwidth = Module["_opus_set_bandwidth"] = createExportWrapper("opus_set_bandwidth");
1409
- /** @type {function(...*):?} */
1410
- var _opus_set_signal = Module["_opus_set_signal"] = createExportWrapper("opus_set_signal");
1411
- /** @type {function(...*):?} */
1412
- var _opus_get_signal = Module["_opus_get_signal"] = createExportWrapper("opus_get_signal");
1413
- /** @type {function(...*):?} */
1414
- var _opus_set_application = Module["_opus_set_application"] = createExportWrapper("opus_set_application");
1415
- /** @type {function(...*):?} */
1416
- var _opus_get_application = Module["_opus_get_application"] = createExportWrapper("opus_get_application");
1417
- /** @type {function(...*):?} */
1418
- var _opus_get_lookahead = Module["_opus_get_lookahead"] = createExportWrapper("opus_get_lookahead");
1419
- /** @type {function(...*):?} */
1420
- var _opus_set_inband_fec = Module["_opus_set_inband_fec"] = createExportWrapper("opus_set_inband_fec");
1421
- /** @type {function(...*):?} */
1422
- var _opus_get_inband_fec = Module["_opus_get_inband_fec"] = createExportWrapper("opus_get_inband_fec");
1423
- /** @type {function(...*):?} */
1424
- var _opus_set_packet_loss_perc = Module["_opus_set_packet_loss_perc"] = createExportWrapper("opus_set_packet_loss_perc");
1425
- /** @type {function(...*):?} */
1426
- var _opus_get_packet_loss_perc = Module["_opus_get_packet_loss_perc"] = createExportWrapper("opus_get_packet_loss_perc");
1427
- /** @type {function(...*):?} */
1428
- var _opus_set_dtx = Module["_opus_set_dtx"] = createExportWrapper("opus_set_dtx");
1429
- /** @type {function(...*):?} */
1430
- var _opus_get_dtx = Module["_opus_get_dtx"] = createExportWrapper("opus_get_dtx");
1431
- /** @type {function(...*):?} */
1432
- var _opus_set_lsb_depth = Module["_opus_set_lsb_depth"] = createExportWrapper("opus_set_lsb_depth");
1433
- /** @type {function(...*):?} */
1434
- var _opus_get_lsb_depth = Module["_opus_get_lsb_depth"] = createExportWrapper("opus_get_lsb_depth");
1435
- /** @type {function(...*):?} */
1436
- var _opus_set_expert_frame_duration = Module["_opus_set_expert_frame_duration"] = createExportWrapper("opus_set_expert_frame_duration");
1437
- /** @type {function(...*):?} */
1438
- var _opus_get_expert_frame_duration = Module["_opus_get_expert_frame_duration"] = createExportWrapper("opus_get_expert_frame_duration");
1439
- /** @type {function(...*):?} */
1440
- var _opus_set_prediction_disabled = Module["_opus_set_prediction_disabled"] = createExportWrapper("opus_set_prediction_disabled");
1441
- /** @type {function(...*):?} */
1442
- var _opus_get_prediction_disabled = Module["_opus_get_prediction_disabled"] = createExportWrapper("opus_get_prediction_disabled");
1443
- /** @type {function(...*):?} */
1444
- var _opus_get_bandwidth = Module["_opus_get_bandwidth"] = createExportWrapper("opus_get_bandwidth");
1445
- /** @type {function(...*):?} */
1446
- var _opus_get_sample_rate = Module["_opus_get_sample_rate"] = createExportWrapper("opus_get_sample_rate");
1447
- /** @type {function(...*):?} */
1448
- var _opus_set_phase_inversion_disabled = Module["_opus_set_phase_inversion_disabled"] = createExportWrapper("opus_set_phase_inversion_disabled");
1449
- /** @type {function(...*):?} */
1450
- var _opus_get_phase_inversion_disabled = Module["_opus_get_phase_inversion_disabled"] = createExportWrapper("opus_get_phase_inversion_disabled");
1451
- /** @type {function(...*):?} */
1452
- var _opus_get_in_dtx = Module["_opus_get_in_dtx"] = createExportWrapper("opus_get_in_dtx");
1453
- /** @type {function(...*):?} */
1454
- var _opus_set_gain = Module["_opus_set_gain"] = createExportWrapper("opus_set_gain");
1455
- /** @type {function(...*):?} */
1456
- var _opus_get_gain = Module["_opus_get_gain"] = createExportWrapper("opus_get_gain");
1457
- /** @type {function(...*):?} */
1458
- var _opus_get_last_packet_duration = Module["_opus_get_last_packet_duration"] = createExportWrapper("opus_get_last_packet_duration");
1459
- /** @type {function(...*):?} */
1460
- var _opus_get_pitch = Module["_opus_get_pitch"] = createExportWrapper("opus_get_pitch");
1461
- /** @type {function(...*):?} */
1462
- var ___errno_location = createExportWrapper("__errno_location");
1463
- /** @type {function(...*):?} */
1464
- var _fflush = Module["_fflush"] = createExportWrapper("fflush");
1465
- /** @type {function(...*):?} */
1466
- var _malloc = Module["_malloc"] = createExportWrapper("malloc");
1467
- /** @type {function(...*):?} */
1468
- var _free = Module["_free"] = createExportWrapper("free");
1469
- /** @type {function(...*):?} */
1470
- var _emscripten_stack_init = function() {
1471
- return (_emscripten_stack_init = Module["asm"]["emscripten_stack_init"]).apply(null, arguments);
1472
- };
1473
-
1474
- /** @type {function(...*):?} */
1475
- var _emscripten_stack_get_free = function() {
1476
- return (_emscripten_stack_get_free = Module["asm"]["emscripten_stack_get_free"]).apply(null, arguments);
1477
- };
1478
-
1479
- /** @type {function(...*):?} */
1480
- var _emscripten_stack_get_base = function() {
1481
- return (_emscripten_stack_get_base = Module["asm"]["emscripten_stack_get_base"]).apply(null, arguments);
1482
- };
1483
-
1484
- /** @type {function(...*):?} */
1485
- var _emscripten_stack_get_end = function() {
1486
- return (_emscripten_stack_get_end = Module["asm"]["emscripten_stack_get_end"]).apply(null, arguments);
1487
- };
1488
-
1489
- /** @type {function(...*):?} */
1490
- var stackSave = createExportWrapper("stackSave");
1491
- /** @type {function(...*):?} */
1492
- var stackRestore = createExportWrapper("stackRestore");
1493
- /** @type {function(...*):?} */
1494
- var stackAlloc = createExportWrapper("stackAlloc");
1495
- /** @type {function(...*):?} */
1496
- var _emscripten_stack_get_current = function() {
1497
- return (_emscripten_stack_get_current = Module["asm"]["emscripten_stack_get_current"]).apply(null, arguments);
1498
- };
1499
-
1500
- /** @type {function(...*):?} */
1501
- var dynCall_jiji = Module["dynCall_jiji"] = createExportWrapper("dynCall_jiji");
1502
-
1503
-
1504
- // include: postamble.js
1505
- // === Auto-generated postamble setup entry stuff ===
1506
-
1507
- var missingLibrarySymbols = [
1508
- 'zeroMemory',
1509
- 'stringToNewUTF8',
1510
- 'exitJS',
1511
- 'emscripten_realloc_buffer',
1512
- 'setErrNo',
1513
- 'inetPton4',
1514
- 'inetNtop4',
1515
- 'inetPton6',
1516
- 'inetNtop6',
1517
- 'readSockaddr',
1518
- 'writeSockaddr',
1519
- 'getHostByName',
1520
- 'getRandomDevice',
1521
- 'traverseStack',
1522
- 'convertPCtoSourceLocation',
1523
- 'readEmAsmArgs',
1524
- 'jstoi_q',
1525
- 'jstoi_s',
1526
- 'getExecutableName',
1527
- 'listenOnce',
1528
- 'autoResumeAudioContext',
1529
- 'dynCallLegacy',
1530
- 'getDynCaller',
1531
- 'dynCall',
1532
- 'handleException',
1533
- 'runtimeKeepalivePush',
1534
- 'runtimeKeepalivePop',
1535
- 'callUserCallback',
1536
- 'maybeExit',
1537
- 'safeSetTimeout',
1538
- 'asmjsMangle',
1539
- 'asyncLoad',
1540
- 'alignMemory',
1541
- 'mmapAlloc',
1542
- 'HandleAllocator',
1543
- 'getNativeTypeSize',
1544
- 'STACK_SIZE',
1545
- 'STACK_ALIGN',
1546
- 'POINTER_SIZE',
1547
- 'ASSERTIONS',
1548
- 'writeI53ToI64',
1549
- 'writeI53ToI64Clamped',
1550
- 'writeI53ToI64Signaling',
1551
- 'writeI53ToU64Clamped',
1552
- 'writeI53ToU64Signaling',
1553
- 'readI53FromI64',
1554
- 'readI53FromU64',
1555
- 'convertI32PairToI53',
1556
- 'convertU32PairToI53',
1557
- 'getCFunc',
1558
- 'ccall',
1559
- 'cwrap',
1560
- 'uleb128Encode',
1561
- 'sigToWasmTypes',
1562
- 'generateFuncType',
1563
- 'convertJsFunctionToWasm',
1564
- 'getEmptyTableSlot',
1565
- 'updateTableMap',
1566
- 'getFunctionAddress',
1567
- 'addFunction',
1568
- 'removeFunction',
1569
- 'reallyNegative',
1570
- 'unSign',
1571
- 'strLen',
1572
- 'reSign',
1573
- 'formatString',
1574
- 'intArrayFromString',
1575
- 'intArrayToString',
1576
- 'AsciiToString',
1577
- 'stringToAscii',
1578
- 'UTF16ToString',
1579
- 'stringToUTF16',
1580
- 'lengthBytesUTF16',
1581
- 'UTF32ToString',
1582
- 'stringToUTF32',
1583
- 'lengthBytesUTF32',
1584
- 'allocateUTF8',
1585
- 'allocateUTF8OnStack',
1586
- 'writeStringToMemory',
1587
- 'writeArrayToMemory',
1588
- 'writeAsciiToMemory',
1589
- 'getSocketFromFD',
1590
- 'getSocketAddress',
1591
- 'registerKeyEventCallback',
1592
- 'maybeCStringToJsString',
1593
- 'findEventTarget',
1594
- 'findCanvasEventTarget',
1595
- 'getBoundingClientRect',
1596
- 'fillMouseEventData',
1597
- 'registerMouseEventCallback',
1598
- 'registerWheelEventCallback',
1599
- 'registerUiEventCallback',
1600
- 'registerFocusEventCallback',
1601
- 'fillDeviceOrientationEventData',
1602
- 'registerDeviceOrientationEventCallback',
1603
- 'fillDeviceMotionEventData',
1604
- 'registerDeviceMotionEventCallback',
1605
- 'screenOrientation',
1606
- 'fillOrientationChangeEventData',
1607
- 'registerOrientationChangeEventCallback',
1608
- 'fillFullscreenChangeEventData',
1609
- 'registerFullscreenChangeEventCallback',
1610
- 'JSEvents_requestFullscreen',
1611
- 'JSEvents_resizeCanvasForFullscreen',
1612
- 'registerRestoreOldStyle',
1613
- 'hideEverythingExceptGivenElement',
1614
- 'restoreHiddenElements',
1615
- 'setLetterbox',
1616
- 'softFullscreenResizeWebGLRenderTarget',
1617
- 'doRequestFullscreen',
1618
- 'fillPointerlockChangeEventData',
1619
- 'registerPointerlockChangeEventCallback',
1620
- 'registerPointerlockErrorEventCallback',
1621
- 'requestPointerLock',
1622
- 'fillVisibilityChangeEventData',
1623
- 'registerVisibilityChangeEventCallback',
1624
- 'registerTouchEventCallback',
1625
- 'fillGamepadEventData',
1626
- 'registerGamepadEventCallback',
1627
- 'registerBeforeUnloadEventCallback',
1628
- 'fillBatteryEventData',
1629
- 'battery',
1630
- 'registerBatteryEventCallback',
1631
- 'setCanvasElementSize',
1632
- 'getCanvasElementSize',
1633
- 'demangle',
1634
- 'demangleAll',
1635
- 'jsStackTrace',
1636
- 'stackTrace',
1637
- 'getEnvStrings',
1638
- 'checkWasiClock',
1639
- 'createDyncallWrapper',
1640
- 'setImmediateWrapped',
1641
- 'clearImmediateWrapped',
1642
- 'polyfillSetImmediate',
1643
- 'getPromise',
1644
- 'makePromise',
1645
- 'makePromiseCallback',
1646
- 'ExceptionInfo',
1647
- 'exception_addRef',
1648
- 'exception_decRef',
1649
- 'setMainLoop',
1650
- '_setNetworkCallback',
1651
- 'heapObjectForWebGLType',
1652
- 'heapAccessShiftForWebGLHeap',
1653
- 'emscriptenWebGLGet',
1654
- 'computeUnpackAlignedImageSize',
1655
- 'emscriptenWebGLGetTexPixelData',
1656
- 'emscriptenWebGLGetUniform',
1657
- 'webglGetUniformLocation',
1658
- 'webglPrepareUniformLocationsBeforeFirstUse',
1659
- 'webglGetLeftBracePos',
1660
- 'emscriptenWebGLGetVertexAttrib',
1661
- 'writeGLArray',
1662
- 'SDL_unicode',
1663
- 'SDL_ttfContext',
1664
- 'SDL_audio',
1665
- 'GLFW_Window',
1666
- 'runAndAbortIfError',
1667
- 'ALLOC_NORMAL',
1668
- 'ALLOC_STACK',
1669
- 'allocate',
1670
- ];
1671
- missingLibrarySymbols.forEach(missingLibrarySymbol)
1672
-
1673
- var unexportedSymbols = [
1674
- 'run',
1675
- 'UTF8ArrayToString',
1676
- 'UTF8ToString',
1677
- 'stringToUTF8Array',
1678
- 'stringToUTF8',
1679
- 'lengthBytesUTF8',
1680
- 'addOnPreRun',
1681
- 'addOnInit',
1682
- 'addOnPreMain',
1683
- 'addOnExit',
1684
- 'addOnPostRun',
1685
- 'addRunDependency',
1686
- 'removeRunDependency',
1687
- 'FS_createFolder',
1688
- 'FS_createPath',
1689
- 'FS_createDataFile',
1690
- 'FS_createPreloadedFile',
1691
- 'FS_createLazyFile',
1692
- 'FS_createLink',
1693
- 'FS_createDevice',
1694
- 'FS_unlink',
1695
- 'out',
1696
- 'err',
1697
- 'callMain',
1698
- 'abort',
1699
- 'keepRuntimeAlive',
1700
- 'wasmMemory',
1701
- 'stackAlloc',
1702
- 'stackSave',
1703
- 'stackRestore',
1704
- 'getTempRet0',
1705
- 'setTempRet0',
1706
- 'writeStackCookie',
1707
- 'checkStackCookie',
1708
- 'ptrToString',
1709
- 'getHeapMax',
1710
- 'abortOnCannotGrowMemory',
1711
- 'ENV',
1712
- 'ERRNO_CODES',
1713
- 'ERRNO_MESSAGES',
1714
- 'DNS',
1715
- 'Protocols',
1716
- 'Sockets',
1717
- 'timers',
1718
- 'warnOnce',
1719
- 'UNWIND_CACHE',
1720
- 'readEmAsmArgsArray',
1721
- 'convertI32PairToI53Checked',
1722
- 'freeTableIndexes',
1723
- 'functionsInTableMap',
1724
- 'setValue',
1725
- 'getValue',
1726
- 'PATH',
1727
- 'PATH_FS',
1728
- 'UTF16Decoder',
1729
- 'SYSCALLS',
1730
- 'JSEvents',
1731
- 'specialHTMLTargets',
1732
- 'currentFullscreenStrategy',
1733
- 'restoreOldWindowedStyle',
1734
- 'ExitStatus',
1735
- 'flush_NO_FILESYSTEM',
1736
- 'dlopenMissingError',
1737
- 'promiseMap',
1738
- 'uncaughtExceptionCount',
1739
- 'exceptionLast',
1740
- 'exceptionCaught',
1741
- 'Browser',
1742
- 'wget',
1743
- 'FS',
1744
- 'MEMFS',
1745
- 'TTY',
1746
- 'PIPEFS',
1747
- 'SOCKFS',
1748
- 'tempFixedLengthArray',
1749
- 'miniTempWebGLFloatBuffers',
1750
- 'GL',
1751
- 'AL',
1752
- 'SDL',
1753
- 'SDL_gfx',
1754
- 'GLUT',
1755
- 'EGL',
1756
- 'GLFW',
1757
- 'GLEW',
1758
- 'IDBStore',
1759
- ];
1760
- unexportedSymbols.forEach(unexportedRuntimeSymbol);
1761
-
1762
-
1763
-
1764
- var calledRun;
1765
-
1766
- dependenciesFulfilled = function runCaller() {
1767
- // If run has never been called, and we should call run (INVOKE_RUN is true, and Module.noInitialRun is not false)
1768
- if (!calledRun) run();
1769
- if (!calledRun) dependenciesFulfilled = runCaller; // try this again later, after new deps are fulfilled
1770
- };
1771
-
1772
- function stackCheckInit() {
1773
- // This is normally called automatically during __wasm_call_ctors but need to
1774
- // get these values before even running any of the ctors so we call it redundantly
1775
- // here.
1776
- _emscripten_stack_init();
1777
- // TODO(sbc): Move writeStackCookie to native to to avoid this.
1778
- writeStackCookie();
1779
- }
1780
-
1781
- function run() {
1782
-
1783
- if (runDependencies > 0) {
1784
- return;
1785
- }
1786
-
1787
- stackCheckInit();
1788
-
1789
- preRun();
1790
-
1791
- // a preRun added a dependency, run will be called later
1792
- if (runDependencies > 0) {
1793
- return;
1794
- }
1795
-
1796
- function doRun() {
1797
- // run may have just been called through dependencies being fulfilled just in this very frame,
1798
- // or while the async setStatus time below was happening
1799
- if (calledRun) return;
1800
- calledRun = true;
1801
- Module['calledRun'] = true;
1802
-
1803
- if (ABORT) return;
1804
-
1805
- initRuntime();
1806
-
1807
- readyPromiseResolve(Module);
1808
- if (Module['onRuntimeInitialized']) Module['onRuntimeInitialized']();
1809
-
1810
- assert(!Module['_main'], 'compiled without a main, but one is present. if you added it from JS, use Module["onRuntimeInitialized"]');
1811
-
1812
- postRun();
1813
- }
1814
-
1815
- if (Module['setStatus']) {
1816
- Module['setStatus']('Running...');
1817
- setTimeout(function() {
1818
- setTimeout(function() {
1819
- Module['setStatus']('');
1820
- }, 1);
1821
- doRun();
1822
- }, 1);
1823
- } else
1824
- {
1825
- doRun();
1826
- }
1827
- checkStackCookie();
1828
- }
1829
-
1830
- function checkUnflushedContent() {
1831
- // Compiler settings do not allow exiting the runtime, so flushing
1832
- // the streams is not possible. but in ASSERTIONS mode we check
1833
- // if there was something to flush, and if so tell the user they
1834
- // should request that the runtime be exitable.
1835
- // Normally we would not even include flush() at all, but in ASSERTIONS
1836
- // builds we do so just for this check, and here we see if there is any
1837
- // content to flush, that is, we check if there would have been
1838
- // something a non-ASSERTIONS build would have not seen.
1839
- // How we flush the streams depends on whether we are in SYSCALLS_REQUIRE_FILESYSTEM=0
1840
- // mode (which has its own special function for this; otherwise, all
1841
- // the code is inside libc)
1842
- var oldOut = out;
1843
- var oldErr = err;
1844
- var has = false;
1845
- out = err = (x) => {
1846
- has = true;
1847
- }
1848
- try { // it doesn't matter if it fails
1849
- flush_NO_FILESYSTEM();
1850
- } catch(e) {}
1851
- out = oldOut;
1852
- err = oldErr;
1853
- if (has) {
1854
- warnOnce('stdio streams had content in them that was not flushed. you should set EXIT_RUNTIME to 1 (see the FAQ), or make sure to emit a newline when you printf etc.');
1855
- warnOnce('(this may also be due to not including full filesystem support - try building with -sFORCE_FILESYSTEM)');
1856
- }
1857
- }
1858
-
1859
- if (Module['preInit']) {
1860
- if (typeof Module['preInit'] == 'function') Module['preInit'] = [Module['preInit']];
1861
- while (Module['preInit'].length > 0) {
1862
- Module['preInit'].pop()();
1863
- }
1864
- }
1865
-
1866
- run();
1867
-
1868
-
1869
- // end include: postamble.js
8
+ var Module=typeof Module!="undefined"?Module:{};var readyPromiseResolve,readyPromiseReject;Module["ready"]=new Promise(function(resolve,reject){readyPromiseResolve=resolve;readyPromiseReject=reject});var moduleOverrides=Object.assign({},Module);var arguments_=[];var thisProgram="./this.program";var quit_=(status,toThrow)=>{throw toThrow};var ENVIRONMENT_IS_WEB=typeof window=="object";var ENVIRONMENT_IS_WORKER=typeof importScripts=="function";var ENVIRONMENT_IS_NODE=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string";var scriptDirectory="";function locateFile(path){if(Module["locateFile"]){return Module["locateFile"](path,scriptDirectory)}return scriptDirectory+path}var read_,readAsync,readBinary,setWindowTitle;if(ENVIRONMENT_IS_NODE){var fs=require("fs");var nodePath=require("path");if(ENVIRONMENT_IS_WORKER){scriptDirectory=nodePath.dirname(scriptDirectory)+"/"}else{scriptDirectory=__dirname+"/"}read_=(filename,binary)=>{filename=isFileURI(filename)?new URL(filename):nodePath.normalize(filename);return fs.readFileSync(filename,binary?undefined:"utf8")};readBinary=filename=>{var ret=read_(filename,true);if(!ret.buffer){ret=new Uint8Array(ret)}return ret};readAsync=(filename,onload,onerror)=>{filename=isFileURI(filename)?new URL(filename):nodePath.normalize(filename);fs.readFile(filename,function(err,data){if(err)onerror(err);else onload(data.buffer)})};if(process.argv.length>1){thisProgram=process.argv[1].replace(/\\/g,"/")}arguments_=process.argv.slice(2);quit_=(status,toThrow)=>{process.exitCode=status;throw toThrow};Module["inspect"]=function(){return"[Emscripten Module object]"}}else if(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER){if(ENVIRONMENT_IS_WORKER){scriptDirectory=self.location.href}else if(typeof document!="undefined"&&document.currentScript){scriptDirectory=document.currentScript.src}if(_scriptDir){scriptDirectory=_scriptDir}if(scriptDirectory.indexOf("blob:")!==0){scriptDirectory=scriptDirectory.substr(0,scriptDirectory.replace(/[?#].*/,"").lastIndexOf("/")+1)}else{scriptDirectory=""}{read_=url=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.send(null);return xhr.responseText};if(ENVIRONMENT_IS_WORKER){readBinary=url=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.responseType="arraybuffer";xhr.send(null);return new Uint8Array(xhr.response)}}readAsync=(url,onload,onerror)=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,true);xhr.responseType="arraybuffer";xhr.onload=()=>{if(xhr.status==200||xhr.status==0&&xhr.response){onload(xhr.response);return}onerror()};xhr.onerror=onerror;xhr.send(null)}}setWindowTitle=title=>document.title=title}else{}var out=Module["print"]||console.log.bind(console);var err=Module["printErr"]||console.warn.bind(console);Object.assign(Module,moduleOverrides);moduleOverrides=null;if(Module["arguments"])arguments_=Module["arguments"];if(Module["thisProgram"])thisProgram=Module["thisProgram"];if(Module["quit"])quit_=Module["quit"];var wasmBinary;if(Module["wasmBinary"])wasmBinary=Module["wasmBinary"];var noExitRuntime=Module["noExitRuntime"]||true;if(typeof WebAssembly!="object"){abort("no native wasm support detected")}var wasmMemory;var ABORT=false;var EXITSTATUS;var UTF8Decoder=typeof TextDecoder!="undefined"?new TextDecoder("utf8"):undefined;function UTF8ArrayToString(heapOrArray,idx,maxBytesToRead){var endIdx=idx+maxBytesToRead;var endPtr=idx;while(heapOrArray[endPtr]&&!(endPtr>=endIdx))++endPtr;if(endPtr-idx>16&&heapOrArray.buffer&&UTF8Decoder){return UTF8Decoder.decode(heapOrArray.subarray(idx,endPtr))}var str="";while(idx<endPtr){var u0=heapOrArray[idx++];if(!(u0&128)){str+=String.fromCharCode(u0);continue}var u1=heapOrArray[idx++]&63;if((u0&224)==192){str+=String.fromCharCode((u0&31)<<6|u1);continue}var u2=heapOrArray[idx++]&63;if((u0&240)==224){u0=(u0&15)<<12|u1<<6|u2}else{u0=(u0&7)<<18|u1<<12|u2<<6|heapOrArray[idx++]&63}if(u0<65536){str+=String.fromCharCode(u0)}else{var ch=u0-65536;str+=String.fromCharCode(55296|ch>>10,56320|ch&1023)}}return str}function UTF8ToString(ptr,maxBytesToRead){return ptr?UTF8ArrayToString(HEAPU8,ptr,maxBytesToRead):""}var HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAPF64;function updateMemoryViews(){var b=wasmMemory.buffer;Module["HEAP8"]=HEAP8=new Int8Array(b);Module["HEAP16"]=HEAP16=new Int16Array(b);Module["HEAP32"]=HEAP32=new Int32Array(b);Module["HEAPU8"]=HEAPU8=new Uint8Array(b);Module["HEAPU16"]=HEAPU16=new Uint16Array(b);Module["HEAPU32"]=HEAPU32=new Uint32Array(b);Module["HEAPF32"]=HEAPF32=new Float32Array(b);Module["HEAPF64"]=HEAPF64=new Float64Array(b)}var wasmTable;var __ATPRERUN__=[];var __ATINIT__=[];var __ATPOSTRUN__=[];var runtimeInitialized=false;function preRun(){if(Module["preRun"]){if(typeof Module["preRun"]=="function")Module["preRun"]=[Module["preRun"]];while(Module["preRun"].length){addOnPreRun(Module["preRun"].shift())}}callRuntimeCallbacks(__ATPRERUN__)}function initRuntime(){runtimeInitialized=true;callRuntimeCallbacks(__ATINIT__)}function postRun(){if(Module["postRun"]){if(typeof Module["postRun"]=="function")Module["postRun"]=[Module["postRun"]];while(Module["postRun"].length){addOnPostRun(Module["postRun"].shift())}}callRuntimeCallbacks(__ATPOSTRUN__)}function addOnPreRun(cb){__ATPRERUN__.unshift(cb)}function addOnInit(cb){__ATINIT__.unshift(cb)}function addOnPostRun(cb){__ATPOSTRUN__.unshift(cb)}var runDependencies=0;var runDependencyWatcher=null;var dependenciesFulfilled=null;function addRunDependency(id){runDependencies++;if(Module["monitorRunDependencies"]){Module["monitorRunDependencies"](runDependencies)}}function removeRunDependency(id){runDependencies--;if(Module["monitorRunDependencies"]){Module["monitorRunDependencies"](runDependencies)}if(runDependencies==0){if(runDependencyWatcher!==null){clearInterval(runDependencyWatcher);runDependencyWatcher=null}if(dependenciesFulfilled){var callback=dependenciesFulfilled;dependenciesFulfilled=null;callback()}}}function abort(what){if(Module["onAbort"]){Module["onAbort"](what)}what="Aborted("+what+")";err(what);ABORT=true;EXITSTATUS=1;what+=". Build with -sASSERTIONS for more info.";var e=new WebAssembly.RuntimeError(what);readyPromiseReject(e);throw e}var dataURIPrefix="data:application/octet-stream;base64,";function isDataURI(filename){return filename.startsWith(dataURIPrefix)}function isFileURI(filename){return filename.startsWith("file://")}var wasmBinaryFile;wasmBinaryFile="index.wasm";if(!isDataURI(wasmBinaryFile)){wasmBinaryFile=locateFile(wasmBinaryFile)}function getBinary(file){try{if(file==wasmBinaryFile&&wasmBinary){return new Uint8Array(wasmBinary)}if(readBinary){return readBinary(file)}throw"both async and sync fetching of the wasm failed"}catch(err){abort(err)}}function getBinaryPromise(binaryFile){if(!wasmBinary&&(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER)){if(typeof fetch=="function"){return fetch(binaryFile,{credentials:"same-origin"}).then(function(response){if(!response["ok"]){throw"failed to load wasm binary file at '"+binaryFile+"'"}return response["arrayBuffer"]()}).catch(function(){return getBinary(binaryFile)})}}return Promise.resolve().then(function(){return getBinary(binaryFile)})}function instantiateArrayBuffer(binaryFile,imports,receiver){return getBinaryPromise(binaryFile).then(function(binary){return WebAssembly.instantiate(binary,imports)}).then(function(instance){return instance}).then(receiver,function(reason){err("failed to asynchronously prepare wasm: "+reason);abort(reason)})}function instantiateAsync(binary,binaryFile,imports,callback){if(!binary&&typeof WebAssembly.instantiateStreaming=="function"&&!isDataURI(binaryFile)&&!ENVIRONMENT_IS_NODE&&typeof fetch=="function"){return fetch(binaryFile,{credentials:"same-origin"}).then(function(response){var result=WebAssembly.instantiateStreaming(response,imports);return result.then(callback,function(reason){err("wasm streaming compile failed: "+reason);err("falling back to ArrayBuffer instantiation");return instantiateArrayBuffer(binaryFile,imports,callback)})})}else{return instantiateArrayBuffer(binaryFile,imports,callback)}}function createWasm(){var info={"a":wasmImports};function receiveInstance(instance,module){var exports=instance.exports;Module["asm"]=exports;wasmMemory=Module["asm"]["g"];updateMemoryViews();wasmTable=Module["asm"]["ea"];addOnInit(Module["asm"]["h"]);removeRunDependency("wasm-instantiate");return exports}addRunDependency("wasm-instantiate");function receiveInstantiationResult(result){receiveInstance(result["instance"])}if(Module["instantiateWasm"]){try{return Module["instantiateWasm"](info,receiveInstance)}catch(e){err("Module.instantiateWasm callback failed with error: "+e);readyPromiseReject(e)}}instantiateAsync(wasmBinary,wasmBinaryFile,info,receiveInstantiationResult).catch(readyPromiseReject);return{}}function callRuntimeCallbacks(callbacks){while(callbacks.length>0){callbacks.shift()(Module)}}function _abort(){abort("")}function _emscripten_memcpy_big(dest,src,num){HEAPU8.copyWithin(dest,src,src+num)}function abortOnCannotGrowMemory(requestedSize){abort("OOM")}function _emscripten_resize_heap(requestedSize){var oldSize=HEAPU8.length;requestedSize=requestedSize>>>0;abortOnCannotGrowMemory(requestedSize)}var SYSCALLS={varargs:undefined,get:function(){SYSCALLS.varargs+=4;var ret=HEAP32[SYSCALLS.varargs-4>>2];return ret},getStr:function(ptr){var ret=UTF8ToString(ptr);return ret}};function _fd_close(fd){return 52}function _fd_seek(fd,offset_low,offset_high,whence,newOffset){return 70}var printCharBuffers=[null,[],[]];function printChar(stream,curr){var buffer=printCharBuffers[stream];if(curr===0||curr===10){(stream===1?out:err)(UTF8ArrayToString(buffer,0));buffer.length=0}else{buffer.push(curr)}}function _fd_write(fd,iov,iovcnt,pnum){var num=0;for(var i=0;i<iovcnt;i++){var ptr=HEAPU32[iov>>2];var len=HEAPU32[iov+4>>2];iov+=8;for(var j=0;j<len;j++){printChar(fd,HEAPU8[ptr+j])}num+=len}HEAPU32[pnum>>2]=num;return 0}var wasmImports={"d":_abort,"f":_emscripten_memcpy_big,"c":_emscripten_resize_heap,"e":_fd_close,"b":_fd_seek,"a":_fd_write};var asm=createWasm();var ___wasm_call_ctors=function(){return(___wasm_call_ctors=Module["asm"]["h"]).apply(null,arguments)};var _opus_decoder_create=Module["_opus_decoder_create"]=function(){return(_opus_decoder_create=Module["_opus_decoder_create"]=Module["asm"]["i"]).apply(null,arguments)};var _opus_decode_float=Module["_opus_decode_float"]=function(){return(_opus_decode_float=Module["_opus_decode_float"]=Module["asm"]["j"]).apply(null,arguments)};var _opus_decoder_destroy=Module["_opus_decoder_destroy"]=function(){return(_opus_decoder_destroy=Module["_opus_decoder_destroy"]=Module["asm"]["k"]).apply(null,arguments)};var _opus_encoder_create=Module["_opus_encoder_create"]=function(){return(_opus_encoder_create=Module["_opus_encoder_create"]=Module["asm"]["l"]).apply(null,arguments)};var _opus_encode_float=Module["_opus_encode_float"]=function(){return(_opus_encode_float=Module["_opus_encode_float"]=Module["asm"]["m"]).apply(null,arguments)};var _opus_encoder_ctl=Module["_opus_encoder_ctl"]=function(){return(_opus_encoder_ctl=Module["_opus_encoder_ctl"]=Module["asm"]["n"]).apply(null,arguments)};var _opus_encoder_destroy=Module["_opus_encoder_destroy"]=function(){return(_opus_encoder_destroy=Module["_opus_encoder_destroy"]=Module["asm"]["o"]).apply(null,arguments)};var _size_of_int=Module["_size_of_int"]=function(){return(_size_of_int=Module["_size_of_int"]=Module["asm"]["p"]).apply(null,arguments)};var _size_of_void_ptr=Module["_size_of_void_ptr"]=function(){return(_size_of_void_ptr=Module["_size_of_void_ptr"]=Module["asm"]["q"]).apply(null,arguments)};var _opus_set_complexity=Module["_opus_set_complexity"]=function(){return(_opus_set_complexity=Module["_opus_set_complexity"]=Module["asm"]["r"]).apply(null,arguments)};var _opus_get_complexity=Module["_opus_get_complexity"]=function(){return(_opus_get_complexity=Module["_opus_get_complexity"]=Module["asm"]["s"]).apply(null,arguments)};var _opus_set_bitrate=Module["_opus_set_bitrate"]=function(){return(_opus_set_bitrate=Module["_opus_set_bitrate"]=Module["asm"]["t"]).apply(null,arguments)};var _opus_get_bitrate=Module["_opus_get_bitrate"]=function(){return(_opus_get_bitrate=Module["_opus_get_bitrate"]=Module["asm"]["u"]).apply(null,arguments)};var _opus_set_vbr=Module["_opus_set_vbr"]=function(){return(_opus_set_vbr=Module["_opus_set_vbr"]=Module["asm"]["v"]).apply(null,arguments)};var _opus_get_vbr=Module["_opus_get_vbr"]=function(){return(_opus_get_vbr=Module["_opus_get_vbr"]=Module["asm"]["w"]).apply(null,arguments)};var _opus_set_vbr_constraint=Module["_opus_set_vbr_constraint"]=function(){return(_opus_set_vbr_constraint=Module["_opus_set_vbr_constraint"]=Module["asm"]["x"]).apply(null,arguments)};var _opus_get_vbr_constraint=Module["_opus_get_vbr_constraint"]=function(){return(_opus_get_vbr_constraint=Module["_opus_get_vbr_constraint"]=Module["asm"]["y"]).apply(null,arguments)};var _opus_set_force_channels=Module["_opus_set_force_channels"]=function(){return(_opus_set_force_channels=Module["_opus_set_force_channels"]=Module["asm"]["z"]).apply(null,arguments)};var _opus_get_force_channels=Module["_opus_get_force_channels"]=function(){return(_opus_get_force_channels=Module["_opus_get_force_channels"]=Module["asm"]["A"]).apply(null,arguments)};var _opus_set_max_bandwidth=Module["_opus_set_max_bandwidth"]=function(){return(_opus_set_max_bandwidth=Module["_opus_set_max_bandwidth"]=Module["asm"]["B"]).apply(null,arguments)};var _opus_get_max_bandwidth=Module["_opus_get_max_bandwidth"]=function(){return(_opus_get_max_bandwidth=Module["_opus_get_max_bandwidth"]=Module["asm"]["C"]).apply(null,arguments)};var _opus_set_bandwidth=Module["_opus_set_bandwidth"]=function(){return(_opus_set_bandwidth=Module["_opus_set_bandwidth"]=Module["asm"]["D"]).apply(null,arguments)};var _opus_set_signal=Module["_opus_set_signal"]=function(){return(_opus_set_signal=Module["_opus_set_signal"]=Module["asm"]["E"]).apply(null,arguments)};var _opus_get_signal=Module["_opus_get_signal"]=function(){return(_opus_get_signal=Module["_opus_get_signal"]=Module["asm"]["F"]).apply(null,arguments)};var _opus_set_application=Module["_opus_set_application"]=function(){return(_opus_set_application=Module["_opus_set_application"]=Module["asm"]["G"]).apply(null,arguments)};var _opus_get_application=Module["_opus_get_application"]=function(){return(_opus_get_application=Module["_opus_get_application"]=Module["asm"]["H"]).apply(null,arguments)};var _opus_get_lookahead=Module["_opus_get_lookahead"]=function(){return(_opus_get_lookahead=Module["_opus_get_lookahead"]=Module["asm"]["I"]).apply(null,arguments)};var _opus_set_inband_fec=Module["_opus_set_inband_fec"]=function(){return(_opus_set_inband_fec=Module["_opus_set_inband_fec"]=Module["asm"]["J"]).apply(null,arguments)};var _opus_get_inband_fec=Module["_opus_get_inband_fec"]=function(){return(_opus_get_inband_fec=Module["_opus_get_inband_fec"]=Module["asm"]["K"]).apply(null,arguments)};var _opus_set_packet_loss_perc=Module["_opus_set_packet_loss_perc"]=function(){return(_opus_set_packet_loss_perc=Module["_opus_set_packet_loss_perc"]=Module["asm"]["L"]).apply(null,arguments)};var _opus_get_packet_loss_perc=Module["_opus_get_packet_loss_perc"]=function(){return(_opus_get_packet_loss_perc=Module["_opus_get_packet_loss_perc"]=Module["asm"]["M"]).apply(null,arguments)};var _opus_set_dtx=Module["_opus_set_dtx"]=function(){return(_opus_set_dtx=Module["_opus_set_dtx"]=Module["asm"]["N"]).apply(null,arguments)};var _opus_get_dtx=Module["_opus_get_dtx"]=function(){return(_opus_get_dtx=Module["_opus_get_dtx"]=Module["asm"]["O"]).apply(null,arguments)};var _opus_set_lsb_depth=Module["_opus_set_lsb_depth"]=function(){return(_opus_set_lsb_depth=Module["_opus_set_lsb_depth"]=Module["asm"]["P"]).apply(null,arguments)};var _opus_get_lsb_depth=Module["_opus_get_lsb_depth"]=function(){return(_opus_get_lsb_depth=Module["_opus_get_lsb_depth"]=Module["asm"]["Q"]).apply(null,arguments)};var _opus_set_expert_frame_duration=Module["_opus_set_expert_frame_duration"]=function(){return(_opus_set_expert_frame_duration=Module["_opus_set_expert_frame_duration"]=Module["asm"]["R"]).apply(null,arguments)};var _opus_get_expert_frame_duration=Module["_opus_get_expert_frame_duration"]=function(){return(_opus_get_expert_frame_duration=Module["_opus_get_expert_frame_duration"]=Module["asm"]["S"]).apply(null,arguments)};var _opus_set_prediction_disabled=Module["_opus_set_prediction_disabled"]=function(){return(_opus_set_prediction_disabled=Module["_opus_set_prediction_disabled"]=Module["asm"]["T"]).apply(null,arguments)};var _opus_get_prediction_disabled=Module["_opus_get_prediction_disabled"]=function(){return(_opus_get_prediction_disabled=Module["_opus_get_prediction_disabled"]=Module["asm"]["U"]).apply(null,arguments)};var _opus_get_bandwidth=Module["_opus_get_bandwidth"]=function(){return(_opus_get_bandwidth=Module["_opus_get_bandwidth"]=Module["asm"]["V"]).apply(null,arguments)};var _opus_get_sample_rate=Module["_opus_get_sample_rate"]=function(){return(_opus_get_sample_rate=Module["_opus_get_sample_rate"]=Module["asm"]["W"]).apply(null,arguments)};var _opus_set_phase_inversion_disabled=Module["_opus_set_phase_inversion_disabled"]=function(){return(_opus_set_phase_inversion_disabled=Module["_opus_set_phase_inversion_disabled"]=Module["asm"]["X"]).apply(null,arguments)};var _opus_get_phase_inversion_disabled=Module["_opus_get_phase_inversion_disabled"]=function(){return(_opus_get_phase_inversion_disabled=Module["_opus_get_phase_inversion_disabled"]=Module["asm"]["Y"]).apply(null,arguments)};var _opus_get_in_dtx=Module["_opus_get_in_dtx"]=function(){return(_opus_get_in_dtx=Module["_opus_get_in_dtx"]=Module["asm"]["Z"]).apply(null,arguments)};var _opus_set_gain=Module["_opus_set_gain"]=function(){return(_opus_set_gain=Module["_opus_set_gain"]=Module["asm"]["_"]).apply(null,arguments)};var _opus_get_gain=Module["_opus_get_gain"]=function(){return(_opus_get_gain=Module["_opus_get_gain"]=Module["asm"]["$"]).apply(null,arguments)};var _opus_get_last_packet_duration=Module["_opus_get_last_packet_duration"]=function(){return(_opus_get_last_packet_duration=Module["_opus_get_last_packet_duration"]=Module["asm"]["aa"]).apply(null,arguments)};var _opus_get_pitch=Module["_opus_get_pitch"]=function(){return(_opus_get_pitch=Module["_opus_get_pitch"]=Module["asm"]["ba"]).apply(null,arguments)};var ___errno_location=function(){return(___errno_location=Module["asm"]["__errno_location"]).apply(null,arguments)};var _malloc=Module["_malloc"]=function(){return(_malloc=Module["_malloc"]=Module["asm"]["ca"]).apply(null,arguments)};var _free=Module["_free"]=function(){return(_free=Module["_free"]=Module["asm"]["da"]).apply(null,arguments)};var calledRun;dependenciesFulfilled=function runCaller(){if(!calledRun)run();if(!calledRun)dependenciesFulfilled=runCaller};function run(){if(runDependencies>0){return}preRun();if(runDependencies>0){return}function doRun(){if(calledRun)return;calledRun=true;Module["calledRun"]=true;if(ABORT)return;initRuntime();readyPromiseResolve(Module);if(Module["onRuntimeInitialized"])Module["onRuntimeInitialized"]();postRun()}if(Module["setStatus"]){Module["setStatus"]("Running...");setTimeout(function(){setTimeout(function(){Module["setStatus"]("")},1);doRun()},1)}else{doRun()}}if(Module["preInit"]){if(typeof Module["preInit"]=="function")Module["preInit"]=[Module["preInit"]];while(Module["preInit"].length>0){Module["preInit"].pop()()}}run();
1870
9
 
1871
10
 
1872
11
  return Module.ready