@ifc-lite/wasm 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +373 -0
- package/README.md +402 -0
- package/ifc_lite_wasm.d.ts +296 -0
- package/ifc_lite_wasm.js +1045 -0
- package/ifc_lite_wasm_bg.wasm +0 -0
- package/package.json +44 -0
package/ifc_lite_wasm.js
ADDED
|
@@ -0,0 +1,1045 @@
|
|
|
1
|
+
let wasm;
|
|
2
|
+
|
|
3
|
+
function addHeapObject(obj) {
|
|
4
|
+
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
5
|
+
const idx = heap_next;
|
|
6
|
+
heap_next = heap[idx];
|
|
7
|
+
|
|
8
|
+
heap[idx] = obj;
|
|
9
|
+
return idx;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
|
|
13
|
+
? { register: () => {}, unregister: () => {} }
|
|
14
|
+
: new FinalizationRegistry(state => state.dtor(state.a, state.b));
|
|
15
|
+
|
|
16
|
+
function debugString(val) {
|
|
17
|
+
// primitive types
|
|
18
|
+
const type = typeof val;
|
|
19
|
+
if (type == 'number' || type == 'boolean' || val == null) {
|
|
20
|
+
return `${val}`;
|
|
21
|
+
}
|
|
22
|
+
if (type == 'string') {
|
|
23
|
+
return `"${val}"`;
|
|
24
|
+
}
|
|
25
|
+
if (type == 'symbol') {
|
|
26
|
+
const description = val.description;
|
|
27
|
+
if (description == null) {
|
|
28
|
+
return 'Symbol';
|
|
29
|
+
} else {
|
|
30
|
+
return `Symbol(${description})`;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
if (type == 'function') {
|
|
34
|
+
const name = val.name;
|
|
35
|
+
if (typeof name == 'string' && name.length > 0) {
|
|
36
|
+
return `Function(${name})`;
|
|
37
|
+
} else {
|
|
38
|
+
return 'Function';
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
// objects
|
|
42
|
+
if (Array.isArray(val)) {
|
|
43
|
+
const length = val.length;
|
|
44
|
+
let debug = '[';
|
|
45
|
+
if (length > 0) {
|
|
46
|
+
debug += debugString(val[0]);
|
|
47
|
+
}
|
|
48
|
+
for(let i = 1; i < length; i++) {
|
|
49
|
+
debug += ', ' + debugString(val[i]);
|
|
50
|
+
}
|
|
51
|
+
debug += ']';
|
|
52
|
+
return debug;
|
|
53
|
+
}
|
|
54
|
+
// Test for built-in
|
|
55
|
+
const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
|
|
56
|
+
let className;
|
|
57
|
+
if (builtInMatches && builtInMatches.length > 1) {
|
|
58
|
+
className = builtInMatches[1];
|
|
59
|
+
} else {
|
|
60
|
+
// Failed to match the standard '[object ClassName]'
|
|
61
|
+
return toString.call(val);
|
|
62
|
+
}
|
|
63
|
+
if (className == 'Object') {
|
|
64
|
+
// we're a user defined class or Object
|
|
65
|
+
// JSON.stringify avoids problems with cycles, and is generally much
|
|
66
|
+
// easier than looping through ownProperties of `val`.
|
|
67
|
+
try {
|
|
68
|
+
return 'Object(' + JSON.stringify(val) + ')';
|
|
69
|
+
} catch (_) {
|
|
70
|
+
return 'Object';
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
// errors
|
|
74
|
+
if (val instanceof Error) {
|
|
75
|
+
return `${val.name}: ${val.message}\n${val.stack}`;
|
|
76
|
+
}
|
|
77
|
+
// TODO we could test for more things here, like `Set`s and `Map`s.
|
|
78
|
+
return className;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function dropObject(idx) {
|
|
82
|
+
if (idx < 132) return;
|
|
83
|
+
heap[idx] = heap_next;
|
|
84
|
+
heap_next = idx;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function getArrayF32FromWasm0(ptr, len) {
|
|
88
|
+
ptr = ptr >>> 0;
|
|
89
|
+
return getFloat32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function getArrayU32FromWasm0(ptr, len) {
|
|
93
|
+
ptr = ptr >>> 0;
|
|
94
|
+
return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
let cachedDataViewMemory0 = null;
|
|
98
|
+
function getDataViewMemory0() {
|
|
99
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
100
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
101
|
+
}
|
|
102
|
+
return cachedDataViewMemory0;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
let cachedFloat32ArrayMemory0 = null;
|
|
106
|
+
function getFloat32ArrayMemory0() {
|
|
107
|
+
if (cachedFloat32ArrayMemory0 === null || cachedFloat32ArrayMemory0.byteLength === 0) {
|
|
108
|
+
cachedFloat32ArrayMemory0 = new Float32Array(wasm.memory.buffer);
|
|
109
|
+
}
|
|
110
|
+
return cachedFloat32ArrayMemory0;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
function getStringFromWasm0(ptr, len) {
|
|
114
|
+
ptr = ptr >>> 0;
|
|
115
|
+
return decodeText(ptr, len);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
let cachedUint32ArrayMemory0 = null;
|
|
119
|
+
function getUint32ArrayMemory0() {
|
|
120
|
+
if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
|
|
121
|
+
cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
|
|
122
|
+
}
|
|
123
|
+
return cachedUint32ArrayMemory0;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
let cachedUint8ArrayMemory0 = null;
|
|
127
|
+
function getUint8ArrayMemory0() {
|
|
128
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
129
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
130
|
+
}
|
|
131
|
+
return cachedUint8ArrayMemory0;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
function getObject(idx) { return heap[idx]; }
|
|
135
|
+
|
|
136
|
+
function handleError(f, args) {
|
|
137
|
+
try {
|
|
138
|
+
return f.apply(this, args);
|
|
139
|
+
} catch (e) {
|
|
140
|
+
wasm.__wbindgen_export3(addHeapObject(e));
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
let heap = new Array(128).fill(undefined);
|
|
145
|
+
heap.push(undefined, null, true, false);
|
|
146
|
+
|
|
147
|
+
let heap_next = heap.length;
|
|
148
|
+
|
|
149
|
+
function isLikeNone(x) {
|
|
150
|
+
return x === undefined || x === null;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
function makeMutClosure(arg0, arg1, dtor, f) {
|
|
154
|
+
const state = { a: arg0, b: arg1, cnt: 1, dtor };
|
|
155
|
+
const real = (...args) => {
|
|
156
|
+
|
|
157
|
+
// First up with a closure we increment the internal reference
|
|
158
|
+
// count. This ensures that the Rust closure environment won't
|
|
159
|
+
// be deallocated while we're invoking it.
|
|
160
|
+
state.cnt++;
|
|
161
|
+
const a = state.a;
|
|
162
|
+
state.a = 0;
|
|
163
|
+
try {
|
|
164
|
+
return f(a, state.b, ...args);
|
|
165
|
+
} finally {
|
|
166
|
+
state.a = a;
|
|
167
|
+
real._wbg_cb_unref();
|
|
168
|
+
}
|
|
169
|
+
};
|
|
170
|
+
real._wbg_cb_unref = () => {
|
|
171
|
+
if (--state.cnt === 0) {
|
|
172
|
+
state.dtor(state.a, state.b);
|
|
173
|
+
state.a = 0;
|
|
174
|
+
CLOSURE_DTORS.unregister(state);
|
|
175
|
+
}
|
|
176
|
+
};
|
|
177
|
+
CLOSURE_DTORS.register(real, state, state);
|
|
178
|
+
return real;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
182
|
+
if (realloc === undefined) {
|
|
183
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
184
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
185
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
186
|
+
WASM_VECTOR_LEN = buf.length;
|
|
187
|
+
return ptr;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
let len = arg.length;
|
|
191
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
192
|
+
|
|
193
|
+
const mem = getUint8ArrayMemory0();
|
|
194
|
+
|
|
195
|
+
let offset = 0;
|
|
196
|
+
|
|
197
|
+
for (; offset < len; offset++) {
|
|
198
|
+
const code = arg.charCodeAt(offset);
|
|
199
|
+
if (code > 0x7F) break;
|
|
200
|
+
mem[ptr + offset] = code;
|
|
201
|
+
}
|
|
202
|
+
if (offset !== len) {
|
|
203
|
+
if (offset !== 0) {
|
|
204
|
+
arg = arg.slice(offset);
|
|
205
|
+
}
|
|
206
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
207
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
208
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
209
|
+
|
|
210
|
+
offset += ret.written;
|
|
211
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
WASM_VECTOR_LEN = offset;
|
|
215
|
+
return ptr;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
function takeObject(idx) {
|
|
219
|
+
const ret = getObject(idx);
|
|
220
|
+
dropObject(idx);
|
|
221
|
+
return ret;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
225
|
+
cachedTextDecoder.decode();
|
|
226
|
+
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
227
|
+
let numBytesDecoded = 0;
|
|
228
|
+
function decodeText(ptr, len) {
|
|
229
|
+
numBytesDecoded += len;
|
|
230
|
+
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
231
|
+
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
232
|
+
cachedTextDecoder.decode();
|
|
233
|
+
numBytesDecoded = len;
|
|
234
|
+
}
|
|
235
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
const cachedTextEncoder = new TextEncoder();
|
|
239
|
+
|
|
240
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
241
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
242
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
243
|
+
view.set(buf);
|
|
244
|
+
return {
|
|
245
|
+
read: arg.length,
|
|
246
|
+
written: buf.length
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
let WASM_VECTOR_LEN = 0;
|
|
252
|
+
|
|
253
|
+
function __wasm_bindgen_func_elem_160(arg0, arg1, arg2) {
|
|
254
|
+
wasm.__wasm_bindgen_func_elem_160(arg0, arg1, addHeapObject(arg2));
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
function __wasm_bindgen_func_elem_198(arg0, arg1, arg2, arg3) {
|
|
258
|
+
wasm.__wasm_bindgen_func_elem_198(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
const IfcAPIFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
262
|
+
? { register: () => {}, unregister: () => {} }
|
|
263
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_ifcapi_free(ptr >>> 0, 1));
|
|
264
|
+
|
|
265
|
+
const MeshCollectionFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
266
|
+
? { register: () => {}, unregister: () => {} }
|
|
267
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_meshcollection_free(ptr >>> 0, 1));
|
|
268
|
+
|
|
269
|
+
const MeshDataJsFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
270
|
+
? { register: () => {}, unregister: () => {} }
|
|
271
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_meshdatajs_free(ptr >>> 0, 1));
|
|
272
|
+
|
|
273
|
+
const ZeroCopyMeshFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
274
|
+
? { register: () => {}, unregister: () => {} }
|
|
275
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_zerocopymesh_free(ptr >>> 0, 1));
|
|
276
|
+
|
|
277
|
+
/**
|
|
278
|
+
* Main IFC-Lite API
|
|
279
|
+
*/
|
|
280
|
+
export class IfcAPI {
|
|
281
|
+
__destroy_into_raw() {
|
|
282
|
+
const ptr = this.__wbg_ptr;
|
|
283
|
+
this.__wbg_ptr = 0;
|
|
284
|
+
IfcAPIFinalization.unregister(this);
|
|
285
|
+
return ptr;
|
|
286
|
+
}
|
|
287
|
+
free() {
|
|
288
|
+
const ptr = this.__destroy_into_raw();
|
|
289
|
+
wasm.__wbg_ifcapi_free(ptr, 0);
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* Get WASM memory for zero-copy access
|
|
293
|
+
* @returns {any}
|
|
294
|
+
*/
|
|
295
|
+
getMemory() {
|
|
296
|
+
const ret = wasm.ifcapi_getMemory(this.__wbg_ptr);
|
|
297
|
+
return takeObject(ret);
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* Parse IFC file and return individual meshes with express IDs and colors
|
|
301
|
+
* This matches the MeshData[] format expected by the viewer
|
|
302
|
+
*
|
|
303
|
+
* Example:
|
|
304
|
+
* ```javascript
|
|
305
|
+
* const api = new IfcAPI();
|
|
306
|
+
* const collection = api.parseMeshes(ifcData);
|
|
307
|
+
* for (let i = 0; i < collection.length; i++) {
|
|
308
|
+
* const mesh = collection.get(i);
|
|
309
|
+
* console.log('Express ID:', mesh.expressId);
|
|
310
|
+
* console.log('Positions:', mesh.positions);
|
|
311
|
+
* console.log('Color:', mesh.color);
|
|
312
|
+
* }
|
|
313
|
+
* ```
|
|
314
|
+
* @param {string} content
|
|
315
|
+
* @returns {MeshCollection}
|
|
316
|
+
*/
|
|
317
|
+
parseMeshes(content) {
|
|
318
|
+
const ptr0 = passStringToWasm0(content, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
319
|
+
const len0 = WASM_VECTOR_LEN;
|
|
320
|
+
const ret = wasm.ifcapi_parseMeshes(this.__wbg_ptr, ptr0, len0);
|
|
321
|
+
return MeshCollection.__wrap(ret);
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
324
|
+
* Parse IFC file with streaming events
|
|
325
|
+
* Calls the callback function for each parse event
|
|
326
|
+
*
|
|
327
|
+
* Example:
|
|
328
|
+
* ```javascript
|
|
329
|
+
* const api = new IfcAPI();
|
|
330
|
+
* await api.parseStreaming(ifcData, (event) => {
|
|
331
|
+
* console.log('Event:', event);
|
|
332
|
+
* });
|
|
333
|
+
* ```
|
|
334
|
+
* @param {string} content
|
|
335
|
+
* @param {Function} callback
|
|
336
|
+
* @returns {Promise<any>}
|
|
337
|
+
*/
|
|
338
|
+
parseStreaming(content, callback) {
|
|
339
|
+
const ptr0 = passStringToWasm0(content, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
340
|
+
const len0 = WASM_VECTOR_LEN;
|
|
341
|
+
const ret = wasm.ifcapi_parseStreaming(this.__wbg_ptr, ptr0, len0, addHeapObject(callback));
|
|
342
|
+
return takeObject(ret);
|
|
343
|
+
}
|
|
344
|
+
/**
|
|
345
|
+
* Parse IFC file with zero-copy mesh data
|
|
346
|
+
* Maximum performance - returns mesh with direct memory access
|
|
347
|
+
*
|
|
348
|
+
* Example:
|
|
349
|
+
* ```javascript
|
|
350
|
+
* const api = new IfcAPI();
|
|
351
|
+
* const mesh = await api.parseZeroCopy(ifcData);
|
|
352
|
+
*
|
|
353
|
+
* // Create TypedArray views (NO COPYING!)
|
|
354
|
+
* const memory = await api.getMemory();
|
|
355
|
+
* const positions = new Float32Array(
|
|
356
|
+
* memory.buffer,
|
|
357
|
+
* mesh.positions_ptr,
|
|
358
|
+
* mesh.positions_len
|
|
359
|
+
* );
|
|
360
|
+
*
|
|
361
|
+
* // Upload directly to GPU
|
|
362
|
+
* gl.bufferData(gl.ARRAY_BUFFER, positions, gl.STATIC_DRAW);
|
|
363
|
+
* ```
|
|
364
|
+
* @param {string} content
|
|
365
|
+
* @returns {ZeroCopyMesh}
|
|
366
|
+
*/
|
|
367
|
+
parseZeroCopy(content) {
|
|
368
|
+
const ptr0 = passStringToWasm0(content, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
369
|
+
const len0 = WASM_VECTOR_LEN;
|
|
370
|
+
const ret = wasm.ifcapi_parseZeroCopy(this.__wbg_ptr, ptr0, len0);
|
|
371
|
+
return ZeroCopyMesh.__wrap(ret);
|
|
372
|
+
}
|
|
373
|
+
/**
|
|
374
|
+
* Debug: Test processing entity #953 (FacetedBrep wall)
|
|
375
|
+
* @param {string} content
|
|
376
|
+
* @returns {string}
|
|
377
|
+
*/
|
|
378
|
+
debugProcessEntity953(content) {
|
|
379
|
+
let deferred2_0;
|
|
380
|
+
let deferred2_1;
|
|
381
|
+
try {
|
|
382
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
383
|
+
const ptr0 = passStringToWasm0(content, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
384
|
+
const len0 = WASM_VECTOR_LEN;
|
|
385
|
+
wasm.ifcapi_debugProcessEntity953(retptr, this.__wbg_ptr, ptr0, len0);
|
|
386
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
387
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
388
|
+
deferred2_0 = r0;
|
|
389
|
+
deferred2_1 = r1;
|
|
390
|
+
return getStringFromWasm0(r0, r1);
|
|
391
|
+
} finally {
|
|
392
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
393
|
+
wasm.__wbindgen_export4(deferred2_0, deferred2_1, 1);
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
/**
|
|
397
|
+
* Debug: Test processing a single wall
|
|
398
|
+
* @param {string} content
|
|
399
|
+
* @returns {string}
|
|
400
|
+
*/
|
|
401
|
+
debugProcessFirstWall(content) {
|
|
402
|
+
let deferred2_0;
|
|
403
|
+
let deferred2_1;
|
|
404
|
+
try {
|
|
405
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
406
|
+
const ptr0 = passStringToWasm0(content, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
407
|
+
const len0 = WASM_VECTOR_LEN;
|
|
408
|
+
wasm.ifcapi_debugProcessFirstWall(retptr, this.__wbg_ptr, ptr0, len0);
|
|
409
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
410
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
411
|
+
deferred2_0 = r0;
|
|
412
|
+
deferred2_1 = r1;
|
|
413
|
+
return getStringFromWasm0(r0, r1);
|
|
414
|
+
} finally {
|
|
415
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
416
|
+
wasm.__wbindgen_export4(deferred2_0, deferred2_1, 1);
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
/**
|
|
420
|
+
* Create and initialize the IFC API
|
|
421
|
+
*/
|
|
422
|
+
constructor() {
|
|
423
|
+
const ret = wasm.ifcapi_new();
|
|
424
|
+
this.__wbg_ptr = ret >>> 0;
|
|
425
|
+
IfcAPIFinalization.register(this, this.__wbg_ptr, this);
|
|
426
|
+
return this;
|
|
427
|
+
}
|
|
428
|
+
/**
|
|
429
|
+
* Parse IFC file (traditional - waits for completion)
|
|
430
|
+
*
|
|
431
|
+
* Example:
|
|
432
|
+
* ```javascript
|
|
433
|
+
* const api = new IfcAPI();
|
|
434
|
+
* const result = await api.parse(ifcData);
|
|
435
|
+
* console.log('Entities:', result.entityCount);
|
|
436
|
+
* ```
|
|
437
|
+
* @param {string} content
|
|
438
|
+
* @returns {Promise<any>}
|
|
439
|
+
*/
|
|
440
|
+
parse(content) {
|
|
441
|
+
const ptr0 = passStringToWasm0(content, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
442
|
+
const len0 = WASM_VECTOR_LEN;
|
|
443
|
+
const ret = wasm.ifcapi_parse(this.__wbg_ptr, ptr0, len0);
|
|
444
|
+
return takeObject(ret);
|
|
445
|
+
}
|
|
446
|
+
/**
|
|
447
|
+
* Get version string
|
|
448
|
+
* @returns {string}
|
|
449
|
+
*/
|
|
450
|
+
get version() {
|
|
451
|
+
let deferred1_0;
|
|
452
|
+
let deferred1_1;
|
|
453
|
+
try {
|
|
454
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
455
|
+
wasm.ifcapi_version(retptr, this.__wbg_ptr);
|
|
456
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
457
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
458
|
+
deferred1_0 = r0;
|
|
459
|
+
deferred1_1 = r1;
|
|
460
|
+
return getStringFromWasm0(r0, r1);
|
|
461
|
+
} finally {
|
|
462
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
463
|
+
wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
/**
|
|
467
|
+
* Check if API is initialized
|
|
468
|
+
* @returns {boolean}
|
|
469
|
+
*/
|
|
470
|
+
get is_ready() {
|
|
471
|
+
const ret = wasm.ifcapi_is_ready(this.__wbg_ptr);
|
|
472
|
+
return ret !== 0;
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
if (Symbol.dispose) IfcAPI.prototype[Symbol.dispose] = IfcAPI.prototype.free;
|
|
476
|
+
|
|
477
|
+
/**
|
|
478
|
+
* Collection of mesh data for returning multiple meshes
|
|
479
|
+
*/
|
|
480
|
+
export class MeshCollection {
|
|
481
|
+
static __wrap(ptr) {
|
|
482
|
+
ptr = ptr >>> 0;
|
|
483
|
+
const obj = Object.create(MeshCollection.prototype);
|
|
484
|
+
obj.__wbg_ptr = ptr;
|
|
485
|
+
MeshCollectionFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
486
|
+
return obj;
|
|
487
|
+
}
|
|
488
|
+
__destroy_into_raw() {
|
|
489
|
+
const ptr = this.__wbg_ptr;
|
|
490
|
+
this.__wbg_ptr = 0;
|
|
491
|
+
MeshCollectionFinalization.unregister(this);
|
|
492
|
+
return ptr;
|
|
493
|
+
}
|
|
494
|
+
free() {
|
|
495
|
+
const ptr = this.__destroy_into_raw();
|
|
496
|
+
wasm.__wbg_meshcollection_free(ptr, 0);
|
|
497
|
+
}
|
|
498
|
+
/**
|
|
499
|
+
* Get total vertex count across all meshes
|
|
500
|
+
* @returns {number}
|
|
501
|
+
*/
|
|
502
|
+
get totalVertices() {
|
|
503
|
+
const ret = wasm.meshcollection_totalVertices(this.__wbg_ptr);
|
|
504
|
+
return ret >>> 0;
|
|
505
|
+
}
|
|
506
|
+
/**
|
|
507
|
+
* Get total triangle count across all meshes
|
|
508
|
+
* @returns {number}
|
|
509
|
+
*/
|
|
510
|
+
get totalTriangles() {
|
|
511
|
+
const ret = wasm.meshcollection_totalTriangles(this.__wbg_ptr);
|
|
512
|
+
return ret >>> 0;
|
|
513
|
+
}
|
|
514
|
+
/**
|
|
515
|
+
* Get mesh at index
|
|
516
|
+
* @param {number} index
|
|
517
|
+
* @returns {MeshDataJs | undefined}
|
|
518
|
+
*/
|
|
519
|
+
get(index) {
|
|
520
|
+
const ret = wasm.meshcollection_get(this.__wbg_ptr, index);
|
|
521
|
+
return ret === 0 ? undefined : MeshDataJs.__wrap(ret);
|
|
522
|
+
}
|
|
523
|
+
/**
|
|
524
|
+
* Get number of meshes
|
|
525
|
+
* @returns {number}
|
|
526
|
+
*/
|
|
527
|
+
get length() {
|
|
528
|
+
const ret = wasm.meshcollection_length(this.__wbg_ptr);
|
|
529
|
+
return ret >>> 0;
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
if (Symbol.dispose) MeshCollection.prototype[Symbol.dispose] = MeshCollection.prototype.free;
|
|
533
|
+
|
|
534
|
+
/**
|
|
535
|
+
* Individual mesh data with express ID and color (matches MeshData interface)
|
|
536
|
+
*/
|
|
537
|
+
export class MeshDataJs {
|
|
538
|
+
static __wrap(ptr) {
|
|
539
|
+
ptr = ptr >>> 0;
|
|
540
|
+
const obj = Object.create(MeshDataJs.prototype);
|
|
541
|
+
obj.__wbg_ptr = ptr;
|
|
542
|
+
MeshDataJsFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
543
|
+
return obj;
|
|
544
|
+
}
|
|
545
|
+
__destroy_into_raw() {
|
|
546
|
+
const ptr = this.__wbg_ptr;
|
|
547
|
+
this.__wbg_ptr = 0;
|
|
548
|
+
MeshDataJsFinalization.unregister(this);
|
|
549
|
+
return ptr;
|
|
550
|
+
}
|
|
551
|
+
free() {
|
|
552
|
+
const ptr = this.__destroy_into_raw();
|
|
553
|
+
wasm.__wbg_meshdatajs_free(ptr, 0);
|
|
554
|
+
}
|
|
555
|
+
/**
|
|
556
|
+
* Get express ID
|
|
557
|
+
* @returns {number}
|
|
558
|
+
*/
|
|
559
|
+
get expressId() {
|
|
560
|
+
const ret = wasm.meshdatajs_expressId(this.__wbg_ptr);
|
|
561
|
+
return ret >>> 0;
|
|
562
|
+
}
|
|
563
|
+
/**
|
|
564
|
+
* Get vertex count
|
|
565
|
+
* @returns {number}
|
|
566
|
+
*/
|
|
567
|
+
get vertexCount() {
|
|
568
|
+
const ret = wasm.meshdatajs_vertexCount(this.__wbg_ptr);
|
|
569
|
+
return ret >>> 0;
|
|
570
|
+
}
|
|
571
|
+
/**
|
|
572
|
+
* Get triangle count
|
|
573
|
+
* @returns {number}
|
|
574
|
+
*/
|
|
575
|
+
get triangleCount() {
|
|
576
|
+
const ret = wasm.meshdatajs_triangleCount(this.__wbg_ptr);
|
|
577
|
+
return ret >>> 0;
|
|
578
|
+
}
|
|
579
|
+
/**
|
|
580
|
+
* Get color as [r, g, b, a] array
|
|
581
|
+
* @returns {Float32Array}
|
|
582
|
+
*/
|
|
583
|
+
get color() {
|
|
584
|
+
try {
|
|
585
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
586
|
+
wasm.meshdatajs_color(retptr, this.__wbg_ptr);
|
|
587
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
588
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
589
|
+
var v1 = getArrayF32FromWasm0(r0, r1).slice();
|
|
590
|
+
wasm.__wbindgen_export4(r0, r1 * 4, 4);
|
|
591
|
+
return v1;
|
|
592
|
+
} finally {
|
|
593
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
/**
|
|
597
|
+
* Get indices as Uint32Array (copy to JS)
|
|
598
|
+
* @returns {Uint32Array}
|
|
599
|
+
*/
|
|
600
|
+
get indices() {
|
|
601
|
+
const ret = wasm.meshdatajs_indices(this.__wbg_ptr);
|
|
602
|
+
return takeObject(ret);
|
|
603
|
+
}
|
|
604
|
+
/**
|
|
605
|
+
* Get normals as Float32Array (copy to JS)
|
|
606
|
+
* @returns {Float32Array}
|
|
607
|
+
*/
|
|
608
|
+
get normals() {
|
|
609
|
+
const ret = wasm.meshdatajs_normals(this.__wbg_ptr);
|
|
610
|
+
return takeObject(ret);
|
|
611
|
+
}
|
|
612
|
+
/**
|
|
613
|
+
* Get positions as Float32Array (copy to JS)
|
|
614
|
+
* @returns {Float32Array}
|
|
615
|
+
*/
|
|
616
|
+
get positions() {
|
|
617
|
+
const ret = wasm.meshdatajs_positions(this.__wbg_ptr);
|
|
618
|
+
return takeObject(ret);
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
if (Symbol.dispose) MeshDataJs.prototype[Symbol.dispose] = MeshDataJs.prototype.free;
|
|
622
|
+
|
|
623
|
+
/**
|
|
624
|
+
* Zero-copy mesh that exposes pointers to WASM memory
|
|
625
|
+
*/
|
|
626
|
+
export class ZeroCopyMesh {
|
|
627
|
+
static __wrap(ptr) {
|
|
628
|
+
ptr = ptr >>> 0;
|
|
629
|
+
const obj = Object.create(ZeroCopyMesh.prototype);
|
|
630
|
+
obj.__wbg_ptr = ptr;
|
|
631
|
+
ZeroCopyMeshFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
632
|
+
return obj;
|
|
633
|
+
}
|
|
634
|
+
__destroy_into_raw() {
|
|
635
|
+
const ptr = this.__wbg_ptr;
|
|
636
|
+
this.__wbg_ptr = 0;
|
|
637
|
+
ZeroCopyMeshFinalization.unregister(this);
|
|
638
|
+
return ptr;
|
|
639
|
+
}
|
|
640
|
+
free() {
|
|
641
|
+
const ptr = this.__destroy_into_raw();
|
|
642
|
+
wasm.__wbg_zerocopymesh_free(ptr, 0);
|
|
643
|
+
}
|
|
644
|
+
/**
|
|
645
|
+
* Get bounding box maximum point
|
|
646
|
+
* @returns {Float32Array}
|
|
647
|
+
*/
|
|
648
|
+
bounds_max() {
|
|
649
|
+
try {
|
|
650
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
651
|
+
wasm.zerocopymesh_bounds_max(retptr, this.__wbg_ptr);
|
|
652
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
653
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
654
|
+
var v1 = getArrayF32FromWasm0(r0, r1).slice();
|
|
655
|
+
wasm.__wbindgen_export4(r0, r1 * 4, 4);
|
|
656
|
+
return v1;
|
|
657
|
+
} finally {
|
|
658
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
659
|
+
}
|
|
660
|
+
}
|
|
661
|
+
/**
|
|
662
|
+
* Get bounding box minimum point
|
|
663
|
+
* @returns {Float32Array}
|
|
664
|
+
*/
|
|
665
|
+
bounds_min() {
|
|
666
|
+
try {
|
|
667
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
668
|
+
wasm.zerocopymesh_bounds_min(retptr, this.__wbg_ptr);
|
|
669
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
670
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
671
|
+
var v1 = getArrayF32FromWasm0(r0, r1).slice();
|
|
672
|
+
wasm.__wbindgen_export4(r0, r1 * 4, 4);
|
|
673
|
+
return v1;
|
|
674
|
+
} finally {
|
|
675
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
676
|
+
}
|
|
677
|
+
}
|
|
678
|
+
/**
|
|
679
|
+
* Get length of indices array
|
|
680
|
+
* @returns {number}
|
|
681
|
+
*/
|
|
682
|
+
get indices_len() {
|
|
683
|
+
const ret = wasm.zerocopymesh_indices_len(this.__wbg_ptr);
|
|
684
|
+
return ret >>> 0;
|
|
685
|
+
}
|
|
686
|
+
/**
|
|
687
|
+
* Get pointer to indices array
|
|
688
|
+
* @returns {number}
|
|
689
|
+
*/
|
|
690
|
+
get indices_ptr() {
|
|
691
|
+
const ret = wasm.zerocopymesh_indices_ptr(this.__wbg_ptr);
|
|
692
|
+
return ret >>> 0;
|
|
693
|
+
}
|
|
694
|
+
/**
|
|
695
|
+
* Get length of normals array
|
|
696
|
+
* @returns {number}
|
|
697
|
+
*/
|
|
698
|
+
get normals_len() {
|
|
699
|
+
const ret = wasm.zerocopymesh_normals_len(this.__wbg_ptr);
|
|
700
|
+
return ret >>> 0;
|
|
701
|
+
}
|
|
702
|
+
/**
|
|
703
|
+
* Get pointer to normals array
|
|
704
|
+
* @returns {number}
|
|
705
|
+
*/
|
|
706
|
+
get normals_ptr() {
|
|
707
|
+
const ret = wasm.zerocopymesh_normals_ptr(this.__wbg_ptr);
|
|
708
|
+
return ret >>> 0;
|
|
709
|
+
}
|
|
710
|
+
/**
|
|
711
|
+
* Get vertex count
|
|
712
|
+
* @returns {number}
|
|
713
|
+
*/
|
|
714
|
+
get vertex_count() {
|
|
715
|
+
const ret = wasm.meshdatajs_vertexCount(this.__wbg_ptr);
|
|
716
|
+
return ret >>> 0;
|
|
717
|
+
}
|
|
718
|
+
/**
|
|
719
|
+
* Get length of positions array (in f32 elements, not bytes)
|
|
720
|
+
* @returns {number}
|
|
721
|
+
*/
|
|
722
|
+
get positions_len() {
|
|
723
|
+
const ret = wasm.zerocopymesh_positions_len(this.__wbg_ptr);
|
|
724
|
+
return ret >>> 0;
|
|
725
|
+
}
|
|
726
|
+
/**
|
|
727
|
+
* Get pointer to positions array
|
|
728
|
+
* JavaScript can create Float32Array view: new Float32Array(memory.buffer, ptr, length)
|
|
729
|
+
* @returns {number}
|
|
730
|
+
*/
|
|
731
|
+
get positions_ptr() {
|
|
732
|
+
const ret = wasm.zerocopymesh_positions_ptr(this.__wbg_ptr);
|
|
733
|
+
return ret >>> 0;
|
|
734
|
+
}
|
|
735
|
+
/**
|
|
736
|
+
* Get triangle count
|
|
737
|
+
* @returns {number}
|
|
738
|
+
*/
|
|
739
|
+
get triangle_count() {
|
|
740
|
+
const ret = wasm.meshdatajs_triangleCount(this.__wbg_ptr);
|
|
741
|
+
return ret >>> 0;
|
|
742
|
+
}
|
|
743
|
+
/**
|
|
744
|
+
* Create a new zero-copy mesh from a Mesh
|
|
745
|
+
*/
|
|
746
|
+
constructor() {
|
|
747
|
+
const ret = wasm.zerocopymesh_new();
|
|
748
|
+
this.__wbg_ptr = ret >>> 0;
|
|
749
|
+
ZeroCopyMeshFinalization.register(this, this.__wbg_ptr, this);
|
|
750
|
+
return this;
|
|
751
|
+
}
|
|
752
|
+
/**
|
|
753
|
+
* Check if mesh is empty
|
|
754
|
+
* @returns {boolean}
|
|
755
|
+
*/
|
|
756
|
+
get is_empty() {
|
|
757
|
+
const ret = wasm.zerocopymesh_is_empty(this.__wbg_ptr);
|
|
758
|
+
return ret !== 0;
|
|
759
|
+
}
|
|
760
|
+
}
|
|
761
|
+
if (Symbol.dispose) ZeroCopyMesh.prototype[Symbol.dispose] = ZeroCopyMesh.prototype.free;
|
|
762
|
+
|
|
763
|
+
/**
|
|
764
|
+
* Get WASM memory to allow JavaScript to create TypedArray views
|
|
765
|
+
* @returns {any}
|
|
766
|
+
*/
|
|
767
|
+
export function get_memory() {
|
|
768
|
+
const ret = wasm.get_memory();
|
|
769
|
+
return takeObject(ret);
|
|
770
|
+
}
|
|
771
|
+
|
|
772
|
+
/**
|
|
773
|
+
* Initialize the WASM module
|
|
774
|
+
*/
|
|
775
|
+
export function init() {
|
|
776
|
+
wasm.init();
|
|
777
|
+
}
|
|
778
|
+
|
|
779
|
+
/**
|
|
780
|
+
* Get the version of IFC-Lite
|
|
781
|
+
* @returns {string}
|
|
782
|
+
*/
|
|
783
|
+
export function version() {
|
|
784
|
+
let deferred1_0;
|
|
785
|
+
let deferred1_1;
|
|
786
|
+
try {
|
|
787
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
788
|
+
wasm.version(retptr);
|
|
789
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
790
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
791
|
+
deferred1_0 = r0;
|
|
792
|
+
deferred1_1 = r1;
|
|
793
|
+
return getStringFromWasm0(r0, r1);
|
|
794
|
+
} finally {
|
|
795
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
796
|
+
wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
|
|
797
|
+
}
|
|
798
|
+
}
|
|
799
|
+
|
|
800
|
+
const EXPECTED_RESPONSE_TYPES = new Set(['basic', 'cors', 'default']);
|
|
801
|
+
|
|
802
|
+
async function __wbg_load(module, imports) {
|
|
803
|
+
if (typeof Response === 'function' && module instanceof Response) {
|
|
804
|
+
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
|
805
|
+
try {
|
|
806
|
+
return await WebAssembly.instantiateStreaming(module, imports);
|
|
807
|
+
} catch (e) {
|
|
808
|
+
const validResponse = module.ok && EXPECTED_RESPONSE_TYPES.has(module.type);
|
|
809
|
+
|
|
810
|
+
if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
|
|
811
|
+
console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
|
|
812
|
+
|
|
813
|
+
} else {
|
|
814
|
+
throw e;
|
|
815
|
+
}
|
|
816
|
+
}
|
|
817
|
+
}
|
|
818
|
+
|
|
819
|
+
const bytes = await module.arrayBuffer();
|
|
820
|
+
return await WebAssembly.instantiate(bytes, imports);
|
|
821
|
+
} else {
|
|
822
|
+
const instance = await WebAssembly.instantiate(module, imports);
|
|
823
|
+
|
|
824
|
+
if (instance instanceof WebAssembly.Instance) {
|
|
825
|
+
return { instance, module };
|
|
826
|
+
} else {
|
|
827
|
+
return instance;
|
|
828
|
+
}
|
|
829
|
+
}
|
|
830
|
+
}
|
|
831
|
+
|
|
832
|
+
function __wbg_get_imports() {
|
|
833
|
+
const imports = {};
|
|
834
|
+
imports.wbg = {};
|
|
835
|
+
imports.wbg.__wbg___wbindgen_debug_string_adfb662ae34724b6 = function(arg0, arg1) {
|
|
836
|
+
const ret = debugString(getObject(arg1));
|
|
837
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
838
|
+
const len1 = WASM_VECTOR_LEN;
|
|
839
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
840
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
841
|
+
};
|
|
842
|
+
imports.wbg.__wbg___wbindgen_is_function_8d400b8b1af978cd = function(arg0) {
|
|
843
|
+
const ret = typeof(getObject(arg0)) === 'function';
|
|
844
|
+
return ret;
|
|
845
|
+
};
|
|
846
|
+
imports.wbg.__wbg___wbindgen_is_undefined_f6b95eab589e0269 = function(arg0) {
|
|
847
|
+
const ret = getObject(arg0) === undefined;
|
|
848
|
+
return ret;
|
|
849
|
+
};
|
|
850
|
+
imports.wbg.__wbg___wbindgen_memory_a342e963fbcabd68 = function() {
|
|
851
|
+
const ret = wasm.memory;
|
|
852
|
+
return addHeapObject(ret);
|
|
853
|
+
};
|
|
854
|
+
imports.wbg.__wbg___wbindgen_throw_dd24417ed36fc46e = function(arg0, arg1) {
|
|
855
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
856
|
+
};
|
|
857
|
+
imports.wbg.__wbg__wbg_cb_unref_87dfb5aaa0cbcea7 = function(arg0) {
|
|
858
|
+
getObject(arg0)._wbg_cb_unref();
|
|
859
|
+
};
|
|
860
|
+
imports.wbg.__wbg_call_3020136f7a2d6e44 = function() { return handleError(function (arg0, arg1, arg2) {
|
|
861
|
+
const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
|
|
862
|
+
return addHeapObject(ret);
|
|
863
|
+
}, arguments) };
|
|
864
|
+
imports.wbg.__wbg_call_abb4ff46ce38be40 = function() { return handleError(function (arg0, arg1) {
|
|
865
|
+
const ret = getObject(arg0).call(getObject(arg1));
|
|
866
|
+
return addHeapObject(ret);
|
|
867
|
+
}, arguments) };
|
|
868
|
+
imports.wbg.__wbg_error_7534b8e9a36f1ab4 = function(arg0, arg1) {
|
|
869
|
+
let deferred0_0;
|
|
870
|
+
let deferred0_1;
|
|
871
|
+
try {
|
|
872
|
+
deferred0_0 = arg0;
|
|
873
|
+
deferred0_1 = arg1;
|
|
874
|
+
console.error(getStringFromWasm0(arg0, arg1));
|
|
875
|
+
} finally {
|
|
876
|
+
wasm.__wbindgen_export4(deferred0_0, deferred0_1, 1);
|
|
877
|
+
}
|
|
878
|
+
};
|
|
879
|
+
imports.wbg.__wbg_new_1ba21ce319a06297 = function() {
|
|
880
|
+
const ret = new Object();
|
|
881
|
+
return addHeapObject(ret);
|
|
882
|
+
};
|
|
883
|
+
imports.wbg.__wbg_new_8a6f238a6ece86ea = function() {
|
|
884
|
+
const ret = new Error();
|
|
885
|
+
return addHeapObject(ret);
|
|
886
|
+
};
|
|
887
|
+
imports.wbg.__wbg_new_ff12d2b041fb48f1 = function(arg0, arg1) {
|
|
888
|
+
try {
|
|
889
|
+
var state0 = {a: arg0, b: arg1};
|
|
890
|
+
var cb0 = (arg0, arg1) => {
|
|
891
|
+
const a = state0.a;
|
|
892
|
+
state0.a = 0;
|
|
893
|
+
try {
|
|
894
|
+
return __wasm_bindgen_func_elem_198(a, state0.b, arg0, arg1);
|
|
895
|
+
} finally {
|
|
896
|
+
state0.a = a;
|
|
897
|
+
}
|
|
898
|
+
};
|
|
899
|
+
const ret = new Promise(cb0);
|
|
900
|
+
return addHeapObject(ret);
|
|
901
|
+
} finally {
|
|
902
|
+
state0.a = state0.b = 0;
|
|
903
|
+
}
|
|
904
|
+
};
|
|
905
|
+
imports.wbg.__wbg_new_from_slice_41e2764a343e3cb1 = function(arg0, arg1) {
|
|
906
|
+
const ret = new Float32Array(getArrayF32FromWasm0(arg0, arg1));
|
|
907
|
+
return addHeapObject(ret);
|
|
908
|
+
};
|
|
909
|
+
imports.wbg.__wbg_new_from_slice_db0691b69e9d3891 = function(arg0, arg1) {
|
|
910
|
+
const ret = new Uint32Array(getArrayU32FromWasm0(arg0, arg1));
|
|
911
|
+
return addHeapObject(ret);
|
|
912
|
+
};
|
|
913
|
+
imports.wbg.__wbg_new_no_args_cb138f77cf6151ee = function(arg0, arg1) {
|
|
914
|
+
const ret = new Function(getStringFromWasm0(arg0, arg1));
|
|
915
|
+
return addHeapObject(ret);
|
|
916
|
+
};
|
|
917
|
+
imports.wbg.__wbg_queueMicrotask_9b549dfce8865860 = function(arg0) {
|
|
918
|
+
const ret = getObject(arg0).queueMicrotask;
|
|
919
|
+
return addHeapObject(ret);
|
|
920
|
+
};
|
|
921
|
+
imports.wbg.__wbg_queueMicrotask_fca69f5bfad613a5 = function(arg0) {
|
|
922
|
+
queueMicrotask(getObject(arg0));
|
|
923
|
+
};
|
|
924
|
+
imports.wbg.__wbg_resolve_fd5bfbaa4ce36e1e = function(arg0) {
|
|
925
|
+
const ret = Promise.resolve(getObject(arg0));
|
|
926
|
+
return addHeapObject(ret);
|
|
927
|
+
};
|
|
928
|
+
imports.wbg.__wbg_set_781438a03c0c3c81 = function() { return handleError(function (arg0, arg1, arg2) {
|
|
929
|
+
const ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2));
|
|
930
|
+
return ret;
|
|
931
|
+
}, arguments) };
|
|
932
|
+
imports.wbg.__wbg_stack_0ed75d68575b0f3c = function(arg0, arg1) {
|
|
933
|
+
const ret = getObject(arg1).stack;
|
|
934
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
935
|
+
const len1 = WASM_VECTOR_LEN;
|
|
936
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
937
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
938
|
+
};
|
|
939
|
+
imports.wbg.__wbg_static_accessor_GLOBAL_769e6b65d6557335 = function() {
|
|
940
|
+
const ret = typeof global === 'undefined' ? null : global;
|
|
941
|
+
return isLikeNone(ret) ? 0 : addHeapObject(ret);
|
|
942
|
+
};
|
|
943
|
+
imports.wbg.__wbg_static_accessor_GLOBAL_THIS_60cf02db4de8e1c1 = function() {
|
|
944
|
+
const ret = typeof globalThis === 'undefined' ? null : globalThis;
|
|
945
|
+
return isLikeNone(ret) ? 0 : addHeapObject(ret);
|
|
946
|
+
};
|
|
947
|
+
imports.wbg.__wbg_static_accessor_SELF_08f5a74c69739274 = function() {
|
|
948
|
+
const ret = typeof self === 'undefined' ? null : self;
|
|
949
|
+
return isLikeNone(ret) ? 0 : addHeapObject(ret);
|
|
950
|
+
};
|
|
951
|
+
imports.wbg.__wbg_static_accessor_WINDOW_a8924b26aa92d024 = function() {
|
|
952
|
+
const ret = typeof window === 'undefined' ? null : window;
|
|
953
|
+
return isLikeNone(ret) ? 0 : addHeapObject(ret);
|
|
954
|
+
};
|
|
955
|
+
imports.wbg.__wbg_then_4f95312d68691235 = function(arg0, arg1) {
|
|
956
|
+
const ret = getObject(arg0).then(getObject(arg1));
|
|
957
|
+
return addHeapObject(ret);
|
|
958
|
+
};
|
|
959
|
+
imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
|
|
960
|
+
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
961
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
962
|
+
return addHeapObject(ret);
|
|
963
|
+
};
|
|
964
|
+
imports.wbg.__wbindgen_cast_a2f2ccacb7ef777f = function(arg0, arg1) {
|
|
965
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 31, function: Function { arguments: [Externref], shim_idx: 32, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
966
|
+
const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_159, __wasm_bindgen_func_elem_160);
|
|
967
|
+
return addHeapObject(ret);
|
|
968
|
+
};
|
|
969
|
+
imports.wbg.__wbindgen_cast_d6cd19b81560fd6e = function(arg0) {
|
|
970
|
+
// Cast intrinsic for `F64 -> Externref`.
|
|
971
|
+
const ret = arg0;
|
|
972
|
+
return addHeapObject(ret);
|
|
973
|
+
};
|
|
974
|
+
imports.wbg.__wbindgen_object_clone_ref = function(arg0) {
|
|
975
|
+
const ret = getObject(arg0);
|
|
976
|
+
return addHeapObject(ret);
|
|
977
|
+
};
|
|
978
|
+
imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
|
|
979
|
+
takeObject(arg0);
|
|
980
|
+
};
|
|
981
|
+
|
|
982
|
+
return imports;
|
|
983
|
+
}
|
|
984
|
+
|
|
985
|
+
function __wbg_finalize_init(instance, module) {
|
|
986
|
+
wasm = instance.exports;
|
|
987
|
+
__wbg_init.__wbindgen_wasm_module = module;
|
|
988
|
+
cachedDataViewMemory0 = null;
|
|
989
|
+
cachedFloat32ArrayMemory0 = null;
|
|
990
|
+
cachedUint32ArrayMemory0 = null;
|
|
991
|
+
cachedUint8ArrayMemory0 = null;
|
|
992
|
+
|
|
993
|
+
|
|
994
|
+
wasm.__wbindgen_start();
|
|
995
|
+
return wasm;
|
|
996
|
+
}
|
|
997
|
+
|
|
998
|
+
function initSync(module) {
|
|
999
|
+
if (wasm !== undefined) return wasm;
|
|
1000
|
+
|
|
1001
|
+
|
|
1002
|
+
if (typeof module !== 'undefined') {
|
|
1003
|
+
if (Object.getPrototypeOf(module) === Object.prototype) {
|
|
1004
|
+
({module} = module)
|
|
1005
|
+
} else {
|
|
1006
|
+
console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
|
|
1007
|
+
}
|
|
1008
|
+
}
|
|
1009
|
+
|
|
1010
|
+
const imports = __wbg_get_imports();
|
|
1011
|
+
if (!(module instanceof WebAssembly.Module)) {
|
|
1012
|
+
module = new WebAssembly.Module(module);
|
|
1013
|
+
}
|
|
1014
|
+
const instance = new WebAssembly.Instance(module, imports);
|
|
1015
|
+
return __wbg_finalize_init(instance, module);
|
|
1016
|
+
}
|
|
1017
|
+
|
|
1018
|
+
async function __wbg_init(module_or_path) {
|
|
1019
|
+
if (wasm !== undefined) return wasm;
|
|
1020
|
+
|
|
1021
|
+
|
|
1022
|
+
if (typeof module_or_path !== 'undefined') {
|
|
1023
|
+
if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
|
|
1024
|
+
({module_or_path} = module_or_path)
|
|
1025
|
+
} else {
|
|
1026
|
+
console.warn('using deprecated parameters for the initialization function; pass a single object instead')
|
|
1027
|
+
}
|
|
1028
|
+
}
|
|
1029
|
+
|
|
1030
|
+
if (typeof module_or_path === 'undefined') {
|
|
1031
|
+
module_or_path = new URL('ifc_lite_wasm_bg.wasm', import.meta.url);
|
|
1032
|
+
}
|
|
1033
|
+
const imports = __wbg_get_imports();
|
|
1034
|
+
|
|
1035
|
+
if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
|
|
1036
|
+
module_or_path = fetch(module_or_path);
|
|
1037
|
+
}
|
|
1038
|
+
|
|
1039
|
+
const { instance, module } = await __wbg_load(await module_or_path, imports);
|
|
1040
|
+
|
|
1041
|
+
return __wbg_finalize_init(instance, module);
|
|
1042
|
+
}
|
|
1043
|
+
|
|
1044
|
+
export { initSync };
|
|
1045
|
+
export default __wbg_init;
|