minecraft-renderer 0.1.39 → 0.1.41

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.
Files changed (57) hide show
  1. package/dist/mesher.js +8 -8
  2. package/dist/mesher.js.map +4 -4
  3. package/dist/mesherWasm.js +94 -94
  4. package/dist/minecraft-renderer.js +57 -57
  5. package/dist/minecraft-renderer.js.meta.json +1 -1
  6. package/dist/threeWorker.js +66 -66
  7. package/package.json +3 -4
  8. package/src/bundler/bundlePrepare.ts +56 -0
  9. package/src/graphicsBackend/appViewer.ts +10 -0
  10. package/src/graphicsBackend/config.ts +5 -1
  11. package/src/graphicsBackend/preloadWorkers.ts +187 -0
  12. package/src/lib/worldrendererCommon.ts +26 -2
  13. package/src/{mesher → mesher-legacy}/mesher.ts +14 -4
  14. package/src/{mesher → mesher-legacy}/test/mesherTester.ts +2 -2
  15. package/src/{mesher → mesher-legacy}/test/run/test-js.ts +1 -1
  16. package/src/{mesher → mesher-legacy}/test/test-perf.ts +1 -1
  17. package/src/{mesher → mesher-legacy}/test/tests.test.ts +1 -1
  18. package/src/{mesher → mesher-shared}/shared.ts +2 -0
  19. package/src/playground/allEntitiesDebug.ts +1 -1
  20. package/src/three/chunkMeshManager.ts +1 -1
  21. package/src/three/entities.ts +19 -6
  22. package/src/three/entity/EntityMesh.ts +123 -140
  23. package/src/three/graphicsBackendBase.ts +13 -0
  24. package/src/three/holdingBlock.ts +1 -1
  25. package/src/three/holdingBlockLegacy.ts +1 -1
  26. package/src/three/modules/sciFiWorldReveal.ts +1 -1
  27. package/src/three/worldRendererThree.ts +2 -2
  28. package/src/wasm-mesher/README.md +90 -0
  29. package/src/{wasm-lib → wasm-mesher/bridge}/convertChunk.ts +2 -2
  30. package/src/{wasm-lib → wasm-mesher/bridge}/render-from-wasm.ts +4 -4
  31. package/src/wasm-mesher/runtime-build/wasm_mesher.d.ts +210 -0
  32. package/src/wasm-mesher/runtime-build/wasm_mesher.js +881 -0
  33. package/src/wasm-mesher/runtime-build/wasm_mesher_bg.wasm +0 -0
  34. package/src/wasm-mesher/runtime-build/wasm_mesher_bg.wasm.d.ts +24 -0
  35. package/src/{mesher/test → wasm-mesher/tests}/heightmapParity.test.ts +4 -4
  36. package/src/{mesher/test → wasm-mesher/tests}/mesherWasmConversionCache.test.ts +2 -2
  37. package/src/{mesher/test → wasm-mesher/tests}/splitColumnWasmOutput.test.ts +1 -1
  38. package/src/wasm-mesher/worker/mesherWasm.ts +1247 -0
  39. package/src/{mesher → wasm-mesher/worker}/mesherWasmConversionCache.ts +1 -1
  40. package/src/worldView/types.ts +90 -0
  41. package/src/mesher/mesherWasm.ts +0 -696
  42. package/wasm/wasm_mesher.d.ts +0 -46
  43. package/wasm/wasm_mesher.js +0 -443
  44. package/wasm/wasm_mesher_bg.wasm +0 -0
  45. package/wasm/wasm_mesher_bg.wasm.d.ts +0 -9
  46. /package/src/{mesher → mesher-legacy}/test/a.ts +0 -0
  47. /package/src/{mesher → mesher-legacy}/test/playground.ts +0 -0
  48. /package/src/{mesher → mesher-legacy}/test/run/chunk.ts +0 -0
  49. /package/src/{mesher → mesher-legacy}/test/snapshotUtils.ts +0 -0
  50. /package/src/{mesher → mesher-shared}/blockEntityMetadata.ts +0 -0
  51. /package/src/{mesher → mesher-shared}/computeHeightmap.ts +0 -0
  52. /package/src/{mesher → mesher-shared}/models.ts +0 -0
  53. /package/src/{mesher → mesher-shared}/modelsGeometryCommon.ts +0 -0
  54. /package/src/{mesher → mesher-shared}/standaloneRenderer.ts +0 -0
  55. /package/src/{mesher → mesher-shared}/world.ts +0 -0
  56. /package/src/{mesher → mesher-shared}/worldConstants.ts +0 -0
  57. /package/src/{mesher → wasm-mesher/worker}/mesherWasmRequestTracker.ts +0 -0
