@lottiefiles/dotlottie-web 0.9.2 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +51 -47
- package/dist/animation-frame-manager.js +50 -4
- package/dist/constants.d.ts +4 -1
- package/dist/constants.js +6 -4
- package/dist/dotlottie.d.ts +16 -1
- package/dist/dotlottie.js +708 -5
- package/dist/event-manager.d.ts +1 -1
- package/dist/event-manager.js +40 -4
- package/dist/index.d.ts +3 -49
- package/dist/index.js +4 -6
- package/dist/renderer-loader.d.ts +37 -0
- package/dist/renderer-loader.js +63 -0
- package/dist/utils.js +45 -4
- package/dist/wasm/index.d.ts +23 -0
- package/dist/wasm/index.js +1 -0
- package/dist/wasm/renderer.d.ts +3 -0
- package/dist/wasm/renderer.js +2026 -0
- package/dist/{renderer.wasm → wasm/renderer.wasm} +0 -0
- package/package.json +25 -11
- package/dist/animation-frame-manager.js.map +0 -1
- package/dist/constants.js.map +0 -1
- package/dist/dotlottie.js.map +0 -1
- package/dist/event-manager.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/utils.js.map +0 -1
|
@@ -0,0 +1,2026 @@
|
|
|
1
|
+
var createRendererModule = (() => {
|
|
2
|
+
var _scriptDir = typeof document !== "undefined" && document.currentScript ? document.currentScript.src : void 0;
|
|
3
|
+
return function(moduleArg = {}) {
|
|
4
|
+
var Module = moduleArg;
|
|
5
|
+
var readyPromiseResolve, readyPromiseReject;
|
|
6
|
+
Module["ready"] = new Promise((resolve, reject) => {
|
|
7
|
+
readyPromiseResolve = resolve;
|
|
8
|
+
readyPromiseReject = reject;
|
|
9
|
+
});
|
|
10
|
+
var moduleOverrides = Object.assign({}, Module);
|
|
11
|
+
var ENVIRONMENT_IS_WEB = true;
|
|
12
|
+
var scriptDirectory = "";
|
|
13
|
+
function locateFile(path) {
|
|
14
|
+
if (Module["locateFile"]) {
|
|
15
|
+
return Module["locateFile"](path, scriptDirectory);
|
|
16
|
+
}
|
|
17
|
+
return scriptDirectory + path;
|
|
18
|
+
}
|
|
19
|
+
{
|
|
20
|
+
if (typeof document != "undefined" && document.currentScript) {
|
|
21
|
+
scriptDirectory = document.currentScript.src;
|
|
22
|
+
}
|
|
23
|
+
if (_scriptDir) {
|
|
24
|
+
scriptDirectory = _scriptDir;
|
|
25
|
+
}
|
|
26
|
+
if (scriptDirectory.indexOf("blob:") !== 0) {
|
|
27
|
+
scriptDirectory = scriptDirectory.substr(0, scriptDirectory.replace(/[?#].*/, "").lastIndexOf("/") + 1);
|
|
28
|
+
} else {
|
|
29
|
+
scriptDirectory = "";
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
var out = Module["print"] || console.log.bind(console);
|
|
33
|
+
var err = Module["printErr"] || console.error.bind(console);
|
|
34
|
+
Object.assign(Module, moduleOverrides);
|
|
35
|
+
moduleOverrides = null;
|
|
36
|
+
if (Module["arguments"])
|
|
37
|
+
Module["arguments"];
|
|
38
|
+
if (Module["thisProgram"])
|
|
39
|
+
Module["thisProgram"];
|
|
40
|
+
if (Module["quit"])
|
|
41
|
+
Module["quit"];
|
|
42
|
+
var wasmBinary;
|
|
43
|
+
if (Module["wasmBinary"])
|
|
44
|
+
wasmBinary = Module["wasmBinary"];
|
|
45
|
+
if (typeof WebAssembly != "object") {
|
|
46
|
+
abort("no native wasm support detected");
|
|
47
|
+
}
|
|
48
|
+
var wasmMemory;
|
|
49
|
+
var ABORT = false;
|
|
50
|
+
function assert(condition, text) {
|
|
51
|
+
if (!condition) {
|
|
52
|
+
abort(text);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
var HEAP8, HEAPU8, HEAP16, HEAPU16, HEAP32, HEAPU32, HEAPF32, HEAPF64;
|
|
56
|
+
function updateMemoryViews() {
|
|
57
|
+
var b = wasmMemory.buffer;
|
|
58
|
+
Module["HEAP8"] = HEAP8 = new Int8Array(b);
|
|
59
|
+
Module["HEAP16"] = HEAP16 = new Int16Array(b);
|
|
60
|
+
Module["HEAPU8"] = HEAPU8 = new Uint8Array(b);
|
|
61
|
+
Module["HEAPU16"] = HEAPU16 = new Uint16Array(b);
|
|
62
|
+
Module["HEAP32"] = HEAP32 = new Int32Array(b);
|
|
63
|
+
Module["HEAPU32"] = HEAPU32 = new Uint32Array(b);
|
|
64
|
+
Module["HEAPF32"] = HEAPF32 = new Float32Array(b);
|
|
65
|
+
Module["HEAPF64"] = HEAPF64 = new Float64Array(b);
|
|
66
|
+
}
|
|
67
|
+
var __ATPRERUN__ = [];
|
|
68
|
+
var __ATINIT__ = [];
|
|
69
|
+
var __ATPOSTRUN__ = [];
|
|
70
|
+
function preRun() {
|
|
71
|
+
if (Module["preRun"]) {
|
|
72
|
+
if (typeof Module["preRun"] == "function")
|
|
73
|
+
Module["preRun"] = [Module["preRun"]];
|
|
74
|
+
while (Module["preRun"].length) {
|
|
75
|
+
addOnPreRun(Module["preRun"].shift());
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
callRuntimeCallbacks(__ATPRERUN__);
|
|
79
|
+
}
|
|
80
|
+
function initRuntime() {
|
|
81
|
+
callRuntimeCallbacks(__ATINIT__);
|
|
82
|
+
}
|
|
83
|
+
function postRun() {
|
|
84
|
+
if (Module["postRun"]) {
|
|
85
|
+
if (typeof Module["postRun"] == "function")
|
|
86
|
+
Module["postRun"] = [Module["postRun"]];
|
|
87
|
+
while (Module["postRun"].length) {
|
|
88
|
+
addOnPostRun(Module["postRun"].shift());
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
callRuntimeCallbacks(__ATPOSTRUN__);
|
|
92
|
+
}
|
|
93
|
+
function addOnPreRun(cb) {
|
|
94
|
+
__ATPRERUN__.unshift(cb);
|
|
95
|
+
}
|
|
96
|
+
function addOnInit(cb) {
|
|
97
|
+
__ATINIT__.unshift(cb);
|
|
98
|
+
}
|
|
99
|
+
function addOnPostRun(cb) {
|
|
100
|
+
__ATPOSTRUN__.unshift(cb);
|
|
101
|
+
}
|
|
102
|
+
var runDependencies = 0;
|
|
103
|
+
var dependenciesFulfilled = null;
|
|
104
|
+
function addRunDependency(id) {
|
|
105
|
+
runDependencies++;
|
|
106
|
+
if (Module["monitorRunDependencies"]) {
|
|
107
|
+
Module["monitorRunDependencies"](runDependencies);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
function removeRunDependency(id) {
|
|
111
|
+
runDependencies--;
|
|
112
|
+
if (Module["monitorRunDependencies"]) {
|
|
113
|
+
Module["monitorRunDependencies"](runDependencies);
|
|
114
|
+
}
|
|
115
|
+
if (runDependencies == 0) {
|
|
116
|
+
if (dependenciesFulfilled) {
|
|
117
|
+
var callback = dependenciesFulfilled;
|
|
118
|
+
dependenciesFulfilled = null;
|
|
119
|
+
callback();
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
function abort(what) {
|
|
124
|
+
if (Module["onAbort"]) {
|
|
125
|
+
Module["onAbort"](what);
|
|
126
|
+
}
|
|
127
|
+
what = "Aborted(" + what + ")";
|
|
128
|
+
err(what);
|
|
129
|
+
ABORT = true;
|
|
130
|
+
what += ". Build with -sASSERTIONS for more info.";
|
|
131
|
+
var e = new WebAssembly.RuntimeError(what);
|
|
132
|
+
readyPromiseReject(e);
|
|
133
|
+
throw e;
|
|
134
|
+
}
|
|
135
|
+
var dataURIPrefix = "data:application/octet-stream;base64,";
|
|
136
|
+
var isDataURI = (filename) => filename.startsWith(dataURIPrefix);
|
|
137
|
+
var wasmBinaryFile;
|
|
138
|
+
wasmBinaryFile = "renderer.wasm";
|
|
139
|
+
if (!isDataURI(wasmBinaryFile)) {
|
|
140
|
+
wasmBinaryFile = locateFile(wasmBinaryFile);
|
|
141
|
+
}
|
|
142
|
+
function getBinarySync(file) {
|
|
143
|
+
if (file == wasmBinaryFile && wasmBinary) {
|
|
144
|
+
return new Uint8Array(wasmBinary);
|
|
145
|
+
}
|
|
146
|
+
throw "both async and sync fetching of the wasm failed";
|
|
147
|
+
}
|
|
148
|
+
function getBinaryPromise(binaryFile) {
|
|
149
|
+
if (!wasmBinary && (ENVIRONMENT_IS_WEB )) {
|
|
150
|
+
if (typeof fetch == "function") {
|
|
151
|
+
return fetch(binaryFile, {
|
|
152
|
+
credentials: "same-origin"
|
|
153
|
+
}).then((response) => {
|
|
154
|
+
if (!response["ok"]) {
|
|
155
|
+
throw "failed to load wasm binary file at '" + binaryFile + "'";
|
|
156
|
+
}
|
|
157
|
+
return response["arrayBuffer"]();
|
|
158
|
+
}).catch(() => getBinarySync(binaryFile));
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
return Promise.resolve().then(() => getBinarySync(binaryFile));
|
|
162
|
+
}
|
|
163
|
+
function instantiateArrayBuffer(binaryFile, imports, receiver) {
|
|
164
|
+
return getBinaryPromise(binaryFile).then((binary) => WebAssembly.instantiate(binary, imports)).then((instance) => instance).then(receiver, (reason) => {
|
|
165
|
+
err(`failed to asynchronously prepare wasm: ${reason}`);
|
|
166
|
+
abort(reason);
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
function instantiateAsync(binary, binaryFile, imports, callback) {
|
|
170
|
+
if (!binary && typeof WebAssembly.instantiateStreaming == "function" && !isDataURI(binaryFile) && typeof fetch == "function") {
|
|
171
|
+
return fetch(binaryFile, {
|
|
172
|
+
credentials: "same-origin"
|
|
173
|
+
}).then((response) => {
|
|
174
|
+
var result = WebAssembly.instantiateStreaming(response, imports);
|
|
175
|
+
return result.then(callback, function(reason) {
|
|
176
|
+
err(`wasm streaming compile failed: ${reason}`);
|
|
177
|
+
err("falling back to ArrayBuffer instantiation");
|
|
178
|
+
return instantiateArrayBuffer(binaryFile, imports, callback);
|
|
179
|
+
});
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
return instantiateArrayBuffer(binaryFile, imports, callback);
|
|
183
|
+
}
|
|
184
|
+
function createWasm() {
|
|
185
|
+
var info = {
|
|
186
|
+
a: wasmImports
|
|
187
|
+
};
|
|
188
|
+
function receiveInstance(instance, module) {
|
|
189
|
+
wasmExports = instance.exports;
|
|
190
|
+
wasmMemory = wasmExports["I"];
|
|
191
|
+
updateMemoryViews();
|
|
192
|
+
wasmTable = wasmExports["O"];
|
|
193
|
+
addOnInit(wasmExports["J"]);
|
|
194
|
+
removeRunDependency();
|
|
195
|
+
return wasmExports;
|
|
196
|
+
}
|
|
197
|
+
addRunDependency();
|
|
198
|
+
function receiveInstantiationResult(result) {
|
|
199
|
+
receiveInstance(result["instance"]);
|
|
200
|
+
}
|
|
201
|
+
if (Module["instantiateWasm"]) {
|
|
202
|
+
try {
|
|
203
|
+
return Module["instantiateWasm"](info, receiveInstance);
|
|
204
|
+
} catch (e) {
|
|
205
|
+
err(`Module.instantiateWasm callback failed with error: ${e}`);
|
|
206
|
+
readyPromiseReject(e);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
instantiateAsync(wasmBinary, wasmBinaryFile, info, receiveInstantiationResult).catch(readyPromiseReject);
|
|
210
|
+
return {};
|
|
211
|
+
}
|
|
212
|
+
var callRuntimeCallbacks = (callbacks) => {
|
|
213
|
+
while (callbacks.length > 0) {
|
|
214
|
+
callbacks.shift()(Module);
|
|
215
|
+
}
|
|
216
|
+
};
|
|
217
|
+
Module["noExitRuntime"] || true;
|
|
218
|
+
var UTF8Decoder = typeof TextDecoder != "undefined" ? new TextDecoder("utf8") : void 0;
|
|
219
|
+
var UTF8ArrayToString = (heapOrArray, idx, maxBytesToRead) => {
|
|
220
|
+
var endIdx = idx + maxBytesToRead;
|
|
221
|
+
var endPtr = idx;
|
|
222
|
+
while (heapOrArray[endPtr] && !(endPtr >= endIdx))
|
|
223
|
+
++endPtr;
|
|
224
|
+
if (endPtr - idx > 16 && heapOrArray.buffer && UTF8Decoder) {
|
|
225
|
+
return UTF8Decoder.decode(heapOrArray.subarray(idx, endPtr));
|
|
226
|
+
}
|
|
227
|
+
var str = "";
|
|
228
|
+
while (idx < endPtr) {
|
|
229
|
+
var u0 = heapOrArray[idx++];
|
|
230
|
+
if (!(u0 & 128)) {
|
|
231
|
+
str += String.fromCharCode(u0);
|
|
232
|
+
continue;
|
|
233
|
+
}
|
|
234
|
+
var u1 = heapOrArray[idx++] & 63;
|
|
235
|
+
if ((u0 & 224) == 192) {
|
|
236
|
+
str += String.fromCharCode((u0 & 31) << 6 | u1);
|
|
237
|
+
continue;
|
|
238
|
+
}
|
|
239
|
+
var u2 = heapOrArray[idx++] & 63;
|
|
240
|
+
if ((u0 & 240) == 224) {
|
|
241
|
+
u0 = (u0 & 15) << 12 | u1 << 6 | u2;
|
|
242
|
+
} else {
|
|
243
|
+
u0 = (u0 & 7) << 18 | u1 << 12 | u2 << 6 | heapOrArray[idx++] & 63;
|
|
244
|
+
}
|
|
245
|
+
if (u0 < 65536) {
|
|
246
|
+
str += String.fromCharCode(u0);
|
|
247
|
+
} else {
|
|
248
|
+
var ch = u0 - 65536;
|
|
249
|
+
str += String.fromCharCode(55296 | ch >> 10, 56320 | ch & 1023);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
return str;
|
|
253
|
+
};
|
|
254
|
+
var UTF8ToString = (ptr, maxBytesToRead) => ptr ? UTF8ArrayToString(HEAPU8, ptr, maxBytesToRead) : "";
|
|
255
|
+
var ___assert_fail = (condition, filename, line, func) => {
|
|
256
|
+
abort(
|
|
257
|
+
`Assertion failed: ${UTF8ToString(condition)}, at: ` + [
|
|
258
|
+
filename ? UTF8ToString(filename) : "unknown filename",
|
|
259
|
+
line,
|
|
260
|
+
func ? UTF8ToString(func) : "unknown function"
|
|
261
|
+
]
|
|
262
|
+
);
|
|
263
|
+
};
|
|
264
|
+
function ___syscall_fcntl64(fd, cmd, varargs) {
|
|
265
|
+
return 0;
|
|
266
|
+
}
|
|
267
|
+
function ___syscall_ioctl(fd, op, varargs) {
|
|
268
|
+
return 0;
|
|
269
|
+
}
|
|
270
|
+
function ___syscall_openat(dirfd, path, flags, varargs) {
|
|
271
|
+
}
|
|
272
|
+
var __embind_register_bigint = (primitiveType, name, size, minRange, maxRange) => {
|
|
273
|
+
};
|
|
274
|
+
var embind_init_charCodes = () => {
|
|
275
|
+
var codes = new Array(256);
|
|
276
|
+
for (var i = 0; i < 256; ++i) {
|
|
277
|
+
codes[i] = String.fromCharCode(i);
|
|
278
|
+
}
|
|
279
|
+
embind_charCodes = codes;
|
|
280
|
+
};
|
|
281
|
+
var embind_charCodes;
|
|
282
|
+
var readLatin1String = (ptr) => {
|
|
283
|
+
var ret = "";
|
|
284
|
+
var c = ptr;
|
|
285
|
+
while (HEAPU8[c]) {
|
|
286
|
+
ret += embind_charCodes[HEAPU8[c++]];
|
|
287
|
+
}
|
|
288
|
+
return ret;
|
|
289
|
+
};
|
|
290
|
+
var awaitingDependencies = {};
|
|
291
|
+
var registeredTypes = {};
|
|
292
|
+
var typeDependencies = {};
|
|
293
|
+
var BindingError;
|
|
294
|
+
var throwBindingError = (message) => {
|
|
295
|
+
throw new BindingError(message);
|
|
296
|
+
};
|
|
297
|
+
var InternalError;
|
|
298
|
+
var throwInternalError = (message) => {
|
|
299
|
+
throw new InternalError(message);
|
|
300
|
+
};
|
|
301
|
+
var whenDependentTypesAreResolved = (myTypes, dependentTypes, getTypeConverters) => {
|
|
302
|
+
myTypes.forEach(function(type) {
|
|
303
|
+
typeDependencies[type] = dependentTypes;
|
|
304
|
+
});
|
|
305
|
+
function onComplete(typeConverters2) {
|
|
306
|
+
var myTypeConverters = getTypeConverters(typeConverters2);
|
|
307
|
+
if (myTypeConverters.length !== myTypes.length) {
|
|
308
|
+
throwInternalError("Mismatched type converter count");
|
|
309
|
+
}
|
|
310
|
+
for (var i = 0; i < myTypes.length; ++i) {
|
|
311
|
+
registerType(myTypes[i], myTypeConverters[i]);
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
var typeConverters = new Array(dependentTypes.length);
|
|
315
|
+
var unregisteredTypes = [];
|
|
316
|
+
var registered = 0;
|
|
317
|
+
dependentTypes.forEach((dt, i) => {
|
|
318
|
+
if (registeredTypes.hasOwnProperty(dt)) {
|
|
319
|
+
typeConverters[i] = registeredTypes[dt];
|
|
320
|
+
} else {
|
|
321
|
+
unregisteredTypes.push(dt);
|
|
322
|
+
if (!awaitingDependencies.hasOwnProperty(dt)) {
|
|
323
|
+
awaitingDependencies[dt] = [];
|
|
324
|
+
}
|
|
325
|
+
awaitingDependencies[dt].push(() => {
|
|
326
|
+
typeConverters[i] = registeredTypes[dt];
|
|
327
|
+
++registered;
|
|
328
|
+
if (registered === unregisteredTypes.length) {
|
|
329
|
+
onComplete(typeConverters);
|
|
330
|
+
}
|
|
331
|
+
});
|
|
332
|
+
}
|
|
333
|
+
});
|
|
334
|
+
if (0 === unregisteredTypes.length) {
|
|
335
|
+
onComplete(typeConverters);
|
|
336
|
+
}
|
|
337
|
+
};
|
|
338
|
+
function sharedRegisterType(rawType, registeredInstance, options = {}) {
|
|
339
|
+
var name = registeredInstance.name;
|
|
340
|
+
if (!rawType) {
|
|
341
|
+
throwBindingError(`type "${name}" must have a positive integer typeid pointer`);
|
|
342
|
+
}
|
|
343
|
+
if (registeredTypes.hasOwnProperty(rawType)) {
|
|
344
|
+
if (options.ignoreDuplicateRegistrations) {
|
|
345
|
+
return;
|
|
346
|
+
} else {
|
|
347
|
+
throwBindingError(`Cannot register type '${name}' twice`);
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
registeredTypes[rawType] = registeredInstance;
|
|
351
|
+
delete typeDependencies[rawType];
|
|
352
|
+
if (awaitingDependencies.hasOwnProperty(rawType)) {
|
|
353
|
+
var callbacks = awaitingDependencies[rawType];
|
|
354
|
+
delete awaitingDependencies[rawType];
|
|
355
|
+
callbacks.forEach((cb) => cb());
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
function registerType(rawType, registeredInstance, options = {}) {
|
|
359
|
+
if (!("argPackAdvance" in registeredInstance)) {
|
|
360
|
+
throw new TypeError("registerType registeredInstance requires argPackAdvance");
|
|
361
|
+
}
|
|
362
|
+
return sharedRegisterType(rawType, registeredInstance, options);
|
|
363
|
+
}
|
|
364
|
+
var GenericWireTypeSize = 8;
|
|
365
|
+
var __embind_register_bool = (rawType, name, trueValue, falseValue) => {
|
|
366
|
+
name = readLatin1String(name);
|
|
367
|
+
registerType(rawType, {
|
|
368
|
+
name,
|
|
369
|
+
fromWireType: function(wt) {
|
|
370
|
+
return !!wt;
|
|
371
|
+
},
|
|
372
|
+
toWireType: function(destructors, o) {
|
|
373
|
+
return o ? trueValue : falseValue;
|
|
374
|
+
},
|
|
375
|
+
argPackAdvance: GenericWireTypeSize,
|
|
376
|
+
readValueFromPointer: function(pointer) {
|
|
377
|
+
return this["fromWireType"](HEAPU8[pointer]);
|
|
378
|
+
},
|
|
379
|
+
destructorFunction: null
|
|
380
|
+
});
|
|
381
|
+
};
|
|
382
|
+
var shallowCopyInternalPointer = (o) => ({
|
|
383
|
+
count: o.count,
|
|
384
|
+
deleteScheduled: o.deleteScheduled,
|
|
385
|
+
preservePointerOnDelete: o.preservePointerOnDelete,
|
|
386
|
+
ptr: o.ptr,
|
|
387
|
+
ptrType: o.ptrType,
|
|
388
|
+
smartPtr: o.smartPtr,
|
|
389
|
+
smartPtrType: o.smartPtrType
|
|
390
|
+
});
|
|
391
|
+
var throwInstanceAlreadyDeleted = (obj) => {
|
|
392
|
+
function getInstanceTypeName(handle) {
|
|
393
|
+
return handle.$$.ptrType.registeredClass.name;
|
|
394
|
+
}
|
|
395
|
+
throwBindingError(getInstanceTypeName(obj) + " instance already deleted");
|
|
396
|
+
};
|
|
397
|
+
var finalizationRegistry = false;
|
|
398
|
+
var detachFinalizer = (handle) => {
|
|
399
|
+
};
|
|
400
|
+
var runDestructor = ($$) => {
|
|
401
|
+
if ($$.smartPtr) {
|
|
402
|
+
$$.smartPtrType.rawDestructor($$.smartPtr);
|
|
403
|
+
} else {
|
|
404
|
+
$$.ptrType.registeredClass.rawDestructor($$.ptr);
|
|
405
|
+
}
|
|
406
|
+
};
|
|
407
|
+
var releaseClassHandle = ($$) => {
|
|
408
|
+
$$.count.value -= 1;
|
|
409
|
+
var toDelete = 0 === $$.count.value;
|
|
410
|
+
if (toDelete) {
|
|
411
|
+
runDestructor($$);
|
|
412
|
+
}
|
|
413
|
+
};
|
|
414
|
+
var downcastPointer = (ptr, ptrClass, desiredClass) => {
|
|
415
|
+
if (ptrClass === desiredClass) {
|
|
416
|
+
return ptr;
|
|
417
|
+
}
|
|
418
|
+
if (void 0 === desiredClass.baseClass) {
|
|
419
|
+
return null;
|
|
420
|
+
}
|
|
421
|
+
var rv = downcastPointer(ptr, ptrClass, desiredClass.baseClass);
|
|
422
|
+
if (rv === null) {
|
|
423
|
+
return null;
|
|
424
|
+
}
|
|
425
|
+
return desiredClass.downcast(rv);
|
|
426
|
+
};
|
|
427
|
+
var registeredPointers = {};
|
|
428
|
+
var getInheritedInstanceCount = () => Object.keys(registeredInstances).length;
|
|
429
|
+
var getLiveInheritedInstances = () => {
|
|
430
|
+
var rv = [];
|
|
431
|
+
for (var k in registeredInstances) {
|
|
432
|
+
if (registeredInstances.hasOwnProperty(k)) {
|
|
433
|
+
rv.push(registeredInstances[k]);
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
return rv;
|
|
437
|
+
};
|
|
438
|
+
var deletionQueue = [];
|
|
439
|
+
var flushPendingDeletes = () => {
|
|
440
|
+
while (deletionQueue.length) {
|
|
441
|
+
var obj = deletionQueue.pop();
|
|
442
|
+
obj.$$.deleteScheduled = false;
|
|
443
|
+
obj["delete"]();
|
|
444
|
+
}
|
|
445
|
+
};
|
|
446
|
+
var delayFunction;
|
|
447
|
+
var setDelayFunction = (fn) => {
|
|
448
|
+
delayFunction = fn;
|
|
449
|
+
if (deletionQueue.length && delayFunction) {
|
|
450
|
+
delayFunction(flushPendingDeletes);
|
|
451
|
+
}
|
|
452
|
+
};
|
|
453
|
+
var init_embind = () => {
|
|
454
|
+
Module["getInheritedInstanceCount"] = getInheritedInstanceCount;
|
|
455
|
+
Module["getLiveInheritedInstances"] = getLiveInheritedInstances;
|
|
456
|
+
Module["flushPendingDeletes"] = flushPendingDeletes;
|
|
457
|
+
Module["setDelayFunction"] = setDelayFunction;
|
|
458
|
+
};
|
|
459
|
+
var registeredInstances = {};
|
|
460
|
+
var getBasestPointer = (class_, ptr) => {
|
|
461
|
+
if (ptr === void 0) {
|
|
462
|
+
throwBindingError("ptr should not be undefined");
|
|
463
|
+
}
|
|
464
|
+
while (class_.baseClass) {
|
|
465
|
+
ptr = class_.upcast(ptr);
|
|
466
|
+
class_ = class_.baseClass;
|
|
467
|
+
}
|
|
468
|
+
return ptr;
|
|
469
|
+
};
|
|
470
|
+
var getInheritedInstance = (class_, ptr) => {
|
|
471
|
+
ptr = getBasestPointer(class_, ptr);
|
|
472
|
+
return registeredInstances[ptr];
|
|
473
|
+
};
|
|
474
|
+
var makeClassHandle = (prototype, record) => {
|
|
475
|
+
if (!record.ptrType || !record.ptr) {
|
|
476
|
+
throwInternalError("makeClassHandle requires ptr and ptrType");
|
|
477
|
+
}
|
|
478
|
+
var hasSmartPtrType = !!record.smartPtrType;
|
|
479
|
+
var hasSmartPtr = !!record.smartPtr;
|
|
480
|
+
if (hasSmartPtrType !== hasSmartPtr) {
|
|
481
|
+
throwInternalError("Both smartPtrType and smartPtr must be specified");
|
|
482
|
+
}
|
|
483
|
+
record.count = {
|
|
484
|
+
value: 1
|
|
485
|
+
};
|
|
486
|
+
return attachFinalizer(
|
|
487
|
+
Object.create(prototype, {
|
|
488
|
+
$$: {
|
|
489
|
+
value: record
|
|
490
|
+
}
|
|
491
|
+
})
|
|
492
|
+
);
|
|
493
|
+
};
|
|
494
|
+
function RegisteredPointer_fromWireType(ptr) {
|
|
495
|
+
var rawPointer = this.getPointee(ptr);
|
|
496
|
+
if (!rawPointer) {
|
|
497
|
+
this.destructor(ptr);
|
|
498
|
+
return null;
|
|
499
|
+
}
|
|
500
|
+
var registeredInstance = getInheritedInstance(this.registeredClass, rawPointer);
|
|
501
|
+
if (void 0 !== registeredInstance) {
|
|
502
|
+
if (0 === registeredInstance.$$.count.value) {
|
|
503
|
+
registeredInstance.$$.ptr = rawPointer;
|
|
504
|
+
registeredInstance.$$.smartPtr = ptr;
|
|
505
|
+
return registeredInstance["clone"]();
|
|
506
|
+
} else {
|
|
507
|
+
var rv = registeredInstance["clone"]();
|
|
508
|
+
this.destructor(ptr);
|
|
509
|
+
return rv;
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
function makeDefaultHandle() {
|
|
513
|
+
if (this.isSmartPointer) {
|
|
514
|
+
return makeClassHandle(this.registeredClass.instancePrototype, {
|
|
515
|
+
ptrType: this.pointeeType,
|
|
516
|
+
ptr: rawPointer,
|
|
517
|
+
smartPtrType: this,
|
|
518
|
+
smartPtr: ptr
|
|
519
|
+
});
|
|
520
|
+
} else {
|
|
521
|
+
return makeClassHandle(this.registeredClass.instancePrototype, {
|
|
522
|
+
ptrType: this,
|
|
523
|
+
ptr
|
|
524
|
+
});
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
var actualType = this.registeredClass.getActualType(rawPointer);
|
|
528
|
+
var registeredPointerRecord = registeredPointers[actualType];
|
|
529
|
+
if (!registeredPointerRecord) {
|
|
530
|
+
return makeDefaultHandle.call(this);
|
|
531
|
+
}
|
|
532
|
+
var toType;
|
|
533
|
+
if (this.isConst) {
|
|
534
|
+
toType = registeredPointerRecord.constPointerType;
|
|
535
|
+
} else {
|
|
536
|
+
toType = registeredPointerRecord.pointerType;
|
|
537
|
+
}
|
|
538
|
+
var dp = downcastPointer(rawPointer, this.registeredClass, toType.registeredClass);
|
|
539
|
+
if (dp === null) {
|
|
540
|
+
return makeDefaultHandle.call(this);
|
|
541
|
+
}
|
|
542
|
+
if (this.isSmartPointer) {
|
|
543
|
+
return makeClassHandle(toType.registeredClass.instancePrototype, {
|
|
544
|
+
ptrType: toType,
|
|
545
|
+
ptr: dp,
|
|
546
|
+
smartPtrType: this,
|
|
547
|
+
smartPtr: ptr
|
|
548
|
+
});
|
|
549
|
+
} else {
|
|
550
|
+
return makeClassHandle(toType.registeredClass.instancePrototype, {
|
|
551
|
+
ptrType: toType,
|
|
552
|
+
ptr: dp
|
|
553
|
+
});
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
var attachFinalizer = (handle) => {
|
|
557
|
+
if ("undefined" === typeof FinalizationRegistry) {
|
|
558
|
+
attachFinalizer = (handle2) => handle2;
|
|
559
|
+
return handle;
|
|
560
|
+
}
|
|
561
|
+
finalizationRegistry = new FinalizationRegistry((info) => {
|
|
562
|
+
releaseClassHandle(info.$$);
|
|
563
|
+
});
|
|
564
|
+
attachFinalizer = (handle2) => {
|
|
565
|
+
var $$ = handle2.$$;
|
|
566
|
+
var hasSmartPtr = !!$$.smartPtr;
|
|
567
|
+
if (hasSmartPtr) {
|
|
568
|
+
var info = {
|
|
569
|
+
$$
|
|
570
|
+
};
|
|
571
|
+
finalizationRegistry.register(handle2, info, handle2);
|
|
572
|
+
}
|
|
573
|
+
return handle2;
|
|
574
|
+
};
|
|
575
|
+
detachFinalizer = (handle2) => finalizationRegistry.unregister(handle2);
|
|
576
|
+
return attachFinalizer(handle);
|
|
577
|
+
};
|
|
578
|
+
var init_ClassHandle = () => {
|
|
579
|
+
Object.assign(ClassHandle.prototype, {
|
|
580
|
+
isAliasOf(other) {
|
|
581
|
+
if (!(this instanceof ClassHandle)) {
|
|
582
|
+
return false;
|
|
583
|
+
}
|
|
584
|
+
if (!(other instanceof ClassHandle)) {
|
|
585
|
+
return false;
|
|
586
|
+
}
|
|
587
|
+
var leftClass = this.$$.ptrType.registeredClass;
|
|
588
|
+
var left = this.$$.ptr;
|
|
589
|
+
other.$$ = /** @type {Object} */
|
|
590
|
+
other.$$;
|
|
591
|
+
var rightClass = other.$$.ptrType.registeredClass;
|
|
592
|
+
var right = other.$$.ptr;
|
|
593
|
+
while (leftClass.baseClass) {
|
|
594
|
+
left = leftClass.upcast(left);
|
|
595
|
+
leftClass = leftClass.baseClass;
|
|
596
|
+
}
|
|
597
|
+
while (rightClass.baseClass) {
|
|
598
|
+
right = rightClass.upcast(right);
|
|
599
|
+
rightClass = rightClass.baseClass;
|
|
600
|
+
}
|
|
601
|
+
return leftClass === rightClass && left === right;
|
|
602
|
+
},
|
|
603
|
+
clone() {
|
|
604
|
+
if (!this.$$.ptr) {
|
|
605
|
+
throwInstanceAlreadyDeleted(this);
|
|
606
|
+
}
|
|
607
|
+
if (this.$$.preservePointerOnDelete) {
|
|
608
|
+
this.$$.count.value += 1;
|
|
609
|
+
return this;
|
|
610
|
+
} else {
|
|
611
|
+
var clone = attachFinalizer(
|
|
612
|
+
Object.create(Object.getPrototypeOf(this), {
|
|
613
|
+
$$: {
|
|
614
|
+
value: shallowCopyInternalPointer(this.$$)
|
|
615
|
+
}
|
|
616
|
+
})
|
|
617
|
+
);
|
|
618
|
+
clone.$$.count.value += 1;
|
|
619
|
+
clone.$$.deleteScheduled = false;
|
|
620
|
+
return clone;
|
|
621
|
+
}
|
|
622
|
+
},
|
|
623
|
+
delete() {
|
|
624
|
+
if (!this.$$.ptr) {
|
|
625
|
+
throwInstanceAlreadyDeleted(this);
|
|
626
|
+
}
|
|
627
|
+
if (this.$$.deleteScheduled && !this.$$.preservePointerOnDelete) {
|
|
628
|
+
throwBindingError("Object already scheduled for deletion");
|
|
629
|
+
}
|
|
630
|
+
detachFinalizer(this);
|
|
631
|
+
releaseClassHandle(this.$$);
|
|
632
|
+
if (!this.$$.preservePointerOnDelete) {
|
|
633
|
+
this.$$.smartPtr = void 0;
|
|
634
|
+
this.$$.ptr = void 0;
|
|
635
|
+
}
|
|
636
|
+
},
|
|
637
|
+
isDeleted() {
|
|
638
|
+
return !this.$$.ptr;
|
|
639
|
+
},
|
|
640
|
+
deleteLater() {
|
|
641
|
+
if (!this.$$.ptr) {
|
|
642
|
+
throwInstanceAlreadyDeleted(this);
|
|
643
|
+
}
|
|
644
|
+
if (this.$$.deleteScheduled && !this.$$.preservePointerOnDelete) {
|
|
645
|
+
throwBindingError("Object already scheduled for deletion");
|
|
646
|
+
}
|
|
647
|
+
deletionQueue.push(this);
|
|
648
|
+
if (deletionQueue.length === 1 && delayFunction) {
|
|
649
|
+
delayFunction(flushPendingDeletes);
|
|
650
|
+
}
|
|
651
|
+
this.$$.deleteScheduled = true;
|
|
652
|
+
return this;
|
|
653
|
+
}
|
|
654
|
+
});
|
|
655
|
+
};
|
|
656
|
+
function ClassHandle() {
|
|
657
|
+
}
|
|
658
|
+
var char_0 = 48;
|
|
659
|
+
var char_9 = 57;
|
|
660
|
+
var makeLegalFunctionName = (name) => {
|
|
661
|
+
if (void 0 === name) {
|
|
662
|
+
return "_unknown";
|
|
663
|
+
}
|
|
664
|
+
name = name.replace(/[^a-zA-Z0-9_]/g, "$");
|
|
665
|
+
var f = name.charCodeAt(0);
|
|
666
|
+
if (f >= char_0 && f <= char_9) {
|
|
667
|
+
return `_${name}`;
|
|
668
|
+
}
|
|
669
|
+
return name;
|
|
670
|
+
};
|
|
671
|
+
function createNamedFunction(name, body) {
|
|
672
|
+
name = makeLegalFunctionName(name);
|
|
673
|
+
return {
|
|
674
|
+
[name]: function() {
|
|
675
|
+
return body.apply(this, arguments);
|
|
676
|
+
}
|
|
677
|
+
}[name];
|
|
678
|
+
}
|
|
679
|
+
var ensureOverloadTable = (proto, methodName, humanName) => {
|
|
680
|
+
if (void 0 === proto[methodName].overloadTable) {
|
|
681
|
+
var prevFunc = proto[methodName];
|
|
682
|
+
proto[methodName] = function() {
|
|
683
|
+
if (!proto[methodName].overloadTable.hasOwnProperty(arguments.length)) {
|
|
684
|
+
throwBindingError(
|
|
685
|
+
`Function '${humanName}' called with an invalid number of arguments (${arguments.length}) - expects one of (${proto[methodName].overloadTable})!`
|
|
686
|
+
);
|
|
687
|
+
}
|
|
688
|
+
return proto[methodName].overloadTable[arguments.length].apply(this, arguments);
|
|
689
|
+
};
|
|
690
|
+
proto[methodName].overloadTable = [];
|
|
691
|
+
proto[methodName].overloadTable[prevFunc.argCount] = prevFunc;
|
|
692
|
+
}
|
|
693
|
+
};
|
|
694
|
+
var exposePublicSymbol = (name, value, numArguments) => {
|
|
695
|
+
if (Module.hasOwnProperty(name)) {
|
|
696
|
+
if (void 0 === numArguments || void 0 !== Module[name].overloadTable && void 0 !== Module[name].overloadTable[numArguments]) {
|
|
697
|
+
throwBindingError(`Cannot register public name '${name}' twice`);
|
|
698
|
+
}
|
|
699
|
+
ensureOverloadTable(Module, name, name);
|
|
700
|
+
if (Module.hasOwnProperty(numArguments)) {
|
|
701
|
+
throwBindingError(
|
|
702
|
+
`Cannot register multiple overloads of a function with the same number of arguments (${numArguments})!`
|
|
703
|
+
);
|
|
704
|
+
}
|
|
705
|
+
Module[name].overloadTable[numArguments] = value;
|
|
706
|
+
} else {
|
|
707
|
+
Module[name] = value;
|
|
708
|
+
if (void 0 !== numArguments) {
|
|
709
|
+
Module[name].numArguments = numArguments;
|
|
710
|
+
}
|
|
711
|
+
}
|
|
712
|
+
};
|
|
713
|
+
function RegisteredClass(name, constructor, instancePrototype, rawDestructor, baseClass, getActualType, upcast, downcast) {
|
|
714
|
+
this.name = name;
|
|
715
|
+
this.constructor = constructor;
|
|
716
|
+
this.instancePrototype = instancePrototype;
|
|
717
|
+
this.rawDestructor = rawDestructor;
|
|
718
|
+
this.baseClass = baseClass;
|
|
719
|
+
this.getActualType = getActualType;
|
|
720
|
+
this.upcast = upcast;
|
|
721
|
+
this.downcast = downcast;
|
|
722
|
+
this.pureVirtualFunctions = [];
|
|
723
|
+
}
|
|
724
|
+
var upcastPointer = (ptr, ptrClass, desiredClass) => {
|
|
725
|
+
while (ptrClass !== desiredClass) {
|
|
726
|
+
if (!ptrClass.upcast) {
|
|
727
|
+
throwBindingError(`Expected null or instance of ${desiredClass.name}, got an instance of ${ptrClass.name}`);
|
|
728
|
+
}
|
|
729
|
+
ptr = ptrClass.upcast(ptr);
|
|
730
|
+
ptrClass = ptrClass.baseClass;
|
|
731
|
+
}
|
|
732
|
+
return ptr;
|
|
733
|
+
};
|
|
734
|
+
function constNoSmartPtrRawPointerToWireType(destructors, handle) {
|
|
735
|
+
if (handle === null) {
|
|
736
|
+
if (this.isReference) {
|
|
737
|
+
throwBindingError(`null is not a valid ${this.name}`);
|
|
738
|
+
}
|
|
739
|
+
return 0;
|
|
740
|
+
}
|
|
741
|
+
if (!handle.$$) {
|
|
742
|
+
throwBindingError(`Cannot pass "${embindRepr(handle)}" as a ${this.name}`);
|
|
743
|
+
}
|
|
744
|
+
if (!handle.$$.ptr) {
|
|
745
|
+
throwBindingError(`Cannot pass deleted object as a pointer of type ${this.name}`);
|
|
746
|
+
}
|
|
747
|
+
var handleClass = handle.$$.ptrType.registeredClass;
|
|
748
|
+
var ptr = upcastPointer(handle.$$.ptr, handleClass, this.registeredClass);
|
|
749
|
+
return ptr;
|
|
750
|
+
}
|
|
751
|
+
function genericPointerToWireType(destructors, handle) {
|
|
752
|
+
var ptr;
|
|
753
|
+
if (handle === null) {
|
|
754
|
+
if (this.isReference) {
|
|
755
|
+
throwBindingError(`null is not a valid ${this.name}`);
|
|
756
|
+
}
|
|
757
|
+
if (this.isSmartPointer) {
|
|
758
|
+
ptr = this.rawConstructor();
|
|
759
|
+
if (destructors !== null) {
|
|
760
|
+
destructors.push(this.rawDestructor, ptr);
|
|
761
|
+
}
|
|
762
|
+
return ptr;
|
|
763
|
+
} else {
|
|
764
|
+
return 0;
|
|
765
|
+
}
|
|
766
|
+
}
|
|
767
|
+
if (!handle.$$) {
|
|
768
|
+
throwBindingError(`Cannot pass "${embindRepr(handle)}" as a ${this.name}`);
|
|
769
|
+
}
|
|
770
|
+
if (!handle.$$.ptr) {
|
|
771
|
+
throwBindingError(`Cannot pass deleted object as a pointer of type ${this.name}`);
|
|
772
|
+
}
|
|
773
|
+
if (!this.isConst && handle.$$.ptrType.isConst) {
|
|
774
|
+
throwBindingError(
|
|
775
|
+
`Cannot convert argument of type ${handle.$$.smartPtrType ? handle.$$.smartPtrType.name : handle.$$.ptrType.name} to parameter type ${this.name}`
|
|
776
|
+
);
|
|
777
|
+
}
|
|
778
|
+
var handleClass = handle.$$.ptrType.registeredClass;
|
|
779
|
+
ptr = upcastPointer(handle.$$.ptr, handleClass, this.registeredClass);
|
|
780
|
+
if (this.isSmartPointer) {
|
|
781
|
+
if (void 0 === handle.$$.smartPtr) {
|
|
782
|
+
throwBindingError("Passing raw pointer to smart pointer is illegal");
|
|
783
|
+
}
|
|
784
|
+
switch (this.sharingPolicy) {
|
|
785
|
+
case 0:
|
|
786
|
+
if (handle.$$.smartPtrType === this) {
|
|
787
|
+
ptr = handle.$$.smartPtr;
|
|
788
|
+
} else {
|
|
789
|
+
throwBindingError(
|
|
790
|
+
`Cannot convert argument of type ${handle.$$.smartPtrType ? handle.$$.smartPtrType.name : handle.$$.ptrType.name} to parameter type ${this.name}`
|
|
791
|
+
);
|
|
792
|
+
}
|
|
793
|
+
break;
|
|
794
|
+
case 1:
|
|
795
|
+
ptr = handle.$$.smartPtr;
|
|
796
|
+
break;
|
|
797
|
+
case 2:
|
|
798
|
+
if (handle.$$.smartPtrType === this) {
|
|
799
|
+
ptr = handle.$$.smartPtr;
|
|
800
|
+
} else {
|
|
801
|
+
var clonedHandle = handle["clone"]();
|
|
802
|
+
ptr = this.rawShare(
|
|
803
|
+
ptr,
|
|
804
|
+
Emval.toHandle(() => clonedHandle["delete"]())
|
|
805
|
+
);
|
|
806
|
+
if (destructors !== null) {
|
|
807
|
+
destructors.push(this.rawDestructor, ptr);
|
|
808
|
+
}
|
|
809
|
+
}
|
|
810
|
+
break;
|
|
811
|
+
default:
|
|
812
|
+
throwBindingError("Unsupporting sharing policy");
|
|
813
|
+
}
|
|
814
|
+
}
|
|
815
|
+
return ptr;
|
|
816
|
+
}
|
|
817
|
+
function nonConstNoSmartPtrRawPointerToWireType(destructors, handle) {
|
|
818
|
+
if (handle === null) {
|
|
819
|
+
if (this.isReference) {
|
|
820
|
+
throwBindingError(`null is not a valid ${this.name}`);
|
|
821
|
+
}
|
|
822
|
+
return 0;
|
|
823
|
+
}
|
|
824
|
+
if (!handle.$$) {
|
|
825
|
+
throwBindingError(`Cannot pass "${embindRepr(handle)}" as a ${this.name}`);
|
|
826
|
+
}
|
|
827
|
+
if (!handle.$$.ptr) {
|
|
828
|
+
throwBindingError(`Cannot pass deleted object as a pointer of type ${this.name}`);
|
|
829
|
+
}
|
|
830
|
+
if (handle.$$.ptrType.isConst) {
|
|
831
|
+
throwBindingError(`Cannot convert argument of type ${handle.$$.ptrType.name} to parameter type ${this.name}`);
|
|
832
|
+
}
|
|
833
|
+
var handleClass = handle.$$.ptrType.registeredClass;
|
|
834
|
+
var ptr = upcastPointer(handle.$$.ptr, handleClass, this.registeredClass);
|
|
835
|
+
return ptr;
|
|
836
|
+
}
|
|
837
|
+
function readPointer(pointer) {
|
|
838
|
+
return this["fromWireType"](HEAPU32[pointer >> 2]);
|
|
839
|
+
}
|
|
840
|
+
var init_RegisteredPointer = () => {
|
|
841
|
+
Object.assign(RegisteredPointer.prototype, {
|
|
842
|
+
getPointee(ptr) {
|
|
843
|
+
if (this.rawGetPointee) {
|
|
844
|
+
ptr = this.rawGetPointee(ptr);
|
|
845
|
+
}
|
|
846
|
+
return ptr;
|
|
847
|
+
},
|
|
848
|
+
destructor(ptr) {
|
|
849
|
+
if (this.rawDestructor) {
|
|
850
|
+
this.rawDestructor(ptr);
|
|
851
|
+
}
|
|
852
|
+
},
|
|
853
|
+
argPackAdvance: GenericWireTypeSize,
|
|
854
|
+
readValueFromPointer: readPointer,
|
|
855
|
+
deleteObject(handle) {
|
|
856
|
+
if (handle !== null) {
|
|
857
|
+
handle["delete"]();
|
|
858
|
+
}
|
|
859
|
+
},
|
|
860
|
+
fromWireType: RegisteredPointer_fromWireType
|
|
861
|
+
});
|
|
862
|
+
};
|
|
863
|
+
function RegisteredPointer(name, registeredClass, isReference, isConst, isSmartPointer, pointeeType, sharingPolicy, rawGetPointee, rawConstructor, rawShare, rawDestructor) {
|
|
864
|
+
this.name = name;
|
|
865
|
+
this.registeredClass = registeredClass;
|
|
866
|
+
this.isReference = isReference;
|
|
867
|
+
this.isConst = isConst;
|
|
868
|
+
this.isSmartPointer = isSmartPointer;
|
|
869
|
+
this.pointeeType = pointeeType;
|
|
870
|
+
this.sharingPolicy = sharingPolicy;
|
|
871
|
+
this.rawGetPointee = rawGetPointee;
|
|
872
|
+
this.rawConstructor = rawConstructor;
|
|
873
|
+
this.rawShare = rawShare;
|
|
874
|
+
this.rawDestructor = rawDestructor;
|
|
875
|
+
if (!isSmartPointer && registeredClass.baseClass === void 0) {
|
|
876
|
+
if (isConst) {
|
|
877
|
+
this["toWireType"] = constNoSmartPtrRawPointerToWireType;
|
|
878
|
+
this.destructorFunction = null;
|
|
879
|
+
} else {
|
|
880
|
+
this["toWireType"] = nonConstNoSmartPtrRawPointerToWireType;
|
|
881
|
+
this.destructorFunction = null;
|
|
882
|
+
}
|
|
883
|
+
} else {
|
|
884
|
+
this["toWireType"] = genericPointerToWireType;
|
|
885
|
+
}
|
|
886
|
+
}
|
|
887
|
+
var replacePublicSymbol = (name, value, numArguments) => {
|
|
888
|
+
if (!Module.hasOwnProperty(name)) {
|
|
889
|
+
throwInternalError("Replacing nonexistant public symbol");
|
|
890
|
+
}
|
|
891
|
+
if (void 0 !== Module[name].overloadTable && void 0 !== numArguments) {
|
|
892
|
+
Module[name].overloadTable[numArguments] = value;
|
|
893
|
+
} else {
|
|
894
|
+
Module[name] = value;
|
|
895
|
+
Module[name].argCount = numArguments;
|
|
896
|
+
}
|
|
897
|
+
};
|
|
898
|
+
var dynCallLegacy = (sig, ptr, args) => {
|
|
899
|
+
var f = Module["dynCall_" + sig];
|
|
900
|
+
return args && args.length ? f.apply(null, [ptr].concat(args)) : f.call(null, ptr);
|
|
901
|
+
};
|
|
902
|
+
var wasmTable;
|
|
903
|
+
var getWasmTableEntry = (funcPtr) => wasmTable.get(funcPtr);
|
|
904
|
+
var dynCall = (sig, ptr, args) => {
|
|
905
|
+
if (sig.includes("j")) {
|
|
906
|
+
return dynCallLegacy(sig, ptr, args);
|
|
907
|
+
}
|
|
908
|
+
var rtn = getWasmTableEntry(ptr).apply(null, args);
|
|
909
|
+
return rtn;
|
|
910
|
+
};
|
|
911
|
+
var getDynCaller = (sig, ptr) => {
|
|
912
|
+
var argCache = [];
|
|
913
|
+
return function() {
|
|
914
|
+
argCache.length = 0;
|
|
915
|
+
Object.assign(argCache, arguments);
|
|
916
|
+
return dynCall(sig, ptr, argCache);
|
|
917
|
+
};
|
|
918
|
+
};
|
|
919
|
+
var embind__requireFunction = (signature, rawFunction) => {
|
|
920
|
+
signature = readLatin1String(signature);
|
|
921
|
+
function makeDynCaller() {
|
|
922
|
+
if (signature.includes("j")) {
|
|
923
|
+
return getDynCaller(signature, rawFunction);
|
|
924
|
+
}
|
|
925
|
+
return getWasmTableEntry(rawFunction);
|
|
926
|
+
}
|
|
927
|
+
var fp = makeDynCaller();
|
|
928
|
+
if (typeof fp != "function") {
|
|
929
|
+
throwBindingError(`unknown function pointer with signature ${signature}: ${rawFunction}`);
|
|
930
|
+
}
|
|
931
|
+
return fp;
|
|
932
|
+
};
|
|
933
|
+
var extendError = (baseErrorType, errorName) => {
|
|
934
|
+
var errorClass = createNamedFunction(errorName, function(message) {
|
|
935
|
+
this.name = errorName;
|
|
936
|
+
this.message = message;
|
|
937
|
+
var stack = new Error(message).stack;
|
|
938
|
+
if (stack !== void 0) {
|
|
939
|
+
this.stack = this.toString() + "\n" + stack.replace(/^Error(:[^\n]*)?\n/, "");
|
|
940
|
+
}
|
|
941
|
+
});
|
|
942
|
+
errorClass.prototype = Object.create(baseErrorType.prototype);
|
|
943
|
+
errorClass.prototype.constructor = errorClass;
|
|
944
|
+
errorClass.prototype.toString = function() {
|
|
945
|
+
if (this.message === void 0) {
|
|
946
|
+
return this.name;
|
|
947
|
+
} else {
|
|
948
|
+
return `${this.name}: ${this.message}`;
|
|
949
|
+
}
|
|
950
|
+
};
|
|
951
|
+
return errorClass;
|
|
952
|
+
};
|
|
953
|
+
var UnboundTypeError;
|
|
954
|
+
var getTypeName = (type) => {
|
|
955
|
+
var ptr = ___getTypeName(type);
|
|
956
|
+
var rv = readLatin1String(ptr);
|
|
957
|
+
_free(ptr);
|
|
958
|
+
return rv;
|
|
959
|
+
};
|
|
960
|
+
var throwUnboundTypeError = (message, types) => {
|
|
961
|
+
var unboundTypes = [];
|
|
962
|
+
var seen = {};
|
|
963
|
+
function visit(type) {
|
|
964
|
+
if (seen[type]) {
|
|
965
|
+
return;
|
|
966
|
+
}
|
|
967
|
+
if (registeredTypes[type]) {
|
|
968
|
+
return;
|
|
969
|
+
}
|
|
970
|
+
if (typeDependencies[type]) {
|
|
971
|
+
typeDependencies[type].forEach(visit);
|
|
972
|
+
return;
|
|
973
|
+
}
|
|
974
|
+
unboundTypes.push(type);
|
|
975
|
+
seen[type] = true;
|
|
976
|
+
}
|
|
977
|
+
types.forEach(visit);
|
|
978
|
+
throw new UnboundTypeError(`${message}: ` + unboundTypes.map(getTypeName).join([", "]));
|
|
979
|
+
};
|
|
980
|
+
var __embind_register_class = (rawType, rawPointerType, rawConstPointerType, baseClassRawType, getActualTypeSignature, getActualType, upcastSignature, upcast, downcastSignature, downcast, name, destructorSignature, rawDestructor) => {
|
|
981
|
+
name = readLatin1String(name);
|
|
982
|
+
getActualType = embind__requireFunction(getActualTypeSignature, getActualType);
|
|
983
|
+
if (upcast) {
|
|
984
|
+
upcast = embind__requireFunction(upcastSignature, upcast);
|
|
985
|
+
}
|
|
986
|
+
if (downcast) {
|
|
987
|
+
downcast = embind__requireFunction(downcastSignature, downcast);
|
|
988
|
+
}
|
|
989
|
+
rawDestructor = embind__requireFunction(destructorSignature, rawDestructor);
|
|
990
|
+
var legalFunctionName = makeLegalFunctionName(name);
|
|
991
|
+
exposePublicSymbol(legalFunctionName, function() {
|
|
992
|
+
throwUnboundTypeError(`Cannot construct ${name} due to unbound types`, [baseClassRawType]);
|
|
993
|
+
});
|
|
994
|
+
whenDependentTypesAreResolved(
|
|
995
|
+
[rawType, rawPointerType, rawConstPointerType],
|
|
996
|
+
baseClassRawType ? [baseClassRawType] : [],
|
|
997
|
+
function(base) {
|
|
998
|
+
base = base[0];
|
|
999
|
+
var baseClass;
|
|
1000
|
+
var basePrototype;
|
|
1001
|
+
if (baseClassRawType) {
|
|
1002
|
+
baseClass = base.registeredClass;
|
|
1003
|
+
basePrototype = baseClass.instancePrototype;
|
|
1004
|
+
} else {
|
|
1005
|
+
basePrototype = ClassHandle.prototype;
|
|
1006
|
+
}
|
|
1007
|
+
var constructor = createNamedFunction(legalFunctionName, function() {
|
|
1008
|
+
if (Object.getPrototypeOf(this) !== instancePrototype) {
|
|
1009
|
+
throw new BindingError("Use 'new' to construct " + name);
|
|
1010
|
+
}
|
|
1011
|
+
if (void 0 === registeredClass.constructor_body) {
|
|
1012
|
+
throw new BindingError(name + " has no accessible constructor");
|
|
1013
|
+
}
|
|
1014
|
+
var body = registeredClass.constructor_body[arguments.length];
|
|
1015
|
+
if (void 0 === body) {
|
|
1016
|
+
throw new BindingError(
|
|
1017
|
+
`Tried to invoke ctor of ${name} with invalid number of parameters (${arguments.length}) - expected (${Object.keys(registeredClass.constructor_body).toString()}) parameters instead!`
|
|
1018
|
+
);
|
|
1019
|
+
}
|
|
1020
|
+
return body.apply(this, arguments);
|
|
1021
|
+
});
|
|
1022
|
+
var instancePrototype = Object.create(basePrototype, {
|
|
1023
|
+
constructor: {
|
|
1024
|
+
value: constructor
|
|
1025
|
+
}
|
|
1026
|
+
});
|
|
1027
|
+
constructor.prototype = instancePrototype;
|
|
1028
|
+
var registeredClass = new RegisteredClass(
|
|
1029
|
+
name,
|
|
1030
|
+
constructor,
|
|
1031
|
+
instancePrototype,
|
|
1032
|
+
rawDestructor,
|
|
1033
|
+
baseClass,
|
|
1034
|
+
getActualType,
|
|
1035
|
+
upcast,
|
|
1036
|
+
downcast
|
|
1037
|
+
);
|
|
1038
|
+
if (registeredClass.baseClass) {
|
|
1039
|
+
if (registeredClass.baseClass.__derivedClasses === void 0) {
|
|
1040
|
+
registeredClass.baseClass.__derivedClasses = [];
|
|
1041
|
+
}
|
|
1042
|
+
registeredClass.baseClass.__derivedClasses.push(registeredClass);
|
|
1043
|
+
}
|
|
1044
|
+
var referenceConverter = new RegisteredPointer(name, registeredClass, true, false, false);
|
|
1045
|
+
var pointerConverter = new RegisteredPointer(name + "*", registeredClass, false, false, false);
|
|
1046
|
+
var constPointerConverter = new RegisteredPointer(name + " const*", registeredClass, false, true, false);
|
|
1047
|
+
registeredPointers[rawType] = {
|
|
1048
|
+
pointerType: pointerConverter,
|
|
1049
|
+
constPointerType: constPointerConverter
|
|
1050
|
+
};
|
|
1051
|
+
replacePublicSymbol(legalFunctionName, constructor);
|
|
1052
|
+
return [referenceConverter, pointerConverter, constPointerConverter];
|
|
1053
|
+
}
|
|
1054
|
+
);
|
|
1055
|
+
};
|
|
1056
|
+
var heap32VectorToArray = (count, firstElement) => {
|
|
1057
|
+
var array = [];
|
|
1058
|
+
for (var i = 0; i < count; i++) {
|
|
1059
|
+
array.push(HEAPU32[firstElement + i * 4 >> 2]);
|
|
1060
|
+
}
|
|
1061
|
+
return array;
|
|
1062
|
+
};
|
|
1063
|
+
var runDestructors = (destructors) => {
|
|
1064
|
+
while (destructors.length) {
|
|
1065
|
+
var ptr = destructors.pop();
|
|
1066
|
+
var del = destructors.pop();
|
|
1067
|
+
del(ptr);
|
|
1068
|
+
}
|
|
1069
|
+
};
|
|
1070
|
+
function craftInvokerFunction(humanName, argTypes, classType, cppInvokerFunc, cppTargetFunc, isAsync) {
|
|
1071
|
+
var argCount = argTypes.length;
|
|
1072
|
+
if (argCount < 2) {
|
|
1073
|
+
throwBindingError("argTypes array size mismatch! Must at least get return value and 'this' types!");
|
|
1074
|
+
}
|
|
1075
|
+
var isClassMethodFunc = argTypes[1] !== null && classType !== null;
|
|
1076
|
+
var needsDestructorStack = false;
|
|
1077
|
+
for (var i = 1; i < argTypes.length; ++i) {
|
|
1078
|
+
if (argTypes[i] !== null && argTypes[i].destructorFunction === void 0) {
|
|
1079
|
+
needsDestructorStack = true;
|
|
1080
|
+
break;
|
|
1081
|
+
}
|
|
1082
|
+
}
|
|
1083
|
+
var returns = argTypes[0].name !== "void";
|
|
1084
|
+
var expectedArgCount = argCount - 2;
|
|
1085
|
+
var argsWired = new Array(expectedArgCount);
|
|
1086
|
+
var invokerFuncArgs = [];
|
|
1087
|
+
var destructors = [];
|
|
1088
|
+
return function() {
|
|
1089
|
+
if (arguments.length !== expectedArgCount) {
|
|
1090
|
+
throwBindingError(
|
|
1091
|
+
`function ${humanName} called with ${arguments.length} arguments, expected ${expectedArgCount}`
|
|
1092
|
+
);
|
|
1093
|
+
}
|
|
1094
|
+
destructors.length = 0;
|
|
1095
|
+
var thisWired;
|
|
1096
|
+
invokerFuncArgs.length = isClassMethodFunc ? 2 : 1;
|
|
1097
|
+
invokerFuncArgs[0] = cppTargetFunc;
|
|
1098
|
+
if (isClassMethodFunc) {
|
|
1099
|
+
thisWired = argTypes[1]["toWireType"](destructors, this);
|
|
1100
|
+
invokerFuncArgs[1] = thisWired;
|
|
1101
|
+
}
|
|
1102
|
+
for (var i2 = 0; i2 < expectedArgCount; ++i2) {
|
|
1103
|
+
argsWired[i2] = argTypes[i2 + 2]["toWireType"](destructors, arguments[i2]);
|
|
1104
|
+
invokerFuncArgs.push(argsWired[i2]);
|
|
1105
|
+
}
|
|
1106
|
+
var rv = cppInvokerFunc.apply(null, invokerFuncArgs);
|
|
1107
|
+
function onDone(rv2) {
|
|
1108
|
+
if (needsDestructorStack) {
|
|
1109
|
+
runDestructors(destructors);
|
|
1110
|
+
} else {
|
|
1111
|
+
for (var i3 = isClassMethodFunc ? 1 : 2; i3 < argTypes.length; i3++) {
|
|
1112
|
+
var param = i3 === 1 ? thisWired : argsWired[i3 - 2];
|
|
1113
|
+
if (argTypes[i3].destructorFunction !== null) {
|
|
1114
|
+
argTypes[i3].destructorFunction(param);
|
|
1115
|
+
}
|
|
1116
|
+
}
|
|
1117
|
+
}
|
|
1118
|
+
if (returns) {
|
|
1119
|
+
return argTypes[0]["fromWireType"](rv2);
|
|
1120
|
+
}
|
|
1121
|
+
}
|
|
1122
|
+
return onDone(rv);
|
|
1123
|
+
};
|
|
1124
|
+
}
|
|
1125
|
+
var __embind_register_class_constructor = (rawClassType, argCount, rawArgTypesAddr, invokerSignature, invoker, rawConstructor) => {
|
|
1126
|
+
var rawArgTypes = heap32VectorToArray(argCount, rawArgTypesAddr);
|
|
1127
|
+
invoker = embind__requireFunction(invokerSignature, invoker);
|
|
1128
|
+
whenDependentTypesAreResolved([], [rawClassType], function(classType) {
|
|
1129
|
+
classType = classType[0];
|
|
1130
|
+
var humanName = `constructor ${classType.name}`;
|
|
1131
|
+
if (void 0 === classType.registeredClass.constructor_body) {
|
|
1132
|
+
classType.registeredClass.constructor_body = [];
|
|
1133
|
+
}
|
|
1134
|
+
if (void 0 !== classType.registeredClass.constructor_body[argCount - 1]) {
|
|
1135
|
+
throw new BindingError(
|
|
1136
|
+
`Cannot register multiple constructors with identical number of parameters (${argCount - 1}) for class '${classType.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!`
|
|
1137
|
+
);
|
|
1138
|
+
}
|
|
1139
|
+
classType.registeredClass.constructor_body[argCount - 1] = () => {
|
|
1140
|
+
throwUnboundTypeError(`Cannot construct ${classType.name} due to unbound types`, rawArgTypes);
|
|
1141
|
+
};
|
|
1142
|
+
whenDependentTypesAreResolved([], rawArgTypes, (argTypes) => {
|
|
1143
|
+
argTypes.splice(1, 0, null);
|
|
1144
|
+
classType.registeredClass.constructor_body[argCount - 1] = craftInvokerFunction(
|
|
1145
|
+
humanName,
|
|
1146
|
+
argTypes,
|
|
1147
|
+
null,
|
|
1148
|
+
invoker,
|
|
1149
|
+
rawConstructor
|
|
1150
|
+
);
|
|
1151
|
+
return [];
|
|
1152
|
+
});
|
|
1153
|
+
return [];
|
|
1154
|
+
});
|
|
1155
|
+
};
|
|
1156
|
+
var getFunctionName = (signature) => {
|
|
1157
|
+
signature = signature.trim();
|
|
1158
|
+
const argsIndex = signature.indexOf("(");
|
|
1159
|
+
if (argsIndex !== -1) {
|
|
1160
|
+
assert(signature[signature.length - 1] == ")", "Parentheses for argument names should match.");
|
|
1161
|
+
return signature.substr(0, argsIndex);
|
|
1162
|
+
} else {
|
|
1163
|
+
return signature;
|
|
1164
|
+
}
|
|
1165
|
+
};
|
|
1166
|
+
var __embind_register_class_function = (rawClassType, methodName, argCount, rawArgTypesAddr, invokerSignature, rawInvoker, context, isPureVirtual, isAsync) => {
|
|
1167
|
+
var rawArgTypes = heap32VectorToArray(argCount, rawArgTypesAddr);
|
|
1168
|
+
methodName = readLatin1String(methodName);
|
|
1169
|
+
methodName = getFunctionName(methodName);
|
|
1170
|
+
rawInvoker = embind__requireFunction(invokerSignature, rawInvoker);
|
|
1171
|
+
whenDependentTypesAreResolved([], [rawClassType], function(classType) {
|
|
1172
|
+
classType = classType[0];
|
|
1173
|
+
var humanName = `${classType.name}.${methodName}`;
|
|
1174
|
+
if (methodName.startsWith("@@")) {
|
|
1175
|
+
methodName = Symbol[methodName.substring(2)];
|
|
1176
|
+
}
|
|
1177
|
+
if (isPureVirtual) {
|
|
1178
|
+
classType.registeredClass.pureVirtualFunctions.push(methodName);
|
|
1179
|
+
}
|
|
1180
|
+
function unboundTypesHandler() {
|
|
1181
|
+
throwUnboundTypeError(`Cannot call ${humanName} due to unbound types`, rawArgTypes);
|
|
1182
|
+
}
|
|
1183
|
+
var proto = classType.registeredClass.instancePrototype;
|
|
1184
|
+
var method = proto[methodName];
|
|
1185
|
+
if (void 0 === method || void 0 === method.overloadTable && method.className !== classType.name && method.argCount === argCount - 2) {
|
|
1186
|
+
unboundTypesHandler.argCount = argCount - 2;
|
|
1187
|
+
unboundTypesHandler.className = classType.name;
|
|
1188
|
+
proto[methodName] = unboundTypesHandler;
|
|
1189
|
+
} else {
|
|
1190
|
+
ensureOverloadTable(proto, methodName, humanName);
|
|
1191
|
+
proto[methodName].overloadTable[argCount - 2] = unboundTypesHandler;
|
|
1192
|
+
}
|
|
1193
|
+
whenDependentTypesAreResolved([], rawArgTypes, function(argTypes) {
|
|
1194
|
+
var memberFunction = craftInvokerFunction(humanName, argTypes, classType, rawInvoker, context);
|
|
1195
|
+
if (void 0 === proto[methodName].overloadTable) {
|
|
1196
|
+
memberFunction.argCount = argCount - 2;
|
|
1197
|
+
proto[methodName] = memberFunction;
|
|
1198
|
+
} else {
|
|
1199
|
+
proto[methodName].overloadTable[argCount - 2] = memberFunction;
|
|
1200
|
+
}
|
|
1201
|
+
return [];
|
|
1202
|
+
});
|
|
1203
|
+
return [];
|
|
1204
|
+
});
|
|
1205
|
+
};
|
|
1206
|
+
function handleAllocatorInit() {
|
|
1207
|
+
Object.assign(
|
|
1208
|
+
HandleAllocator.prototype,
|
|
1209
|
+
/** @lends {HandleAllocator.prototype} */
|
|
1210
|
+
{
|
|
1211
|
+
get(id) {
|
|
1212
|
+
return this.allocated[id];
|
|
1213
|
+
},
|
|
1214
|
+
has(id) {
|
|
1215
|
+
return this.allocated[id] !== void 0;
|
|
1216
|
+
},
|
|
1217
|
+
allocate(handle) {
|
|
1218
|
+
var id = this.freelist.pop() || this.allocated.length;
|
|
1219
|
+
this.allocated[id] = handle;
|
|
1220
|
+
return id;
|
|
1221
|
+
},
|
|
1222
|
+
free(id) {
|
|
1223
|
+
this.allocated[id] = void 0;
|
|
1224
|
+
this.freelist.push(id);
|
|
1225
|
+
}
|
|
1226
|
+
}
|
|
1227
|
+
);
|
|
1228
|
+
}
|
|
1229
|
+
function HandleAllocator() {
|
|
1230
|
+
this.allocated = [void 0];
|
|
1231
|
+
this.freelist = [];
|
|
1232
|
+
}
|
|
1233
|
+
var emval_handles = new HandleAllocator();
|
|
1234
|
+
var __emval_decref = (handle) => {
|
|
1235
|
+
if (handle >= emval_handles.reserved && 0 === --emval_handles.get(handle).refcount) {
|
|
1236
|
+
emval_handles.free(handle);
|
|
1237
|
+
}
|
|
1238
|
+
};
|
|
1239
|
+
var count_emval_handles = () => {
|
|
1240
|
+
var count = 0;
|
|
1241
|
+
for (var i = emval_handles.reserved; i < emval_handles.allocated.length; ++i) {
|
|
1242
|
+
if (emval_handles.allocated[i] !== void 0) {
|
|
1243
|
+
++count;
|
|
1244
|
+
}
|
|
1245
|
+
}
|
|
1246
|
+
return count;
|
|
1247
|
+
};
|
|
1248
|
+
var init_emval = () => {
|
|
1249
|
+
emval_handles.allocated.push(
|
|
1250
|
+
{
|
|
1251
|
+
value: void 0
|
|
1252
|
+
},
|
|
1253
|
+
{
|
|
1254
|
+
value: null
|
|
1255
|
+
},
|
|
1256
|
+
{
|
|
1257
|
+
value: true
|
|
1258
|
+
},
|
|
1259
|
+
{
|
|
1260
|
+
value: false
|
|
1261
|
+
}
|
|
1262
|
+
);
|
|
1263
|
+
emval_handles.reserved = emval_handles.allocated.length;
|
|
1264
|
+
Module["count_emval_handles"] = count_emval_handles;
|
|
1265
|
+
};
|
|
1266
|
+
var Emval = {
|
|
1267
|
+
toValue: (handle) => {
|
|
1268
|
+
if (!handle) {
|
|
1269
|
+
throwBindingError("Cannot use deleted val. handle = " + handle);
|
|
1270
|
+
}
|
|
1271
|
+
return emval_handles.get(handle).value;
|
|
1272
|
+
},
|
|
1273
|
+
toHandle: (value) => {
|
|
1274
|
+
switch (value) {
|
|
1275
|
+
case void 0:
|
|
1276
|
+
return 1;
|
|
1277
|
+
case null:
|
|
1278
|
+
return 2;
|
|
1279
|
+
case true:
|
|
1280
|
+
return 3;
|
|
1281
|
+
case false:
|
|
1282
|
+
return 4;
|
|
1283
|
+
default: {
|
|
1284
|
+
return emval_handles.allocate({
|
|
1285
|
+
refcount: 1,
|
|
1286
|
+
value
|
|
1287
|
+
});
|
|
1288
|
+
}
|
|
1289
|
+
}
|
|
1290
|
+
}
|
|
1291
|
+
};
|
|
1292
|
+
function simpleReadValueFromPointer(pointer) {
|
|
1293
|
+
return this["fromWireType"](HEAP32[pointer >> 2]);
|
|
1294
|
+
}
|
|
1295
|
+
var __embind_register_emval = (rawType, name) => {
|
|
1296
|
+
name = readLatin1String(name);
|
|
1297
|
+
registerType(rawType, {
|
|
1298
|
+
name,
|
|
1299
|
+
fromWireType: (handle) => {
|
|
1300
|
+
var rv = Emval.toValue(handle);
|
|
1301
|
+
__emval_decref(handle);
|
|
1302
|
+
return rv;
|
|
1303
|
+
},
|
|
1304
|
+
toWireType: (destructors, value) => Emval.toHandle(value),
|
|
1305
|
+
argPackAdvance: GenericWireTypeSize,
|
|
1306
|
+
readValueFromPointer: simpleReadValueFromPointer,
|
|
1307
|
+
destructorFunction: null
|
|
1308
|
+
});
|
|
1309
|
+
};
|
|
1310
|
+
var embindRepr = (v) => {
|
|
1311
|
+
if (v === null) {
|
|
1312
|
+
return "null";
|
|
1313
|
+
}
|
|
1314
|
+
var t = typeof v;
|
|
1315
|
+
if (t === "object" || t === "array" || t === "function") {
|
|
1316
|
+
return v.toString();
|
|
1317
|
+
} else {
|
|
1318
|
+
return "" + v;
|
|
1319
|
+
}
|
|
1320
|
+
};
|
|
1321
|
+
var floatReadValueFromPointer = (name, width) => {
|
|
1322
|
+
switch (width) {
|
|
1323
|
+
case 4:
|
|
1324
|
+
return function(pointer) {
|
|
1325
|
+
return this["fromWireType"](HEAPF32[pointer >> 2]);
|
|
1326
|
+
};
|
|
1327
|
+
case 8:
|
|
1328
|
+
return function(pointer) {
|
|
1329
|
+
return this["fromWireType"](HEAPF64[pointer >> 3]);
|
|
1330
|
+
};
|
|
1331
|
+
default:
|
|
1332
|
+
throw new TypeError(`invalid float width (${width}): ${name}`);
|
|
1333
|
+
}
|
|
1334
|
+
};
|
|
1335
|
+
var __embind_register_float = (rawType, name, size) => {
|
|
1336
|
+
name = readLatin1String(name);
|
|
1337
|
+
registerType(rawType, {
|
|
1338
|
+
name,
|
|
1339
|
+
fromWireType: (value) => value,
|
|
1340
|
+
toWireType: (destructors, value) => value,
|
|
1341
|
+
argPackAdvance: GenericWireTypeSize,
|
|
1342
|
+
readValueFromPointer: floatReadValueFromPointer(name, size),
|
|
1343
|
+
destructorFunction: null
|
|
1344
|
+
});
|
|
1345
|
+
};
|
|
1346
|
+
var integerReadValueFromPointer = (name, width, signed) => {
|
|
1347
|
+
switch (width) {
|
|
1348
|
+
case 1:
|
|
1349
|
+
return signed ? (pointer) => HEAP8[pointer >> 0] : (pointer) => HEAPU8[pointer >> 0];
|
|
1350
|
+
case 2:
|
|
1351
|
+
return signed ? (pointer) => HEAP16[pointer >> 1] : (pointer) => HEAPU16[pointer >> 1];
|
|
1352
|
+
case 4:
|
|
1353
|
+
return signed ? (pointer) => HEAP32[pointer >> 2] : (pointer) => HEAPU32[pointer >> 2];
|
|
1354
|
+
default:
|
|
1355
|
+
throw new TypeError(`invalid integer width (${width}): ${name}`);
|
|
1356
|
+
}
|
|
1357
|
+
};
|
|
1358
|
+
var __embind_register_integer = (primitiveType, name, size, minRange, maxRange) => {
|
|
1359
|
+
name = readLatin1String(name);
|
|
1360
|
+
var fromWireType = (value) => value;
|
|
1361
|
+
if (minRange === 0) {
|
|
1362
|
+
var bitshift = 32 - 8 * size;
|
|
1363
|
+
fromWireType = (value) => value << bitshift >>> bitshift;
|
|
1364
|
+
}
|
|
1365
|
+
var isUnsignedType = name.includes("unsigned");
|
|
1366
|
+
var checkAssertions = (value, toTypeName) => {
|
|
1367
|
+
};
|
|
1368
|
+
var toWireType;
|
|
1369
|
+
if (isUnsignedType) {
|
|
1370
|
+
toWireType = function(destructors, value) {
|
|
1371
|
+
checkAssertions(value, this.name);
|
|
1372
|
+
return value >>> 0;
|
|
1373
|
+
};
|
|
1374
|
+
} else {
|
|
1375
|
+
toWireType = function(destructors, value) {
|
|
1376
|
+
checkAssertions(value, this.name);
|
|
1377
|
+
return value;
|
|
1378
|
+
};
|
|
1379
|
+
}
|
|
1380
|
+
registerType(primitiveType, {
|
|
1381
|
+
name,
|
|
1382
|
+
fromWireType,
|
|
1383
|
+
toWireType,
|
|
1384
|
+
argPackAdvance: GenericWireTypeSize,
|
|
1385
|
+
readValueFromPointer: integerReadValueFromPointer(name, size, minRange !== 0),
|
|
1386
|
+
destructorFunction: null
|
|
1387
|
+
});
|
|
1388
|
+
};
|
|
1389
|
+
var __embind_register_memory_view = (rawType, dataTypeIndex, name) => {
|
|
1390
|
+
var typeMapping = [
|
|
1391
|
+
Int8Array,
|
|
1392
|
+
Uint8Array,
|
|
1393
|
+
Int16Array,
|
|
1394
|
+
Uint16Array,
|
|
1395
|
+
Int32Array,
|
|
1396
|
+
Uint32Array,
|
|
1397
|
+
Float32Array,
|
|
1398
|
+
Float64Array
|
|
1399
|
+
];
|
|
1400
|
+
var TA = typeMapping[dataTypeIndex];
|
|
1401
|
+
function decodeMemoryView(handle) {
|
|
1402
|
+
var size = HEAPU32[handle >> 2];
|
|
1403
|
+
var data = HEAPU32[handle + 4 >> 2];
|
|
1404
|
+
return new TA(HEAP8.buffer, data, size);
|
|
1405
|
+
}
|
|
1406
|
+
name = readLatin1String(name);
|
|
1407
|
+
registerType(
|
|
1408
|
+
rawType,
|
|
1409
|
+
{
|
|
1410
|
+
name,
|
|
1411
|
+
fromWireType: decodeMemoryView,
|
|
1412
|
+
argPackAdvance: GenericWireTypeSize,
|
|
1413
|
+
readValueFromPointer: decodeMemoryView
|
|
1414
|
+
},
|
|
1415
|
+
{
|
|
1416
|
+
ignoreDuplicateRegistrations: true
|
|
1417
|
+
}
|
|
1418
|
+
);
|
|
1419
|
+
};
|
|
1420
|
+
var stringToUTF8Array = (str, heap, outIdx, maxBytesToWrite) => {
|
|
1421
|
+
if (!(maxBytesToWrite > 0))
|
|
1422
|
+
return 0;
|
|
1423
|
+
var startIdx = outIdx;
|
|
1424
|
+
var endIdx = outIdx + maxBytesToWrite - 1;
|
|
1425
|
+
for (var i = 0; i < str.length; ++i) {
|
|
1426
|
+
var u = str.charCodeAt(i);
|
|
1427
|
+
if (u >= 55296 && u <= 57343) {
|
|
1428
|
+
var u1 = str.charCodeAt(++i);
|
|
1429
|
+
u = 65536 + ((u & 1023) << 10) | u1 & 1023;
|
|
1430
|
+
}
|
|
1431
|
+
if (u <= 127) {
|
|
1432
|
+
if (outIdx >= endIdx)
|
|
1433
|
+
break;
|
|
1434
|
+
heap[outIdx++] = u;
|
|
1435
|
+
} else if (u <= 2047) {
|
|
1436
|
+
if (outIdx + 1 >= endIdx)
|
|
1437
|
+
break;
|
|
1438
|
+
heap[outIdx++] = 192 | u >> 6;
|
|
1439
|
+
heap[outIdx++] = 128 | u & 63;
|
|
1440
|
+
} else if (u <= 65535) {
|
|
1441
|
+
if (outIdx + 2 >= endIdx)
|
|
1442
|
+
break;
|
|
1443
|
+
heap[outIdx++] = 224 | u >> 12;
|
|
1444
|
+
heap[outIdx++] = 128 | u >> 6 & 63;
|
|
1445
|
+
heap[outIdx++] = 128 | u & 63;
|
|
1446
|
+
} else {
|
|
1447
|
+
if (outIdx + 3 >= endIdx)
|
|
1448
|
+
break;
|
|
1449
|
+
heap[outIdx++] = 240 | u >> 18;
|
|
1450
|
+
heap[outIdx++] = 128 | u >> 12 & 63;
|
|
1451
|
+
heap[outIdx++] = 128 | u >> 6 & 63;
|
|
1452
|
+
heap[outIdx++] = 128 | u & 63;
|
|
1453
|
+
}
|
|
1454
|
+
}
|
|
1455
|
+
heap[outIdx] = 0;
|
|
1456
|
+
return outIdx - startIdx;
|
|
1457
|
+
};
|
|
1458
|
+
var stringToUTF8 = (str, outPtr, maxBytesToWrite) => stringToUTF8Array(str, HEAPU8, outPtr, maxBytesToWrite);
|
|
1459
|
+
var lengthBytesUTF8 = (str) => {
|
|
1460
|
+
var len = 0;
|
|
1461
|
+
for (var i = 0; i < str.length; ++i) {
|
|
1462
|
+
var c = str.charCodeAt(i);
|
|
1463
|
+
if (c <= 127) {
|
|
1464
|
+
len++;
|
|
1465
|
+
} else if (c <= 2047) {
|
|
1466
|
+
len += 2;
|
|
1467
|
+
} else if (c >= 55296 && c <= 57343) {
|
|
1468
|
+
len += 4;
|
|
1469
|
+
++i;
|
|
1470
|
+
} else {
|
|
1471
|
+
len += 3;
|
|
1472
|
+
}
|
|
1473
|
+
}
|
|
1474
|
+
return len;
|
|
1475
|
+
};
|
|
1476
|
+
var __embind_register_std_string = (rawType, name) => {
|
|
1477
|
+
name = readLatin1String(name);
|
|
1478
|
+
var stdStringIsUTF8 = name === "std::string";
|
|
1479
|
+
registerType(rawType, {
|
|
1480
|
+
name,
|
|
1481
|
+
fromWireType(value) {
|
|
1482
|
+
var length = HEAPU32[value >> 2];
|
|
1483
|
+
var payload = value + 4;
|
|
1484
|
+
var str;
|
|
1485
|
+
if (stdStringIsUTF8) {
|
|
1486
|
+
var decodeStartPtr = payload;
|
|
1487
|
+
for (var i = 0; i <= length; ++i) {
|
|
1488
|
+
var currentBytePtr = payload + i;
|
|
1489
|
+
if (i == length || HEAPU8[currentBytePtr] == 0) {
|
|
1490
|
+
var maxRead = currentBytePtr - decodeStartPtr;
|
|
1491
|
+
var stringSegment = UTF8ToString(decodeStartPtr, maxRead);
|
|
1492
|
+
if (str === void 0) {
|
|
1493
|
+
str = stringSegment;
|
|
1494
|
+
} else {
|
|
1495
|
+
str += String.fromCharCode(0);
|
|
1496
|
+
str += stringSegment;
|
|
1497
|
+
}
|
|
1498
|
+
decodeStartPtr = currentBytePtr + 1;
|
|
1499
|
+
}
|
|
1500
|
+
}
|
|
1501
|
+
} else {
|
|
1502
|
+
var a = new Array(length);
|
|
1503
|
+
for (var i = 0; i < length; ++i) {
|
|
1504
|
+
a[i] = String.fromCharCode(HEAPU8[payload + i]);
|
|
1505
|
+
}
|
|
1506
|
+
str = a.join("");
|
|
1507
|
+
}
|
|
1508
|
+
_free(value);
|
|
1509
|
+
return str;
|
|
1510
|
+
},
|
|
1511
|
+
toWireType(destructors, value) {
|
|
1512
|
+
if (value instanceof ArrayBuffer) {
|
|
1513
|
+
value = new Uint8Array(value);
|
|
1514
|
+
}
|
|
1515
|
+
var length;
|
|
1516
|
+
var valueIsOfTypeString = typeof value == "string";
|
|
1517
|
+
if (!(valueIsOfTypeString || value instanceof Uint8Array || value instanceof Uint8ClampedArray || value instanceof Int8Array)) {
|
|
1518
|
+
throwBindingError("Cannot pass non-string to std::string");
|
|
1519
|
+
}
|
|
1520
|
+
if (stdStringIsUTF8 && valueIsOfTypeString) {
|
|
1521
|
+
length = lengthBytesUTF8(value);
|
|
1522
|
+
} else {
|
|
1523
|
+
length = value.length;
|
|
1524
|
+
}
|
|
1525
|
+
var base = _malloc(4 + length + 1);
|
|
1526
|
+
var ptr = base + 4;
|
|
1527
|
+
HEAPU32[base >> 2] = length;
|
|
1528
|
+
if (stdStringIsUTF8 && valueIsOfTypeString) {
|
|
1529
|
+
stringToUTF8(value, ptr, length + 1);
|
|
1530
|
+
} else {
|
|
1531
|
+
if (valueIsOfTypeString) {
|
|
1532
|
+
for (var i = 0; i < length; ++i) {
|
|
1533
|
+
var charCode = value.charCodeAt(i);
|
|
1534
|
+
if (charCode > 255) {
|
|
1535
|
+
_free(ptr);
|
|
1536
|
+
throwBindingError("String has UTF-16 code units that do not fit in 8 bits");
|
|
1537
|
+
}
|
|
1538
|
+
HEAPU8[ptr + i] = charCode;
|
|
1539
|
+
}
|
|
1540
|
+
} else {
|
|
1541
|
+
for (var i = 0; i < length; ++i) {
|
|
1542
|
+
HEAPU8[ptr + i] = value[i];
|
|
1543
|
+
}
|
|
1544
|
+
}
|
|
1545
|
+
}
|
|
1546
|
+
if (destructors !== null) {
|
|
1547
|
+
destructors.push(_free, base);
|
|
1548
|
+
}
|
|
1549
|
+
return base;
|
|
1550
|
+
},
|
|
1551
|
+
argPackAdvance: GenericWireTypeSize,
|
|
1552
|
+
readValueFromPointer: readPointer,
|
|
1553
|
+
destructorFunction(ptr) {
|
|
1554
|
+
_free(ptr);
|
|
1555
|
+
}
|
|
1556
|
+
});
|
|
1557
|
+
};
|
|
1558
|
+
var UTF16Decoder = typeof TextDecoder != "undefined" ? new TextDecoder("utf-16le") : void 0;
|
|
1559
|
+
var UTF16ToString = (ptr, maxBytesToRead) => {
|
|
1560
|
+
var endPtr = ptr;
|
|
1561
|
+
var idx = endPtr >> 1;
|
|
1562
|
+
var maxIdx = idx + maxBytesToRead / 2;
|
|
1563
|
+
while (!(idx >= maxIdx) && HEAPU16[idx])
|
|
1564
|
+
++idx;
|
|
1565
|
+
endPtr = idx << 1;
|
|
1566
|
+
if (endPtr - ptr > 32 && UTF16Decoder)
|
|
1567
|
+
return UTF16Decoder.decode(HEAPU8.subarray(ptr, endPtr));
|
|
1568
|
+
var str = "";
|
|
1569
|
+
for (var i = 0; !(i >= maxBytesToRead / 2); ++i) {
|
|
1570
|
+
var codeUnit = HEAP16[ptr + i * 2 >> 1];
|
|
1571
|
+
if (codeUnit == 0)
|
|
1572
|
+
break;
|
|
1573
|
+
str += String.fromCharCode(codeUnit);
|
|
1574
|
+
}
|
|
1575
|
+
return str;
|
|
1576
|
+
};
|
|
1577
|
+
var stringToUTF16 = (str, outPtr, maxBytesToWrite) => {
|
|
1578
|
+
if (maxBytesToWrite === void 0) {
|
|
1579
|
+
maxBytesToWrite = 2147483647;
|
|
1580
|
+
}
|
|
1581
|
+
if (maxBytesToWrite < 2)
|
|
1582
|
+
return 0;
|
|
1583
|
+
maxBytesToWrite -= 2;
|
|
1584
|
+
var startPtr = outPtr;
|
|
1585
|
+
var numCharsToWrite = maxBytesToWrite < str.length * 2 ? maxBytesToWrite / 2 : str.length;
|
|
1586
|
+
for (var i = 0; i < numCharsToWrite; ++i) {
|
|
1587
|
+
var codeUnit = str.charCodeAt(i);
|
|
1588
|
+
HEAP16[outPtr >> 1] = codeUnit;
|
|
1589
|
+
outPtr += 2;
|
|
1590
|
+
}
|
|
1591
|
+
HEAP16[outPtr >> 1] = 0;
|
|
1592
|
+
return outPtr - startPtr;
|
|
1593
|
+
};
|
|
1594
|
+
var lengthBytesUTF16 = (str) => str.length * 2;
|
|
1595
|
+
var UTF32ToString = (ptr, maxBytesToRead) => {
|
|
1596
|
+
var i = 0;
|
|
1597
|
+
var str = "";
|
|
1598
|
+
while (!(i >= maxBytesToRead / 4)) {
|
|
1599
|
+
var utf32 = HEAP32[ptr + i * 4 >> 2];
|
|
1600
|
+
if (utf32 == 0)
|
|
1601
|
+
break;
|
|
1602
|
+
++i;
|
|
1603
|
+
if (utf32 >= 65536) {
|
|
1604
|
+
var ch = utf32 - 65536;
|
|
1605
|
+
str += String.fromCharCode(55296 | ch >> 10, 56320 | ch & 1023);
|
|
1606
|
+
} else {
|
|
1607
|
+
str += String.fromCharCode(utf32);
|
|
1608
|
+
}
|
|
1609
|
+
}
|
|
1610
|
+
return str;
|
|
1611
|
+
};
|
|
1612
|
+
var stringToUTF32 = (str, outPtr, maxBytesToWrite) => {
|
|
1613
|
+
if (maxBytesToWrite === void 0) {
|
|
1614
|
+
maxBytesToWrite = 2147483647;
|
|
1615
|
+
}
|
|
1616
|
+
if (maxBytesToWrite < 4)
|
|
1617
|
+
return 0;
|
|
1618
|
+
var startPtr = outPtr;
|
|
1619
|
+
var endPtr = startPtr + maxBytesToWrite - 4;
|
|
1620
|
+
for (var i = 0; i < str.length; ++i) {
|
|
1621
|
+
var codeUnit = str.charCodeAt(i);
|
|
1622
|
+
if (codeUnit >= 55296 && codeUnit <= 57343) {
|
|
1623
|
+
var trailSurrogate = str.charCodeAt(++i);
|
|
1624
|
+
codeUnit = 65536 + ((codeUnit & 1023) << 10) | trailSurrogate & 1023;
|
|
1625
|
+
}
|
|
1626
|
+
HEAP32[outPtr >> 2] = codeUnit;
|
|
1627
|
+
outPtr += 4;
|
|
1628
|
+
if (outPtr + 4 > endPtr)
|
|
1629
|
+
break;
|
|
1630
|
+
}
|
|
1631
|
+
HEAP32[outPtr >> 2] = 0;
|
|
1632
|
+
return outPtr - startPtr;
|
|
1633
|
+
};
|
|
1634
|
+
var lengthBytesUTF32 = (str) => {
|
|
1635
|
+
var len = 0;
|
|
1636
|
+
for (var i = 0; i < str.length; ++i) {
|
|
1637
|
+
var codeUnit = str.charCodeAt(i);
|
|
1638
|
+
if (codeUnit >= 55296 && codeUnit <= 57343)
|
|
1639
|
+
++i;
|
|
1640
|
+
len += 4;
|
|
1641
|
+
}
|
|
1642
|
+
return len;
|
|
1643
|
+
};
|
|
1644
|
+
var __embind_register_std_wstring = (rawType, charSize, name) => {
|
|
1645
|
+
name = readLatin1String(name);
|
|
1646
|
+
var decodeString, encodeString, getHeap, lengthBytesUTF, shift;
|
|
1647
|
+
if (charSize === 2) {
|
|
1648
|
+
decodeString = UTF16ToString;
|
|
1649
|
+
encodeString = stringToUTF16;
|
|
1650
|
+
lengthBytesUTF = lengthBytesUTF16;
|
|
1651
|
+
getHeap = () => HEAPU16;
|
|
1652
|
+
shift = 1;
|
|
1653
|
+
} else if (charSize === 4) {
|
|
1654
|
+
decodeString = UTF32ToString;
|
|
1655
|
+
encodeString = stringToUTF32;
|
|
1656
|
+
lengthBytesUTF = lengthBytesUTF32;
|
|
1657
|
+
getHeap = () => HEAPU32;
|
|
1658
|
+
shift = 2;
|
|
1659
|
+
}
|
|
1660
|
+
registerType(rawType, {
|
|
1661
|
+
name,
|
|
1662
|
+
fromWireType: (value) => {
|
|
1663
|
+
var length = HEAPU32[value >> 2];
|
|
1664
|
+
var HEAP = getHeap();
|
|
1665
|
+
var str;
|
|
1666
|
+
var decodeStartPtr = value + 4;
|
|
1667
|
+
for (var i = 0; i <= length; ++i) {
|
|
1668
|
+
var currentBytePtr = value + 4 + i * charSize;
|
|
1669
|
+
if (i == length || HEAP[currentBytePtr >> shift] == 0) {
|
|
1670
|
+
var maxReadBytes = currentBytePtr - decodeStartPtr;
|
|
1671
|
+
var stringSegment = decodeString(decodeStartPtr, maxReadBytes);
|
|
1672
|
+
if (str === void 0) {
|
|
1673
|
+
str = stringSegment;
|
|
1674
|
+
} else {
|
|
1675
|
+
str += String.fromCharCode(0);
|
|
1676
|
+
str += stringSegment;
|
|
1677
|
+
}
|
|
1678
|
+
decodeStartPtr = currentBytePtr + charSize;
|
|
1679
|
+
}
|
|
1680
|
+
}
|
|
1681
|
+
_free(value);
|
|
1682
|
+
return str;
|
|
1683
|
+
},
|
|
1684
|
+
toWireType: (destructors, value) => {
|
|
1685
|
+
if (!(typeof value == "string")) {
|
|
1686
|
+
throwBindingError(`Cannot pass non-string to C++ string type ${name}`);
|
|
1687
|
+
}
|
|
1688
|
+
var length = lengthBytesUTF(value);
|
|
1689
|
+
var ptr = _malloc(4 + length + charSize);
|
|
1690
|
+
HEAPU32[ptr >> 2] = length >> shift;
|
|
1691
|
+
encodeString(value, ptr + 4, length + charSize);
|
|
1692
|
+
if (destructors !== null) {
|
|
1693
|
+
destructors.push(_free, ptr);
|
|
1694
|
+
}
|
|
1695
|
+
return ptr;
|
|
1696
|
+
},
|
|
1697
|
+
argPackAdvance: GenericWireTypeSize,
|
|
1698
|
+
readValueFromPointer: simpleReadValueFromPointer,
|
|
1699
|
+
destructorFunction(ptr) {
|
|
1700
|
+
_free(ptr);
|
|
1701
|
+
}
|
|
1702
|
+
});
|
|
1703
|
+
};
|
|
1704
|
+
var __embind_register_void = (rawType, name) => {
|
|
1705
|
+
name = readLatin1String(name);
|
|
1706
|
+
registerType(rawType, {
|
|
1707
|
+
isVoid: true,
|
|
1708
|
+
name,
|
|
1709
|
+
argPackAdvance: 0,
|
|
1710
|
+
fromWireType: () => void 0,
|
|
1711
|
+
toWireType: (destructors, o) => void 0
|
|
1712
|
+
});
|
|
1713
|
+
};
|
|
1714
|
+
var __emscripten_throw_longjmp = () => {
|
|
1715
|
+
throw Infinity;
|
|
1716
|
+
};
|
|
1717
|
+
var __emval_incref = (handle) => {
|
|
1718
|
+
if (handle > 4) {
|
|
1719
|
+
emval_handles.get(handle).refcount += 1;
|
|
1720
|
+
}
|
|
1721
|
+
};
|
|
1722
|
+
var requireRegisteredType = (rawType, humanName) => {
|
|
1723
|
+
var impl = registeredTypes[rawType];
|
|
1724
|
+
if (void 0 === impl) {
|
|
1725
|
+
throwBindingError(humanName + " has unknown type " + getTypeName(rawType));
|
|
1726
|
+
}
|
|
1727
|
+
return impl;
|
|
1728
|
+
};
|
|
1729
|
+
var __emval_take_value = (type, arg) => {
|
|
1730
|
+
type = requireRegisteredType(type, "_emval_take_value");
|
|
1731
|
+
var v = type["readValueFromPointer"](arg);
|
|
1732
|
+
return Emval.toHandle(v);
|
|
1733
|
+
};
|
|
1734
|
+
var _abort = () => {
|
|
1735
|
+
abort("");
|
|
1736
|
+
};
|
|
1737
|
+
var _emscripten_memcpy_js = (dest, src, num) => HEAPU8.copyWithin(dest, src, src + num);
|
|
1738
|
+
var getHeapMax = () => 2147483648;
|
|
1739
|
+
var growMemory = (size) => {
|
|
1740
|
+
var b = wasmMemory.buffer;
|
|
1741
|
+
var pages = (size - b.byteLength + 65535) / 65536;
|
|
1742
|
+
try {
|
|
1743
|
+
wasmMemory.grow(pages);
|
|
1744
|
+
updateMemoryViews();
|
|
1745
|
+
return 1;
|
|
1746
|
+
} catch (e) {
|
|
1747
|
+
}
|
|
1748
|
+
};
|
|
1749
|
+
var _emscripten_resize_heap = (requestedSize) => {
|
|
1750
|
+
var oldSize = HEAPU8.length;
|
|
1751
|
+
requestedSize >>>= 0;
|
|
1752
|
+
var maxHeapSize = getHeapMax();
|
|
1753
|
+
if (requestedSize > maxHeapSize) {
|
|
1754
|
+
return false;
|
|
1755
|
+
}
|
|
1756
|
+
var alignUp = (x, multiple) => x + (multiple - x % multiple) % multiple;
|
|
1757
|
+
for (var cutDown = 1; cutDown <= 4; cutDown *= 2) {
|
|
1758
|
+
var overGrownHeapSize = oldSize * (1 + 0.2 / cutDown);
|
|
1759
|
+
overGrownHeapSize = Math.min(overGrownHeapSize, requestedSize + 100663296);
|
|
1760
|
+
var newSize = Math.min(maxHeapSize, alignUp(Math.max(requestedSize, overGrownHeapSize), 65536));
|
|
1761
|
+
var replacement = growMemory(newSize);
|
|
1762
|
+
if (replacement) {
|
|
1763
|
+
return true;
|
|
1764
|
+
}
|
|
1765
|
+
}
|
|
1766
|
+
return false;
|
|
1767
|
+
};
|
|
1768
|
+
var _fd_close = (fd) => 52;
|
|
1769
|
+
var _fd_read = (fd, iov, iovcnt, pnum) => 52;
|
|
1770
|
+
function _fd_seek(fd, offset_low, offset_high, whence, newOffset) {
|
|
1771
|
+
return 70;
|
|
1772
|
+
}
|
|
1773
|
+
var printCharBuffers = [null, [], []];
|
|
1774
|
+
var printChar = (stream, curr) => {
|
|
1775
|
+
var buffer = printCharBuffers[stream];
|
|
1776
|
+
if (curr === 0 || curr === 10) {
|
|
1777
|
+
(stream === 1 ? out : err)(UTF8ArrayToString(buffer, 0));
|
|
1778
|
+
buffer.length = 0;
|
|
1779
|
+
} else {
|
|
1780
|
+
buffer.push(curr);
|
|
1781
|
+
}
|
|
1782
|
+
};
|
|
1783
|
+
var _fd_write = (fd, iov, iovcnt, pnum) => {
|
|
1784
|
+
var num = 0;
|
|
1785
|
+
for (var i = 0; i < iovcnt; i++) {
|
|
1786
|
+
var ptr = HEAPU32[iov >> 2];
|
|
1787
|
+
var len = HEAPU32[iov + 4 >> 2];
|
|
1788
|
+
iov += 8;
|
|
1789
|
+
for (var j = 0; j < len; j++) {
|
|
1790
|
+
printChar(fd, HEAPU8[ptr + j]);
|
|
1791
|
+
}
|
|
1792
|
+
num += len;
|
|
1793
|
+
}
|
|
1794
|
+
HEAPU32[pnum >> 2] = num;
|
|
1795
|
+
return 0;
|
|
1796
|
+
};
|
|
1797
|
+
embind_init_charCodes();
|
|
1798
|
+
BindingError = Module["BindingError"] = class BindingError extends Error {
|
|
1799
|
+
constructor(message) {
|
|
1800
|
+
super(message);
|
|
1801
|
+
this.name = "BindingError";
|
|
1802
|
+
}
|
|
1803
|
+
};
|
|
1804
|
+
InternalError = Module["InternalError"] = class InternalError extends Error {
|
|
1805
|
+
constructor(message) {
|
|
1806
|
+
super(message);
|
|
1807
|
+
this.name = "InternalError";
|
|
1808
|
+
}
|
|
1809
|
+
};
|
|
1810
|
+
init_ClassHandle();
|
|
1811
|
+
init_embind();
|
|
1812
|
+
init_RegisteredPointer();
|
|
1813
|
+
UnboundTypeError = Module["UnboundTypeError"] = extendError(Error, "UnboundTypeError");
|
|
1814
|
+
handleAllocatorInit();
|
|
1815
|
+
init_emval();
|
|
1816
|
+
var wasmImports = {
|
|
1817
|
+
/** @export */
|
|
1818
|
+
b: ___assert_fail,
|
|
1819
|
+
/** @export */
|
|
1820
|
+
n: ___syscall_fcntl64,
|
|
1821
|
+
/** @export */
|
|
1822
|
+
D: ___syscall_ioctl,
|
|
1823
|
+
/** @export */
|
|
1824
|
+
E: ___syscall_openat,
|
|
1825
|
+
/** @export */
|
|
1826
|
+
w: __embind_register_bigint,
|
|
1827
|
+
/** @export */
|
|
1828
|
+
q: __embind_register_bool,
|
|
1829
|
+
/** @export */
|
|
1830
|
+
H: __embind_register_class,
|
|
1831
|
+
/** @export */
|
|
1832
|
+
G: __embind_register_class_constructor,
|
|
1833
|
+
/** @export */
|
|
1834
|
+
e: __embind_register_class_function,
|
|
1835
|
+
/** @export */
|
|
1836
|
+
F: __embind_register_emval,
|
|
1837
|
+
/** @export */
|
|
1838
|
+
o: __embind_register_float,
|
|
1839
|
+
/** @export */
|
|
1840
|
+
f: __embind_register_integer,
|
|
1841
|
+
/** @export */
|
|
1842
|
+
d: __embind_register_memory_view,
|
|
1843
|
+
/** @export */
|
|
1844
|
+
p: __embind_register_std_string,
|
|
1845
|
+
/** @export */
|
|
1846
|
+
k: __embind_register_std_wstring,
|
|
1847
|
+
/** @export */
|
|
1848
|
+
r: __embind_register_void,
|
|
1849
|
+
/** @export */
|
|
1850
|
+
y: __emscripten_throw_longjmp,
|
|
1851
|
+
/** @export */
|
|
1852
|
+
s: __emval_decref,
|
|
1853
|
+
/** @export */
|
|
1854
|
+
t: __emval_incref,
|
|
1855
|
+
/** @export */
|
|
1856
|
+
g: __emval_take_value,
|
|
1857
|
+
/** @export */
|
|
1858
|
+
h: _abort,
|
|
1859
|
+
/** @export */
|
|
1860
|
+
A: _emscripten_memcpy_js,
|
|
1861
|
+
/** @export */
|
|
1862
|
+
z: _emscripten_resize_heap,
|
|
1863
|
+
/** @export */
|
|
1864
|
+
m: _fd_close,
|
|
1865
|
+
/** @export */
|
|
1866
|
+
C: _fd_read,
|
|
1867
|
+
/** @export */
|
|
1868
|
+
v: _fd_seek,
|
|
1869
|
+
/** @export */
|
|
1870
|
+
B: _fd_write,
|
|
1871
|
+
/** @export */
|
|
1872
|
+
j: invoke_ii,
|
|
1873
|
+
/** @export */
|
|
1874
|
+
i: invoke_iiii,
|
|
1875
|
+
/** @export */
|
|
1876
|
+
l: invoke_iiiiii,
|
|
1877
|
+
/** @export */
|
|
1878
|
+
a: invoke_vi,
|
|
1879
|
+
/** @export */
|
|
1880
|
+
c: invoke_vii,
|
|
1881
|
+
/** @export */
|
|
1882
|
+
x: invoke_viiii,
|
|
1883
|
+
/** @export */
|
|
1884
|
+
u: invoke_viiij
|
|
1885
|
+
};
|
|
1886
|
+
var wasmExports = createWasm();
|
|
1887
|
+
var _free = (a0) => (_free = wasmExports["K"])(a0);
|
|
1888
|
+
var _malloc = (a0) => (_malloc = wasmExports["L"])(a0);
|
|
1889
|
+
var ___getTypeName = (a0) => (___getTypeName = wasmExports["M"])(a0);
|
|
1890
|
+
Module["__embind_initialize_bindings"] = () => (Module["__embind_initialize_bindings"] = wasmExports["N"])();
|
|
1891
|
+
var _setThrew = (a0, a1) => (_setThrew = wasmExports["P"])(a0, a1);
|
|
1892
|
+
var stackSave = () => (stackSave = wasmExports["Q"])();
|
|
1893
|
+
var stackRestore = (a0) => (stackRestore = wasmExports["R"])(a0);
|
|
1894
|
+
var dynCall_viiij = Module["dynCall_viiij"] = (a0, a1, a2, a3, a4, a5) => (dynCall_viiij = Module["dynCall_viiij"] = wasmExports["S"])(a0, a1, a2, a3, a4, a5);
|
|
1895
|
+
Module["dynCall_jiji"] = (a0, a1, a2, a3, a4) => (Module["dynCall_jiji"] = wasmExports["T"])(a0, a1, a2, a3, a4);
|
|
1896
|
+
function invoke_vi(index, a1) {
|
|
1897
|
+
var sp = stackSave();
|
|
1898
|
+
try {
|
|
1899
|
+
getWasmTableEntry(index)(a1);
|
|
1900
|
+
} catch (e) {
|
|
1901
|
+
stackRestore(sp);
|
|
1902
|
+
if (e !== e + 0)
|
|
1903
|
+
throw e;
|
|
1904
|
+
_setThrew(1, 0);
|
|
1905
|
+
}
|
|
1906
|
+
}
|
|
1907
|
+
function invoke_vii(index, a1, a2) {
|
|
1908
|
+
var sp = stackSave();
|
|
1909
|
+
try {
|
|
1910
|
+
getWasmTableEntry(index)(a1, a2);
|
|
1911
|
+
} catch (e) {
|
|
1912
|
+
stackRestore(sp);
|
|
1913
|
+
if (e !== e + 0)
|
|
1914
|
+
throw e;
|
|
1915
|
+
_setThrew(1, 0);
|
|
1916
|
+
}
|
|
1917
|
+
}
|
|
1918
|
+
function invoke_ii(index, a1) {
|
|
1919
|
+
var sp = stackSave();
|
|
1920
|
+
try {
|
|
1921
|
+
return getWasmTableEntry(index)(a1);
|
|
1922
|
+
} catch (e) {
|
|
1923
|
+
stackRestore(sp);
|
|
1924
|
+
if (e !== e + 0)
|
|
1925
|
+
throw e;
|
|
1926
|
+
_setThrew(1, 0);
|
|
1927
|
+
}
|
|
1928
|
+
}
|
|
1929
|
+
function invoke_iiii(index, a1, a2, a3) {
|
|
1930
|
+
var sp = stackSave();
|
|
1931
|
+
try {
|
|
1932
|
+
return getWasmTableEntry(index)(a1, a2, a3);
|
|
1933
|
+
} catch (e) {
|
|
1934
|
+
stackRestore(sp);
|
|
1935
|
+
if (e !== e + 0)
|
|
1936
|
+
throw e;
|
|
1937
|
+
_setThrew(1, 0);
|
|
1938
|
+
}
|
|
1939
|
+
}
|
|
1940
|
+
function invoke_iiiiii(index, a1, a2, a3, a4, a5) {
|
|
1941
|
+
var sp = stackSave();
|
|
1942
|
+
try {
|
|
1943
|
+
return getWasmTableEntry(index)(a1, a2, a3, a4, a5);
|
|
1944
|
+
} catch (e) {
|
|
1945
|
+
stackRestore(sp);
|
|
1946
|
+
if (e !== e + 0)
|
|
1947
|
+
throw e;
|
|
1948
|
+
_setThrew(1, 0);
|
|
1949
|
+
}
|
|
1950
|
+
}
|
|
1951
|
+
function invoke_viiii(index, a1, a2, a3, a4) {
|
|
1952
|
+
var sp = stackSave();
|
|
1953
|
+
try {
|
|
1954
|
+
getWasmTableEntry(index)(a1, a2, a3, a4);
|
|
1955
|
+
} catch (e) {
|
|
1956
|
+
stackRestore(sp);
|
|
1957
|
+
if (e !== e + 0)
|
|
1958
|
+
throw e;
|
|
1959
|
+
_setThrew(1, 0);
|
|
1960
|
+
}
|
|
1961
|
+
}
|
|
1962
|
+
function invoke_viiij(index, a1, a2, a3, a4, a5) {
|
|
1963
|
+
var sp = stackSave();
|
|
1964
|
+
try {
|
|
1965
|
+
dynCall_viiij(index, a1, a2, a3, a4, a5);
|
|
1966
|
+
} catch (e) {
|
|
1967
|
+
stackRestore(sp);
|
|
1968
|
+
if (e !== e + 0)
|
|
1969
|
+
throw e;
|
|
1970
|
+
_setThrew(1, 0);
|
|
1971
|
+
}
|
|
1972
|
+
}
|
|
1973
|
+
var calledRun;
|
|
1974
|
+
dependenciesFulfilled = function runCaller() {
|
|
1975
|
+
if (!calledRun)
|
|
1976
|
+
run();
|
|
1977
|
+
if (!calledRun)
|
|
1978
|
+
dependenciesFulfilled = runCaller;
|
|
1979
|
+
};
|
|
1980
|
+
function run() {
|
|
1981
|
+
if (runDependencies > 0) {
|
|
1982
|
+
return;
|
|
1983
|
+
}
|
|
1984
|
+
preRun();
|
|
1985
|
+
if (runDependencies > 0) {
|
|
1986
|
+
return;
|
|
1987
|
+
}
|
|
1988
|
+
function doRun() {
|
|
1989
|
+
if (calledRun)
|
|
1990
|
+
return;
|
|
1991
|
+
calledRun = true;
|
|
1992
|
+
Module["calledRun"] = true;
|
|
1993
|
+
if (ABORT)
|
|
1994
|
+
return;
|
|
1995
|
+
initRuntime();
|
|
1996
|
+
readyPromiseResolve(Module);
|
|
1997
|
+
if (Module["onRuntimeInitialized"])
|
|
1998
|
+
Module["onRuntimeInitialized"]();
|
|
1999
|
+
postRun();
|
|
2000
|
+
}
|
|
2001
|
+
if (Module["setStatus"]) {
|
|
2002
|
+
Module["setStatus"]("Running...");
|
|
2003
|
+
setTimeout(function() {
|
|
2004
|
+
setTimeout(function() {
|
|
2005
|
+
Module["setStatus"]("");
|
|
2006
|
+
}, 1);
|
|
2007
|
+
doRun();
|
|
2008
|
+
}, 1);
|
|
2009
|
+
} else {
|
|
2010
|
+
doRun();
|
|
2011
|
+
}
|
|
2012
|
+
}
|
|
2013
|
+
if (Module["preInit"]) {
|
|
2014
|
+
if (typeof Module["preInit"] == "function")
|
|
2015
|
+
Module["preInit"] = [Module["preInit"]];
|
|
2016
|
+
while (Module["preInit"].length > 0) {
|
|
2017
|
+
Module["preInit"].pop()();
|
|
2018
|
+
}
|
|
2019
|
+
}
|
|
2020
|
+
run();
|
|
2021
|
+
return moduleArg.ready;
|
|
2022
|
+
};
|
|
2023
|
+
})();
|
|
2024
|
+
var renderer_default = createRendererModule;
|
|
2025
|
+
|
|
2026
|
+
export { renderer_default as default };
|