@wovin/core 0.0.14 → 0.0.15

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 (63) hide show
  1. package/dist/applog/applog-helpers.d.ts +13 -13
  2. package/dist/applog/applog-helpers.d.ts.map +1 -1
  3. package/dist/applog/applog-utils.d.ts +5 -5
  4. package/dist/applog/applog-utils.d.ts.map +1 -1
  5. package/dist/applog/datom-types.d.ts +4 -3
  6. package/dist/applog/datom-types.d.ts.map +1 -1
  7. package/dist/applog.min.js +4 -4
  8. package/dist/{chunk-3HSO7QDN.min.js → chunk-FIOA3FZW.min.js} +5 -5
  9. package/dist/{chunk-6EBQRFQC.min.js → chunk-HYMC7W6S.min.js} +4 -6
  10. package/dist/{chunk-6EBQRFQC.min.js.map → chunk-HYMC7W6S.min.js.map} +1 -1
  11. package/dist/{chunk-R3MVKMV2.min.js → chunk-JEOQUHTK.min.js} +206 -1010
  12. package/dist/chunk-JEOQUHTK.min.js.map +1 -0
  13. package/dist/{chunk-DF3UOPRV.min.js → chunk-KEHU7HGZ.min.js} +388 -257
  14. package/dist/chunk-KEHU7HGZ.min.js.map +1 -0
  15. package/dist/{chunk-JEYJIYNF.min.js → chunk-NPCVLBCM.min.js} +6450 -6341
  16. package/dist/chunk-NPCVLBCM.min.js.map +1 -0
  17. package/dist/{chunk-DPU6MD7E.min.js → chunk-OBMVNVJR.min.js} +53 -37
  18. package/dist/chunk-OBMVNVJR.min.js.map +1 -0
  19. package/dist/{chunk-KRQZ6V4Y.min.js → chunk-PHITDXZT.min.js} +1 -1
  20. package/dist/{chunk-CDGK7IKH.min.js → chunk-TEQ4SIKN.min.js} +6 -7
  21. package/dist/{chunk-CDGK7IKH.min.js.map → chunk-TEQ4SIKN.min.js.map} +1 -1
  22. package/dist/index.min.js +16 -8
  23. package/dist/ipfs/car.d.ts +13 -13
  24. package/dist/ipfs/car.d.ts.map +1 -1
  25. package/dist/ipfs/ipfs-utils.d.ts +2 -2
  26. package/dist/ipfs/ipfs-utils.d.ts.map +1 -1
  27. package/dist/ipfs.min.js +6 -6
  28. package/dist/mobx/mobx-utils.d.ts +4 -3
  29. package/dist/mobx/mobx-utils.d.ts.map +1 -1
  30. package/dist/mobx.min.js +2 -2
  31. package/dist/pubsub/pub-pull.d.ts +1 -1
  32. package/dist/pubsub/pub-pull.d.ts.map +1 -1
  33. package/dist/pubsub/pub-push.d.ts +9 -9
  34. package/dist/pubsub/pubsub-types.d.ts.map +1 -1
  35. package/dist/pubsub.min.js +7 -7
  36. package/dist/query/basic.d.ts +9 -35
  37. package/dist/query/basic.d.ts.map +1 -1
  38. package/dist/query/matchers.d.ts.map +1 -1
  39. package/dist/query/situations.d.ts +2 -0
  40. package/dist/query/situations.d.ts.map +1 -0
  41. package/dist/query/types.d.ts +3 -2
  42. package/dist/query/types.d.ts.map +1 -1
  43. package/dist/query.min.js +12 -6
  44. package/dist/thread/basic.d.ts.map +1 -1
  45. package/dist/thread/filters.d.ts +2 -2
  46. package/dist/thread/filters.d.ts.map +1 -1
  47. package/dist/thread/utils.d.ts +1 -0
  48. package/dist/thread/utils.d.ts.map +1 -1
  49. package/dist/thread/writeable.d.ts +5 -0
  50. package/dist/thread/writeable.d.ts.map +1 -1
  51. package/dist/thread.min.js +6 -4
  52. package/dist/types/typescript-utils.d.ts +2 -2
  53. package/dist/types/typescript-utils.d.ts.map +1 -1
  54. package/dist/types.min.js +2 -2
  55. package/dist/utils.d.ts.map +1 -1
  56. package/dist/utils.min.js +1 -1
  57. package/package.json +13 -12
  58. package/dist/chunk-DF3UOPRV.min.js.map +0 -1
  59. package/dist/chunk-DPU6MD7E.min.js.map +0 -1
  60. package/dist/chunk-JEYJIYNF.min.js.map +0 -1
  61. package/dist/chunk-R3MVKMV2.min.js.map +0 -1
  62. /package/dist/{chunk-3HSO7QDN.min.js.map → chunk-FIOA3FZW.min.js.map} +0 -0
  63. /package/dist/{chunk-KRQZ6V4Y.min.js.map → chunk-PHITDXZT.min.js.map} +0 -0
@@ -3,10 +3,9 @@ import {
3
3
  } from "./chunk-QPGEBDMJ.min.js";
4
4
  import {
5
5
  lastWriteWins
6
- } from "./chunk-DPU6MD7E.min.js";
6
+ } from "./chunk-OBMVNVJR.min.js";
7
7
  import {
8
8
  CID,
9
- E,
10
9
  Token,
11
10
  Type,
12
11
  areCidsEqual,
@@ -17,45 +16,46 @@ import {
17
16
  encode,
18
17
  encodeBlockOriginal,
19
18
  ensureTsPvAndFinalizeApplog,
19
+ g,
20
20
  getLogsFromThread,
21
21
  makeCborEncoders,
22
22
  prepareForPub,
23
23
  rollingFilter,
24
24
  src_exports,
25
25
  wrapper_default
26
- } from "./chunk-JEYJIYNF.min.js";
26
+ } from "./chunk-NPCVLBCM.min.js";
27
27
  import {
28
28
  __commonJS,
29
29
  __toESM
30
- } from "./chunk-KRQZ6V4Y.min.js";
30
+ } from "./chunk-PHITDXZT.min.js";
31
31
 
32
32
  // ../../../node_modules/.pnpm/varint@6.0.0/node_modules/varint/encode.js