@@ -0,0 +1,881 @@
1
+ let wasm;
2
+
3
+ function addToExternrefTable0(obj) {
4
+ const idx = wasm.__externref_table_alloc();
5
+ wasm.__wbindgen_externrefs.set(idx, obj);
6
+ return idx;
7
+ }
8
+
9
+ function debugString(val) {
10
+ // primitive types
11
+ const type = typeof val;
12
+ if (type == 'number' || type == 'boolean' || val == null) {
13
+ return `${val}`;
14
+ }
15
+ if (type == 'string') {
16
+ return `"${val}"`;
17
+ }
18
+ if (type == 'symbol') {
19
+ const description = val.description;
20
+ if (description == null) {
21
+ return 'Symbol';
22
+ } else {
23
+ return `Symbol(${description})`;
24
+ }
25
+ }
26
+ if (type == 'function') {
27
+ const name = val.name;
28
+ if (typeof name == 'string' && name.length > 0) {
29
+ return `Function(${name})`;
30
+ } else {
31
+ return 'Function';
32
+ }
33
+ }
34
+ // objects
35
+ if (Array.isArray(val)) {
36
+ const length = val.length;
37
+ let debug = '[';
38
+ if (length > 0) {
39
+ debug += debugString(val[0]);
40
+ }
41
+ for(let i = 1; i < length; i++) {
42
+ debug += ', ' + debugString(val[i]);
43
+ }
44
+ debug += ']';
45
+ return debug;
46
+ }
47
+ // Test for built-in
48
+ const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
49
+ let className;
50
+ if (builtInMatches && builtInMatches.length > 1) {
51
+ className = builtInMatches[1];
52
+ } else {
53
+ // Failed to match the standard '[object ClassName]'
54
+ return toString.call(val);
55
+ }
56
+ if (className == 'Object') {
57
+ // we're a user defined class or Object
58
+ // JSON.stringify avoids problems with cycles, and is generally much
59
+ // easier than looping through ownProperties of `val`.
60
+ try {
61
+ return 'Object(' + JSON.stringify(val) + ')';
62
+ } catch (_) {
63
+ return 'Object';
64
+ }
65
+ }
66
+ // errors
67
+ if (val instanceof Error) {
68
+ return `${val.name}: ${val.message}\n${val.stack}`;
69
+ }
70
+ // TODO we could test for more things here, like `Set`s and `Map`s.
71
+ return className;
72
+ }
73
+
74
+ function getArrayU16FromWasm0(ptr, len) {
75
+ ptr = ptr >>> 0;
76
+ return getUint16ArrayMemory0().subarray(ptr / 2, ptr / 2 + len);
77
+ }
78
+
79
+ function getArrayU8FromWasm0(ptr, len) {
80
+ ptr = ptr >>> 0;
81
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
82
+ }
83
+
84
+ let cachedDataViewMemory0 = null;
85
+ function getDataViewMemory0() {
86
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
87
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
88
+ }
89
+ return cachedDataViewMemory0;
90
+ }
91
+
92
+ function getStringFromWasm0(ptr, len) {
93
+ ptr = ptr >>> 0;
94
+ return decodeText(ptr, len);
95
+ }
96
+
97
+ let cachedUint16ArrayMemory0 = null;
98
+ function getUint16ArrayMemory0() {
99
+ if (cachedUint16ArrayMemory0 === null || cachedUint16ArrayMemory0.byteLength === 0) {
100
+ cachedUint16ArrayMemory0 = new Uint16Array(wasm.memory.buffer);
101
+ }
102
+ return cachedUint16ArrayMemory0;
103
+ }
104
+
105
+ let cachedUint32ArrayMemory0 = null;
106
+ function getUint32ArrayMemory0() {
107
+ if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
108
+ cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
109
+ }
110
+ return cachedUint32ArrayMemory0;
111
+ }
112
+
113
+ let cachedUint8ArrayMemory0 = null;
114
+ function getUint8ArrayMemory0() {
115
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
116
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
117
+ }
118
+ return cachedUint8ArrayMemory0;
119
+ }
120
+
121
+ function handleError(f, args) {
122
+ try {
123
+ return f.apply(this, args);
124
+ } catch (e) {
125
+ const idx = addToExternrefTable0(e);
126
+ wasm.__wbindgen_exn_store(idx);
127
+ }
128
+ }
129
+
130
+ function passArray16ToWasm0(arg, malloc) {
131
+ const ptr = malloc(arg.length * 2, 2) >>> 0;
132
+ getUint16ArrayMemory0().set(arg, ptr / 2);
133
+ WASM_VECTOR_LEN = arg.length;
134
+ return ptr;
135
+ }
136
+
137
+ function passArray32ToWasm0(arg, malloc) {
138
+ const ptr = malloc(arg.length * 4, 4) >>> 0;
139
+ getUint32ArrayMemory0().set(arg, ptr / 4);
140
+ WASM_VECTOR_LEN = arg.length;
141
+ return ptr;
142
+ }
143
+
144
+ function passArray8ToWasm0(arg, malloc) {
145
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
146
+ getUint8ArrayMemory0().set(arg, ptr / 1);
147
+ WASM_VECTOR_LEN = arg.length;
148
+ return ptr;
149
+ }
150
+
151
+ function passStringToWasm0(arg, malloc, realloc) {
152
+ if (realloc === undefined) {
153
+ const buf = cachedTextEncoder.encode(arg);
154
+ const ptr = malloc(buf.length, 1) >>> 0;
155
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
156
+ WASM_VECTOR_LEN = buf.length;
157
+ return ptr;
158
+ }
159
+
160
+ let len = arg.length;
161
+ let ptr = malloc(len, 1) >>> 0;
162
+
163
+ const mem = getUint8ArrayMemory0();
164
+
165
+ let offset = 0;
166
+
167
+ for (; offset < len; offset++) {
168
+ const code = arg.charCodeAt(offset);
169
+ if (code > 0x7F) break;
170
+ mem[ptr + offset] = code;
171
+ }
172
+ if (offset !== len) {
173
+ if (offset !== 0) {
174
+ arg = arg.slice(offset);
175
+ }
176
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
177
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
178
+ const ret = cachedTextEncoder.encodeInto(arg, view);
179
+
180
+ offset += ret.written;
181
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
182
+ }
183
+
184
+ WASM_VECTOR_LEN = offset;
185
+ return ptr;
186
+ }
187
+
188
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
189
+ cachedTextDecoder.decode();
190
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
191
+ let numBytesDecoded = 0;
192
+ function decodeText(ptr, len) {
193
+ numBytesDecoded += len;
194
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
195
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
196
+ cachedTextDecoder.decode();
197
+ numBytesDecoded = len;
198
+ }
199
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
200
+ }
201
+
202
+ const cachedTextEncoder = new TextEncoder();
203
+
204
+ if (!('encodeInto' in cachedTextEncoder)) {
205
+ cachedTextEncoder.encodeInto = function (arg, view) {
206
+ const buf = cachedTextEncoder.encode(arg);
207
+ view.set(buf);
208
+ return {
209
+ read: arg.length,
210
+ written: buf.length
211
+ };
212
+ }
213
+ }
214
+
215
+ let WASM_VECTOR_LEN = 0;
216
+
217
+ /**
218
+ * VITALY's path: parse 1.18+ dump + light → run the mesher → return ONLY the final
219
+ * geometry. Avoids marshalling the intermediate ~300KB block_states/biomes/lights
220
+ * arrays back to JS.
221
+ *
222
+ * Combines `parseChunkDump118FullColumnAll` and `generate_geometry` into one Rust call.
223
+ * All `generate_geometry` parameters (mesher config, block-state lists) are accepted
224
+ * unchanged.
225
+ * @param {number} section_x
226
+ * @param {number} section_y
227
+ * @param {number} section_z
228
+ * @param {number} section_height
229
+ * @param {number} world_min_y
230
+ * @param {number} world_max_y
231
+ * @param {number} section_data_start_y
232
+ * @param {Uint8Array} dump_buffer
233
+ * @param {Uint8Array} sky_light_concat
234
+ * @param {Uint8Array} block_light_concat
235
+ * @param {Uint32Array} sky_light_mask
236
+ * @param {Uint32Array} block_light_mask
237
+ * @param {Uint32Array} empty_sky_light_mask
238
+ * @param {Uint32Array} empty_block_light_mask
239
+ * @param {number} num_sections
240
+ * @param {number} max_bits_per_block
241
+ * @param {number} max_bits_per_biome
242
+ * @param {Uint16Array} invisible_blocks
243
+ * @param {Uint16Array} transparent_blocks
244
+ * @param {Uint16Array} no_ao_blocks
245
+ * @param {Uint16Array} cull_identical_blocks
246
+ * @param {Uint16Array} occluding_blocks
247
+ * @param {boolean} enable_lighting
248
+ * @param {boolean} smooth_lighting
249
+ * @param {number} sky_light_value
250
+ * @returns {any}
251
+ */
252
+ export function generateGeometryFromDump118(section_x, section_y, section_z, section_height, world_min_y, world_max_y, section_data_start_y, dump_buffer, sky_light_concat, block_light_concat, sky_light_mask, block_light_mask, empty_sky_light_mask, empty_block_light_mask, num_sections, max_bits_per_block, max_bits_per_biome, invisible_blocks, transparent_blocks, no_ao_blocks, cull_identical_blocks, occluding_blocks, enable_lighting, smooth_lighting, sky_light_value) {
253
+ const ptr0 = passArray8ToWasm0(dump_buffer, wasm.__wbindgen_malloc);
254
+ const len0 = WASM_VECTOR_LEN;
255
+ const ptr1 = passArray8ToWasm0(sky_light_concat, wasm.__wbindgen_malloc);
256
+ const len1 = WASM_VECTOR_LEN;
257
+ const ptr2 = passArray8ToWasm0(block_light_concat, wasm.__wbindgen_malloc);
258
+ const len2 = WASM_VECTOR_LEN;
259
+ const ptr3 = passArray32ToWasm0(sky_light_mask, wasm.__wbindgen_malloc);
260
+ const len3 = WASM_VECTOR_LEN;
261
+ const ptr4 = passArray32ToWasm0(block_light_mask, wasm.__wbindgen_malloc);
262
+ const len4 = WASM_VECTOR_LEN;
263
+ const ptr5 = passArray32ToWasm0(empty_sky_light_mask, wasm.__wbindgen_malloc);
264
+ const len5 = WASM_VECTOR_LEN;
265
+ const ptr6 = passArray32ToWasm0(empty_block_light_mask, wasm.__wbindgen_malloc);
266
+ const len6 = WASM_VECTOR_LEN;
267
+ const ptr7 = passArray16ToWasm0(invisible_blocks, wasm.__wbindgen_malloc);
268
+ const len7 = WASM_VECTOR_LEN;
269
+ const ptr8 = passArray16ToWasm0(transparent_blocks, wasm.__wbindgen_malloc);
270
+ const len8 = WASM_VECTOR_LEN;
271
+ const ptr9 = passArray16ToWasm0(no_ao_blocks, wasm.__wbindgen_malloc);
272
+ const len9 = WASM_VECTOR_LEN;
273
+ const ptr10 = passArray16ToWasm0(cull_identical_blocks, wasm.__wbindgen_malloc);
274
+ const len10 = WASM_VECTOR_LEN;
275
+ const ptr11 = passArray16ToWasm0(occluding_blocks, wasm.__wbindgen_malloc);
276
+ const len11 = WASM_VECTOR_LEN;
277
+ const ret = wasm.generateGeometryFromDump118(section_x, section_y, section_z, section_height, world_min_y, world_max_y, section_data_start_y, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, ptr5, len5, ptr6, len6, num_sections, max_bits_per_block, max_bits_per_biome, ptr7, len7, ptr8, len8, ptr9, len9, ptr10, len10, ptr11, len11, enable_lighting, smooth_lighting, sky_light_value);
278
+ return ret;
279
+ }
280
+
281
+ /**
282
+ * Fused parse+mesh for 1.18+ `map_chunk` wire format.
283
+ *
284
+ * Parses the raw packet inside Rust, meshes immediately, and returns ONLY the
285
+ * final `GeometryOutput` — no intermediate typed arrays are materialised on the
286
+ * JS heap. This halves the number of JS<->WASM boundary crossings per column
287
+ * and removes the largest per-column allocations (Uint16Array block_states +
288
+ * three Uint8Arrays for biomes/light).
289
+ *
290
+ * `raw_packet` is the buffer captured from `bot._client.on('raw.map_chunk', ...)`;
291
+ * it includes the leading packet-id varint (we skip it).
292
+ * @param {Uint8Array} raw_packet
293
+ * @param {number} num_sections
294
+ * @param {number} max_bits_per_block
295
+ * @param {number} max_bits_per_biome
296
+ * @param {number} protocol
297
+ * @param {number} section_x
298
+ * @param {number} section_y
299
+ * @param {number} section_z
300
+ * @param {number} section_height
301
+ * @param {number} world_min_y
302
+ * @param {number} world_max_y
303
+ * @param {number} section_data_start_y
304
+ * @param {Uint16Array} invisible_blocks
305
+ * @param {Uint16Array} transparent_blocks
306
+ * @param {Uint16Array} no_ao_blocks
307
+ * @param {Uint16Array} cull_identical_blocks
308
+ * @param {Uint16Array} occluding_blocks
309
+ * @param {boolean} enable_lighting
310
+ * @param {boolean} smooth_lighting
311
+ * @param {number} sky_light_value
312
+ * @returns {any}
313
+ */
314
+ export function generateGeometryFromMapChunkV18Plus(raw_packet, num_sections, max_bits_per_block, max_bits_per_biome, protocol, section_x, section_y, section_z, section_height, world_min_y, world_max_y, section_data_start_y, invisible_blocks, transparent_blocks, no_ao_blocks, cull_identical_blocks, occluding_blocks, enable_lighting, smooth_lighting, sky_light_value) {
315
+ const ptr0 = passArray8ToWasm0(raw_packet, wasm.__wbindgen_malloc);
316
+ const len0 = WASM_VECTOR_LEN;
317
+ const ptr1 = passArray16ToWasm0(invisible_blocks, wasm.__wbindgen_malloc);
318
+ const len1 = WASM_VECTOR_LEN;
319
+ const ptr2 = passArray16ToWasm0(transparent_blocks, wasm.__wbindgen_malloc);
320
+ const len2 = WASM_VECTOR_LEN;
321
+ const ptr3 = passArray16ToWasm0(no_ao_blocks, wasm.__wbindgen_malloc);
322
+ const len3 = WASM_VECTOR_LEN;
323
+ const ptr4 = passArray16ToWasm0(cull_identical_blocks, wasm.__wbindgen_malloc);
324
+ const len4 = WASM_VECTOR_LEN;
325
+ const ptr5 = passArray16ToWasm0(occluding_blocks, wasm.__wbindgen_malloc);
326
+ const len5 = WASM_VECTOR_LEN;
327
+ const ret = wasm.generateGeometryFromMapChunkV18Plus(ptr0, len0, num_sections, max_bits_per_block, max_bits_per_biome, protocol, section_x, section_y, section_z, section_height, world_min_y, world_max_y, section_data_start_y, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, ptr5, len5, enable_lighting, smooth_lighting, sky_light_value);
328
+ return ret;
329
+ }
330
+
331
+ /**
332
+ * Fused parse+mesh for 1.16 / 1.17 chunk sections.
333
+ *
334
+ * Parses `chunk_data` (the raw section bytes from a `map_chunk` packet) inside
335
+ * Rust and meshes immediately, returning only `GeometryOutput`. Block states
336
+ * and biomes never leave WASM memory.
337
+ *
338
+ * Light arrays (`sky_light` / `block_light`) come from a pre-parsed
339
+ * `update_light` packet and are passed by reference (the JS-side update-light
340
+ * cache already holds them as `Uint8Array`). When light is absent the
341
+ * function fills defaults (sky=15, block=0) internally.
342
+ * @param {Uint8Array} chunk_data
343
+ * @param {Uint32Array} bit_map_lo_hi
344
+ * @param {number} num_sections
345
+ * @param {number} max_bits_per_block
346
+ * @param {Int32Array} biomes_cells
347
+ * @param {number} default_biome
348
+ * @param {Uint8Array} sky_light
349
+ * @param {Uint8Array} block_light
350
+ * @param {number} section_x
351
+ * @param {number} section_y
352
+ * @param {number} section_z
353
+ * @param {number} section_height
354
+ * @param {number} world_min_y
355
+ * @param {number} world_max_y
356
+ * @param {number} section_data_start_y
357
+ * @param {Uint16Array} invisible_blocks
358
+ * @param {Uint16Array} transparent_blocks
359
+ * @param {Uint16Array} no_ao_blocks
360
+ * @param {Uint16Array} cull_identical_blocks
361
+ * @param {Uint16Array} occluding_blocks
362
+ * @param {boolean} enable_lighting
363
+ * @param {boolean} smooth_lighting
364
+ * @param {number} sky_light_value
365
+ * @returns {any}
366
+ */
367
+ export function generateGeometryFromParsedV16V17(chunk_data, bit_map_lo_hi, num_sections, max_bits_per_block, biomes_cells, default_biome, sky_light, block_light, section_x, section_y, section_z, section_height, world_min_y, world_max_y, section_data_start_y, invisible_blocks, transparent_blocks, no_ao_blocks, cull_identical_blocks, occluding_blocks, enable_lighting, smooth_lighting, sky_light_value) {
368
+ const ptr0 = passArray8ToWasm0(chunk_data, wasm.__wbindgen_malloc);
369
+ const len0 = WASM_VECTOR_LEN;
370
+ const ptr1 = passArray32ToWasm0(bit_map_lo_hi, wasm.__wbindgen_malloc);
371
+ const len1 = WASM_VECTOR_LEN;
372
+ const ptr2 = passArray32ToWasm0(biomes_cells, wasm.__wbindgen_malloc);
373
+ const len2 = WASM_VECTOR_LEN;
374
+ const ptr3 = passArray8ToWasm0(sky_light, wasm.__wbindgen_malloc);
375
+ const len3 = WASM_VECTOR_LEN;
376
+ const ptr4 = passArray8ToWasm0(block_light, wasm.__wbindgen_malloc);
377
+ const len4 = WASM_VECTOR_LEN;
378
+ const ptr5 = passArray16ToWasm0(invisible_blocks, wasm.__wbindgen_malloc);
379
+ const len5 = WASM_VECTOR_LEN;
380
+ const ptr6 = passArray16ToWasm0(transparent_blocks, wasm.__wbindgen_malloc);
381
+ const len6 = WASM_VECTOR_LEN;
382
+ const ptr7 = passArray16ToWasm0(no_ao_blocks, wasm.__wbindgen_malloc);
383
+ const len7 = WASM_VECTOR_LEN;
384
+ const ptr8 = passArray16ToWasm0(cull_identical_blocks, wasm.__wbindgen_malloc);
385
+ const len8 = WASM_VECTOR_LEN;
386
+ const ptr9 = passArray16ToWasm0(occluding_blocks, wasm.__wbindgen_malloc);
387
+ const len9 = WASM_VECTOR_LEN;
388
+ const ret = wasm.generateGeometryFromParsedV16V17(ptr0, len0, ptr1, len1, num_sections, max_bits_per_block, ptr2, len2, default_biome, ptr3, len3, ptr4, len4, section_x, section_y, section_z, section_height, world_min_y, world_max_y, section_data_start_y, ptr5, len5, ptr6, len6, ptr7, len7, ptr8, len8, ptr9, len9, enable_lighting, smooth_lighting, sky_light_value);
389
+ return ret;
390
+ }
391
+
392
+ /**
393
+ * Main entry point for generating geometry
394
+ *
395
+ * Input: Serialized chunk data as TypedArrays
396
+ * Output: Geometry data (positions, normals, colors, uvs, indices)
397
+ * @param {number} section_x
398
+ * @param {number} section_y
399
+ * @param {number} section_z
400
+ * @param {number} section_height
401
+ * @param {number} world_min_y
402
+ * @param {number} world_max_y
403
+ * @param {number} section_data_start_y
404
+ * @param {Uint16Array} block_states
405
+ * @param {Uint8Array} block_light
406
+ * @param {Uint8Array} sky_light
407
+ * @param {Uint8Array} biomes
408
+ * @param {Uint16Array} invisible_blocks
409
+ * @param {Uint16Array} transparent_blocks
410
+ * @param {Uint16Array} no_ao_blocks
411
+ * @param {Uint16Array} cull_identical_blocks
412
+ * @param {Uint16Array} occluding_blocks
413
+ * @param {boolean} enable_lighting
414
+ * @param {boolean} smooth_lighting
415
+ * @param {number} sky_light_value
416
+ * @returns {any}
417
+ */
418
+ export function generate_geometry(section_x, section_y, section_z, section_height, world_min_y, world_max_y, section_data_start_y, block_states, block_light, sky_light, biomes, invisible_blocks, transparent_blocks, no_ao_blocks, cull_identical_blocks, occluding_blocks, enable_lighting, smooth_lighting, sky_light_value) {
419
+ const ptr0 = passArray16ToWasm0(block_states, wasm.__wbindgen_malloc);
420
+ const len0 = WASM_VECTOR_LEN;
421
+ const ptr1 = passArray8ToWasm0(block_light, wasm.__wbindgen_malloc);
422
+ const len1 = WASM_VECTOR_LEN;
423
+ const ptr2 = passArray8ToWasm0(sky_light, wasm.__wbindgen_malloc);
424
+ const len2 = WASM_VECTOR_LEN;
425
+ const ptr3 = passArray8ToWasm0(biomes, wasm.__wbindgen_malloc);
426
+ const len3 = WASM_VECTOR_LEN;
427
+ const ptr4 = passArray16ToWasm0(invisible_blocks, wasm.__wbindgen_malloc);
428
+ const len4 = WASM_VECTOR_LEN;
429
+ const ptr5 = passArray16ToWasm0(transparent_blocks, wasm.__wbindgen_malloc);
430
+ const len5 = WASM_VECTOR_LEN;
431
+ const ptr6 = passArray16ToWasm0(no_ao_blocks, wasm.__wbindgen_malloc);
432
+ const len6 = WASM_VECTOR_LEN;
433
+ const ptr7 = passArray16ToWasm0(cull_identical_blocks, wasm.__wbindgen_malloc);
434
+ const len7 = WASM_VECTOR_LEN;
435
+ const ptr8 = passArray16ToWasm0(occluding_blocks, wasm.__wbindgen_malloc);
436
+ const len8 = WASM_VECTOR_LEN;
437
+ const ret = wasm.generate_geometry(section_x, section_y, section_z, section_height, world_min_y, world_max_y, section_data_start_y, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, ptr5, len5, ptr6, len6, ptr7, len7, ptr8, len8, enable_lighting, smooth_lighting, sky_light_value);
438
+ return ret;
439
+ }
440
+
441
+ /**
442
+ * @param {number} section_x
443
+ * @param {number} section_y
444
+ * @param {number} section_z
445
+ * @param {number} section_height
446
+ * @param {number} world_min_y
447
+ * @param {number} world_max_y
448
+ * @param {number} section_data_start_y
449
+ * @param {Int32Array} chunk_xs
450
+ * @param {Int32Array} chunk_zs
451
+ * @param {Uint16Array} block_states
452
+ * @param {Uint8Array} block_light
453
+ * @param {Uint8Array} sky_light
454
+ * @param {Uint8Array} biomes
455
+ * @param {Uint16Array} invisible_blocks
456
+ * @param {Uint16Array} transparent_blocks
457
+ * @param {Uint16Array} no_ao_blocks
458
+ * @param {Uint16Array} cull_identical_blocks
459
+ * @param {Uint16Array} occluding_blocks
460
+ * @param {boolean} enable_lighting
461
+ * @param {boolean} smooth_lighting
462
+ * @param {number} sky_light_value
463
+ * @returns {any}
464
+ */
465
+ export function generate_geometry_multi(section_x, section_y, section_z, section_height, world_min_y, world_max_y, section_data_start_y, chunk_xs, chunk_zs, block_states, block_light, sky_light, biomes, invisible_blocks, transparent_blocks, no_ao_blocks, cull_identical_blocks, occluding_blocks, enable_lighting, smooth_lighting, sky_light_value) {
466
+ const ptr0 = passArray32ToWasm0(chunk_xs, wasm.__wbindgen_malloc);
467
+ const len0 = WASM_VECTOR_LEN;
468
+ const ptr1 = passArray32ToWasm0(chunk_zs, wasm.__wbindgen_malloc);
469
+ const len1 = WASM_VECTOR_LEN;
470
+ const ptr2 = passArray16ToWasm0(block_states, wasm.__wbindgen_malloc);
471
+ const len2 = WASM_VECTOR_LEN;
472
+ const ptr3 = passArray8ToWasm0(block_light, wasm.__wbindgen_malloc);
473
+ const len3 = WASM_VECTOR_LEN;
474
+ const ptr4 = passArray8ToWasm0(sky_light, wasm.__wbindgen_malloc);
475
+ const len4 = WASM_VECTOR_LEN;
476
+ const ptr5 = passArray8ToWasm0(biomes, wasm.__wbindgen_malloc);
477
+ const len5 = WASM_VECTOR_LEN;
478
+ const ptr6 = passArray16ToWasm0(invisible_blocks, wasm.__wbindgen_malloc);
479
+ const len6 = WASM_VECTOR_LEN;
480
+ const ptr7 = passArray16ToWasm0(transparent_blocks, wasm.__wbindgen_malloc);
481
+ const len7 = WASM_VECTOR_LEN;
482
+ const ptr8 = passArray16ToWasm0(no_ao_blocks, wasm.__wbindgen_malloc);
483
+ const len8 = WASM_VECTOR_LEN;
484
+ const ptr9 = passArray16ToWasm0(cull_identical_blocks, wasm.__wbindgen_malloc);
485
+ const len9 = WASM_VECTOR_LEN;
486
+ const ptr10 = passArray16ToWasm0(occluding_blocks, wasm.__wbindgen_malloc);
487
+ const len10 = WASM_VECTOR_LEN;
488
+ const ret = wasm.generate_geometry_multi(section_x, section_y, section_z, section_height, world_min_y, world_max_y, section_data_start_y, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, ptr5, len5, ptr6, len6, ptr7, len7, ptr8, len8, ptr9, len9, ptr10, len10, enable_lighting, smooth_lighting, sky_light_value);
489
+ return ret;
490
+ }
491
+
492
+ /**
493
+ * Parse a 1.18+ Minecraft chunk dump (column.dump() output).
494
+ *
495
+ * Returns an object: { blockStates: Uint16Array, biomes: Uint8Array, bytesRead: number }.
496
+ * Throws on parse error.
497
+ * @param {Uint8Array} buffer
498
+ * @param {number} num_sections
499
+ * @param {number} max_bits_per_block
500
+ * @param {number} max_bits_per_biome
501
+ * @returns {any}
502
+ */
503
+ export function parseChunkDump118(buffer, num_sections, max_bits_per_block, max_bits_per_biome) {
504
+ const ptr0 = passArray8ToWasm0(buffer, wasm.__wbindgen_malloc);
505
+ const len0 = WASM_VECTOR_LEN;
506
+ const ret = wasm.parseChunkDump118(ptr0, len0, num_sections, max_bits_per_block, max_bits_per_biome);
507
+ return ret;
508
+ }
509
+
510
+ /**
511
+ * index = x + z*16 + y*256, where y goes 0..(num_sections*16).
512
+ * Biomes are expanded from per-section 4×4×4 to per-block (matching prismarine-chunk's
513
+ * `getBiome(pos)`).
514
+ *
515
+ * This is the drop-in replacement for `convertChunkToWasm`'s blocks+biomes extraction:
516
+ * no JS hot loop, no per-section-to-full-column reorder. Light is still produced by
517
+ * `unpackLightSection118` per section (caller is responsible).
518
+ *
519
+ * Returns: { blockStates: Uint16Array, biomes: Uint8Array, bytesRead: number }.
520
+ * @param {Uint8Array} buffer
521
+ * @param {number} num_sections
522
+ * @param {number} max_bits_per_block
523
+ * @param {number} max_bits_per_biome
524
+ * @returns {any}
525
+ */
526
+ export function parseChunkDump118FullColumn(buffer, num_sections, max_bits_per_block, max_bits_per_biome) {
527
+ const ptr0 = passArray8ToWasm0(buffer, wasm.__wbindgen_malloc);
528
+ const len0 = WASM_VECTOR_LEN;
529
+ const ret = wasm.parseChunkDump118FullColumn(ptr0, len0, num_sections, max_bits_per_block, max_bits_per_biome);
530
+ return ret;
531
+ }
532
+
533
+ /**
534
+ * Full drop-in replacement for `convertChunkToWasm`: parses dump + assembles light into
535
+ * `convertChunkToWasm`-shaped Uint16Array(blocks) + Uint8Array(biomes/blockLight/skyLight).
536
+ *
537
+ * Light masks come as Uint32Array laid out as (low0, high0, low1, high1, ...).
538
+ * The JS side flattens prismarine's [[high, low]] format into that order:
539
+ * `Uint32Array.of(...mask.flatMap(([h, l]) => [l >>> 0, h >>> 0]))`.
540
+ *
541
+ * `sky_light_concat` / `block_light_concat` = concatenation of present light section
542
+ * buffers (each 2048 bytes), in mask-bit order (border-below first).
543
+ *
544
+ * Returns: { blockStates: Uint16Array, biomes: Uint8Array, blockLight: Uint8Array,
545
+ * skyLight: Uint8Array, bytesRead: number }.
546
+ * @param {Uint8Array} dump_buffer
547
+ * @param {Uint8Array} sky_light_concat
548
+ * @param {Uint8Array} block_light_concat
549
+ * @param {Uint32Array} sky_light_mask
550
+ * @param {Uint32Array} block_light_mask
551
+ * @param {Uint32Array} empty_sky_light_mask
552
+ * @param {Uint32Array} empty_block_light_mask
553
+ * @param {number} num_sections
554
+ * @param {number} max_bits_per_block
555
+ * @param {number} max_bits_per_biome
556
+ * @returns {any}
557
+ */
558
+ export function parseChunkDump118FullColumnAll(dump_buffer, sky_light_concat, block_light_concat, sky_light_mask, block_light_mask, empty_sky_light_mask, empty_block_light_mask, num_sections, max_bits_per_block, max_bits_per_biome) {
559
+ const ptr0 = passArray8ToWasm0(dump_buffer, wasm.__wbindgen_malloc);
560
+ const len0 = WASM_VECTOR_LEN;
561
+ const ptr1 = passArray8ToWasm0(sky_light_concat, wasm.__wbindgen_malloc);
562
+ const len1 = WASM_VECTOR_LEN;
563
+ const ptr2 = passArray8ToWasm0(block_light_concat, wasm.__wbindgen_malloc);
564
+ const len2 = WASM_VECTOR_LEN;
565
+ const ptr3 = passArray32ToWasm0(sky_light_mask, wasm.__wbindgen_malloc);
566
+ const len3 = WASM_VECTOR_LEN;
567
+ const ptr4 = passArray32ToWasm0(block_light_mask, wasm.__wbindgen_malloc);
568
+ const len4 = WASM_VECTOR_LEN;
569
+ const ptr5 = passArray32ToWasm0(empty_sky_light_mask, wasm.__wbindgen_malloc);
570
+ const len5 = WASM_VECTOR_LEN;
571
+ const ptr6 = passArray32ToWasm0(empty_block_light_mask, wasm.__wbindgen_malloc);
572
+ const len6 = WASM_VECTOR_LEN;
573
+ const ret = wasm.parseChunkDump118FullColumnAll(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, ptr5, len5, ptr6, len6, num_sections, max_bits_per_block, max_bits_per_biome);
574
+ return ret;
575
+ }
576
+
577
+ /**
578
+ * PoC bench helper: parse dump but return ONLY a checksum (no Uint16Array marshalling).
579
+ * Lets us isolate raw parse cost from the JS<->WASM boundary cost.
580
+ * @param {Uint8Array} buffer
581
+ * @param {number} num_sections
582
+ * @param {number} max_bits_per_block
583
+ * @param {number} max_bits_per_biome
584
+ * @returns {number}
585
+ */
586
+ export function parseChunkDump118NoMarshal(buffer, num_sections, max_bits_per_block, max_bits_per_biome) {
587
+ const ptr0 = passArray8ToWasm0(buffer, wasm.__wbindgen_malloc);
588
+ const len0 = WASM_VECTOR_LEN;
589
+ const ret = wasm.parseChunkDump118NoMarshal(ptr0, len0, num_sections, max_bits_per_block, max_bits_per_biome);
590
+ return ret;
591
+ }
592
+
593
+ /**
594
+ * Parse a 1.17 chunk-section payload (the bytes inside `chunkData` of a
595
+ * `map_chunk` packet) into a flat `Uint16Array` of block states **and** an
596
+ * expanded per-block biome `Uint8Array`.
597
+ *
598
+ * `chunk_data` — exactly the bytes between the `chunkData` length prefix and
599
+ * the `blockEntities` count in the wire packet (i.e. what
600
+ * `prismarine-chunk` 1.17 `ChunkColumn.load(data, bitMap)` consumes). The
601
+ * JS-side caller (mineflayer/protodef) does the outer-packet parsing and
602
+ * hands the slice in directly.
603
+ *
604
+ * `bit_map_lo_hi` — section mask flattened to `[low0, high0, low1, high1,
605
+ * ...]` u32 pairs. Bit `s` indicates that section index `s` is present in
606
+ * `chunk_data`. Sections without a set bit decode to all-zeros.
607
+ *
608
+ * `biomes_cells` — the 1.17 wire `biomes` field (varint[num_sections * 64]),
609
+ * passed straight through as `Int32Array`. May be empty (`&[]`) when the
610
+ * caller didn't capture biomes — every block then gets `default_biome`
611
+ * (typically 1 = plains).
612
+ *
613
+ * Returns `{ blockStates: Uint16Array(num_sections * 4096),
614
+ * biomes: Uint8Array(num_sections * 4096),
615
+ * bytesRead, bytesTotal }`.
616
+ * Layout of both arrays is `(s * 4096) | (y_in << 8) | (z << 4) | x`,
617
+ * matching what the WASM mesher already consumes for 1.18+ blocks.
618
+ *
619
+ * Light is **not** produced here — in 1.17 it arrives in a separate
620
+ * `update_light` packet (see `parseUpdateLightV17`). The JS bridge fills in
621
+ * defaults (sky=15, block=0) or merges real data from a paired light cache.
622
+ * @param {Uint8Array} chunk_data
623
+ * @param {Uint32Array} bit_map_lo_hi
624
+ * @param {number} num_sections
625
+ * @param {number} max_bits_per_block
626
+ * @param {Int32Array} biomes_cells
627
+ * @param {number} default_biome
628
+ * @returns {any}
629
+ */
630
+ export function parseChunkSectionsV16V17(chunk_data, bit_map_lo_hi, num_sections, max_bits_per_block, biomes_cells, default_biome) {
631
+ const ptr0 = passArray8ToWasm0(chunk_data, wasm.__wbindgen_malloc);
632
+ const len0 = WASM_VECTOR_LEN;
633
+ const ptr1 = passArray32ToWasm0(bit_map_lo_hi, wasm.__wbindgen_malloc);
634
+ const len1 = WASM_VECTOR_LEN;
635
+ const ptr2 = passArray32ToWasm0(biomes_cells, wasm.__wbindgen_malloc);
636
+ const len2 = WASM_VECTOR_LEN;
637
+ const ret = wasm.parseChunkSectionsV16V17(ptr0, len0, ptr1, len1, num_sections, max_bits_per_block, ptr2, len2, default_biome);
638
+ return ret;
639
+ }
640
+
641
+ /**
642
+ * Stage-3 entry: parse a raw `map_chunk` packet (1.18+) into the same shape as
643
+ * `parseChunkDump118FullColumnAll` so the worker can drop it straight into
644
+ * `generate_geometry`.
645
+ *
646
+ * `raw_packet` is the buffer captured from `bot._client.on('raw.map_chunk', ...)`;
647
+ * it includes the leading packet-id varint (we skip it). `protocol` selects
648
+ * the version-specific quirks (heightmaps NBT, trust_edges, anonymous NBT, etc.).
649
+ *
650
+ * Returns: `{ x, z, blockStates: Uint16Array, biomes: Uint8Array,
651
+ * blockLight: Uint8Array, skyLight: Uint8Array, bytesRead }`.
652
+ * @param {Uint8Array} raw_packet
653
+ * @param {number} num_sections
654
+ * @param {number} max_bits_per_block
655
+ * @param {number} max_bits_per_biome
656
+ * @param {number} protocol
657
+ * @returns {any}
658
+ */
659
+ export function parseMapChunkV18Plus(raw_packet, num_sections, max_bits_per_block, max_bits_per_biome, protocol) {
660
+ const ptr0 = passArray8ToWasm0(raw_packet, wasm.__wbindgen_malloc);
661
+ const len0 = WASM_VECTOR_LEN;
662
+ const ret = wasm.parseMapChunkV18Plus(ptr0, len0, num_sections, max_bits_per_block, max_bits_per_biome, protocol);
663
+ return ret;
664
+ }
665
+
666
+ /**
667
+ * Parse a raw 1.17 `update_light` packet (as captured by
668
+ * `client.on('raw.update_light', ...)`) into flat per-block sky/block light
669
+ * arrays the WASM mesher consumes.
670
+ *
671
+ * `raw_packet` includes the leading packet-id varint (we skip it).
672
+ * `num_sections` should match the column the light is for (16 in 1.17).
673
+ *
674
+ * Returns `{ x, z, skyLight: Uint8Array(num_sections * 4096),
675
+ * blockLight: Uint8Array(num_sections * 4096), bytesRead }`.
676
+ * Layout matches the existing 1.18+ light arrays
677
+ * (`x + z*16 + y_abs*256`); the JS-side worker reorders into per-section
678
+ * stack via the same path used for 1.18+ raw map_chunk parsing.
679
+ * @param {Uint8Array} raw_packet
680
+ * @param {number} num_sections
681
+ * @returns {any}
682
+ */
683
+ export function parseUpdateLightV17(raw_packet, num_sections) {
684
+ const ptr0 = passArray8ToWasm0(raw_packet, wasm.__wbindgen_malloc);
685
+ const len0 = WASM_VECTOR_LEN;
686
+ const ret = wasm.parseUpdateLightV17(ptr0, len0, num_sections);
687
+ return ret;
688
+ }
689
+
690
+ /**
691
+ * Unpack a single light section (2048 bytes, BitArrayNoSpan bpv=4) into 4096 nibble values.
692
+ * @param {Uint8Array} buffer
693
+ * @returns {Uint8Array}
694
+ */
695
+ export function unpackLightSection118(buffer) {
696
+ const ptr0 = passArray8ToWasm0(buffer, wasm.__wbindgen_malloc);
697
+ const len0 = WASM_VECTOR_LEN;
698
+ const ret = wasm.unpackLightSection118(ptr0, len0);
699
+ var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
700
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
701
+ return v2;
702
+ }
703
+
704
+ const EXPECTED_RESPONSE_TYPES = new Set(['basic', 'cors', 'default']);
705
+
706
+ async function __wbg_load(module, imports) {
707
+ if (typeof Response === 'function' && module instanceof Response) {
708
+ if (typeof WebAssembly.instantiateStreaming === 'function') {
709
+ try {
710
+ return await WebAssembly.instantiateStreaming(module, imports);
711
+ } catch (e) {
712
+ const validResponse = module.ok && EXPECTED_RESPONSE_TYPES.has(module.type);
713
+
714
+ if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
715
+ 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);
716
+
717
+ } else {
718
+ throw e;
719
+ }
720
+ }
721
+ }
722
+
723
+ const bytes = await module.arrayBuffer();
724
+ return await WebAssembly.instantiate(bytes, imports);
725
+ } else {
726
+ const instance = await WebAssembly.instantiate(module, imports);
727
+
728
+ if (instance instanceof WebAssembly.Instance) {
729
+ return { instance, module };
730
+ } else {
731
+ return instance;
732
+ }
733
+ }
734
+ }
735
+
736
+ function __wbg_get_imports() {
737
+ const imports = {};
738
+ imports.wbg = {};
739
+ imports.wbg.__wbg_Error_52673b7de5a0ca89 = function(arg0, arg1) {
740
+ const ret = Error(getStringFromWasm0(arg0, arg1));
741
+ return ret;
742
+ };
743
+ imports.wbg.__wbg___wbindgen_debug_string_adfb662ae34724b6 = function(arg0, arg1) {
744
+ const ret = debugString(arg1);
745
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
746
+ const len1 = WASM_VECTOR_LEN;
747
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
748
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
749
+ };
750
+ imports.wbg.__wbg___wbindgen_throw_dd24417ed36fc46e = function(arg0, arg1) {
751
+ throw new Error(getStringFromWasm0(arg0, arg1));
752
+ };
753
+ imports.wbg.__wbg_length_22ac23eaec9d8053 = function(arg0) {
754
+ const ret = arg0.length;
755
+ return ret;
756
+ };
757
+ imports.wbg.__wbg_length_497fc8f401ac8b1c = function(arg0) {
758
+ const ret = arg0.length;
759
+ return ret;
760
+ };
761
+ imports.wbg.__wbg_new_1ba21ce319a06297 = function() {
762
+ const ret = new Object();
763
+ return ret;
764
+ };
765
+ imports.wbg.__wbg_new_25f239778d6112b9 = function() {
766
+ const ret = new Array();
767
+ return ret;
768
+ };
769
+ imports.wbg.__wbg_new_with_length_aa5eaf41d35235e5 = function(arg0) {
770
+ const ret = new Uint8Array(arg0 >>> 0);
771
+ return ret;
772
+ };
773
+ imports.wbg.__wbg_new_with_length_d7142aa2b68069a8 = function(arg0) {
774
+ const ret = new Uint16Array(arg0 >>> 0);
775
+ return ret;
776
+ };
777
+ imports.wbg.__wbg_set_169e13b608078b7b = function(arg0, arg1, arg2) {
778
+ arg0.set(getArrayU8FromWasm0(arg1, arg2));
779
+ };
780
+ imports.wbg.__wbg_set_3f1d0b984ed272ed = function(arg0, arg1, arg2) {
781
+ arg0[arg1] = arg2;
782
+ };
783
+ imports.wbg.__wbg_set_781438a03c0c3c81 = function() { return handleError(function (arg0, arg1, arg2) {
784
+ const ret = Reflect.set(arg0, arg1, arg2);
785
+ return ret;
786
+ }, arguments) };
787
+ imports.wbg.__wbg_set_7df433eea03a5c14 = function(arg0, arg1, arg2) {
788
+ arg0[arg1 >>> 0] = arg2;
789
+ };
790
+ imports.wbg.__wbg_set_bb0c6a7fe60d81b5 = function(arg0, arg1, arg2) {
791
+ arg0.set(getArrayU16FromWasm0(arg1, arg2));
792
+ };
793
+ imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
794
+ // Cast intrinsic for `Ref(String) -> Externref`.
795
+ const ret = getStringFromWasm0(arg0, arg1);
796
+ return ret;
797
+ };
798
+ imports.wbg.__wbindgen_cast_4625c577ab2ec9ee = function(arg0) {
799
+ // Cast intrinsic for `U64 -> Externref`.
800
+ const ret = BigInt.asUintN(64, arg0);
801
+ return ret;
802
+ };
803
+ imports.wbg.__wbindgen_cast_d6cd19b81560fd6e = function(arg0) {
804
+ // Cast intrinsic for `F64 -> Externref`.
805
+ const ret = arg0;
806
+ return ret;
807
+ };
808
+ imports.wbg.__wbindgen_init_externref_table = function() {
809
+ const table = wasm.__wbindgen_externrefs;
810
+ const offset = table.grow(4);
811
+ table.set(0, undefined);
812
+ table.set(offset + 0, undefined);
813
+ table.set(offset + 1, null);
814
+ table.set(offset + 2, true);
815
+ table.set(offset + 3, false);
816
+ };
817
+
818
+ return imports;
819
+ }
820
+
821
+ function __wbg_finalize_init(instance, module) {
822
+ wasm = instance.exports;
823
+ __wbg_init.__wbindgen_wasm_module = module;
824
+ cachedDataViewMemory0 = null;
825
+ cachedUint16ArrayMemory0 = null;
826
+ cachedUint32ArrayMemory0 = null;
827
+ cachedUint8ArrayMemory0 = null;
828
+
829
+
830
+ wasm.__wbindgen_start();
831
+ return wasm;
832
+ }
833
+
834
+ function initSync(module) {
835
+ if (wasm !== undefined) return wasm;
836
+
837
+
838
+ if (typeof module !== 'undefined') {
839
+ if (Object.getPrototypeOf(module) === Object.prototype) {
840
+ ({module} = module)
841
+ } else {
842
+ console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
843
+ }
844
+ }
845
+
846
+ const imports = __wbg_get_imports();
847
+ if (!(module instanceof WebAssembly.Module)) {
848
+ module = new WebAssembly.Module(module);
849
+ }
850
+ const instance = new WebAssembly.Instance(module, imports);
851
+ return __wbg_finalize_init(instance, module);
852
+ }
853
+
854
+ async function __wbg_init(module_or_path) {
855
+ if (wasm !== undefined) return wasm;
856
+
857
+
858
+ if (typeof module_or_path !== 'undefined') {
859
+ if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
860
+ ({module_or_path} = module_or_path)
861
+ } else {
862
+ console.warn('using deprecated parameters for the initialization function; pass a single object instead')
863
+ }
864
+ }
865
+
866
+ if (typeof module_or_path === 'undefined') {
867
+ module_or_path = new URL('wasm_mesher_bg.wasm', import.meta.url);
868
+ }
869
+ const imports = __wbg_get_imports();
870
+
871
+ if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
872
+ module_or_path = fetch(module_or_path);
873
+ }
874
+
875
+ const { instance, module } = await __wbg_load(await module_or_path, imports);
876
+
877
+ return __wbg_finalize_init(instance, module);
878
+ }
879
+
880
+ export { initSync };
881
+ export default __wbg_init;