1
1
let wasm ;
2
2
3
- const cachedTextDecoder = new TextDecoder ( 'utf-8' , { ignoreBOM : true , fatal : true } ) ;
3
+ const cachedTextDecoder = ( typeof TextDecoder !== 'undefined' ? new TextDecoder ( 'utf-8' , { ignoreBOM : true , fatal : true } ) : { decode : ( ) => { throw Error ( 'TextDecoder not available' ) } } ) ;
4
4
5
- cachedTextDecoder . decode ( ) ;
5
+ if ( typeof TextDecoder !== 'undefined' ) { cachedTextDecoder . decode ( ) ; } ;
6
6
7
- let cachedUint8Memory0 = new Uint8Array ( ) ;
7
+ let cachedUint8Memory0 = null ;
8
8
9
9
function getUint8Memory0 ( ) {
10
- if ( cachedUint8Memory0 . byteLength === 0 ) {
10
+ if ( cachedUint8Memory0 === null || cachedUint8Memory0 . buffer !== wasm . memory . buffer ) {
11
11
cachedUint8Memory0 = new Uint8Array ( wasm . memory . buffer ) ;
12
12
}
13
13
return cachedUint8Memory0 ;
14
14
}
15
15
16
16
function getStringFromWasm0 ( ptr , len ) {
17
- return cachedTextDecoder . decode ( getUint8Memory0 ( ) . subarray ( ptr , ptr + len ) ) ;
17
+ ptr = ptr >>> 0 ;
18
+ return cachedTextDecoder . decode ( getUint8Memory0 ( ) . slice ( ptr , ptr + len ) ) ;
18
19
}
19
20
20
21
let WASM_VECTOR_LEN = 0 ;
21
22
22
- const cachedTextEncoder = new TextEncoder ( 'utf-8' ) ;
23
+ const cachedTextEncoder = ( typeof TextEncoder !== 'undefined' ? new TextEncoder ( 'utf-8' ) : { encode : ( ) => { throw Error ( 'TextEncoder not available' ) } } ) ;
23
24
24
- const encodeString = ( typeof cachedTextEncoder . encodeInto === 'function'
25
- ? function ( arg , view ) {
26
- return cachedTextEncoder . encodeInto ( arg , view ) ;
27
- }
28
- : function ( arg , view ) {
25
+ const encodeString = function ( arg , view ) {
29
26
const buf = cachedTextEncoder . encode ( arg ) ;
30
27
view . set ( buf ) ;
31
28
return {
32
29
read : arg . length ,
33
30
written : buf . length
34
31
} ;
35
- } ) ;
32
+ } ;
36
33
37
34
function passStringToWasm0 ( arg , malloc , realloc ) {
38
35
39
36
if ( realloc === undefined ) {
40
37
const buf = cachedTextEncoder . encode ( arg ) ;
41
- const ptr = malloc ( buf . length ) ;
38
+ const ptr = malloc ( buf . length , 1 ) >>> 0 ;
42
39
getUint8Memory0 ( ) . subarray ( ptr , ptr + buf . length ) . set ( buf ) ;
43
40
WASM_VECTOR_LEN = buf . length ;
44
41
return ptr ;
45
42
}
46
43
47
44
let len = arg . length ;
48
- let ptr = malloc ( len ) ;
45
+ let ptr = malloc ( len , 1 ) >>> 0 ;
49
46
50
47
const mem = getUint8Memory0 ( ) ;
51
48
@@ -61,7 +58,7 @@ function passStringToWasm0(arg, malloc, realloc) {
61
58
if ( offset !== 0 ) {
62
59
arg = arg . slice ( offset ) ;
63
60
}
64
- ptr = realloc ( ptr , len , len = offset + arg . length * 3 ) ;
61
+ ptr = realloc ( ptr , len , len = offset + arg . length * 3 , 1 ) >>> 0 ;
65
62
const view = getUint8Memory0 ( ) . subarray ( ptr + offset , ptr + len ) ;
66
63
const ret = encodeString ( arg , view ) ;
67
64
@@ -72,16 +69,17 @@ function passStringToWasm0(arg, malloc, realloc) {
72
69
return ptr ;
73
70
}
74
71
75
- let cachedInt32Memory0 = new Int32Array ( ) ;
72
+ let cachedInt32Memory0 = null ;
76
73
77
74
function getInt32Memory0 ( ) {
78
- if ( cachedInt32Memory0 . byteLength === 0 ) {
75
+ if ( cachedInt32Memory0 === null || cachedInt32Memory0 . buffer !== wasm . memory . buffer ) {
79
76
cachedInt32Memory0 = new Int32Array ( wasm . memory . buffer ) ;
80
77
}
81
78
return cachedInt32Memory0 ;
82
79
}
83
80
84
81
function getArrayU8FromWasm0 ( ptr , len ) {
82
+ ptr = ptr >>> 0 ;
85
83
return getUint8Memory0 ( ) . subarray ( ptr / 1 , ptr / 1 + len ) ;
86
84
}
87
85
/**
@@ -97,25 +95,25 @@ export function qr(content) {
97
95
wasm . qr ( retptr , ptr0 , len0 ) ;
98
96
var r0 = getInt32Memory0 ( ) [ retptr / 4 + 0 ] ;
99
97
var r1 = getInt32Memory0 ( ) [ retptr / 4 + 1 ] ;
100
- var v1 = getArrayU8FromWasm0 ( r0 , r1 ) . slice ( ) ;
98
+ var v2 = getArrayU8FromWasm0 ( r0 , r1 ) . slice ( ) ;
101
99
wasm . __wbindgen_free ( r0 , r1 * 1 ) ;
102
- return v1 ;
100
+ return v2 ;
103
101
} finally {
104
102
wasm . __wbindgen_add_to_stack_pointer ( 16 ) ;
105
103
}
106
104
}
107
105
108
- let cachedFloat64Memory0 = new Float64Array ( ) ;
106
+ let cachedFloat64Memory0 = null ;
109
107
110
108
function getFloat64Memory0 ( ) {
111
- if ( cachedFloat64Memory0 . byteLength === 0 ) {
109
+ if ( cachedFloat64Memory0 === null || cachedFloat64Memory0 . buffer !== wasm . memory . buffer ) {
112
110
cachedFloat64Memory0 = new Float64Array ( wasm . memory . buffer ) ;
113
111
}
114
112
return cachedFloat64Memory0 ;
115
113
}
116
114
117
115
function passArrayF64ToWasm0 ( arg , malloc ) {
118
- const ptr = malloc ( arg . length * 8 ) ;
116
+ const ptr = malloc ( arg . length * 8 , 8 ) >>> 0 ;
119
117
getFloat64Memory0 ( ) . set ( arg , ptr / 8 ) ;
120
118
WASM_VECTOR_LEN = arg . length ;
121
119
return ptr ;
@@ -134,25 +132,28 @@ function _assertClass(instance, klass) {
134
132
* @returns {string }
135
133
*/
136
134
export function qr_svg ( content , options ) {
135
+ let deferred3_0 ;
136
+ let deferred3_1 ;
137
137
try {
138
138
const retptr = wasm . __wbindgen_add_to_stack_pointer ( - 16 ) ;
139
139
const ptr0 = passStringToWasm0 ( content , wasm . __wbindgen_malloc , wasm . __wbindgen_realloc ) ;
140
140
const len0 = WASM_VECTOR_LEN ;
141
141
_assertClass ( options , SvgOptions ) ;
142
- var ptr1 = options . ptr ;
143
- options . ptr = 0 ;
142
+ var ptr1 = options . __destroy_into_raw ( ) ;
144
143
wasm . qr_svg ( retptr , ptr0 , len0 , ptr1 ) ;
145
144
var r0 = getInt32Memory0 ( ) [ retptr / 4 + 0 ] ;
146
145
var r1 = getInt32Memory0 ( ) [ retptr / 4 + 1 ] ;
146
+ deferred3_0 = r0 ;
147
+ deferred3_1 = r1 ;
147
148
return getStringFromWasm0 ( r0 , r1 ) ;
148
149
} finally {
149
150
wasm . __wbindgen_add_to_stack_pointer ( 16 ) ;
150
- wasm . __wbindgen_free ( r0 , r1 ) ;
151
+ wasm . __wbindgen_free ( deferred3_0 , deferred3_1 , 1 ) ;
151
152
}
152
153
}
153
154
154
155
/**
155
- * Different possible Shapes to represent modules in a QRCode
156
+ * Different possible Shapes to represent modules in a [`crate:: QRCode`]
156
157
*/
157
158
export const Shape = Object . freeze ( {
158
159
/**
@@ -201,15 +202,16 @@ RoundedSquare:2,"2":"RoundedSquare", });
201
202
export class SvgOptions {
202
203
203
204
static __wrap ( ptr ) {
205
+ ptr = ptr >>> 0 ;
204
206
const obj = Object . create ( SvgOptions . prototype ) ;
205
- obj . ptr = ptr ;
207
+ obj . __wbg_ptr = ptr ;
206
208
207
209
return obj ;
208
210
}
209
211
210
212
__destroy_into_raw ( ) {
211
- const ptr = this . ptr ;
212
- this . ptr = 0 ;
213
+ const ptr = this . __wbg_ptr ;
214
+ this . __wbg_ptr = 0 ;
213
215
214
216
return ptr ;
215
217
}
@@ -328,7 +330,7 @@ export class SvgOptions {
328
330
}
329
331
}
330
332
331
- async function load ( module , imports ) {
333
+ async function __wbg_load ( module , imports ) {
332
334
if ( typeof Response === 'function' && module instanceof Response ) {
333
335
if ( typeof WebAssembly . instantiateStreaming === 'function' ) {
334
336
try {
@@ -359,7 +361,7 @@ async function load(module, imports) {
359
361
}
360
362
}
361
363
362
- function getImports ( ) {
364
+ function __wbg_get_imports ( ) {
363
365
const imports = { } ;
364
366
imports . wbg = { } ;
365
367
imports . wbg . __wbindgen_throw = function ( arg0 , arg1 ) {
@@ -369,51 +371,55 @@ function getImports() {
369
371
return imports ;
370
372
}
371
373
372
- function initMemory ( imports , maybe_memory ) {
373
-
374
+ function __wbg_init_memory ( imports , maybe_memory ) {
375
+ imports . wbg . memory = maybe_memory || new WebAssembly . Memory ( { initial : 18 , maximum : 65536 , shared : true } ) ;
374
376
}
375
377
376
- function finalizeInit ( instance , module ) {
378
+ function __wbg_finalize_init ( instance , module ) {
377
379
wasm = instance . exports ;
378
- init . __wbindgen_wasm_module = module ;
379
- cachedFloat64Memory0 = new Float64Array ( ) ;
380
- cachedInt32Memory0 = new Int32Array ( ) ;
381
- cachedUint8Memory0 = new Uint8Array ( ) ;
382
-
380
+ __wbg_init . __wbindgen_wasm_module = module ;
381
+ cachedFloat64Memory0 = null ;
382
+ cachedInt32Memory0 = null ;
383
+ cachedUint8Memory0 = null ;
383
384
385
+ wasm . __wbindgen_start ( ) ;
384
386
return wasm ;
385
387
}
386
388
387
- function initSync ( module ) {
388
- const imports = getImports ( ) ;
389
+ function initSync ( module , maybe_memory ) {
390
+ if ( wasm !== undefined ) return wasm ;
389
391
390
- initMemory ( imports ) ;
392
+ const imports = __wbg_get_imports ( ) ;
393
+
394
+ __wbg_init_memory ( imports , maybe_memory ) ;
391
395
392
396
if ( ! ( module instanceof WebAssembly . Module ) ) {
393
397
module = new WebAssembly . Module ( module ) ;
394
398
}
395
399
396
400
const instance = new WebAssembly . Instance ( module , imports ) ;
397
401
398
- return finalizeInit ( instance , module ) ;
402
+ return __wbg_finalize_init ( instance , module ) ;
399
403
}
400
404
401
- async function init ( input ) {
405
+ async function __wbg_init ( input , maybe_memory ) {
406
+ if ( wasm !== undefined ) return wasm ;
407
+
402
408
if ( typeof input === 'undefined' ) {
403
409
input = new URL ( 'fast_qr_bg.wasm' , import . meta. url ) ;
404
410
}
405
- const imports = getImports ( ) ;
411
+ const imports = __wbg_get_imports ( ) ;
406
412
407
413
if ( typeof input === 'string' || ( typeof Request === 'function' && input instanceof Request ) || ( typeof URL === 'function' && input instanceof URL ) ) {
408
414
input = fetch ( input ) ;
409
415
}
410
416
411
- initMemory ( imports ) ;
417
+ __wbg_init_memory ( imports , maybe_memory ) ;
412
418
413
- const { instance, module } = await load ( await input , imports ) ;
419
+ const { instance, module } = await __wbg_load ( await input , imports ) ;
414
420
415
- return finalizeInit ( instance , module ) ;
421
+ return __wbg_finalize_init ( instance , module ) ;
416
422
}
417
423
418
424
export { initSync }
419
- export default init ;
425
+ export default __wbg_init ;
0 commit comments