@wonfsy/wonfy-tools 0.1.2 → 0.2.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/wonfy_tools.js CHANGED
@@ -1,103 +1,811 @@
1
- let wasm;
1
+ /* @ts-self-types="./wonfy_tools.d.ts" */
2
2
 
3
- function addToExternrefTable0(obj) {
4
- const idx = wasm.__externref_table_alloc();
5
- wasm.__wbindgen_export_2.set(idx, obj);
6
- return idx;
3
+ /**
4
+ * @enum {0 | 1 | 2 | 3}
5
+ */
6
+ export const EncodeFormat = Object.freeze({
7
+ Png: 0, "0": "Png",
8
+ Jpeg: 1, "1": "Jpeg",
9
+ Gif: 2, "2": "Gif",
10
+ WebP: 3, "3": "WebP",
11
+ });
12
+
13
+ export class ImageWithDHash {
14
+ static __wrap(ptr) {
15
+ const obj = Object.create(ImageWithDHash.prototype);
16
+ obj.__wbg_ptr = ptr;
17
+ ImageWithDHashFinalization.register(obj, obj.__wbg_ptr, obj);
18
+ return obj;
19
+ }
20
+ __destroy_into_raw() {
21
+ const ptr = this.__wbg_ptr;
22
+ this.__wbg_ptr = 0;
23
+ ImageWithDHashFinalization.unregister(this);
24
+ return ptr;
25
+ }
26
+ free() {
27
+ const ptr = this.__destroy_into_raw();
28
+ wasm.__wbg_imagewithdhash_free(ptr, 0);
29
+ }
30
+ /**
31
+ * @returns {[Uint8Array, BigInt]}
32
+ */
33
+ images() {
34
+ const ptr = this.__destroy_into_raw();
35
+ const ret = wasm.imagewithdhash_images(ptr);
36
+ return ret;
37
+ }
7
38
  }
39
+ if (Symbol.dispose) ImageWithDHash.prototype[Symbol.dispose] = ImageWithDHash.prototype.free;
8
40
 
9
- function handleError(f, args) {
10
- try {
11
- return f.apply(this, args);
12
- } catch (e) {
13
- const idx = addToExternrefTable0(e);
14
- wasm.__wbindgen_exn_store(idx);
41
+ export class Preview {
42
+ __destroy_into_raw() {
43
+ const ptr = this.__wbg_ptr;
44
+ this.__wbg_ptr = 0;
45
+ PreviewFinalization.unregister(this);
46
+ return ptr;
47
+ }
48
+ free() {
49
+ const ptr = this.__destroy_into_raw();
50
+ wasm.__wbg_preview_free(ptr, 0);
51
+ }
52
+ /**
53
+ * @param {PreviewType} type
54
+ * @param {number} value
55
+ */
56
+ constructor(type, value) {
57
+ const ret = wasm.preview_new(type, value);
58
+ this.__wbg_ptr = ret;
59
+ PreviewFinalization.register(this, this.__wbg_ptr, this);
60
+ return this;
15
61
  }
16
62
  }
63
+ if (Symbol.dispose) Preview.prototype[Symbol.dispose] = Preview.prototype.free;
17
64
 
18
- const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
65
+ /**
66
+ * @enum {0 | 1 | 2}
67
+ */
68
+ export const PreviewType = Object.freeze({
69
+ Resize: 0, "0": "Resize",
70
+ MaxWidth: 1, "1": "MaxWidth",
71
+ MaxHeight: 2, "2": "MaxHeight",
72
+ });
19
73
 
20
- if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
74
+ export class StitchReturn {
75
+ static __wrap(ptr) {
76
+ const obj = Object.create(StitchReturn.prototype);
77
+ obj.__wbg_ptr = ptr;
78
+ StitchReturnFinalization.register(obj, obj.__wbg_ptr, obj);
79
+ return obj;
80
+ }
81
+ __destroy_into_raw() {
82
+ const ptr = this.__wbg_ptr;
83
+ this.__wbg_ptr = 0;
84
+ StitchReturnFinalization.unregister(this);
85
+ return ptr;
86
+ }
87
+ free() {
88
+ const ptr = this.__destroy_into_raw();
89
+ wasm.__wbg_stitchreturn_free(ptr, 0);
90
+ }
91
+ /**
92
+ * @returns {[StitchedImage, StitchedImage?]}
93
+ */
94
+ images() {
95
+ const ptr = this.__destroy_into_raw();
96
+ const ret = wasm.stitchreturn_images(ptr);
97
+ return ret;
98
+ }
99
+ }
100
+ if (Symbol.dispose) StitchReturn.prototype[Symbol.dispose] = StitchReturn.prototype.free;
21
101
 
22
- let cachedUint8ArrayMemory0 = null;
102
+ export class StitchedImage {
103
+ static __wrap(ptr) {
104
+ const obj = Object.create(StitchedImage.prototype);
105
+ obj.__wbg_ptr = ptr;
106
+ StitchedImageFinalization.register(obj, obj.__wbg_ptr, obj);
107
+ return obj;
108
+ }
109
+ __destroy_into_raw() {
110
+ const ptr = this.__wbg_ptr;
111
+ this.__wbg_ptr = 0;
112
+ StitchedImageFinalization.unregister(this);
113
+ return ptr;
114
+ }
115
+ free() {
116
+ const ptr = this.__destroy_into_raw();
117
+ wasm.__wbg_stitchedimage_free(ptr, 0);
118
+ }
119
+ /**
120
+ * @returns {number}
121
+ */
122
+ get height() {
123
+ const ret = wasm.__wbg_get_stitchedimage_height(this.__wbg_ptr);
124
+ return ret >>> 0;
125
+ }
126
+ /**
127
+ * @returns {number}
128
+ */
129
+ get width() {
130
+ const ret = wasm.__wbg_get_stitchedimage_width(this.__wbg_ptr);
131
+ return ret >>> 0;
132
+ }
133
+ /**
134
+ * @param {number} arg0
135
+ */
136
+ set height(arg0) {
137
+ wasm.__wbg_set_stitchedimage_height(this.__wbg_ptr, arg0);
138
+ }
139
+ /**
140
+ * @param {number} arg0
141
+ */
142
+ set width(arg0) {
143
+ wasm.__wbg_set_stitchedimage_width(this.__wbg_ptr, arg0);
144
+ }
145
+ /**
146
+ * @returns {{ image: Uint8Array, stitchPositions: Array<{ x: number, y: number }>, width: number, height: number }}
147
+ */
148
+ toJson() {
149
+ const ptr = this.__destroy_into_raw();
150
+ const ret = wasm.stitchedimage_toJson(ptr);
151
+ return ret;
152
+ }
153
+ }
154
+ if (Symbol.dispose) StitchedImage.prototype[Symbol.dispose] = StitchedImage.prototype.free;
23
155
 
24
- function getUint8ArrayMemory0() {
25
- if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
26
- cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
156
+ /**
157
+ * @param {EncodeFormat} format
158
+ * @returns {string}
159
+ */
160
+ export function encode_format_content_type(format) {
161
+ let deferred1_0;
162
+ let deferred1_1;
163
+ try {
164
+ const ret = wasm.encode_format_content_type(format);
165
+ deferred1_0 = ret[0];
166
+ deferred1_1 = ret[1];
167
+ return getStringFromWasm0(ret[0], ret[1]);
168
+ } finally {
169
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
27
170
  }
28
- return cachedUint8ArrayMemory0;
29
171
  }
30
172
 
31
- function getStringFromWasm0(ptr, len) {
32
- ptr = ptr >>> 0;
33
- return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
173
+ /**
174
+ * @param {EncodeFormat} format
175
+ * @returns {string}
176
+ */
177
+ export function encode_format_file_extension(format) {
178
+ let deferred1_0;
179
+ let deferred1_1;
180
+ try {
181
+ const ret = wasm.encode_format_file_extension(format);
182
+ deferred1_0 = ret[0];
183
+ deferred1_1 = ret[1];
184
+ return getStringFromWasm0(ret[0], ret[1]);
185
+ } finally {
186
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
187
+ }
34
188
  }
35
189
 
36
- let WASM_VECTOR_LEN = 0;
190
+ /**
191
+ * @param {Uint8Array} bytes
192
+ * @param {number} width
193
+ * @param {number} height
194
+ * @param {EncodeFormat} format
195
+ * @returns {ImageWithDHash}
196
+ */
197
+ export function rgba_bytes_to_image(bytes, width, height, format) {
198
+ const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
199
+ const len0 = WASM_VECTOR_LEN;
200
+ const ret = wasm.rgba_bytes_to_image(ptr0, len0, width, height, format);
201
+ if (ret[2]) {
202
+ throw takeFromExternrefTable0(ret[1]);
203
+ }
204
+ return ImageWithDHash.__wrap(ret[0]);
205
+ }
37
206
 
38
- const cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );
207
+ export function start() {
208
+ wasm.start();
209
+ }
39
210
 
40
- const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
41
- ? function (arg, view) {
42
- return cachedTextEncoder.encodeInto(arg, view);
211
+ /**
212
+ * @param {Uint8Array[]} images
213
+ * @param {string} direction
214
+ * @param {string} order
215
+ * @param {number | null | undefined} window_size
216
+ * @param {string | null | undefined} match_mode
217
+ * @param {number | null | undefined} crop_padding
218
+ * @param {Preview | null | undefined} preview
219
+ * @param {EncodeFormat} format
220
+ * @returns {Promise<StitchReturn>}
221
+ */
222
+ export function stitch(images, direction, order, window_size, match_mode, crop_padding, preview, format) {
223
+ const ptr0 = passArrayJsValueToWasm0(images, wasm.__wbindgen_malloc);
224
+ const len0 = WASM_VECTOR_LEN;
225
+ const ptr1 = passStringToWasm0(direction, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
226
+ const len1 = WASM_VECTOR_LEN;
227
+ const ptr2 = passStringToWasm0(order, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
228
+ const len2 = WASM_VECTOR_LEN;
229
+ var ptr3 = isLikeNone(match_mode) ? 0 : passStringToWasm0(match_mode, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
230
+ var len3 = WASM_VECTOR_LEN;
231
+ let ptr4 = 0;
232
+ if (!isLikeNone(preview)) {
233
+ _assertClass(preview, Preview);
234
+ ptr4 = preview.__destroy_into_raw();
235
+ }
236
+ const ret = wasm.stitch(ptr0, len0, ptr1, len1, ptr2, len2, isLikeNone(window_size) ? Number.MAX_SAFE_INTEGER : (window_size) >>> 0, ptr3, len3, isLikeNone(crop_padding) ? Number.MAX_SAFE_INTEGER : (crop_padding) >>> 0, ptr4, format);
237
+ return ret;
43
238
  }
44
- : function (arg, view) {
45
- const buf = cachedTextEncoder.encode(arg);
46
- view.set(buf);
239
+ function __wbg_get_imports() {
240
+ const import0 = {
241
+ __proto__: null,
242
+ __wbg_BigInt_7c5b46c866f07602: function() { return handleError(function (arg0) {
243
+ const ret = BigInt(arg0);
244
+ return ret;
245
+ }, arguments); },
246
+ __wbg_Window_afcc911b2f9c92e2: function(arg0) {
247
+ const ret = arg0.Window;
248
+ return ret;
249
+ },
250
+ __wbg_WorkerGlobalScope_5d19ebc889ff397e: function(arg0) {
251
+ const ret = arg0.WorkerGlobalScope;
252
+ return ret;
253
+ },
254
+ __wbg___wbindgen_debug_string_c25d447a39f5578f: function(arg0, arg1) {
255
+ const ret = debugString(arg1);
256
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
257
+ const len1 = WASM_VECTOR_LEN;
258
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
259
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
260
+ },
261
+ __wbg___wbindgen_is_function_1ff95bcc5517c252: function(arg0) {
262
+ const ret = typeof(arg0) === 'function';
263
+ return ret;
264
+ },
265
+ __wbg___wbindgen_is_null_ea9085d691f535d3: function(arg0) {
266
+ const ret = arg0 === null;
267
+ return ret;
268
+ },
269
+ __wbg___wbindgen_is_string_ea5e6cc2e4141dfe: function(arg0) {
270
+ const ret = typeof(arg0) === 'string';
271
+ return ret;
272
+ },
273
+ __wbg___wbindgen_is_undefined_c05833b95a3cf397: function(arg0) {
274
+ const ret = arg0 === undefined;
275
+ return ret;
276
+ },
277
+ __wbg___wbindgen_throw_344f42d3211c4765: function(arg0, arg1) {
278
+ throw new Error(getStringFromWasm0(arg0, arg1));
279
+ },
280
+ __wbg__wbg_cb_unref_fffb441def202758: function(arg0) {
281
+ arg0._wbg_cb_unref();
282
+ },
283
+ __wbg_beginComputePass_431a159006c13c7c: function(arg0, arg1) {
284
+ const ret = arg0.beginComputePass(arg1);
285
+ return ret;
286
+ },
287
+ __wbg_call_a6e5c5dce5018821: function() { return handleError(function (arg0, arg1, arg2) {
288
+ const ret = arg0.call(arg1, arg2);
289
+ return ret;
290
+ }, arguments); },
291
+ __wbg_configure_0e4789c0f6b35c8e: function() { return handleError(function (arg0, arg1) {
292
+ arg0.configure(arg1);
293
+ }, arguments); },
294
+ __wbg_copyBufferToBuffer_5e2cd8f10ae78183: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
295
+ arg0.copyBufferToBuffer(arg1, arg2, arg3, arg4);
296
+ }, arguments); },
297
+ __wbg_copyBufferToBuffer_ca30deb8de65f5d5: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5) {
298
+ arg0.copyBufferToBuffer(arg1, arg2, arg3, arg4, arg5);
299
+ }, arguments); },
300
+ __wbg_createBindGroup_655c6e6c0258530e: function(arg0, arg1) {
301
+ const ret = arg0.createBindGroup(arg1);
302
+ return ret;
303
+ },
304
+ __wbg_createBuffer_0726dd2ab09ea1d2: function() { return handleError(function (arg0, arg1) {
305
+ const ret = arg0.createBuffer(arg1);
306
+ return ret;
307
+ }, arguments); },
308
+ __wbg_createCommandEncoder_ec1f40f0cb4d09df: function(arg0, arg1) {
309
+ const ret = arg0.createCommandEncoder(arg1);
310
+ return ret;
311
+ },
312
+ __wbg_createComputePipeline_2545c47f08715810: function(arg0, arg1) {
313
+ const ret = arg0.createComputePipeline(arg1);
314
+ return ret;
315
+ },
316
+ __wbg_createShaderModule_2e44fc7677c6288b: function(arg0, arg1) {
317
+ const ret = arg0.createShaderModule(arg1);
318
+ return ret;
319
+ },
320
+ __wbg_dispatchWorkgroups_afb2344298c62227: function(arg0, arg1, arg2, arg3) {
321
+ arg0.dispatchWorkgroups(arg1 >>> 0, arg2 >>> 0, arg3 >>> 0);
322
+ },
323
+ __wbg_end_c36889de8ddef882: function(arg0) {
324
+ arg0.end();
325
+ },
326
+ __wbg_error_a6fa202b58aa1cd3: function(arg0, arg1) {
327
+ let deferred0_0;
328
+ let deferred0_1;
329
+ try {
330
+ deferred0_0 = arg0;
331
+ deferred0_1 = arg1;
332
+ console.error(getStringFromWasm0(arg0, arg1));
333
+ } finally {
334
+ wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
335
+ }
336
+ },
337
+ __wbg_finish_4d91de5e927dd13f: function(arg0, arg1) {
338
+ const ret = arg0.finish(arg1);
339
+ return ret;
340
+ },
341
+ __wbg_finish_6e06b68ab68cd9f6: function(arg0) {
342
+ const ret = arg0.finish();
343
+ return ret;
344
+ },
345
+ __wbg_getBindGroupLayout_d38545dfc4eab8d5: function(arg0, arg1) {
346
+ const ret = arg0.getBindGroupLayout(arg1 >>> 0);
347
+ return ret;
348
+ },
349
+ __wbg_getContext_fd298c901058eb31: function() { return handleError(function (arg0, arg1, arg2) {
350
+ const ret = arg0.getContext(getStringFromWasm0(arg1, arg2));
351
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
352
+ }, arguments); },
353
+ __wbg_getMappedRange_d0bf3141224111b6: function() { return handleError(function (arg0, arg1, arg2) {
354
+ const ret = arg0.getMappedRange(arg1, arg2);
355
+ return ret;
356
+ }, arguments); },
357
+ __wbg_gpu_2ccc250735d24a2a: function(arg0) {
358
+ const ret = arg0.gpu;
359
+ return ret;
360
+ },
361
+ __wbg_label_7ed42f25f841996b: function(arg0, arg1) {
362
+ const ret = arg1.label;
363
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
364
+ const len1 = WASM_VECTOR_LEN;
365
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
366
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
367
+ },
368
+ __wbg_length_1f0964f4a5e2c6d8: function(arg0) {
369
+ const ret = arg0.length;
370
+ return ret;
371
+ },
372
+ __wbg_log_0c201ade58bb55e1: function(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) {
373
+ let deferred0_0;
374
+ let deferred0_1;
375
+ try {
376
+ deferred0_0 = arg0;
377
+ deferred0_1 = arg1;
378
+ console.log(getStringFromWasm0(arg0, arg1), getStringFromWasm0(arg2, arg3), getStringFromWasm0(arg4, arg5), getStringFromWasm0(arg6, arg7));
379
+ } finally {
380
+ wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
381
+ }
382
+ },
383
+ __wbg_log_ce2c4456b290c5e7: function(arg0, arg1) {
384
+ let deferred0_0;
385
+ let deferred0_1;
386
+ try {
387
+ deferred0_0 = arg0;
388
+ deferred0_1 = arg1;
389
+ console.log(getStringFromWasm0(arg0, arg1));
390
+ } finally {
391
+ wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
392
+ }
393
+ },
394
+ __wbg_mapAsync_52b01fa9e8f765fd: function(arg0, arg1, arg2, arg3) {
395
+ const ret = arg0.mapAsync(arg1 >>> 0, arg2, arg3);
396
+ return ret;
397
+ },
398
+ __wbg_mark_b4d943f3bc2d2404: function(arg0, arg1) {
399
+ performance.mark(getStringFromWasm0(arg0, arg1));
400
+ },
401
+ __wbg_measure_84362959e621a2c1: function() { return handleError(function (arg0, arg1, arg2, arg3) {
402
+ let deferred0_0;
403
+ let deferred0_1;
404
+ let deferred1_0;
405
+ let deferred1_1;
406
+ try {
407
+ deferred0_0 = arg0;
408
+ deferred0_1 = arg1;
409
+ deferred1_0 = arg2;
410
+ deferred1_1 = arg3;
411
+ performance.measure(getStringFromWasm0(arg0, arg1), getStringFromWasm0(arg2, arg3));
412
+ } finally {
413
+ wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
414
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
415
+ }
416
+ }, arguments); },
417
+ __wbg_navigator_51379c10a84aeec9: function(arg0) {
418
+ const ret = arg0.navigator;
419
+ return ret;
420
+ },
421
+ __wbg_navigator_99621db14b3f1099: function(arg0) {
422
+ const ret = arg0.navigator;
423
+ return ret;
424
+ },
425
+ __wbg_new_227d7c05414eb861: function() {
426
+ const ret = new Error();
427
+ return ret;
428
+ },
429
+ __wbg_new_25e75d1f0df4d87a: function() { return handleError(function (arg0, arg1) {
430
+ const ret = new OffscreenCanvas(arg0 >>> 0, arg1 >>> 0);
431
+ return ret;
432
+ }, arguments); },
433
+ __wbg_new_32b398fb48b6d94a: function() {
434
+ const ret = new Array();
435
+ return ret;
436
+ },
437
+ __wbg_new_da52cf8fe3429cb2: function() {
438
+ const ret = new Object();
439
+ return ret;
440
+ },
441
+ __wbg_new_typed_1824d93f294193e5: function(arg0, arg1) {
442
+ try {
443
+ var state0 = {a: arg0, b: arg1};
444
+ var cb0 = (arg0, arg1) => {
445
+ const a = state0.a;
446
+ state0.a = 0;
447
+ try {
448
+ return wasm_bindgen__convert__closures_____invoke__h2a7050afc147b47a(a, state0.b, arg0, arg1);
449
+ } finally {
450
+ state0.a = a;
451
+ }
452
+ };
453
+ const ret = new Promise(cb0);
454
+ return ret;
455
+ } finally {
456
+ state0.a = 0;
457
+ }
458
+ },
459
+ __wbg_new_typed_4148bd5ae72ab3f0: function() {
460
+ const ret = new Object();
461
+ return ret;
462
+ },
463
+ __wbg_new_with_byte_offset_and_length_54c7724ee3ec7d82: function(arg0, arg1, arg2) {
464
+ const ret = new Uint8Array(arg0, arg1 >>> 0, arg2 >>> 0);
465
+ return ret;
466
+ },
467
+ __wbg_new_with_length_f8cbc3a5b9ff9368: function(arg0) {
468
+ const ret = new Array(arg0 >>> 0);
469
+ return ret;
470
+ },
471
+ __wbg_onSubmittedWorkDone_270d6b5a45520e79: function(arg0) {
472
+ const ret = arg0.onSubmittedWorkDone();
473
+ return ret;
474
+ },
475
+ __wbg_prototypesetcall_4770620bbe4688a0: function(arg0, arg1, arg2) {
476
+ Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
477
+ },
478
+ __wbg_push_d2ae3af0c1217ae6: function(arg0, arg1) {
479
+ const ret = arg0.push(arg1);
480
+ return ret;
481
+ },
482
+ __wbg_queueMicrotask_0ab5b2d2393e99b9: function(arg0) {
483
+ const ret = arg0.queueMicrotask;
484
+ return ret;
485
+ },
486
+ __wbg_queueMicrotask_6a09b7bc46549209: function(arg0) {
487
+ queueMicrotask(arg0);
488
+ },
489
+ __wbg_queue_adce34608fd0c893: function(arg0) {
490
+ const ret = arg0.queue;
491
+ return ret;
492
+ },
493
+ __wbg_requestAdapter_2e6718811c735a57: function(arg0, arg1) {
494
+ const ret = arg0.requestAdapter(arg1);
495
+ return ret;
496
+ },
497
+ __wbg_requestDevice_ab46d0519ea1cc34: function(arg0, arg1) {
498
+ const ret = arg0.requestDevice(arg1);
499
+ return ret;
500
+ },
501
+ __wbg_resolve_2191a4dfe481c25b: function(arg0) {
502
+ const ret = Promise.resolve(arg0);
503
+ return ret;
504
+ },
505
+ __wbg_setBindGroup_3e4ce136bc833ea1: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6) {
506
+ arg0.setBindGroup(arg1 >>> 0, arg2, getArrayU32FromWasm0(arg3, arg4), arg5, arg6 >>> 0);
507
+ }, arguments); },
508
+ __wbg_setBindGroup_c22a1b95c0b17f37: function(arg0, arg1, arg2) {
509
+ arg0.setBindGroup(arg1 >>> 0, arg2);
510
+ },
511
+ __wbg_setPipeline_d73f019e98c76d2d: function(arg0, arg1) {
512
+ arg0.setPipeline(arg1);
513
+ },
514
+ __wbg_set_61e45ae8061eca11: function(arg0, arg1, arg2) {
515
+ arg0.set(arg1, arg2 >>> 0);
516
+ },
517
+ __wbg_set_8535240470bf2500: function() { return handleError(function (arg0, arg1, arg2) {
518
+ const ret = Reflect.set(arg0, arg1, arg2);
519
+ return ret;
520
+ }, arguments); },
521
+ __wbg_set_8a16b38e4805b298: function(arg0, arg1, arg2) {
522
+ arg0[arg1 >>> 0] = arg2;
523
+ },
524
+ __wbg_set_beginning_of_pass_write_index_0d4fa06109208ad7: function(arg0, arg1) {
525
+ arg0.beginningOfPassWriteIndex = arg1 >>> 0;
526
+ },
527
+ __wbg_set_binding_f74df3510792aba1: function(arg0, arg1) {
528
+ arg0.binding = arg1 >>> 0;
529
+ },
530
+ __wbg_set_buffer_c3410572051920ba: function(arg0, arg1) {
531
+ arg0.buffer = arg1;
532
+ },
533
+ __wbg_set_code_b4f37f81f45b5b25: function(arg0, arg1, arg2) {
534
+ arg0.code = getStringFromWasm0(arg1, arg2);
535
+ },
536
+ __wbg_set_compute_d0c2d276b6d4b18d: function(arg0, arg1) {
537
+ arg0.compute = arg1;
538
+ },
539
+ __wbg_set_device_e275d1d4f3c9eb74: function(arg0, arg1) {
540
+ arg0.device = arg1;
541
+ },
542
+ __wbg_set_end_of_pass_write_index_49a6ddbb2b888bfa: function(arg0, arg1) {
543
+ arg0.endOfPassWriteIndex = arg1 >>> 0;
544
+ },
545
+ __wbg_set_entries_a12aca1e458b0456: function(arg0, arg1, arg2) {
546
+ arg0.entries = getArrayJsValueViewFromWasm0(arg1, arg2);
547
+ },
548
+ __wbg_set_entry_point_5f26aacbe4c545eb: function(arg0, arg1, arg2) {
549
+ arg0.entryPoint = getStringFromWasm0(arg1, arg2);
550
+ },
551
+ __wbg_set_format_815efd4dc4817bbb: function(arg0, arg1) {
552
+ arg0.format = __wbindgen_enum_GpuTextureFormat[arg1];
553
+ },
554
+ __wbg_set_label_08d9be3e4719c226: function(arg0, arg1, arg2) {
555
+ arg0.label = getStringFromWasm0(arg1, arg2);
556
+ },
557
+ __wbg_set_label_60ad96c811e0d109: function(arg0, arg1, arg2) {
558
+ arg0.label = getStringFromWasm0(arg1, arg2);
559
+ },
560
+ __wbg_set_label_6db0393d3fdc90a5: function(arg0, arg1, arg2) {
561
+ arg0.label = getStringFromWasm0(arg1, arg2);
562
+ },
563
+ __wbg_set_label_72bb4f41ef0cb893: function(arg0, arg1, arg2) {
564
+ arg0.label = getStringFromWasm0(arg1, arg2);
565
+ },
566
+ __wbg_set_label_79387decda299036: function(arg0, arg1, arg2) {
567
+ arg0.label = getStringFromWasm0(arg1, arg2);
568
+ },
569
+ __wbg_set_label_d010f237b26f2c55: function(arg0, arg1, arg2) {
570
+ arg0.label = getStringFromWasm0(arg1, arg2);
571
+ },
572
+ __wbg_set_label_e3944e54881b8c50: function(arg0, arg1, arg2) {
573
+ arg0.label = getStringFromWasm0(arg1, arg2);
574
+ },
575
+ __wbg_set_label_ef44793ddf4455c5: function(arg0, arg1, arg2) {
576
+ arg0.label = getStringFromWasm0(arg1, arg2);
577
+ },
578
+ __wbg_set_layout_41021cfd2a2f62df: function(arg0, arg1) {
579
+ arg0.layout = arg1;
580
+ },
581
+ __wbg_set_layout_913d53c17194c989: function(arg0, arg1) {
582
+ arg0.layout = arg1;
583
+ },
584
+ __wbg_set_layout_gpu_auto_layout_mode_0a5a185b3d52b726: function(arg0, arg1) {
585
+ arg0.layout = __wbindgen_enum_GpuAutoLayoutMode[arg1];
586
+ },
587
+ __wbg_set_mapped_at_creation_81b586dc90a50347: function(arg0, arg1) {
588
+ arg0.mappedAtCreation = arg1 !== 0;
589
+ },
590
+ __wbg_set_module_5db9b76ee2dd2a59: function(arg0, arg1) {
591
+ arg0.module = arg1;
592
+ },
593
+ __wbg_set_offset_f64_89f0ce01a689839e: function(arg0, arg1) {
594
+ arg0.offset = arg1;
595
+ },
596
+ __wbg_set_power_preference_8fdca0b7af640d49: function(arg0, arg1) {
597
+ arg0.powerPreference = __wbindgen_enum_GpuPowerPreference[arg1];
598
+ },
599
+ __wbg_set_query_set_4889dd944d5ec0fd: function(arg0, arg1) {
600
+ arg0.querySet = arg1;
601
+ },
602
+ __wbg_set_required_features_1baf274a8669db60: function(arg0, arg1, arg2) {
603
+ arg0.requiredFeatures = getArrayJsValueViewFromWasm0(arg1, arg2);
604
+ },
605
+ __wbg_set_required_limits_871ed33c68613dcb: function(arg0, arg1) {
606
+ arg0.requiredLimits = arg1;
607
+ },
608
+ __wbg_set_resource_5ae7b5e67924f234: function(arg0, arg1) {
609
+ arg0.resource = arg1;
610
+ },
611
+ __wbg_set_resource_gpu_buffer_binding_e5dbca063e7cb67b: function(arg0, arg1) {
612
+ arg0.resource = arg1;
613
+ },
614
+ __wbg_set_resource_gpu_texture_view_eb46c355d51ad7e5: function(arg0, arg1) {
615
+ arg0.resource = arg1;
616
+ },
617
+ __wbg_set_size_f64_6bcd40704bf4cfdc: function(arg0, arg1) {
618
+ arg0.size = arg1;
619
+ },
620
+ __wbg_set_size_f64_8b8f6bba5d678162: function(arg0, arg1) {
621
+ arg0.size = arg1;
622
+ },
623
+ __wbg_set_timestamp_writes_59c2d19ed8aecd97: function(arg0, arg1) {
624
+ arg0.timestampWrites = arg1;
625
+ },
626
+ __wbg_set_usage_b2a2935f37bf3d08: function(arg0, arg1) {
627
+ arg0.usage = arg1 >>> 0;
628
+ },
629
+ __wbg_stack_3b0d974bbf31e44f: function(arg0, arg1) {
630
+ const ret = arg1.stack;
631
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
632
+ const len1 = WASM_VECTOR_LEN;
633
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
634
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
635
+ },
636
+ __wbg_static_accessor_GLOBAL_4ef717fb391d88b7: function() {
637
+ const ret = typeof global === 'undefined' ? null : global;
638
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
639
+ },
640
+ __wbg_static_accessor_GLOBAL_THIS_8d1badc68b5a74f4: function() {
641
+ const ret = typeof globalThis === 'undefined' ? null : globalThis;
642
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
643
+ },
644
+ __wbg_static_accessor_SELF_146583524fe1469b: function() {
645
+ const ret = typeof self === 'undefined' ? null : self;
646
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
647
+ },
648
+ __wbg_static_accessor_WINDOW_f2829a2234d7819e: function() {
649
+ const ret = typeof window === 'undefined' ? null : window;
650
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
651
+ },
652
+ __wbg_stitchedimage_new: function(arg0) {
653
+ const ret = StitchedImage.__wrap(arg0);
654
+ return ret;
655
+ },
656
+ __wbg_stitchreturn_new: function(arg0) {
657
+ const ret = StitchReturn.__wrap(arg0);
658
+ return ret;
659
+ },
660
+ __wbg_submit_ce44115121cd166c: function(arg0, arg1, arg2) {
661
+ arg0.submit(getArrayJsValueViewFromWasm0(arg1, arg2));
662
+ },
663
+ __wbg_then_16d107c451e9905d: function(arg0, arg1, arg2) {
664
+ const ret = arg0.then(arg1, arg2);
665
+ return ret;
666
+ },
667
+ __wbg_then_6ec10ae38b3e92f7: function(arg0, arg1) {
668
+ const ret = arg0.then(arg1);
669
+ return ret;
670
+ },
671
+ __wbg_unconfigure_0a07a0a40de8988d: function(arg0) {
672
+ arg0.unconfigure();
673
+ },
674
+ __wbg_unmap_adaf93276fdf9aaf: function(arg0) {
675
+ arg0.unmap();
676
+ },
677
+ __wbindgen_cast_0000000000000001: function(arg0, arg1) {
678
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 655, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
679
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__hb7851211c87e2b70);
680
+ return ret;
681
+ },
682
+ __wbindgen_cast_0000000000000002: function(arg0, arg1) {
683
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("GPUDevice")], shim_idx: 610, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
684
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h1e0146e5517296ad);
685
+ return ret;
686
+ },
687
+ __wbindgen_cast_0000000000000003: function(arg0, arg1) {
688
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("any")], shim_idx: 610, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
689
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h1e0146e5517296ad_2);
690
+ return ret;
691
+ },
692
+ __wbindgen_cast_0000000000000004: function(arg0, arg1) {
693
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("undefined")], shim_idx: 610, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
694
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h1e0146e5517296ad_3);
695
+ return ret;
696
+ },
697
+ __wbindgen_cast_0000000000000005: function(arg0) {
698
+ // Cast intrinsic for `F64 -> Externref`.
699
+ const ret = arg0;
700
+ return ret;
701
+ },
702
+ __wbindgen_cast_0000000000000006: function(arg0, arg1) {
703
+ // Cast intrinsic for `Ref(Slice(U8)) -> NamedExternref("Uint8Array")`.
704
+ const ret = getArrayU8FromWasm0(arg0, arg1);
705
+ return ret;
706
+ },
707
+ __wbindgen_cast_0000000000000007: function(arg0, arg1) {
708
+ // Cast intrinsic for `Ref(String) -> Externref`.
709
+ const ret = getStringFromWasm0(arg0, arg1);
710
+ return ret;
711
+ },
712
+ __wbindgen_cast_0000000000000008: function(arg0) {
713
+ // Cast intrinsic for `U64 -> Externref`.
714
+ const ret = BigInt.asUintN(64, arg0);
715
+ return ret;
716
+ },
717
+ __wbindgen_cast_0000000000000009: function(arg0, arg1) {
718
+ var v0 = getArrayU8FromWasm0(arg0, arg1).slice();
719
+ wasm.__wbindgen_free(arg0, arg1 * 1, 1);
720
+ // Cast intrinsic for `Vector(U8) -> Externref`.
721
+ const ret = v0;
722
+ return ret;
723
+ },
724
+ __wbindgen_init_externref_table: function() {
725
+ const table = wasm.__wbindgen_externrefs;
726
+ const offset = table.grow(4);
727
+ table.set(0, undefined);
728
+ table.set(offset + 0, undefined);
729
+ table.set(offset + 1, null);
730
+ table.set(offset + 2, true);
731
+ table.set(offset + 3, false);
732
+ },
733
+ };
47
734
  return {
48
- read: arg.length,
49
- written: buf.length
735
+ __proto__: null,
736
+ "./wonfy_tools_bg.js": import0,
50
737
  };
