@trust0/ridb-core 1.7.14 → 1.7.16

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.
@@ -0,0 +1,3080 @@
1
+ // pkg/ridb_core.js
2
+ var wasm;
3
+ var heap = new Array(128).fill(void 0);
4
+ heap.push(void 0, null, true, false);
5
+ function getObject(idx) {
6
+ return heap[idx];
7
+ }
8
+ var heap_next = heap.length;
9
+ function dropObject(idx) {
10
+ if (idx < 132) return;
11
+ heap[idx] = heap_next;
12
+ heap_next = idx;
13
+ }
14
+ function takeObject(idx) {
15
+ const ret = getObject(idx);
16
+ dropObject(idx);
17
+ return ret;
18
+ }
19
+ var cachedTextDecoder = typeof TextDecoder !== "undefined" ? new TextDecoder("utf-8", { ignoreBOM: true, fatal: true }) : { decode: () => {
20
+ throw Error("TextDecoder not available");
21
+ } };
22
+ if (typeof TextDecoder !== "undefined") {
23
+ cachedTextDecoder.decode();
24
+ }
25
+ var cachedUint8Memory0 = null;
26
+ function getUint8Memory0() {
27
+ if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) {
28
+ cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer);
29
+ }
30
+ return cachedUint8Memory0;
31
+ }
32
+ function getStringFromWasm0(ptr, len) {
33
+ ptr = ptr >>> 0;
34
+ return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
35
+ }
36
+ function addHeapObject(obj) {
37
+ if (heap_next === heap.length) heap.push(heap.length + 1);
38
+ const idx = heap_next;
39
+ heap_next = heap[idx];
40
+ heap[idx] = obj;
41
+ return idx;
42
+ }
43
+ var WASM_VECTOR_LEN = 0;
44
+ var cachedTextEncoder = typeof TextEncoder !== "undefined" ? new TextEncoder("utf-8") : { encode: () => {
45
+ throw Error("TextEncoder not available");
46
+ } };
47
+ var encodeString = typeof cachedTextEncoder.encodeInto === "function" ? function(arg, view) {
48
+ return cachedTextEncoder.encodeInto(arg, view);
49
+ } : function(arg, view) {
50
+ const buf = cachedTextEncoder.encode(arg);
51
+ view.set(buf);
52
+ return {
53
+ read: arg.length,
54
+ written: buf.length
55
+ };
56
+ };
57
+ function passStringToWasm0(arg, malloc, realloc) {
58
+ if (realloc === void 0) {
59
+ const buf = cachedTextEncoder.encode(arg);
60
+ const ptr2 = malloc(buf.length, 1) >>> 0;
61
+ getUint8Memory0().subarray(ptr2, ptr2 + buf.length).set(buf);
62
+ WASM_VECTOR_LEN = buf.length;
63
+ return ptr2;
64
+ }
65
+ let len = arg.length;
66
+ let ptr = malloc(len, 1) >>> 0;
67
+ const mem = getUint8Memory0();
68
+ let offset = 0;
69
+ for (; offset < len; offset++) {
70
+ const code = arg.charCodeAt(offset);
71
+ if (code > 127) break;
72
+ mem[ptr + offset] = code;
73
+ }
74
+ if (offset !== len) {
75
+ if (offset !== 0) {
76
+ arg = arg.slice(offset);
77
+ }
78
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
79
+ const view = getUint8Memory0().subarray(ptr + offset, ptr + len);
80
+ const ret = encodeString(arg, view);
81
+ offset += ret.written;
82
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
83
+ }
84
+ WASM_VECTOR_LEN = offset;
85
+ return ptr;
86
+ }
87
+ function isLikeNone(x) {
88
+ return x === void 0 || x === null;
89
+ }
90
+ var cachedInt32Memory0 = null;
91
+ function getInt32Memory0() {
92
+ if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) {
93
+ cachedInt32Memory0 = new Int32Array(wasm.memory.buffer);
94
+ }
95
+ return cachedInt32Memory0;
96
+ }
97
+ var cachedFloat64Memory0 = null;
98
+ function getFloat64Memory0() {
99
+ if (cachedFloat64Memory0 === null || cachedFloat64Memory0.byteLength === 0) {
100
+ cachedFloat64Memory0 = new Float64Array(wasm.memory.buffer);
101
+ }
102
+ return cachedFloat64Memory0;
103
+ }
104
+ var cachedBigInt64Memory0 = null;
105
+ function getBigInt64Memory0() {
106
+ if (cachedBigInt64Memory0 === null || cachedBigInt64Memory0.byteLength === 0) {
107
+ cachedBigInt64Memory0 = new BigInt64Array(wasm.memory.buffer);
108
+ }
109
+ return cachedBigInt64Memory0;
110
+ }
111
+ function debugString(val) {
112
+ const type = typeof val;
113
+ if (type == "number" || type == "boolean" || val == null) {
114
+ return `${val}`;
115
+ }
116
+ if (type == "string") {
117
+ return `"${val}"`;
118
+ }
119
+ if (type == "symbol") {
120
+ const description = val.description;
121
+ if (description == null) {
122
+ return "Symbol";
123
+ } else {
124
+ return `Symbol(${description})`;
125
+ }
126
+ }
127
+ if (type == "function") {
128
+ const name = val.name;
129
+ if (typeof name == "string" && name.length > 0) {
130
+ return `Function(${name})`;
131
+ } else {
132
+ return "Function";
133
+ }
134
+ }
135
+ if (Array.isArray(val)) {
136
+ const length = val.length;
137
+ let debug = "[";
138
+ if (length > 0) {
139
+ debug += debugString(val[0]);
140
+ }
141
+ for (let i = 1; i < length; i++) {
142
+ debug += ", " + debugString(val[i]);
143
+ }
144
+ debug += "]";
145
+ return debug;
146
+ }
147
+ const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
148
+ let className;
149
+ if (builtInMatches.length > 1) {
150
+ className = builtInMatches[1];
151
+ } else {
152
+ return toString.call(val);
153
+ }
154
+ if (className == "Object") {
155
+ try {
156
+ return "Object(" + JSON.stringify(val) + ")";
157
+ } catch (_) {
158
+ return "Object";
159
+ }
160
+ }
161
+ if (val instanceof Error) {
162
+ return `${val.name}: ${val.message}
163
+ ${val.stack}`;
164
+ }
165
+ return className;
166
+ }
167
+ var CLOSURE_DTORS = typeof FinalizationRegistry === "undefined" ? { register: () => {
168
+ }, unregister: () => {
169
+ } } : new FinalizationRegistry((state) => {
170
+ wasm.__wbindgen_export_2.get(state.dtor)(state.a, state.b);
171
+ });
172
+ function makeMutClosure(arg0, arg1, dtor, f) {
173
+ const state = { a: arg0, b: arg1, cnt: 1, dtor };
174
+ const real = (...args) => {
175
+ state.cnt++;
176
+ const a = state.a;
177
+ state.a = 0;
178
+ try {
179
+ return f(a, state.b, ...args);
180
+ } finally {
181
+ if (--state.cnt === 0) {
182
+ wasm.__wbindgen_export_2.get(state.dtor)(a, state.b);
183
+ CLOSURE_DTORS.unregister(state);
184
+ } else {
185
+ state.a = a;
186
+ }
187
+ }
188
+ };
189
+ real.original = state;
190
+ CLOSURE_DTORS.register(real, state, state);
191
+ return real;
192
+ }
193
+ function __wbg_adapter_56(arg0, arg1, arg2) {
194
+ wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h8fda0c55cc3a81de(arg0, arg1, addHeapObject(arg2));
195
+ }
196
+ function makeClosure(arg0, arg1, dtor, f) {
197
+ const state = { a: arg0, b: arg1, cnt: 1, dtor };
198
+ const real = (...args) => {
199
+ state.cnt++;
200
+ try {
201
+ return f(state.a, state.b, ...args);
202
+ } finally {
203
+ if (--state.cnt === 0) {
204
+ wasm.__wbindgen_export_2.get(state.dtor)(state.a, state.b);
205
+ state.a = 0;
206
+ CLOSURE_DTORS.unregister(state);
207
+ }
208
+ }
209
+ };
210
+ real.original = state;
211
+ CLOSURE_DTORS.register(real, state, state);
212
+ return real;
213
+ }
214
+ function __wbg_adapter_59(arg0, arg1, arg2, arg3, arg4) {
215
+ try {
216
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
217
+ wasm._dyn_core__ops__function__Fn__A_B_C___Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hd6d7e1645277db8b(retptr, arg0, arg1, addHeapObject(arg2), addHeapObject(arg3), addHeapObject(arg4));
218
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
219
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
220
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
221
+ if (r2) {
222
+ throw takeObject(r1);
223
+ }
224
+ return takeObject(r0);
225
+ } finally {
226
+ wasm.__wbindgen_add_to_stack_pointer(16);
227
+ }
228
+ }
229
+ function __wbg_adapter_62(arg0, arg1, arg2) {
230
+ const ret = wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hb8ff6b112b411818(arg0, arg1, addHeapObject(arg2));
231
+ return takeObject(ret);
232
+ }
233
+ function __wbg_adapter_65(arg0, arg1, arg2) {
234
+ wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__ha88f7e4598f57d81(arg0, arg1, addHeapObject(arg2));
235
+ }
236
+ function _assertClass(instance, klass) {
237
+ if (!(instance instanceof klass)) {
238
+ throw new Error(`expected instance of ${klass.name}`);
239
+ }
240
+ return instance.ptr;
241
+ }
242
+ var cachedUint32Memory0 = null;
243
+ function getUint32Memory0() {
244
+ if (cachedUint32Memory0 === null || cachedUint32Memory0.byteLength === 0) {
245
+ cachedUint32Memory0 = new Uint32Array(wasm.memory.buffer);
246
+ }
247
+ return cachedUint32Memory0;
248
+ }
249
+ function getArrayJsValueFromWasm0(ptr, len) {
250
+ ptr = ptr >>> 0;
251
+ const mem = getUint32Memory0();
252
+ const slice = mem.subarray(ptr / 4, ptr / 4 + len);
253
+ const result = [];
254
+ for (let i = 0; i < slice.length; i++) {
255
+ result.push(takeObject(slice[i]));
256
+ }
257
+ return result;
258
+ }
259
+ var stack_pointer = 128;
260
+ function addBorrowedObject(obj) {
261
+ if (stack_pointer == 1) throw new Error("out of js stack");
262
+ heap[--stack_pointer] = obj;
263
+ return stack_pointer;
264
+ }
265
+ function main_js() {
266
+ wasm.main_js();
267
+ }
268
+ function is_debug_mode() {
269
+ const ret = wasm.is_debug_mode();
270
+ return ret !== 0;
271
+ }
272
+ function passArrayJsValueToWasm0(array, malloc) {
273
+ const ptr = malloc(array.length * 4, 4) >>> 0;
274
+ const mem = getUint32Memory0();
275
+ for (let i = 0; i < array.length; i++) {
276
+ mem[ptr / 4 + i] = addHeapObject(array[i]);
277
+ }
278
+ WASM_VECTOR_LEN = array.length;
279
+ return ptr;
280
+ }
281
+ function handleError(f, args) {
282
+ try {
283
+ return f.apply(this, args);
284
+ } catch (e) {
285
+ wasm.__wbindgen_exn_store(addHeapObject(e));
286
+ }
287
+ }
288
+ function __wbgtest_console_log(args) {
289
+ try {
290
+ wasm.__wbgtest_console_log(addBorrowedObject(args));
291
+ } finally {
292
+ heap[stack_pointer++] = void 0;
293
+ }
294
+ }
295
+ function __wbgtest_console_debug(args) {
296
+ try {
297
+ wasm.__wbgtest_console_debug(addBorrowedObject(args));
298
+ } finally {
299
+ heap[stack_pointer++] = void 0;
300
+ }
301
+ }
302
+ function __wbgtest_console_info(args) {
303
+ try {
304
+ wasm.__wbgtest_console_info(addBorrowedObject(args));
305
+ } finally {
306
+ heap[stack_pointer++] = void 0;
307
+ }
308
+ }
309
+ function __wbgtest_console_warn(args) {
310
+ try {
311
+ wasm.__wbgtest_console_warn(addBorrowedObject(args));
312
+ } finally {
313
+ heap[stack_pointer++] = void 0;
314
+ }
315
+ }
316
+ function __wbgtest_console_error(args) {
317
+ try {
318
+ wasm.__wbgtest_console_error(addBorrowedObject(args));
319
+ } finally {
320
+ heap[stack_pointer++] = void 0;
321
+ }
322
+ }
323
+ function __wbg_adapter_296(arg0, arg1) {
324
+ wasm.wasm_bindgen__convert__closures__invoke0_mut__h99a9f0884c9cd22a(arg0, arg1);
325
+ }
326
+ function __wbg_adapter_339(arg0, arg1, arg2, arg3, arg4) {
327
+ wasm.wasm_bindgen__convert__closures__invoke3_mut__h07c8feee2a4f48f8(arg0, arg1, addHeapObject(arg2), arg3, addHeapObject(arg4));
328
+ }
329
+ function __wbg_adapter_396(arg0, arg1, arg2, arg3) {
330
+ wasm.wasm_bindgen__convert__closures__invoke2_mut__h424d8c39cf909020(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
331
+ }
332
+ var Errors = Object.freeze({ Error: 0, "0": "Error", HookError: 1, "1": "HookError", QueryError: 2, "2": "QueryError", SerializationError: 3, "3": "SerializationError", ValidationError: 4, "4": "ValidationError", AuthenticationError: 5, "5": "AuthenticationError" });
333
+ var OpType = Object.freeze({
334
+ /**
335
+ * Create operation.
336
+ */
337
+ CREATE: 0,
338
+ "0": "CREATE",
339
+ /**
340
+ * Update operation.
341
+ */
342
+ UPDATE: 1,
343
+ "1": "UPDATE",
344
+ /**
345
+ * Delete operation.
346
+ */
347
+ DELETE: 2,
348
+ "2": "DELETE",
349
+ /**
350
+ * Query Operation.
351
+ */
352
+ QUERY: 3,
353
+ "3": "QUERY",
354
+ /**
355
+ * Count Operation.
356
+ */
357
+ COUNT: 4,
358
+ "4": "COUNT"
359
+ });
360
+ var BasePluginFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
361
+ }, unregister: () => {
362
+ } } : new FinalizationRegistry((ptr) => wasm.__wbg_baseplugin_free(ptr >>> 0));
363
+ var BasePlugin = class {
364
+ __destroy_into_raw() {
365
+ const ptr = this.__wbg_ptr;
366
+ this.__wbg_ptr = 0;
367
+ BasePluginFinalization.unregister(this);
368
+ return ptr;
369
+ }
370
+ free() {
371
+ const ptr = this.__destroy_into_raw();
372
+ wasm.__wbg_baseplugin_free(ptr);
373
+ }
374
+ /**
375
+ * @param {string} name
376
+ */
377
+ constructor(name) {
378
+ try {
379
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
380
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
381
+ const len0 = WASM_VECTOR_LEN;
382
+ wasm.baseplugin_new(retptr, ptr0, len0);
383
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
384
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
385
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
386
+ if (r2) {
387
+ throw takeObject(r1);
388
+ }
389
+ this.__wbg_ptr = r0 >>> 0;
390
+ return this;
391
+ } finally {
392
+ wasm.__wbindgen_add_to_stack_pointer(16);
393
+ }
394
+ }
395
+ /**
396
+ * @returns {any}
397
+ */
398
+ get name() {
399
+ const ret = wasm.baseplugin_name(this.__wbg_ptr);
400
+ return takeObject(ret);
401
+ }
402
+ /**
403
+ * @returns {any}
404
+ */
405
+ get docCreateHook() {
406
+ const ret = wasm.baseplugin_get_doc_create_hook(this.__wbg_ptr);
407
+ return takeObject(ret);
408
+ }
409
+ /**
410
+ * @returns {any}
411
+ */
412
+ get docRecoverHook() {
413
+ const ret = wasm.baseplugin_get_doc_recover_hook(this.__wbg_ptr);
414
+ return takeObject(ret);
415
+ }
416
+ /**
417
+ * @param {any} hook
418
+ */
419
+ set docCreateHook(hook) {
420
+ wasm.baseplugin_set_doc_create_hook(this.__wbg_ptr, addHeapObject(hook));
421
+ }
422
+ /**
423
+ * @param {any} hook
424
+ */
425
+ set docRecoverHook(hook) {
426
+ wasm.baseplugin_set_doc_recover_hook(this.__wbg_ptr, addHeapObject(hook));
427
+ }
428
+ };
429
+ var BaseStorageFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
430
+ }, unregister: () => {
431
+ } } : new FinalizationRegistry((ptr) => wasm.__wbg_basestorage_free(ptr >>> 0));
432
+ var BaseStorage = class {
433
+ __destroy_into_raw() {
434
+ const ptr = this.__wbg_ptr;
435
+ this.__wbg_ptr = 0;
436
+ BaseStorageFinalization.unregister(this);
437
+ return ptr;
438
+ }
439
+ free() {
440
+ const ptr = this.__destroy_into_raw();
441
+ wasm.__wbg_basestorage_free(ptr);
442
+ }
443
+ /**
444
+ * Creates a new `BaseStorage` instance with the provided name and schema type.
445
+ *
446
+ * # Arguments
447
+ *
448
+ * * `name` - The name of the storage.
449
+ * * `schema_type` - The schema type in `JsValue` format.
450
+ *
451
+ * # Returns
452
+ *
453
+ * * `Result<BaseStorage, JsValue>` - A result containing the new `BaseStorage` instance or an error.
454
+ * @param {string} name
455
+ * @param {object} schemas_js
456
+ * @param {object | undefined} [options]
457
+ */
458
+ constructor(name, schemas_js, options) {
459
+ try {
460
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
461
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
462
+ const len0 = WASM_VECTOR_LEN;
463
+ wasm.basestorage_new(retptr, ptr0, len0, addHeapObject(schemas_js), isLikeNone(options) ? 0 : addHeapObject(options));
464
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
465
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
466
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
467
+ if (r2) {
468
+ throw takeObject(r1);
469
+ }
470
+ this.__wbg_ptr = r0 >>> 0;
471
+ return this;
472
+ } finally {
473
+ wasm.__wbindgen_add_to_stack_pointer(16);
474
+ }
475
+ }
476
+ /**
477
+ * @returns {any}
478
+ */
479
+ addIndexSchemas() {
480
+ try {
481
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
482
+ wasm.basestorage_addIndexSchemas(retptr, this.__wbg_ptr);
483
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
484
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
485
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
486
+ if (r2) {
487
+ throw takeObject(r1);
488
+ }
489
+ return takeObject(r0);
490
+ } finally {
491
+ wasm.__wbindgen_add_to_stack_pointer(16);
492
+ }
493
+ }
494
+ /**
495
+ * @param {string} name
496
+ * @returns {any}
497
+ */
498
+ getOption(name) {
499
+ try {
500
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
501
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
502
+ const len0 = WASM_VECTOR_LEN;
503
+ wasm.basestorage_getOption(retptr, this.__wbg_ptr, ptr0, len0);
504
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
505
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
506
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
507
+ if (r2) {
508
+ throw takeObject(r1);
509
+ }
510
+ return takeObject(r0);
511
+ } finally {
512
+ wasm.__wbindgen_add_to_stack_pointer(16);
513
+ }
514
+ }
515
+ /**
516
+ * @param {string} name
517
+ * @returns {Schema}
518
+ */
519
+ getSchema(name) {
520
+ try {
521
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
522
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
523
+ const len0 = WASM_VECTOR_LEN;
524
+ wasm.basestorage_getSchema(retptr, this.__wbg_ptr, ptr0, len0);
525
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
526
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
527
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
528
+ if (r2) {
529
+ throw takeObject(r1);
530
+ }
531
+ return Schema.__wrap(r0);
532
+ } finally {
533
+ wasm.__wbindgen_add_to_stack_pointer(16);
534
+ }
535
+ }
536
+ /**
537
+ * @returns {CoreStorage}
538
+ */
539
+ get core() {
540
+ try {
541
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
542
+ wasm.basestorage_core(retptr, this.__wbg_ptr);
543
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
544
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
545
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
546
+ if (r2) {
547
+ throw takeObject(r1);
548
+ }
549
+ return CoreStorage.__wrap(r0);
550
+ } finally {
551
+ wasm.__wbindgen_add_to_stack_pointer(16);
552
+ }
553
+ }
554
+ };
555
+ var CollectionFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
556
+ }, unregister: () => {
557
+ } } : new FinalizationRegistry((ptr) => wasm.__wbg_collection_free(ptr >>> 0));
558
+ var Collection = class _Collection {
559
+ static __wrap(ptr) {
560
+ ptr = ptr >>> 0;
561
+ const obj = Object.create(_Collection.prototype);
562
+ obj.__wbg_ptr = ptr;
563
+ CollectionFinalization.register(obj, obj.__wbg_ptr, obj);
564
+ return obj;
565
+ }
566
+ __destroy_into_raw() {
567
+ const ptr = this.__wbg_ptr;
568
+ this.__wbg_ptr = 0;
569
+ CollectionFinalization.unregister(this);
570
+ return ptr;
571
+ }
572
+ free() {
573
+ const ptr = this.__destroy_into_raw();
574
+ wasm.__wbg_collection_free(ptr);
575
+ }
576
+ /**
577
+ * @returns {string}
578
+ */
579
+ get name() {
580
+ let deferred1_0;
581
+ let deferred1_1;
582
+ try {
583
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
584
+ wasm.collection_name(retptr, this.__wbg_ptr);
585
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
586
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
587
+ deferred1_0 = r0;
588
+ deferred1_1 = r1;
589
+ return getStringFromWasm0(r0, r1);
590
+ } finally {
591
+ wasm.__wbindgen_add_to_stack_pointer(16);
592
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
593
+ }
594
+ }
595
+ /**
596
+ * @returns {Schema}
597
+ */
598
+ get schema() {
599
+ try {
600
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
601
+ wasm.collection_schema(retptr, this.__wbg_ptr);
602
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
603
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
604
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
605
+ if (r2) {
606
+ throw takeObject(r1);
607
+ }
608
+ return Schema.__wrap(r0);
609
+ } finally {
610
+ wasm.__wbindgen_add_to_stack_pointer(16);
611
+ }
612
+ }
613
+ /**
614
+ * Finds and returns all documents in the collection.
615
+ *
616
+ * This function is asynchronous and returns a `JsValue` representing
617
+ * the documents found in the collection.
618
+ * @param {any} query_js
619
+ * @param {any} options_js
620
+ * @returns {Promise<any>}
621
+ */
622
+ find(query_js, options_js) {
623
+ const ret = wasm.collection_find(this.__wbg_ptr, addHeapObject(query_js), addHeapObject(options_js));
624
+ return takeObject(ret);
625
+ }
626
+ /**
627
+ * @param {any} options
628
+ * @returns {QueryOptions}
629
+ */
630
+ parse_query_options(options) {
631
+ try {
632
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
633
+ wasm.collection_parse_query_options(retptr, this.__wbg_ptr, addHeapObject(options));
634
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
635
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
636
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
637
+ if (r2) {
638
+ throw takeObject(r1);
639
+ }
640
+ return QueryOptions.__wrap(r0);
641
+ } finally {
642
+ wasm.__wbindgen_add_to_stack_pointer(16);
643
+ }
644
+ }
645
+ /**
646
+ * counts and returns all documents in the collection.
647
+ *
648
+ * This function is asynchronous and returns a `Schema` representing
649
+ * the documents found in the collection.
650
+ * @param {any} query_js
651
+ * @param {any} options_js
652
+ * @returns {Promise<any>}
653
+ */
654
+ count(query_js, options_js) {
655
+ const ret = wasm.collection_count(this.__wbg_ptr, addHeapObject(query_js), addHeapObject(options_js));
656
+ return takeObject(ret);
657
+ }
658
+ /**
659
+ * Finds and returns a single document in the collection by its ID.
660
+ *
661
+ * This function is asynchronous.
662
+ * @param {any} primary_key
663
+ * @returns {Promise<any>}
664
+ */
665
+ findById(primary_key) {
666
+ const ret = wasm.collection_findById(this.__wbg_ptr, addHeapObject(primary_key));
667
+ return takeObject(ret);
668
+ }
669
+ /**
670
+ * Updates a document in the collection with the given data.
671
+ *
672
+ * This function is asynchronous and returns a `Result` indicating success or failure.
673
+ *
674
+ * # Arguments
675
+ *
676
+ * * `document` - A `JsValue` representing the partial document to update.
677
+ * @param {any} document
678
+ * @returns {Promise<any>}
679
+ */
680
+ update(document2) {
681
+ const ret = wasm.collection_update(this.__wbg_ptr, addHeapObject(document2));
682
+ return takeObject(ret);
683
+ }
684
+ /**
685
+ * Creates a new document in the collection.
686
+ *
687
+ * This function is asynchronous and returns a `Result` indicating success or failure.
688
+ *
689
+ * # Arguments
690
+ *
691
+ * * `document` - A `JsValue` representing the document to create.
692
+ * @param {any} document
693
+ * @returns {Promise<any>}
694
+ */
695
+ create(document2) {
696
+ const ret = wasm.collection_create(this.__wbg_ptr, addHeapObject(document2));
697
+ return takeObject(ret);
698
+ }
699
+ /**
700
+ * Deletes a document from the collection by its ID.
701
+ *
702
+ * This function is asynchronous.
703
+ * @param {any} primary_key
704
+ * @returns {Promise<any>}
705
+ */
706
+ delete(primary_key) {
707
+ const ret = wasm.collection_delete(this.__wbg_ptr, addHeapObject(primary_key));
708
+ return takeObject(ret);
709
+ }
710
+ };
711
+ var CoreStorageFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
712
+ }, unregister: () => {
713
+ } } : new FinalizationRegistry((ptr) => wasm.__wbg_corestorage_free(ptr >>> 0));
714
+ var CoreStorage = class _CoreStorage {
715
+ static __wrap(ptr) {
716
+ ptr = ptr >>> 0;
717
+ const obj = Object.create(_CoreStorage.prototype);
718
+ obj.__wbg_ptr = ptr;
719
+ CoreStorageFinalization.register(obj, obj.__wbg_ptr, obj);
720
+ return obj;
721
+ }
722
+ __destroy_into_raw() {
723
+ const ptr = this.__wbg_ptr;
724
+ this.__wbg_ptr = 0;
725
+ CoreStorageFinalization.unregister(this);
726
+ return ptr;
727
+ }
728
+ free() {
729
+ const ptr = this.__destroy_into_raw();
730
+ wasm.__wbg_corestorage_free(ptr);
731
+ }
732
+ /**
733
+ */
734
+ constructor() {
735
+ const ret = wasm.corestorage_new();
736
+ this.__wbg_ptr = ret >>> 0;
737
+ return this;
738
+ }
739
+ /**
740
+ * @param {any} value
741
+ * @returns {string}
742
+ */
743
+ getPrimaryKeyTyped(value) {
744
+ let deferred2_0;
745
+ let deferred2_1;
746
+ try {
747
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
748
+ wasm.corestorage_getPrimaryKeyTyped(retptr, this.__wbg_ptr, addHeapObject(value));
749
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
750
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
751
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
752
+ var r3 = getInt32Memory0()[retptr / 4 + 3];
753
+ var ptr1 = r0;
754
+ var len1 = r1;
755
+ if (r3) {
756
+ ptr1 = 0;
757
+ len1 = 0;
758
+ throw takeObject(r2);
759
+ }
760
+ deferred2_0 = ptr1;
761
+ deferred2_1 = len1;
762
+ return getStringFromWasm0(ptr1, len1);
763
+ } finally {
764
+ wasm.__wbindgen_add_to_stack_pointer(16);
765
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
766
+ }
767
+ }
768
+ /**
769
+ * @param {Schema} schema
770
+ * @param {Operation} op
771
+ * @returns {(string)[]}
772
+ */
773
+ getIndexes(schema, op) {
774
+ try {
775
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
776
+ _assertClass(schema, Schema);
777
+ _assertClass(op, Operation);
778
+ wasm.corestorage_getIndexes(retptr, this.__wbg_ptr, schema.__wbg_ptr, op.__wbg_ptr);
779
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
780
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
781
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
782
+ var r3 = getInt32Memory0()[retptr / 4 + 3];
783
+ if (r3) {
784
+ throw takeObject(r2);
785
+ }
786
+ var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
787
+ wasm.__wbindgen_free(r0, r1 * 4, 4);
788
+ return v1;
789
+ } finally {
790
+ wasm.__wbindgen_add_to_stack_pointer(16);
791
+ }
792
+ }
793
+ /**
794
+ * @param {any} document
795
+ * @param {Query} query
796
+ * @returns {boolean}
797
+ */
798
+ matchesQuery(document2, query) {
799
+ try {
800
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
801
+ _assertClass(query, Query);
802
+ var ptr0 = query.__destroy_into_raw();
803
+ wasm.corestorage_matchesQuery(retptr, this.__wbg_ptr, addBorrowedObject(document2), ptr0);
804
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
805
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
806
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
807
+ if (r2) {
808
+ throw takeObject(r1);
809
+ }
810
+ return r0 !== 0;
811
+ } finally {
812
+ wasm.__wbindgen_add_to_stack_pointer(16);
813
+ heap[stack_pointer++] = void 0;
814
+ }
815
+ }
816
+ };
817
+ var DatabaseFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
818
+ }, unregister: () => {
819
+ } } : new FinalizationRegistry((ptr) => wasm.__wbg_database_free(ptr >>> 0));
820
+ var Database = class _Database {
821
+ static __wrap(ptr) {
822
+ ptr = ptr >>> 0;
823
+ const obj = Object.create(_Database.prototype);
824
+ obj.__wbg_ptr = ptr;
825
+ DatabaseFinalization.register(obj, obj.__wbg_ptr, obj);
826
+ return obj;
827
+ }
828
+ __destroy_into_raw() {
829
+ const ptr = this.__wbg_ptr;
830
+ this.__wbg_ptr = 0;
831
+ DatabaseFinalization.unregister(this);
832
+ return ptr;
833
+ }
834
+ free() {
835
+ const ptr = this.__destroy_into_raw();
836
+ wasm.__wbg_database_free(ptr);
837
+ }
838
+ /**
839
+ * @returns {Promise<any>}
840
+ */
841
+ start() {
842
+ const ret = wasm.database_start(this.__wbg_ptr);
843
+ return takeObject(ret);
844
+ }
845
+ /**
846
+ * @returns {Promise<any>}
847
+ */
848
+ close() {
849
+ const ptr = this.__destroy_into_raw();
850
+ const ret = wasm.database_close(ptr);
851
+ return takeObject(ret);
852
+ }
853
+ /**
854
+ * @returns {boolean}
855
+ */
856
+ get started() {
857
+ const ret = wasm.database_started(this.__wbg_ptr);
858
+ return ret !== 0;
859
+ }
860
+ /**
861
+ * @param {string} password
862
+ * @returns {Promise<boolean>}
863
+ */
864
+ authenticate(password) {
865
+ const ptr0 = passStringToWasm0(password, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
866
+ const len0 = WASM_VECTOR_LEN;
867
+ const ret = wasm.database_authenticate(this.__wbg_ptr, ptr0, len0);
868
+ return takeObject(ret);
869
+ }
870
+ /**
871
+ * Retrieves the collections in the database.
872
+ *
873
+ * This function returns an `Object` containing the collections.
874
+ *
875
+ * # Returns
876
+ *
877
+ * * `Result<Object, JsValue>` - A result containing an `Object` with the collections or an error.
878
+ * @returns {object}
879
+ */
880
+ get collections() {
881
+ try {
882
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
883
+ wasm.database_collections(retptr, this.__wbg_ptr);
884
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
885
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
886
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
887
+ if (r2) {
888
+ throw takeObject(r1);
889
+ }
890
+ return takeObject(r0);
891
+ } finally {
892
+ wasm.__wbindgen_add_to_stack_pointer(16);
893
+ }
894
+ }
895
+ /**
896
+ * @param {string} db_name
897
+ * @param {object} schemas_js
898
+ * @param {object} migrations_js
899
+ * @param {Array<any>} plugins
900
+ * @param {any} module
901
+ * @param {string | undefined} [password]
902
+ * @param {any | undefined} [storage]
903
+ * @returns {Promise<Database>}
904
+ */
905
+ static create(db_name, schemas_js, migrations_js, plugins, module2, password, storage) {
906
+ const ptr0 = passStringToWasm0(db_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
907
+ const len0 = WASM_VECTOR_LEN;
908
+ var ptr1 = isLikeNone(password) ? 0 : passStringToWasm0(password, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
909
+ var len1 = WASM_VECTOR_LEN;
910
+ const ret = wasm.database_create(ptr0, len0, addHeapObject(schemas_js), addHeapObject(migrations_js), addHeapObject(plugins), addHeapObject(module2), ptr1, len1, isLikeNone(storage) ? 0 : addHeapObject(storage));
911
+ return takeObject(ret);
912
+ }
913
+ };
914
+ var InMemoryFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
915
+ }, unregister: () => {
916
+ } } : new FinalizationRegistry((ptr) => wasm.__wbg_inmemory_free(ptr >>> 0));
917
+ var InMemory = class _InMemory {
918
+ static __wrap(ptr) {
919
+ ptr = ptr >>> 0;
920
+ const obj = Object.create(_InMemory.prototype);
921
+ obj.__wbg_ptr = ptr;
922
+ InMemoryFinalization.register(obj, obj.__wbg_ptr, obj);
923
+ return obj;
924
+ }
925
+ __destroy_into_raw() {
926
+ const ptr = this.__wbg_ptr;
927
+ this.__wbg_ptr = 0;
928
+ InMemoryFinalization.unregister(this);
929
+ return ptr;
930
+ }
931
+ free() {
932
+ const ptr = this.__destroy_into_raw();
933
+ wasm.__wbg_inmemory_free(ptr);
934
+ }
935
+ /**
936
+ * @param {string} name
937
+ * @param {object} schemas_js
938
+ * @returns {Promise<InMemory>}
939
+ */
940
+ static create(name, schemas_js) {
941
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
942
+ const len0 = WASM_VECTOR_LEN;
943
+ const ret = wasm.inmemory_create(ptr0, len0, addHeapObject(schemas_js));
944
+ return takeObject(ret);
945
+ }
946
+ /**
947
+ * @param {Operation} op
948
+ * @returns {Promise<any>}
949
+ */
950
+ write(op) {
951
+ _assertClass(op, Operation);
952
+ var ptr0 = op.__destroy_into_raw();
953
+ const ret = wasm.inmemory_write(this.__wbg_ptr, ptr0);
954
+ return takeObject(ret);
955
+ }
956
+ /**
957
+ * @param {string} collection_name
958
+ * @param {any} query_js
959
+ * @param {QueryOptions} options
960
+ * @returns {Promise<any>}
961
+ */
962
+ find(collection_name, query_js, options) {
963
+ const ptr0 = passStringToWasm0(collection_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
964
+ const len0 = WASM_VECTOR_LEN;
965
+ _assertClass(options, QueryOptions);
966
+ var ptr1 = options.__destroy_into_raw();
967
+ const ret = wasm.inmemory_find(this.__wbg_ptr, ptr0, len0, addHeapObject(query_js), ptr1);
968
+ return takeObject(ret);
969
+ }
970
+ /**
971
+ * @param {string} collection_name
972
+ * @param {any} primary_key
973
+ * @returns {Promise<any>}
974
+ */
975
+ findDocumentById(collection_name, primary_key) {
976
+ const ptr0 = passStringToWasm0(collection_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
977
+ const len0 = WASM_VECTOR_LEN;
978
+ const ret = wasm.inmemory_findDocumentById(this.__wbg_ptr, ptr0, len0, addHeapObject(primary_key));
979
+ return takeObject(ret);
980
+ }
981
+ /**
982
+ * @param {string} collection_name
983
+ * @param {any} query_js
984
+ * @param {QueryOptions} options
985
+ * @returns {Promise<any>}
986
+ */
987
+ count(collection_name, query_js, options) {
988
+ const ptr0 = passStringToWasm0(collection_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
989
+ const len0 = WASM_VECTOR_LEN;
990
+ _assertClass(options, QueryOptions);
991
+ var ptr1 = options.__destroy_into_raw();
992
+ const ret = wasm.inmemory_count(this.__wbg_ptr, ptr0, len0, addHeapObject(query_js), ptr1);
993
+ return takeObject(ret);
994
+ }
995
+ /**
996
+ * @returns {Promise<any>}
997
+ */
998
+ close() {
999
+ const ret = wasm.inmemory_close(this.__wbg_ptr);
1000
+ return takeObject(ret);
1001
+ }
1002
+ /**
1003
+ * @returns {Promise<any>}
1004
+ */
1005
+ start() {
1006
+ const ret = wasm.inmemory_start(this.__wbg_ptr);
1007
+ return takeObject(ret);
1008
+ }
1009
+ };
1010
+ var IndexDBFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
1011
+ }, unregister: () => {
1012
+ } } : new FinalizationRegistry((ptr) => wasm.__wbg_indexdb_free(ptr >>> 0));
1013
+ var IndexDB = class _IndexDB {
1014
+ static __wrap(ptr) {
1015
+ ptr = ptr >>> 0;
1016
+ const obj = Object.create(_IndexDB.prototype);
1017
+ obj.__wbg_ptr = ptr;
1018
+ IndexDBFinalization.register(obj, obj.__wbg_ptr, obj);
1019
+ return obj;
1020
+ }
1021
+ __destroy_into_raw() {
1022
+ const ptr = this.__wbg_ptr;
1023
+ this.__wbg_ptr = 0;
1024
+ IndexDBFinalization.unregister(this);
1025
+ return ptr;
1026
+ }
1027
+ free() {
1028
+ const ptr = this.__destroy_into_raw();
1029
+ wasm.__wbg_indexdb_free(ptr);
1030
+ }
1031
+ /**
1032
+ * Fetch documents by opening an IndexedDB cursor (on an index or store),
1033
+ * then apply inline filtering and offset/limit constraints.
1034
+ * @returns {(string)[]}
1035
+ */
1036
+ get_stores() {
1037
+ try {
1038
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1039
+ wasm.indexdb_get_stores(retptr, this.__wbg_ptr);
1040
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1041
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1042
+ var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
1043
+ wasm.__wbindgen_free(r0, r1 * 4, 4);
1044
+ return v1;
1045
+ } finally {
1046
+ wasm.__wbindgen_add_to_stack_pointer(16);
1047
+ }
1048
+ }
1049
+ /**
1050
+ * @param {string} store_name
1051
+ * @returns {IDBObjectStore}
1052
+ */
1053
+ get_store(store_name) {
1054
+ try {
1055
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1056
+ const ptr0 = passStringToWasm0(store_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1057
+ const len0 = WASM_VECTOR_LEN;
1058
+ wasm.indexdb_get_store(retptr, this.__wbg_ptr, ptr0, len0);
1059
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1060
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1061
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
1062
+ if (r2) {
1063
+ throw takeObject(r1);
1064
+ }
1065
+ return takeObject(r0);
1066
+ } finally {
1067
+ wasm.__wbindgen_add_to_stack_pointer(16);
1068
+ }
1069
+ }
1070
+ /**
1071
+ * @param {string} name
1072
+ * @param {object} schemas_js
1073
+ * @returns {Promise<IndexDB>}
1074
+ */
1075
+ static create(name, schemas_js) {
1076
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1077
+ const len0 = WASM_VECTOR_LEN;
1078
+ const ret = wasm.indexdb_create(ptr0, len0, addHeapObject(schemas_js));
1079
+ return takeObject(ret);
1080
+ }
1081
+ /**
1082
+ * @param {Operation} op
1083
+ * @returns {Promise<any>}
1084
+ */
1085
+ write(op) {
1086
+ _assertClass(op, Operation);
1087
+ var ptr0 = op.__destroy_into_raw();
1088
+ const ret = wasm.indexdb_write(this.__wbg_ptr, ptr0);
1089
+ return takeObject(ret);
1090
+ }
1091
+ /**
1092
+ * @param {string} collection_name
1093
+ * @param {any} query
1094
+ * @param {QueryOptions} options
1095
+ * @returns {Promise<any>}
1096
+ */
1097
+ find(collection_name, query, options) {
1098
+ const ptr0 = passStringToWasm0(collection_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1099
+ const len0 = WASM_VECTOR_LEN;
1100
+ _assertClass(options, QueryOptions);
1101
+ var ptr1 = options.__destroy_into_raw();
1102
+ const ret = wasm.indexdb_find(this.__wbg_ptr, ptr0, len0, addHeapObject(query), ptr1);
1103
+ return takeObject(ret);
1104
+ }
1105
+ /**
1106
+ * @param {string} collection_name
1107
+ * @param {any} primary_key
1108
+ * @returns {Promise<any>}
1109
+ */
1110
+ findDocumentById(collection_name, primary_key) {
1111
+ const ptr0 = passStringToWasm0(collection_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1112
+ const len0 = WASM_VECTOR_LEN;
1113
+ const ret = wasm.indexdb_findDocumentById(this.__wbg_ptr, ptr0, len0, addHeapObject(primary_key));
1114
+ return takeObject(ret);
1115
+ }
1116
+ /**
1117
+ * @param {string} collection_name
1118
+ * @param {any} query
1119
+ * @param {QueryOptions} options
1120
+ * @returns {Promise<any>}
1121
+ */
1122
+ count(collection_name, query, options) {
1123
+ const ptr0 = passStringToWasm0(collection_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1124
+ const len0 = WASM_VECTOR_LEN;
1125
+ _assertClass(options, QueryOptions);
1126
+ var ptr1 = options.__destroy_into_raw();
1127
+ const ret = wasm.indexdb_count(this.__wbg_ptr, ptr0, len0, addHeapObject(query), ptr1);
1128
+ return takeObject(ret);
1129
+ }
1130
+ /**
1131
+ * @returns {Promise<any>}
1132
+ */
1133
+ close() {
1134
+ const ret = wasm.indexdb_close(this.__wbg_ptr);
1135
+ return takeObject(ret);
1136
+ }
1137
+ /**
1138
+ * @returns {Promise<any>}
1139
+ */
1140
+ start() {
1141
+ const ret = wasm.indexdb_start(this.__wbg_ptr);
1142
+ return takeObject(ret);
1143
+ }
1144
+ };
1145
+ var OperationFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
1146
+ }, unregister: () => {
1147
+ } } : new FinalizationRegistry((ptr) => wasm.__wbg_operation_free(ptr >>> 0));
1148
+ var Operation = class _Operation {
1149
+ static __wrap(ptr) {
1150
+ ptr = ptr >>> 0;
1151
+ const obj = Object.create(_Operation.prototype);
1152
+ obj.__wbg_ptr = ptr;
1153
+ OperationFinalization.register(obj, obj.__wbg_ptr, obj);
1154
+ return obj;
1155
+ }
1156
+ __destroy_into_raw() {
1157
+ const ptr = this.__wbg_ptr;
1158
+ this.__wbg_ptr = 0;
1159
+ OperationFinalization.unregister(this);
1160
+ return ptr;
1161
+ }
1162
+ free() {
1163
+ const ptr = this.__destroy_into_raw();
1164
+ wasm.__wbg_operation_free(ptr);
1165
+ }
1166
+ /**
1167
+ * Retrieves the name of the collection.
1168
+ *
1169
+ * # Returns
1170
+ *
1171
+ * * `String` - The name of the collection.
1172
+ * @returns {string}
1173
+ */
1174
+ get collection() {
1175
+ let deferred1_0;
1176
+ let deferred1_1;
1177
+ try {
1178
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1179
+ wasm.operation_collection(retptr, this.__wbg_ptr);
1180
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1181
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1182
+ deferred1_0 = r0;
1183
+ deferred1_1 = r1;
1184
+ return getStringFromWasm0(r0, r1);
1185
+ } finally {
1186
+ wasm.__wbindgen_add_to_stack_pointer(16);
1187
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1188
+ }
1189
+ }
1190
+ /**
1191
+ * Retrieves the type of operation.
1192
+ *
1193
+ * # Returns
1194
+ *
1195
+ * * `OpType` - The type of operation.
1196
+ * @returns {OpType}
1197
+ */
1198
+ get opType() {
1199
+ const ret = wasm.operation_opType(this.__wbg_ptr);
1200
+ return ret;
1201
+ }
1202
+ /**
1203
+ * Retrieves the data involved in the operation.
1204
+ *
1205
+ * # Returns
1206
+ *
1207
+ * * `JsValue` - The data involved in the operation.
1208
+ * @returns {any}
1209
+ */
1210
+ get data() {
1211
+ const ret = wasm.operation_data(this.__wbg_ptr);
1212
+ return takeObject(ret);
1213
+ }
1214
+ /**
1215
+ * Retrieves the primary key field of the current collection.
1216
+ *
1217
+ * # Returns
1218
+ *
1219
+ * * `Option<String>` - The primary key field of the current collection.
1220
+ * @returns {any}
1221
+ */
1222
+ get primaryKeyField() {
1223
+ const ret = wasm.operation_primaryKeyField(this.__wbg_ptr);
1224
+ return takeObject(ret);
1225
+ }
1226
+ /**
1227
+ * Retrieves the primary key value of the current data.
1228
+ *
1229
+ * # Returns
1230
+ *
1231
+ * * `Option<JsValue>` - The primary key value of the current data.
1232
+ * @returns {any}
1233
+ */
1234
+ get primaryKey() {
1235
+ const ret = wasm.operation_primaryKey(this.__wbg_ptr);
1236
+ return takeObject(ret);
1237
+ }
1238
+ /**
1239
+ * @returns {string}
1240
+ */
1241
+ get primaryKeyIndex() {
1242
+ let deferred2_0;
1243
+ let deferred2_1;
1244
+ try {
1245
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1246
+ wasm.operation_primaryKeyIndex(retptr, this.__wbg_ptr);
1247
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1248
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1249
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
1250
+ var r3 = getInt32Memory0()[retptr / 4 + 3];
1251
+ var ptr1 = r0;
1252
+ var len1 = r1;
1253
+ if (r3) {
1254
+ ptr1 = 0;
1255
+ len1 = 0;
1256
+ throw takeObject(r2);
1257
+ }
1258
+ deferred2_0 = ptr1;
1259
+ deferred2_1 = len1;
1260
+ return getStringFromWasm0(ptr1, len1);
1261
+ } finally {
1262
+ wasm.__wbindgen_add_to_stack_pointer(16);
1263
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
1264
+ }
1265
+ }
1266
+ };
1267
+ var PropertyFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
1268
+ }, unregister: () => {
1269
+ } } : new FinalizationRegistry((ptr) => wasm.__wbg_property_free(ptr >>> 0));
1270
+ var Property = class {
1271
+ __destroy_into_raw() {
1272
+ const ptr = this.__wbg_ptr;
1273
+ this.__wbg_ptr = 0;
1274
+ PropertyFinalization.unregister(this);
1275
+ return ptr;
1276
+ }
1277
+ free() {
1278
+ const ptr = this.__destroy_into_raw();
1279
+ wasm.__wbg_property_free(ptr);
1280
+ }
1281
+ /**
1282
+ * Checks is the schema is valid.
1283
+ *
1284
+ * # Returns
1285
+ *
1286
+ * Throws exception if not valid
1287
+ * @returns {boolean}
1288
+ */
1289
+ is_valid() {
1290
+ try {
1291
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1292
+ wasm.property_is_valid(retptr, this.__wbg_ptr);
1293
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1294
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1295
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
1296
+ if (r2) {
1297
+ throw takeObject(r1);
1298
+ }
1299
+ return r0 !== 0;
1300
+ } finally {
1301
+ wasm.__wbindgen_add_to_stack_pointer(16);
1302
+ }
1303
+ }
1304
+ /**
1305
+ * Retrieves the type of the property.
1306
+ *
1307
+ * # Returns
1308
+ *
1309
+ * * `PropertyType` - The type of the property.
1310
+ * @returns {any}
1311
+ */
1312
+ get type() {
1313
+ const ret = wasm.property_type(this.__wbg_ptr);
1314
+ return takeObject(ret);
1315
+ }
1316
+ /**
1317
+ * Retrieves the items of the property.
1318
+ *
1319
+ * # Returns
1320
+ *
1321
+ * * `Result<JsValue, JsValue>` - A result containing the items as a `JsValue` or an error.
1322
+ * @returns {any}
1323
+ */
1324
+ get items() {
1325
+ try {
1326
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1327
+ wasm.property_items(retptr, this.__wbg_ptr);
1328
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1329
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1330
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
1331
+ if (r2) {
1332
+ throw takeObject(r1);
1333
+ }
1334
+ return takeObject(r0);
1335
+ } finally {
1336
+ wasm.__wbindgen_add_to_stack_pointer(16);
1337
+ }
1338
+ }
1339
+ /**
1340
+ * Retrieves the maximum number of items of the property.
1341
+ *
1342
+ * # Returns
1343
+ *
1344
+ * * `Result<JsValue, JsValue>` - A result containing the maximum number of items as a `JsValue` or an error.
1345
+ * @returns {any}
1346
+ */
1347
+ get maxItems() {
1348
+ try {
1349
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1350
+ wasm.property_maxItems(retptr, this.__wbg_ptr);
1351
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1352
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1353
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
1354
+ if (r2) {
1355
+ throw takeObject(r1);
1356
+ }
1357
+ return takeObject(r0);
1358
+ } finally {
1359
+ wasm.__wbindgen_add_to_stack_pointer(16);
1360
+ }
1361
+ }
1362
+ /**
1363
+ * Retrieves the minimum number of items of the property.
1364
+ *
1365
+ * # Returns
1366
+ *
1367
+ * * `Result<JsValue, JsValue>` - A result containing the minimum number of items as a `JsValue` or an error.
1368
+ * @returns {any}
1369
+ */
1370
+ get minItems() {
1371
+ try {
1372
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1373
+ wasm.property_minItems(retptr, this.__wbg_ptr);
1374
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1375
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1376
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
1377
+ if (r2) {
1378
+ throw takeObject(r1);
1379
+ }
1380
+ return takeObject(r0);
1381
+ } finally {
1382
+ wasm.__wbindgen_add_to_stack_pointer(16);
1383
+ }
1384
+ }
1385
+ /**
1386
+ * Retrieves the maximum length of the property.
1387
+ *
1388
+ * # Returns
1389
+ *
1390
+ * * `Result<JsValue, JsValue>` - A result containing the maximum length as a `JsValue` or an error.
1391
+ * @returns {any}
1392
+ */
1393
+ get maxLength() {
1394
+ try {
1395
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1396
+ wasm.property_maxLength(retptr, this.__wbg_ptr);
1397
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1398
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1399
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
1400
+ if (r2) {
1401
+ throw takeObject(r1);
1402
+ }
1403
+ return takeObject(r0);
1404
+ } finally {
1405
+ wasm.__wbindgen_add_to_stack_pointer(16);
1406
+ }
1407
+ }
1408
+ /**
1409
+ * Retrieves the minimum length of the property.
1410
+ *
1411
+ * # Returns
1412
+ *
1413
+ * * `Result<JsValue, JsValue>` - A result containing the minimum length as a `JsValue` or an error.
1414
+ * @returns {any}
1415
+ */
1416
+ get minLength() {
1417
+ try {
1418
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1419
+ wasm.property_minLength(retptr, this.__wbg_ptr);
1420
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1421
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1422
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
1423
+ if (r2) {
1424
+ throw takeObject(r1);
1425
+ }
1426
+ return takeObject(r0);
1427
+ } finally {
1428
+ wasm.__wbindgen_add_to_stack_pointer(16);
1429
+ }
1430
+ }
1431
+ /**
1432
+ * Retrieves the nested properties of the property.
1433
+ *
1434
+ * # Returns
1435
+ *
1436
+ * * `Result<JsValue, JsValue>` - A result containing the nested properties as a `JsValue` or an error.
1437
+ * @returns {any}
1438
+ */
1439
+ get properties() {
1440
+ try {
1441
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1442
+ wasm.property_properties(retptr, this.__wbg_ptr);
1443
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1444
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1445
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
1446
+ if (r2) {
1447
+ throw takeObject(r1);
1448
+ }
1449
+ return takeObject(r0);
1450
+ } finally {
1451
+ wasm.__wbindgen_add_to_stack_pointer(16);
1452
+ }
1453
+ }
1454
+ };
1455
+ var QueryFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
1456
+ }, unregister: () => {
1457
+ } } : new FinalizationRegistry((ptr) => wasm.__wbg_query_free(ptr >>> 0));
1458
+ var Query = class {
1459
+ __destroy_into_raw() {
1460
+ const ptr = this.__wbg_ptr;
1461
+ this.__wbg_ptr = 0;
1462
+ QueryFinalization.unregister(this);
1463
+ return ptr;
1464
+ }
1465
+ free() {
1466
+ const ptr = this.__destroy_into_raw();
1467
+ wasm.__wbg_query_free(ptr);
1468
+ }
1469
+ /**
1470
+ * @param {any} query
1471
+ * @param {Schema} schema
1472
+ */
1473
+ constructor(query, schema) {
1474
+ try {
1475
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1476
+ _assertClass(schema, Schema);
1477
+ var ptr0 = schema.__destroy_into_raw();
1478
+ wasm.query_new(retptr, addHeapObject(query), ptr0);
1479
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1480
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1481
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
1482
+ if (r2) {
1483
+ throw takeObject(r1);
1484
+ }
1485
+ this.__wbg_ptr = r0 >>> 0;
1486
+ return this;
1487
+ } finally {
1488
+ wasm.__wbindgen_add_to_stack_pointer(16);
1489
+ }
1490
+ }
1491
+ /**
1492
+ * @returns {any}
1493
+ */
1494
+ get query() {
1495
+ try {
1496
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1497
+ wasm.query_query(retptr, this.__wbg_ptr);
1498
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1499
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1500
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
1501
+ if (r2) {
1502
+ throw takeObject(r1);
1503
+ }
1504
+ return takeObject(r0);
1505
+ } finally {
1506
+ wasm.__wbindgen_add_to_stack_pointer(16);
1507
+ }
1508
+ }
1509
+ /**
1510
+ * Returns the schema properties (fields) that are used in the query.
1511
+ * The query may contain operators like $and, $or, $gt, $lt, etc.
1512
+ * @returns {(string)[]}
1513
+ */
1514
+ get_properties() {
1515
+ try {
1516
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1517
+ wasm.query_get_properties(retptr, this.__wbg_ptr);
1518
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1519
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1520
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
1521
+ var r3 = getInt32Memory0()[retptr / 4 + 3];
1522
+ if (r3) {
1523
+ throw takeObject(r2);
1524
+ }
1525
+ var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
1526
+ wasm.__wbindgen_free(r0, r1 * 4, 4);
1527
+ return v1;
1528
+ } finally {
1529
+ wasm.__wbindgen_add_to_stack_pointer(16);
1530
+ }
1531
+ }
1532
+ /**
1533
+ * @returns {any}
1534
+ */
1535
+ parse() {
1536
+ try {
1537
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1538
+ wasm.query_parse(retptr, this.__wbg_ptr);
1539
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1540
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1541
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
1542
+ if (r2) {
1543
+ throw takeObject(r1);
1544
+ }
1545
+ return takeObject(r0);
1546
+ } finally {
1547
+ wasm.__wbindgen_add_to_stack_pointer(16);
1548
+ }
1549
+ }
1550
+ /**
1551
+ * @param {any} query
1552
+ * @returns {any}
1553
+ */
1554
+ process_query(query) {
1555
+ try {
1556
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1557
+ wasm.query_process_query(retptr, this.__wbg_ptr, addBorrowedObject(query));
1558
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1559
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1560
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
1561
+ if (r2) {
1562
+ throw takeObject(r1);
1563
+ }
1564
+ return takeObject(r0);
1565
+ } finally {
1566
+ wasm.__wbindgen_add_to_stack_pointer(16);
1567
+ heap[stack_pointer++] = void 0;
1568
+ }
1569
+ }
1570
+ /**
1571
+ * Returns the value of a property from the (normalized) query by its name.
1572
+ * This will scan the normalized query structure (including arrays, $and/$or blocks, etc.)
1573
+ * to find the first occurrence of the given property name and return its corresponding value.
1574
+ *
1575
+ * If not found, an error is returned.
1576
+ *
1577
+ * Example:
1578
+ * let val = query.get("age")?;
1579
+ * // val is a JsValue that might be a number, string, boolean, array, or object (e.g., { "$gt": 30 })
1580
+ * @param {string} property_name
1581
+ * @returns {any}
1582
+ */
1583
+ get(property_name) {
1584
+ try {
1585
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1586
+ const ptr0 = passStringToWasm0(property_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1587
+ const len0 = WASM_VECTOR_LEN;
1588
+ wasm.query_get(retptr, this.__wbg_ptr, ptr0, len0);
1589
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1590
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1591
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
1592
+ if (r2) {
1593
+ throw takeObject(r1);
1594
+ }
1595
+ return takeObject(r0);
1596
+ } finally {
1597
+ wasm.__wbindgen_add_to_stack_pointer(16);
1598
+ }
1599
+ }
1600
+ };
1601
+ var QueryOptionsFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
1602
+ }, unregister: () => {
1603
+ } } : new FinalizationRegistry((ptr) => wasm.__wbg_queryoptions_free(ptr >>> 0));
1604
+ var QueryOptions = class _QueryOptions {
1605
+ static __wrap(ptr) {
1606
+ ptr = ptr >>> 0;
1607
+ const obj = Object.create(_QueryOptions.prototype);
1608
+ obj.__wbg_ptr = ptr;
1609
+ QueryOptionsFinalization.register(obj, obj.__wbg_ptr, obj);
1610
+ return obj;
1611
+ }
1612
+ __destroy_into_raw() {
1613
+ const ptr = this.__wbg_ptr;
1614
+ this.__wbg_ptr = 0;
1615
+ QueryOptionsFinalization.unregister(this);
1616
+ return ptr;
1617
+ }
1618
+ free() {
1619
+ const ptr = this.__destroy_into_raw();
1620
+ wasm.__wbg_queryoptions_free(ptr);
1621
+ }
1622
+ /**
1623
+ * @returns {any}
1624
+ */
1625
+ get limit() {
1626
+ try {
1627
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1628
+ wasm.queryoptions_limit(retptr, this.__wbg_ptr);
1629
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1630
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1631
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
1632
+ if (r2) {
1633
+ throw takeObject(r1);
1634
+ }
1635
+ return takeObject(r0);
1636
+ } finally {
1637
+ wasm.__wbindgen_add_to_stack_pointer(16);
1638
+ }
1639
+ }
1640
+ /**
1641
+ * @returns {any}
1642
+ */
1643
+ get offset() {
1644
+ try {
1645
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1646
+ wasm.queryoptions_offset(retptr, this.__wbg_ptr);
1647
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1648
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1649
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
1650
+ if (r2) {
1651
+ throw takeObject(r1);
1652
+ }
1653
+ return takeObject(r0);
1654
+ } finally {
1655
+ wasm.__wbindgen_add_to_stack_pointer(16);
1656
+ }
1657
+ }
1658
+ };
1659
+ var RIDBErrorFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
1660
+ }, unregister: () => {
1661
+ } } : new FinalizationRegistry((ptr) => wasm.__wbg_ridberror_free(ptr >>> 0));
1662
+ var RIDBError = class _RIDBError {
1663
+ static __wrap(ptr) {
1664
+ ptr = ptr >>> 0;
1665
+ const obj = Object.create(_RIDBError.prototype);
1666
+ obj.__wbg_ptr = ptr;
1667
+ RIDBErrorFinalization.register(obj, obj.__wbg_ptr, obj);
1668
+ return obj;
1669
+ }
1670
+ toJSON() {
1671
+ return {
1672
+ type: this.type,
1673
+ code: this.code,
1674
+ message: this.message
1675
+ };
1676
+ }
1677
+ toString() {
1678
+ return JSON.stringify(this);
1679
+ }
1680
+ __destroy_into_raw() {
1681
+ const ptr = this.__wbg_ptr;
1682
+ this.__wbg_ptr = 0;
1683
+ RIDBErrorFinalization.unregister(this);
1684
+ return ptr;
1685
+ }
1686
+ free() {
1687
+ const ptr = this.__destroy_into_raw();
1688
+ wasm.__wbg_ridberror_free(ptr);
1689
+ }
1690
+ /**
1691
+ * @param {string} err_type
1692
+ * @param {string} message
1693
+ * @param {number} code
1694
+ */
1695
+ constructor(err_type, message, code) {
1696
+ const ptr0 = passStringToWasm0(err_type, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1697
+ const len0 = WASM_VECTOR_LEN;
1698
+ const ptr1 = passStringToWasm0(message, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1699
+ const len1 = WASM_VECTOR_LEN;
1700
+ const ret = wasm.ridberror_new(ptr0, len0, ptr1, len1, code);
1701
+ this.__wbg_ptr = ret >>> 0;
1702
+ return this;
1703
+ }
1704
+ /**
1705
+ * @returns {string}
1706
+ */
1707
+ get type() {
1708
+ let deferred1_0;
1709
+ let deferred1_1;
1710
+ try {
1711
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1712
+ wasm.ridberror_type(retptr, this.__wbg_ptr);
1713
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1714
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1715
+ deferred1_0 = r0;
1716
+ deferred1_1 = r1;
1717
+ return getStringFromWasm0(r0, r1);
1718
+ } finally {
1719
+ wasm.__wbindgen_add_to_stack_pointer(16);
1720
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1721
+ }
1722
+ }
1723
+ /**
1724
+ * @returns {any}
1725
+ */
1726
+ get code() {
1727
+ const ret = wasm.ridberror_code(this.__wbg_ptr);
1728
+ return takeObject(ret);
1729
+ }
1730
+ /**
1731
+ * @returns {string}
1732
+ */
1733
+ get message() {
1734
+ let deferred1_0;
1735
+ let deferred1_1;
1736
+ try {
1737
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1738
+ wasm.ridberror_message(retptr, this.__wbg_ptr);
1739
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1740
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1741
+ deferred1_0 = r0;
1742
+ deferred1_1 = r1;
1743
+ return getStringFromWasm0(r0, r1);
1744
+ } finally {
1745
+ wasm.__wbindgen_add_to_stack_pointer(16);
1746
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1747
+ }
1748
+ }
1749
+ /**
1750
+ * @param {any} err
1751
+ * @returns {RIDBError}
1752
+ */
1753
+ static from(err) {
1754
+ const ret = wasm.ridberror_from(addHeapObject(err));
1755
+ return _RIDBError.__wrap(ret);
1756
+ }
1757
+ /**
1758
+ * @param {string} err
1759
+ * @param {number} code
1760
+ * @returns {RIDBError}
1761
+ */
1762
+ static error(err, code) {
1763
+ const ptr0 = passStringToWasm0(err, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1764
+ const len0 = WASM_VECTOR_LEN;
1765
+ const ret = wasm.ridberror_error(ptr0, len0, code);
1766
+ return _RIDBError.__wrap(ret);
1767
+ }
1768
+ /**
1769
+ * @param {string} err
1770
+ * @param {number} code
1771
+ * @returns {RIDBError}
1772
+ */
1773
+ static query(err, code) {
1774
+ const ptr0 = passStringToWasm0(err, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1775
+ const len0 = WASM_VECTOR_LEN;
1776
+ const ret = wasm.ridberror_query(ptr0, len0, code);
1777
+ return _RIDBError.__wrap(ret);
1778
+ }
1779
+ /**
1780
+ * @param {string} err
1781
+ * @param {number} code
1782
+ * @returns {RIDBError}
1783
+ */
1784
+ static authentication(err, code) {
1785
+ const ptr0 = passStringToWasm0(err, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1786
+ const len0 = WASM_VECTOR_LEN;
1787
+ const ret = wasm.ridberror_authentication(ptr0, len0, code);
1788
+ return _RIDBError.__wrap(ret);
1789
+ }
1790
+ /**
1791
+ * @param {string} err
1792
+ * @param {number} code
1793
+ * @returns {RIDBError}
1794
+ */
1795
+ static serialisation(err, code) {
1796
+ const ptr0 = passStringToWasm0(err, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1797
+ const len0 = WASM_VECTOR_LEN;
1798
+ const ret = wasm.ridberror_serialisation(ptr0, len0, code);
1799
+ return _RIDBError.__wrap(ret);
1800
+ }
1801
+ /**
1802
+ * @param {string} err
1803
+ * @param {number} code
1804
+ * @returns {RIDBError}
1805
+ */
1806
+ static validation(err, code) {
1807
+ const ptr0 = passStringToWasm0(err, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1808
+ const len0 = WASM_VECTOR_LEN;
1809
+ const ret = wasm.ridberror_validation(ptr0, len0, code);
1810
+ return _RIDBError.__wrap(ret);
1811
+ }
1812
+ /**
1813
+ * @param {string} err
1814
+ * @param {number} code
1815
+ * @returns {RIDBError}
1816
+ */
1817
+ static hook(err, code) {
1818
+ const ptr0 = passStringToWasm0(err, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1819
+ const len0 = WASM_VECTOR_LEN;
1820
+ const ret = wasm.ridberror_hook(ptr0, len0, code);
1821
+ return _RIDBError.__wrap(ret);
1822
+ }
1823
+ };
1824
+ var SchemaFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
1825
+ }, unregister: () => {
1826
+ } } : new FinalizationRegistry((ptr) => wasm.__wbg_schema_free(ptr >>> 0));
1827
+ var Schema = class _Schema {
1828
+ static __wrap(ptr) {
1829
+ ptr = ptr >>> 0;
1830
+ const obj = Object.create(_Schema.prototype);
1831
+ obj.__wbg_ptr = ptr;
1832
+ SchemaFinalization.register(obj, obj.__wbg_ptr, obj);
1833
+ return obj;
1834
+ }
1835
+ __destroy_into_raw() {
1836
+ const ptr = this.__wbg_ptr;
1837
+ this.__wbg_ptr = 0;
1838
+ SchemaFinalization.unregister(this);
1839
+ return ptr;
1840
+ }
1841
+ free() {
1842
+ const ptr = this.__destroy_into_raw();
1843
+ wasm.__wbg_schema_free(ptr);
1844
+ }
1845
+ /**
1846
+ * @param {any} document
1847
+ */
1848
+ validate(document2) {
1849
+ try {
1850
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1851
+ wasm.schema_validate(retptr, this.__wbg_ptr, addHeapObject(document2));
1852
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1853
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1854
+ if (r1) {
1855
+ throw takeObject(r0);
1856
+ }
1857
+ } finally {
1858
+ wasm.__wbindgen_add_to_stack_pointer(16);
1859
+ }
1860
+ }
1861
+ /**
1862
+ * @returns {boolean}
1863
+ */
1864
+ is_valid() {
1865
+ try {
1866
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1867
+ wasm.schema_is_valid(retptr, this.__wbg_ptr);
1868
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1869
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1870
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
1871
+ if (r2) {
1872
+ throw takeObject(r1);
1873
+ }
1874
+ return r0 !== 0;
1875
+ } finally {
1876
+ wasm.__wbindgen_add_to_stack_pointer(16);
1877
+ }
1878
+ }
1879
+ /**
1880
+ * Creates a new `Schema` instance from a given `JsValue`.
1881
+ *
1882
+ * # Arguments
1883
+ *
1884
+ * * `schema` - A `JsValue` representing the schema.
1885
+ *
1886
+ * # Returns
1887
+ *
1888
+ * * `Result<Schema, JsValue>` - A result containing the new `Schema` instance or an error.
1889
+ * @param {any} schema
1890
+ * @returns {Schema}
1891
+ */
1892
+ static create(schema) {
1893
+ try {
1894
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1895
+ wasm.schema_create(retptr, addHeapObject(schema));
1896
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1897
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1898
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
1899
+ if (r2) {
1900
+ throw takeObject(r1);
1901
+ }
1902
+ return _Schema.__wrap(r0);
1903
+ } finally {
1904
+ wasm.__wbindgen_add_to_stack_pointer(16);
1905
+ }
1906
+ }
1907
+ /**
1908
+ * Retrieves the version of the schema.
1909
+ *
1910
+ * # Returns
1911
+ *
1912
+ * * `i32` - The version of the schema.
1913
+ * @returns {number}
1914
+ */
1915
+ get version() {
1916
+ const ret = wasm.schema_version(this.__wbg_ptr);
1917
+ return ret;
1918
+ }
1919
+ /**
1920
+ * Retrieves the primary key of the schema.
1921
+ *
1922
+ * # Returns
1923
+ *
1924
+ * * `String` - The primary key of the schema.
1925
+ * @returns {string}
1926
+ */
1927
+ get primaryKey() {
1928
+ let deferred1_0;
1929
+ let deferred1_1;
1930
+ try {
1931
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1932
+ wasm.schema_primaryKey(retptr, this.__wbg_ptr);
1933
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1934
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1935
+ deferred1_0 = r0;
1936
+ deferred1_1 = r1;
1937
+ return getStringFromWasm0(r0, r1);
1938
+ } finally {
1939
+ wasm.__wbindgen_add_to_stack_pointer(16);
1940
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1941
+ }
1942
+ }
1943
+ /**
1944
+ * Retrieves the type of the schema.
1945
+ *
1946
+ * # Returns
1947
+ *
1948
+ * * `String` - The type of the schema.
1949
+ * @returns {string}
1950
+ */
1951
+ get type() {
1952
+ let deferred1_0;
1953
+ let deferred1_1;
1954
+ try {
1955
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1956
+ wasm.schema_type(retptr, this.__wbg_ptr);
1957
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1958
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1959
+ deferred1_0 = r0;
1960
+ deferred1_1 = r1;
1961
+ return getStringFromWasm0(r0, r1);
1962
+ } finally {
1963
+ wasm.__wbindgen_add_to_stack_pointer(16);
1964
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1965
+ }
1966
+ }
1967
+ /**
1968
+ * Retrieves the indexes of the schema, if any.
1969
+ *
1970
+ * # Returns
1971
+ *
1972
+ * * `Option<Vec<String>>` - The indexes of the schema, if any.
1973
+ * @returns {(string)[] | undefined}
1974
+ */
1975
+ get indexes() {
1976
+ try {
1977
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1978
+ wasm.schema_indexes(retptr, this.__wbg_ptr);
1979
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1980
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1981
+ let v1;
1982
+ if (r0 !== 0) {
1983
+ v1 = getArrayJsValueFromWasm0(r0, r1).slice();
1984
+ wasm.__wbindgen_free(r0, r1 * 4, 4);
1985
+ }
1986
+ return v1;
1987
+ } finally {
1988
+ wasm.__wbindgen_add_to_stack_pointer(16);
1989
+ }
1990
+ }
1991
+ /**
1992
+ * @returns {(string)[] | undefined}
1993
+ */
1994
+ get encrypted() {
1995
+ try {
1996
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1997
+ wasm.schema_encrypted(retptr, this.__wbg_ptr);
1998
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1999
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
2000
+ let v1;
2001
+ if (r0 !== 0) {
2002
+ v1 = getArrayJsValueFromWasm0(r0, r1).slice();
2003
+ wasm.__wbindgen_free(r0, r1 * 4, 4);
2004
+ }
2005
+ return v1;
2006
+ } finally {
2007
+ wasm.__wbindgen_add_to_stack_pointer(16);
2008
+ }
2009
+ }
2010
+ /**
2011
+ * Retrieves the properties of the schema.
2012
+ *
2013
+ * # Returns
2014
+ *
2015
+ * * `Result<JsValue, JsValue>` - A result containing the properties as a `JsValue` or an error.
2016
+ * @returns {any}
2017
+ */
2018
+ get properties() {
2019
+ try {
2020
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2021
+ wasm.schema_properties(retptr, this.__wbg_ptr);
2022
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
2023
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
2024
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
2025
+ if (r2) {
2026
+ throw takeObject(r1);
2027
+ }
2028
+ return takeObject(r0);
2029
+ } finally {
2030
+ wasm.__wbindgen_add_to_stack_pointer(16);
2031
+ }
2032
+ }
2033
+ };
2034
+ var WasmBindgenTestContextFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
2035
+ }, unregister: () => {
2036
+ } } : new FinalizationRegistry((ptr) => wasm.__wbg_wasmbindgentestcontext_free(ptr >>> 0));
2037
+ var WasmBindgenTestContext = class {
2038
+ __destroy_into_raw() {
2039
+ const ptr = this.__wbg_ptr;
2040
+ this.__wbg_ptr = 0;
2041
+ WasmBindgenTestContextFinalization.unregister(this);
2042
+ return ptr;
2043
+ }
2044
+ free() {
2045
+ const ptr = this.__destroy_into_raw();
2046
+ wasm.__wbg_wasmbindgentestcontext_free(ptr);
2047
+ }
2048
+ /**
2049
+ * Creates a new context ready to run tests.
2050
+ *
2051
+ * A `Context` is the main structure through which test execution is
2052
+ * coordinated, and this will collect output and results for all executed
2053
+ * tests.
2054
+ */
2055
+ constructor() {
2056
+ const ret = wasm.wasmbindgentestcontext_new();
2057
+ this.__wbg_ptr = ret >>> 0;
2058
+ return this;
2059
+ }
2060
+ /**
2061
+ * Inform this context about runtime arguments passed to the test
2062
+ * harness.
2063
+ * @param {any[]} args
2064
+ */
2065
+ args(args) {
2066
+ const ptr0 = passArrayJsValueToWasm0(args, wasm.__wbindgen_malloc);
2067
+ const len0 = WASM_VECTOR_LEN;
2068
+ wasm.wasmbindgentestcontext_args(this.__wbg_ptr, ptr0, len0);
2069
+ }
2070
+ /**
2071
+ * Executes a list of tests, returning a promise representing their
2072
+ * eventual completion.
2073
+ *
2074
+ * This is the main entry point for executing tests. All the tests passed
2075
+ * in are the JS `Function` object that was plucked off the
2076
+ * `WebAssembly.Instance` exports list.
2077
+ *
2078
+ * The promise returned resolves to either `true` if all tests passed or
2079
+ * `false` if at least one test failed.
2080
+ * @param {any[]} tests
2081
+ * @returns {Promise<any>}
2082
+ */
2083
+ run(tests) {
2084
+ const ptr0 = passArrayJsValueToWasm0(tests, wasm.__wbindgen_malloc);
2085
+ const len0 = WASM_VECTOR_LEN;
2086
+ const ret = wasm.wasmbindgentestcontext_run(this.__wbg_ptr, ptr0, len0);
2087
+ return takeObject(ret);
2088
+ }
2089
+ };
2090
+ async function __wbg_load(module2, imports) {
2091
+ if (typeof Response === "function" && module2 instanceof Response) {
2092
+ if (typeof WebAssembly.instantiateStreaming === "function") {
2093
+ try {
2094
+ return await WebAssembly.instantiateStreaming(module2, imports);
2095
+ } catch (e) {
2096
+ if (module2.headers.get("Content-Type") != "application/wasm") {
2097
+ 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);
2098
+ } else {
2099
+ throw e;
2100
+ }
2101
+ }
2102
+ }
2103
+ const bytes = await module2.arrayBuffer();
2104
+ return await WebAssembly.instantiate(bytes, imports);
2105
+ } else {
2106
+ const instance = await WebAssembly.instantiate(module2, imports);
2107
+ if (instance instanceof WebAssembly.Instance) {
2108
+ return { instance, module: module2 };
2109
+ } else {
2110
+ return instance;
2111
+ }
2112
+ }
2113
+ }
2114
+ function __wbg_get_imports() {
2115
+ const imports = {};
2116
+ imports.wbg = {};
2117
+ imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
2118
+ takeObject(arg0);
2119
+ };
2120
+ imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
2121
+ const ret = getStringFromWasm0(arg0, arg1);
2122
+ return addHeapObject(ret);
2123
+ };
2124
+ imports.wbg.__wbindgen_object_clone_ref = function(arg0) {
2125
+ const ret = getObject(arg0);
2126
+ return addHeapObject(ret);
2127
+ };
2128
+ imports.wbg.__wbindgen_cb_drop = function(arg0) {
2129
+ const obj = takeObject(arg0).original;
2130
+ if (obj.cnt-- == 1) {
2131
+ obj.a = 0;
2132
+ return true;
2133
+ }
2134
+ const ret = false;
2135
+ return ret;
2136
+ };
2137
+ imports.wbg.__wbg_ridberror_new = function(arg0) {
2138
+ const ret = RIDBError.__wrap(arg0);
2139
+ return addHeapObject(ret);
2140
+ };
2141
+ imports.wbg.__wbindgen_number_new = function(arg0) {
2142
+ const ret = arg0;
2143
+ return addHeapObject(ret);
2144
+ };
2145
+ imports.wbg.__wbindgen_is_null = function(arg0) {
2146
+ const ret = getObject(arg0) === null;
2147
+ return ret;
2148
+ };
2149
+ imports.wbg.__wbindgen_is_undefined = function(arg0) {
2150
+ const ret = getObject(arg0) === void 0;
2151
+ return ret;
2152
+ };
2153
+ imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
2154
+ const obj = getObject(arg1);
2155
+ const ret = typeof obj === "string" ? obj : void 0;
2156
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2157
+ var len1 = WASM_VECTOR_LEN;
2158
+ getInt32Memory0()[arg0 / 4 + 1] = len1;
2159
+ getInt32Memory0()[arg0 / 4 + 0] = ptr1;
2160
+ };
2161
+ imports.wbg.__wbg_count_19db4c3174d573d5 = function() {
2162
+ return handleError(function(arg0, arg1, arg2, arg3, arg4) {
2163
+ const ret = getObject(arg0).count(getStringFromWasm0(arg1, arg2), takeObject(arg3), QueryOptions.__wrap(arg4));
2164
+ return addHeapObject(ret);
2165
+ }, arguments);
2166
+ };
2167
+ imports.wbg.__wbg_start_76c138c3b73ae6f8 = function() {
2168
+ return handleError(function(arg0) {
2169
+ const ret = getObject(arg0).start();
2170
+ return addHeapObject(ret);
2171
+ }, arguments);
2172
+ };
2173
+ imports.wbg.__wbg_close_6384ed3c27ef25c1 = function() {
2174
+ return handleError(function(arg0) {
2175
+ const ret = getObject(arg0).close();
2176
+ return addHeapObject(ret);
2177
+ }, arguments);
2178
+ };
2179
+ imports.wbg.__wbg_apply_9f557eba1534d597 = function() {
2180
+ return handleError(function(arg0, arg1, arg2) {
2181
+ const ret = getObject(arg1).apply(takeObject(arg2));
2182
+ const ptr1 = passArrayJsValueToWasm0(ret, wasm.__wbindgen_malloc);
2183
+ const len1 = WASM_VECTOR_LEN;
2184
+ getInt32Memory0()[arg0 / 4 + 1] = len1;
2185
+ getInt32Memory0()[arg0 / 4 + 0] = ptr1;
2186
+ }, arguments);
2187
+ };
2188
+ imports.wbg.__wbg_inmemory_new = function(arg0) {
2189
+ const ret = InMemory.__wrap(arg0);
2190
+ return addHeapObject(ret);
2191
+ };
2192
+ imports.wbg.__wbg_find_567c5c9f064fe3d2 = function() {
2193
+ return handleError(function(arg0, arg1, arg2, arg3, arg4) {
2194
+ const ret = getObject(arg0).find(getStringFromWasm0(arg1, arg2), takeObject(arg3), QueryOptions.__wrap(arg4));
2195
+ return addHeapObject(ret);
2196
+ }, arguments);
2197
+ };
2198
+ imports.wbg.__wbindgen_number_get = function(arg0, arg1) {
2199
+ const obj = getObject(arg1);
2200
+ const ret = typeof obj === "number" ? obj : void 0;
2201
+ getFloat64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? 0 : ret;
2202
+ getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret);
2203
+ };
2204
+ imports.wbg.__wbg_findDocumentById_2edf7350e5f12657 = function() {
2205
+ return handleError(function(arg0, arg1, arg2, arg3) {
2206
+ const ret = getObject(arg0).findDocumentById(getStringFromWasm0(arg1, arg2), takeObject(arg3));
2207
+ return addHeapObject(ret);
2208
+ }, arguments);
2209
+ };
2210
+ imports.wbg.__wbg_write_1159c67c07f62020 = function() {
2211
+ return handleError(function(arg0, arg1) {
2212
+ const ret = getObject(arg0).write(Operation.__wrap(arg1));
2213
+ return addHeapObject(ret);
2214
+ }, arguments);
2215
+ };
2216
+ imports.wbg.__wbindgen_is_function = function(arg0) {
2217
+ const ret = typeof getObject(arg0) === "function";
2218
+ return ret;
2219
+ };
2220
+ imports.wbg.__wbindgen_is_string = function(arg0) {
2221
+ const ret = typeof getObject(arg0) === "string";
2222
+ return ret;
2223
+ };
2224
+ imports.wbg.__wbindgen_is_bigint = function(arg0) {
2225
+ const ret = typeof getObject(arg0) === "bigint";
2226
+ return ret;
2227
+ };
2228
+ imports.wbg.__wbg_collection_new = function(arg0) {
2229
+ const ret = Collection.__wrap(arg0);
2230
+ return addHeapObject(ret);
2231
+ };
2232
+ imports.wbg.__wbg_database_new = function(arg0) {
2233
+ const ret = Database.__wrap(arg0);
2234
+ return addHeapObject(ret);
2235
+ };
2236
+ imports.wbg.__wbindgen_error_new = function(arg0, arg1) {
2237
+ const ret = new Error(getStringFromWasm0(arg0, arg1));
2238
+ return addHeapObject(ret);
2239
+ };
2240
+ imports.wbg.__wbindgen_jsval_eq = function(arg0, arg1) {
2241
+ const ret = getObject(arg0) === getObject(arg1);
2242
+ return ret;
2243
+ };
2244
+ imports.wbg.__wbindgen_is_array = function(arg0) {
2245
+ const ret = Array.isArray(getObject(arg0));
2246
+ return ret;
2247
+ };
2248
+ imports.wbg.__wbindgen_is_object = function(arg0) {
2249
+ const val = getObject(arg0);
2250
+ const ret = typeof val === "object" && val !== null;
2251
+ return ret;
2252
+ };
2253
+ imports.wbg.__wbindgen_is_falsy = function(arg0) {
2254
+ const ret = !getObject(arg0);
2255
+ return ret;
2256
+ };
2257
+ imports.wbg.__wbindgen_boolean_get = function(arg0) {
2258
+ const v = getObject(arg0);
2259
+ const ret = typeof v === "boolean" ? v ? 1 : 0 : 2;
2260
+ return ret;
2261
+ };
2262
+ imports.wbg.__wbindgen_in = function(arg0, arg1) {
2263
+ const ret = getObject(arg0) in getObject(arg1);
2264
+ return ret;
2265
+ };
2266
+ imports.wbg.__wbindgen_bigint_from_i64 = function(arg0) {
2267
+ const ret = arg0;
2268
+ return addHeapObject(ret);
2269
+ };
2270
+ imports.wbg.__wbindgen_bigint_from_u64 = function(arg0) {
2271
+ const ret = BigInt.asUintN(64, arg0);
2272
+ return addHeapObject(ret);
2273
+ };
2274
+ imports.wbg.__wbg_indexdb_new = function(arg0) {
2275
+ const ret = IndexDB.__wrap(arg0);
2276
+ return addHeapObject(ret);
2277
+ };
2278
+ imports.wbg.__wbg_crypto_1d1f22824a6a080c = function(arg0) {
2279
+ const ret = getObject(arg0).crypto;
2280
+ return addHeapObject(ret);
2281
+ };
2282
+ imports.wbg.__wbg_process_4a72847cc503995b = function(arg0) {
2283
+ const ret = getObject(arg0).process;
2284
+ return addHeapObject(ret);
2285
+ };
2286
+ imports.wbg.__wbg_versions_f686565e586dd935 = function(arg0) {
2287
+ const ret = getObject(arg0).versions;
2288
+ return addHeapObject(ret);
2289
+ };
2290
+ imports.wbg.__wbg_node_104a2ff8d6ea03a2 = function(arg0) {
2291
+ const ret = getObject(arg0).node;
2292
+ return addHeapObject(ret);
2293
+ };
2294
+ imports.wbg.__wbg_require_cca90b1a94a0255b = function() {
2295
+ return handleError(function() {
2296
+ const ret = module.require;
2297
+ return addHeapObject(ret);
2298
+ }, arguments);
2299
+ };
2300
+ imports.wbg.__wbg_msCrypto_eb05e62b530a1508 = function(arg0) {
2301
+ const ret = getObject(arg0).msCrypto;
2302
+ return addHeapObject(ret);
2303
+ };
2304
+ imports.wbg.__wbg_randomFillSync_5c9c955aa56b6049 = function() {
2305
+ return handleError(function(arg0, arg1) {
2306
+ getObject(arg0).randomFillSync(takeObject(arg1));
2307
+ }, arguments);
2308
+ };
2309
+ imports.wbg.__wbg_getRandomValues_3aa56aa6edec874c = function() {
2310
+ return handleError(function(arg0, arg1) {
2311
+ getObject(arg0).getRandomValues(getObject(arg1));
2312
+ }, arguments);
2313
+ };
2314
+ imports.wbg.__wbg_instanceof_Window_f401953a2cf86220 = function(arg0) {
2315
+ let result;
2316
+ try {
2317
+ result = getObject(arg0) instanceof Window;
2318
+ } catch (_) {
2319
+ result = false;
2320
+ }
2321
+ const ret = result;
2322
+ return ret;
2323
+ };
2324
+ imports.wbg.__wbg_localStorage_e381d34d0c40c761 = function() {
2325
+ return handleError(function(arg0) {
2326
+ const ret = getObject(arg0).localStorage;
2327
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
2328
+ }, arguments);
2329
+ };
2330
+ imports.wbg.__wbg_indexedDB_7c51d9056667f4e0 = function() {
2331
+ return handleError(function(arg0) {
2332
+ const ret = getObject(arg0).indexedDB;
2333
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
2334
+ }, arguments);
2335
+ };
2336
+ imports.wbg.__wbg_instanceof_WorkerGlobalScope_46b577f151fad960 = function(arg0) {
2337
+ let result;
2338
+ try {
2339
+ result = getObject(arg0) instanceof WorkerGlobalScope;
2340
+ } catch (_) {
2341
+ result = false;
2342
+ }
2343
+ const ret = result;
2344
+ return ret;
2345
+ };
2346
+ imports.wbg.__wbg_indexedDB_d312f95759a15fdc = function() {
2347
+ return handleError(function(arg0) {
2348
+ const ret = getObject(arg0).indexedDB;
2349
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
2350
+ }, arguments);
2351
+ };
2352
+ imports.wbg.__wbg_debug_5fb96680aecf5dc8 = function(arg0) {
2353
+ console.debug(getObject(arg0));
2354
+ };
2355
+ imports.wbg.__wbg_log_5bb5f88f245d7762 = function(arg0) {
2356
+ console.log(getObject(arg0));
2357
+ };
2358
+ imports.wbg.__wbg_openCursor_425aba9cbe1d4d39 = function() {
2359
+ return handleError(function(arg0) {
2360
+ const ret = getObject(arg0).openCursor();
2361
+ return addHeapObject(ret);
2362
+ }, arguments);
2363
+ };
2364
+ imports.wbg.__wbg_openCursor_e3042770817a8d57 = function() {
2365
+ return handleError(function(arg0, arg1) {
2366
+ const ret = getObject(arg0).openCursor(getObject(arg1));
2367
+ return addHeapObject(ret);
2368
+ }, arguments);
2369
+ };
2370
+ imports.wbg.__wbg_createIndex_b8da1f5571f644be = function() {
2371
+ return handleError(function(arg0, arg1, arg2, arg3, arg4, arg5) {
2372
+ const ret = getObject(arg0).createIndex(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4), getObject(arg5));
2373
+ return addHeapObject(ret);
2374
+ }, arguments);
2375
+ };
2376
+ imports.wbg.__wbg_delete_f60bba7d0ae59a4f = function() {
2377
+ return handleError(function(arg0, arg1) {
2378
+ const ret = getObject(arg0).delete(getObject(arg1));
2379
+ return addHeapObject(ret);
2380
+ }, arguments);
2381
+ };
2382
+ imports.wbg.__wbg_get_5361b64cac0d0826 = function() {
2383
+ return handleError(function(arg0, arg1) {
2384
+ const ret = getObject(arg0).get(getObject(arg1));
2385
+ return addHeapObject(ret);
2386
+ }, arguments);
2387
+ };
2388
+ imports.wbg.__wbg_index_383b6812c1508030 = function() {
2389
+ return handleError(function(arg0, arg1, arg2) {
2390
+ const ret = getObject(arg0).index(getStringFromWasm0(arg1, arg2));
2391
+ return addHeapObject(ret);
2392
+ }, arguments);
2393
+ };
2394
+ imports.wbg.__wbg_openCursor_30d58ae27a327629 = function() {
2395
+ return handleError(function(arg0) {
2396
+ const ret = getObject(arg0).openCursor();
2397
+ return addHeapObject(ret);
2398
+ }, arguments);
2399
+ };
2400
+ imports.wbg.__wbg_openCursor_611b1e488c393dd8 = function() {
2401
+ return handleError(function(arg0, arg1) {
2402
+ const ret = getObject(arg0).openCursor(getObject(arg1));
2403
+ return addHeapObject(ret);
2404
+ }, arguments);
2405
+ };
2406
+ imports.wbg.__wbg_put_22792e17580ca18b = function() {
2407
+ return handleError(function(arg0, arg1, arg2) {
2408
+ const ret = getObject(arg0).put(getObject(arg1), getObject(arg2));
2409
+ return addHeapObject(ret);
2410
+ }, arguments);
2411
+ };
2412
+ imports.wbg.__wbg_target_2fc177e386c8b7b0 = function(arg0) {
2413
+ const ret = getObject(arg0).target;
2414
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
2415
+ };
2416
+ imports.wbg.__wbg_instanceof_IdbDatabase_db671cf2454a9542 = function(arg0) {
2417
+ let result;
2418
+ try {
2419
+ result = getObject(arg0) instanceof IDBDatabase;
2420
+ } catch (_) {
2421
+ result = false;
2422
+ }
2423
+ const ret = result;
2424
+ return ret;
2425
+ };
2426
+ imports.wbg.__wbg_objectStoreNames_588b5924274239fd = function(arg0) {
2427
+ const ret = getObject(arg0).objectStoreNames;
2428
+ return addHeapObject(ret);
2429
+ };
2430
+ imports.wbg.__wbg_close_6bfe4ca2fe67cb67 = function(arg0) {
2431
+ getObject(arg0).close();
2432
+ };
2433
+ imports.wbg.__wbg_createObjectStore_882f2f6b1b1ef040 = function() {
2434
+ return handleError(function(arg0, arg1, arg2) {
2435
+ const ret = getObject(arg0).createObjectStore(getStringFromWasm0(arg1, arg2));
2436
+ return addHeapObject(ret);
2437
+ }, arguments);
2438
+ };
2439
+ imports.wbg.__wbg_transaction_c32bb10c9c692f4b = function() {
2440
+ return handleError(function(arg0, arg1, arg2) {
2441
+ const ret = getObject(arg0).transaction(getStringFromWasm0(arg1, arg2));
2442
+ return addHeapObject(ret);
2443
+ }, arguments);
2444
+ };
2445
+ imports.wbg.__wbg_transaction_1e282a79e9bb7387 = function() {
2446
+ return handleError(function(arg0, arg1, arg2, arg3) {
2447
+ const ret = getObject(arg0).transaction(getStringFromWasm0(arg1, arg2), takeObject(arg3));
2448
+ return addHeapObject(ret);
2449
+ }, arguments);
2450
+ };
2451
+ imports.wbg.__wbg_length_9ae5daf9a690cba9 = function(arg0) {
2452
+ const ret = getObject(arg0).length;
2453
+ return ret;
2454
+ };
2455
+ imports.wbg.__wbg_contains_c65b44400b549286 = function(arg0, arg1, arg2) {
2456
+ const ret = getObject(arg0).contains(getStringFromWasm0(arg1, arg2));
2457
+ return ret;
2458
+ };
2459
+ imports.wbg.__wbg_get_910bbb94abdcf488 = function(arg0, arg1, arg2) {
2460
+ const ret = getObject(arg1)[arg2 >>> 0];
2461
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2462
+ var len1 = WASM_VECTOR_LEN;
2463
+ getInt32Memory0()[arg0 / 4 + 1] = len1;
2464
+ getInt32Memory0()[arg0 / 4 + 0] = ptr1;
2465
+ };
2466
+ imports.wbg.__wbg_instanceof_IdbCursorWithValue_abeb44d13d947bc2 = function(arg0) {
2467
+ let result;
2468
+ try {
2469
+ result = getObject(arg0) instanceof IDBCursorWithValue;
2470
+ } catch (_) {
2471
+ result = false;
2472
+ }
2473
+ const ret = result;
2474
+ return ret;
2475
+ };
2476
+ imports.wbg.__wbg_value_86d3334f5075b232 = function() {
2477
+ return handleError(function(arg0) {
2478
+ const ret = getObject(arg0).value;
2479
+ return addHeapObject(ret);
2480
+ }, arguments);
2481
+ };
2482
+ imports.wbg.__wbg_only_cacf767244bdc280 = function() {
2483
+ return handleError(function(arg0) {
2484
+ const ret = IDBKeyRange.only(getObject(arg0));
2485
+ return addHeapObject(ret);
2486
+ }, arguments);
2487
+ };
2488
+ imports.wbg.__wbg_instanceof_IdbOpenDbRequest_3f4a166bc0340578 = function(arg0) {
2489
+ let result;
2490
+ try {
2491
+ result = getObject(arg0) instanceof IDBOpenDBRequest;
2492
+ } catch (_) {
2493
+ result = false;
2494
+ }
2495
+ const ret = result;
2496
+ return ret;
2497
+ };
2498
+ imports.wbg.__wbg_setonupgradeneeded_ad7645373c7d5e1b = function(arg0, arg1) {
2499
+ getObject(arg0).onupgradeneeded = getObject(arg1);
2500
+ };
2501
+ imports.wbg.__wbg_instanceof_IdbRequest_93249da04f5370b6 = function(arg0) {
2502
+ let result;
2503
+ try {
2504
+ result = getObject(arg0) instanceof IDBRequest;
2505
+ } catch (_) {
2506
+ result = false;
2507
+ }
2508
+ const ret = result;
2509
+ return ret;
2510
+ };
2511
+ imports.wbg.__wbg_result_6cedf5f78600a79c = function() {
2512
+ return handleError(function(arg0) {
2513
+ const ret = getObject(arg0).result;
2514
+ return addHeapObject(ret);
2515
+ }, arguments);
2516
+ };
2517
+ imports.wbg.__wbg_error_685b20024dc2d6ca = function() {
2518
+ return handleError(function(arg0) {
2519
+ const ret = getObject(arg0).error;
2520
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
2521
+ }, arguments);
2522
+ };
2523
+ imports.wbg.__wbg_setonsuccess_632ce0a1460455c2 = function(arg0, arg1) {
2524
+ getObject(arg0).onsuccess = getObject(arg1);
2525
+ };
2526
+ imports.wbg.__wbg_setonerror_8479b33e7568a904 = function(arg0, arg1) {
2527
+ getObject(arg0).onerror = getObject(arg1);
2528
+ };
2529
+ imports.wbg.__wbg_setoncomplete_d8e4236665cbf1e2 = function(arg0, arg1) {
2530
+ getObject(arg0).oncomplete = getObject(arg1);
2531
+ };
2532
+ imports.wbg.__wbg_objectStore_da468793bd9df17b = function() {
2533
+ return handleError(function(arg0, arg1, arg2) {
2534
+ const ret = getObject(arg0).objectStore(getStringFromWasm0(arg1, arg2));
2535
+ return addHeapObject(ret);
2536
+ }, arguments);
2537
+ };
2538
+ imports.wbg.__wbg_open_f0d7259fd7e689ce = function() {
2539
+ return handleError(function(arg0, arg1, arg2, arg3) {
2540
+ const ret = getObject(arg0).open(getStringFromWasm0(arg1, arg2), arg3 >>> 0);
2541
+ return addHeapObject(ret);
2542
+ }, arguments);
2543
+ };
2544
+ imports.wbg.__wbg_getItem_164e8e5265095b87 = function() {
2545
+ return handleError(function(arg0, arg1, arg2, arg3) {
2546
+ const ret = getObject(arg1).getItem(getStringFromWasm0(arg2, arg3));
2547
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2548
+ var len1 = WASM_VECTOR_LEN;
2549
+ getInt32Memory0()[arg0 / 4 + 1] = len1;
2550
+ getInt32Memory0()[arg0 / 4 + 0] = ptr1;
2551
+ }, arguments);
2552
+ };
2553
+ imports.wbg.__wbg_continue_f1c3e0815924de62 = function() {
2554
+ return handleError(function(arg0) {
2555
+ getObject(arg0).continue();
2556
+ }, arguments);
2557
+ };
2558
+ imports.wbg.__wbindgen_jsval_loose_eq = function(arg0, arg1) {
2559
+ const ret = getObject(arg0) == getObject(arg1);
2560
+ return ret;
2561
+ };
2562
+ imports.wbg.__wbindgen_as_number = function(arg0) {
2563
+ const ret = +getObject(arg0);
2564
+ return ret;
2565
+ };
2566
+ imports.wbg.__wbg_String_389b54bd9d25375f = function(arg0, arg1) {
2567
+ const ret = String(getObject(arg1));
2568
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2569
+ const len1 = WASM_VECTOR_LEN;
2570
+ getInt32Memory0()[arg0 / 4 + 1] = len1;
2571
+ getInt32Memory0()[arg0 / 4 + 0] = ptr1;
2572
+ };
2573
+ imports.wbg.__wbg_getwithrefkey_4a92a5eca60879b9 = function(arg0, arg1) {
2574
+ const ret = getObject(arg0)[getObject(arg1)];
2575
+ return addHeapObject(ret);
2576
+ };
2577
+ imports.wbg.__wbg_set_9182712abebf82ef = function(arg0, arg1, arg2) {
2578
+ getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
2579
+ };
2580
+ imports.wbg.__wbg_log_28eee4e6432efd24 = function(arg0, arg1) {
2581
+ console.log(getStringFromWasm0(arg0, arg1));
2582
+ };
2583
+ imports.wbg.__wbg_String_55b8bdc4bc243677 = function(arg0, arg1) {
2584
+ const ret = String(getObject(arg1));
2585
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2586
+ const len1 = WASM_VECTOR_LEN;
2587
+ getInt32Memory0()[arg0 / 4 + 1] = len1;
2588
+ getInt32Memory0()[arg0 / 4 + 0] = ptr1;
2589
+ };
2590
+ imports.wbg.__wbg_getElementById_8458f2a6c28467dc = function(arg0, arg1, arg2) {
2591
+ const ret = getObject(arg0).getElementById(getStringFromWasm0(arg1, arg2));
2592
+ return addHeapObject(ret);
2593
+ };
2594
+ imports.wbg.__wbg_settextcontent_fc3ff485b96fcb1d = function(arg0, arg1, arg2) {
2595
+ getObject(arg0).textContent = getStringFromWasm0(arg1, arg2);
2596
+ };
2597
+ imports.wbg.__wbg_wbgtestinvoke_8c20f4132af2bded = function() {
2598
+ return handleError(function(arg0, arg1) {
2599
+ try {
2600
+ var state0 = { a: arg0, b: arg1 };
2601
+ var cb0 = () => {
2602
+ const a = state0.a;
2603
+ state0.a = 0;
2604
+ try {
2605
+ return __wbg_adapter_296(a, state0.b);
2606
+ } finally {
2607
+ state0.a = a;
2608
+ }
2609
+ };
2610
+ __wbg_test_invoke(cb0);
2611
+ } finally {
2612
+ state0.a = state0.b = 0;
2613
+ }
2614
+ }, arguments);
2615
+ };
2616
+ imports.wbg.__wbg_static_accessor_document_d4b6ae7f5578480f = function() {
2617
+ const ret = document;
2618
+ return addHeapObject(ret);
2619
+ };
2620
+ imports.wbg.__wbg_textcontent_67e4e811cbdf00fc = function(arg0, arg1) {
2621
+ const ret = getObject(arg1).textContent;
2622
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2623
+ const len1 = WASM_VECTOR_LEN;
2624
+ getInt32Memory0()[arg0 / 4 + 1] = len1;
2625
+ getInt32Memory0()[arg0 / 4 + 0] = ptr1;
2626
+ };
2627
+ imports.wbg.__wbg_stack_44743fb7d71926a0 = function(arg0) {
2628
+ const ret = getObject(arg0).stack;
2629
+ return addHeapObject(ret);
2630
+ };
2631
+ imports.wbg.__wbg_self_55106357ec10ecd4 = function(arg0) {
2632
+ const ret = getObject(arg0).self;
2633
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
2634
+ };
2635
+ imports.wbg.__wbg_constructor_fd0d22d60b7dfd72 = function(arg0) {
2636
+ const ret = getObject(arg0).constructor;
2637
+ return addHeapObject(ret);
2638
+ };
2639
+ imports.wbg.__wbg_name_7f439d24ff7ba1d3 = function(arg0, arg1) {
2640
+ const ret = getObject(arg1).name;
2641
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2642
+ const len1 = WASM_VECTOR_LEN;
2643
+ getInt32Memory0()[arg0 / 4 + 1] = len1;
2644
+ getInt32Memory0()[arg0 / 4 + 0] = ptr1;
2645
+ };
2646
+ imports.wbg.__wbg_stack_17c77e9f5bfe6714 = function(arg0, arg1) {
2647
+ const ret = getObject(arg1).stack;
2648
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2649
+ const len1 = WASM_VECTOR_LEN;
2650
+ getInt32Memory0()[arg0 / 4 + 1] = len1;
2651
+ getInt32Memory0()[arg0 / 4 + 0] = ptr1;
2652
+ };
2653
+ imports.wbg.__wbg_wbgtestoutputwriteln_4db3bd64914ec955 = function(arg0) {
2654
+ __wbg_test_output_writeln(takeObject(arg0));
2655
+ };
2656
+ imports.wbg.__wbg_stack_436273c21658169b = function(arg0) {
2657
+ const ret = getObject(arg0).stack;
2658
+ return addHeapObject(ret);
2659
+ };
2660
+ imports.wbg.__wbg_new_abda76e883ba8a5f = function() {
2661
+ const ret = new Error();
2662
+ return addHeapObject(ret);
2663
+ };
2664
+ imports.wbg.__wbg_stack_658279fe44541cf6 = function(arg0, arg1) {
2665
+ const ret = getObject(arg1).stack;
2666
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2667
+ const len1 = WASM_VECTOR_LEN;
2668
+ getInt32Memory0()[arg0 / 4 + 1] = len1;
2669
+ getInt32Memory0()[arg0 / 4 + 0] = ptr1;
2670
+ };
2671
+ imports.wbg.__wbg_error_f851667af71bcfc6 = function(arg0, arg1) {
2672
+ let deferred0_0;
2673
+ let deferred0_1;
2674
+ try {
2675
+ deferred0_0 = arg0;
2676
+ deferred0_1 = arg1;
2677
+ console.error(getStringFromWasm0(arg0, arg1));
2678
+ } finally {
2679
+ wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
2680
+ }
2681
+ };
2682
+ imports.wbg.__wbg_queueMicrotask_481971b0d87f3dd4 = function(arg0) {
2683
+ queueMicrotask(getObject(arg0));
2684
+ };
2685
+ imports.wbg.__wbg_queueMicrotask_3cbae2ec6b6cd3d6 = function(arg0) {
2686
+ const ret = getObject(arg0).queueMicrotask;
2687
+ return addHeapObject(ret);
2688
+ };
2689
+ imports.wbg.__wbg_get_bd8e338fbd5f5cc8 = function(arg0, arg1) {
2690
+ const ret = getObject(arg0)[arg1 >>> 0];
2691
+ return addHeapObject(ret);
2692
+ };
2693
+ imports.wbg.__wbg_length_cd7af8117672b8b8 = function(arg0) {
2694
+ const ret = getObject(arg0).length;
2695
+ return ret;
2696
+ };
2697
+ imports.wbg.__wbg_new_16b304a2cfa7ff4a = function() {
2698
+ const ret = new Array();
2699
+ return addHeapObject(ret);
2700
+ };
2701
+ imports.wbg.__wbg_newnoargs_e258087cd0daa0ea = function(arg0, arg1) {
2702
+ const ret = new Function(getStringFromWasm0(arg0, arg1));
2703
+ return addHeapObject(ret);
2704
+ };
2705
+ imports.wbg.__wbg_new_d9bc3a0147634640 = function() {
2706
+ const ret = /* @__PURE__ */ new Map();
2707
+ return addHeapObject(ret);
2708
+ };
2709
+ imports.wbg.__wbg_next_40fc327bfc8770e6 = function(arg0) {
2710
+ const ret = getObject(arg0).next;
2711
+ return addHeapObject(ret);
2712
+ };
2713
+ imports.wbg.__wbg_next_196c84450b364254 = function() {
2714
+ return handleError(function(arg0) {
2715
+ const ret = getObject(arg0).next();
2716
+ return addHeapObject(ret);
2717
+ }, arguments);
2718
+ };
2719
+ imports.wbg.__wbg_done_298b57d23c0fc80c = function(arg0) {
2720
+ const ret = getObject(arg0).done;
2721
+ return ret;
2722
+ };
2723
+ imports.wbg.__wbg_value_d93c65011f51a456 = function(arg0) {
2724
+ const ret = getObject(arg0).value;
2725
+ return addHeapObject(ret);
2726
+ };
2727
+ imports.wbg.__wbg_iterator_2cee6dadfd956dfa = function() {
2728
+ const ret = Symbol.iterator;
2729
+ return addHeapObject(ret);
2730
+ };
2731
+ imports.wbg.__wbg_get_e3c254076557e348 = function() {
2732
+ return handleError(function(arg0, arg1) {
2733
+ const ret = Reflect.get(getObject(arg0), getObject(arg1));
2734
+ return addHeapObject(ret);
2735
+ }, arguments);
2736
+ };
2737
+ imports.wbg.__wbg_call_27c0f87801dedf93 = function() {
2738
+ return handleError(function(arg0, arg1) {
2739
+ const ret = getObject(arg0).call(getObject(arg1));
2740
+ return addHeapObject(ret);
2741
+ }, arguments);
2742
+ };
2743
+ imports.wbg.__wbg_new_72fb9a18b5ae2624 = function() {
2744
+ const ret = new Object();
2745
+ return addHeapObject(ret);
2746
+ };
2747
+ imports.wbg.__wbg_self_ce0dbfc45cf2f5be = function() {
2748
+ return handleError(function() {
2749
+ const ret = self.self;
2750
+ return addHeapObject(ret);
2751
+ }, arguments);
2752
+ };
2753
+ imports.wbg.__wbg_window_c6fb939a7f436783 = function() {
2754
+ return handleError(function() {
2755
+ const ret = window.window;
2756
+ return addHeapObject(ret);
2757
+ }, arguments);
2758
+ };
2759
+ imports.wbg.__wbg_globalThis_d1e6af4856ba331b = function() {
2760
+ return handleError(function() {
2761
+ const ret = globalThis.globalThis;
2762
+ return addHeapObject(ret);
2763
+ }, arguments);
2764
+ };
2765
+ imports.wbg.__wbg_global_207b558942527489 = function() {
2766
+ return handleError(function() {
2767
+ const ret = global.global;
2768
+ return addHeapObject(ret);
2769
+ }, arguments);
2770
+ };
2771
+ imports.wbg.__wbg_set_d4638f722068f043 = function(arg0, arg1, arg2) {
2772
+ getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
2773
+ };
2774
+ imports.wbg.__wbg_from_89e3fc3ba5e6fb48 = function(arg0) {
2775
+ const ret = Array.from(getObject(arg0));
2776
+ return addHeapObject(ret);
2777
+ };
2778
+ imports.wbg.__wbg_forEach_2be8de7347d63332 = function(arg0, arg1, arg2) {
2779
+ try {
2780
+ var state0 = { a: arg1, b: arg2 };
2781
+ var cb0 = (arg02, arg12, arg22) => {
2782
+ const a = state0.a;
2783
+ state0.a = 0;
2784
+ try {
2785
+ return __wbg_adapter_339(a, state0.b, arg02, arg12, arg22);
2786
+ } finally {
2787
+ state0.a = a;
2788
+ }
2789
+ };
2790
+ getObject(arg0).forEach(cb0);
2791
+ } finally {
2792
+ state0.a = state0.b = 0;
2793
+ }
2794
+ };
2795
+ imports.wbg.__wbg_isArray_2ab64d95e09ea0ae = function(arg0) {
2796
+ const ret = Array.isArray(getObject(arg0));
2797
+ return ret;
2798
+ };
2799
+ imports.wbg.__wbg_of_4a2b313a453ec059 = function(arg0) {
2800
+ const ret = Array.of(getObject(arg0));
2801
+ return addHeapObject(ret);
2802
+ };
2803
+ imports.wbg.__wbg_push_a5b05aedc7234f9f = function(arg0, arg1) {
2804
+ const ret = getObject(arg0).push(getObject(arg1));
2805
+ return ret;
2806
+ };
2807
+ imports.wbg.__wbg_instanceof_ArrayBuffer_836825be07d4c9d2 = function(arg0) {
2808
+ let result;
2809
+ try {
2810
+ result = getObject(arg0) instanceof ArrayBuffer;
2811
+ } catch (_) {
2812
+ result = false;
2813
+ }
2814
+ const ret = result;
2815
+ return ret;
2816
+ };
2817
+ imports.wbg.__wbg_message_5bf28016c2b49cfb = function(arg0) {
2818
+ const ret = getObject(arg0).message;
2819
+ return addHeapObject(ret);
2820
+ };
2821
+ imports.wbg.__wbg_name_e7429f0dda6079e2 = function(arg0) {
2822
+ const ret = getObject(arg0).name;
2823
+ return addHeapObject(ret);
2824
+ };
2825
+ imports.wbg.__wbg_call_b3ca7c6051f9bec1 = function() {
2826
+ return handleError(function(arg0, arg1, arg2) {
2827
+ const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
2828
+ return addHeapObject(ret);
2829
+ }, arguments);
2830
+ };
2831
+ imports.wbg.__wbg_call_938992c832f74314 = function() {
2832
+ return handleError(function(arg0, arg1, arg2, arg3, arg4) {
2833
+ const ret = getObject(arg0).call(getObject(arg1), getObject(arg2), getObject(arg3), getObject(arg4));
2834
+ return addHeapObject(ret);
2835
+ }, arguments);
2836
+ };
2837
+ imports.wbg.__wbg_set_8417257aaedc936b = function(arg0, arg1, arg2) {
2838
+ const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
2839
+ return addHeapObject(ret);
2840
+ };
2841
+ imports.wbg.__wbg_isSafeInteger_f7b04ef02296c4d2 = function(arg0) {
2842
+ const ret = Number.isSafeInteger(getObject(arg0));
2843
+ return ret;
2844
+ };
2845
+ imports.wbg.__wbg_getTime_2bc4375165f02d15 = function(arg0) {
2846
+ const ret = getObject(arg0).getTime();
2847
+ return ret;
2848
+ };
2849
+ imports.wbg.__wbg_new0_7d84e5b2cd9fdc73 = function() {
2850
+ const ret = /* @__PURE__ */ new Date();
2851
+ return addHeapObject(ret);
2852
+ };
2853
+ imports.wbg.__wbg_instanceof_Object_71ca3c0a59266746 = function(arg0) {
2854
+ let result;
2855
+ try {
2856
+ result = getObject(arg0) instanceof Object;
2857
+ } catch (_) {
2858
+ result = false;
2859
+ }
2860
+ const ret = result;
2861
+ return ret;
2862
+ };
2863
+ imports.wbg.__wbg_assign_496d2d14fecafbcf = function(arg0, arg1) {
2864
+ const ret = Object.assign(getObject(arg0), getObject(arg1));
2865
+ return addHeapObject(ret);
2866
+ };
2867
+ imports.wbg.__wbg_entries_95cc2c823b285a09 = function(arg0) {
2868
+ const ret = Object.entries(getObject(arg0));
2869
+ return addHeapObject(ret);
2870
+ };
2871
+ imports.wbg.__wbg_is_010fdc0f4ab96916 = function(arg0, arg1) {
2872
+ const ret = Object.is(getObject(arg0), getObject(arg1));
2873
+ return ret;
2874
+ };
2875
+ imports.wbg.__wbg_keys_91e412b4b222659f = function(arg0) {
2876
+ const ret = Object.keys(getObject(arg0));
2877
+ return addHeapObject(ret);
2878
+ };
2879
+ imports.wbg.__wbg_new_81740750da40724f = function(arg0, arg1) {
2880
+ try {
2881
+ var state0 = { a: arg0, b: arg1 };
2882
+ var cb0 = (arg02, arg12) => {
2883
+ const a = state0.a;
2884
+ state0.a = 0;
2885
+ try {
2886
+ return __wbg_adapter_396(a, state0.b, arg02, arg12);
2887
+ } finally {
2888
+ state0.a = a;
2889
+ }
2890
+ };
2891
+ const ret = new Promise(cb0);
2892
+ return addHeapObject(ret);
2893
+ } finally {
2894
+ state0.a = state0.b = 0;
2895
+ }
2896
+ };
2897
+ imports.wbg.__wbg_resolve_b0083a7967828ec8 = function(arg0) {
2898
+ const ret = Promise.resolve(getObject(arg0));
2899
+ return addHeapObject(ret);
2900
+ };
2901
+ imports.wbg.__wbg_then_0c86a60e8fcfe9f6 = function(arg0, arg1) {
2902
+ const ret = getObject(arg0).then(getObject(arg1));
2903
+ return addHeapObject(ret);
2904
+ };
2905
+ imports.wbg.__wbg_then_a73caa9a87991566 = function(arg0, arg1, arg2) {
2906
+ const ret = getObject(arg0).then(getObject(arg1), getObject(arg2));
2907
+ return addHeapObject(ret);
2908
+ };
2909
+ imports.wbg.__wbg_buffer_12d079cc21e14bdb = function(arg0) {
2910
+ const ret = getObject(arg0).buffer;
2911
+ return addHeapObject(ret);
2912
+ };
2913
+ imports.wbg.__wbg_newwithbyteoffsetandlength_aa4a17c33a06e5cb = function(arg0, arg1, arg2) {
2914
+ const ret = new Uint8Array(getObject(arg0), arg1 >>> 0, arg2 >>> 0);
2915
+ return addHeapObject(ret);
2916
+ };
2917
+ imports.wbg.__wbg_new_63b92bc8671ed464 = function(arg0) {
2918
+ const ret = new Uint8Array(getObject(arg0));
2919
+ return addHeapObject(ret);
2920
+ };
2921
+ imports.wbg.__wbg_set_a47bac70306a19a7 = function(arg0, arg1, arg2) {
2922
+ getObject(arg0).set(getObject(arg1), arg2 >>> 0);
2923
+ };
2924
+ imports.wbg.__wbg_length_c20a40f15020d68a = function(arg0) {
2925
+ const ret = getObject(arg0).length;
2926
+ return ret;
2927
+ };
2928
+ imports.wbg.__wbg_instanceof_Uint8Array_2b3bbecd033d19f6 = function(arg0) {
2929
+ let result;
2930
+ try {
2931
+ result = getObject(arg0) instanceof Uint8Array;
2932
+ } catch (_) {
2933
+ result = false;
2934
+ }
2935
+ const ret = result;
2936
+ return ret;
2937
+ };
2938
+ imports.wbg.__wbg_newwithlength_e9b4878cebadb3d3 = function(arg0) {
2939
+ const ret = new Uint8Array(arg0 >>> 0);
2940
+ return addHeapObject(ret);
2941
+ };
2942
+ imports.wbg.__wbg_subarray_a1f73cd4b5b42fe1 = function(arg0, arg1, arg2) {
2943
+ const ret = getObject(arg0).subarray(arg1 >>> 0, arg2 >>> 0);
2944
+ return addHeapObject(ret);
2945
+ };
2946
+ imports.wbg.__wbg_apply_0a5aa603881e6d79 = function() {
2947
+ return handleError(function(arg0, arg1, arg2) {
2948
+ const ret = Reflect.apply(getObject(arg0), getObject(arg1), getObject(arg2));
2949
+ return addHeapObject(ret);
2950
+ }, arguments);
2951
+ };
2952
+ imports.wbg.__wbg_deleteProperty_13e721a56f19e842 = function() {
2953
+ return handleError(function(arg0, arg1) {
2954
+ const ret = Reflect.deleteProperty(getObject(arg0), getObject(arg1));
2955
+ return ret;
2956
+ }, arguments);
2957
+ };
2958
+ imports.wbg.__wbg_has_0af94d20077affa2 = function() {
2959
+ return handleError(function(arg0, arg1) {
2960
+ const ret = Reflect.has(getObject(arg0), getObject(arg1));
2961
+ return ret;
2962
+ }, arguments);
2963
+ };
2964
+ imports.wbg.__wbg_set_1f9b04f170055d33 = function() {
2965
+ return handleError(function(arg0, arg1, arg2) {
2966
+ const ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2));
2967
+ return ret;
2968
+ }, arguments);
2969
+ };
2970
+ imports.wbg.__wbg_parse_66d1801634e099ac = function() {
2971
+ return handleError(function(arg0, arg1) {
2972
+ const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
2973
+ return addHeapObject(ret);
2974
+ }, arguments);
2975
+ };
2976
+ imports.wbg.__wbg_stringify_8887fe74e1c50d81 = function() {
2977
+ return handleError(function(arg0) {
2978
+ const ret = JSON.stringify(getObject(arg0));
2979
+ return addHeapObject(ret);
2980
+ }, arguments);
2981
+ };
2982
+ imports.wbg.__wbindgen_bigint_get_as_i64 = function(arg0, arg1) {
2983
+ const v = getObject(arg1);
2984
+ const ret = typeof v === "bigint" ? v : void 0;
2985
+ getBigInt64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? BigInt(0) : ret;
2986
+ getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret);
2987
+ };
2988
+ imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
2989
+ const ret = debugString(getObject(arg1));
2990
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2991
+ const len1 = WASM_VECTOR_LEN;
2992
+ getInt32Memory0()[arg0 / 4 + 1] = len1;
2993
+ getInt32Memory0()[arg0 / 4 + 0] = ptr1;
2994
+ };
2995
+ imports.wbg.__wbindgen_throw = function(arg0, arg1) {
2996
+ throw new Error(getStringFromWasm0(arg0, arg1));
2997
+ };
2998
+ imports.wbg.__wbindgen_memory = function() {
2999
+ const ret = wasm.memory;
3000
+ return addHeapObject(ret);
3001
+ };
3002
+ imports.wbg.__wbindgen_closure_wrapper960 = function(arg0, arg1, arg2) {
3003
+ const ret = makeMutClosure(arg0, arg1, 342, __wbg_adapter_56);
3004
+ return addHeapObject(ret);
3005
+ };
3006
+ imports.wbg.__wbindgen_closure_wrapper962 = function(arg0, arg1, arg2) {
3007
+ const ret = makeClosure(arg0, arg1, 342, __wbg_adapter_59);
3008
+ return addHeapObject(ret);
3009
+ };
3010
+ imports.wbg.__wbindgen_closure_wrapper964 = function(arg0, arg1, arg2) {
3011
+ const ret = makeMutClosure(arg0, arg1, 342, __wbg_adapter_62);
3012
+ return addHeapObject(ret);
3013
+ };
3014
+ imports.wbg.__wbindgen_closure_wrapper1629 = function(arg0, arg1, arg2) {
3015
+ const ret = makeMutClosure(arg0, arg1, 444, __wbg_adapter_65);
3016
+ return addHeapObject(ret);
3017
+ };
3018
+ return imports;
3019
+ }
3020
+ function __wbg_init_memory(imports, maybe_memory) {
3021
+ }
3022
+ function __wbg_finalize_init(instance, module2) {
3023
+ wasm = instance.exports;
3024
+ __wbg_init.__wbindgen_wasm_module = module2;
3025
+ cachedBigInt64Memory0 = null;
3026
+ cachedFloat64Memory0 = null;
3027
+ cachedInt32Memory0 = null;
3028
+ cachedUint32Memory0 = null;
3029
+ cachedUint8Memory0 = null;
3030
+ wasm.__wbindgen_start();
3031
+ return wasm;
3032
+ }
3033
+ function initSync(module2) {
3034
+ if (wasm !== void 0) return wasm;
3035
+ const imports = __wbg_get_imports();
3036
+ __wbg_init_memory(imports);
3037
+ if (!(module2 instanceof WebAssembly.Module)) {
3038
+ module2 = new WebAssembly.Module(module2);
3039
+ }
3040
+ const instance = new WebAssembly.Instance(module2, imports);
3041
+ return __wbg_finalize_init(instance, module2);
3042
+ }
3043
+ async function __wbg_init(input) {
3044
+ if (wasm !== void 0) return wasm;
3045
+ const imports = __wbg_get_imports();
3046
+ if (typeof input === "string" || typeof Request === "function" && input instanceof Request || typeof URL === "function" && input instanceof URL) {
3047
+ input = fetch(input);
3048
+ }
3049
+ __wbg_init_memory(imports);
3050
+ const { instance, module: module2 } = await __wbg_load(await input, imports);
3051
+ return __wbg_finalize_init(instance, module2);
3052
+ }
3053
+ var ridb_core_default = __wbg_init;
3054
+ export {
3055
+ BasePlugin,
3056
+ BaseStorage,
3057
+ Collection,
3058
+ CoreStorage,
3059
+ Database,
3060
+ Errors,
3061
+ InMemory,
3062
+ IndexDB,
3063
+ OpType,
3064
+ Operation,
3065
+ Property,
3066
+ Query,
3067
+ QueryOptions,
3068
+ RIDBError,
3069
+ Schema,
3070
+ WasmBindgenTestContext,
3071
+ __wbgtest_console_debug,
3072
+ __wbgtest_console_error,
3073
+ __wbgtest_console_info,
3074
+ __wbgtest_console_log,
3075
+ __wbgtest_console_warn,
3076
+ ridb_core_default as default,
3077
+ initSync,
3078
+ is_debug_mode,
3079
+ main_js
3080
+ };