@rainlanguage/sqlite-web 0.0.1 → 0.0.3

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/sqlite_web.js CHANGED
@@ -1,137 +1,550 @@
1
- let wasm;
1
+ /* @ts-self-types="./sqlite_web.d.ts" */
2
2
 
3
- let WASM_VECTOR_LEN = 0;
4
-
5
- let cachedUint8ArrayMemory0 = null;
6
-
7
- function getUint8ArrayMemory0() {
8
- if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
9
- cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
3
+ export class SQLiteWasmDatabase {
4
+ static __wrap(ptr) {
5
+ const obj = Object.create(SQLiteWasmDatabase.prototype);
6
+ obj.__wbg_ptr = ptr;
7
+ SQLiteWasmDatabaseFinalization.register(obj, obj.__wbg_ptr, obj);
8
+ return obj;
10
9
  }
11
- return cachedUint8ArrayMemory0;
12
- }
13
-
14
- const cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );
15
-
16
- const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
17
- ? function (arg, view) {
18
- return cachedTextEncoder.encodeInto(arg, view);
19
- }
20
- : function (arg, view) {
21
- const buf = cachedTextEncoder.encode(arg);
22
- view.set(buf);
23
- return {
24
- read: arg.length,
25
- written: buf.length
26
- };
27
- });
28
-
29
- function passStringToWasm0(arg, malloc, realloc) {
30
-
31
- if (realloc === undefined) {
32
- const buf = cachedTextEncoder.encode(arg);
33
- const ptr = malloc(buf.length, 1) >>> 0;
34
- getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
35
- WASM_VECTOR_LEN = buf.length;
10
+ __destroy_into_raw() {
11
+ const ptr = this.__wbg_ptr;
12
+ this.__wbg_ptr = 0;
13
+ SQLiteWasmDatabaseFinalization.unregister(this);
36
14
  return ptr;
37
15
  }
38
-
39
- let len = arg.length;
40
- let ptr = malloc(len, 1) >>> 0;
41
-
42
- const mem = getUint8ArrayMemory0();
43
-
44
- let offset = 0;
45
-
46
- for (; offset < len; offset++) {
47
- const code = arg.charCodeAt(offset);
48
- if (code > 0x7F) break;
49
- mem[ptr + offset] = code;
16
+ free() {
17
+ const ptr = this.__destroy_into_raw();
18
+ wasm.__wbg_sqlitewasmdatabase_free(ptr, 0);
50
19
  }
51
-
52
- if (offset !== len) {
53
- if (offset !== 0) {
54
- arg = arg.slice(offset);
55
- }
56
- ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
57
- const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
58
- const ret = encodeString(arg, view);
59
-
60
- offset += ret.written;
61
- ptr = realloc(ptr, len, offset, 1) >>> 0;
20
+ /**
21
+ * Create a new database connection with fully embedded worker
22
+ * @param {string} db_name
23
+ * @returns {WasmEncodedResult<SQLiteWasmDatabase>}
24
+ */
25
+ static new(db_name) {
26
+ const ptr0 = passStringToWasm0(db_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
27
+ const len0 = WASM_VECTOR_LEN;
28
+ const ret = wasm.sqlitewasmdatabase_new(ptr0, len0);
29
+ return ret;
30
+ }
31
+ /**
32
+ * Execute a SQL query (optionally parameterized via JS Array)
33
+ *
34
+ * Passing `undefined`/`null` from JS maps to `None`.
35
+ * @param {string} sql
36
+ * @param {Array<any> | null} [params]
37
+ * @returns {WasmEncodedResult<string>}
38
+ */
39
+ query(sql, params) {
40
+ const ptr0 = passStringToWasm0(sql, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
41
+ const len0 = WASM_VECTOR_LEN;
42
+ const ret = wasm.sqlitewasmdatabase_query(this.__wbg_ptr, ptr0, len0, isLikeNone(params) ? 0 : addToExternrefTable0(params));
43
+ return ret;
44
+ }
45
+ /**
46
+ * Execute a list of single SQL statements atomically as one worker job.
47
+ *
48
+ * Each item must be `{ sql: string, params?: Array }`. Do not include
49
+ * transaction-control statements; the worker owns the transaction.
50
+ * @param {Array<any>} statements
51
+ * @returns {WasmEncodedResult<string>}
52
+ */
53
+ transaction(statements) {
54
+ const ret = wasm.sqlitewasmdatabase_transaction(this.__wbg_ptr, statements);
55
+ return ret;
56
+ }
57
+ /**
58
+ * @returns {WasmEncodedResult<void>}
59
+ */
60
+ wipeAndRecreate() {
61
+ const ret = wasm.sqlitewasmdatabase_wipeAndRecreate(this.__wbg_ptr);
62
+ return ret;
62
63
  }
63
-
64
- WASM_VECTOR_LEN = offset;
65
- return ptr;
64
+ }
65
+ if (Symbol.dispose) SQLiteWasmDatabase.prototype[Symbol.dispose] = SQLiteWasmDatabase.prototype.free;
66
+ function __wbg_get_imports() {
67
+ const import0 = {
68
+ __proto__: null,
69
+ __wbg_Error_92b29b0548f8b746: function(arg0, arg1) {
70
+ const ret = Error(getStringFromWasm0(arg0, arg1));
71
+ return ret;
72
+ },
73
+ __wbg_String_8564e559799eccda: function(arg0, arg1) {
74
+ const ret = String(arg1);
75
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
76
+ const len1 = WASM_VECTOR_LEN;
77
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
78
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
79
+ },
80
+ __wbg___wbindgen_bigint_get_as_i64_d968e41184ae354f: function(arg0, arg1) {
81
+ const v = arg1;
82
+ const ret = typeof(v) === 'bigint' ? v : undefined;
83
+ getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
84
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
85
+ },
86
+ __wbg___wbindgen_boolean_get_fa956cfa2d1bd751: function(arg0) {
87
+ const v = arg0;
88
+ const ret = typeof(v) === 'boolean' ? v : undefined;
89
+ return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
90
+ },
91
+ __wbg___wbindgen_debug_string_c25d447a39f5578f: function(arg0, arg1) {
92
+ const ret = debugString(arg1);
93
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
94
+ const len1 = WASM_VECTOR_LEN;
95
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
96
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
97
+ },
98
+ __wbg___wbindgen_in_aca499c5de7ff5e5: function(arg0, arg1) {
99
+ const ret = arg0 in arg1;
100
+ return ret;
101
+ },
102
+ __wbg___wbindgen_is_bigint_2f76dc55065b4273: function(arg0) {
103
+ const ret = typeof(arg0) === 'bigint';
104
+ return ret;
105
+ },
106
+ __wbg___wbindgen_is_function_1ff95bcc5517c252: function(arg0) {
107
+ const ret = typeof(arg0) === 'function';
108
+ return ret;
109
+ },
110
+ __wbg___wbindgen_is_null_ea9085d691f535d3: function(arg0) {
111
+ const ret = arg0 === null;
112
+ return ret;
113
+ },
114
+ __wbg___wbindgen_is_object_a27215656b807791: function(arg0) {
115
+ const val = arg0;
116
+ const ret = typeof(val) === 'object' && val !== null;
117
+ return ret;
118
+ },
119
+ __wbg___wbindgen_is_undefined_c05833b95a3cf397: function(arg0) {
120
+ const ret = arg0 === undefined;
121
+ return ret;
122
+ },
123
+ __wbg___wbindgen_jsval_eq_e659fcf7b0e32763: function(arg0, arg1) {
124
+ const ret = arg0 === arg1;
125
+ return ret;
126
+ },
127
+ __wbg___wbindgen_jsval_loose_eq_db4c3b15f63fc170: function(arg0, arg1) {
128
+ const ret = arg0 == arg1;
129
+ return ret;
130
+ },
131
+ __wbg___wbindgen_number_get_394265ed1e1b84ee: function(arg0, arg1) {
132
+ const obj = arg1;
133
+ const ret = typeof(obj) === 'number' ? obj : undefined;
134
+ getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
135
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
136
+ },
137
+ __wbg___wbindgen_string_get_b0ca35b86a603356: function(arg0, arg1) {
138
+ const obj = arg1;
139
+ const ret = typeof(obj) === 'string' ? obj : undefined;
140
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
141
+ var len1 = WASM_VECTOR_LEN;
142
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
143
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
144
+ },
145
+ __wbg___wbindgen_throw_344f42d3211c4765: function(arg0, arg1) {
146
+ throw new Error(getStringFromWasm0(arg0, arg1));
147
+ },
148
+ __wbg__wbg_cb_unref_fffb441def202758: function(arg0) {
149
+ arg0._wbg_cb_unref();
150
+ },
151
+ __wbg_call_8a2dd23819f8a60a: function() { return handleError(function (arg0, arg1) {
152
+ const ret = arg0.call(arg1);
153
+ return ret;
154
+ }, arguments); },
155
+ __wbg_call_a6e5c5dce5018821: function() { return handleError(function (arg0, arg1, arg2) {
156
+ const ret = arg0.call(arg1, arg2);
157
+ return ret;
158
+ }, arguments); },
159
+ __wbg_createObjectURL_416e527781e6fd6d: function() { return handleError(function (arg0, arg1) {
160
+ const ret = URL.createObjectURL(arg1);
161
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
162
+ const len1 = WASM_VECTOR_LEN;
163
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
164
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
165
+ }, arguments); },
166
+ __wbg_data_328de4280640da92: function(arg0) {
167
+ const ret = arg0.data;
168
+ return ret;
169
+ },
170
+ __wbg_done_89b2b13e91a60321: function(arg0) {
171
+ const ret = arg0.done;
172
+ return ret;
173
+ },
174
+ __wbg_entries_015dc610cd81ede0: function(arg0) {
175
+ const ret = Object.entries(arg0);
176
+ return ret;
177
+ },
178
+ __wbg_entries_3d99c52a47728e2f: function(arg0) {
179
+ const ret = arg0.entries();
180
+ return ret;
181
+ },
182
+ __wbg_getDirectoryHandle_cf175faf1a75a384: function(arg0, arg1, arg2, arg3) {
183
+ const ret = arg0.getDirectoryHandle(getStringFromWasm0(arg1, arg2), arg3);
184
+ return ret;
185
+ },
186
+ __wbg_getDirectory_389283588dfb8117: function(arg0) {
187
+ const ret = arg0.getDirectory();
188
+ return ret;
189
+ },
190
+ __wbg_get_507a50627bffa49b: function(arg0, arg1) {
191
+ const ret = arg0[arg1 >>> 0];
192
+ return ret;
193
+ },
194
+ __wbg_get_78f252d074a84d0b: function() { return handleError(function (arg0, arg1) {
195
+ const ret = Reflect.get(arg0, arg1);
196
+ return ret;
197
+ }, arguments); },
198
+ __wbg_get_c7eb1f358a7654df: function() { return handleError(function (arg0, arg1) {
199
+ const ret = Reflect.get(arg0, arg1);
200
+ return ret;
201
+ }, arguments); },
202
+ __wbg_get_unchecked_6e0ad6d2a41b06f6: function(arg0, arg1) {
203
+ const ret = arg0[arg1 >>> 0];
204
+ return ret;
205
+ },
206
+ __wbg_instanceof_ArrayBuffer_4480b9e0068a8adb: function(arg0) {
207
+ let result;
208
+ try {
209
+ result = arg0 instanceof ArrayBuffer;
210
+ } catch (_) {
211
+ result = false;
212
+ }
213
+ const ret = result;
214
+ return ret;
215
+ },
216
+ __wbg_instanceof_DomException_952faa8037702c00: function(arg0) {
217
+ let result;
218
+ try {
219
+ result = arg0 instanceof DOMException;
220
+ } catch (_) {
221
+ result = false;
222
+ }
223
+ const ret = result;
224
+ return ret;
225
+ },
226
+ __wbg_instanceof_FileSystemDirectoryHandle_c9ab7c5cdb7a7c30: function(arg0) {
227
+ let result;
228
+ try {
229
+ result = arg0 instanceof FileSystemDirectoryHandle;
230
+ } catch (_) {
231
+ result = false;
232
+ }
233
+ const ret = result;
234
+ return ret;
235
+ },
236
+ __wbg_instanceof_Map_e5b5e3db98422fcc: function(arg0) {
237
+ let result;
238
+ try {
239
+ result = arg0 instanceof Map;
240
+ } catch (_) {
241
+ result = false;
242
+ }
243
+ const ret = result;
244
+ return ret;
245
+ },
246
+ __wbg_instanceof_Navigator_51c4c7741403f34f: function(arg0) {
247
+ let result;
248
+ try {
249
+ result = arg0 instanceof Navigator;
250
+ } catch (_) {
251
+ result = false;
252
+ }
253
+ const ret = result;
254
+ return ret;
255
+ },
256
+ __wbg_instanceof_Uint8Array_309b927aaf7a3fc7: function(arg0) {
257
+ let result;
258
+ try {
259
+ result = arg0 instanceof Uint8Array;
260
+ } catch (_) {
261
+ result = false;
262
+ }
263
+ const ret = result;
264
+ return ret;
265
+ },
266
+ __wbg_instanceof_Window_05ba1ee4f6781663: function(arg0) {
267
+ let result;
268
+ try {
269
+ result = arg0 instanceof Window;
270
+ } catch (_) {
271
+ result = false;
272
+ }
273
+ const ret = result;
274
+ return ret;
275
+ },
276
+ __wbg_isArray_0677c962b281d01a: function(arg0) {
277
+ const ret = Array.isArray(arg0);
278
+ return ret;
279
+ },
280
+ __wbg_isSafeInteger_04f36e4056f1b851: function(arg0) {
281
+ const ret = Number.isSafeInteger(arg0);
282
+ return ret;
283
+ },
284
+ __wbg_iterator_6f722e4a93058b71: function() {
285
+ const ret = Symbol.iterator;
286
+ return ret;
287
+ },
288
+ __wbg_length_1f0964f4a5e2c6d8: function(arg0) {
289
+ const ret = arg0.length;
290
+ return ret;
291
+ },
292
+ __wbg_length_370319915dc99107: function(arg0) {
293
+ const ret = arg0.length;
294
+ return ret;
295
+ },
296
+ __wbg_name_9d2bcd24d4433cef: function(arg0, arg1) {
297
+ const ret = arg1.name;
298
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
299
+ const len1 = WASM_VECTOR_LEN;
300
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
301
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
302
+ },
303
+ __wbg_navigator_99621db14b3f1099: function(arg0) {
304
+ const ret = arg0.navigator;
305
+ return ret;
306
+ },
307
+ __wbg_new_32b398fb48b6d94a: function() {
308
+ const ret = new Array();
309
+ return ret;
310
+ },
311
+ __wbg_new_8f0c2d11e48a4727: function() { return handleError(function (arg0, arg1) {
312
+ const ret = new Worker(getStringFromWasm0(arg0, arg1));
313
+ return ret;
314
+ }, arguments); },
315
+ __wbg_new_aec3e25493d729fe: function(arg0, arg1) {
316
+ try {
317
+ var state0 = {a: arg0, b: arg1};
318
+ var cb0 = (arg0, arg1) => {
319
+ const a = state0.a;
320
+ state0.a = 0;
321
+ try {
322
+ return wasm_bindgen__convert__closures_____invoke__h3fea4067346f5309(a, state0.b, arg0, arg1);
323
+ } finally {
324
+ state0.a = a;
325
+ }
326
+ };
327
+ const ret = new Promise(cb0);
328
+ return ret;
329
+ } finally {
330
+ state0.a = 0;
331
+ }
332
+ },
333
+ __wbg_new_cd45aabdf6073e84: function(arg0) {
334
+ const ret = new Uint8Array(arg0);
335
+ return ret;
336
+ },
337
+ __wbg_new_da52cf8fe3429cb2: function() {
338
+ const ret = new Object();
339
+ return ret;
340
+ },
341
+ __wbg_new_typed_1824d93f294193e5: function(arg0, arg1) {
342
+ try {
343
+ var state0 = {a: arg0, b: arg1};
344
+ var cb0 = (arg0, arg1) => {
345
+ const a = state0.a;
346
+ state0.a = 0;
347
+ try {
348
+ return wasm_bindgen__convert__closures_____invoke__h3fea4067346f5309(a, state0.b, arg0, arg1);
349
+ } finally {
350
+ state0.a = a;
351
+ }
352
+ };
353
+ const ret = new Promise(cb0);
354
+ return ret;
355
+ } finally {
356
+ state0.a = 0;
357
+ }
358
+ },
359
+ __wbg_new_with_str_sequence_and_options_9db076dc44ddbeb0: function() { return handleError(function (arg0, arg1) {
360
+ const ret = new Blob(arg0, arg1);
361
+ return ret;
362
+ }, arguments); },
363
+ __wbg_next_6dbf2c0ac8cde20f: function(arg0) {
364
+ const ret = arg0.next;
365
+ return ret;
366
+ },
367
+ __wbg_next_71f2aa1cb3d1e37e: function() { return handleError(function (arg0) {
368
+ const ret = arg0.next();
369
+ return ret;
370
+ }, arguments); },
371
+ __wbg_postMessage_56396682c54d5757: function() { return handleError(function (arg0, arg1) {
372
+ arg0.postMessage(arg1);
373
+ }, arguments); },
374
+ __wbg_prototypesetcall_4770620bbe4688a0: function(arg0, arg1, arg2) {
375
+ Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
376
+ },
377
+ __wbg_push_d2ae3af0c1217ae6: function(arg0, arg1) {
378
+ const ret = arg0.push(arg1);
379
+ return ret;
380
+ },
381
+ __wbg_queueMicrotask_0ab5b2d2393e99b9: function(arg0) {
382
+ const ret = arg0.queueMicrotask;
383
+ return ret;
384
+ },
385
+ __wbg_queueMicrotask_6a09b7bc46549209: function(arg0) {
386
+ queueMicrotask(arg0);
387
+ },
388
+ __wbg_removeEntry_6716e344f14ec77f: function(arg0, arg1, arg2, arg3) {
389
+ const ret = arg0.removeEntry(getStringFromWasm0(arg1, arg2), arg3);
390
+ return ret;
391
+ },
392
+ __wbg_resolve_2191a4dfe481c25b: function(arg0) {
393
+ const ret = Promise.resolve(arg0);
394
+ return ret;
395
+ },
396
+ __wbg_revokeObjectURL_e010fb0b45f93f3f: function() { return handleError(function (arg0, arg1) {
397
+ URL.revokeObjectURL(getStringFromWasm0(arg0, arg1));
398
+ }, arguments); },
399
+ __wbg_setTimeout_cfa2cf195c3738db: function() { return handleError(function (arg0, arg1, arg2) {
400
+ const ret = arg0.setTimeout(arg1, arg2);
401
+ return ret;
402
+ }, arguments); },
403
+ __wbg_set_6be42768c690e380: function(arg0, arg1, arg2) {
404
+ arg0[arg1] = arg2;
405
+ },
406
+ __wbg_set_8535240470bf2500: function() { return handleError(function (arg0, arg1, arg2) {
407
+ const ret = Reflect.set(arg0, arg1, arg2);
408
+ return ret;
409
+ }, arguments); },
410
+ __wbg_set_create_fa1dfa475fac91e9: function(arg0, arg1) {
411
+ arg0.create = arg1 !== 0;
412
+ },
413
+ __wbg_set_onmessage_57d6a01ac0bfd3a3: function(arg0, arg1) {
414
+ arg0.onmessage = arg1;
415
+ },
416
+ __wbg_set_recursive_a4f915c7492b89e8: function(arg0, arg1) {
417
+ arg0.recursive = arg1 !== 0;
418
+ },
419
+ __wbg_set_type_8ce203e412e28cf6: function(arg0, arg1, arg2) {
420
+ arg0.type = getStringFromWasm0(arg1, arg2);
421
+ },
422
+ __wbg_sqlitewasmdatabase_new: function(arg0) {
423
+ const ret = SQLiteWasmDatabase.__wrap(arg0);
424
+ return ret;
425
+ },
426
+ __wbg_static_accessor_GLOBAL_4ef717fb391d88b7: function() {
427
+ const ret = typeof global === 'undefined' ? null : global;
428
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
429
+ },
430
+ __wbg_static_accessor_GLOBAL_THIS_8d1badc68b5a74f4: function() {
431
+ const ret = typeof globalThis === 'undefined' ? null : globalThis;
432
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
433
+ },
434
+ __wbg_static_accessor_SELF_146583524fe1469b: function() {
435
+ const ret = typeof self === 'undefined' ? null : self;
436
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
437
+ },
438
+ __wbg_static_accessor_WINDOW_f2829a2234d7819e: function() {
439
+ const ret = typeof window === 'undefined' ? null : window;
440
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
441
+ },
442
+ __wbg_storage_756400487605531a: function(arg0) {
443
+ const ret = arg0.storage;
444
+ return ret;
445
+ },
446
+ __wbg_terminate_13d19661bbbf7d2b: function(arg0) {
447
+ arg0.terminate();
448
+ },
449
+ __wbg_then_16d107c451e9905d: function(arg0, arg1, arg2) {
450
+ const ret = arg0.then(arg1, arg2);
451
+ return ret;
452
+ },
453
+ __wbg_then_6ec10ae38b3e92f7: function(arg0, arg1) {
454
+ const ret = arg0.then(arg1);
455
+ return ret;
456
+ },
457
+ __wbg_toString_34387d7c1df9ca1e: function() { return handleError(function (arg0, arg1) {
458
+ const ret = arg0.toString(arg1);
459
+ return ret;
460
+ }, arguments); },
461
+ __wbg_value_a5d5488a9589444a: function(arg0) {
462
+ const ret = arg0.value;
463
+ return ret;
464
+ },
465
+ __wbindgen_cast_0000000000000001: function(arg0, arg1) {
466
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 32, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
467
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h662cc5297105c4a7);
468
+ return ret;
469
+ },
470
+ __wbindgen_cast_0000000000000002: function(arg0, arg1) {
471
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 63, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
472
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h27ec19c17abe8f50);
473
+ return ret;
474
+ },
475
+ __wbindgen_cast_0000000000000003: function(arg0, arg1) {
476
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 61, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
477
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h78dad3b4b0b34364);
478
+ return ret;
479
+ },
480
+ __wbindgen_cast_0000000000000004: function(arg0) {
481
+ // Cast intrinsic for `F64 -> Externref`.
482
+ const ret = arg0;
483
+ return ret;
484
+ },
485
+ __wbindgen_cast_0000000000000005: function(arg0) {
486
+ // Cast intrinsic for `I64 -> Externref`.
487
+ const ret = arg0;
488
+ return ret;
489
+ },
490
+ __wbindgen_cast_0000000000000006: function(arg0, arg1) {
491
+ // Cast intrinsic for `Ref(String) -> Externref`.
492
+ const ret = getStringFromWasm0(arg0, arg1);
493
+ return ret;
494
+ },
495
+ __wbindgen_cast_0000000000000007: function(arg0) {
496
+ // Cast intrinsic for `U64 -> Externref`.
497
+ const ret = BigInt.asUintN(64, arg0);
498
+ return ret;
499
+ },
500
+ __wbindgen_init_externref_table: function() {
501
+ const table = wasm.__wbindgen_externrefs;
502
+ const offset = table.grow(4);
503
+ table.set(0, undefined);
504
+ table.set(offset + 0, undefined);
505
+ table.set(offset + 1, null);
506
+ table.set(offset + 2, true);
507
+ table.set(offset + 3, false);
508
+ },
509
+ };
510
+ return {
511
+ __proto__: null,
512
+ "./sqlite_web_bg.js": import0,
513
+ };
66
514
  }
67
515
 
68
- let cachedDataViewMemory0 = null;
69
-
70
- function getDataViewMemory0() {
71
- if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
72
- cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
73
- }
74
- return cachedDataViewMemory0;
516
+ function wasm_bindgen__convert__closures_____invoke__h78dad3b4b0b34364(arg0, arg1) {
517
+ wasm.wasm_bindgen__convert__closures_____invoke__h78dad3b4b0b34364(arg0, arg1);
75
518
  }
76
519
 
77
- function addToExternrefTable0(obj) {
78
- const idx = wasm.__externref_table_alloc();
79
- wasm.__wbindgen_export_4.set(idx, obj);
80
- return idx;
520
+ function wasm_bindgen__convert__closures_____invoke__h27ec19c17abe8f50(arg0, arg1, arg2) {
521
+ wasm.wasm_bindgen__convert__closures_____invoke__h27ec19c17abe8f50(arg0, arg1, arg2);
81
522
  }
82
523
 
83
- function handleError(f, args) {
84
- try {
85
- return f.apply(this, args);
86
- } catch (e) {
87
- const idx = addToExternrefTable0(e);
88
- wasm.__wbindgen_exn_store(idx);
524
+ function wasm_bindgen__convert__closures_____invoke__h662cc5297105c4a7(arg0, arg1, arg2) {
525
+ const ret = wasm.wasm_bindgen__convert__closures_____invoke__h662cc5297105c4a7(arg0, arg1, arg2);
526
+ if (ret[1]) {
527
+ throw takeFromExternrefTable0(ret[0]);
89
528
  }
90
529
  }
91
530
 
92
- const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
93
-
94
- if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
95
-
96
- function getStringFromWasm0(ptr, len) {
97
- ptr = ptr >>> 0;
98
- return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
531
+ function wasm_bindgen__convert__closures_____invoke__h3fea4067346f5309(arg0, arg1, arg2, arg3) {
532
+ wasm.wasm_bindgen__convert__closures_____invoke__h3fea4067346f5309(arg0, arg1, arg2, arg3);
99
533
  }
100
534
 
101
- function isLikeNone(x) {
102
- return x === undefined || x === null;
535
+ const SQLiteWasmDatabaseFinalization = (typeof FinalizationRegistry === 'undefined')
536
+ ? { register: () => {}, unregister: () => {} }
537
+ : new FinalizationRegistry(ptr => wasm.__wbg_sqlitewasmdatabase_free(ptr, 1));
538
+
539
+ function addToExternrefTable0(obj) {
540
+ const idx = wasm.__externref_table_alloc();
541
+ wasm.__wbindgen_externrefs.set(idx, obj);
542
+ return idx;
103
543
  }
104
544
 
105
545
  const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
106
546
  ? { register: () => {}, unregister: () => {} }
107
- : new FinalizationRegistry(state => {
108
- wasm.__wbindgen_export_5.get(state.dtor)(state.a, state.b)
109
- });
110
-
111
- function makeMutClosure(arg0, arg1, dtor, f) {
112
- const state = { a: arg0, b: arg1, cnt: 1, dtor };
113
- const real = (...args) => {
114
- // First up with a closure we increment the internal reference
115
- // count. This ensures that the Rust closure environment won't
116
- // be deallocated while we're invoking it.
117
- state.cnt++;
118
- const a = state.a;
119
- state.a = 0;
120
- try {
121
- return f(a, state.b, ...args);
122
- } finally {
123
- if (--state.cnt === 0) {
124
- wasm.__wbindgen_export_5.get(state.dtor)(a, state.b);
125
- CLOSURE_DTORS.unregister(state);
126
- } else {
127
- state.a = a;
128
- }
129
- }
130
- };
131
- real.original = state;
132
- CLOSURE_DTORS.register(real, state, state);
133
- return real;
134
- }
547
+ : new FinalizationRegistry(state => wasm.__wbindgen_destroy_closure(state.a, state.b));
135
548
 
136
549
  function debugString(val) {
137
550
  // primitive types
@@ -197,64 +610,154 @@ function debugString(val) {
197
610
  // TODO we could test for more things here, like `Set`s and `Map`s.
198
611
  return className;
199
612
  }
200
- function __wbg_adapter_50(arg0, arg1, arg2) {
201
- wasm.closure2_externref_shim(arg0, arg1, arg2);
613
+
614
+ function getArrayU8FromWasm0(ptr, len) {
615
+ ptr = ptr >>> 0;
616
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
202
617
  }
203
618
 
204
- function __wbg_adapter_91(arg0, arg1, arg2, arg3) {
205
- wasm.closure25_externref_shim(arg0, arg1, arg2, arg3);
619
+ let cachedDataViewMemory0 = null;
620
+ function getDataViewMemory0() {
621
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
622
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
623
+ }
624
+ return cachedDataViewMemory0;
206
625
  }
207
626
 
208
- const SQLiteWasmDatabaseFinalization = (typeof FinalizationRegistry === 'undefined')
209
- ? { register: () => {}, unregister: () => {} }
210
- : new FinalizationRegistry(ptr => wasm.__wbg_sqlitewasmdatabase_free(ptr >>> 0, 1));
627
+ function getStringFromWasm0(ptr, len) {
628
+ return decodeText(ptr >>> 0, len);
629
+ }
211
630
 
212
- export class SQLiteWasmDatabase {
631
+ let cachedUint8ArrayMemory0 = null;
632
+ function getUint8ArrayMemory0() {
633
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
634
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
635
+ }
636
+ return cachedUint8ArrayMemory0;
637
+ }
213
638
 
214
- static __wrap(ptr) {
215
- ptr = ptr >>> 0;
216
- const obj = Object.create(SQLiteWasmDatabase.prototype);
217
- obj.__wbg_ptr = ptr;
218
- SQLiteWasmDatabaseFinalization.register(obj, obj.__wbg_ptr, obj);
219
- return obj;
639
+ function handleError(f, args) {
640
+ try {
641
+ return f.apply(this, args);
642
+ } catch (e) {
643
+ const idx = addToExternrefTable0(e);
644
+ wasm.__wbindgen_exn_store(idx);
220
645
  }
646
+ }
221
647
 
222
- __destroy_into_raw() {
223
- const ptr = this.__wbg_ptr;
224
- this.__wbg_ptr = 0;
225
- SQLiteWasmDatabaseFinalization.unregister(this);
648
+ function isLikeNone(x) {
649
+ return x === undefined || x === null;
650
+ }
651
+
652
+ function makeMutClosure(arg0, arg1, f) {
653
+ const state = { a: arg0, b: arg1, cnt: 1 };
654
+ const real = (...args) => {
655
+
656
+ // First up with a closure we increment the internal reference
657
+ // count. This ensures that the Rust closure environment won't
658
+ // be deallocated while we're invoking it.
659
+ state.cnt++;
660
+ const a = state.a;
661
+ state.a = 0;
662
+ try {
663
+ return f(a, state.b, ...args);
664
+ } finally {
665
+ state.a = a;
666
+ real._wbg_cb_unref();
667
+ }
668
+ };
669
+ real._wbg_cb_unref = () => {
670
+ if (--state.cnt === 0) {
671
+ wasm.__wbindgen_destroy_closure(state.a, state.b);
672
+ state.a = 0;
673
+ CLOSURE_DTORS.unregister(state);
674
+ }
675
+ };
676
+ CLOSURE_DTORS.register(real, state, state);
677
+ return real;
678
+ }
679
+
680
+ function passStringToWasm0(arg, malloc, realloc) {
681
+ if (realloc === undefined) {
682
+ const buf = cachedTextEncoder.encode(arg);
683
+ const ptr = malloc(buf.length, 1) >>> 0;
684
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
685
+ WASM_VECTOR_LEN = buf.length;
226
686
  return ptr;
227
687
  }
228
688
 
229
- free() {
230
- const ptr = this.__destroy_into_raw();
231
- wasm.__wbg_sqlitewasmdatabase_free(ptr, 0);
689
+ let len = arg.length;
690
+ let ptr = malloc(len, 1) >>> 0;
691
+
692
+ const mem = getUint8ArrayMemory0();
693
+
694
+ let offset = 0;
695
+
696
+ for (; offset < len; offset++) {
697
+ const code = arg.charCodeAt(offset);
698
+ if (code > 0x7F) break;
699
+ mem[ptr + offset] = code;
232
700
  }
233
- /**
234
- * Create a new database connection with fully embedded worker
235
- * @param {string} db_name
236
- * @returns {WasmEncodedResult<SQLiteWasmDatabase>}
237
- */
238
- static new(db_name) {
239
- const ptr0 = passStringToWasm0(db_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
240
- const len0 = WASM_VECTOR_LEN;
241
- const ret = wasm.sqlitewasmdatabase_new(ptr0, len0);
242
- return ret;
701
+ if (offset !== len) {
702
+ if (offset !== 0) {
703
+ arg = arg.slice(offset);
704
+ }
705
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
706
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
707
+ const ret = cachedTextEncoder.encodeInto(arg, view);
708
+
709
+ offset += ret.written;
710
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
243
711
  }
244
- /**
245
- * Execute a SQL query (optionally parameterized via JS Array)
246
- *
247
- * Passing `undefined`/`null` from JS maps to `None`.
248
- * @param {string} sql
249
- * @param {Array<any> | null} [params]
250
- * @returns {WasmEncodedResult<string>}
251
- */
252
- query(sql, params) {
253
- const ptr0 = passStringToWasm0(sql, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
254
- const len0 = WASM_VECTOR_LEN;
255
- const ret = wasm.sqlitewasmdatabase_query(this.__wbg_ptr, ptr0, len0, isLikeNone(params) ? 0 : addToExternrefTable0(params));
256
- return ret;
712
+
713
+ WASM_VECTOR_LEN = offset;
714
+ return ptr;
715
+ }
716
+
717
+ function takeFromExternrefTable0(idx) {
718
+ const value = wasm.__wbindgen_externrefs.get(idx);
719
+ wasm.__externref_table_dealloc(idx);
720
+ return value;
721
+ }
722
+
723
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
724
+ cachedTextDecoder.decode();
725
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
726
+ let numBytesDecoded = 0;
727
+ function decodeText(ptr, len) {
728
+ numBytesDecoded += len;
729
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
730
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
731
+ cachedTextDecoder.decode();
732
+ numBytesDecoded = len;
257
733
  }
734
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
735
+ }
736
+
737
+ const cachedTextEncoder = new TextEncoder();
738
+
739
+ if (!('encodeInto' in cachedTextEncoder)) {
740
+ cachedTextEncoder.encodeInto = function (arg, view) {
741
+ const buf = cachedTextEncoder.encode(arg);
742
+ view.set(buf);
743
+ return {
744
+ read: arg.length,
745
+ written: buf.length
746
+ };
747
+ };
748
+ }
749
+
750
+ let WASM_VECTOR_LEN = 0;
751
+
752
+ let wasmModule, wasmInstance, wasm;
753
+ function __wbg_finalize_init(instance, module) {
754
+ wasmInstance = instance;
755
+ wasm = instance.exports;
756
+ wasmModule = module;
757
+ cachedDataViewMemory0 = null;
758
+ cachedUint8ArrayMemory0 = null;
759
+ wasm.__wbindgen_start();
760
+ return wasm;
258
761
  }
259
762
 
260
763
  async function __wbg_load(module, imports) {
@@ -262,397 +765,41 @@ async function __wbg_load(module, imports) {
262
765
  if (typeof WebAssembly.instantiateStreaming === 'function') {
263
766
  try {
264
767
  return await WebAssembly.instantiateStreaming(module, imports);
265
-
266
768
  } catch (e) {
267
- if (module.headers.get('Content-Type') != 'application/wasm') {
769
+ const validResponse = module.ok && expectedResponseType(module.type);
770
+
771
+ if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
268
772
  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);
269
773
 
270
- } else {
271
- throw e;
272
- }
774
+ } else { throw e; }
273
775
  }
274
776
  }
275
777
 
276
778
  const bytes = await module.arrayBuffer();
277
779
  return await WebAssembly.instantiate(bytes, imports);
278
-
279
780
  } else {
280
781
  const instance = await WebAssembly.instantiate(module, imports);
281
782
 
282
783
  if (instance instanceof WebAssembly.Instance) {
283
784
  return { instance, module };
284
-
285
785
  } else {
286
786
  return instance;
287
787
  }
288
788
  }
289
- }
290
789
 
291
- function __wbg_get_imports() {
292
- const imports = {};
293
- imports.wbg = {};
294
- imports.wbg.__wbg_String_8f0eb39a4a4c2f66 = function(arg0, arg1) {
295
- const ret = String(arg1);
296
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
297
- const len1 = WASM_VECTOR_LEN;
298
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
299
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
300
- };
301
- imports.wbg.__wbg_buffer_609cc3eee51ed158 = function(arg0) {
302
- const ret = arg0.buffer;
303
- return ret;
304
- };
305
- imports.wbg.__wbg_call_672a4d21634d4a24 = function() { return handleError(function (arg0, arg1) {
306
- const ret = arg0.call(arg1);
307
- return ret;
308
- }, arguments) };
309
- imports.wbg.__wbg_call_7cccdd69e0791ae2 = function() { return handleError(function (arg0, arg1, arg2) {
310
- const ret = arg0.call(arg1, arg2);
311
- return ret;
312
- }, arguments) };
313
- imports.wbg.__wbg_createObjectURL_6e98d2f9c7bd9764 = function() { return handleError(function (arg0, arg1) {
314
- const ret = URL.createObjectURL(arg1);
315
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
316
- const len1 = WASM_VECTOR_LEN;
317
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
318
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
319
- }, arguments) };
320
- imports.wbg.__wbg_data_432d9c3df2630942 = function(arg0) {
321
- const ret = arg0.data;
322
- return ret;
323
- };
324
- imports.wbg.__wbg_done_769e5ede4b31c67b = function(arg0) {
325
- const ret = arg0.done;
326
- return ret;
327
- };
328
- imports.wbg.__wbg_entries_3265d4158b33e5dc = function(arg0) {
329
- const ret = Object.entries(arg0);
330
- return ret;
331
- };
332
- imports.wbg.__wbg_get_67b2ba62fc30de12 = function() { return handleError(function (arg0, arg1) {
333
- const ret = Reflect.get(arg0, arg1);
334
- return ret;
335
- }, arguments) };
336
- imports.wbg.__wbg_get_b9b93047fe3cf45b = function(arg0, arg1) {
337
- const ret = arg0[arg1 >>> 0];
338
- return ret;
339
- };
340
- imports.wbg.__wbg_instanceof_ArrayBuffer_e14585432e3737fc = function(arg0) {
341
- let result;
342
- try {
343
- result = arg0 instanceof ArrayBuffer;
344
- } catch (_) {
345
- result = false;
790
+ function expectedResponseType(type) {
791
+ switch (type) {
792
+ case 'basic': case 'cors': case 'default': return true;
346
793
  }
347
- const ret = result;
348
- return ret;
349
- };
350
- imports.wbg.__wbg_instanceof_Map_f3469ce2244d2430 = function(arg0) {
351
- let result;
352
- try {
353
- result = arg0 instanceof Map;
354
- } catch (_) {
355
- result = false;
356
- }
357
- const ret = result;
358
- return ret;
359
- };
360
- imports.wbg.__wbg_instanceof_Uint8Array_17156bcf118086a9 = function(arg0) {
361
- let result;
362
- try {
363
- result = arg0 instanceof Uint8Array;
364
- } catch (_) {
365
- result = false;
366
- }
367
- const ret = result;
368
- return ret;
369
- };
370
- imports.wbg.__wbg_isArray_a1eab7e0d067391b = function(arg0) {
371
- const ret = Array.isArray(arg0);
372
- return ret;
373
- };
374
- imports.wbg.__wbg_isSafeInteger_343e2beeeece1bb0 = function(arg0) {
375
- const ret = Number.isSafeInteger(arg0);
376
- return ret;
377
- };
378
- imports.wbg.__wbg_iterator_9a24c88df860dc65 = function() {
379
- const ret = Symbol.iterator;
380
- return ret;
381
- };
382
- imports.wbg.__wbg_length_a446193dc22c12f8 = function(arg0) {
383
- const ret = arg0.length;
384
- return ret;
385
- };
386
- imports.wbg.__wbg_length_e2d2a49132c1b256 = function(arg0) {
387
- const ret = arg0.length;
388
- return ret;
389
- };
390
- imports.wbg.__wbg_new_23a2665fac83c611 = function(arg0, arg1) {
391
- try {
392
- var state0 = {a: arg0, b: arg1};
393
- var cb0 = (arg0, arg1) => {
394
- const a = state0.a;
395
- state0.a = 0;
396
- try {
397
- return __wbg_adapter_91(a, state0.b, arg0, arg1);
398
- } finally {
399
- state0.a = a;
400
- }
401
- };
402
- const ret = new Promise(cb0);
403
- return ret;
404
- } finally {
405
- state0.a = state0.b = 0;
406
- }
407
- };
408
- imports.wbg.__wbg_new_405e22f390576ce2 = function() {
409
- const ret = new Object();
410
- return ret;
411
- };
412
- imports.wbg.__wbg_new_78feb108b6472713 = function() {
413
- const ret = new Array();
414
- return ret;
415
- };
416
- imports.wbg.__wbg_new_a12002a7f91c75be = function(arg0) {
417
- const ret = new Uint8Array(arg0);
418
- return ret;
419
- };
420
- imports.wbg.__wbg_new_b1a33e5095abf678 = function() { return handleError(function (arg0, arg1) {
421
- const ret = new Worker(getStringFromWasm0(arg0, arg1));
422
- return ret;
423
- }, arguments) };
424
- imports.wbg.__wbg_newnoargs_105ed471475aaf50 = function(arg0, arg1) {
425
- const ret = new Function(getStringFromWasm0(arg0, arg1));
426
- return ret;
427
- };
428
- imports.wbg.__wbg_newwithstrsequenceandoptions_aaff55b467c81b63 = function() { return handleError(function (arg0, arg1) {
429
- const ret = new Blob(arg0, arg1);
430
- return ret;
431
- }, arguments) };
432
- imports.wbg.__wbg_next_25feadfc0913fea9 = function(arg0) {
433
- const ret = arg0.next;
434
- return ret;
435
- };
436
- imports.wbg.__wbg_next_6574e1a8a62d1055 = function() { return handleError(function (arg0) {
437
- const ret = arg0.next();
438
- return ret;
439
- }, arguments) };
440
- imports.wbg.__wbg_postMessage_6edafa8f7b9c2f52 = function() { return handleError(function (arg0, arg1) {
441
- arg0.postMessage(arg1);
442
- }, arguments) };
443
- imports.wbg.__wbg_push_737cfc8c1432c2c6 = function(arg0, arg1) {
444
- const ret = arg0.push(arg1);
445
- return ret;
446
- };
447
- imports.wbg.__wbg_queueMicrotask_97d92b4fcc8a61c5 = function(arg0) {
448
- queueMicrotask(arg0);
449
- };
450
- imports.wbg.__wbg_queueMicrotask_d3219def82552485 = function(arg0) {
451
- const ret = arg0.queueMicrotask;
452
- return ret;
453
- };
454
- imports.wbg.__wbg_resolve_4851785c9c5f573d = function(arg0) {
455
- const ret = Promise.resolve(arg0);
456
- return ret;
457
- };
458
- imports.wbg.__wbg_revokeObjectURL_27267efebeb457c7 = function() { return handleError(function (arg0, arg1) {
459
- URL.revokeObjectURL(getStringFromWasm0(arg0, arg1));
460
- }, arguments) };
461
- imports.wbg.__wbg_set_3f1d0b984ed272ed = function(arg0, arg1, arg2) {
462
- arg0[arg1] = arg2;
463
- };
464
- imports.wbg.__wbg_set_65595bdd868b3009 = function(arg0, arg1, arg2) {
465
- arg0.set(arg1, arg2 >>> 0);
466
- };
467
- imports.wbg.__wbg_set_bb8cecf6a62b9f46 = function() { return handleError(function (arg0, arg1, arg2) {
468
- const ret = Reflect.set(arg0, arg1, arg2);
469
- return ret;
470
- }, arguments) };
471
- imports.wbg.__wbg_setonmessage_5a885b16bdc6dca6 = function(arg0, arg1) {
472
- arg0.onmessage = arg1;
473
- };
474
- imports.wbg.__wbg_settype_39ed370d3edd403c = function(arg0, arg1, arg2) {
475
- arg0.type = getStringFromWasm0(arg1, arg2);
476
- };
477
- imports.wbg.__wbg_sqlitewasmdatabase_new = function(arg0) {
478
- const ret = SQLiteWasmDatabase.__wrap(arg0);
479
- return ret;
480
- };
481
- imports.wbg.__wbg_static_accessor_GLOBAL_88a902d13a557d07 = function() {
482
- const ret = typeof global === 'undefined' ? null : global;
483
- return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
484
- };
485
- imports.wbg.__wbg_static_accessor_GLOBAL_THIS_56578be7e9f832b0 = function() {
486
- const ret = typeof globalThis === 'undefined' ? null : globalThis;
487
- return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
488
- };
489
- imports.wbg.__wbg_static_accessor_SELF_37c5d418e4bf5819 = function() {
490
- const ret = typeof self === 'undefined' ? null : self;
491
- return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
492
- };
493
- imports.wbg.__wbg_static_accessor_WINDOW_5de37043a91a9c40 = function() {
494
- const ret = typeof window === 'undefined' ? null : window;
495
- return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
496
- };
497
- imports.wbg.__wbg_then_44b73946d2fb3e7d = function(arg0, arg1) {
498
- const ret = arg0.then(arg1);
499
- return ret;
500
- };
501
- imports.wbg.__wbg_then_48b406749878a531 = function(arg0, arg1, arg2) {
502
- const ret = arg0.then(arg1, arg2);
503
- return ret;
504
- };
505
- imports.wbg.__wbg_toString_b5d4438bc26b267c = function() { return handleError(function (arg0, arg1) {
506
- const ret = arg0.toString(arg1);
507
- return ret;
508
- }, arguments) };
509
- imports.wbg.__wbg_value_cd1ffa7b1ab794f1 = function(arg0) {
510
- const ret = arg0.value;
511
- return ret;
512
- };
513
- imports.wbg.__wbindgen_bigint_from_i64 = function(arg0) {
514
- const ret = arg0;
515
- return ret;
516
- };
517
- imports.wbg.__wbindgen_bigint_from_u64 = function(arg0) {
518
- const ret = BigInt.asUintN(64, arg0);
519
- return ret;
520
- };
521
- imports.wbg.__wbindgen_bigint_get_as_i64 = function(arg0, arg1) {
522
- const v = arg1;
523
- const ret = typeof(v) === 'bigint' ? v : undefined;
524
- getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
525
- getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
526
- };
527
- imports.wbg.__wbindgen_boolean_get = function(arg0) {
528
- const v = arg0;
529
- const ret = typeof(v) === 'boolean' ? (v ? 1 : 0) : 2;
530
- return ret;
531
- };
532
- imports.wbg.__wbindgen_cb_drop = function(arg0) {
533
- const obj = arg0.original;
534
- if (obj.cnt-- == 1) {
535
- obj.a = 0;
536
- return true;
537
- }
538
- const ret = false;
539
- return ret;
540
- };
541
- imports.wbg.__wbindgen_closure_wrapper1061 = function(arg0, arg1, arg2) {
542
- const ret = makeMutClosure(arg0, arg1, 49, __wbg_adapter_50);
543
- return ret;
544
- };
545
- imports.wbg.__wbindgen_closure_wrapper77 = function(arg0, arg1, arg2) {
546
- const ret = makeMutClosure(arg0, arg1, 3, __wbg_adapter_50);
547
- return ret;
548
- };
549
- imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
550
- const ret = debugString(arg1);
551
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
552
- const len1 = WASM_VECTOR_LEN;
553
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
554
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
555
- };
556
- imports.wbg.__wbindgen_error_new = function(arg0, arg1) {
557
- const ret = new Error(getStringFromWasm0(arg0, arg1));
558
- return ret;
559
- };
560
- imports.wbg.__wbindgen_in = function(arg0, arg1) {
561
- const ret = arg0 in arg1;
562
- return ret;
563
- };
564
- imports.wbg.__wbindgen_init_externref_table = function() {
565
- const table = wasm.__wbindgen_export_4;
566
- const offset = table.grow(4);
567
- table.set(0, undefined);
568
- table.set(offset + 0, undefined);
569
- table.set(offset + 1, null);
570
- table.set(offset + 2, true);
571
- table.set(offset + 3, false);
572
- ;
573
- };
574
- imports.wbg.__wbindgen_is_bigint = function(arg0) {
575
- const ret = typeof(arg0) === 'bigint';
576
- return ret;
577
- };
578
- imports.wbg.__wbindgen_is_function = function(arg0) {
579
- const ret = typeof(arg0) === 'function';
580
- return ret;
581
- };
582
- imports.wbg.__wbindgen_is_null = function(arg0) {
583
- const ret = arg0 === null;
584
- return ret;
585
- };
586
- imports.wbg.__wbindgen_is_object = function(arg0) {
587
- const val = arg0;
588
- const ret = typeof(val) === 'object' && val !== null;
589
- return ret;
590
- };
591
- imports.wbg.__wbindgen_is_undefined = function(arg0) {
592
- const ret = arg0 === undefined;
593
- return ret;
594
- };
595
- imports.wbg.__wbindgen_jsval_eq = function(arg0, arg1) {
596
- const ret = arg0 === arg1;
597
- return ret;
598
- };
599
- imports.wbg.__wbindgen_jsval_loose_eq = function(arg0, arg1) {
600
- const ret = arg0 == arg1;
601
- return ret;
602
- };
603
- imports.wbg.__wbindgen_memory = function() {
604
- const ret = wasm.memory;
605
- return ret;
606
- };
607
- imports.wbg.__wbindgen_number_get = function(arg0, arg1) {
608
- const obj = arg1;
609
- const ret = typeof(obj) === 'number' ? obj : undefined;
610
- getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
611
- getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
612
- };
613
- imports.wbg.__wbindgen_number_new = function(arg0) {
614
- const ret = arg0;
615
- return ret;
616
- };
617
- imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
618
- const obj = arg1;
619
- const ret = typeof(obj) === 'string' ? obj : undefined;
620
- var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
621
- var len1 = WASM_VECTOR_LEN;
622
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
623
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
624
- };
625
- imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
626
- const ret = getStringFromWasm0(arg0, arg1);
627
- return ret;
628
- };
629
- imports.wbg.__wbindgen_throw = function(arg0, arg1) {
630
- throw new Error(getStringFromWasm0(arg0, arg1));
631
- };
632
-
633
- return imports;
634
- }
635
-
636
- function __wbg_init_memory(imports, memory) {
637
-
638
- }
639
-
640
- function __wbg_finalize_init(instance, module) {
641
- wasm = instance.exports;
642
- __wbg_init.__wbindgen_wasm_module = module;
643
- cachedDataViewMemory0 = null;
644
- cachedUint8ArrayMemory0 = null;
645
-
646
-
647
- wasm.__wbindgen_start();
648
- return wasm;
794
+ return false;
795
+ }
649
796
  }
650
797
 
651
798
  function initSync(module) {
652
799
  if (wasm !== undefined) return wasm;
653
800
 
654
801
 
655
- if (typeof module !== 'undefined') {
802
+ if (module !== undefined) {
656
803
  if (Object.getPrototypeOf(module) === Object.prototype) {
657
804
  ({module} = module)
658
805
  } else {
@@ -661,15 +808,10 @@ function initSync(module) {
661
808
  }
662
809
 
663
810
  const imports = __wbg_get_imports();
664
-
665
- __wbg_init_memory(imports);
666
-
667
811
  if (!(module instanceof WebAssembly.Module)) {
668
812
  module = new WebAssembly.Module(module);
669
813
  }
670
-
671
814
  const instance = new WebAssembly.Instance(module, imports);
672
-
673
815
  return __wbg_finalize_init(instance, module);
674
816
  }
675
817
 
@@ -677,7 +819,7 @@ async function __wbg_init(module_or_path) {
677
819
  if (wasm !== undefined) return wasm;
678
820
 
679
821
 
680
- if (typeof module_or_path !== 'undefined') {
822
+ if (module_or_path !== undefined) {
681
823
  if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
682
824
  ({module_or_path} = module_or_path)
683
825
  } else {
@@ -685,7 +827,7 @@ async function __wbg_init(module_or_path) {
685
827
  }
686
828
  }
687
829
 
688
- if (typeof module_or_path === 'undefined') {
830
+ if (module_or_path === undefined) {
689
831
  module_or_path = new URL('sqlite_web_bg.wasm', import.meta.url);
690
832
  }
691
833
  const imports = __wbg_get_imports();
@@ -694,12 +836,9 @@ async function __wbg_init(module_or_path) {
694
836
  module_or_path = fetch(module_or_path);
695
837
  }
696
838
 
697
- __wbg_init_memory(imports);
698
-
699
839
  const { instance, module } = await __wbg_load(await module_or_path, imports);
700
840
 
701
841
  return __wbg_finalize_init(instance, module);
702
842
  }
703
843
 
704
- export { initSync };
705
- export default __wbg_init;
844
+ export { initSync, __wbg_init as default };