51
- });
738
+ }
52
739
 
53
- function passStringToWasm0(arg, malloc, realloc) {
740
+ function wasm_bindgen__convert__closures_____invoke__hb7851211c87e2b70(arg0, arg1, arg2) {
741
+ const ret = wasm.wasm_bindgen__convert__closures_____invoke__hb7851211c87e2b70(arg0, arg1, arg2);
742
+ if (ret[1]) {
743
+ throw takeFromExternrefTable0(ret[0]);
744
+ }
745
+ }
54
746
 
55
- if (realloc === undefined) {
56
- const buf = cachedTextEncoder.encode(arg);
57
- const ptr = malloc(buf.length, 1) >>> 0;
58
- getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
59
- WASM_VECTOR_LEN = buf.length;
60
- return ptr;
747
+ function wasm_bindgen__convert__closures_____invoke__h1e0146e5517296ad(arg0, arg1, arg2) {
748
+ const ret = wasm.wasm_bindgen__convert__closures_____invoke__h1e0146e5517296ad(arg0, arg1, arg2);
749
+ if (ret[1]) {
750
+ throw takeFromExternrefTable0(ret[0]);
61
751
  }
752
+ }
62
753
 
63
- let len = arg.length;
64
- let ptr = malloc(len, 1) >>> 0;
754
+ function wasm_bindgen__convert__closures_____invoke__h1e0146e5517296ad_2(arg0, arg1, arg2) {
755
+ const ret = wasm.wasm_bindgen__convert__closures_____invoke__h1e0146e5517296ad_2(arg0, arg1, arg2);
756
+ if (ret[1]) {
757
+ throw takeFromExternrefTable0(ret[0]);
758
+ }
759
+ }
65
760
 
66
- const mem = getUint8ArrayMemory0();
761
+ function wasm_bindgen__convert__closures_____invoke__h1e0146e5517296ad_3(arg0, arg1, arg2) {
762
+ const ret = wasm.wasm_bindgen__convert__closures_____invoke__h1e0146e5517296ad_3(arg0, arg1, arg2);
763
+ if (ret[1]) {
764
+ throw takeFromExternrefTable0(ret[0]);
765
+ }
766
+ }
67
767
 
68
- let offset = 0;
768
+ function wasm_bindgen__convert__closures_____invoke__h2a7050afc147b47a(arg0, arg1, arg2, arg3) {
769
+ wasm.wasm_bindgen__convert__closures_____invoke__h2a7050afc147b47a(arg0, arg1, arg2, arg3);
770
+ }
69
771
 
70
- for (; offset < len; offset++) {
71
- const code = arg.charCodeAt(offset);
72
- if (code > 0x7F) break;
73
- mem[ptr + offset] = code;
74
- }
75
772
 
76
- if (offset !== len) {
77
- if (offset !== 0) {
78
- arg = arg.slice(offset);
79
- }
80
- ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
81
- const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
82
- const ret = encodeString(arg, view);
773
+ const __wbindgen_enum_GpuAutoLayoutMode = ["auto"];
83
774
 
84
- offset += ret.written;
85
- ptr = realloc(ptr, len, offset, 1) >>> 0;
86
- }
87
775
 
88
- WASM_VECTOR_LEN = offset;
89
- return ptr;
90
- }
776
+ const __wbindgen_enum_GpuPowerPreference = ["low-power", "high-performance"];
91
777
 
92
- let cachedDataViewMemory0 = null;
93
778
 
94
- function getDataViewMemory0() {
95
- if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
96
- cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
779
+ const __wbindgen_enum_GpuTextureFormat = ["r8unorm", "r8snorm", "r8uint", "r8sint", "r16unorm", "r16snorm", "r16uint", "r16sint", "r16float", "rg8unorm", "rg8snorm", "rg8uint", "rg8sint", "r32uint", "r32sint", "r32float", "rg16unorm", "rg16snorm", "rg16uint", "rg16sint", "rg16float", "rgba8unorm", "rgba8unorm-srgb", "rgba8snorm", "rgba8uint", "rgba8sint", "bgra8unorm", "bgra8unorm-srgb", "rgb9e5ufloat", "rgb10a2uint", "rgb10a2unorm", "rg11b10ufloat", "rg32uint", "rg32sint", "rg32float", "rgba16unorm", "rgba16snorm", "rgba16uint", "rgba16sint", "rgba16float", "rgba32uint", "rgba32sint", "rgba32float", "stencil8", "depth16unorm", "depth24plus", "depth24plus-stencil8", "depth32float", "depth32float-stencil8", "bc1-rgba-unorm", "bc1-rgba-unorm-srgb", "bc2-rgba-unorm", "bc2-rgba-unorm-srgb", "bc3-rgba-unorm", "bc3-rgba-unorm-srgb", "bc4-r-unorm", "bc4-r-snorm", "bc5-rg-unorm", "bc5-rg-snorm", "bc6h-rgb-ufloat", "bc6h-rgb-float", "bc7-rgba-unorm", "bc7-rgba-unorm-srgb", "etc2-rgb8unorm", "etc2-rgb8unorm-srgb", "etc2-rgb8a1unorm", "etc2-rgb8a1unorm-srgb", "etc2-rgba8unorm", "etc2-rgba8unorm-srgb", "eac-r11unorm", "eac-r11snorm", "eac-rg11unorm", "eac-rg11snorm", "astc-4x4-unorm", "astc-4x4-unorm-srgb", "astc-5x4-unorm", "astc-5x4-unorm-srgb", "astc-5x5-unorm", "astc-5x5-unorm-srgb", "astc-6x5-unorm", "astc-6x5-unorm-srgb", "astc-6x6-unorm", "astc-6x6-unorm-srgb", "astc-8x5-unorm", "astc-8x5-unorm-srgb", "astc-8x6-unorm", "astc-8x6-unorm-srgb", "astc-8x8-unorm", "astc-8x8-unorm-srgb", "astc-10x5-unorm", "astc-10x5-unorm-srgb", "astc-10x6-unorm", "astc-10x6-unorm-srgb", "astc-10x8-unorm", "astc-10x8-unorm-srgb", "astc-10x10-unorm", "astc-10x10-unorm-srgb", "astc-12x10-unorm", "astc-12x10-unorm-srgb", "astc-12x12-unorm", "astc-12x12-unorm-srgb"];
780
+ const ImageWithDHashFinalization = (typeof FinalizationRegistry === 'undefined')
781
+ ? { register: () => {}, unregister: () => {} }
782
+ : new FinalizationRegistry(ptr => wasm.__wbg_imagewithdhash_free(ptr, 1));
783
+ const PreviewFinalization = (typeof FinalizationRegistry === 'undefined')
784
+ ? { register: () => {}, unregister: () => {} }
785
+ : new FinalizationRegistry(ptr => wasm.__wbg_preview_free(ptr, 1));
786
+ const StitchReturnFinalization = (typeof FinalizationRegistry === 'undefined')
787
+ ? { register: () => {}, unregister: () => {} }
788
+ : new FinalizationRegistry(ptr => wasm.__wbg_stitchreturn_free(ptr, 1));
789
+ const StitchedImageFinalization = (typeof FinalizationRegistry === 'undefined')
790
+ ? { register: () => {}, unregister: () => {} }
791
+ : new FinalizationRegistry(ptr => wasm.__wbg_stitchedimage_free(ptr, 1));
792
+
793
+ function addToExternrefTable0(obj) {
794
+ const idx = wasm.__externref_table_alloc();
795
+ wasm.__wbindgen_externrefs.set(idx, obj);
796
+ return idx;
797
+ }
798
+
799
+ function _assertClass(instance, klass) {
800
+ if (!(instance instanceof klass)) {
801
+ throw new Error(`expected instance of ${klass.name}`);
97
802
  }
98
- return cachedDataViewMemory0;
99
803
  }
100
804
 
805
+ const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
806
+ ? { register: () => {}, unregister: () => {} }
807
+ : new FinalizationRegistry(state => wasm.__wbindgen_destroy_closure(state.a, state.b));
808
+
101
809
  function debugString(val) {
102
810
  // primitive types
103
811
  const type = typeof val;
@@ -162,303 +870,195 @@ function debugString(val) {
162
870
  // TODO we could test for more things here, like `Set`s and `Map`s.
163
871
  return className;
164
872
  }
165
-
166
- function getArrayU8FromWasm0(ptr, len) {
167
- ptr = ptr >>> 0;
168
- return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
169
- }
170
-
171
- function passArrayJsValueToWasm0(array, malloc) {
172
- const ptr = malloc(array.length * 4, 4) >>> 0;
173
- for (let i = 0; i < array.length; i++) {
174
- const add = addToExternrefTable0(array[i]);
175
- getDataViewMemory0().setUint32(ptr + 4 * i, add, true);
176
- }
177
- WASM_VECTOR_LEN = array.length;
178
- return ptr;
179
- }
180
-
181
- function isLikeNone(x) {
182
- return x === undefined || x === null;
183
- }
184
-
185
- function _assertClass(instance, klass) {
186
- if (!(instance instanceof klass)) {
187
- throw new Error(`expected instance of ${klass.name}`);
188
- }
189
- }
190
-
191
- function takeFromExternrefTable0(idx) {
192
- const value = wasm.__wbindgen_export_2.get(idx);
193
- wasm.__externref_table_dealloc(idx);
194
- return value;
195
- }
196
- /**
197
- * @param {Uint8Array[]} images
198
- * @param {string} direction
199
- * @param {string} order
200
- * @param {number | null | undefined} window_size
201
- * @param {string | null | undefined} match_mode
202
- * @param {number | null | undefined} crop_padding
203
- * @param {Preview | null | undefined} preview
204
- * @param {EncodeFormat} format
205
- * @returns {StitchReturn}
206
- */
207
- export function stitch(images, direction, order, window_size, match_mode, crop_padding, preview, format) {
208
- const ptr0 = passArrayJsValueToWasm0(images, wasm.__wbindgen_malloc);
209
- const len0 = WASM_VECTOR_LEN;
210
- const ptr1 = passStringToWasm0(direction, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
211
- const len1 = WASM_VECTOR_LEN;
212
- const ptr2 = passStringToWasm0(order, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
213
- const len2 = WASM_VECTOR_LEN;
214
- var ptr3 = isLikeNone(match_mode) ? 0 : passStringToWasm0(match_mode, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
215
- var len3 = WASM_VECTOR_LEN;
216
- let ptr4 = 0;
217
- if (!isLikeNone(preview)) {
218
- _assertClass(preview, Preview);
219
- ptr4 = preview.__destroy_into_raw();
220
- }
221
- const ret = wasm.stitch(ptr0, len0, ptr1, len1, ptr2, len2, isLikeNone(window_size) ? 0x100000001 : (window_size) >>> 0, ptr3, len3, isLikeNone(crop_padding) ? 0x100000001 : (crop_padding) >>> 0, ptr4, format);
222
- if (ret[2]) {
223
- throw takeFromExternrefTable0(ret[1]);
224
- }
225
- return StitchReturn.__wrap(ret[0]);
226
- }
227
-
228
- function passArray8ToWasm0(arg, malloc) {
229
- const ptr = malloc(arg.length * 1, 1) >>> 0;
230
- getUint8ArrayMemory0().set(arg, ptr / 1);
231
- WASM_VECTOR_LEN = arg.length;
232
- return ptr;
233
- }
234
- /**
235
- * @param {Uint8Array} bytes
236
- * @param {number} width
237
- * @param {number} height
238
- * @param {EncodeFormat} format
239
- * @returns {ImageWithDHash}
240
- */
241
- export function rgba_bytes_to_image(bytes, width, height, format) {
242
- const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
243
- const len0 = WASM_VECTOR_LEN;
244
- const ret = wasm.rgba_bytes_to_image(ptr0, len0, width, height, format);
245
- return ImageWithDHash.__wrap(ret);
246
- }
247
-
248
- export function start() {
249
- wasm.start();
250
- }
251
-
252
- /**
253
- * @param {EncodeFormat} format
254
- * @returns {string}
255
- */
256
- export function encode_format_content_type(format) {
257
- let deferred1_0;
258
- let deferred1_1;
259
- try {
260
- const ret = wasm.encode_format_content_type(format);
261
- deferred1_0 = ret[0];
262
- deferred1_1 = ret[1];
263
- return getStringFromWasm0(ret[0], ret[1]);
264
- } finally {
265
- wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
266
- }
267
- }
268
-
269
- /**
270
- * @param {EncodeFormat} format
271
- * @returns {string}
272
- */
273
- export function encode_format_file_extension(format) {
274
- let deferred1_0;
275
- let deferred1_1;
276
- try {
277
- const ret = wasm.encode_format_file_extension(format);
278
- deferred1_0 = ret[0];
279
- deferred1_1 = ret[1];
280
- return getStringFromWasm0(ret[0], ret[1]);
281
- } finally {
282
- wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
283
- }
284
- }
285
-
286
- /**
287
- * @enum {0 | 1 | 2 | 3}
288
- */
289
- export const EncodeFormat = Object.freeze({
290
- Png: 0, "0": "Png",
291
- Jpeg: 1, "1": "Jpeg",
292
- Gif: 2, "2": "Gif",
293
- WebP: 3, "3": "WebP",
294
- });
295
- /**
296
- * @enum {0 | 1 | 2}
297
- */
298
- export const PreviewType = Object.freeze({
299
- Resize: 0, "0": "Resize",
300
- MaxWidth: 1, "1": "MaxWidth",
301
- MaxHeight: 2, "2": "MaxHeight",
302
- });
303
-
304
- const ImageWithDHashFinalization = (typeof FinalizationRegistry === 'undefined')
305
- ? { register: () => {}, unregister: () => {} }
306
- : new FinalizationRegistry(ptr => wasm.__wbg_imagewithdhash_free(ptr >>> 0, 1));
307
-
308
- export class ImageWithDHash {
309
-
310
- static __wrap(ptr) {
311
- ptr = ptr >>> 0;
312
- const obj = Object.create(ImageWithDHash.prototype);
313
- obj.__wbg_ptr = ptr;
314
- ImageWithDHashFinalization.register(obj, obj.__wbg_ptr, obj);
315
- return obj;
316
- }
317
-
318
- __destroy_into_raw() {
319
- const ptr = this.__wbg_ptr;
320
- this.__wbg_ptr = 0;
321
- ImageWithDHashFinalization.unregister(this);
322
- return ptr;
323
- }
324
-
325
- free() {
326
- const ptr = this.__destroy_into_raw();
327
- wasm.__wbg_imagewithdhash_free(ptr, 0);
328
- }
329
- /**
330
- * @returns {[Uint8Array, BigInt]}
331
- */
332
- images() {
333
- const ptr = this.__destroy_into_raw();
334
- const ret = wasm.imagewithdhash_images(ptr);
335
- return ret;
336
- }
337
- }
338
-
339
- const PreviewFinalization = (typeof FinalizationRegistry === 'undefined')
340
- ? { register: () => {}, unregister: () => {} }
341
- : new FinalizationRegistry(ptr => wasm.__wbg_preview_free(ptr >>> 0, 1));
342
-
343
- export class Preview {
344
-
345
- __destroy_into_raw() {
346
- const ptr = this.__wbg_ptr;
347
- this.__wbg_ptr = 0;
348
- PreviewFinalization.unregister(this);
349
- return ptr;
350
- }
351
-
352
- free() {
353
- const ptr = this.__destroy_into_raw();
354
- wasm.__wbg_preview_free(ptr, 0);
355
- }
356
- /**
357
- * @param {PreviewType} type
358
- * @param {number} value
359
- */
360
- constructor(type, value) {
361
- const ret = wasm.preview_new(type, value);
362
- this.__wbg_ptr = ret >>> 0;
363
- PreviewFinalization.register(this, this.__wbg_ptr, this);
364
- return this;
873
+
874
+ function getArrayJsValueViewFromWasm0(ptr, len) {
875
+ ptr = ptr >>> 0;
876
+ const mem = getDataViewMemory0();
877
+ const result = [];
878
+ for (let i = ptr; i < ptr + 4 * len; i += 4) {
879
+ result.push(wasm.__wbindgen_externrefs.get(mem.getUint32(i, true)));
365
880
  }
881
+ return result;
366
882
  }
367
883
 
368
- const StitchReturnFinalization = (typeof FinalizationRegistry === 'undefined')
369
- ? { register: () => {}, unregister: () => {} }
370
- : new FinalizationRegistry(ptr => wasm.__wbg_stitchreturn_free(ptr >>> 0, 1));
884
+ function getArrayU32FromWasm0(ptr, len) {
885
+ ptr = ptr >>> 0;
886
+ return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
887
+ }
371
888
 
372
- export class StitchReturn {
889
+ function getArrayU8FromWasm0(ptr, len) {
890
+ ptr = ptr >>> 0;
891
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
892
+ }
373
893
 
374
- static __wrap(ptr) {
375
- ptr = ptr >>> 0;
376
- const obj = Object.create(StitchReturn.prototype);
377
- obj.__wbg_ptr = ptr;
378
- StitchReturnFinalization.register(obj, obj.__wbg_ptr, obj);
379
- return obj;
894
+ let cachedDataViewMemory0 = null;
895
+ function getDataViewMemory0() {
896
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
897
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
380
898
  }
899
+ return cachedDataViewMemory0;
900
+ }
381
901
 
382
- __destroy_into_raw() {
383
- const ptr = this.__wbg_ptr;
384
- this.__wbg_ptr = 0;
385
- StitchReturnFinalization.unregister(this);
386
- return ptr;
902
+ function getStringFromWasm0(ptr, len) {
903
+ return decodeText(ptr >>> 0, len);
904
+ }
905
+
906
+ let cachedUint32ArrayMemory0 = null;
907
+ function getUint32ArrayMemory0() {
908
+ if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
909
+ cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
387
910
  }
911
+ return cachedUint32ArrayMemory0;
912
+ }
388
913
 
389
- free() {
390
- const ptr = this.__destroy_into_raw();
391
- wasm.__wbg_stitchreturn_free(ptr, 0);
914
+ let cachedUint8ArrayMemory0 = null;
915
+ function getUint8ArrayMemory0() {
916
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
917
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
392
918
  }
393
- /**
394
- * @returns {[StitchedImage, StitchedImage?]}
395
- */
396
- images() {
397
- const ptr = this.__destroy_into_raw();
398
- const ret = wasm.stitchreturn_images(ptr);
399
- return ret;
919
+ return cachedUint8ArrayMemory0;
920
+ }
921
+
922
+ function handleError(f, args) {
923
+ try {
924
+ return f.apply(this, args);
925
+ } catch (e) {
926
+ const idx = addToExternrefTable0(e);
927
+ wasm.__wbindgen_exn_store(idx);
400
928
  }
401
929
  }
402
930
 
403
- const StitchedImageFinalization = (typeof FinalizationRegistry === 'undefined')
404
- ? { register: () => {}, unregister: () => {} }
405
- : new FinalizationRegistry(ptr => wasm.__wbg_stitchedimage_free(ptr >>> 0, 1));
931
+ function isLikeNone(x) {
932
+ return x === undefined || x === null;
933
+ }
406
934
 
407
- export class StitchedImage {
935
+ function makeMutClosure(arg0, arg1, f) {
936
+ const state = { a: arg0, b: arg1, cnt: 1 };
937
+ const real = (...args) => {
408
938
 
409
- static __wrap(ptr) {
410
- ptr = ptr >>> 0;
411
- const obj = Object.create(StitchedImage.prototype);
412
- obj.__wbg_ptr = ptr;
413
- StitchedImageFinalization.register(obj, obj.__wbg_ptr, obj);
414
- return obj;
939
+ // First up with a closure we increment the internal reference
940
+ // count. This ensures that the Rust closure environment won't
941
+ // be deallocated while we're invoking it.
942
+ state.cnt++;
943
+ const a = state.a;
944
+ state.a = 0;
945
+ try {
946
+ return f(a, state.b, ...args);
947
+ } finally {
948
+ state.a = a;
949
+ real._wbg_cb_unref();
950
+ }
951
+ };
952
+ real._wbg_cb_unref = () => {
953
+ if (--state.cnt === 0) {
954
+ wasm.__wbindgen_destroy_closure(state.a, state.b);
955
+ state.a = 0;
956
+ CLOSURE_DTORS.unregister(state);
957
+ }
958
+ };
959
+ CLOSURE_DTORS.register(real, state, state);
960
+ return real;
961
+ }
962
+
963
+ function passArray8ToWasm0(arg, malloc) {
964
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
965
+ getUint8ArrayMemory0().set(arg, ptr / 1);
966
+ WASM_VECTOR_LEN = arg.length;
967
+ return ptr;
968
+ }
969
+
970
+ function passArrayJsValueToWasm0(array, malloc) {
971
+ const ptr = malloc(array.length * 4, 4) >>> 0;
972
+ for (let i = 0; i < array.length; i++) {
973
+ const add = addToExternrefTable0(array[i]);
974
+ getDataViewMemory0().setUint32(ptr + 4 * i, add, true);
415
975
  }
976
+ WASM_VECTOR_LEN = array.length;
977
+ return ptr;
978
+ }
416
979
 
417
- __destroy_into_raw() {
418
- const ptr = this.__wbg_ptr;
419
- this.__wbg_ptr = 0;
420
- StitchedImageFinalization.unregister(this);
980
+ function passStringToWasm0(arg, malloc, realloc) {
981
+ if (realloc === undefined) {
982
+ const buf = cachedTextEncoder.encode(arg);
983
+ const ptr = malloc(buf.length, 1) >>> 0;
984
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
985
+ WASM_VECTOR_LEN = buf.length;
421
986
  return ptr;
422
987
  }
423
988
 
424
- free() {
425
- const ptr = this.__destroy_into_raw();
426
- wasm.__wbg_stitchedimage_free(ptr, 0);
427
- }
428
- /**
429
- * @returns {number}
430
- */
431
- get width() {
432
- const ret = wasm.__wbg_get_stitchedimage_width(this.__wbg_ptr);
433
- return ret >>> 0;
434
- }
435
- /**
436
- * @param {number} arg0
437
- */
438
- set width(arg0) {
439
- wasm.__wbg_set_stitchedimage_width(this.__wbg_ptr, arg0);
440
- }
441
- /**
442
- * @returns {number}
443
- */
444
- get height() {
445
- const ret = wasm.__wbg_get_stitchedimage_height(this.__wbg_ptr);
446
- return ret >>> 0;
989
+ let len = arg.length;
990
+ let ptr = malloc(len, 1) >>> 0;
991
+
992
+ const mem = getUint8ArrayMemory0();
993
+
994
+ let offset = 0;
995
+
996
+ for (; offset < len; offset++) {
997
+ const code = arg.charCodeAt(offset);
998
+ if (code > 0x7F) break;
999
+ mem[ptr + offset] = code;
447
1000
  }
448
- /**
449
- * @param {number} arg0
450
- */
451
- set height(arg0) {
452
- wasm.__wbg_set_stitchedimage_height(this.__wbg_ptr, arg0);
1001
+ if (offset !== len) {
1002
+ if (offset !== 0) {
1003
+ arg = arg.slice(offset);
1004
+ }
1005
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
1006
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
1007
+ const ret = cachedTextEncoder.encodeInto(arg, view);
1008
+
1009
+ offset += ret.written;
1010
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
453
1011
  }
454
- /**
455
- * @returns {{ image: Uint8Array, stitchPositions: Array<{ x: number, y: number }>, width: number, height: number }}
456
- */
457
- toJson() {
458
- const ptr = this.__destroy_into_raw();
459
- const ret = wasm.stitchedimage_toJson(ptr);
460
- return ret;
1012
+
1013
+ WASM_VECTOR_LEN = offset;
1014
+ return ptr;
1015
+ }
1016
+
1017
+ function takeFromExternrefTable0(idx) {
1018
+ const value = wasm.__wbindgen_externrefs.get(idx);
1019
+ wasm.__externref_table_dealloc(idx);
1020
+ return value;
1021
+ }
1022
+
1023
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
1024
+ cachedTextDecoder.decode();
1025
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
1026
+ let numBytesDecoded = 0;
1027
+ function decodeText(ptr, len) {
1028
+ numBytesDecoded += len;
1029
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
1030
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
1031
+ cachedTextDecoder.decode();
1032
+ numBytesDecoded = len;
461
1033
  }
1034
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
1035
+ }
1036
+
1037
+ const cachedTextEncoder = new TextEncoder();
1038
+
1039
+ if (!('encodeInto' in cachedTextEncoder)) {
1040
+ cachedTextEncoder.encodeInto = function (arg, view) {
1041
+ const buf = cachedTextEncoder.encode(arg);
1042
+ view.set(buf);
1043
+ return {
1044
+ read: arg.length,
1045
+ written: buf.length
1046
+ };
1047
+ };
1048
+ }
1049
+
1050
+ let WASM_VECTOR_LEN = 0;
1051
+
1052
+ let wasmModule, wasmInstance, wasm;
1053
+ function __wbg_finalize_init(instance, module) {
1054
+ wasmInstance = instance;
1055
+ wasm = instance.exports;
1056
+ wasmModule = module;
1057
+ cachedDataViewMemory0 = null;
1058
+ cachedUint32ArrayMemory0 = null;
1059
+ cachedUint8ArrayMemory0 = null;
1060
+ wasm.__wbindgen_start();
1061
+ return wasm;
462
1062
  }
463
1063
 
464
1064
  async function __wbg_load(module, imports) {
@@ -466,210 +1066,41 @@ async function __wbg_load(module, imports) {
466
1066
  if (typeof WebAssembly.instantiateStreaming === 'function') {
467
1067
  try {
468
1068
  return await WebAssembly.instantiateStreaming(module, imports);
469
-
470
1069
  } catch (e) {
471
- if (module.headers.get('Content-Type') != 'application/wasm') {
1070
+ const validResponse = module.ok && expectedResponseType(module.type);
1071
+
1072
+ if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
472
1073
  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);
473
1074
 
474
- } else {
475
- throw e;
476
- }
1075
+ } else { throw e; }
477
1076
  }
478
1077
  }
479
1078
 
480
1079
  const bytes = await module.arrayBuffer();
481
1080
  return await WebAssembly.instantiate(bytes, imports);
482
-
483
1081
  } else {
484
1082
  const instance = await WebAssembly.instantiate(module, imports);
485
1083
 
486
1084
  if (instance instanceof WebAssembly.Instance) {
487
1085
  return { instance, module };
488
-
489
1086
  } else {
490
1087
  return instance;
491
1088
  }
492
1089
  }
493
- }
494
1090
 
495
- function __wbg_get_imports() {
496
- const imports = {};
497
- imports.wbg = {};
498
- imports.wbg.__wbg_BigInt_ddea6d2f55558acb = function() { return handleError(function (arg0) {
499
- const ret = BigInt(arg0);
500
- return ret;
501
- }, arguments) };
502
- imports.wbg.__wbg_buffer_609cc3eee51ed158 = function(arg0) {
503
- const ret = arg0.buffer;
504
- return ret;
505
- };
506
- imports.wbg.__wbg_error_7534b8e9a36f1ab4 = function(arg0, arg1) {
507
- let deferred0_0;
508
- let deferred0_1;
509
- try {
510
- deferred0_0 = arg0;
511
- deferred0_1 = arg1;
512
- console.error(getStringFromWasm0(arg0, arg1));
513
- } finally {
514
- wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
515
- }
516
- };
517
- imports.wbg.__wbg_length_a446193dc22c12f8 = function(arg0) {
518
- const ret = arg0.length;
519
- return ret;
520
- };
521
- imports.wbg.__wbg_log_0cc1b7768397bcfe = function(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) {
522
- let deferred0_0;
523
- let deferred0_1;
524
- try {
525
- deferred0_0 = arg0;
526
- deferred0_1 = arg1;
527
- console.log(getStringFromWasm0(arg0, arg1), getStringFromWasm0(arg2, arg3), getStringFromWasm0(arg4, arg5), getStringFromWasm0(arg6, arg7));
528
- } finally {
529
- wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
530
- }
531
- };
532
- imports.wbg.__wbg_log_cb9e190acc5753fb = function(arg0, arg1) {
533
- let deferred0_0;
534
- let deferred0_1;
535
- try {
536
- deferred0_0 = arg0;
537
- deferred0_1 = arg1;
538
- console.log(getStringFromWasm0(arg0, arg1));
539
- } finally {
540
- wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
1091
+ function expectedResponseType(type) {
1092
+ switch (type) {
1093
+ case 'basic': case 'cors': case 'default': return true;
541
1094
  }
542
- };
543
- imports.wbg.__wbg_mark_7438147ce31e9d4b = function(arg0, arg1) {
544
- performance.mark(getStringFromWasm0(arg0, arg1));
545
- };
546
- imports.wbg.__wbg_measure_fb7825c11612c823 = function() { return handleError(function (arg0, arg1, arg2, arg3) {
547
- let deferred0_0;
548
- let deferred0_1;
549
- let deferred1_0;
550
- let deferred1_1;
551
- try {
552
- deferred0_0 = arg0;
553
- deferred0_1 = arg1;
554
- deferred1_0 = arg2;
555
- deferred1_1 = arg3;
556
- performance.measure(getStringFromWasm0(arg0, arg1), getStringFromWasm0(arg2, arg3));
557
- } finally {
558
- wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
559
- wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
560
- }
561
- }, arguments) };
562
- imports.wbg.__wbg_new_405e22f390576ce2 = function() {
563
- const ret = new Object();
564
- return ret;
565
- };
566
- imports.wbg.__wbg_new_78feb108b6472713 = function() {
567
- const ret = new Array();
568
- return ret;
569
- };
570
- imports.wbg.__wbg_new_8a6f238a6ece86ea = function() {
571
- const ret = new Error();
572
- return ret;
573
- };
574
- imports.wbg.__wbg_new_a12002a7f91c75be = function(arg0) {
575
- const ret = new Uint8Array(arg0);
576
- return ret;
577
- };
578
- imports.wbg.__wbg_newwithlength_c4c419ef0bc8a1f8 = function(arg0) {
579
- const ret = new Array(arg0 >>> 0);
580
- return ret;
581
- };
582
- imports.wbg.__wbg_push_737cfc8c1432c2c6 = function(arg0, arg1) {
583
- const ret = arg0.push(arg1);
584
- return ret;
585
- };
586
- imports.wbg.__wbg_set_37837023f3d740e8 = function(arg0, arg1, arg2) {
587
- arg0[arg1 >>> 0] = arg2;
588
- };
589
- imports.wbg.__wbg_set_65595bdd868b3009 = function(arg0, arg1, arg2) {
590
- arg0.set(arg1, arg2 >>> 0);
591
- };
592
- imports.wbg.__wbg_set_bb8cecf6a62b9f46 = function() { return handleError(function (arg0, arg1, arg2) {
593
- const ret = Reflect.set(arg0, arg1, arg2);
594
- return ret;
595
- }, arguments) };
596
- imports.wbg.__wbg_stack_0ed75d68575b0f3c = function(arg0, arg1) {
597
- const ret = arg1.stack;
598
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
599
- const len1 = WASM_VECTOR_LEN;
600
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
601
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
602
- };
603
- imports.wbg.__wbg_stitchedimage_new = function(arg0) {
604
- const ret = StitchedImage.__wrap(arg0);
605
- return ret;
606
- };
607
- imports.wbg.__wbindgen_bigint_from_u64 = function(arg0) {
608
- const ret = BigInt.asUintN(64, arg0);
609
- return ret;
610
- };
611
- imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
612
- const ret = debugString(arg1);
613
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
614
- const len1 = WASM_VECTOR_LEN;
615
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
616
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
617
- };
618
- imports.wbg.__wbindgen_init_externref_table = function() {
619
- const table = wasm.__wbindgen_export_2;
620
- const offset = table.grow(4);
621
- table.set(0, undefined);
622
- table.set(offset + 0, undefined);
623
- table.set(offset + 1, null);
624
- table.set(offset + 2, true);
625
- table.set(offset + 3, false);
626
- ;
627
- };
628
- imports.wbg.__wbindgen_memory = function() {
629
- const ret = wasm.memory;
630
- return ret;
631
- };
632
- imports.wbg.__wbindgen_number_new = function(arg0) {
633
- const ret = arg0;
634
- return ret;
635
- };
636
- imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
637
- const ret = getStringFromWasm0(arg0, arg1);
638
- return ret;
639
- };
640
- imports.wbg.__wbindgen_throw = function(arg0, arg1) {
641
- throw new Error(getStringFromWasm0(arg0, arg1));
642
- };
643
- imports.wbg.__wbindgen_uint8_array_new = function(arg0, arg1) {
644
- var v0 = getArrayU8FromWasm0(arg0, arg1).slice();
645
- wasm.__wbindgen_free(arg0, arg1 * 1, 1);
646
- const ret = v0;
647
- return ret;
648
- };
649
-
650
- return imports;
651
- }
652
-
653
- function __wbg_init_memory(imports, memory) {
654
-
655
- }
656
-
657
- function __wbg_finalize_init(instance, module) {
658
- wasm = instance.exports;
659
- __wbg_init.__wbindgen_wasm_module = module;
660
- cachedDataViewMemory0 = null;
661
- cachedUint8ArrayMemory0 = null;
662
-
663
-
664
- wasm.__wbindgen_start();
665
- return wasm;
1095
+ return false;
1096
+ }
666
1097
  }
667
1098
 
668
1099
  function initSync(module) {
669
1100
  if (wasm !== undefined) return wasm;
670
1101
 
671
1102
 
672
- if (typeof module !== 'undefined') {
1103
+ if (module !== undefined) {
673
1104
  if (Object.getPrototypeOf(module) === Object.prototype) {
674
1105
  ({module} = module)
675
1106
  } else {
@@ -678,15 +1109,10 @@ function initSync(module) {
678
1109
  }
679
1110
 
680
1111
  const imports = __wbg_get_imports();
681
-
682
- __wbg_init_memory(imports);
683
-
684
1112
  if (!(module instanceof WebAssembly.Module)) {
685
1113
  module = new WebAssembly.Module(module);
686
1114
  }
687
-
688
1115
  const instance = new WebAssembly.Instance(module, imports);
689
-
690
1116
  return __wbg_finalize_init(instance, module);
691
1117
  }
692
1118
 
@@ -694,7 +1120,7 @@ async function __wbg_init(module_or_path) {
694
1120
  if (wasm !== undefined) return wasm;
695
1121
 
696
1122
 
697
- if (typeof module_or_path !== 'undefined') {
1123
+ if (module_or_path !== undefined) {
698
1124
  if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
699
1125
  ({module_or_path} = module_or_path)
700
1126
  } else {
@@ -702,7 +1128,7 @@ async function __wbg_init(module_or_path) {
702
1128
  }
703
1129
  }
704
1130
 
705
- if (typeof module_or_path === 'undefined') {
1131
+ if (module_or_path === undefined) {
706
1132
  module_or_path = new URL('wonfy_tools_bg.wasm', import.meta.url);
707
1133
  }
708
1134
  const imports = __wbg_get_imports();
@@ -711,12 +1137,9 @@ async function __wbg_init(module_or_path) {
711
1137
  module_or_path = fetch(module_or_path);
712
1138
  }
713
1139
 
714
- __wbg_init_memory(imports);
715
-
716
1140
  const { instance, module } = await __wbg_load(await module_or_path, imports);
717
1141
 
718
1142
  return __wbg_finalize_init(instance, module);
719
1143
  }
720
1144
 
721
- export { initSync };
722
- export default __wbg_init;
1145
+ export { initSync, __wbg_init as default };