33
33
  var require_encode = __commonJS({
34
34
  "../../../node_modules/.pnpm/varint@6.0.0/node_modules/varint/encode.js"(exports, module) {
35
35
  "use strict";
36
- module.exports = encode5;
37
- var MSB2 = 128;
38
- var REST2 = 127;
39
- var MSBALL2 = ~REST2;
40
- var INT2 = Math.pow(2, 31);
41
- function encode5(num, out, offset) {
36
+ module.exports = encode3;
37
+ var MSB = 128;
38
+ var REST = 127;
39
+ var MSBALL = ~REST;
40
+ var INT = Math.pow(2, 31);
41
+ function encode3(num, out, offset) {
42
42
  if (Number.MAX_SAFE_INTEGER && num > Number.MAX_SAFE_INTEGER) {
43
- encode5.bytes = 0;
43
+ encode3.bytes = 0;
44
44
  throw new RangeError("Could not encode varint");
45
45
  }
46
46
  out = out || [];
47
47
  offset = offset || 0;
48
48
  var oldOffset = offset;
49
- while (num >= INT2) {
50
- out[offset++] = num & 255 | MSB2;
49
+ while (num >= INT) {
50
+ out[offset++] = num & 255 | MSB;
51
51
  num /= 128;
52
52
  }
53
- while (num & MSBALL2) {
54
- out[offset++] = num & 255 | MSB2;
53
+ while (num & MSBALL) {
54
+ out[offset++] = num & 255 | MSB;
55
55
  num >>>= 7;
56
56
  }
57
57
  out[offset] = num | 0;
58
- encode5.bytes = offset - oldOffset + 1;
58
+ encode3.bytes = offset - oldOffset + 1;
59
59
  return out;
60
60
  }
61
61
  }
@@ -65,21 +65,21 @@ var require_encode = __commonJS({
65
65
  var require_decode = __commonJS({
66
66
  "../../../node_modules/.pnpm/varint@6.0.0/node_modules/varint/decode.js"(exports, module) {
67
67
  "use strict";
68
- module.exports = read2;
69
- var MSB2 = 128;
70
- var REST2 = 127;
71
- function read2(buf, offset) {
68
+ module.exports = read;
69
+ var MSB = 128;
70
+ var REST = 127;
71
+ function read(buf, offset) {
72
72
  var res = 0, offset = offset || 0, shift = 0, counter = offset, b, l = buf.length;
73
73
  do {
74
74
  if (counter >= l || shift > 49) {
75
- read2.bytes = 0;
75
+ read.bytes = 0;
76
76
  throw new RangeError("Could not decode varint");
77
77
  }
78
78
  b = buf[counter++];
79
- res += shift < 28 ? (b & REST2) << shift : (b & REST2) * Math.pow(2, shift);
79
+ res += shift < 28 ? (b & REST) << shift : (b & REST) * Math.pow(2, shift);
80
80
  shift += 7;
81
- } while (b >= MSB2);
82
- read2.bytes = counter - offset;
81
+ } while (b >= MSB);
82
+ read.bytes = counter - offset;
83
83
  return res;
84
84
  }
85
85
  }
@@ -89,17 +89,17 @@ var require_decode = __commonJS({
89
89
  var require_length = __commonJS({
90
90
  "../../../node_modules/.pnpm/varint@6.0.0/node_modules/varint/length.js"(exports, module) {
91
91
  "use strict";
92
- var N12 = Math.pow(2, 7);
93
- var N22 = Math.pow(2, 14);
94
- var N32 = Math.pow(2, 21);
95
- var N42 = Math.pow(2, 28);
96
- var N52 = Math.pow(2, 35);
97
- var N62 = Math.pow(2, 42);
98
- var N72 = Math.pow(2, 49);
99
- var N82 = Math.pow(2, 56);
100
- var N92 = Math.pow(2, 63);
92
+ var N1 = Math.pow(2, 7);
93
+ var N2 = Math.pow(2, 14);
94
+ var N3 = Math.pow(2, 21);
95
+ var N4 = Math.pow(2, 28);
96
+ var N5 = Math.pow(2, 35);
97
+ var N6 = Math.pow(2, 42);
98
+ var N7 = Math.pow(2, 49);
99
+ var N8 = Math.pow(2, 56);
100
+ var N9 = Math.pow(2, 63);
101
101
  module.exports = function(value) {
102
- return value < N12 ? 1 : value < N22 ? 2 : value < N32 ? 3 : value < N42 ? 4 : value < N52 ? 5 : value < N62 ? 6 : value < N72 ? 7 : value < N82 ? 8 : value < N92 ? 9 : 10;
102
+ return value < N1 ? 1 : value < N2 ? 2 : value < N3 ? 3 : value < N4 ? 4 : value < N5 ? 5 : value < N6 ? 6 : value < N7 ? 7 : value < N8 ? 8 : value < N9 ? 9 : 10;
103
103
  };
104
104
  }
105
105
  });
@@ -116,879 +116,19 @@ var require_varint = __commonJS({
116
116
  }
117
117
  });
118
118
 
119
- // ../../../node_modules/.pnpm/multiformats@13.3.1/node_modules/multiformats/dist/src/bytes.js
120
- var empty = new Uint8Array(0);
121
- function equals(aa, bb) {
122
- if (aa === bb)
123
- return true;
124
- if (aa.byteLength !== bb.byteLength) {
125
- return false;
126
- }
127
- for (let ii = 0; ii < aa.byteLength; ii++) {
128
- if (aa[ii] !== bb[ii]) {
129
- return false;
130
- }
131
- }
132
- return true;
133
- }
134
- function coerce(o) {
135
- if (o instanceof Uint8Array && o.constructor.name === "Uint8Array")
136
- return o;
137
- if (o instanceof ArrayBuffer)
138
- return new Uint8Array(o);
139
- if (ArrayBuffer.isView(o)) {
140
- return new Uint8Array(o.buffer, o.byteOffset, o.byteLength);
141
- }
142
- throw new Error("Unknown type, must be binary type");
143
- }
144
-
145
- // ../../../node_modules/.pnpm/multiformats@13.3.1/node_modules/multiformats/dist/src/vendor/base-x.js
146
- function base(ALPHABET, name) {
147
- if (ALPHABET.length >= 255) {
148
- throw new TypeError("Alphabet too long");
149
- }
150
- var BASE_MAP = new Uint8Array(256);
151
- for (var j = 0; j < BASE_MAP.length; j++) {
152
- BASE_MAP[j] = 255;
153
- }
154
- for (var i = 0; i < ALPHABET.length; i++) {
155
- var x = ALPHABET.charAt(i);
156
- var xc = x.charCodeAt(0);
157
- if (BASE_MAP[xc] !== 255) {
158
- throw new TypeError(x + " is ambiguous");
159
- }
160
- BASE_MAP[xc] = i;
161
- }
162
- var BASE = ALPHABET.length;
163
- var LEADER = ALPHABET.charAt(0);
164
- var FACTOR = Math.log(BASE) / Math.log(256);
165
- var iFACTOR = Math.log(256) / Math.log(BASE);
166
- function encode5(source) {
167
- if (source instanceof Uint8Array)
168
- ;
169
- else if (ArrayBuffer.isView(source)) {
170
- source = new Uint8Array(source.buffer, source.byteOffset, source.byteLength);
171
- } else if (Array.isArray(source)) {
172
- source = Uint8Array.from(source);
173
- }
174
- if (!(source instanceof Uint8Array)) {
175
- throw new TypeError("Expected Uint8Array");
176
- }
177
- if (source.length === 0) {
178
- return "";
179
- }
180
- var zeroes = 0;
181
- var length2 = 0;
182
- var pbegin = 0;
183
- var pend = source.length;
184
- while (pbegin !== pend && source[pbegin] === 0) {
185
- pbegin++;
186
- zeroes++;
187
- }
188
- var size = (pend - pbegin) * iFACTOR + 1 >>> 0;
189
- var b58 = new Uint8Array(size);
190
- while (pbegin !== pend) {
191
- var carry = source[pbegin];
192
- var i2 = 0;
193
- for (var it1 = size - 1; (carry !== 0 || i2 < length2) && it1 !== -1; it1--, i2++) {
194
- carry += 256 * b58[it1] >>> 0;
195
- b58[it1] = carry % BASE >>> 0;
196
- carry = carry / BASE >>> 0;
197
- }
198
- if (carry !== 0) {
199
- throw new Error("Non-zero carry");
200
- }
201
- length2 = i2;
202
- pbegin++;
203
- }
204
- var it2 = size - length2;
205
- while (it2 !== size && b58[it2] === 0) {
206
- it2++;
207
- }
208
- var str = LEADER.repeat(zeroes);
209
- for (; it2 < size; ++it2) {
210
- str += ALPHABET.charAt(b58[it2]);
211
- }
212
- return str;
213
- }
214
- function decodeUnsafe(source) {
215
- if (typeof source !== "string") {
216
- throw new TypeError("Expected String");
217
- }
218
- if (source.length === 0) {
219
- return new Uint8Array();
220
- }
221
- var psz = 0;
222
- if (source[psz] === " ") {
223
- return;
224
- }
225
- var zeroes = 0;
226
- var length2 = 0;
227
- while (source[psz] === LEADER) {
228
- zeroes++;
229
- psz++;
230
- }
231
- var size = (source.length - psz) * FACTOR + 1 >>> 0;
232
- var b256 = new Uint8Array(size);
233
- while (source[psz]) {
234
- var carry = BASE_MAP[source.charCodeAt(psz)];
235
- if (carry === 255) {
236
- return;
237
- }
238
- var i2 = 0;
239
- for (var it3 = size - 1; (carry !== 0 || i2 < length2) && it3 !== -1; it3--, i2++) {
240
- carry += BASE * b256[it3] >>> 0;
241
- b256[it3] = carry % 256 >>> 0;
242
- carry = carry / 256 >>> 0;
243
- }
244
- if (carry !== 0) {
245
- throw new Error("Non-zero carry");
246
- }
247
- length2 = i2;
248
- psz++;
249
- }
250
- if (source[psz] === " ") {
251
- return;
252
- }
253
- var it4 = size - length2;
254
- while (it4 !== size && b256[it4] === 0) {
255
- it4++;
256
- }
257
- var vch = new Uint8Array(zeroes + (size - it4));
258
- var j2 = zeroes;
259
- while (it4 !== size) {
260
- vch[j2++] = b256[it4++];
261
- }
262
- return vch;
263
- }
264
- function decode9(string) {
265
- var buffer = decodeUnsafe(string);
266
- if (buffer) {
267
- return buffer;
268
- }
269
- throw new Error(`Non-${name} character`);
270
- }
271
- return {
272
- encode: encode5,
273
- decodeUnsafe,
274
- decode: decode9
275
- };
276
- }
277
- var src = base;
278
- var _brrp__multiformats_scope_baseX = src;
279
- var base_x_default = _brrp__multiformats_scope_baseX;
280
-
281
- // ../../../node_modules/.pnpm/multiformats@13.3.1/node_modules/multiformats/dist/src/bases/base.js
282
- var Encoder = class {
283
- name;
284
- prefix;
285
- baseEncode;
286
- constructor(name, prefix, baseEncode) {
287
- this.name = name;
288
- this.prefix = prefix;
289
- this.baseEncode = baseEncode;
290
- }
291
- encode(bytes) {
292
- if (bytes instanceof Uint8Array) {
293
- return `${this.prefix}${this.baseEncode(bytes)}`;
294
- } else {
295
- throw Error("Unknown type, must be binary type");
296
- }
297
- }
298
- };
299
- var Decoder = class {
300
- name;
301
- prefix;
302
- baseDecode;
303
- prefixCodePoint;
304
- constructor(name, prefix, baseDecode) {
305
- this.name = name;
306
- this.prefix = prefix;
307
- const prefixCodePoint = prefix.codePointAt(0);
308
- if (prefixCodePoint === void 0) {
309
- throw new Error("Invalid prefix character");
310
- }
311
- this.prefixCodePoint = prefixCodePoint;
312
- this.baseDecode = baseDecode;
313
- }
314
- decode(text) {
315
- if (typeof text === "string") {
316
- if (text.codePointAt(0) !== this.prefixCodePoint) {
317
- throw Error(`Unable to decode multibase string ${JSON.stringify(text)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);
318
- }
319
- return this.baseDecode(text.slice(this.prefix.length));
320
- } else {
321
- throw Error("Can only multibase decode strings");
322
- }
323
- }
324
- or(decoder) {
325
- return or(this, decoder);
326
- }
327
- };
328
- var ComposedDecoder = class {
329
- decoders;
330
- constructor(decoders) {
331
- this.decoders = decoders;
332
- }
333
- or(decoder) {
334
- return or(this, decoder);
335
- }
336
- decode(input) {
337
- const prefix = input[0];
338
- const decoder = this.decoders[prefix];
339
- if (decoder != null) {
340
- return decoder.decode(input);
341
- } else {
342
- throw RangeError(`Unable to decode multibase string ${JSON.stringify(input)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`);
343
- }
344
- }
345
- };
346
- function or(left, right) {
347
- return new ComposedDecoder({
348
- ...left.decoders ?? { [left.prefix]: left },
349
- ...right.decoders ?? { [right.prefix]: right }
350
- });
351
- }
352
- var Codec = class {
353
- name;
354
- prefix;
355
- baseEncode;
356
- baseDecode;
357
- encoder;
358
- decoder;
359
- constructor(name, prefix, baseEncode, baseDecode) {
360
- this.name = name;
361
- this.prefix = prefix;
362
- this.baseEncode = baseEncode;
363
- this.baseDecode = baseDecode;
364
- this.encoder = new Encoder(name, prefix, baseEncode);
365
- this.decoder = new Decoder(name, prefix, baseDecode);
366
- }
367
- encode(input) {
368
- return this.encoder.encode(input);
369
- }
370
- decode(input) {
371
- return this.decoder.decode(input);
372
- }
373
- };
374
- function from({ name, prefix, encode: encode5, decode: decode9 }) {
375
- return new Codec(name, prefix, encode5, decode9);
376
- }
377
- function baseX({ name, prefix, alphabet }) {
378
- const { encode: encode5, decode: decode9 } = base_x_default(alphabet, name);
379
- return from({
380
- prefix,
381
- name,
382
- encode: encode5,
383
- decode: (text) => coerce(decode9(text))
384
- });
385
- }
386
- function decode4(string, alphabet, bitsPerChar, name) {
387
- const codes = {};
388
- for (let i = 0; i < alphabet.length; ++i) {
389
- codes[alphabet[i]] = i;
390
- }
391
- let end = string.length;
392
- while (string[end - 1] === "=") {
393
- --end;
394
- }
395
- const out = new Uint8Array(end * bitsPerChar / 8 | 0);
396
- let bits = 0;
397
- let buffer = 0;
398
- let written = 0;
399
- for (let i = 0; i < end; ++i) {
400
- const value = codes[string[i]];
401
- if (value === void 0) {
402
- throw new SyntaxError(`Non-${name} character`);
403
- }
404
- buffer = buffer << bitsPerChar | value;
405
- bits += bitsPerChar;
406
- if (bits >= 8) {
407
- bits -= 8;
408
- out[written++] = 255 & buffer >> bits;
409
- }
410
- }
411
- if (bits >= bitsPerChar || (255 & buffer << 8 - bits) !== 0) {
412
- throw new SyntaxError("Unexpected end of data");
413
- }
414
- return out;
415
- }
416
- function encode2(data, alphabet, bitsPerChar) {
417
- const pad = alphabet[alphabet.length - 1] === "=";
418
- const mask = (1 << bitsPerChar) - 1;
419
- let out = "";
420
- let bits = 0;
421
- let buffer = 0;
422
- for (let i = 0; i < data.length; ++i) {
423
- buffer = buffer << 8 | data[i];
424
- bits += 8;
425
- while (bits > bitsPerChar) {
426
- bits -= bitsPerChar;
427
- out += alphabet[mask & buffer >> bits];
428
- }
429
- }
430
- if (bits !== 0) {
431
- out += alphabet[mask & buffer << bitsPerChar - bits];
432
- }
433
- if (pad) {
434
- while ((out.length * bitsPerChar & 7) !== 0) {
435
- out += "=";
436
- }
437
- }
438
- return out;
439
- }
440
- function rfc4648({ name, prefix, bitsPerChar, alphabet }) {
441
- return from({
442
- prefix,
443
- name,
444
- encode(input) {
445
- return encode2(input, alphabet, bitsPerChar);
446
- },
447
- decode(input) {
448
- return decode4(input, alphabet, bitsPerChar, name);
449
- }
450
- });
451
- }
452
-
453
- // ../../../node_modules/.pnpm/multiformats@13.3.1/node_modules/multiformats/dist/src/bases/base32.js
454
- var base32 = rfc4648({
455
- prefix: "b",
456
- name: "base32",
457
- alphabet: "abcdefghijklmnopqrstuvwxyz234567",
458
- bitsPerChar: 5
459
- });
460
- var base32upper = rfc4648({
461
- prefix: "B",
462
- name: "base32upper",
463
- alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",
464
- bitsPerChar: 5
465
- });
466
- var base32pad = rfc4648({
467
- prefix: "c",
468
- name: "base32pad",
469
- alphabet: "abcdefghijklmnopqrstuvwxyz234567=",
470
- bitsPerChar: 5
471
- });
472
- var base32padupper = rfc4648({
473
- prefix: "C",
474
- name: "base32padupper",
475
- alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",
476
- bitsPerChar: 5
477
- });
478
- var base32hex = rfc4648({
479
- prefix: "v",
480
- name: "base32hex",
481
- alphabet: "0123456789abcdefghijklmnopqrstuv",
482
- bitsPerChar: 5
483
- });
484
- var base32hexupper = rfc4648({
485
- prefix: "V",
486
- name: "base32hexupper",
487
- alphabet: "0123456789ABCDEFGHIJKLMNOPQRSTUV",
488
- bitsPerChar: 5
489
- });
490
- var base32hexpad = rfc4648({
491
- prefix: "t",
492
- name: "base32hexpad",
493
- alphabet: "0123456789abcdefghijklmnopqrstuv=",
494
- bitsPerChar: 5
495
- });
496
- var base32hexpadupper = rfc4648({
497
- prefix: "T",
498
- name: "base32hexpadupper",
499
- alphabet: "0123456789ABCDEFGHIJKLMNOPQRSTUV=",
500
- bitsPerChar: 5
501
- });
502
- var base32z = rfc4648({
503
- prefix: "h",
504
- name: "base32z",
505
- alphabet: "ybndrfg8ejkmcpqxot1uwisza345h769",
506
- bitsPerChar: 5
507
- });
508
-
509
- // ../../../node_modules/.pnpm/multiformats@13.3.1/node_modules/multiformats/dist/src/bases/base36.js
510
- var base36 = baseX({
511
- prefix: "k",
512
- name: "base36",
513
- alphabet: "0123456789abcdefghijklmnopqrstuvwxyz"
514
- });
515
- var base36upper = baseX({
516
- prefix: "K",
517
- name: "base36upper",
518
- alphabet: "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
519
- });
520
-
521
- // ../../../node_modules/.pnpm/multiformats@13.3.1/node_modules/multiformats/dist/src/bases/base58.js
522
- var base58btc = baseX({
523
- name: "base58btc",
524
- prefix: "z",
525
- alphabet: "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"
526
- });
527
- var base58flickr = baseX({
528
- name: "base58flickr",
529
- prefix: "Z",
530
- alphabet: "123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"
531
- });
532
-
533
- // ../../../node_modules/.pnpm/multiformats@13.3.1/node_modules/multiformats/dist/src/vendor/varint.js
534
- var encode_1 = encode3;
535
- var MSB = 128;
536
- var REST = 127;
537
- var MSBALL = ~REST;
538
- var INT = Math.pow(2, 31);
539
- function encode3(num, out, offset) {
540
- out = out || [];
541
- offset = offset || 0;
542
- var oldOffset = offset;
543
- while (num >= INT) {
544
- out[offset++] = num & 255 | MSB;
545
- num /= 128;
546
- }
547
- while (num & MSBALL) {
548
- out[offset++] = num & 255 | MSB;
549
- num >>>= 7;
550
- }
551
- out[offset] = num | 0;
552
- encode3.bytes = offset - oldOffset + 1;
553
- return out;
554
- }
555
- var decode5 = read;
556
- var MSB$1 = 128;
557
- var REST$1 = 127;
558
- function read(buf, offset) {
559
- var res = 0, offset = offset || 0, shift = 0, counter = offset, b, l = buf.length;
560
- do {
561
- if (counter >= l) {
562
- read.bytes = 0;
563
- throw new RangeError("Could not decode varint");
564
- }
565
- b = buf[counter++];
566
- res += shift < 28 ? (b & REST$1) << shift : (b & REST$1) * Math.pow(2, shift);
567
- shift += 7;
568
- } while (b >= MSB$1);
569
- read.bytes = counter - offset;
570
- return res;
571
- }
572
- var N1 = Math.pow(2, 7);
573
- var N2 = Math.pow(2, 14);
574
- var N3 = Math.pow(2, 21);
575
- var N4 = Math.pow(2, 28);
576
- var N5 = Math.pow(2, 35);
577
- var N6 = Math.pow(2, 42);
578
- var N7 = Math.pow(2, 49);
579
- var N8 = Math.pow(2, 56);
580
- var N9 = Math.pow(2, 63);
581
- var length = function(value) {
582
- return value < N1 ? 1 : value < N2 ? 2 : value < N3 ? 3 : value < N4 ? 4 : value < N5 ? 5 : value < N6 ? 6 : value < N7 ? 7 : value < N8 ? 8 : value < N9 ? 9 : 10;
583
- };
584
- var varint = {
585
- encode: encode_1,
586
- decode: decode5,
587
- encodingLength: length
588
- };
589
- var _brrp_varint = varint;
590
- var varint_default = _brrp_varint;
591
-
592
- // ../../../node_modules/.pnpm/multiformats@13.3.1/node_modules/multiformats/dist/src/varint.js
593
- function decode6(data, offset = 0) {
594
- const code = varint_default.decode(data, offset);
595
- return [code, varint_default.decode.bytes];
596
- }
597
- function encodeTo(int, target, offset = 0) {
598
- varint_default.encode(int, target, offset);
599
- return target;
600
- }
601
- function encodingLength(int) {
602
- return varint_default.encodingLength(int);
603
- }
604
-
605
- // ../../../node_modules/.pnpm/multiformats@13.3.1/node_modules/multiformats/dist/src/hashes/digest.js
606
- function create(code, digest) {
607
- const size = digest.byteLength;
608
- const sizeOffset = encodingLength(code);
609
- const digestOffset = sizeOffset + encodingLength(size);
610
- const bytes = new Uint8Array(digestOffset + size);
611
- encodeTo(code, bytes, 0);
612
- encodeTo(size, bytes, sizeOffset);
613
- bytes.set(digest, digestOffset);
614
- return new Digest(code, size, digest, bytes);
615
- }
616
- function decode7(multihash) {
617
- const bytes = coerce(multihash);
618
- const [code, sizeOffset] = decode6(bytes);
619
- const [size, digestOffset] = decode6(bytes.subarray(sizeOffset));
620
- const digest = bytes.subarray(sizeOffset + digestOffset);
621
- if (digest.byteLength !== size) {
622
- throw new Error("Incorrect length");
623
- }
624
- return new Digest(code, size, digest, bytes);
625
- }
626
- function equals2(a, b) {
627
- if (a === b) {
628
- return true;
629
- } else {
630
- const data = b;
631
- return a.code === data.code && a.size === data.size && data.bytes instanceof Uint8Array && equals(a.bytes, data.bytes);
632
- }
633
- }
634
- var Digest = class {
635
- code;
636
- size;
637
- digest;
638
- bytes;
639
- /**
640
- * Creates a multihash digest.
641
- */
642
- constructor(code, size, digest, bytes) {
643
- this.code = code;
644
- this.size = size;
645
- this.digest = digest;
646
- this.bytes = bytes;
647
- }
648
- };
649
-
650
- // ../../../node_modules/.pnpm/multiformats@13.3.1/node_modules/multiformats/dist/src/cid.js
651
- function format(link, base2) {
652
- const { bytes, version } = link;
653
- switch (version) {
654
- case 0:
655
- return toStringV0(bytes, baseCache(link), base2 ?? base58btc.encoder);
656
- default:
657
- return toStringV1(bytes, baseCache(link), base2 ?? base32.encoder);
658
- }
659
- }
660
- var cache = /* @__PURE__ */ new WeakMap();
661
- function baseCache(cid) {
662
- const baseCache2 = cache.get(cid);
663
- if (baseCache2 == null) {
664
- const baseCache3 = /* @__PURE__ */ new Map();
665
- cache.set(cid, baseCache3);
666
- return baseCache3;
667
- }
668
- return baseCache2;
669
- }
670
- var CID2 = class _CID {
671
- code;
672
- version;
673
- multihash;
674
- bytes;
675
- "/";
676
- /**
677
- * @param version - Version of the CID
678
- * @param code - Code of the codec content is encoded in, see https://github.com/multiformats/multicodec/blob/master/table.csv
679
- * @param multihash - (Multi)hash of the of the content.
680
- */
681
- constructor(version, code, multihash, bytes) {
682
- this.code = code;
683
- this.version = version;
684
- this.multihash = multihash;
685
- this.bytes = bytes;
686
- this["/"] = bytes;
687
- }
688
- /**
689
- * Signalling `cid.asCID === cid` has been replaced with `cid['/'] === cid.bytes`
690
- * please either use `CID.asCID(cid)` or switch to new signalling mechanism
691
- *
692
- * @deprecated
693
- */
694
- get asCID() {
695
- return this;
696
- }
697
- // ArrayBufferView
698
- get byteOffset() {
699
- return this.bytes.byteOffset;
700
- }
701
- // ArrayBufferView
702
- get byteLength() {
703
- return this.bytes.byteLength;
704
- }
705
- toV0() {
706
- switch (this.version) {
707
- case 0: {
708
- return this;
709
- }
710
- case 1: {
711
- const { code, multihash } = this;
712
- if (code !== DAG_PB_CODE) {
713
- throw new Error("Cannot convert a non dag-pb CID to CIDv0");
714
- }
715
- if (multihash.code !== SHA_256_CODE) {
716
- throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");
717
- }
718
- return _CID.createV0(multihash);
719
- }
720
- default: {
721
- throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`);
722
- }
723
- }
724
- }
725
- toV1() {
726
- switch (this.version) {
727
- case 0: {
728
- const { code, digest } = this.multihash;
729
- const multihash = create(code, digest);
730
- return _CID.createV1(this.code, multihash);
731
- }
732
- case 1: {
733
- return this;
734
- }
735
- default: {
736
- throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`);
737
- }
738
- }
739
- }
740
- equals(other) {
741
- return _CID.equals(this, other);
742
- }
743
- static equals(self, other) {
744
- const unknown = other;
745
- return unknown != null && self.code === unknown.code && self.version === unknown.version && equals2(self.multihash, unknown.multihash);
746
- }
747
- toString(base2) {
748
- return format(this, base2);
749
- }
750
- toJSON() {
751
- return { "/": format(this) };
752
- }
753
- link() {
754
- return this;
755
- }
756
- [Symbol.toStringTag] = "CID";
757
- // Legacy
758
- [Symbol.for("nodejs.util.inspect.custom")]() {
759
- return `CID(${this.toString()})`;
760
- }
761
- /**
762
- * Takes any input `value` and returns a `CID` instance if it was
763
- * a `CID` otherwise returns `null`. If `value` is instanceof `CID`
764
- * it will return value back. If `value` is not instance of this CID
765
- * class, but is compatible CID it will return new instance of this
766
- * `CID` class. Otherwise returns null.
767
- *
768
- * This allows two different incompatible versions of CID library to
769
- * co-exist and interop as long as binary interface is compatible.
770
- */
771
- static asCID(input) {
772
- if (input == null) {
773
- return null;
774
- }
775
- const value = input;
776
- if (value instanceof _CID) {
777
- return value;
778
- } else if (value["/"] != null && value["/"] === value.bytes || value.asCID === value) {
779
- const { version, code, multihash, bytes } = value;
780
- return new _CID(version, code, multihash, bytes ?? encodeCID(version, code, multihash.bytes));
781
- } else if (value[cidSymbol] === true) {
782
- const { version, multihash, code } = value;
783
- const digest = decode7(multihash);
784
- return _CID.create(version, code, digest);
785
- } else {
786
- return null;
787
- }
788
- }
789
- /**
790
- * @param version - Version of the CID
791
- * @param code - Code of the codec content is encoded in, see https://github.com/multiformats/multicodec/blob/master/table.csv
792
- * @param digest - (Multi)hash of the of the content.
793
- */
794
- static create(version, code, digest) {
795
- if (typeof code !== "number") {
796
- throw new Error("String codecs are no longer supported");
797
- }
798
- if (!(digest.bytes instanceof Uint8Array)) {
799
- throw new Error("Invalid digest");
800
- }
801
- switch (version) {
802
- case 0: {
803
- if (code !== DAG_PB_CODE) {
804
- throw new Error(`Version 0 CID must use dag-pb (code: ${DAG_PB_CODE}) block encoding`);
805
- } else {
806
- return new _CID(version, code, digest, digest.bytes);
807
- }
808
- }
809
- case 1: {
810
- const bytes = encodeCID(version, code, digest.bytes);
811
- return new _CID(version, code, digest, bytes);
812
- }
813
- default: {
814
- throw new Error("Invalid version");
815
- }
816
- }
817
- }
818
- /**
819
- * Simplified version of `create` for CIDv0.
820
- */
821
- static createV0(digest) {
822
- return _CID.create(0, DAG_PB_CODE, digest);
823
- }
824
- /**
825
- * Simplified version of `create` for CIDv1.
826
- *
827
- * @param code - Content encoding format code.
828
- * @param digest - Multihash of the content.
829
- */
830
- static createV1(code, digest) {
831
- return _CID.create(1, code, digest);
832
- }
833
- /**
834
- * Decoded a CID from its binary representation. The byte array must contain
835
- * only the CID with no additional bytes.
836
- *
837
- * An error will be thrown if the bytes provided do not contain a valid
838
- * binary representation of a CID.
839
- */
840
- static decode(bytes) {
841
- const [cid, remainder] = _CID.decodeFirst(bytes);
842
- if (remainder.length !== 0) {
843
- throw new Error("Incorrect length");
844
- }
845
- return cid;
846
- }
847
- /**
848
- * Decoded a CID from its binary representation at the beginning of a byte
849
- * array.
850
- *
851
- * Returns an array with the first element containing the CID and the second
852
- * element containing the remainder of the original byte array. The remainder
853
- * will be a zero-length byte array if the provided bytes only contained a
854
- * binary CID representation.
855
- */
856
- static decodeFirst(bytes) {
857
- const specs = _CID.inspectBytes(bytes);
858
- const prefixSize = specs.size - specs.multihashSize;
859
- const multihashBytes = coerce(bytes.subarray(prefixSize, prefixSize + specs.multihashSize));
860
- if (multihashBytes.byteLength !== specs.multihashSize) {
861
- throw new Error("Incorrect length");
862
- }
863
- const digestBytes = multihashBytes.subarray(specs.multihashSize - specs.digestSize);
864
- const digest = new Digest(specs.multihashCode, specs.digestSize, digestBytes, multihashBytes);
865
- const cid = specs.version === 0 ? _CID.createV0(digest) : _CID.createV1(specs.codec, digest);
866
- return [cid, bytes.subarray(specs.size)];
867
- }
868
- /**
869
- * Inspect the initial bytes of a CID to determine its properties.
870
- *
871
- * Involves decoding up to 4 varints. Typically this will require only 4 to 6
872
- * bytes but for larger multicodec code values and larger multihash digest
873
- * lengths these varints can be quite large. It is recommended that at least
874
- * 10 bytes be made available in the `initialBytes` argument for a complete
875
- * inspection.
876
- */
877
- static inspectBytes(initialBytes) {
878
- let offset = 0;
879
- const next = () => {
880
- const [i, length2] = decode6(initialBytes.subarray(offset));
881
- offset += length2;
882
- return i;
883
- };
884
- let version = next();
885
- let codec = DAG_PB_CODE;
886
- if (version === 18) {
887
- version = 0;
888
- offset = 0;
889
- } else {
890
- codec = next();
891
- }
892
- if (version !== 0 && version !== 1) {
893
- throw new RangeError(`Invalid CID version ${version}`);
894
- }
895
- const prefixSize = offset;
896
- const multihashCode = next();
897
- const digestSize = next();
898
- const size = offset + digestSize;
899
- const multihashSize = size - prefixSize;
900
- return { version, codec, multihashCode, digestSize, multihashSize, size };
901
- }
902
- /**
903
- * Takes cid in a string representation and creates an instance. If `base`
904
- * decoder is not provided will use a default from the configuration. It will
905
- * throw an error if encoding of the CID is not compatible with supplied (or
906
- * a default decoder).
907
- */
908
- static parse(source, base2) {
909
- const [prefix, bytes] = parseCIDtoBytes(source, base2);
910
- const cid = _CID.decode(bytes);
911
- if (cid.version === 0 && source[0] !== "Q") {
912
- throw Error("Version 0 CID string must not include multibase prefix");
913
- }
914
- baseCache(cid).set(prefix, source);
915
- return cid;
916
- }
917
- };
918
- function parseCIDtoBytes(source, base2) {
919
- switch (source[0]) {
920
- case "Q": {
921
- const decoder = base2 ?? base58btc;
922
- return [
923
- base58btc.prefix,
924
- decoder.decode(`${base58btc.prefix}${source}`)
925
- ];
926
- }
927
- case base58btc.prefix: {
928
- const decoder = base2 ?? base58btc;
929
- return [base58btc.prefix, decoder.decode(source)];
930
- }
931
- case base32.prefix: {
932
- const decoder = base2 ?? base32;
933
- return [base32.prefix, decoder.decode(source)];
934
- }
935
- case base36.prefix: {
936
- const decoder = base2 ?? base36;
937
- return [base36.prefix, decoder.decode(source)];
938
- }
939
- default: {
940
- if (base2 == null) {
941
- throw Error("To parse non base32, base36 or base58btc encoded CID multibase decoder must be provided");
942
- }
943
- return [source[0], base2.decode(source)];
944
- }
945
- }
946
- }
947
- function toStringV0(bytes, cache2, base2) {
948
- const { prefix } = base2;
949
- if (prefix !== base58btc.prefix) {
950
- throw Error(`Cannot string encode V0 in ${base2.name} encoding`);
951
- }
952
- const cid = cache2.get(prefix);
953
- if (cid == null) {
954
- const cid2 = base2.encode(bytes).slice(1);
955
- cache2.set(prefix, cid2);
956
- return cid2;
957
- } else {
958
- return cid;
959
- }
960
- }
961
- function toStringV1(bytes, cache2, base2) {
962
- const { prefix } = base2;
963
- const cid = cache2.get(prefix);
964
- if (cid == null) {
965
- const cid2 = base2.encode(bytes);
966
- cache2.set(prefix, cid2);
967
- return cid2;
968
- } else {
969
- return cid;
119
+ // ../../../node_modules/.pnpm/@ipld+dag-cbor@9.2.5/node_modules/@ipld/dag-cbor/src/index.js
120
+ var CID_CBOR_TAG = 42;
121
+ function toByteView(buf) {
122
+ if (buf instanceof ArrayBuffer) {
123
+ return new Uint8Array(buf, 0, buf.byteLength);
970
124
  }
125
+ return buf;
971
126
  }
972
- var DAG_PB_CODE = 112;
973
- var SHA_256_CODE = 18;
974
- function encodeCID(version, code, multihash) {
975
- const codeOffset = encodingLength(version);
976
- const hashOffset = codeOffset + encodingLength(code);
977
- const bytes = new Uint8Array(hashOffset + multihash.byteLength);
978
- encodeTo(version, bytes, 0);
979
- encodeTo(code, bytes, codeOffset);
980
- bytes.set(multihash, hashOffset);
981
- return bytes;
982
- }
983
- var cidSymbol = Symbol.for("@ipld/js-cid/CID");
984
-
985
- // ../../../node_modules/.pnpm/@ipld+dag-cbor@9.1.0/node_modules/@ipld/dag-cbor/src/index.js
986
- var CID_CBOR_TAG = 42;
987
127
  function cidEncoder(obj) {
988
128
  if (obj.asCID !== obj && obj["/"] !== obj.bytes) {
989
129
  return null;
990
130
  }
991
- const cid = CID2.asCID(obj);
131
+ const cid = CID.asCID(obj);
992
132
  if (!cid) {
993
133
  return null;
994
134
  }
@@ -1011,9 +151,18 @@ function numberEncoder(num) {
1011
151
  }
1012
152
  return null;
1013
153
  }
154
+ function mapEncoder(map) {
155
+ for (const key of map.keys()) {
156
+ if (typeof key !== "string" || key.length === 0) {
157
+ throw new Error("Non-string Map keys are not supported by the IPLD Data Model and cannot be encoded");
158
+ }
159
+ }
160
+ return null;
161
+ }
1014
162
  var _encodeOptions = {
1015
163
  float64: true,
1016
164
  typeEncoders: {
165
+ Map: mapEncoder,
1017
166
  Object: cidEncoder,
1018
167
  undefined: undefinedEncoder,
1019
168
  number: numberEncoder
@@ -1029,7 +178,7 @@ function cidDecoder(bytes) {
1029
178
  if (bytes[0] !== 0) {
1030
179
  throw new Error("Invalid CID for CBOR tag 42; expected leading 0x00");
1031
180
  }
1032
- return CID2.decode(bytes.subarray(1));
181
+ return CID.decode(bytes.subarray(1));
1033
182
  }
1034
183
  var _decodeOptions = {
1035
184
  allowIndefinite: false,
@@ -1050,11 +199,11 @@ var decodeOptions = {
1050
199
  ..._decodeOptions,
1051
200
  tags: _decodeOptions.tags.slice()
1052
201
  };
1053
- var encode4 = (node) => encode(node, _encodeOptions);
1054
- var decode8 = (data) => decode(data, _decodeOptions);
202
+ var encode2 = (node) => encode(node, _encodeOptions);
203
+ var decode4 = (data) => decode(toByteView(data), _decodeOptions);
1055
204
 
1056
- // ../../../node_modules/.pnpm/@ipld+car@5.2.6/node_modules/@ipld/car/src/decoder-common.js
1057
- var import_varint2 = __toESM(require_varint(), 1);
205
+ // ../../../node_modules/.pnpm/@ipld+car@5.4.2/node_modules/@ipld/car/src/decoder-common.js
206
+ var import_varint = __toESM(require_varint(), 1);
1058
207
  var CIDV0_BYTES = {
1059
208
  SHA2_256: 18,
1060
209
  LENGTH: 32,
@@ -1068,10 +217,10 @@ function decodeVarint(bytes, seeker) {
1068
217
  if (!bytes.length) {
1069
218
  throw new Error("Unexpected end of data");
1070
219
  }
1071
- const i = import_varint2.default.decode(bytes);
220
+ const i = import_varint.default.decode(bytes);
1072
221
  seeker.seek(
1073
222
  /** @type {number} */
1074
- import_varint2.default.decode.bytes
223
+ import_varint.default.decode.bytes
1075
224
  );
1076
225
  return i;
1077
226
  }
@@ -1092,63 +241,93 @@ function decodeV2Header(bytes) {
1092
241
  return header;
1093
242
  }
1094
243
  function getMultihashLength(bytes) {
1095
- import_varint2.default.decode(bytes);
244
+ import_varint.default.decode(bytes);
1096
245
  const codeLength = (
1097
246
  /** @type {number} */
1098
- import_varint2.default.decode.bytes
247
+ import_varint.default.decode.bytes
1099
248
  );
1100
- const length2 = import_varint2.default.decode(bytes.subarray(import_varint2.default.decode.bytes));
249
+ const length = import_varint.default.decode(bytes.subarray(import_varint.default.decode.bytes));
1101
250
  const lengthLength = (
1102
251
  /** @type {number} */
1103
- import_varint2.default.decode.bytes
252
+ import_varint.default.decode.bytes
1104
253
  );
1105
- const mhLength = codeLength + lengthLength + length2;
254
+ const mhLength = codeLength + lengthLength + length;
1106
255
  return mhLength;
1107
256
  }
1108
257
 
1109
- // ../../../node_modules/.pnpm/@ipld+car@5.2.6/node_modules/@ipld/car/src/header-validator.js
258
+ // ../../../node_modules/.pnpm/@ipld+car@5.4.2/node_modules/@ipld/car/src/header-validator.js
1110
259
  var Kinds = {
1111
260
  Null: (
1112
- /** @returns {undefined|null} */
261
+ /**
262
+ * @param obj
263
+ * @returns {undefined|null}
264
+ */
1113
265
  (obj) => obj === null ? obj : void 0
1114
266
  ),
1115
267
  Int: (
1116
- /** @returns {undefined|number} */
268
+ /**
269
+ * @param obj
270
+ * @returns {undefined|number}
271
+ */
1117
272
  (obj) => Number.isInteger(obj) ? obj : void 0
1118
273
  ),
1119
274
  Float: (
1120
- /** @returns {undefined|number} */
275
+ /**
276
+ * @param obj
277
+ * @returns {undefined|number}
278
+ */
1121
279
  (obj) => typeof obj === "number" && Number.isFinite(obj) ? obj : void 0
1122
280
  ),
1123
281
  String: (
1124
- /** @returns {undefined|string} */
282
+ /**
283
+ * @param obj
284
+ * @returns {undefined|string}
285
+ */
1125
286
  (obj) => typeof obj === "string" ? obj : void 0
1126
287
  ),
1127
288
  Bool: (
1128
- /** @returns {undefined|boolean} */
289
+ /**
290
+ * @param obj
291
+ * @returns {undefined|boolean}
292
+ */
1129
293
  (obj) => typeof obj === "boolean" ? obj : void 0
1130
294
  ),
1131
295
  Bytes: (
1132
- /** @returns {undefined|Uint8Array} */
296
+ /**
297
+ * @param obj
298
+ * @returns {undefined|Uint8Array}
299
+ */
1133
300
  (obj) => obj instanceof Uint8Array ? obj : void 0
1134
301
  ),
1135
302
  Link: (
1136
- /** @returns {undefined|object} */
303
+ /**
304
+ * @param obj
305
+ * @returns {undefined|object}
306
+ */
1137
307
  (obj) => obj !== null && typeof obj === "object" && obj.asCID === obj ? obj : void 0
1138
308
  ),
1139
309
  List: (
1140
- /** @returns {undefined|Array<any>} */
310
+ /**
311
+ * @param obj
312
+ * @returns {undefined|Array<any>}
313
+ */
1141
314
  (obj) => Array.isArray(obj) ? obj : void 0
1142
315
  ),
1143
316
  Map: (
1144
- /** @returns {undefined|object} */
317
+ /**
318
+ * @param obj
319
+ * @returns {undefined|object}
320
+ */
1145
321
  (obj) => obj !== null && typeof obj === "object" && obj.asCID !== obj && !Array.isArray(obj) && !(obj instanceof Uint8Array) ? obj : void 0
1146
322
  )
1147
323
  };
1148
324
  var Types = {
1149
325
  "CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)": Kinds.Link,
1150
326
  "CarV1HeaderOrV2Pragma > roots (anon)": (
1151
- /** @returns {undefined|any} */
327
+ /**
328
+ * @param obj
329
+ * @returns {undefined|any}
330
+ */
1152
331
  (obj) => {
1153
332
  if (Kinds.List(obj) === void 0) {
1154
333
  return void 0;
@@ -1177,7 +356,10 @@ var Types = {
1177
356
  ),
1178
357
  Int: Kinds.Int,
1179
358
  CarV1HeaderOrV2Pragma: (
1180
- /** @returns {undefined|any} */
359
+ /**
360
+ * @param obj
361
+ * @returns {undefined|any}
362
+ */
1181
363
  (obj) => {
1182
364
  if (Kinds.Map(obj) === void 0) {
1183
365
  return void 0;
@@ -1237,7 +419,10 @@ var Types = {
1237
419
  var Reprs = {
1238
420
  "CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)": Kinds.Link,
1239
421
  "CarV1HeaderOrV2Pragma > roots (anon)": (
1240
- /** @returns {undefined|any} */
422
+ /**
423
+ * @param obj
424
+ * @returns {undefined|any}
425
+ */
1241
426
  (obj) => {
1242
427
  if (Kinds.List(obj) === void 0) {
1243
428
  return void 0;
@@ -1266,7 +451,10 @@ var Reprs = {
1266
451
  ),
1267
452
  Int: Kinds.Int,
1268
453
  CarV1HeaderOrV2Pragma: (
1269
- /** @returns {undefined|any} */
454
+ /**
455
+ * @param obj
456
+ * @returns {undefined|any}
457
+ */
1270
458
  (obj) => {
1271
459
  if (Kinds.Map(obj) === void 0) {
1272
460
  return void 0;
@@ -1328,11 +516,11 @@ var CarV1HeaderOrV2Pragma = {
1328
516
  toRepresentation: Reprs.CarV1HeaderOrV2Pragma
1329
517
  };
1330
518
 
1331
- // ../../../node_modules/.pnpm/cborg@4.0.9/node_modules/cborg/lib/length.js
519
+ // ../../../node_modules/.pnpm/cborg@4.2.15/node_modules/cborg/lib/length.js
1332
520
  var cborEncoders = makeCborEncoders();
1333
521
 
1334
- // ../../../node_modules/.pnpm/@ipld+car@5.2.6/node_modules/@ipld/car/src/buffer-writer.js
1335
- var import_varint3 = __toESM(require_varint(), 1);
522
+ // ../../../node_modules/.pnpm/@ipld+car@5.4.2/node_modules/@ipld/car/src/buffer-writer.js
523
+ var import_varint2 = __toESM(require_varint(), 1);
1336
524
  var headerPreludeTokens = [
1337
525
  new Token(Type.map, 2),
1338
526
  new Token(Type.string, "version"),
@@ -1341,14 +529,14 @@ var headerPreludeTokens = [
1341
529
  ];
1342
530
  var CID_TAG = new Token(Type.tag, 42);
1343
531
 
1344
- // ../../../node_modules/.pnpm/@ipld+car@5.2.6/node_modules/@ipld/car/src/decoder.js
532
+ // ../../../node_modules/.pnpm/@ipld+car@5.4.2/node_modules/@ipld/car/src/decoder.js
1345
533
  async function readHeader(reader, strictVersion) {
1346
- const length2 = decodeVarint(await reader.upTo(8), reader);
1347
- if (length2 === 0) {
534
+ const length = decodeVarint(await reader.upTo(8), reader);
535
+ if (length === 0) {
1348
536
  throw new Error("Invalid CAR header (zero length)");
1349
537
  }
1350
- const header = await reader.exactly(length2, true);
1351
- const block = decode8(header);
538
+ const header = await reader.exactly(length, true);
539
+ const block = decode4(header);
1352
540
  if (CarV1HeaderOrV2Pragma.toTyped(block) === void 0) {
1353
541
  throw new Error("Invalid CAR header format");
1354
542
  }
@@ -1387,14 +575,14 @@ async function readCid(reader) {
1387
575
  }
1388
576
  async function readBlockHead(reader) {
1389
577
  const start = reader.pos;
1390
- let length2 = decodeVarint(await reader.upTo(8), reader);
1391
- if (length2 === 0) {
578
+ let length = decodeVarint(await reader.upTo(8), reader);
579
+ if (length === 0) {
1392
580
  throw new Error("Invalid CAR section (zero length)");
1393
581
  }
1394
- length2 += reader.pos - start;
582
+ length += reader.pos - start;
1395
583
  const cid = await readCid(reader);
1396
- const blockLength = length2 - Number(reader.pos - start);
1397
- return { cid, length: length2, blockLength };
584
+ const blockLength = length - Number(reader.pos - start);
585
+ return { cid, length, blockLength };
1398
586
  }
1399
587
  async function readBlock(reader) {
1400
588
  const { cid, blockLength } = await readBlockHead(reader);
@@ -1403,8 +591,8 @@ async function readBlock(reader) {
1403
591
  }
1404
592
  async function readBlockIndex(reader) {
1405
593
  const offset = reader.pos;
1406
- const { cid, length: length2, blockLength } = await readBlockHead(reader);
1407
- const index = { cid, length: length2, blockLength, offset, blockOffset: reader.pos };
594
+ const { cid, length, blockLength } = await readBlockHead(reader);
595
+ const index = { cid, length, blockLength, offset, blockOffset: reader.pos };
1408
596
  reader.seek(index.blockLength);
1409
597
  return index;
1410
598
  }
@@ -1436,22 +624,22 @@ function createDecoder(reader) {
1436
624
  function bytesReader(bytes) {
1437
625
  let pos = 0;
1438
626
  return {
1439
- async upTo(length2) {
1440
- const out = bytes.subarray(pos, pos + Math.min(length2, bytes.length - pos));
627
+ async upTo(length) {
628
+ const out = bytes.subarray(pos, pos + Math.min(length, bytes.length - pos));
1441
629
  return out;
1442
630
  },
1443
- async exactly(length2, seek = false) {
1444
- if (length2 > bytes.length - pos) {
631
+ async exactly(length, seek = false) {
632
+ if (length > bytes.length - pos) {
1445
633
  throw new Error("Unexpected end of data");
1446
634
  }
1447
- const out = bytes.subarray(pos, pos + length2);
635
+ const out = bytes.subarray(pos, pos + length);
1448
636
  if (seek) {
1449
- pos += length2;
637
+ pos += length;
1450
638
  }
1451
639
  return out;
1452
640
  },
1453
- seek(length2) {
1454
- pos += length2;
641
+ seek(length) {
642
+ pos += length;
1455
643
  },
1456
644
  get pos() {
1457
645
  return pos;
@@ -1463,10 +651,13 @@ function chunkReader(readChunk) {
1463
651
  let have = 0;
1464
652
  let offset = 0;
1465
653
  let currentChunk = new Uint8Array(0);
1466
- const read2 = async (length2) => {
654
+ const read = async (length) => {
1467
655
  have = currentChunk.length - offset;
1468
- const bufa = [currentChunk.subarray(offset)];
1469
- while (have < length2) {
656
+ const bufa = (
657
+ /** @type {Uint8Array<ArrayBufferLike>[]} */
658
+ [currentChunk.subarray(offset)]
659
+ );
660
+ while (have < length) {
1470
661
  const chunk = await readChunk();
1471
662
  if (chunk == null) {
1472
663
  break;
@@ -1489,29 +680,29 @@ function chunkReader(readChunk) {
1489
680
  offset = 0;
1490
681
  };
1491
682
  return {
1492
- async upTo(length2) {
1493
- if (currentChunk.length - offset < length2) {
1494
- await read2(length2);
683
+ async upTo(length) {
684
+ if (currentChunk.length - offset < length) {
685
+ await read(length);
1495
686
  }
1496
- return currentChunk.subarray(offset, offset + Math.min(currentChunk.length - offset, length2));
687
+ return currentChunk.subarray(offset, offset + Math.min(currentChunk.length - offset, length));
1497
688
  },
1498
- async exactly(length2, seek = false) {
1499
- if (currentChunk.length - offset < length2) {
1500
- await read2(length2);
689
+ async exactly(length, seek = false) {
690
+ if (currentChunk.length - offset < length) {
691
+ await read(length);
1501
692
  }
1502
- if (currentChunk.length - offset < length2) {
693
+ if (currentChunk.length - offset < length) {
1503
694
  throw new Error("Unexpected end of data");
1504
695
  }
1505
- const out = currentChunk.subarray(offset, offset + length2);
696
+ const out = currentChunk.subarray(offset, offset + length);
1506
697
  if (seek) {
1507
- pos += length2;
1508
- offset += length2;
698
+ pos += length;
699
+ offset += length;
1509
700
  }
1510
701
  return out;
1511
702
  },
1512
- seek(length2) {
1513
- pos += length2;
1514
- offset += length2;
703
+ seek(length) {
704
+ pos += length;
705
+ offset += length;
1515
706
  },
1516
707
  get pos() {
1517
708
  return pos;
@@ -1532,26 +723,26 @@ function asyncIterableReader(asyncIterable) {
1532
723
  function limitReader(reader, byteLimit) {
1533
724
  let bytesRead = 0;
1534
725
  return {
1535
- async upTo(length2) {
1536
- let bytes = await reader.upTo(length2);
726
+ async upTo(length) {
727
+ let bytes = await reader.upTo(length);
1537
728
  if (bytes.length + bytesRead > byteLimit) {
1538
729
  bytes = bytes.subarray(0, byteLimit - bytesRead);
1539
730
  }
1540
731
  return bytes;
1541
732
  },
1542
- async exactly(length2, seek = false) {
1543
- const bytes = await reader.exactly(length2, seek);
733
+ async exactly(length, seek = false) {
734
+ const bytes = await reader.exactly(length, seek);
1544
735
  if (bytes.length + bytesRead > byteLimit) {
1545
736
  throw new Error("Unexpected end of data");
1546
737
  }
1547
738
  if (seek) {
1548
- bytesRead += length2;
739
+ bytesRead += length;
1549
740
  }
1550
741
  return bytes;
1551
742
  },
1552
- seek(length2) {
1553
- bytesRead += length2;
1554
- reader.seek(length2);
743
+ seek(length) {
744
+ bytesRead += length;
745
+ reader.seek(length);
1555
746
  },
1556
747
  get pos() {
1557
748
  return reader.pos;
@@ -1559,7 +750,7 @@ function limitReader(reader, byteLimit) {
1559
750
  };
1560
751
  }
1561
752
 
1562
- // ../../../node_modules/.pnpm/@ipld+car@5.2.6/node_modules/@ipld/car/src/reader-browser.js
753
+ // ../../../node_modules/.pnpm/@ipld+car@5.4.2/node_modules/@ipld/car/src/reader-browser.js
1563
754
  var CarReader = class {
1564
755
  /**
1565
756
  * @constructs CarReader
@@ -1706,11 +897,12 @@ async function decodeReaderComplete(reader) {
1706
897
  return new CarReader(header, blocks);
1707
898
  }
1708
899
 
1709
- // ../../../node_modules/.pnpm/@ipld+car@5.2.6/node_modules/@ipld/car/src/encoder.js
1710
- var import_varint4 = __toESM(require_varint(), 1);
900
+ // ../../../node_modules/.pnpm/@ipld+car@5.4.2/node_modules/@ipld/car/src/encoder.js
901
+ var import_varint3 = __toESM(require_varint(), 1);
902
+ var CAR_V1_VERSION = 1;
1711
903
  function createHeader(roots) {
1712
- const headerBytes = encode4({ version: 1, roots });
1713
- const varintBytes = import_varint4.default.encode(headerBytes.length);
904
+ const headerBytes = encode2({ version: CAR_V1_VERSION, roots });
905
+ const varintBytes = import_varint3.default.encode(headerBytes.length);
1714
906
  const header = new Uint8Array(varintBytes.length + headerBytes.length);
1715
907
  header.set(varintBytes, 0);
1716
908
  header.set(headerBytes, varintBytes.length);
@@ -1732,7 +924,7 @@ function createEncoder(writer) {
1732
924
  */
1733
925
  async writeBlock(block) {
1734
926
  const { cid, bytes } = block;
1735
- await writer.write(new Uint8Array(import_varint4.default.encode(cid.bytes.length + bytes.length)));
927
+ await writer.write(new Uint8Array(import_varint3.default.encode(cid.bytes.length + bytes.length)));
1736
928
  await writer.write(cid.bytes);
1737
929
  if (bytes.length) {
1738
930
  await writer.write(bytes);
@@ -1743,14 +935,20 @@ function createEncoder(writer) {
1743
935
  */
1744
936
  async close() {
1745
937
  await writer.end();
938
+ },
939
+ /**
940
+ * @returns {number}
941
+ */
942
+ version() {
943
+ return CAR_V1_VERSION;
1746
944
  }
1747
945
  };
1748
946
  }
1749
947
 
1750
- // ../../../node_modules/.pnpm/@ipld+car@5.2.6/node_modules/@ipld/car/src/iterator-channel.js
948
+ // ../../../node_modules/.pnpm/@ipld+car@5.4.2/node_modules/@ipld/car/src/iterator-channel.js
1751
949
  function noop() {
1752
950
  }
1753
- function create2() {
951
+ function create() {
1754
952
  const chunkQueue = [];
1755
953
  let drainer = null;
1756
954
  let drainerResolver = noop;
@@ -1816,7 +1014,7 @@ function create2() {
1816
1014
  return { writer, iterator };
1817
1015
  }
1818
1016
 
1819
- // ../../../node_modules/.pnpm/@ipld+car@5.2.6/node_modules/@ipld/car/src/writer-browser.js
1017
+ // ../../../node_modules/.pnpm/@ipld+car@5.4.2/node_modules/@ipld/car/src/writer-browser.js
1820
1018
  var CarWriter = class _CarWriter {
1821
1019
  /**
1822
1020
  * @param {CID[]} roots
@@ -1870,6 +1068,14 @@ var CarWriter = class _CarWriter {
1870
1068
  this._ended = true;
1871
1069
  return this._encoder.close();
1872
1070
  }
1071
+ /**
1072
+ * Returns the version number of the CAR file being written
1073
+ *
1074
+ * @returns {number}
1075
+ */
1076
+ version() {
1077
+ return this._encoder.version();
1078
+ }
1873
1079
  /**
1874
1080
  * Create a new CAR writer "channel" which consists of a
1875
1081
  * `{ writer:CarWriter, out:AsyncIterable<Uint8Array> }` pair.
@@ -1959,7 +1165,7 @@ var CarWriterOut = class {
1959
1165
  }
1960
1166
  };
1961
1167
  function encodeWriter() {
1962
- const iw = create2();
1168
+ const iw = create();
1963
1169
  const { writer, iterator } = iw;
1964
1170
  const encoder = createEncoder(writer);
1965
1171
  return { encoder, iterator };
@@ -1987,7 +1193,7 @@ function toRoots(roots) {
1987
1193
  }
1988
1194
 
1989
1195
  // src/ipfs/car.ts
1990
- var { WARN, LOG, DEBUG, VERBOSE, ERROR } = E.setup(E.INFO);
1196
+ var { WARN, LOG, DEBUG, VERBOSE, ERROR } = g.setup(g.INFO);
1991
1197
  async function decodePubFromCar(car) {
1992
1198
  const decoded = await getBlocksOfCar(car);
1993
1199
  return await decodePubFromBlocks(decoded);
@@ -2001,8 +1207,7 @@ async function decodePubFromBlocks({ rootCID, blockStore }, recursionTrace = [])
2001
1207
  let applogsCID = null;
2002
1208
  let info = null;
2003
1209
  VERBOSE(`[decodePubFromBlocks] root:`, rootCID.toString(), root, { blockStore });
2004
- if (!root)
2005
- throw ERROR("root not found in blockStore", { blockStore, rootCID });
1210
+ if (!root) throw ERROR("root not found in blockStore", { blockStore, rootCID });
2006
1211
  if (root?.info) {
2007
1212
  applogsCID = root.applogs;
2008
1213
  const applogsBlock = await getDecodedBlock(blockStore, applogsCID);
@@ -2019,8 +1224,7 @@ async function decodePubFromBlocks({ rootCID, blockStore }, recursionTrace = [])
2019
1224
  ERROR(`Could not find applog CID in pub blocks:`, cid.toString(), { cid, root, blockStore });
2020
1225
  throw new Error(`Could not find applog CID in pub blocks: ${cid.toString()}`);
2021
1226
  }
2022
- if (applog.pv instanceof CID)
2023
- applog.pv = applog.pv.toV1().toString();
1227
+ if (applog.pv instanceof CID) applog.pv = applog.pv.toV1().toString();
2024
1228
  return {
2025
1229
  ...applog,
2026
1230
  cid: cid.toV1().toString()
@@ -2078,8 +1282,7 @@ async function getDecodedBlock(blockStore, cid) {
2078
1282
  return null;
2079
1283
  }
2080
1284
  } catch (err) {
2081
- if (err.message === "Not Found")
2082
- return null;
1285
+ if (err.message === "Not Found") return null;
2083
1286
  throw err;
2084
1287
  }
2085
1288
  return decode3(blob);
@@ -2104,7 +1307,7 @@ async function carFromBlob(blob) {
2104
1307
  return CarReader.fromBytes(new Uint8Array(await blob.arrayBuffer()));
2105
1308
  }
2106
1309
  function streamReaderToIterable(bodyReader) {
2107
- return async function* () {
1310
+ return (async function* () {
2108
1311
  while (true) {
2109
1312
  const { done, value } = await bodyReader.read();
2110
1313
  VERBOSE(`[car] chunk`, { done, value });
@@ -2113,11 +1316,11 @@ function streamReaderToIterable(bodyReader) {
2113
1316
  }
2114
1317
  yield value;
2115
1318
  }
2116
- }();
1319
+ })();
2117
1320
  }
2118
1321
 
2119
1322
  // src/pubsub/pub-push.ts
2120
- var { WARN: WARN2, LOG: LOG2, DEBUG: DEBUG2, VERBOSE: VERBOSE2, ERROR: ERROR2 } = E.setup(E.INFO);
1323
+ var { WARN: WARN2, LOG: LOG2, DEBUG: DEBUG2, VERBOSE: VERBOSE2, ERROR: ERROR2 } = g.setup(g.INFO);
2121
1324
  async function preparePubForPush(agent, appThread, threadToPublish, publication, prevPubCID) {
2122
1325
  let logsToPublish = getLogsFromThread(threadToPublish);
2123
1326
  DEBUG2(`[preparePubForPush] Collected ${logsToPublish.length} logs :`, {
@@ -2196,8 +1399,7 @@ async function preparePubForPush(agent, appThread, threadToPublish, publication,
2196
1399
  ...agentSharedKeyLogs
2197
1400
  ];
2198
1401
  DEBUG2(`[preparePubForPush] info logs:`, infoLogs);
2199
- if (!infoLogs.find(({ at }) => at === "agent/appAgent"))
2200
- throw ERROR2(`[preparePubForPush] appThread missing agent/appAgent log`);
1402
+ if (!infoLogs.find(({ at }) => at === "agent/appAgent")) throw ERROR2(`[preparePubForPush] appThread missing agent/appAgent log`);
2201
1403
  const applogsToEncode = keepTruthy(maybeEncryptedApplogs);
2202
1404
  const infologsToEncode = keepTruthy(infoLogs);
2203
1405
  if (!applogsToEncode.length) {
@@ -2242,15 +1444,13 @@ async function encodePubAsCar(agent, applogs, infoLogs, prevPubCID) {
2242
1444
  };
2243
1445
  }
2244
1446
  async function chunkApplogs(applogCids, size = 1e4) {
2245
- if (!applogCids.length)
2246
- throw ERROR2(`[chunkApplogs] called with empty array`);
1447
+ if (!applogCids.length) throw ERROR2(`[chunkApplogs] called with empty array`);
2247
1448
  const chunks = [];
2248
1449
  for (let i = 0; i < applogCids.length; i += size) {
2249
1450
  const chunk = await encodeBlockOriginal({ logs: applogCids.slice(i, Math.min(i + applogCids.length, i + size)) });
2250
1451
  chunks.push(chunk);
2251
1452
  }
2252
- if (chunks.length === 1)
2253
- return { rootCID: chunks[0].cid, blocks: chunks };
1453
+ if (chunks.length === 1) return { rootCID: chunks[0].cid, blocks: chunks };
2254
1454
  const root = await encodeBlockOriginal({ chunks: chunks.map((chunk) => chunk.cid) });
2255
1455
  const blocks = [root, ...chunks];
2256
1456
  DEBUG2(`[chunkApplogs] ${applogCids.length} logs chunked into ${chunks.length}`, { applogCids, root, blocks, chunks, dagJson: src_exports });
@@ -2261,8 +1461,7 @@ async function unchunkApplogsBlock(block, blockStore) {
2261
1461
  return (await Promise.all(
2262
1462
  block.chunks.map(async (chunkCid) => {
2263
1463
  const block2 = await getDecodedBlock(blockStore, chunkCid);
2264
- if (!block2.logs)
2265
- throw ERROR2(`Weird chunk`, block2);
1464
+ if (!block2.logs) throw ERROR2(`Weird chunk`, block2);
2266
1465
  return block2.logs;
2267
1466
  })
2268
1467
  )).flat();
@@ -2275,8 +1474,7 @@ function isPubBlockChunks(block) {
2275
1474
  }
2276
1475
  async function encodeApplogsAsCar(applogs) {
2277
1476
  const encoded = await encodeApplogsAsIPLD(applogs);
2278
- if (!encoded)
2279
- throw ERROR2("invalid applogs cannot continue", { applogs, encoded });
1477
+ if (!encoded) throw ERROR2("invalid applogs cannot continue", { applogs, encoded });
2280
1478
  const { cids, encodedApplogs } = encoded;
2281
1479
  const root = { applogs: cids };
2282
1480
  const encodedRoot = await encodeBlockOriginal(root);
@@ -2287,14 +1485,12 @@ async function encodeApplogsAsIPLD(applogs) {
2287
1485
  DEBUG2({ applogs });
2288
1486
  const validApplogs = applogs.filter((eachLog) => !!eachLog);
2289
1487
  DEBUG2({ validApplogs });
2290
- if (!validApplogs.length)
2291
- throw ERROR2("no valid applogs");
1488
+ if (!validApplogs.length) throw ERROR2("no valid applogs");
2292
1489
  const preppedLogs = validApplogs.map((log) => prepareForPub(log).log);
2293
1490
  const encodedApplogs = await Promise.all(preppedLogs.map(encodeBlockOriginal));
2294
1491
  DEBUG2("[encodeApplogsAsIpld] encoded applogs", { preppedLogs, encodedApplogs });
2295
1492
  const cids = encodedApplogs.map((b) => {
2296
- if (!b.cid)
2297
- throw ERROR2(`[publish] no cid for encoded log:`, b);
1493
+ if (!b.cid) throw ERROR2(`[publish] no cid for encoded log:`, b);
2298
1494
  return b.cid;
2299
1495
  });
2300
1496
  return { cids, encodedApplogs };
@@ -2316,4 +1512,4 @@ export {
2316
1512
  carFromBlob,
2317
1513
  streamReaderToIterable
2318
1514
  };
2319
- //# sourceMappingURL=chunk-R3MVKMV2.min.js.map
1515
+ //# sourceMappingURL=chunk-JEOQUHTK.min.js.map