rxing-wasm 0.2.6 → 0.2.8

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "rxing-wasm",
3
3
  "description": "wasm bindings for rxing to provide commong barcode operations (decode/encode)",
4
- "version": "0.2.6",
4
+ "version": "0.2.8",
5
5
  "license": "Apache 2.0",
6
6
  "repository": {
7
7
  "type": "git",
package/rxing_wasm.d.ts CHANGED
@@ -5,27 +5,27 @@
5
5
  * @param {string} data
6
6
  * @param {number} width
7
7
  * @param {number} height
8
- * @param {number} bc_type
8
+ * @param {BarcodeFormat} bc_type
9
9
  * @returns {string}
10
10
  */
11
- export function encode_barcode(data: string, width: number, height: number, bc_type: number): string;
11
+ export function encode_barcode(data: string, width: number, height: number, bc_type: BarcodeFormat): string;
12
12
  /**
13
13
  * Encode a barcode with the given data, dimensions, and type, use the given encoding hints
14
14
  * @param {string} data
15
15
  * @param {number} width
16
16
  * @param {number} height
17
- * @param {number} bc_type
17
+ * @param {BarcodeFormat} bc_type
18
18
  * @param {EncodeHintDictionary} hints
19
19
  * @returns {string}
20
20
  */
21
- export function encode_barcode_with_hints(data: string, width: number, height: number, bc_type: number, hints: EncodeHintDictionary): string;
21
+ export function encode_barcode_with_hints(data: string, width: number, height: number, bc_type: BarcodeFormat, hints: EncodeHintDictionary): string;
22
22
  /**
23
23
  * Decode a barcode from an array of 8bit luma data
24
24
  * @param {Uint8Array} data
25
25
  * @param {number} width
26
26
  * @param {number} height
27
- * @param {boolean | undefined} try_harder
28
- * @param {boolean | undefined} filter_image
27
+ * @param {boolean | undefined} [try_harder]
28
+ * @param {boolean | undefined} [filter_image]
29
29
  * @returns {BarcodeResult}
30
30
  */
31
31
  export function decode_barcode(data: Uint8Array, width: number, height: number, try_harder?: boolean, filter_image?: boolean): BarcodeResult;
@@ -47,7 +47,7 @@ export function convert_js_image_to_luma(data: Uint8Array): Uint8Array;
47
47
  * @param {Uint32Array} data
48
48
  * @param {number} width
49
49
  * @param {number} height
50
- * @param {boolean | undefined} try_harder
50
+ * @param {boolean | undefined} [try_harder]
51
51
  * @returns {BarcodeResult}
52
52
  */
53
53
  export function decode_barcode_rgb(data: Uint32Array, width: number, height: number, try_harder?: boolean): BarcodeResult;
@@ -56,7 +56,7 @@ export function decode_barcode_rgb(data: Uint32Array, width: number, height: num
56
56
  * @param {number} width
57
57
  * @param {number} height
58
58
  * @param {DecodeHintDictionary} hints
59
- * @param {boolean | undefined} filter_image
59
+ * @param {boolean | undefined} [filter_image]
60
60
  * @returns {BarcodeResult}
61
61
  */
62
62
  export function decode_barcode_with_hints(data: Uint8Array, width: number, height: number, hints: DecodeHintDictionary, filter_image?: boolean): BarcodeResult;
@@ -241,83 +241,6 @@ export enum EncodeHintTypes {
241
241
  TelepenAsNumeric = 19,
242
242
  }
243
243
  /**
244
- * Available barcode types
245
- */
246
- export enum BarcodeFormat {
247
- /**
248
- * Aztec 2D barcode format.
249
- */
250
- AZTEC = 0,
251
- /**
252
- * CODABAR 1D format.
253
- */
254
- CODABAR = 1,
255
- /**
256
- * Code 39 1D format.
257
- */
258
- Code39 = 2,
259
- /**
260
- * Code 93 1D format.
261
- */
262
- Code93 = 3,
263
- /**
264
- * Code 128 1D format.
265
- */
266
- Code128 = 4,
267
- /**
268
- * Data Matrix 2D barcode format.
269
- */
270
- DataMatrix = 5,
271
- /**
272
- * EAN-8 1D format.
273
- */
274
- Ean8 = 6,
275
- /**
276
- * EAN-13 1D format.
277
- */
278
- Ean13 = 7,
279
- /**
280
- * ITF (Interleaved Two of Five) 1D format.
281
- */
282
- ITF = 8,
283
- /**
284
- * MaxiCode 2D barcode format.
285
- */
286
- MAXICODE = 9,
287
- /**
288
- * PDF417 format.
289
- */
290
- Pdf417 = 10,
291
- /**
292
- * QR Code 2D barcode format.
293
- */
294
- QrCode = 11,
295
- /**
296
- * RSS 14
297
- */
298
- Rss14 = 12,
299
- /**
300
- * RSS EXPANDED
301
- */
302
- RssExpanded = 13,
303
- /**
304
- * UPC-A 1D format.
305
- */
306
- UpcA = 14,
307
- /**
308
- * UPC-E 1D format.
309
- */
310
- UpcE = 15,
311
- /**
312
- * UPC/EAN extension format. Not a stand-alone format.
313
- */
314
- UpcEanExtension = 16,
315
- MicroQR = 17,
316
- Telepen = 18,
317
- RectangularMicroQR = 19,
318
- UnsuportedFormat = 20,
319
- }
320
- /**
321
244
  */
322
245
  export enum DecodeHintTypes {
323
246
  /**
@@ -414,6 +337,83 @@ export enum DecodeHintTypes {
414
337
  TelepenAsNumeric = 12,
415
338
  }
416
339
  /**
340
+ * Available barcode types
341
+ */
342
+ export enum BarcodeFormat {
343
+ /**
344
+ * Aztec 2D barcode format.
345
+ */
346
+ AZTEC = 0,
347
+ /**
348
+ * CODABAR 1D format.
349
+ */
350
+ CODABAR = 1,
351
+ /**
352
+ * Code 39 1D format.
353
+ */
354
+ Code39 = 2,
355
+ /**
356
+ * Code 93 1D format.
357
+ */
358
+ Code93 = 3,
359
+ /**
360
+ * Code 128 1D format.
361
+ */
362
+ Code128 = 4,
363
+ /**
364
+ * Data Matrix 2D barcode format.
365
+ */
366
+ DataMatrix = 5,
367
+ /**
368
+ * EAN-8 1D format.
369
+ */
370
+ Ean8 = 6,
371
+ /**
372
+ * EAN-13 1D format.
373
+ */
374
+ Ean13 = 7,
375
+ /**
376
+ * ITF (Interleaved Two of Five) 1D format.
377
+ */
378
+ ITF = 8,
379
+ /**
380
+ * MaxiCode 2D barcode format.
381
+ */
382
+ MAXICODE = 9,
383
+ /**
384
+ * PDF417 format.
385
+ */
386
+ Pdf417 = 10,
387
+ /**
388
+ * QR Code 2D barcode format.
389
+ */
390
+ QrCode = 11,
391
+ /**
392
+ * RSS 14
393
+ */
394
+ Rss14 = 12,
395
+ /**
396
+ * RSS EXPANDED
397
+ */
398
+ RssExpanded = 13,
399
+ /**
400
+ * UPC-A 1D format.
401
+ */
402
+ UpcA = 14,
403
+ /**
404
+ * UPC-E 1D format.
405
+ */
406
+ UpcE = 15,
407
+ /**
408
+ * UPC/EAN extension format. Not a stand-alone format.
409
+ */
410
+ UpcEanExtension = 16,
411
+ MicroQR = 17,
412
+ Telepen = 18,
413
+ RectangularMicroQR = 19,
414
+ UnsuportedFormat = 20,
415
+ }
416
+ /**
417
417
  */
418
418
  export class BarcodeResult {
419
419
  free(): void;
@@ -422,9 +422,9 @@ export class BarcodeResult {
422
422
  */
423
423
  timestamp(): number;
424
424
  /**
425
- * @returns {number}
425
+ * @returns {BarcodeFormat}
426
426
  */
427
- format(): number;
427
+ format(): BarcodeFormat;
428
428
  /**
429
429
  * Each pair of f32 values is an (x,y) point
430
430
  * @returns {Float32Array}
@@ -455,21 +455,21 @@ export class DecodeHintDictionary {
455
455
  */
456
456
  constructor();
457
457
  /**
458
- * @param {number} hint
458
+ * @param {DecodeHintTypes} hint
459
459
  * @returns {string}
460
460
  */
461
- get_hint(hint: number): string;
461
+ get_hint(hint: DecodeHintTypes): string;
462
462
  /**
463
- * @param {number} hint
463
+ * @param {DecodeHintTypes} hint
464
464
  * @param {string} value
465
465
  * @returns {boolean}
466
466
  */
467
- set_hint(hint: number, value: string): boolean;
467
+ set_hint(hint: DecodeHintTypes, value: string): boolean;
468
468
  /**
469
- * @param {number} hint
469
+ * @param {DecodeHintTypes} hint
470
470
  * @returns {boolean}
471
471
  */
472
- remove_hint(hint: number): boolean;
472
+ remove_hint(hint: DecodeHintTypes): boolean;
473
473
  }
474
474
  /**
475
475
  */
@@ -479,21 +479,21 @@ export class EncodeHintDictionary {
479
479
  */
480
480
  constructor();
481
481
  /**
482
- * @param {number} hint
482
+ * @param {EncodeHintTypes} hint
483
483
  * @returns {string}
484
484
  */
485
- get_hint(hint: number): string;
485
+ get_hint(hint: EncodeHintTypes): string;
486
486
  /**
487
- * @param {number} hint
487
+ * @param {EncodeHintTypes} hint
488
488
  * @param {string} value
489
489
  * @returns {boolean}
490
490
  */
491
- set_hint(hint: number, value: string): boolean;
491
+ set_hint(hint: EncodeHintTypes, value: string): boolean;
492
492
  /**
493
- * @param {number} hint
493
+ * @param {EncodeHintTypes} hint
494
494
  * @returns {boolean}
495
495
  */
496
- remove_hint(hint: number): boolean;
496
+ remove_hint(hint: EncodeHintTypes): boolean;
497
497
  }
498
498
  /**
499
499
  */
package/rxing_wasm_bg.js CHANGED
@@ -4,6 +4,26 @@ export function __wbg_set_wasm(val) {
4
4
  }
5
5
 
6
6
 
7
+ const heap = new Array(128).fill(undefined);
8
+
9
+ heap.push(undefined, null, true, false);
10
+
11
+ function getObject(idx) { return heap[idx]; }
12
+
13
+ let heap_next = heap.length;
14
+
15
+ function dropObject(idx) {
16
+ if (idx < 132) return;
17
+ heap[idx] = heap_next;
18
+ heap_next = idx;
19
+ }
20
+
21
+ function takeObject(idx) {
22
+ const ret = getObject(idx);
23
+ dropObject(idx);
24
+ return ret;
25
+ }
26
+
7
27
  const lTextDecoder = typeof TextDecoder === 'undefined' ? (0, module.require)('util').TextDecoder : TextDecoder;
8
28
 
9
29
  let cachedTextDecoder = new lTextDecoder('utf-8', { ignoreBOM: true, fatal: true });
@@ -20,15 +40,10 @@ function getUint8Memory0() {
20
40
  }
21
41
 
22
42
  function getStringFromWasm0(ptr, len) {
43
+ ptr = ptr >>> 0;
23
44
  return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
24
45
  }
25
46
 
26
- const heap = new Array(128).fill(undefined);
27
-
28
- heap.push(undefined, null, true, false);
29
-
30
- let heap_next = heap.length;
31
-
32
47
  function addHeapObject(obj) {
33
48
  if (heap_next === heap.length) heap.push(heap.length + 1);
34
49
  const idx = heap_next;
@@ -38,20 +53,6 @@ function addHeapObject(obj) {
38
53
  return idx;
39
54
  }
40
55
 
41
- function getObject(idx) { return heap[idx]; }
42
-
43
- function dropObject(idx) {
44
- if (idx < 132) return;
45
- heap[idx] = heap_next;
46
- heap_next = idx;
47
- }
48
-
49
- function takeObject(idx) {
50
- const ret = getObject(idx);
51
- dropObject(idx);
52
- return ret;
53
- }
54
-
55
56
  let cachedInt32Memory0 = null;
56
57
 
57
58
  function getInt32Memory0() {
@@ -84,14 +85,14 @@ function passStringToWasm0(arg, malloc, realloc) {
84
85
 
85
86
  if (realloc === undefined) {
86
87
  const buf = cachedTextEncoder.encode(arg);
87
- const ptr = malloc(buf.length);
88
+ const ptr = malloc(buf.length, 1) >>> 0;
88
89
  getUint8Memory0().subarray(ptr, ptr + buf.length).set(buf);
89
90
  WASM_VECTOR_LEN = buf.length;
90
91
  return ptr;
91
92
  }
92
93
 
93
94
  let len = arg.length;
94
- let ptr = malloc(len);
95
+ let ptr = malloc(len, 1) >>> 0;
95
96
 
96
97
  const mem = getUint8Memory0();
97
98
 
@@ -107,11 +108,12 @@ function passStringToWasm0(arg, malloc, realloc) {
107
108
  if (offset !== 0) {
108
109
  arg = arg.slice(offset);
109
110
  }
110
- ptr = realloc(ptr, len, len = offset + arg.length * 3);
111
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
111
112
  const view = getUint8Memory0().subarray(ptr + offset, ptr + len);
112
113
  const ret = encodeString(arg, view);
113
114
 
114
115
  offset += ret.written;
116
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
115
117
  }
116
118
 
117
119
  WASM_VECTOR_LEN = offset;
@@ -128,10 +130,12 @@ function getFloat32Memory0() {
128
130
  }
129
131
 
130
132
  function getArrayF32FromWasm0(ptr, len) {
133
+ ptr = ptr >>> 0;
131
134
  return getFloat32Memory0().subarray(ptr / 4, ptr / 4 + len);
132
135
  }
133
136
 
134
137
  function getArrayU8FromWasm0(ptr, len) {
138
+ ptr = ptr >>> 0;
135
139
  return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
136
140
  }
137
141
  /**
@@ -139,10 +143,12 @@ function getArrayU8FromWasm0(ptr, len) {
139
143
  * @param {string} data
140
144
  * @param {number} width
141
145
  * @param {number} height
142
- * @param {number} bc_type
146
+ * @param {BarcodeFormat} bc_type
143
147
  * @returns {string}
144
148
  */
145
149
  export function encode_barcode(data, width, height, bc_type) {
150
+ let deferred3_0;
151
+ let deferred3_1;
146
152
  try {
147
153
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
148
154
  const ptr0 = passStringToWasm0(data, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
@@ -152,16 +158,18 @@ export function encode_barcode(data, width, height, bc_type) {
152
158
  var r1 = getInt32Memory0()[retptr / 4 + 1];
153
159
  var r2 = getInt32Memory0()[retptr / 4 + 2];
154
160
  var r3 = getInt32Memory0()[retptr / 4 + 3];
155
- var ptr1 = r0;
156
- var len1 = r1;
161
+ var ptr2 = r0;
162
+ var len2 = r1;
157
163
  if (r3) {
158
- ptr1 = 0; len1 = 0;
164
+ ptr2 = 0; len2 = 0;
159
165
  throw takeObject(r2);
160
166
  }
161
- return getStringFromWasm0(ptr1, len1);
167
+ deferred3_0 = ptr2;
168
+ deferred3_1 = len2;
169
+ return getStringFromWasm0(ptr2, len2);
162
170
  } finally {
163
171
  wasm.__wbindgen_add_to_stack_pointer(16);
164
- wasm.__wbindgen_free(ptr1, len1);
172
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
165
173
  }
166
174
  }
167
175
 
@@ -176,36 +184,40 @@ function _assertClass(instance, klass) {
176
184
  * @param {string} data
177
185
  * @param {number} width
178
186
  * @param {number} height
179
- * @param {number} bc_type
187
+ * @param {BarcodeFormat} bc_type
180
188
  * @param {EncodeHintDictionary} hints
181
189
  * @returns {string}
182
190
  */
183
191
  export function encode_barcode_with_hints(data, width, height, bc_type, hints) {
192
+ let deferred3_0;
193
+ let deferred3_1;
184
194
  try {
185
195
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
186
196
  const ptr0 = passStringToWasm0(data, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
187
197
  const len0 = WASM_VECTOR_LEN;
188
198
  _assertClass(hints, EncodeHintDictionary);
189
- wasm.encode_barcode_with_hints(retptr, ptr0, len0, width, height, bc_type, hints.ptr);
199
+ wasm.encode_barcode_with_hints(retptr, ptr0, len0, width, height, bc_type, hints.__wbg_ptr);
190
200
  var r0 = getInt32Memory0()[retptr / 4 + 0];
191
201
  var r1 = getInt32Memory0()[retptr / 4 + 1];
192
202
  var r2 = getInt32Memory0()[retptr / 4 + 2];
193
203
  var r3 = getInt32Memory0()[retptr / 4 + 3];
194
- var ptr1 = r0;
195
- var len1 = r1;
204
+ var ptr2 = r0;
205
+ var len2 = r1;
196
206
  if (r3) {
197
- ptr1 = 0; len1 = 0;
207
+ ptr2 = 0; len2 = 0;
198
208
  throw takeObject(r2);
199
209
  }
200
- return getStringFromWasm0(ptr1, len1);
210
+ deferred3_0 = ptr2;
211
+ deferred3_1 = len2;
212
+ return getStringFromWasm0(ptr2, len2);
201
213
  } finally {
202
214
  wasm.__wbindgen_add_to_stack_pointer(16);
203
- wasm.__wbindgen_free(ptr1, len1);
215
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
204
216
  }
205
217
  }
206
218
 
207
219
  function passArray8ToWasm0(arg, malloc) {
208
- const ptr = malloc(arg.length * 1);
220
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
209
221
  getUint8Memory0().set(arg, ptr / 1);
210
222
  WASM_VECTOR_LEN = arg.length;
211
223
  return ptr;
@@ -219,8 +231,8 @@ function isLikeNone(x) {
219
231
  * @param {Uint8Array} data
220
232
  * @param {number} width
221
233
  * @param {number} height
222
- * @param {boolean | undefined} try_harder
223
- * @param {boolean | undefined} filter_image
234
+ * @param {boolean | undefined} [try_harder]
235
+ * @param {boolean | undefined} [filter_image]
224
236
  * @returns {BarcodeResult}
225
237
  */
226
238
  export function decode_barcode(data, width, height, try_harder, filter_image) {
@@ -259,9 +271,9 @@ export function convert_js_image_to_luma(data) {
259
271
  wasm.convert_js_image_to_luma(retptr, ptr0, len0);
260
272
  var r0 = getInt32Memory0()[retptr / 4 + 0];
261
273
  var r1 = getInt32Memory0()[retptr / 4 + 1];
262
- var v1 = getArrayU8FromWasm0(r0, r1).slice();
263
- wasm.__wbindgen_free(r0, r1 * 1);
264
- return v1;
274
+ var v2 = getArrayU8FromWasm0(r0, r1).slice();
275
+ wasm.__wbindgen_free(r0, r1 * 1, 1);
276
+ return v2;
265
277
  } finally {
266
278
  wasm.__wbindgen_add_to_stack_pointer(16);
267
279
  }
@@ -277,7 +289,7 @@ function getUint32Memory0() {
277
289
  }
278
290
 
279
291
  function passArray32ToWasm0(arg, malloc) {
280
- const ptr = malloc(arg.length * 4);
292
+ const ptr = malloc(arg.length * 4, 4) >>> 0;
281
293
  getUint32Memory0().set(arg, ptr / 4);
282
294
  WASM_VECTOR_LEN = arg.length;
283
295
  return ptr;
@@ -289,7 +301,7 @@ function passArray32ToWasm0(arg, malloc) {
289
301
  * @param {Uint32Array} data
290
302
  * @param {number} width
291
303
  * @param {number} height
292
- * @param {boolean | undefined} try_harder
304
+ * @param {boolean | undefined} [try_harder]
293
305
  * @returns {BarcodeResult}
294
306
  */
295
307
  export function decode_barcode_rgb(data, width, height, try_harder) {
@@ -315,7 +327,7 @@ export function decode_barcode_rgb(data, width, height, try_harder) {
315
327
  * @param {number} width
316
328
  * @param {number} height
317
329
  * @param {DecodeHintDictionary} hints
318
- * @param {boolean | undefined} filter_image
330
+ * @param {boolean | undefined} [filter_image]
319
331
  * @returns {BarcodeResult}
320
332
  */
321
333
  export function decode_barcode_with_hints(data, width, height, hints, filter_image) {
@@ -324,7 +336,7 @@ export function decode_barcode_with_hints(data, width, height, hints, filter_ima
324
336
  const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
325
337
  const len0 = WASM_VECTOR_LEN;
326
338
  _assertClass(hints, DecodeHintDictionary);
327
- wasm.decode_barcode_with_hints(retptr, ptr0, len0, width, height, hints.ptr, isLikeNone(filter_image) ? 0xFFFFFF : filter_image ? 1 : 0);
339
+ wasm.decode_barcode_with_hints(retptr, ptr0, len0, width, height, hints.__wbg_ptr, isLikeNone(filter_image) ? 0xFFFFFF : filter_image ? 1 : 0);
328
340
  var r0 = getInt32Memory0()[retptr / 4 + 0];
329
341
  var r1 = getInt32Memory0()[retptr / 4 + 1];
330
342
  var r2 = getInt32Memory0()[retptr / 4 + 2];
@@ -350,7 +362,7 @@ export function decode_multi(data, width, height, hints) {
350
362
  const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
351
363
  const len0 = WASM_VECTOR_LEN;
352
364
  _assertClass(hints, DecodeHintDictionary);
353
- wasm.decode_multi(retptr, ptr0, len0, width, height, hints.ptr);
365
+ wasm.decode_multi(retptr, ptr0, len0, width, height, hints.__wbg_ptr);
354
366
  var r0 = getInt32Memory0()[retptr / 4 + 0];
355
367
  var r1 = getInt32Memory0()[retptr / 4 + 1];
356
368
  var r2 = getInt32Memory0()[retptr / 4 + 2];
@@ -534,78 +546,6 @@ ForceC40:17,"17":"ForceC40",
534
546
  */
535
547
  Code128Compact:18,"18":"Code128Compact",TelepenAsNumeric:19,"19":"TelepenAsNumeric", });
536
548
  /**
537
- * Available barcode types
538
- */
539
- export const BarcodeFormat = Object.freeze({
540
- /**
541
- * Aztec 2D barcode format.
542
- */
543
- AZTEC:0,"0":"AZTEC",
544
- /**
545
- * CODABAR 1D format.
546
- */
547
- CODABAR:1,"1":"CODABAR",
548
- /**
549
- * Code 39 1D format.
550
- */
551
- Code39:2,"2":"Code39",
552
- /**
553
- * Code 93 1D format.
554
- */
555
- Code93:3,"3":"Code93",
556
- /**
557
- * Code 128 1D format.
558
- */
559
- Code128:4,"4":"Code128",
560
- /**
561
- * Data Matrix 2D barcode format.
562
- */
563
- DataMatrix:5,"5":"DataMatrix",
564
- /**
565
- * EAN-8 1D format.
566
- */
567
- Ean8:6,"6":"Ean8",
568
- /**
569
- * EAN-13 1D format.
570
- */
571
- Ean13:7,"7":"Ean13",
572
- /**
573
- * ITF (Interleaved Two of Five) 1D format.
574
- */
575
- ITF:8,"8":"ITF",
576
- /**
577
- * MaxiCode 2D barcode format.
578
- */
579
- MAXICODE:9,"9":"MAXICODE",
580
- /**
581
- * PDF417 format.
582
- */
583
- Pdf417:10,"10":"Pdf417",
584
- /**
585
- * QR Code 2D barcode format.
586
- */
587
- QrCode:11,"11":"QrCode",
588
- /**
589
- * RSS 14
590
- */
591
- Rss14:12,"12":"Rss14",
592
- /**
593
- * RSS EXPANDED
594
- */
595
- RssExpanded:13,"13":"RssExpanded",
596
- /**
597
- * UPC-A 1D format.
598
- */
599
- UpcA:14,"14":"UpcA",
600
- /**
601
- * UPC-E 1D format.
602
- */
603
- UpcE:15,"15":"UpcE",
604
- /**
605
- * UPC/EAN extension format. Not a stand-alone format.
606
- */
607
- UpcEanExtension:16,"16":"UpcEanExtension",MicroQR:17,"17":"MicroQR",Telepen:18,"18":"Telepen",RectangularMicroQR:19,"19":"RectangularMicroQR",UnsuportedFormat:20,"20":"UnsuportedFormat", });
608
- /**
609
549
  */
610
550
  export const DecodeHintTypes = Object.freeze({
611
551
  /**
@@ -701,20 +641,97 @@ AlsoInverted:11,"11":"AlsoInverted",
701
641
  */
702
642
  TelepenAsNumeric:12,"12":"TelepenAsNumeric", });
703
643
  /**
644
+ * Available barcode types
645
+ */
646
+ export const BarcodeFormat = Object.freeze({
647
+ /**
648
+ * Aztec 2D barcode format.
649
+ */
650
+ AZTEC:0,"0":"AZTEC",
651
+ /**
652
+ * CODABAR 1D format.
653
+ */
654
+ CODABAR:1,"1":"CODABAR",
655
+ /**
656
+ * Code 39 1D format.
657
+ */
658
+ Code39:2,"2":"Code39",
659
+ /**
660
+ * Code 93 1D format.
661
+ */
662
+ Code93:3,"3":"Code93",
663
+ /**
664
+ * Code 128 1D format.
665
+ */
666
+ Code128:4,"4":"Code128",
667
+ /**
668
+ * Data Matrix 2D barcode format.
669
+ */
670
+ DataMatrix:5,"5":"DataMatrix",
671
+ /**
672
+ * EAN-8 1D format.
673
+ */
674
+ Ean8:6,"6":"Ean8",
675
+ /**
676
+ * EAN-13 1D format.
677
+ */
678
+ Ean13:7,"7":"Ean13",
679
+ /**
680
+ * ITF (Interleaved Two of Five) 1D format.
681
+ */
682
+ ITF:8,"8":"ITF",
683
+ /**
684
+ * MaxiCode 2D barcode format.
685
+ */
686
+ MAXICODE:9,"9":"MAXICODE",
687
+ /**
688
+ * PDF417 format.
689
+ */
690
+ Pdf417:10,"10":"Pdf417",
691
+ /**
692
+ * QR Code 2D barcode format.
693
+ */
694
+ QrCode:11,"11":"QrCode",
695
+ /**
696
+ * RSS 14
697
+ */
698
+ Rss14:12,"12":"Rss14",
699
+ /**
700
+ * RSS EXPANDED
701
+ */
702
+ RssExpanded:13,"13":"RssExpanded",
703
+ /**
704
+ * UPC-A 1D format.
705
+ */
706
+ UpcA:14,"14":"UpcA",
707
+ /**
708
+ * UPC-E 1D format.
709
+ */
710
+ UpcE:15,"15":"UpcE",
711
+ /**
712
+ * UPC/EAN extension format. Not a stand-alone format.
713
+ */
714
+ UpcEanExtension:16,"16":"UpcEanExtension",MicroQR:17,"17":"MicroQR",Telepen:18,"18":"Telepen",RectangularMicroQR:19,"19":"RectangularMicroQR",UnsuportedFormat:20,"20":"UnsuportedFormat", });
715
+
716
+ const BarcodeResultFinalization = (typeof FinalizationRegistry === 'undefined')
717
+ ? { register: () => {}, unregister: () => {} }
718
+ : new FinalizationRegistry(ptr => wasm.__wbg_barcoderesult_free(ptr >>> 0));
719
+ /**
704
720
  */
705
721
  export class BarcodeResult {
706
722
 
707
723
  static __wrap(ptr) {
724
+ ptr = ptr >>> 0;
708
725
  const obj = Object.create(BarcodeResult.prototype);
709
- obj.ptr = ptr;
710
-
726
+ obj.__wbg_ptr = ptr;
727
+ BarcodeResultFinalization.register(obj, obj.__wbg_ptr, obj);
711
728
  return obj;
712
729
  }
713
730
 
714
731
  __destroy_into_raw() {
715
- const ptr = this.ptr;
716
- this.ptr = 0;
717
-
732
+ const ptr = this.__wbg_ptr;
733
+ this.__wbg_ptr = 0;
734
+ BarcodeResultFinalization.unregister(this);
718
735
  return ptr;
719
736
  }
720
737
 
@@ -726,15 +743,15 @@ export class BarcodeResult {
726
743
  * @returns {number}
727
744
  */
728
745
  timestamp() {
729
- const ret = wasm.barcoderesult_timestamp(this.ptr);
746
+ const ret = wasm.barcoderesult_timestamp(this.__wbg_ptr);
730
747
  return ret;
731
748
  }
732
749
  /**
733
- * @returns {number}
750
+ * @returns {BarcodeFormat}
734
751
  */
735
752
  format() {
736
- const ret = wasm.barcoderesult_format(this.ptr);
737
- return ret >>> 0;
753
+ const ret = wasm.barcoderesult_format(this.__wbg_ptr);
754
+ return ret;
738
755
  }
739
756
  /**
740
757
  * Each pair of f32 values is an (x,y) point
@@ -743,12 +760,12 @@ export class BarcodeResult {
743
760
  result_points() {
744
761
  try {
745
762
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
746
- wasm.barcoderesult_result_points(retptr, this.ptr);
763
+ wasm.barcoderesult_result_points(retptr, this.__wbg_ptr);
747
764
  var r0 = getInt32Memory0()[retptr / 4 + 0];
748
765
  var r1 = getInt32Memory0()[retptr / 4 + 1];
749
- var v0 = getArrayF32FromWasm0(r0, r1).slice();
750
- wasm.__wbindgen_free(r0, r1 * 4);
751
- return v0;
766
+ var v1 = getArrayF32FromWasm0(r0, r1).slice();
767
+ wasm.__wbindgen_free(r0, r1 * 4, 4);
768
+ return v1;
752
769
  } finally {
753
770
  wasm.__wbindgen_add_to_stack_pointer(16);
754
771
  }
@@ -757,7 +774,7 @@ export class BarcodeResult {
757
774
  * @returns {number}
758
775
  */
759
776
  num_bits() {
760
- const ret = wasm.barcoderesult_num_bits(this.ptr);
777
+ const ret = wasm.barcoderesult_num_bits(this.__wbg_ptr);
761
778
  return ret >>> 0;
762
779
  }
763
780
  /**
@@ -766,12 +783,12 @@ export class BarcodeResult {
766
783
  raw_bytes() {
767
784
  try {
768
785
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
769
- wasm.barcoderesult_raw_bytes(retptr, this.ptr);
786
+ wasm.barcoderesult_raw_bytes(retptr, this.__wbg_ptr);
770
787
  var r0 = getInt32Memory0()[retptr / 4 + 0];
771
788
  var r1 = getInt32Memory0()[retptr / 4 + 1];
772
- var v0 = getArrayU8FromWasm0(r0, r1).slice();
773
- wasm.__wbindgen_free(r0, r1 * 1);
774
- return v0;
789
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
790
+ wasm.__wbindgen_free(r0, r1 * 1, 1);
791
+ return v1;
775
792
  } finally {
776
793
  wasm.__wbindgen_add_to_stack_pointer(16);
777
794
  }
@@ -780,40 +797,41 @@ export class BarcodeResult {
780
797
  * @returns {string}
781
798
  */
782
799
  text() {
800
+ let deferred1_0;
801
+ let deferred1_1;
783
802
  try {
784
803
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
785
- wasm.barcoderesult_text(retptr, this.ptr);
804
+ wasm.barcoderesult_text(retptr, this.__wbg_ptr);
786
805
  var r0 = getInt32Memory0()[retptr / 4 + 0];
787
806
  var r1 = getInt32Memory0()[retptr / 4 + 1];
807
+ deferred1_0 = r0;
808
+ deferred1_1 = r1;
788
809
  return getStringFromWasm0(r0, r1);
789
810
  } finally {
790
811
  wasm.__wbindgen_add_to_stack_pointer(16);
791
- wasm.__wbindgen_free(r0, r1);
812
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
792
813
  }
793
814
  }
794
815
  /**
795
816
  * @returns {Map<any, any>}
796
817
  */
797
818
  get_meta_data() {
798
- const ret = wasm.barcoderesult_get_meta_data(this.ptr);
819
+ const ret = wasm.barcoderesult_get_meta_data(this.__wbg_ptr);
799
820
  return takeObject(ret);
800
821
  }
801
822
  }
823
+
824
+ const DecodeHintDictionaryFinalization = (typeof FinalizationRegistry === 'undefined')
825
+ ? { register: () => {}, unregister: () => {} }
826
+ : new FinalizationRegistry(ptr => wasm.__wbg_decodehintdictionary_free(ptr >>> 0));
802
827
  /**
803
828
  */
804
829
  export class DecodeHintDictionary {
805
830
 
806
- static __wrap(ptr) {
807
- const obj = Object.create(DecodeHintDictionary.prototype);
808
- obj.ptr = ptr;
809
-
810
- return obj;
811
- }
812
-
813
831
  __destroy_into_raw() {
814
- const ptr = this.ptr;
815
- this.ptr = 0;
816
-
832
+ const ptr = this.__wbg_ptr;
833
+ this.__wbg_ptr = 0;
834
+ DecodeHintDictionaryFinalization.unregister(this);
817
835
  return ptr;
818
836
  }
819
837
 
@@ -825,59 +843,61 @@ export class DecodeHintDictionary {
825
843
  */
826
844
  constructor() {
827
845
  const ret = wasm.decodehintdictionary_new();
828
- return DecodeHintDictionary.__wrap(ret);
846
+ this.__wbg_ptr = ret >>> 0;
847
+ return this;
829
848
  }
830
849
  /**
831
- * @param {number} hint
850
+ * @param {DecodeHintTypes} hint
832
851
  * @returns {string}
833
852
  */
834
853
  get_hint(hint) {
854
+ let deferred1_0;
855
+ let deferred1_1;
835
856
  try {
836
857
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
837
- wasm.decodehintdictionary_get_hint(retptr, this.ptr, hint);
858
+ wasm.decodehintdictionary_get_hint(retptr, this.__wbg_ptr, hint);
838
859
  var r0 = getInt32Memory0()[retptr / 4 + 0];
839
860
  var r1 = getInt32Memory0()[retptr / 4 + 1];
861
+ deferred1_0 = r0;
862
+ deferred1_1 = r1;
840
863
  return getStringFromWasm0(r0, r1);
841
864
  } finally {
842
865
  wasm.__wbindgen_add_to_stack_pointer(16);
843
- wasm.__wbindgen_free(r0, r1);
866
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
844
867
  }
845
868
  }
846
869
  /**
847
- * @param {number} hint
870
+ * @param {DecodeHintTypes} hint
848
871
  * @param {string} value
849
872
  * @returns {boolean}
850
873
  */
851
874
  set_hint(hint, value) {
852
875
  const ptr0 = passStringToWasm0(value, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
853
876
  const len0 = WASM_VECTOR_LEN;
854
- const ret = wasm.decodehintdictionary_set_hint(this.ptr, hint, ptr0, len0);
877
+ const ret = wasm.decodehintdictionary_set_hint(this.__wbg_ptr, hint, ptr0, len0);
855
878
  return ret !== 0;
856
879
  }
857
880
  /**
858
- * @param {number} hint
881
+ * @param {DecodeHintTypes} hint
859
882
  * @returns {boolean}
860
883
  */
861
884
  remove_hint(hint) {
862
- const ret = wasm.decodehintdictionary_remove_hint(this.ptr, hint);
885
+ const ret = wasm.decodehintdictionary_remove_hint(this.__wbg_ptr, hint);
863
886
  return ret !== 0;
864
887
  }
865
888
  }
889
+
890
+ const EncodeHintDictionaryFinalization = (typeof FinalizationRegistry === 'undefined')
891
+ ? { register: () => {}, unregister: () => {} }
892
+ : new FinalizationRegistry(ptr => wasm.__wbg_encodehintdictionary_free(ptr >>> 0));
866
893
  /**
867
894
  */
868
895
  export class EncodeHintDictionary {
869
896
 
870
- static __wrap(ptr) {
871
- const obj = Object.create(EncodeHintDictionary.prototype);
872
- obj.ptr = ptr;
873
-
874
- return obj;
875
- }
876
-
877
897
  __destroy_into_raw() {
878
- const ptr = this.ptr;
879
- this.ptr = 0;
880
-
898
+ const ptr = this.__wbg_ptr;
899
+ this.__wbg_ptr = 0;
900
+ EncodeHintDictionaryFinalization.unregister(this);
881
901
  return ptr;
882
902
  }
883
903
 
@@ -889,59 +909,69 @@ export class EncodeHintDictionary {
889
909
  */
890
910
  constructor() {
891
911
  const ret = wasm.encodehintdictionary_new();
892
- return EncodeHintDictionary.__wrap(ret);
912
+ this.__wbg_ptr = ret >>> 0;
913
+ return this;
893
914
  }
894
915
  /**
895
- * @param {number} hint
916
+ * @param {EncodeHintTypes} hint
896
917
  * @returns {string}
897
918
  */
898
919
  get_hint(hint) {
920
+ let deferred1_0;
921
+ let deferred1_1;
899
922
  try {
900
923
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
901
- wasm.encodehintdictionary_get_hint(retptr, this.ptr, hint);
924
+ wasm.encodehintdictionary_get_hint(retptr, this.__wbg_ptr, hint);
902
925
  var r0 = getInt32Memory0()[retptr / 4 + 0];
903
926
  var r1 = getInt32Memory0()[retptr / 4 + 1];
927
+ deferred1_0 = r0;
928
+ deferred1_1 = r1;
904
929
  return getStringFromWasm0(r0, r1);
905
930
  } finally {
906
931
  wasm.__wbindgen_add_to_stack_pointer(16);
907
- wasm.__wbindgen_free(r0, r1);
932
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
908
933
  }
909
934
  }
910
935
  /**
911
- * @param {number} hint
936
+ * @param {EncodeHintTypes} hint
912
937
  * @param {string} value
913
938
  * @returns {boolean}
914
939
  */
915
940
  set_hint(hint, value) {
916
941
  const ptr0 = passStringToWasm0(value, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
917
942
  const len0 = WASM_VECTOR_LEN;
918
- const ret = wasm.encodehintdictionary_set_hint(this.ptr, hint, ptr0, len0);
943
+ const ret = wasm.encodehintdictionary_set_hint(this.__wbg_ptr, hint, ptr0, len0);
919
944
  return ret !== 0;
920
945
  }
921
946
  /**
922
- * @param {number} hint
947
+ * @param {EncodeHintTypes} hint
923
948
  * @returns {boolean}
924
949
  */
925
950
  remove_hint(hint) {
926
- const ret = wasm.encodehintdictionary_remove_hint(this.ptr, hint);
951
+ const ret = wasm.encodehintdictionary_remove_hint(this.__wbg_ptr, hint);
927
952
  return ret !== 0;
928
953
  }
929
954
  }
955
+
956
+ const MultiDecodeResultFinalization = (typeof FinalizationRegistry === 'undefined')
957
+ ? { register: () => {}, unregister: () => {} }
958
+ : new FinalizationRegistry(ptr => wasm.__wbg_multidecoderesult_free(ptr >>> 0));
930
959
  /**
931
960
  */
932
961
  export class MultiDecodeResult {
933
962
 
934
963
  static __wrap(ptr) {
964
+ ptr = ptr >>> 0;
935
965
  const obj = Object.create(MultiDecodeResult.prototype);
936
- obj.ptr = ptr;
937
-
966
+ obj.__wbg_ptr = ptr;
967
+ MultiDecodeResultFinalization.register(obj, obj.__wbg_ptr, obj);
938
968
  return obj;
939
969
  }
940
970
 
941
971
  __destroy_into_raw() {
942
- const ptr = this.ptr;
943
- this.ptr = 0;
944
-
972
+ const ptr = this.__wbg_ptr;
973
+ this.__wbg_ptr = 0;
974
+ MultiDecodeResultFinalization.unregister(this);
945
975
  return ptr;
946
976
  }
947
977
 
@@ -953,42 +983,43 @@ export class MultiDecodeResult {
953
983
  */
954
984
  constructor() {
955
985
  const ret = wasm.multidecoderesult_new();
956
- return MultiDecodeResult.__wrap(ret);
986
+ this.__wbg_ptr = ret >>> 0;
987
+ return this;
957
988
  }
958
989
  /**
959
990
  * @returns {BarcodeResult | undefined}
960
991
  */
961
992
  next() {
962
- const ret = wasm.multidecoderesult_next(this.ptr);
993
+ const ret = wasm.multidecoderesult_next(this.__wbg_ptr);
963
994
  return ret === 0 ? undefined : BarcodeResult.__wrap(ret);
964
995
  }
965
996
  }
966
997
 
998
+ export function __wbindgen_object_drop_ref(arg0) {
999
+ takeObject(arg0);
1000
+ };
1001
+
967
1002
  export function __wbindgen_string_new(arg0, arg1) {
968
1003
  const ret = getStringFromWasm0(arg0, arg1);
969
1004
  return addHeapObject(ret);
970
1005
  };
971
1006
 
972
- export function __wbindgen_object_drop_ref(arg0) {
973
- takeObject(arg0);
974
- };
975
-
976
- export function __wbg_new_f841cc6f2098f4b5() {
1007
+ export function __wbg_new_d9bc3a0147634640() {
977
1008
  const ret = new Map();
978
1009
  return addHeapObject(ret);
979
1010
  };
980
1011
 
981
- export function __wbg_set_388c4c6422704173(arg0, arg1, arg2) {
1012
+ export function __wbg_set_8417257aaedc936b(arg0, arg1, arg2) {
982
1013
  const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
983
1014
  return addHeapObject(ret);
984
1015
  };
985
1016
 
986
- export function __wbg_getTime_7c59072d1651a3cf(arg0) {
1017
+ export function __wbg_getTime_2bc4375165f02d15(arg0) {
987
1018
  const ret = getObject(arg0).getTime();
988
1019
  return ret;
989
1020
  };
990
1021
 
991
- export function __wbg_new0_25059e40b1c02766() {
1022
+ export function __wbg_new0_7d84e5b2cd9fdc73() {
992
1023
  const ret = new Date();
993
1024
  return addHeapObject(ret);
994
1025
  };
Binary file