@automerge/sedimentree 0.9.0 → 0.10.0

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.
Files changed (37) hide show
  1. package/package.json +30 -3
  2. package/dist/cjs/node.cjs +0 -5
  3. package/dist/cjs/slim.cjs +0 -1
  4. package/dist/cjs/wasm-base64.cjs +0 -1
  5. package/dist/cjs/web-bindings.cjs +0 -1788
  6. package/dist/cjs/web.cjs +0 -1741
  7. package/dist/esm/bundler.js +0 -7
  8. package/dist/esm/node.js +0 -7
  9. package/dist/esm/slim.js +0 -2
  10. package/dist/esm/wasm-base64.js +0 -1
  11. package/dist/esm/web.js +0 -5
  12. package/dist/esm/workerd.js +0 -5
  13. package/dist/iife/index.js +0 -1723
  14. package/dist/index.d.ts +0 -522
  15. package/dist/sedimentree.wasm +0 -0
  16. package/dist/wasm_bindgen/bundler/sedimentree_wasm.d.ts +0 -522
  17. package/dist/wasm_bindgen/bundler/sedimentree_wasm.js +0 -9
  18. package/dist/wasm_bindgen/bundler/sedimentree_wasm_bg.js +0 -1742
  19. package/dist/wasm_bindgen/bundler/sedimentree_wasm_bg.wasm +0 -0
  20. package/dist/wasm_bindgen/bundler/sedimentree_wasm_bg.wasm.d.ts +0 -104
  21. package/dist/wasm_bindgen/bundler/snippets/sedimentree_wasm-8e1863d4f7634be2/inline0.js +0 -2
  22. package/dist/wasm_bindgen/bundler/snippets/sedimentree_wasm-8e1863d4f7634be2/inline1.js +0 -2
  23. package/dist/wasm_bindgen/bundler/snippets/sedimentree_wasm-8e1863d4f7634be2/inline2.js +0 -2
  24. package/dist/wasm_bindgen/nodejs/sedimentree_wasm.cjs +0 -1762
  25. package/dist/wasm_bindgen/nodejs/sedimentree_wasm.d.ts +0 -522
  26. package/dist/wasm_bindgen/nodejs/sedimentree_wasm_bg.wasm +0 -0
  27. package/dist/wasm_bindgen/nodejs/sedimentree_wasm_bg.wasm.d.ts +0 -104
  28. package/dist/wasm_bindgen/nodejs/snippets/sedimentree_wasm-8e1863d4f7634be2/inline0.js +0 -2
  29. package/dist/wasm_bindgen/nodejs/snippets/sedimentree_wasm-8e1863d4f7634be2/inline1.js +0 -2
  30. package/dist/wasm_bindgen/nodejs/snippets/sedimentree_wasm-8e1863d4f7634be2/inline2.js +0 -2
  31. package/dist/wasm_bindgen/web/sedimentree_wasm.d.ts +0 -651
  32. package/dist/wasm_bindgen/web/sedimentree_wasm.js +0 -1844
  33. package/dist/wasm_bindgen/web/sedimentree_wasm_bg.wasm +0 -0
  34. package/dist/wasm_bindgen/web/sedimentree_wasm_bg.wasm.d.ts +0 -104
  35. package/dist/wasm_bindgen/web/snippets/sedimentree_wasm-8e1863d4f7634be2/inline0.js +0 -2
  36. package/dist/wasm_bindgen/web/snippets/sedimentree_wasm-8e1863d4f7634be2/inline1.js +0 -2
  37. package/dist/wasm_bindgen/web/snippets/sedimentree_wasm-8e1863d4f7634be2/inline2.js +0 -2
