ducjs 3.0.3 → 3.0.5

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,850 @@
1
+ let wasm;
2
+
3
+ let cachedUint8ArrayMemory0 = null;
4
+
5
+ function getUint8ArrayMemory0() {
6
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
7
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
8
+ }
9
+ return cachedUint8ArrayMemory0;
10
+ }
11
+
12
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
13
+
14
+ cachedTextDecoder.decode();
15
+
16
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
17
+ let numBytesDecoded = 0;
18
+ function decodeText(ptr, len) {
19
+ numBytesDecoded += len;
20
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
21
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
22
+ cachedTextDecoder.decode();
23
+ numBytesDecoded = len;
24
+ }
25
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
26
+ }
27
+
28
+ function getStringFromWasm0(ptr, len) {
29
+ ptr = ptr >>> 0;
30
+ return decodeText(ptr, len);
31
+ }
32
+
33
+ let WASM_VECTOR_LEN = 0;
34
+
35
+ const cachedTextEncoder = new TextEncoder();
36
+
37
+ if (!('encodeInto' in cachedTextEncoder)) {
38
+ cachedTextEncoder.encodeInto = function (arg, view) {
39
+ const buf = cachedTextEncoder.encode(arg);
40
+ view.set(buf);
41
+ return {
42
+ read: arg.length,
43
+ written: buf.length
44
+ };
45
+ }
46
+ }
47
+
48
+ function passStringToWasm0(arg, malloc, realloc) {
49
+
50
+ if (realloc === undefined) {
51
+ const buf = cachedTextEncoder.encode(arg);
52
+ const ptr = malloc(buf.length, 1) >>> 0;
53
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
54
+ WASM_VECTOR_LEN = buf.length;
55
+ return ptr;
56
+ }
57
+
58
+ let len = arg.length;
59
+ let ptr = malloc(len, 1) >>> 0;
60
+
61
+ const mem = getUint8ArrayMemory0();
62
+
63
+ let offset = 0;
64
+
65
+ for (; offset < len; offset++) {
66
+ const code = arg.charCodeAt(offset);
67
+ if (code > 0x7F) break;
68
+ mem[ptr + offset] = code;
69
+ }
70
+
71
+ if (offset !== len) {
72
+ if (offset !== 0) {
73
+ arg = arg.slice(offset);
74
+ }
75
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
76
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
77
+ const ret = cachedTextEncoder.encodeInto(arg, view);
78
+
79
+ offset += ret.written;
80
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
81
+ }
82
+
83
+ WASM_VECTOR_LEN = offset;
84
+ return ptr;
85
+ }
86
+
87
+ let cachedDataViewMemory0 = null;
88
+
89
+ function getDataViewMemory0() {
90
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
91
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
92
+ }
93
+ return cachedDataViewMemory0;
94
+ }
95
+
96
+ function addToExternrefTable0(obj) {
97
+ const idx = wasm.__externref_table_alloc();
98
+ wasm.__wbindgen_export_4.set(idx, obj);
99
+ return idx;
100
+ }
101
+
102
+ function handleError(f, args) {
103
+ try {
104
+ return f.apply(this, args);
105
+ } catch (e) {
106
+ const idx = addToExternrefTable0(e);
107
+ wasm.__wbindgen_exn_store(idx);
108
+ }
109
+ }
110
+
111
+ function getArrayU8FromWasm0(ptr, len) {
112
+ ptr = ptr >>> 0;
113
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
114
+ }
115
+
116
+ function isLikeNone(x) {
117
+ return x === undefined || x === null;
118
+ }
119
+
120
+ function debugString(val) {
121
+ // primitive types
122
+ const type = typeof val;
123
+ if (type == 'number' || type == 'boolean' || val == null) {
124
+ return `${val}`;
125
+ }
126
+ if (type == 'string') {
127
+ return `"${val}"`;
128
+ }
129
+ if (type == 'symbol') {
130
+ const description = val.description;
131
+ if (description == null) {
132
+ return 'Symbol';
133
+ } else {
134
+ return `Symbol(${description})`;
135
+ }
136
+ }
137
+ if (type == 'function') {
138
+ const name = val.name;
139
+ if (typeof name == 'string' && name.length > 0) {
140
+ return `Function(${name})`;
141
+ } else {
142
+ return 'Function';
143
+ }
144
+ }
145
+ // objects
146
+ if (Array.isArray(val)) {
147
+ const length = val.length;
148
+ let debug = '[';
149
+ if (length > 0) {
150
+ debug += debugString(val[0]);
151
+ }
152
+ for(let i = 1; i < length; i++) {
153
+ debug += ', ' + debugString(val[i]);
154
+ }
155
+ debug += ']';
156
+ return debug;
157
+ }
158
+ // Test for built-in
159
+ const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
160
+ let className;
161
+ if (builtInMatches && builtInMatches.length > 1) {
162
+ className = builtInMatches[1];
163
+ } else {
164
+ // Failed to match the standard '[object ClassName]'
165
+ return toString.call(val);
166
+ }
167
+ if (className == 'Object') {
168
+ // we're a user defined class or Object
169
+ // JSON.stringify avoids problems with cycles, and is generally much
170
+ // easier than looping through ownProperties of `val`.
171
+ try {
172
+ return 'Object(' + JSON.stringify(val) + ')';
173
+ } catch (_) {
174
+ return 'Object';
175
+ }
176
+ }
177
+ // errors
178
+ if (val instanceof Error) {
179
+ return `${val.name}: ${val.message}\n${val.stack}`;
180
+ }
181
+ // TODO we could test for more things here, like `Set`s and `Map`s.
182
+ return className;
183
+ }
184
+
185
+ function passArray8ToWasm0(arg, malloc) {
186
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
187
+ getUint8ArrayMemory0().set(arg, ptr / 1);
188
+ WASM_VECTOR_LEN = arg.length;
189
+ return ptr;
190
+ }
191
+
192
+ function takeFromExternrefTable0(idx) {
193
+ const value = wasm.__wbindgen_export_4.get(idx);
194
+ wasm.__externref_table_dealloc(idx);
195
+ return value;
196
+ }
197
+ /**
198
+ * Fetch a single external file from a `.duc` buffer by file ID.
199
+ *
200
+ * Returns the file entry as a JS object, or `undefined` if not found.
201
+ * @param {Uint8Array} buf
202
+ * @param {string} file_id
203
+ * @returns {any}
204
+ */
205
+ export function getExternalFile(buf, file_id) {
206
+ const ptr0 = passArray8ToWasm0(buf, wasm.__wbindgen_malloc);
207
+ const len0 = WASM_VECTOR_LEN;
208
+ const ptr1 = passStringToWasm0(file_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
209
+ const len1 = WASM_VECTOR_LEN;
210
+ const ret = wasm.getExternalFile(ptr0, len0, ptr1, len1);
211
+ if (ret[2]) {
212
+ throw takeFromExternrefTable0(ret[1]);
213
+ }
214
+ return takeFromExternrefTable0(ret[0]);
215
+ }
216
+
217
+ /**
218
+ * Restore a specific checkpoint by its ID from a `.duc` file buffer.
219
+ *
220
+ * Returns a JS object `{ versionNumber, schemaVersion, data, fromCheckpoint }`.
221
+ * @param {Uint8Array} duc_buf
222
+ * @param {string} checkpoint_id
223
+ * @returns {any}
224
+ */
225
+ export function restoreCheckpoint(duc_buf, checkpoint_id) {
226
+ const ptr0 = passArray8ToWasm0(duc_buf, wasm.__wbindgen_malloc);
227
+ const len0 = WASM_VECTOR_LEN;
228
+ const ptr1 = passStringToWasm0(checkpoint_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
229
+ const len1 = WASM_VECTOR_LEN;
230
+ const ret = wasm.restoreCheckpoint(ptr0, len0, ptr1, len1);
231
+ if (ret[2]) {
232
+ throw takeFromExternrefTable0(ret[1]);
233
+ }
234
+ return takeFromExternrefTable0(ret[0]);
235
+ }
236
+
237
+ /**
238
+ * List all versions (checkpoints + deltas) from a `.duc` file buffer.
239
+ *
240
+ * Returns a JS array of `VersionEntry` objects (no heavy data blobs).
241
+ * @param {Uint8Array} duc_buf
242
+ * @returns {any}
243
+ */
244
+ export function listVersions(duc_buf) {
245
+ const ptr0 = passArray8ToWasm0(duc_buf, wasm.__wbindgen_malloc);
246
+ const len0 = WASM_VECTOR_LEN;
247
+ const ret = wasm.listVersions(ptr0, len0);
248
+ if (ret[2]) {
249
+ throw takeFromExternrefTable0(ret[1]);
250
+ }
251
+ return takeFromExternrefTable0(ret[0]);
252
+ }
253
+
254
+ /**
255
+ * Read the full VersionGraph from a `.duc` file buffer.
256
+ *
257
+ * Returns a JS object matching the `VersionGraph` TypeScript interface,
258
+ * or `undefined` if no version graph exists.
259
+ * @param {Uint8Array} duc_buf
260
+ * @returns {any}
261
+ */
262
+ export function readVersionGraph(duc_buf) {
263
+ const ptr0 = passArray8ToWasm0(duc_buf, wasm.__wbindgen_malloc);
264
+ const len0 = WASM_VECTOR_LEN;
265
+ const ret = wasm.readVersionGraph(ptr0, len0);
266
+ if (ret[2]) {
267
+ throw takeFromExternrefTable0(ret[1]);
268
+ }
269
+ return takeFromExternrefTable0(ret[0]);
270
+ }
271
+
272
+ /**
273
+ * Returns the current version-control schema version defined in Rust.
274
+ *
275
+ * TypeScript should use this as the source of truth instead of hardcoding
276
+ * its own constant. When this value is bumped in Rust, the version control
277
+ * system will automatically handle migration bookkeeping (closing old chains,
278
+ * recording migrations) the next time a checkpoint or delta is created.
279
+ * @returns {number}
280
+ */
281
+ export function getCurrentSchemaVersion() {
282
+ return 3000000;
283
+ }
284
+
285
+ /**
286
+ * Restore the document state at `version_number` from a `.duc` file buffer.
287
+ *
288
+ * The `.duc` file is a SQLite database — this function opens it and queries
289
+ * the `checkpoints` / `deltas` tables directly for version restoration.
290
+ *
291
+ * Returns a JS object `{ versionNumber, schemaVersion, data, fromCheckpoint }`.
292
+ * @param {Uint8Array} duc_buf
293
+ * @param {number} version_number
294
+ * @returns {any}
295
+ */
296
+ export function restoreVersion(duc_buf, version_number) {
297
+ const ptr0 = passArray8ToWasm0(duc_buf, wasm.__wbindgen_malloc);
298
+ const len0 = WASM_VECTOR_LEN;
299
+ const ret = wasm.restoreVersion(ptr0, len0, version_number);
300
+ if (ret[2]) {
301
+ throw takeFromExternrefTable0(ret[1]);
302
+ }
303
+ return takeFromExternrefTable0(ret[0]);
304
+ }
305
+
306
+ /**
307
+ * Revert the document to a specific version, removing all newer versions.
308
+ *
309
+ * Returns a JS object `{ versionNumber, schemaVersion, data, fromCheckpoint }`.
310
+ * @param {Uint8Array} duc_buf
311
+ * @param {number} target_version
312
+ * @returns {any}
313
+ */
314
+ export function revertToVersion(duc_buf, target_version) {
315
+ const ptr0 = passArray8ToWasm0(duc_buf, wasm.__wbindgen_malloc);
316
+ const len0 = WASM_VECTOR_LEN;
317
+ const ret = wasm.revertToVersion(ptr0, len0, target_version);
318
+ if (ret[2]) {
319
+ throw takeFromExternrefTable0(ret[1]);
320
+ }
321
+ return takeFromExternrefTable0(ret[0]);
322
+ }
323
+
324
+ /**
325
+ * Apply a changeset to reconstruct document state.
326
+ *
327
+ * `base_state` must be the exact checkpoint data used when the changeset
328
+ * was created. Returns the full document state as `Uint8Array`.
329
+ *
330
+ * Handles all changeset formats transparently:
331
+ * - v3 (bsdiff), v2 (XOR diff), v1 (zlib full snapshot)
332
+ * @param {Uint8Array} base_state
333
+ * @param {Uint8Array} changeset
334
+ * @returns {Uint8Array}
335
+ */
336
+ export function applyDeltaChangeset(base_state, changeset) {
337
+ const ptr0 = passArray8ToWasm0(base_state, wasm.__wbindgen_malloc);
338
+ const len0 = WASM_VECTOR_LEN;
339
+ const ptr1 = passArray8ToWasm0(changeset, wasm.__wbindgen_malloc);
340
+ const len1 = WASM_VECTOR_LEN;
341
+ const ret = wasm.applyDeltaChangeset(ptr0, len0, ptr1, len1);
342
+ if (ret[3]) {
343
+ throw takeFromExternrefTable0(ret[2]);
344
+ }
345
+ var v3 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
346
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
347
+ return v3;
348
+ }
349
+
350
+ /**
351
+ * List metadata for all external files (without loading the heavy data blobs).
352
+ * @param {Uint8Array} buf
353
+ * @returns {any}
354
+ */
355
+ export function listExternalFiles(buf) {
356
+ const ptr0 = passArray8ToWasm0(buf, wasm.__wbindgen_malloc);
357
+ const len0 = WASM_VECTOR_LEN;
358
+ const ret = wasm.listExternalFiles(ptr0, len0);
359
+ if (ret[2]) {
360
+ throw takeFromExternrefTable0(ret[1]);
361
+ }
362
+ return takeFromExternrefTable0(ret[0]);
363
+ }
364
+
365
+ /**
366
+ * Serialize a JS object (ExportedDataState) into `.duc` bytes (Uint8Array).
367
+ * @param {any} data
368
+ * @returns {Uint8Array}
369
+ */
370
+ export function serializeDuc(data) {
371
+ const ret = wasm.serializeDuc(data);
372
+ if (ret[3]) {
373
+ throw takeFromExternrefTable0(ret[2]);
374
+ }
375
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
376
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
377
+ return v1;
378
+ }
379
+
380
+ /**
381
+ * Compute a checkpoint-relative binary diff changeset using bsdiff.
382
+ *
383
+ * `base_state` is the checkpoint's full data blob.
384
+ * `current_state` is the full document state at the new version.
385
+ *
386
+ * Returns an encoded changeset (`Uint8Array`) ready for storage in a
387
+ * `Delta.payload`. bsdiff finds matching blocks even when they shift
388
+ * offsets, which is critical for SQLite databases.
389
+ * @param {Uint8Array} base_state
390
+ * @param {Uint8Array} current_state
391
+ * @returns {Uint8Array}
392
+ */
393
+ export function createDeltaChangeset(base_state, current_state) {
394
+ const ptr0 = passArray8ToWasm0(base_state, wasm.__wbindgen_malloc);
395
+ const len0 = WASM_VECTOR_LEN;
396
+ const ptr1 = passArray8ToWasm0(current_state, wasm.__wbindgen_malloc);
397
+ const len1 = WASM_VECTOR_LEN;
398
+ const ret = wasm.createDeltaChangeset(ptr0, len0, ptr1, len1);
399
+ if (ret[3]) {
400
+ throw takeFromExternrefTable0(ret[2]);
401
+ }
402
+ var v3 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
403
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
404
+ return v3;
405
+ }
406
+
407
+ /**
408
+ * Parse a `.duc` file (Uint8Array) into a JS object (ExportedDataState).
409
+ * @param {Uint8Array} buf
410
+ * @returns {any}
411
+ */
412
+ export function parseDuc(buf) {
413
+ const ptr0 = passArray8ToWasm0(buf, wasm.__wbindgen_malloc);
414
+ const len0 = WASM_VECTOR_LEN;
415
+ const ret = wasm.parseDuc(ptr0, len0);
416
+ if (ret[2]) {
417
+ throw takeFromExternrefTable0(ret[1]);
418
+ }
419
+ return takeFromExternrefTable0(ret[0]);
420
+ }
421
+
422
+ /**
423
+ * Parse a `.duc` file lazily — returns everything EXCEPT external file data blobs.
424
+ *
425
+ * Use `getExternalFile()` or `listExternalFiles()` for on-demand access.
426
+ * @param {Uint8Array} buf
427
+ * @returns {any}
428
+ */
429
+ export function parseDucLazy(buf) {
430
+ const ptr0 = passArray8ToWasm0(buf, wasm.__wbindgen_malloc);
431
+ const len0 = WASM_VECTOR_LEN;
432
+ const ret = wasm.parseDucLazy(ptr0, len0);
433
+ if (ret[2]) {
434
+ throw takeFromExternrefTable0(ret[1]);
435
+ }
436
+ return takeFromExternrefTable0(ret[0]);
437
+ }
438
+
439
+ const EXPECTED_RESPONSE_TYPES = new Set(['basic', 'cors', 'default']);
440
+
441
+ async function __wbg_load(module, imports) {
442
+ if (typeof Response === 'function' && module instanceof Response) {
443
+ if (typeof WebAssembly.instantiateStreaming === 'function') {
444
+ try {
445
+ return await WebAssembly.instantiateStreaming(module, imports);
446
+
447
+ } catch (e) {
448
+ const validResponse = module.ok && EXPECTED_RESPONSE_TYPES.has(module.type);
449
+
450
+ if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
451
+ 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);
452
+
453
+ } else {
454
+ throw e;
455
+ }
456
+ }
457
+ }
458
+
459
+ const bytes = await module.arrayBuffer();
460
+ return await WebAssembly.instantiate(bytes, imports);
461
+
462
+ } else {
463
+ const instance = await WebAssembly.instantiate(module, imports);
464
+
465
+ if (instance instanceof WebAssembly.Instance) {
466
+ return { instance, module };
467
+
468
+ } else {
469
+ return instance;
470
+ }
471
+ }
472
+ }
473
+
474
+ function __wbg_get_imports() {
475
+ const imports = {};
476
+ imports.wbg = {};
477
+ imports.wbg.__wbg_Error_e17e777aac105295 = function(arg0, arg1) {
478
+ const ret = Error(getStringFromWasm0(arg0, arg1));
479
+ return ret;
480
+ };
481
+ imports.wbg.__wbg_Number_998bea33bd87c3e0 = function(arg0) {
482
+ const ret = Number(arg0);
483
+ return ret;
484
+ };
485
+ imports.wbg.__wbg_String_8f0eb39a4a4c2f66 = function(arg0, arg1) {
486
+ const ret = String(arg1);
487
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
488
+ const len1 = WASM_VECTOR_LEN;
489
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
490
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
491
+ };
492
+ imports.wbg.__wbg_call_13410aac570ffff7 = function() { return handleError(function (arg0, arg1) {
493
+ const ret = arg0.call(arg1);
494
+ return ret;
495
+ }, arguments) };
496
+ imports.wbg.__wbg_done_75ed0ee6dd243d9d = function(arg0) {
497
+ const ret = arg0.done;
498
+ return ret;
499
+ };
500
+ imports.wbg.__wbg_entries_2be2f15bd5554996 = function(arg0) {
501
+ const ret = Object.entries(arg0);
502
+ return ret;
503
+ };
504
+ imports.wbg.__wbg_from_88bc52ce20ba6318 = function(arg0) {
505
+ const ret = Array.from(arg0);
506
+ return ret;
507
+ };
508
+ imports.wbg.__wbg_getDate_9615e288fc892247 = function(arg0) {
509
+ const ret = arg0.getDate();
510
+ return ret;
511
+ };
512
+ imports.wbg.__wbg_getDay_c9c4f57fb4ef6fef = function(arg0) {
513
+ const ret = arg0.getDay();
514
+ return ret;
515
+ };
516
+ imports.wbg.__wbg_getFullYear_e351a9fa7d2fab83 = function(arg0) {
517
+ const ret = arg0.getFullYear();
518
+ return ret;
519
+ };
520
+ imports.wbg.__wbg_getHours_4cc14de357c9e723 = function(arg0) {
521
+ const ret = arg0.getHours();
522
+ return ret;
523
+ };
524
+ imports.wbg.__wbg_getMinutes_6cde8fdd08b0c2ec = function(arg0) {
525
+ const ret = arg0.getMinutes();
526
+ return ret;
527
+ };
528
+ imports.wbg.__wbg_getMonth_8cc234bce5c8bcac = function(arg0) {
529
+ const ret = arg0.getMonth();
530
+ return ret;
531
+ };
532
+ imports.wbg.__wbg_getRandomValues_933a06e2370405af = function() { return handleError(function (arg0, arg1) {
533
+ globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
534
+ }, arguments) };
535
+ imports.wbg.__wbg_getSeconds_c2f02452d804ece0 = function(arg0) {
536
+ const ret = arg0.getSeconds();
537
+ return ret;
538
+ };
539
+ imports.wbg.__wbg_getTime_6bb3f64e0f18f817 = function(arg0) {
540
+ const ret = arg0.getTime();
541
+ return ret;
542
+ };
543
+ imports.wbg.__wbg_getTimezoneOffset_1e3ddc1382e7c8b0 = function(arg0) {
544
+ const ret = arg0.getTimezoneOffset();
545
+ return ret;
546
+ };
547
+ imports.wbg.__wbg_get_0da715ceaecea5c8 = function(arg0, arg1) {
548
+ const ret = arg0[arg1 >>> 0];
549
+ return ret;
550
+ };
551
+ imports.wbg.__wbg_get_458e874b43b18b25 = function() { return handleError(function (arg0, arg1) {
552
+ const ret = Reflect.get(arg0, arg1);
553
+ return ret;
554
+ }, arguments) };
555
+ imports.wbg.__wbg_getwithrefkey_1dc361bd10053bfe = function(arg0, arg1) {
556
+ const ret = arg0[arg1];
557
+ return ret;
558
+ };
559
+ imports.wbg.__wbg_instanceof_ArrayBuffer_67f3012529f6a2dd = function(arg0) {
560
+ let result;
561
+ try {
562
+ result = arg0 instanceof ArrayBuffer;
563
+ } catch (_) {
564
+ result = false;
565
+ }
566
+ const ret = result;
567
+ return ret;
568
+ };
569
+ imports.wbg.__wbg_instanceof_Map_ebb01a5b6b5ffd0b = function(arg0) {
570
+ let result;
571
+ try {
572
+ result = arg0 instanceof Map;
573
+ } catch (_) {
574
+ result = false;
575
+ }
576
+ const ret = result;
577
+ return ret;
578
+ };
579
+ imports.wbg.__wbg_instanceof_Uint8Array_9a8378d955933db7 = function(arg0) {
580
+ let result;
581
+ try {
582
+ result = arg0 instanceof Uint8Array;
583
+ } catch (_) {
584
+ result = false;
585
+ }
586
+ const ret = result;
587
+ return ret;
588
+ };
589
+ imports.wbg.__wbg_isArray_030cce220591fb41 = function(arg0) {
590
+ const ret = Array.isArray(arg0);
591
+ return ret;
592
+ };
593
+ imports.wbg.__wbg_isSafeInteger_1c0d1af5542e102a = function(arg0) {
594
+ const ret = Number.isSafeInteger(arg0);
595
+ return ret;
596
+ };
597
+ imports.wbg.__wbg_iterator_f370b34483c71a1c = function() {
598
+ const ret = Symbol.iterator;
599
+ return ret;
600
+ };
601
+ imports.wbg.__wbg_length_186546c51cd61acd = function(arg0) {
602
+ const ret = arg0.length;
603
+ return ret;
604
+ };
605
+ imports.wbg.__wbg_length_6bb7e81f9d7713e4 = function(arg0) {
606
+ const ret = arg0.length;
607
+ return ret;
608
+ };
609
+ imports.wbg.__wbg_new0_b0a0a38c201e6df5 = function() {
610
+ const ret = new Date();
611
+ return ret;
612
+ };
613
+ imports.wbg.__wbg_new_19c25a3f2fa63a02 = function() {
614
+ const ret = new Object();
615
+ return ret;
616
+ };
617
+ imports.wbg.__wbg_new_1f3a344cf3123716 = function() {
618
+ const ret = new Array();
619
+ return ret;
620
+ };
621
+ imports.wbg.__wbg_new_2ff1f68f3676ea53 = function() {
622
+ const ret = new Map();
623
+ return ret;
624
+ };
625
+ imports.wbg.__wbg_new_5a2ae4557f92b50e = function(arg0) {
626
+ const ret = new Date(arg0);
627
+ return ret;
628
+ };
629
+ imports.wbg.__wbg_new_638ebfaedbf32a5e = function(arg0) {
630
+ const ret = new Uint8Array(arg0);
631
+ return ret;
632
+ };
633
+ imports.wbg.__wbg_newfromslice_074c56947bd43469 = function(arg0, arg1) {
634
+ const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
635
+ return ret;
636
+ };
637
+ imports.wbg.__wbg_newwithyearmonthday_9d5466a369f2521d = function(arg0, arg1, arg2) {
638
+ const ret = new Date(arg0 >>> 0, arg1, arg2);
639
+ return ret;
640
+ };
641
+ imports.wbg.__wbg_next_5b3530e612fde77d = function(arg0) {
642
+ const ret = arg0.next;
643
+ return ret;
644
+ };
645
+ imports.wbg.__wbg_next_692e82279131b03c = function() { return handleError(function (arg0) {
646
+ const ret = arg0.next();
647
+ return ret;
648
+ }, arguments) };
649
+ imports.wbg.__wbg_prototypesetcall_3d4a26c1ed734349 = function(arg0, arg1, arg2) {
650
+ Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
651
+ };
652
+ imports.wbg.__wbg_random_7ed63a0b38ee3b75 = function() {
653
+ const ret = Math.random();
654
+ return ret;
655
+ };
656
+ imports.wbg.__wbg_set_3f1d0b984ed272ed = function(arg0, arg1, arg2) {
657
+ arg0[arg1] = arg2;
658
+ };
659
+ imports.wbg.__wbg_set_453345bcda80b89a = function() { return handleError(function (arg0, arg1, arg2) {
660
+ const ret = Reflect.set(arg0, arg1, arg2);
661
+ return ret;
662
+ }, arguments) };
663
+ imports.wbg.__wbg_set_90f6c0f7bd8c0415 = function(arg0, arg1, arg2) {
664
+ arg0[arg1 >>> 0] = arg2;
665
+ };
666
+ imports.wbg.__wbg_set_b7f1cf4fae26fe2a = function(arg0, arg1, arg2) {
667
+ const ret = arg0.set(arg1, arg2);
668
+ return ret;
669
+ };
670
+ imports.wbg.__wbg_value_dd9372230531eade = function(arg0) {
671
+ const ret = arg0.value;
672
+ return ret;
673
+ };
674
+ imports.wbg.__wbg_wbindgenbigintgetasi64_ac743ece6ab9bba1 = function(arg0, arg1) {
675
+ const v = arg1;
676
+ const ret = typeof(v) === 'bigint' ? v : undefined;
677
+ getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
678
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
679
+ };
680
+ imports.wbg.__wbg_wbindgenbooleanget_3fe6f642c7d97746 = function(arg0) {
681
+ const v = arg0;
682
+ const ret = typeof(v) === 'boolean' ? v : undefined;
683
+ return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
684
+ };
685
+ imports.wbg.__wbg_wbindgendebugstring_99ef257a3ddda34d = function(arg0, arg1) {
686
+ const ret = debugString(arg1);
687
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
688
+ const len1 = WASM_VECTOR_LEN;
689
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
690
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
691
+ };
692
+ imports.wbg.__wbg_wbindgenin_d7a1ee10933d2d55 = function(arg0, arg1) {
693
+ const ret = arg0 in arg1;
694
+ return ret;
695
+ };
696
+ imports.wbg.__wbg_wbindgenisbigint_ecb90cc08a5a9154 = function(arg0) {
697
+ const ret = typeof(arg0) === 'bigint';
698
+ return ret;
699
+ };
700
+ imports.wbg.__wbg_wbindgenisfunction_8cee7dce3725ae74 = function(arg0) {
701
+ const ret = typeof(arg0) === 'function';
702
+ return ret;
703
+ };
704
+ imports.wbg.__wbg_wbindgenisobject_307a53c6bd97fbf8 = function(arg0) {
705
+ const val = arg0;
706
+ const ret = typeof(val) === 'object' && val !== null;
707
+ return ret;
708
+ };
709
+ imports.wbg.__wbg_wbindgenisstring_d4fa939789f003b0 = function(arg0) {
710
+ const ret = typeof(arg0) === 'string';
711
+ return ret;
712
+ };
713
+ imports.wbg.__wbg_wbindgenisundefined_c4b71d073b92f3c5 = function(arg0) {
714
+ const ret = arg0 === undefined;
715
+ return ret;
716
+ };
717
+ imports.wbg.__wbg_wbindgenjsvaleq_e6f2ad59ccae1b58 = function(arg0, arg1) {
718
+ const ret = arg0 === arg1;
719
+ return ret;
720
+ };
721
+ imports.wbg.__wbg_wbindgenjsvallooseeq_9bec8c9be826bed1 = function(arg0, arg1) {
722
+ const ret = arg0 == arg1;
723
+ return ret;
724
+ };
725
+ imports.wbg.__wbg_wbindgennumberget_f74b4c7525ac05cb = function(arg0, arg1) {
726
+ const obj = arg1;
727
+ const ret = typeof(obj) === 'number' ? obj : undefined;
728
+ getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
729
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
730
+ };
731
+ imports.wbg.__wbg_wbindgenstringget_0f16a6ddddef376f = function(arg0, arg1) {
732
+ const obj = arg1;
733
+ const ret = typeof(obj) === 'string' ? obj : undefined;
734
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
735
+ var len1 = WASM_VECTOR_LEN;
736
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
737
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
738
+ };
739
+ imports.wbg.__wbg_wbindgenthrow_451ec1a8469d7eb6 = function(arg0, arg1) {
740
+ throw new Error(getStringFromWasm0(arg0, arg1));
741
+ };
742
+ imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
743
+ // Cast intrinsic for `Ref(String) -> Externref`.
744
+ const ret = getStringFromWasm0(arg0, arg1);
745
+ return ret;
746
+ };
747
+ imports.wbg.__wbindgen_cast_4625c577ab2ec9ee = function(arg0) {
748
+ // Cast intrinsic for `U64 -> Externref`.
749
+ const ret = BigInt.asUintN(64, arg0);
750
+ return ret;
751
+ };
752
+ imports.wbg.__wbindgen_cast_9ae0607507abb057 = function(arg0) {
753
+ // Cast intrinsic for `I64 -> Externref`.
754
+ const ret = arg0;
755
+ return ret;
756
+ };
757
+ imports.wbg.__wbindgen_cast_cb9088102bce6b30 = function(arg0, arg1) {
758
+ // Cast intrinsic for `Ref(Slice(U8)) -> NamedExternref("Uint8Array")`.
759
+ const ret = getArrayU8FromWasm0(arg0, arg1);
760
+ return ret;
761
+ };
762
+ imports.wbg.__wbindgen_cast_d6cd19b81560fd6e = function(arg0) {
763
+ // Cast intrinsic for `F64 -> Externref`.
764
+ const ret = arg0;
765
+ return ret;
766
+ };
767
+ imports.wbg.__wbindgen_init_externref_table = function() {
768
+ const table = wasm.__wbindgen_export_4;
769
+ const offset = table.grow(4);
770
+ table.set(0, undefined);
771
+ table.set(offset + 0, undefined);
772
+ table.set(offset + 1, null);
773
+ table.set(offset + 2, true);
774
+ table.set(offset + 3, false);
775
+ ;
776
+ };
777
+
778
+ return imports;
779
+ }
780
+
781
+ function __wbg_init_memory(imports, memory) {
782
+
783
+ }
784
+
785
+ function __wbg_finalize_init(instance, module) {
786
+ wasm = instance.exports;
787
+ __wbg_init.__wbindgen_wasm_module = module;
788
+ cachedDataViewMemory0 = null;
789
+ cachedUint8ArrayMemory0 = null;
790
+
791
+
792
+ wasm.__wbindgen_start();
793
+ return wasm;
794
+ }
795
+
796
+ function initSync(module) {
797
+ if (wasm !== undefined) return wasm;
798
+
799
+
800
+ if (typeof module !== 'undefined') {
801
+ if (Object.getPrototypeOf(module) === Object.prototype) {
802
+ ({module} = module)
803
+ } else {
804
+ console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
805
+ }
806
+ }
807
+
808
+ const imports = __wbg_get_imports();
809
+
810
+ __wbg_init_memory(imports);
811
+
812
+ if (!(module instanceof WebAssembly.Module)) {
813
+ module = new WebAssembly.Module(module);
814
+ }
815
+
816
+ const instance = new WebAssembly.Instance(module, imports);
817
+
818
+ return __wbg_finalize_init(instance, module);
819
+ }
820
+
821
+ async function __wbg_init(module_or_path) {
822
+ if (wasm !== undefined) return wasm;
823
+
824
+
825
+ if (typeof module_or_path !== 'undefined') {
826
+ if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
827
+ ({module_or_path} = module_or_path)
828
+ } else {
829
+ console.warn('using deprecated parameters for the initialization function; pass a single object instead')
830
+ }
831
+ }
832
+
833
+ if (typeof module_or_path === 'undefined') {
834
+ module_or_path = new URL('ducjs_wasm_bg.wasm', import.meta.url);
835
+ }
836
+ const imports = __wbg_get_imports();
837
+
838
+ if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
839
+ module_or_path = fetch(module_or_path);
840
+ }
841
+
842
+ __wbg_init_memory(imports);
843
+
844
+ const { instance, module } = await __wbg_load(await module_or_path, imports);
845
+
846
+ return __wbg_finalize_init(instance, module);
847
+ }
848
+
849
+ export { initSync };
850
+ export default __wbg_init;