@@ -1,1844 +0,0 @@
1
- /* @ts-self-types="./sedimentree_wasm.d.ts" */
2
-
3
- /**
4
- * A Wasm wrapper around the [`BlobMeta`] type.
5
- */
6
- export class BlobMeta {
7
- static __wrap(ptr) {
8
- ptr = ptr >>> 0;
9
- const obj = Object.create(BlobMeta.prototype);
10
- obj.__wbg_ptr = ptr;
11
- BlobMetaFinalization.register(obj, obj.__wbg_ptr, obj);
12
- return obj;
13
- }
14
- __destroy_into_raw() {
15
- const ptr = this.__wbg_ptr;
16
- this.__wbg_ptr = 0;
17
- BlobMetaFinalization.unregister(this);
18
- return ptr;
19
- }
20
- free() {
21
- const ptr = this.__destroy_into_raw();
22
- wasm.__wbg_blobmeta_free(ptr, 0);
23
- }
24
- /**
25
- * Get the digest of the blob.
26
- * @returns {Digest}
27
- */
28
- digest() {
29
- const ret = wasm.blobmeta_digest(this.__wbg_ptr);
30
- return Digest.__wrap(ret);
31
- }
32
- /**
33
- * Create a `BlobMeta` from a digest and size.
34
- *
35
- * This is useful for deserialization when the original blob is not available.
36
- * Since this is manual, the caller must ensure the digest and size are correct.
37
- * @param {Digest} digest
38
- * @param {bigint} size_bytes
39
- * @returns {BlobMeta}
40
- */
41
- static fromDigestSize(digest, size_bytes) {
42
- _assertClass(digest, Digest);
43
- const ret = wasm.blobmeta_fromDigestSize(digest.__wbg_ptr, size_bytes);
44
- return BlobMeta.__wrap(ret);
45
- }
46
- /**
47
- * Create a new `BlobMeta` from the given blob contents.
48
- * @param {Uint8Array} blob
49
- */
50
- constructor(blob) {
51
- const ptr0 = passArray8ToWasm0(blob, wasm.__wbindgen_export);
52
- const len0 = WASM_VECTOR_LEN;
53
- const ret = wasm.blobmeta_new(ptr0, len0);
54
- this.__wbg_ptr = ret >>> 0;
55
- BlobMetaFinalization.register(this, this.__wbg_ptr, this);
56
- return this;
57
- }
58
- /**
59
- * Get the size of the blob in bytes.
60
- * @returns {bigint}
61
- */
62
- get sizeBytes() {
63
- const ret = wasm.blobmeta_sizeBytes(this.__wbg_ptr);
64
- return BigInt.asUintN(64, ret);
65
- }
66
- }
67
- if (Symbol.dispose) BlobMeta.prototype[Symbol.dispose] = BlobMeta.prototype.free;
68
-
69
- /**
70
- * A user-supplied opaque identifier for a loose commit.
71
- *
72
- * Unlike [`Digest`](crate::digest::WasmDigest), which is a content hash
73
- * computed by the system, `CommitId` is provided by the caller at construction
74
- * time. This is the identity used for DAG traversal, fragment boundaries,
75
- * and sync.
76
- */
77
- export class CommitId {
78
- static __wrap(ptr) {
79
- ptr = ptr >>> 0;
80
- const obj = Object.create(CommitId.prototype);
81
- obj.__wbg_ptr = ptr;
82
- CommitIdFinalization.register(obj, obj.__wbg_ptr, obj);
83
- return obj;
84
- }
85
- __destroy_into_raw() {
86
- const ptr = this.__wbg_ptr;
87
- this.__wbg_ptr = 0;
88
- CommitIdFinalization.unregister(this);
89
- return ptr;
90
- }
91
- free() {
92
- const ptr = this.__destroy_into_raw();
93
- wasm.__wbg_commitid_free(ptr, 0);
94
- }
95
- /**
96
- * Upcasts; to the JS-import type for [`WasmCommitId`].
97
- * @returns {CommitId}
98
- */
99
- __wasm_refgen_toWasmCommitId() {
100
- const ret = wasm.commitid___wasm_refgen_toWasmCommitId(this.__wbg_ptr);
101
- return CommitId.__wrap(ret);
102
- }
103
- /**
104
- * Creates a new commit identifier from its Base58 string representation.
105
- *
106
- * # Errors
107
- *
108
- * Returns an error if the string cannot be decoded or is not 32 bytes.
109
- * @param {string} s
110
- * @returns {CommitId}
111
- */
112
- static fromBase58(s) {
113
- const ptr0 = passStringToWasm0(s, wasm.__wbindgen_export, wasm.__wbindgen_export2);
114
- const len0 = WASM_VECTOR_LEN;
115
- const ret = wasm.commitid_fromBase58(ptr0, len0);
116
- if (ret[2]) {
117
- throw takeFromExternrefTable0(ret[1]);
118
- }
119
- return CommitId.__wrap(ret[0]);
120
- }
121
- /**
122
- * Creates a new commit identifier from its byte representation.
123
- *
124
- * # Errors
125
- *
126
- * Returns an error if the byte slice is not exactly 32 bytes.
127
- * @param {Uint8Array} bytes
128
- * @returns {CommitId}
129
- */
130
- static fromBytes(bytes) {
131
- const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export);
132
- const len0 = WASM_VECTOR_LEN;
133
- const ret = wasm.commitid_fromBytes(ptr0, len0);
134
- if (ret[2]) {
135
- throw takeFromExternrefTable0(ret[1]);
136
- }
137
- return CommitId.__wrap(ret[0]);
138
- }
139
- /**
140
- * Creates a new commit identifier from its hexadecimal string representation.
141
- *
142
- * # Errors
143
- *
144
- * Returns an error if the string is not valid hex or not 32 bytes.
145
- * @param {string} s
146
- * @returns {CommitId}
147
- */
148
- static fromHexString(s) {
149
- const ptr0 = passStringToWasm0(s, wasm.__wbindgen_export, wasm.__wbindgen_export2);
150
- const len0 = WASM_VECTOR_LEN;
151
- const ret = wasm.commitid_fromHexString(ptr0, len0);
152
- if (ret[2]) {
153
- throw takeFromExternrefTable0(ret[1]);
154
- }
155
- return CommitId.__wrap(ret[0]);
156
- }
157
- /**
158
- * Creates a new commit identifier from its byte representation.
159
- *
160
- * # Errors
161
- *
162
- * Returns an error if the byte slice is not exactly 32 bytes.
163
- * @param {Uint8Array} bytes
164
- */
165
- constructor(bytes) {
166
- const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export);
167
- const len0 = WASM_VECTOR_LEN;
168
- const ret = wasm.commitid_new(ptr0, len0);
169
- if (ret[2]) {
170
- throw takeFromExternrefTable0(ret[1]);
171
- }
172
- this.__wbg_ptr = ret[0] >>> 0;
173
- CommitIdFinalization.register(this, this.__wbg_ptr, this);
174
- return this;
175
- }
176
- /**
177
- * Returns the byte representation of the commit identifier.
178
- * @returns {Uint8Array}
179
- */
180
- toBytes() {
181
- const ret = wasm.commitid_toBytes(this.__wbg_ptr);
182
- var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
183
- wasm.__wbindgen_export6(ret[0], ret[1] * 1, 1);
184
- return v1;
185
- }
186
- /**
187
- * Returns the hexadecimal string representation.
188
- * @returns {string}
189
- */
190
- toHexString() {
191
- let deferred1_0;
192
- let deferred1_1;
193
- try {
194
- const ret = wasm.commitid_toHexString(this.__wbg_ptr);
195
- deferred1_0 = ret[0];
196
- deferred1_1 = ret[1];
197
- return getStringFromWasm0(ret[0], ret[1]);
198
- } finally {
199
- wasm.__wbindgen_export6(deferred1_0, deferred1_1, 1);
200
- }
201
- }
202
- }
203
- if (Symbol.dispose) CommitId.prototype[Symbol.dispose] = CommitId.prototype.free;
204
-
205
- /**
206
- * A commit stored with its associated blob.
207
- */
208
- export class CommitWithBlob {
209
- static __wrap(ptr) {
210
- ptr = ptr >>> 0;
211
- const obj = Object.create(CommitWithBlob.prototype);
212
- obj.__wbg_ptr = ptr;
213
- CommitWithBlobFinalization.register(obj, obj.__wbg_ptr, obj);
214
- return obj;
215
- }
216
- __destroy_into_raw() {
217
- const ptr = this.__wbg_ptr;
218
- this.__wbg_ptr = 0;
219
- CommitWithBlobFinalization.unregister(this);
220
- return ptr;
221
- }
222
- free() {
223
- const ptr = this.__destroy_into_raw();
224
- wasm.__wbg_commitwithblob_free(ptr, 0);
225
- }
226
- /**
227
- * Upcasts; to the JS-import type for [`WasmCommitWithBlob`].
228
- * @returns {CommitWithBlob}
229
- */
230
- __wasm_refgen_toWasmCommitWithBlob() {
231
- const ret = wasm.commitwithblob___wasm_refgen_toWasmCommitWithBlob(this.__wbg_ptr);
232
- return CommitWithBlob.__wrap(ret);
233
- }
234
- /**
235
- * Get the blob.
236
- * @returns {Uint8Array}
237
- */
238
- get blob() {
239
- const ret = wasm.commitwithblob_blob(this.__wbg_ptr);
240
- return ret;
241
- }
242
- /**
243
- * Create a new commit with blob.
244
- * @param {SignedLooseCommit} signed
245
- * @param {Uint8Array} blob
246
- */
247
- constructor(signed, blob) {
248
- _assertClass(signed, SignedLooseCommit);
249
- var ptr0 = signed.__destroy_into_raw();
250
- const ret = wasm.commitwithblob_new(ptr0, blob);
251
- this.__wbg_ptr = ret >>> 0;
252
- CommitWithBlobFinalization.register(this, this.__wbg_ptr, this);
253
- return this;
254
- }
255
- /**
256
- * Get the signed commit.
257
- * @returns {SignedLooseCommit}
258
- */
259
- get signed() {
260
- const ret = wasm.commitwithblob_signed(this.__wbg_ptr);
261
- return SignedLooseCommit.__wrap(ret);
262
- }
263
- }
264
- if (Symbol.dispose) CommitWithBlob.prototype[Symbol.dispose] = CommitWithBlob.prototype.free;
265
-
266
- /**
267
- * A JavaScript wrapper around `Depth`.
268
- */
269
- export class Depth {
270
- static __wrap(ptr) {
271
- ptr = ptr >>> 0;
272
- const obj = Object.create(Depth.prototype);
273
- obj.__wbg_ptr = ptr;
274
- DepthFinalization.register(obj, obj.__wbg_ptr, obj);
275
- return obj;
276
- }
277
- __destroy_into_raw() {
278
- const ptr = this.__wbg_ptr;
279
- this.__wbg_ptr = 0;
280
- DepthFinalization.unregister(this);
281
- return ptr;
282
- }
283
- free() {
284
- const ptr = this.__destroy_into_raw();
285
- wasm.__wbg_depth_free(ptr, 0);
286
- }
287
- /**
288
- * Internal method for a hack crossing the JS boundary.
289
- * @returns {Depth}
290
- */
291
- __subduction_castToDepth() {
292
- const ret = wasm.depth___subduction_castToDepth(this.__wbg_ptr);
293
- return Depth.__wrap(ret);
294
- }
295
- /**
296
- * Upcasts; to the JS-import type for [`WasmDepth`].
297
- * @returns {Depth}
298
- */
299
- __wasm_refgen_toWasmDepth() {
300
- const ret = wasm.depth___wasm_refgen_toWasmDepth(this.__wbg_ptr);
301
- return Depth.__wrap(ret);
302
- }
303
- /**
304
- * Creates a new `WasmDepth` from a JavaScript value.
305
- *
306
- * # Errors
307
- *
308
- * Returns a `NotU32Error` if the JS value is not safely coercible to `u32`.
309
- * @param {any} js_value
310
- */
311
- constructor(js_value) {
312
- const ret = wasm.depth_new(js_value);
313
- if (ret[2]) {
314
- throw takeFromExternrefTable0(ret[1]);
315
- }
316
- this.__wbg_ptr = ret[0] >>> 0;
317
- DepthFinalization.register(this, this.__wbg_ptr, this);
318
- return this;
319
- }
320
- /**
321
- * The depth value as an integer.
322
- * @returns {number}
323
- */
324
- get value() {
325
- const ret = wasm.depth_value(this.__wbg_ptr);
326
- return ret >>> 0;
327
- }
328
- }
329
- if (Symbol.dispose) Depth.prototype[Symbol.dispose] = Depth.prototype.free;
330
-
331
- /**
332
- * A wrapper around digest bytes for use in JavaScript via wasm-bindgen.
333
- *
334
- * Since JavaScript doesn't have Rust's type system, this stores raw bytes
335
- * and converts to/from typed `Digest<T>` at the Rust boundary.
336
- */
337
- export class Digest {
338
- static __wrap(ptr) {
339
- ptr = ptr >>> 0;
340
- const obj = Object.create(Digest.prototype);
341
- obj.__wbg_ptr = ptr;
342
- DigestFinalization.register(obj, obj.__wbg_ptr, obj);
343
- return obj;
344
- }
345
- __destroy_into_raw() {
346
- const ptr = this.__wbg_ptr;
347
- this.__wbg_ptr = 0;
348
- DigestFinalization.unregister(this);
349
- return ptr;
350
- }
351
- free() {
352
- const ptr = this.__destroy_into_raw();
353
- wasm.__wbg_digest_free(ptr, 0);
354
- }
355
- /**
356
- * Upcasts; to the JS-import type for [`WasmDigest`].
357
- * @returns {Digest}
358
- */
359
- __wasm_refgen_toWasmDigest() {
360
- const ret = wasm.digest___wasm_refgen_toWasmDigest(this.__wbg_ptr);
361
- return Digest.__wrap(ret);
362
- }
363
- /**
364
- * Creates a new digest from its Base58 string representation.
365
- *
366
- * # Errors
367
- *
368
- * Returns a `WasmInvalidDigest` error if the string cannot be decoded or is not a valid digest.
369
- * @param {string} s
370
- * @returns {Digest}
371
- */
372
- static fromBase58(s) {
373
- const ptr0 = passStringToWasm0(s, wasm.__wbindgen_export, wasm.__wbindgen_export2);
374
- const len0 = WASM_VECTOR_LEN;
375
- const ret = wasm.digest_fromBase58(ptr0, len0);
376
- if (ret[2]) {
377
- throw takeFromExternrefTable0(ret[1]);
378
- }
379
- return Digest.__wrap(ret[0]);
380
- }
381
- /**
382
- * Creates a new digest from its byte representation.
383
- *
384
- * # Errors
385
- *
386
- * Returns a `WasmValue` error if the byte slice is not a valid digest.
387
- * @param {Uint8Array} bytes
388
- * @returns {Digest}
389
- */
390
- static fromBytes(bytes) {
391
- const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export);
392
- const len0 = WASM_VECTOR_LEN;
393
- const ret = wasm.digest_fromBytes(ptr0, len0);
394
- if (ret[2]) {
395
- throw takeFromExternrefTable0(ret[1]);
396
- }
397
- return Digest.__wrap(ret[0]);
398
- }
399
- /**
400
- * Creates a new digest from its hexadecimal string representation.
401
- *
402
- * # Errors
403
- *
404
- * Returns a [`WasmInvalidDigest`] if the string is not a valid digest.
405
- * @param {string} s
406
- * @returns {Digest}
407
- */
408
- static fromHexString(s) {
409
- const ptr0 = passStringToWasm0(s, wasm.__wbindgen_export, wasm.__wbindgen_export2);
410
- const len0 = WASM_VECTOR_LEN;
411
- const ret = wasm.digest_fromHexString(ptr0, len0);
412
- if (ret[2]) {
413
- throw takeFromExternrefTable0(ret[1]);
414
- }
415
- return Digest.__wrap(ret[0]);
416
- }
417
- /**
418
- * Creates a new digest from its byte representation.
419
- *
420
- * # Errors
421
- *
422
- * Returns a `WasmValue` error if the byte slice is not a valid digest.
423
- * @param {Uint8Array} bytes
424
- */
425
- constructor(bytes) {
426
- const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export);
427
- const len0 = WASM_VECTOR_LEN;
428
- const ret = wasm.digest_new(ptr0, len0);
429
- if (ret[2]) {
430
- throw takeFromExternrefTable0(ret[1]);
431
- }
432
- this.__wbg_ptr = ret[0] >>> 0;
433
- DigestFinalization.register(this, this.__wbg_ptr, this);
434
- return this;
435
- }
436
- /**
437
- * Returns the byte representation of the digest.
438
- * @returns {Uint8Array}
439
- */
440
- toBytes() {
441
- const ret = wasm.digest_toBytes(this.__wbg_ptr);
442
- var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
443
- wasm.__wbindgen_export6(ret[0], ret[1] * 1, 1);
444
- return v1;
445
- }
446
- /**
447
- * Returns the hexadecimal string representation of the digest.
448
- * @returns {string}
449
- */
450
- toHexString() {
451
- let deferred1_0;
452
- let deferred1_1;
453
- try {
454
- const ret = wasm.digest_toHexString(this.__wbg_ptr);
455
- deferred1_0 = ret[0];
456
- deferred1_1 = ret[1];
457
- return getStringFromWasm0(ret[0], ret[1]);
458
- } finally {
459
- wasm.__wbindgen_export6(deferred1_0, deferred1_1, 1);
460
- }
461
- }
462
- }
463
- if (Symbol.dispose) Digest.prototype[Symbol.dispose] = Digest.prototype.free;
464
-
465
- /**
466
- * A data fragment used in the Sedimentree system.
467
- */
468
- export class Fragment {
469
- static __wrap(ptr) {
470
- ptr = ptr >>> 0;
471
- const obj = Object.create(Fragment.prototype);
472
- obj.__wbg_ptr = ptr;
473
- FragmentFinalization.register(obj, obj.__wbg_ptr, obj);
474
- return obj;
475
- }
476
- __destroy_into_raw() {
477
- const ptr = this.__wbg_ptr;
478
- this.__wbg_ptr = 0;
479
- FragmentFinalization.unregister(this);
480
- return ptr;
481
- }
482
- free() {
483
- const ptr = this.__destroy_into_raw();
484
- wasm.__wbg_fragment_free(ptr, 0);
485
- }
486
- /**
487
- * Upcasts; to the JS-import type for [`WasmFragment`].
488
- * @returns {Fragment}
489
- */
490
- __wasm_refgen_toWasmFragment() {
491
- const ret = wasm.fragment___wasm_refgen_toWasmFragment(this.__wbg_ptr);
492
- return Fragment.__wrap(ret);
493
- }
494
- /**
495
- * Get the blob metadata of the fragment.
496
- * @returns {BlobMeta}
497
- */
498
- get blobMeta() {
499
- const ret = wasm.fragment_blobMeta(this.__wbg_ptr);
500
- return BlobMeta.__wrap(ret);
501
- }
502
- /**
503
- * Get the boundary commit identifiers of the fragment.
504
- * @returns {CommitId[]}
505
- */
506
- get boundary() {
507
- const ret = wasm.fragment_boundary(this.__wbg_ptr);
508
- var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
509
- wasm.__wbindgen_export6(ret[0], ret[1] * 4, 4);
510
- return v1;
511
- }
512
- /**
513
- * Get the head commit identifier of the fragment.
514
- * @returns {CommitId}
515
- */
516
- get head() {
517
- const ret = wasm.fragment_head(this.__wbg_ptr);
518
- return CommitId.__wrap(ret);
519
- }
520
- /**
521
- * Create a new fragment from the given sedimentree ID, head, boundary, checkpoints, and blob metadata.
522
- * @param {SedimentreeId} sedimentree_id
523
- * @param {CommitId} head
524
- * @param {CommitId[]} boundary
525
- * @param {CommitId[]} checkpoints
526
- * @param {BlobMeta} blob_meta
527
- */
528
- constructor(sedimentree_id, head, boundary, checkpoints, blob_meta) {
529
- _assertClass(sedimentree_id, SedimentreeId);
530
- var ptr0 = sedimentree_id.__destroy_into_raw();
531
- _assertClass(head, CommitId);
532
- var ptr1 = head.__destroy_into_raw();
533
- const ptr2 = passArrayJsValueToWasm0(boundary, wasm.__wbindgen_export);
534
- const len2 = WASM_VECTOR_LEN;
535
- const ptr3 = passArrayJsValueToWasm0(checkpoints, wasm.__wbindgen_export);
536
- const len3 = WASM_VECTOR_LEN;
537
- _assertClass(blob_meta, BlobMeta);
538
- var ptr4 = blob_meta.__destroy_into_raw();
539
- const ret = wasm.fragment_new(ptr0, ptr1, ptr2, len2, ptr3, len3, ptr4);
540
- this.__wbg_ptr = ret >>> 0;
541
- FragmentFinalization.register(this, this.__wbg_ptr, this);
542
- return this;
543
- }
544
- }
545
- if (Symbol.dispose) Fragment.prototype[Symbol.dispose] = Fragment.prototype.free;
546
-
547
- /**
548
- * A fragment stored with its associated blob.
549
- */
550
- export class FragmentWithBlob {
551
- static __wrap(ptr) {
552
- ptr = ptr >>> 0;
553
- const obj = Object.create(FragmentWithBlob.prototype);
554
- obj.__wbg_ptr = ptr;
555
- FragmentWithBlobFinalization.register(obj, obj.__wbg_ptr, obj);
556
- return obj;
557
- }
558
- __destroy_into_raw() {
559
- const ptr = this.__wbg_ptr;
560
- this.__wbg_ptr = 0;
561
- FragmentWithBlobFinalization.unregister(this);
562
- return ptr;
563
- }
564
- free() {
565
- const ptr = this.__destroy_into_raw();
566
- wasm.__wbg_fragmentwithblob_free(ptr, 0);
567
- }
568
- /**
569
- * Upcasts; to the JS-import type for [`WasmFragmentWithBlob`].
570
- * @returns {FragmentWithBlob}
571
- */
572
- __wasm_refgen_toWasmFragmentWithBlob() {
573
- const ret = wasm.fragmentwithblob___wasm_refgen_toWasmFragmentWithBlob(this.__wbg_ptr);
574
- return FragmentWithBlob.__wrap(ret);
575
- }
576
- /**
577
- * Get the blob.
578
- * @returns {Uint8Array}
579
- */
580
- get blob() {
581
- const ret = wasm.fragmentwithblob_blob(this.__wbg_ptr);
582
- return ret;
583
- }
584
- /**
585
- * Create a new fragment with blob.
586
- * @param {SignedFragment} signed
587
- * @param {Uint8Array} blob
588
- */
589
- constructor(signed, blob) {
590
- _assertClass(signed, SignedFragment);
591
- var ptr0 = signed.__destroy_into_raw();
592
- const ret = wasm.fragmentwithblob_new(ptr0, blob);
593
- this.__wbg_ptr = ret >>> 0;
594
- FragmentWithBlobFinalization.register(this, this.__wbg_ptr, this);
595
- return this;
596
- }
597
- /**
598
- * Get the signed fragment.
599
- * @returns {SignedFragment}
600
- */
601
- get signed() {
602
- const ret = wasm.fragmentwithblob_signed(this.__wbg_ptr);
603
- return SignedFragment.__wrap(ret);
604
- }
605
- }
606
- if (Symbol.dispose) FragmentWithBlob.prototype[Symbol.dispose] = FragmentWithBlob.prototype.free;
607
-
608
- export class FragmentsArray {
609
- static __wrap(ptr) {
610
- ptr = ptr >>> 0;
611
- const obj = Object.create(FragmentsArray.prototype);
612
- obj.__wbg_ptr = ptr;
613
- FragmentsArrayFinalization.register(obj, obj.__wbg_ptr, obj);
614
- return obj;
615
- }
616
- __destroy_into_raw() {
617
- const ptr = this.__wbg_ptr;
618
- this.__wbg_ptr = 0;
619
- FragmentsArrayFinalization.unregister(this);
620
- return ptr;
621
- }
622
- free() {
623
- const ptr = this.__destroy_into_raw();
624
- wasm.__wbg_fragmentsarray_free(ptr, 0);
625
- }
626
- /**
627
- * Upcasts; to the JS-import type for [`WasmFragmentsArray`].
628
- * @returns {FragmentsArray}
629
- */
630
- __wasm_refgen_toWasmFragmentsArray() {
631
- const ret = wasm.fragmentsarray___wasm_refgen_toWasmFragmentsArray(this.__wbg_ptr);
632
- return FragmentsArray.__wrap(ret);
633
- }
634
- }
635
- if (Symbol.dispose) FragmentsArray.prototype[Symbol.dispose] = FragmentsArray.prototype.free;
636
-
637
- /**
638
- * A Wasm wrapper around the [`LooseCommit`] type.
639
- */
640
- export class LooseCommit {
641
- static __wrap(ptr) {
642
- ptr = ptr >>> 0;
643
- const obj = Object.create(LooseCommit.prototype);
644
- obj.__wbg_ptr = ptr;
645
- LooseCommitFinalization.register(obj, obj.__wbg_ptr, obj);
646
- return obj;
647
- }
648
- __destroy_into_raw() {
649
- const ptr = this.__wbg_ptr;
650
- this.__wbg_ptr = 0;
651
- LooseCommitFinalization.unregister(this);
652
- return ptr;
653
- }
654
- free() {
655
- const ptr = this.__destroy_into_raw();
656
- wasm.__wbg_loosecommit_free(ptr, 0);
657
- }
658
- /**
659
- * Upcasts; to the JS-import type for [`WasmLooseCommit`].
660
- * @returns {LooseCommit}
661
- */
662
- __wasm_refgen_toWasmLooseCommit() {
663
- const ret = wasm.loosecommit___wasm_refgen_toWasmLooseCommit(this.__wbg_ptr);
664
- return LooseCommit.__wrap(ret);
665
- }
666
- /**
667
- * Get the blob metadata of the commit.
668
- * @returns {BlobMeta}
669
- */
670
- get blobMeta() {
671
- const ret = wasm.loosecommit_blobMeta(this.__wbg_ptr);
672
- return BlobMeta.__wrap(ret);
673
- }
674
- /**
675
- * Get the commit's head identifier.
676
- * @returns {CommitId}
677
- */
678
- get commitId() {
679
- const ret = wasm.loosecommit_commitId(this.__wbg_ptr);
680
- return CommitId.__wrap(ret);
681
- }
682
- /**
683
- * Get the digest of the commit (content hash).
684
- * @returns {Digest}
685
- */
686
- get digest() {
687
- const ret = wasm.loosecommit_digest(this.__wbg_ptr);
688
- return Digest.__wrap(ret);
689
- }
690
- /**
691
- * Create a new `LooseCommit` from the given sedimentree ID, head, parents, and blob metadata.
692
- * @param {SedimentreeId} sedimentree_id
693
- * @param {CommitId} head
694
- * @param {CommitId[]} parents
695
- * @param {BlobMeta} blob_meta
696
- */
697
- constructor(sedimentree_id, head, parents, blob_meta) {
698
- _assertClass(sedimentree_id, SedimentreeId);
699
- var ptr0 = sedimentree_id.__destroy_into_raw();
700
- _assertClass(head, CommitId);
701
- var ptr1 = head.__destroy_into_raw();
702
- const ptr2 = passArrayJsValueToWasm0(parents, wasm.__wbindgen_export);
703
- const len2 = WASM_VECTOR_LEN;
704
- _assertClass(blob_meta, BlobMeta);
705
- const ret = wasm.loosecommit_new(ptr0, ptr1, ptr2, len2, blob_meta.__wbg_ptr);
706
- this.__wbg_ptr = ret >>> 0;
707
- LooseCommitFinalization.register(this, this.__wbg_ptr, this);
708
- return this;
709
- }
710
- /**
711
- * Get the parent commit identifiers.
712
- * @returns {CommitId[]}
713
- */
714
- get parents() {
715
- const ret = wasm.loosecommit_parents(this.__wbg_ptr);
716
- var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
717
- wasm.__wbindgen_export6(ret[0], ret[1] * 4, 4);
718
- return v1;
719
- }
720
- }
721
- if (Symbol.dispose) LooseCommit.prototype[Symbol.dispose] = LooseCommit.prototype.free;
722
-
723
- /**
724
- * An in-memory storage implementation for use in tests and development.
725
- *
726
- * This wraps the core `MemoryStorage` and exposes it via the `SedimentreeStorage` interface.
727
- */
728
- export class MemoryStorage {
729
- __destroy_into_raw() {
730
- const ptr = this.__wbg_ptr;
731
- this.__wbg_ptr = 0;
732
- MemoryStorageFinalization.unregister(this);
733
- return ptr;
734
- }
735
- free() {
736
- const ptr = this.__destroy_into_raw();
737
- wasm.__wbg_memorystorage_free(ptr, 0);
738
- }
739
- /**
740
- * Delete all commits for a sedimentree.
741
- * @param {SedimentreeId} sedimentree_id
742
- * @returns {Promise<any>}
743
- */
744
- deleteAllCommits(sedimentree_id) {
745
- _assertClass(sedimentree_id, SedimentreeId);
746
- const ret = wasm.memorystorage_deleteAllCommits(this.__wbg_ptr, sedimentree_id.__wbg_ptr);
747
- return ret;
748
- }
749
- /**
750
- * Delete all fragments for a sedimentree.
751
- * @param {SedimentreeId} sedimentree_id
752
- * @returns {Promise<any>}
753
- */
754
- deleteAllFragments(sedimentree_id) {
755
- _assertClass(sedimentree_id, SedimentreeId);
756
- const ret = wasm.memorystorage_deleteAllFragments(this.__wbg_ptr, sedimentree_id.__wbg_ptr);
757
- return ret;
758
- }
759
- /**
760
- * Delete a single commit by its ID.
761
- * @param {SedimentreeId} sedimentree_id
762
- * @param {CommitId} commit_id
763
- * @returns {Promise<any>}
764
- */
765
- deleteCommit(sedimentree_id, commit_id) {
766
- _assertClass(sedimentree_id, SedimentreeId);
767
- _assertClass(commit_id, CommitId);
768
- const ret = wasm.memorystorage_deleteCommit(this.__wbg_ptr, sedimentree_id.__wbg_ptr, commit_id.__wbg_ptr);
769
- return ret;
770
- }
771
- /**
772
- * Delete a fragment by its identifier.
773
- * @param {SedimentreeId} sedimentree_id
774
- * @param {CommitId} fragment_head
775
- * @returns {Promise<any>}
776
- */
777
- deleteFragment(sedimentree_id, fragment_head) {
778
- _assertClass(sedimentree_id, SedimentreeId);
779
- _assertClass(fragment_head, CommitId);
780
- const ret = wasm.memorystorage_deleteFragment(this.__wbg_ptr, sedimentree_id.__wbg_ptr, fragment_head.__wbg_ptr);
781
- return ret;
782
- }
783
- /**
784
- * Delete a sedimentree ID.
785
- * @param {SedimentreeId} sedimentree_id
786
- * @returns {Promise<any>}
787
- */
788
- deleteSedimentreeId(sedimentree_id) {
789
- _assertClass(sedimentree_id, SedimentreeId);
790
- const ret = wasm.memorystorage_deleteSedimentreeId(this.__wbg_ptr, sedimentree_id.__wbg_ptr);
791
- return ret;
792
- }
793
- /**
794
- * List all commit IDs for a sedimentree.
795
- * @param {SedimentreeId} sedimentree_id
796
- * @returns {Promise<any>}
797
- */
798
- listCommitIds(sedimentree_id) {
799
- _assertClass(sedimentree_id, SedimentreeId);
800
- const ret = wasm.memorystorage_listCommitIds(this.__wbg_ptr, sedimentree_id.__wbg_ptr);
801
- return ret;
802
- }
803
- /**
804
- * List all fragment IDs for a sedimentree.
805
- * @param {SedimentreeId} sedimentree_id
806
- * @returns {Promise<any>}
807
- */
808
- listFragmentIds(sedimentree_id) {
809
- _assertClass(sedimentree_id, SedimentreeId);
810
- const ret = wasm.memorystorage_listFragmentIds(this.__wbg_ptr, sedimentree_id.__wbg_ptr);
811
- return ret;
812
- }
813
- /**
814
- * Load all commits for a sedimentree, returning `CommitWithBlob[]`.
815
- * @param {SedimentreeId} sedimentree_id
816
- * @returns {Promise<any>}
817
- */
818
- loadAllCommits(sedimentree_id) {
819
- _assertClass(sedimentree_id, SedimentreeId);
820
- const ret = wasm.memorystorage_loadAllCommits(this.__wbg_ptr, sedimentree_id.__wbg_ptr);
821
- return ret;
822
- }
823
- /**
824
- * Load all fragments for a sedimentree, returning `FragmentWithBlob[]`.
825
- * @param {SedimentreeId} sedimentree_id
826
- * @returns {Promise<any>}
827
- */
828
- loadAllFragments(sedimentree_id) {
829
- _assertClass(sedimentree_id, SedimentreeId);
830
- const ret = wasm.memorystorage_loadAllFragments(this.__wbg_ptr, sedimentree_id.__wbg_ptr);
831
- return ret;
832
- }
833
- /**
834
- * Load all sedimentree IDs.
835
- * @returns {Promise<any>}
836
- */
837
- loadAllSedimentreeIds() {
838
- const ret = wasm.memorystorage_loadAllSedimentreeIds(this.__wbg_ptr);
839
- return ret;
840
- }
841
- /**
842
- * Load a single commit by its ID, returning `CommitWithBlob` or null.
843
- * @param {SedimentreeId} sedimentree_id
844
- * @param {CommitId} commit_id
845
- * @returns {Promise<any>}
846
- */
847
- loadCommit(sedimentree_id, commit_id) {
848
- _assertClass(sedimentree_id, SedimentreeId);
849
- _assertClass(commit_id, CommitId);
850
- const ret = wasm.memorystorage_loadCommit(this.__wbg_ptr, sedimentree_id.__wbg_ptr, commit_id.__wbg_ptr);
851
- return ret;
852
- }
853
- /**
854
- * Load a fragment by its identifier, returning `FragmentWithBlob` or null.
855
- * @param {SedimentreeId} sedimentree_id
856
- * @param {CommitId} fragment_head
857
- * @returns {Promise<any>}
858
- */
859
- loadFragment(sedimentree_id, fragment_head) {
860
- _assertClass(sedimentree_id, SedimentreeId);
861
- _assertClass(fragment_head, CommitId);
862
- const ret = wasm.memorystorage_loadFragment(this.__wbg_ptr, sedimentree_id.__wbg_ptr, fragment_head.__wbg_ptr);
863
- return ret;
864
- }
865
- /**
866
- * Create a new in-memory storage instance.
867
- */
868
- constructor() {
869
- const ret = wasm.memorystorage_new();
870
- this.__wbg_ptr = ret >>> 0;
871
- MemoryStorageFinalization.register(this, this.__wbg_ptr, this);
872
- return this;
873
- }
874
- /**
875
- * Save commits and fragments in a single batch.
876
- * @param {SedimentreeId} sedimentree_id
877
- * @param {Array<any>} commits
878
- * @param {Array<any>} fragments
879
- * @returns {Promise<any>}
880
- */
881
- saveBatchAll(sedimentree_id, commits, fragments) {
882
- _assertClass(sedimentree_id, SedimentreeId);
883
- const ret = wasm.memorystorage_saveBatchAll(this.__wbg_ptr, sedimentree_id.__wbg_ptr, commits, fragments);
884
- return ret;
885
- }
886
- /**
887
- * Save a commit with its blob.
888
- *
889
- * The `commit_id` parameter must match the `head()` embedded in
890
- * the signed commit payload. Returns an error if they differ.
891
- *
892
- * # Errors
893
- *
894
- * Returns a JS error if:
895
- * - The signed payload cannot be decoded
896
- * - The `commit_id` does not match the embedded `head()`
897
- * @param {SedimentreeId} sedimentree_id
898
- * @param {CommitId} commit_id
899
- * @param {SignedLooseCommit} signed_commit
900
- * @param {Uint8Array} blob
901
- * @returns {Promise<any>}
902
- */
903
- saveCommit(sedimentree_id, commit_id, signed_commit, blob) {
904
- _assertClass(sedimentree_id, SedimentreeId);
905
- _assertClass(commit_id, CommitId);
906
- _assertClass(signed_commit, SignedLooseCommit);
907
- const ret = wasm.memorystorage_saveCommit(this.__wbg_ptr, sedimentree_id.__wbg_ptr, commit_id.__wbg_ptr, signed_commit.__wbg_ptr, blob);
908
- return ret;
909
- }
910
- /**
911
- * Save a fragment with its blob.
912
- * @param {SedimentreeId} sedimentree_id
913
- * @param {CommitId} _fragment_head
914
- * @param {SignedFragment} signed_fragment
915
- * @param {Uint8Array} blob
916
- * @returns {Promise<any>}
917
- */
918
- saveFragment(sedimentree_id, _fragment_head, signed_fragment, blob) {
919
- _assertClass(sedimentree_id, SedimentreeId);
920
- _assertClass(_fragment_head, CommitId);
921
- _assertClass(signed_fragment, SignedFragment);
922
- const ret = wasm.memorystorage_saveFragment(this.__wbg_ptr, sedimentree_id.__wbg_ptr, _fragment_head.__wbg_ptr, signed_fragment.__wbg_ptr, blob);
923
- return ret;
924
- }
925
- /**
926
- * Save a sedimentree ID.
927
- * @param {SedimentreeId} sedimentree_id
928
- * @returns {Promise<any>}
929
- */
930
- saveSedimentreeId(sedimentree_id) {
931
- _assertClass(sedimentree_id, SedimentreeId);
932
- const ret = wasm.memorystorage_saveSedimentreeId(this.__wbg_ptr, sedimentree_id.__wbg_ptr);
933
- return ret;
934
- }
935
- }
936
- if (Symbol.dispose) MemoryStorage.prototype[Symbol.dispose] = MemoryStorage.prototype.free;
937
-
938
- /**
939
- * The main Sedimentree data structure.
940
- */
941
- export class Sedimentree {
942
- static __wrap(ptr) {
943
- ptr = ptr >>> 0;
944
- const obj = Object.create(Sedimentree.prototype);
945
- obj.__wbg_ptr = ptr;
946
- SedimentreeFinalization.register(obj, obj.__wbg_ptr, obj);
947
- return obj;
948
- }
949
- __destroy_into_raw() {
950
- const ptr = this.__wbg_ptr;
951
- this.__wbg_ptr = 0;
952
- SedimentreeFinalization.unregister(this);
953
- return ptr;
954
- }
955
- free() {
956
- const ptr = this.__destroy_into_raw();
957
- wasm.__wbg_sedimentree_free(ptr, 0);
958
- }
959
- /**
960
- * Create an empty Sedimentree.
961
- * @returns {Sedimentree}
962
- */
963
- static empty() {
964
- const ret = wasm.sedimentree_empty();
965
- return Sedimentree.__wrap(ret);
966
- }
967
- /**
968
- * Create a new Sedimentree from fragments and loose commits.
969
- * @param {Fragment[]} fragments
970
- * @param {LooseCommit[]} commits
971
- */
972
- constructor(fragments, commits) {
973
- const ptr0 = passArrayJsValueToWasm0(fragments, wasm.__wbindgen_export);
974
- const len0 = WASM_VECTOR_LEN;
975
- const ptr1 = passArrayJsValueToWasm0(commits, wasm.__wbindgen_export);
976
- const len1 = WASM_VECTOR_LEN;
977
- const ret = wasm.sedimentree_new(ptr0, len0, ptr1, len1);
978
- this.__wbg_ptr = ret >>> 0;
979
- SedimentreeFinalization.register(this, this.__wbg_ptr, this);
980
- return this;
981
- }
982
- }
983
- if (Symbol.dispose) Sedimentree.prototype[Symbol.dispose] = Sedimentree.prototype.free;
984
-
985
- /**
986
- * A Wasm wrapper around the [`SedimentreeId`] type.
987
- */
988
- export class SedimentreeId {
989
- static __wrap(ptr) {
990
- ptr = ptr >>> 0;
991
- const obj = Object.create(SedimentreeId.prototype);
992
- obj.__wbg_ptr = ptr;
993
- SedimentreeIdFinalization.register(obj, obj.__wbg_ptr, obj);
994
- return obj;
995
- }
996
- __destroy_into_raw() {
997
- const ptr = this.__wbg_ptr;
998
- this.__wbg_ptr = 0;
999
- SedimentreeIdFinalization.unregister(this);
1000
- return ptr;
1001
- }
1002
- free() {
1003
- const ptr = this.__destroy_into_raw();
1004
- wasm.__wbg_sedimentreeid_free(ptr, 0);
1005
- }
1006
- /**
1007
- * Upcasts; to the JS-import type for [`WasmSedimentreeId`].
1008
- * @returns {SedimentreeId}
1009
- */
1010
- __wasm_refgen_toWasmSedimentreeId() {
1011
- const ret = wasm.sedimentreeid___wasm_refgen_toWasmSedimentreeId(this.__wbg_ptr);
1012
- return SedimentreeId.__wrap(ret);
1013
- }
1014
- /**
1015
- * Create an ID from a byte array.
1016
- *
1017
- * # Errors
1018
- *
1019
- * Returns `Not32Bytes` if the provided byte array is not exactly 32 bytes long.
1020
- * @param {Uint8Array} bytes
1021
- * @returns {SedimentreeId}
1022
- */
1023
- static fromBytes(bytes) {
1024
- const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export);
1025
- const len0 = WASM_VECTOR_LEN;
1026
- const ret = wasm.sedimentreeid_fromBytes(ptr0, len0);
1027
- if (ret[2]) {
1028
- throw takeFromExternrefTable0(ret[1]);
1029
- }
1030
- return SedimentreeId.__wrap(ret[0]);
1031
- }
1032
- /**
1033
- * Returns the raw bytes of this ID.
1034
- * @returns {Uint8Array}
1035
- */
1036
- toBytes() {
1037
- const ret = wasm.sedimentreeid_toBytes(this.__wbg_ptr);
1038
- var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
1039
- wasm.__wbindgen_export6(ret[0], ret[1] * 1, 1);
1040
- return v1;
1041
- }
1042
- /**
1043
- * Returns the string representation of the ID.
1044
- * @returns {string}
1045
- */
1046
- toString() {
1047
- let deferred1_0;
1048
- let deferred1_1;
1049
- try {
1050
- const ret = wasm.sedimentreeid_toString(this.__wbg_ptr);
1051
- deferred1_0 = ret[0];
1052
- deferred1_1 = ret[1];
1053
- return getStringFromWasm0(ret[0], ret[1]);
1054
- } finally {
1055
- wasm.__wbindgen_export6(deferred1_0, deferred1_1, 1);
1056
- }
1057
- }
1058
- }
1059
- if (Symbol.dispose) SedimentreeId.prototype[Symbol.dispose] = SedimentreeId.prototype.free;
1060
-
1061
- export class SedimentreeIdsArray {
1062
- static __wrap(ptr) {
1063
- ptr = ptr >>> 0;
1064
- const obj = Object.create(SedimentreeIdsArray.prototype);
1065
- obj.__wbg_ptr = ptr;
1066
- SedimentreeIdsArrayFinalization.register(obj, obj.__wbg_ptr, obj);
1067
- return obj;
1068
- }
1069
- __destroy_into_raw() {
1070
- const ptr = this.__wbg_ptr;
1071
- this.__wbg_ptr = 0;
1072
- SedimentreeIdsArrayFinalization.unregister(this);
1073
- return ptr;
1074
- }
1075
- free() {
1076
- const ptr = this.__destroy_into_raw();
1077
- wasm.__wbg_sedimentreeidsarray_free(ptr, 0);
1078
- }
1079
- /**
1080
- * Upcasts; to the JS-import type for [`WasmSedimentreeIdsArray`].
1081
- * @returns {SedimentreeIdsArray}
1082
- */
1083
- __wasm_refgen_toWasmSedimentreeIdsArray() {
1084
- const ret = wasm.sedimentreeidsarray___wasm_refgen_toWasmSedimentreeIdsArray(this.__wbg_ptr);
1085
- return SedimentreeIdsArray.__wrap(ret);
1086
- }
1087
- }
1088
- if (Symbol.dispose) SedimentreeIdsArray.prototype[Symbol.dispose] = SedimentreeIdsArray.prototype.free;
1089
-
1090
- /**
1091
- * A Wasm wrapper around `Signed<Fragment>`.
1092
- */
1093
- export class SignedFragment {
1094
- static __wrap(ptr) {
1095
- ptr = ptr >>> 0;
1096
- const obj = Object.create(SignedFragment.prototype);
1097
- obj.__wbg_ptr = ptr;
1098
- SignedFragmentFinalization.register(obj, obj.__wbg_ptr, obj);
1099
- return obj;
1100
- }
1101
- static __unwrap(jsValue) {
1102
- if (!(jsValue instanceof SignedFragment)) {
1103
- return 0;
1104
- }
1105
- return jsValue.__destroy_into_raw();
1106
- }
1107
- __destroy_into_raw() {
1108
- const ptr = this.__wbg_ptr;
1109
- this.__wbg_ptr = 0;
1110
- SignedFragmentFinalization.unregister(this);
1111
- return ptr;
1112
- }
1113
- free() {
1114
- const ptr = this.__destroy_into_raw();
1115
- wasm.__wbg_signedfragment_free(ptr, 0);
1116
- }
1117
- /**
1118
- * Upcasts; to the JS-import type for [`WasmSignedFragment`].
1119
- * @returns {SignedFragment}
1120
- */
1121
- __wasm_refgen_toWasmSignedFragment() {
1122
- const ret = wasm.signedfragment___wasm_refgen_toWasmSignedFragment(this.__wbg_ptr);
1123
- return SignedFragment.__wrap(ret);
1124
- }
1125
- /**
1126
- * Encode this signed fragment to raw bytes.
1127
- * @returns {Uint8Array}
1128
- */
1129
- encode() {
1130
- const ret = wasm.signedfragment_encode(this.__wbg_ptr);
1131
- return ret;
1132
- }
1133
- /**
1134
- * Get the unsigned payload without re-verifying the signature.
1135
- *
1136
- * # Errors
1137
- *
1138
- * Returns an error if the payload cannot be decoded.
1139
- * @returns {Fragment}
1140
- */
1141
- get payload() {
1142
- const ret = wasm.signedfragment_payload(this.__wbg_ptr);
1143
- if (ret[2]) {
1144
- throw takeFromExternrefTable0(ret[1]);
1145
- }
1146
- return Fragment.__wrap(ret[0]);
1147
- }
1148
- /**
1149
- * Decode a `SignedFragment` from raw bytes.
1150
- *
1151
- * # Errors
1152
- *
1153
- * Returns an error if the bytes are not a valid signed fragment.
1154
- * @param {Uint8Array} bytes
1155
- * @returns {SignedFragment}
1156
- */
1157
- static tryDecode(bytes) {
1158
- const ret = wasm.signedfragment_tryDecode(bytes);
1159
- if (ret[2]) {
1160
- throw takeFromExternrefTable0(ret[1]);
1161
- }
1162
- return SignedFragment.__wrap(ret[0]);
1163
- }
1164
- }
1165
- if (Symbol.dispose) SignedFragment.prototype[Symbol.dispose] = SignedFragment.prototype.free;
1166
-
1167
- /**
1168
- * A Wasm wrapper around `Signed<LooseCommit>`.
1169
- */
1170
- export class SignedLooseCommit {
1171
- static __wrap(ptr) {
1172
- ptr = ptr >>> 0;
1173
- const obj = Object.create(SignedLooseCommit.prototype);
1174
- obj.__wbg_ptr = ptr;
1175
- SignedLooseCommitFinalization.register(obj, obj.__wbg_ptr, obj);
1176
- return obj;
1177
- }
1178
- static __unwrap(jsValue) {
1179
- if (!(jsValue instanceof SignedLooseCommit)) {
1180
- return 0;
1181
- }
1182
- return jsValue.__destroy_into_raw();
1183
- }
1184
- __destroy_into_raw() {
1185
- const ptr = this.__wbg_ptr;
1186
- this.__wbg_ptr = 0;
1187
- SignedLooseCommitFinalization.unregister(this);
1188
- return ptr;
1189
- }
1190
- free() {
1191
- const ptr = this.__destroy_into_raw();
1192
- wasm.__wbg_signedloosecommit_free(ptr, 0);
1193
- }
1194
- /**
1195
- * Upcasts; to the JS-import type for [`WasmSignedLooseCommit`].
1196
- * @returns {SignedLooseCommit}
1197
- */
1198
- __wasm_refgen_toWasmSignedLooseCommit() {
1199
- const ret = wasm.signedloosecommit___wasm_refgen_toWasmSignedLooseCommit(this.__wbg_ptr);
1200
- return SignedLooseCommit.__wrap(ret);
1201
- }
1202
- /**
1203
- * Encode this signed loose commit to raw bytes.
1204
- * @returns {Uint8Array}
1205
- */
1206
- encode() {
1207
- const ret = wasm.signedloosecommit_encode(this.__wbg_ptr);
1208
- return ret;
1209
- }
1210
- /**
1211
- * Get the unsigned payload without re-verifying the signature.
1212
- *
1213
- * # Errors
1214
- *
1215
- * Returns an error if the payload cannot be decoded.
1216
- * @returns {LooseCommit}
1217
- */
1218
- get payload() {
1219
- const ret = wasm.signedloosecommit_payload(this.__wbg_ptr);
1220
- if (ret[2]) {
1221
- throw takeFromExternrefTable0(ret[1]);
1222
- }
1223
- return LooseCommit.__wrap(ret[0]);
1224
- }
1225
- /**
1226
- * Decode a `SignedLooseCommit` from raw bytes.
1227
- *
1228
- * # Errors
1229
- *
1230
- * Returns an error if the bytes are not a valid signed loose commit.
1231
- * @param {Uint8Array} bytes
1232
- * @returns {SignedLooseCommit}
1233
- */
1234
- static tryDecode(bytes) {
1235
- const ret = wasm.signedloosecommit_tryDecode(bytes);
1236
- if (ret[2]) {
1237
- throw takeFromExternrefTable0(ret[1]);
1238
- }
1239
- return SignedLooseCommit.__wrap(ret[0]);
1240
- }
1241
- }
1242
- if (Symbol.dispose) SignedLooseCommit.prototype[Symbol.dispose] = SignedLooseCommit.prototype.free;
1243
-
1244
- function __wbg_get_imports() {
1245
- const import0 = {
1246
- __proto__: null,
1247
- __wbg___wasm_refgen_toWasmCommitId_65b818e358f27de6: function(arg0) {
1248
- const ret = arg0.__wasm_refgen_toWasmCommitId();
1249
- _assertClass(ret, CommitId);
1250
- var ptr1 = ret.__destroy_into_raw();
1251
- return ptr1;
1252
- },
1253
- __wbg___wasm_refgen_toWasmFragment_38ddb9958dbdc455: function(arg0) {
1254
- const ret = arg0.__wasm_refgen_toWasmFragment();
1255
- _assertClass(ret, Fragment);
1256
- var ptr1 = ret.__destroy_into_raw();
1257
- return ptr1;
1258
- },
1259
- __wbg___wasm_refgen_toWasmLooseCommit_876edb05490f6350: function(arg0) {
1260
- const ret = arg0.__wasm_refgen_toWasmLooseCommit();
1261
- _assertClass(ret, LooseCommit);
1262
- var ptr1 = ret.__destroy_into_raw();
1263
- return ptr1;
1264
- },
1265
- __wbg___wbindgen_debug_string_5398f5bb970e0daa: function(arg0, arg1) {
1266
- const ret = debugString(arg1);
1267
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1268
- const len1 = WASM_VECTOR_LEN;
1269
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1270
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1271
- },
1272
- __wbg___wbindgen_is_function_3c846841762788c1: function(arg0) {
1273
- const ret = typeof(arg0) === 'function';
1274
- return ret;
1275
- },
1276
- __wbg___wbindgen_is_undefined_52709e72fb9f179c: function(arg0) {
1277
- const ret = arg0 === undefined;
1278
- return ret;
1279
- },
1280
- __wbg___wbindgen_number_get_34bb9d9dcfa21373: function(arg0, arg1) {
1281
- const obj = arg1;
1282
- const ret = typeof(obj) === 'number' ? obj : undefined;
1283
- getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
1284
- getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
1285
- },
1286
- __wbg___wbindgen_throw_6ddd609b62940d55: function(arg0, arg1) {
1287
- throw new Error(getStringFromWasm0(arg0, arg1));
1288
- },
1289
- __wbg__wbg_cb_unref_6b5b6b8576d35cb1: function(arg0) {
1290
- arg0._wbg_cb_unref();
1291
- },
1292
- __wbg_call_2d781c1f4d5c0ef8: function() { return handleError(function (arg0, arg1, arg2) {
1293
- const ret = arg0.call(arg1, arg2);
1294
- return ret;
1295
- }, arguments); },
1296
- __wbg_commitid_new: function(arg0) {
1297
- const ret = CommitId.__wrap(arg0);
1298
- return ret;
1299
- },
1300
- __wbg_commitwithblob_new: function(arg0) {
1301
- const ret = CommitWithBlob.__wrap(arg0);
1302
- return ret;
1303
- },
1304
- __wbg_fragmentwithblob_new: function(arg0) {
1305
- const ret = FragmentWithBlob.__wrap(arg0);
1306
- return ret;
1307
- },
1308
- __wbg_get_3ef1eba1850ade27: function() { return handleError(function (arg0, arg1) {
1309
- const ret = Reflect.get(arg0, arg1);
1310
- return ret;
1311
- }, arguments); },
1312
- __wbg_get_unchecked_329cfe50afab7352: function(arg0, arg1) {
1313
- const ret = arg0[arg1 >>> 0];
1314
- return ret;
1315
- },
1316
- __wbg_isSafeInteger_ecd6a7f9c3e053cd: function(arg0) {
1317
- const ret = Number.isSafeInteger(arg0);
1318
- return ret;
1319
- },
1320
- __wbg_length_b3416cf66a5452c8: function(arg0) {
1321
- const ret = arg0.length;
1322
- return ret;
1323
- },
1324
- __wbg_length_ea16607d7b61445b: function(arg0) {
1325
- const ret = arg0.length;
1326
- return ret;
1327
- },
1328
- __wbg_new_5f486cdf45a04d78: function(arg0) {
1329
- const ret = new Uint8Array(arg0);
1330
- return ret;
1331
- },
1332
- __wbg_new_a70fbab9066b301f: function() {
1333
- const ret = new Array();
1334
- return ret;
1335
- },
1336
- __wbg_new_d15cb560a6a0e5f0: function(arg0, arg1) {
1337
- const ret = new Error(getStringFromWasm0(arg0, arg1));
1338
- return ret;
1339
- },
1340
- __wbg_new_from_slice_22da9388ac046e50: function(arg0, arg1) {
1341
- const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
1342
- return ret;
1343
- },
1344
- __wbg_new_typed_aaaeaf29cf802876: function(arg0, arg1) {
1345
- try {
1346
- var state0 = {a: arg0, b: arg1};
1347
- var cb0 = (arg0, arg1) => {
1348
- const a = state0.a;
1349
- state0.a = 0;
1350
- try {
1351
- return __wasm_bindgen_func_elem_563_75(a, state0.b, arg0, arg1);
1352
- } finally {
1353
- state0.a = a;
1354
- }
1355
- };
1356
- const ret = new Promise(cb0);
1357
- return ret;
1358
- } finally {
1359
- state0.a = state0.b = 0;
1360
- }
1361
- },
1362
- __wbg_prototypesetcall_d62e5099504357e6: function(arg0, arg1, arg2) {
1363
- Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
1364
- },
1365
- __wbg_push_e87b0e732085a946: function(arg0, arg1) {
1366
- const ret = arg0.push(arg1);
1367
- return ret;
1368
- },
1369
- __wbg_queueMicrotask_0c399741342fb10f: function(arg0) {
1370
- const ret = arg0.queueMicrotask;
1371
- return ret;
1372
- },
1373
- __wbg_queueMicrotask_a082d78ce798393e: function(arg0) {
1374
- queueMicrotask(arg0);
1375
- },
1376
- __wbg_resolve_ae8d83246e5bcc12: function(arg0) {
1377
- const ret = Promise.resolve(arg0);
1378
- return ret;
1379
- },
1380
- __wbg_sedimentreeid_new: function(arg0) {
1381
- const ret = SedimentreeId.__wrap(arg0);
1382
- return ret;
1383
- },
1384
- __wbg_set_name_7ef37fe858379aaf: function(arg0, arg1, arg2) {
1385
- arg0.name = getStringFromWasm0(arg1, arg2);
1386
- },
1387
- __wbg_signedfragment_unwrap: function(arg0) {
1388
- const ret = SignedFragment.__unwrap(arg0);
1389
- return ret;
1390
- },
1391
- __wbg_signedloosecommit_unwrap: function(arg0) {
1392
- const ret = SignedLooseCommit.__unwrap(arg0);
1393
- return ret;
1394
- },
1395
- __wbg_static_accessor_GLOBAL_8adb955bd33fac2f: function() {
1396
- const ret = typeof global === 'undefined' ? null : global;
1397
- return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1398
- },
1399
- __wbg_static_accessor_GLOBAL_THIS_ad356e0db91c7913: function() {
1400
- const ret = typeof globalThis === 'undefined' ? null : globalThis;
1401
- return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1402
- },
1403
- __wbg_static_accessor_SELF_f207c857566db248: function() {
1404
- const ret = typeof self === 'undefined' ? null : self;
1405
- return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1406
- },
1407
- __wbg_static_accessor_WINDOW_bb9f1ba69d61b386: function() {
1408
- const ret = typeof window === 'undefined' ? null : window;
1409
- return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1410
- },
1411
- __wbg_then_098abe61755d12f6: function(arg0, arg1) {
1412
- const ret = arg0.then(arg1);
1413
- return ret;
1414
- },
1415
- __wbindgen_cast_0000000000000001: function(arg0, arg1) {
1416
- // Cast intrinsic for `Closure(Closure { dtor_idx: 73, function: Function { arguments: [Externref], shim_idx: 136, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
1417
- const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_400, __wasm_bindgen_func_elem_563);
1418
- return ret;
1419
- },
1420
- __wbindgen_cast_0000000000000002: function(arg0) {
1421
- // Cast intrinsic for `F64 -> Externref`.
1422
- const ret = arg0;
1423
- return ret;
1424
- },
1425
- __wbindgen_cast_0000000000000003: function(arg0, arg1) {
1426
- // Cast intrinsic for `Ref(String) -> Externref`.
1427
- const ret = getStringFromWasm0(arg0, arg1);
1428
- return ret;
1429
- },
1430
- __wbindgen_init_externref_table: function() {
1431
- const table = wasm.__wbindgen_externrefs;
1432
- const offset = table.grow(4);
1433
- table.set(0, undefined);
1434
- table.set(offset + 0, undefined);
1435
- table.set(offset + 1, null);
1436
- table.set(offset + 2, true);
1437
- table.set(offset + 3, false);
1438
- },
1439
- };
1440
- return {
1441
- __proto__: null,
1442
- "./sedimentree_wasm_bg.js": import0,
1443
- };
1444
- }
1445
-
1446
- function __wasm_bindgen_func_elem_563(arg0, arg1, arg2) {
1447
- const ret = wasm.__wasm_bindgen_func_elem_563(arg0, arg1, arg2);
1448
- if (ret[1]) {
1449
- throw takeFromExternrefTable0(ret[0]);
1450
- }
1451
- }
1452
-
1453
- function __wasm_bindgen_func_elem_563_75(arg0, arg1, arg2, arg3) {
1454
- wasm.__wasm_bindgen_func_elem_563_75(arg0, arg1, arg2, arg3);
1455
- }
1456
-
1457
- const MemoryStorageFinalization = (typeof FinalizationRegistry === 'undefined')
1458
- ? { register: () => {}, unregister: () => {} }
1459
- : new FinalizationRegistry(ptr => wasm.__wbg_memorystorage_free(ptr >>> 0, 1));
1460
- const BlobMetaFinalization = (typeof FinalizationRegistry === 'undefined')
1461
- ? { register: () => {}, unregister: () => {} }
1462
- : new FinalizationRegistry(ptr => wasm.__wbg_blobmeta_free(ptr >>> 0, 1));
1463
- const CommitIdFinalization = (typeof FinalizationRegistry === 'undefined')
1464
- ? { register: () => {}, unregister: () => {} }
1465
- : new FinalizationRegistry(ptr => wasm.__wbg_commitid_free(ptr >>> 0, 1));
1466
- const CommitWithBlobFinalization = (typeof FinalizationRegistry === 'undefined')
1467
- ? { register: () => {}, unregister: () => {} }
1468
- : new FinalizationRegistry(ptr => wasm.__wbg_commitwithblob_free(ptr >>> 0, 1));
1469
- const DepthFinalization = (typeof FinalizationRegistry === 'undefined')
1470
- ? { register: () => {}, unregister: () => {} }
1471
- : new FinalizationRegistry(ptr => wasm.__wbg_depth_free(ptr >>> 0, 1));
1472
- const DigestFinalization = (typeof FinalizationRegistry === 'undefined')
1473
- ? { register: () => {}, unregister: () => {} }
1474
- : new FinalizationRegistry(ptr => wasm.__wbg_digest_free(ptr >>> 0, 1));
1475
- const FragmentFinalization = (typeof FinalizationRegistry === 'undefined')
1476
- ? { register: () => {}, unregister: () => {} }
1477
- : new FinalizationRegistry(ptr => wasm.__wbg_fragment_free(ptr >>> 0, 1));
1478
- const FragmentWithBlobFinalization = (typeof FinalizationRegistry === 'undefined')
1479
- ? { register: () => {}, unregister: () => {} }
1480
- : new FinalizationRegistry(ptr => wasm.__wbg_fragmentwithblob_free(ptr >>> 0, 1));
1481
- const FragmentsArrayFinalization = (typeof FinalizationRegistry === 'undefined')
1482
- ? { register: () => {}, unregister: () => {} }
1483
- : new FinalizationRegistry(ptr => wasm.__wbg_fragmentsarray_free(ptr >>> 0, 1));
1484
- const LooseCommitFinalization = (typeof FinalizationRegistry === 'undefined')
1485
- ? { register: () => {}, unregister: () => {} }
1486
- : new FinalizationRegistry(ptr => wasm.__wbg_loosecommit_free(ptr >>> 0, 1));
1487
- const SedimentreeFinalization = (typeof FinalizationRegistry === 'undefined')
1488
- ? { register: () => {}, unregister: () => {} }
1489
- : new FinalizationRegistry(ptr => wasm.__wbg_sedimentree_free(ptr >>> 0, 1));
1490
- const SedimentreeIdFinalization = (typeof FinalizationRegistry === 'undefined')
1491
- ? { register: () => {}, unregister: () => {} }
1492
- : new FinalizationRegistry(ptr => wasm.__wbg_sedimentreeid_free(ptr >>> 0, 1));
1493
- const SedimentreeIdsArrayFinalization = (typeof FinalizationRegistry === 'undefined')
1494
- ? { register: () => {}, unregister: () => {} }
1495
- : new FinalizationRegistry(ptr => wasm.__wbg_sedimentreeidsarray_free(ptr >>> 0, 1));
1496
- const SignedFragmentFinalization = (typeof FinalizationRegistry === 'undefined')
1497
- ? { register: () => {}, unregister: () => {} }
1498
- : new FinalizationRegistry(ptr => wasm.__wbg_signedfragment_free(ptr >>> 0, 1));
1499
- const SignedLooseCommitFinalization = (typeof FinalizationRegistry === 'undefined')
1500
- ? { register: () => {}, unregister: () => {} }
1501
- : new FinalizationRegistry(ptr => wasm.__wbg_signedloosecommit_free(ptr >>> 0, 1));
1502
-
1503
- function addToExternrefTable0(obj) {
1504
- const idx = wasm.__wbindgen_export4();
1505
- wasm.__wbindgen_externrefs.set(idx, obj);
1506
- return idx;
1507
- }
1508
-
1509
- function _assertClass(instance, klass) {
1510
- if (!(instance instanceof klass)) {
1511
- throw new Error(`expected instance of ${klass.name}`);
1512
- }
1513
- }
1514
-
1515
- const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
1516
- ? { register: () => {}, unregister: () => {} }
1517
- : new FinalizationRegistry(state => state.dtor(state.a, state.b));
1518
-
1519
- function debugString(val) {
1520
- // primitive types
1521
- const type = typeof val;
1522
- if (type == 'number' || type == 'boolean' || val == null) {
1523
- return `${val}`;
1524
- }
1525
- if (type == 'string') {
1526
- return `"${val}"`;
1527
- }
1528
- if (type == 'symbol') {
1529
- const description = val.description;
1530
- if (description == null) {
1531
- return 'Symbol';
1532
- } else {
1533
- return `Symbol(${description})`;
1534
- }
1535
- }
1536
- if (type == 'function') {
1537
- const name = val.name;
1538
- if (typeof name == 'string' && name.length > 0) {
1539
- return `Function(${name})`;
1540
- } else {
1541
- return 'Function';
1542
- }
1543
- }
1544
- // objects
1545
- if (Array.isArray(val)) {
1546
- const length = val.length;
1547
- let debug = '[';
1548
- if (length > 0) {
1549
- debug += debugString(val[0]);
1550
- }
1551
- for(let i = 1; i < length; i++) {
1552
- debug += ', ' + debugString(val[i]);
1553
- }
1554
- debug += ']';
1555
- return debug;
1556
- }
1557
- // Test for built-in
1558
- const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
1559
- let className;
1560
- if (builtInMatches && builtInMatches.length > 1) {
1561
- className = builtInMatches[1];
1562
- } else {
1563
- // Failed to match the standard '[object ClassName]'
1564
- return toString.call(val);
1565
- }
1566
- if (className == 'Object') {
1567
- // we're a user defined class or Object
1568
- // JSON.stringify avoids problems with cycles, and is generally much
1569
- // easier than looping through ownProperties of `val`.
1570
- try {
1571
- return 'Object(' + JSON.stringify(val) + ')';
1572
- } catch (_) {
1573
- return 'Object';
1574
- }
1575
- }
1576
- // errors
1577
- if (val instanceof Error) {
1578
- return `${val.name}: ${val.message}\n${val.stack}`;
1579
- }
1580
- // TODO we could test for more things here, like `Set`s and `Map`s.
1581
- return className;
1582
- }
1583
-
1584
- function getArrayJsValueFromWasm0(ptr, len) {
1585
- ptr = ptr >>> 0;
1586
- const mem = getDataViewMemory0();
1587
- const result = [];
1588
- for (let i = ptr; i < ptr + 4 * len; i += 4) {
1589
- result.push(wasm.__wbindgen_externrefs.get(mem.getUint32(i, true)));
1590
- }
1591
- wasm.__wbindgen_export7(ptr, len);
1592
- return result;
1593
- }
1594
-
1595
- function getArrayU8FromWasm0(ptr, len) {
1596
- ptr = ptr >>> 0;
1597
- return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
1598
- }
1599
-
1600
- let cachedDataViewMemory0 = null;
1601
- function getDataViewMemory0() {
1602
- if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
1603
- cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
1604
- }
1605
- return cachedDataViewMemory0;
1606
- }
1607
-
1608
- function getStringFromWasm0(ptr, len) {
1609
- ptr = ptr >>> 0;
1610
- return decodeText(ptr, len);
1611
- }
1612
-
1613
- let cachedUint8ArrayMemory0 = null;
1614
- function getUint8ArrayMemory0() {
1615
- if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
1616
- cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
1617
- }
1618
- return cachedUint8ArrayMemory0;
1619
- }
1620
-
1621
- function handleError(f, args) {
1622
- try {
1623
- return f.apply(this, args);
1624
- } catch (e) {
1625
- const idx = addToExternrefTable0(e);
1626
- wasm.__wbindgen_export3(idx);
1627
- }
1628
- }
1629
-
1630
- function isLikeNone(x) {
1631
- return x === undefined || x === null;
1632
- }
1633
-
1634
- function makeMutClosure(arg0, arg1, dtor, f) {
1635
- const state = { a: arg0, b: arg1, cnt: 1, dtor };
1636
- const real = (...args) => {
1637
-
1638
- // First up with a closure we increment the internal reference
1639
- // count. This ensures that the Rust closure environment won't
1640
- // be deallocated while we're invoking it.
1641
- state.cnt++;
1642
- const a = state.a;
1643
- state.a = 0;
1644
- try {
1645
- return f(a, state.b, ...args);
1646
- } finally {
1647
- state.a = a;
1648
- real._wbg_cb_unref();
1649
- }
1650
- };
1651
- real._wbg_cb_unref = () => {
1652
- if (--state.cnt === 0) {
1653
- state.dtor(state.a, state.b);
1654
- state.a = 0;
1655
- CLOSURE_DTORS.unregister(state);
1656
- }
1657
- };
1658
- CLOSURE_DTORS.register(real, state, state);
1659
- return real;
1660
- }
1661
-
1662
- function passArray8ToWasm0(arg, malloc) {
1663
- const ptr = malloc(arg.length * 1, 1) >>> 0;
1664
- getUint8ArrayMemory0().set(arg, ptr / 1);
1665
- WASM_VECTOR_LEN = arg.length;
1666
- return ptr;
1667
- }
1668
-
1669
- function passArrayJsValueToWasm0(array, malloc) {
1670
- const ptr = malloc(array.length * 4, 4) >>> 0;
1671
- for (let i = 0; i < array.length; i++) {
1672
- const add = addToExternrefTable0(array[i]);
1673
- getDataViewMemory0().setUint32(ptr + 4 * i, add, true);
1674
- }
1675
- WASM_VECTOR_LEN = array.length;
1676
- return ptr;
1677
- }
1678
-
1679
- function passStringToWasm0(arg, malloc, realloc) {
1680
- if (realloc === undefined) {
1681
- const buf = cachedTextEncoder.encode(arg);
1682
- const ptr = malloc(buf.length, 1) >>> 0;
1683
- getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
1684
- WASM_VECTOR_LEN = buf.length;
1685
- return ptr;
1686
- }
1687
-
1688
- let len = arg.length;
1689
- let ptr = malloc(len, 1) >>> 0;
1690
-
1691
- const mem = getUint8ArrayMemory0();
1692
-
1693
- let offset = 0;
1694
-
1695
- for (; offset < len; offset++) {
1696
- const code = arg.charCodeAt(offset);
1697
- if (code > 0x7F) break;
1698
- mem[ptr + offset] = code;
1699
- }
1700
- if (offset !== len) {
1701
- if (offset !== 0) {
1702
- arg = arg.slice(offset);
1703
- }
1704
- ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
1705
- const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
1706
- const ret = cachedTextEncoder.encodeInto(arg, view);
1707
-
1708
- offset += ret.written;
1709
- ptr = realloc(ptr, len, offset, 1) >>> 0;
1710
- }
1711
-
1712
- WASM_VECTOR_LEN = offset;
1713
- return ptr;
1714
- }
1715
-
1716
- function takeFromExternrefTable0(idx) {
1717
- const value = wasm.__wbindgen_externrefs.get(idx);
1718
- wasm.__wbindgen_export5(idx);
1719
- return value;
1720
- }
1721
-
1722
- let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
1723
- cachedTextDecoder.decode();
1724
- const MAX_SAFARI_DECODE_BYTES = 2146435072;
1725
- let numBytesDecoded = 0;
1726
- function decodeText(ptr, len) {
1727
- numBytesDecoded += len;
1728
- if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
1729
- cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
1730
- cachedTextDecoder.decode();
1731
- numBytesDecoded = len;
1732
- }
1733
- return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
1734
- }
1735
-
1736
- const cachedTextEncoder = new TextEncoder();
1737
-
1738
- if (!('encodeInto' in cachedTextEncoder)) {
1739
- cachedTextEncoder.encodeInto = function (arg, view) {
1740
- const buf = cachedTextEncoder.encode(arg);
1741
- view.set(buf);
1742
- return {
1743
- read: arg.length,
1744
- written: buf.length
1745
- };
1746
- };
1747
- }
1748
-
1749
- let WASM_VECTOR_LEN = 0;
1750
-
1751
- let wasmModule, wasm;
1752
- function __wbg_finalize_init(instance, module) {
1753
- wasm = instance.exports;
1754
- wasmModule = module;
1755
- cachedDataViewMemory0 = null;
1756
- cachedUint8ArrayMemory0 = null;
1757
- wasm.__wbindgen_start();
1758
- return wasm;
1759
- }
1760
-
1761
- async function __wbg_load(module, imports) {
1762
- if (typeof Response === 'function' && module instanceof Response) {
1763
- if (typeof WebAssembly.instantiateStreaming === 'function') {
1764
- try {
1765
- return await WebAssembly.instantiateStreaming(module, imports);
1766
- } catch (e) {
1767
- const validResponse = module.ok && expectedResponseType(module.type);
1768
-
1769
- if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
1770
- 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);
1771
-
1772
- } else { throw e; }
1773
- }
1774
- }
1775
-
1776
- const bytes = await module.arrayBuffer();
1777
- return await WebAssembly.instantiate(bytes, imports);
1778
- } else {
1779
- const instance = await WebAssembly.instantiate(module, imports);
1780
-
1781
- if (instance instanceof WebAssembly.Instance) {
1782
- return { instance, module };
1783
- } else {
1784
- return instance;
1785
- }
1786
- }
1787
-
1788
- function expectedResponseType(type) {
1789
- switch (type) {
1790
- case 'basic': case 'cors': case 'default': return true;
1791
- }
1792
- return false;
1793
- }
1794
- }
1795
-
1796
- function initSync(module) {
1797
- if (wasm !== undefined) return wasm;
1798
-
1799
-
1800
- if (module !== undefined) {
1801
- if (Object.getPrototypeOf(module) === Object.prototype) {
1802
- ({module} = module)
1803
- } else {
1804
- console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
1805
- }
1806
- }
1807
-
1808
- const imports = __wbg_get_imports();
1809
- if (!(module instanceof WebAssembly.Module)) {
1810
- module = new WebAssembly.Module(module);
1811
- }
1812
- const instance = new WebAssembly.Instance(module, imports);
1813
- return __wbg_finalize_init(instance, module);
1814
- }
1815
-
1816
- async function __wbg_init(module_or_path) {
1817
- if (wasm !== undefined) return wasm;
1818
-
1819
-
1820
- if (module_or_path !== undefined) {
1821
- if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
1822
- ({module_or_path} = module_or_path)
1823
- } else {
1824
- console.warn('using deprecated parameters for the initialization function; pass a single object instead')
1825
- }
1826
- }
1827
-
1828
- if (module_or_path === undefined) {
1829
- module_or_path = new /* @vite-ignore */ URL('sedimentree_wasm_bg.wasm', import.meta.url);
1830
- }
1831
- const imports = __wbg_get_imports();
1832
-
1833
- if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
1834
- module_or_path = fetch(module_or_path);
1835
- }
1836
-
1837
- const { instance, module } = await __wbg_load(await module_or_path, imports);
1838
-
1839
- return __wbg_finalize_init(instance, module);
1840
- }
1841
-
1842
- export { initSync, __wbg_init as default };
1843
-
1844
- export function __wbg_set_wasm(val) { wasm = val; }