omnipin 1.7.1 → 1.7.2

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 (2) hide show
  1. package/dist/cli.js +835 -451
  2. package/package.json +13 -13
package/dist/cli.js CHANGED
@@ -53,13 +53,13 @@ var __toESM = (mod3, isNodeMode, target) => {
53
53
  return to2;
54
54
  };
55
55
  var __commonJS = (cb, mod3) => () => (mod3 || cb((mod3 = { exports: {} }).exports, mod3), mod3.exports);
56
- var __export = (target, all2) => {
57
- for (var name12 in all2)
58
- __defProp(target, name12, {
59
- get: all2[name12],
56
+ var __export = (target, all3) => {
57
+ for (var name2 in all3)
58
+ __defProp(target, name2, {
59
+ get: all3[name2],
60
60
  enumerable: true,
61
61
  configurable: true,
62
- set: (newValue) => all2[name12] = () => newValue
62
+ set: (newValue) => all3[name2] = () => newValue
63
63
  });
64
64
  };
65
65
  var __require = /* @__PURE__ */ createRequire(import.meta.url);
@@ -874,14 +874,14 @@ var require_eventemitter3 = __commonJS((exports, module) => {
874
874
  }
875
875
  });
876
876
  var require_encode = __commonJS((exports, module) => {
877
- module.exports = encode202;
877
+ module.exports = encode232;
878
878
  var MSB22 = 128;
879
879
  var REST22 = 127;
880
880
  var MSBALL22 = ~REST22;
881
881
  var INT22 = Math.pow(2, 31);
882
- function encode202(num, out, offset) {
882
+ function encode232(num, out, offset) {
883
883
  if (Number.MAX_SAFE_INTEGER && num > Number.MAX_SAFE_INTEGER) {
884
- encode202.bytes = 0;
884
+ encode232.bytes = 0;
885
885
  throw new RangeError("Could not encode varint");
886
886
  }
887
887
  out = out || [];
@@ -896,7 +896,7 @@ var require_encode = __commonJS((exports, module) => {
896
896
  num >>>= 7;
897
897
  }
898
898
  out[offset] = num | 0;
899
- encode202.bytes = offset - oldOffset + 1;
899
+ encode232.bytes = offset - oldOffset + 1;
900
900
  return out;
901
901
  }
902
902
  });
@@ -1704,8 +1704,8 @@ var require_scan = __commonJS((exports, module) => {
1704
1704
  CHAR_RIGHT_PARENTHESES,
1705
1705
  CHAR_RIGHT_SQUARE_BRACKET
1706
1706
  } = require_constants();
1707
- var isPathSeparator = (code142) => {
1708
- return code142 === CHAR_FORWARD_SLASH || code142 === CHAR_BACKWARD_SLASH;
1707
+ var isPathSeparator = (code162) => {
1708
+ return code162 === CHAR_FORWARD_SLASH || code162 === CHAR_BACKWARD_SLASH;
1709
1709
  };
1710
1710
  var depth = (token) => {
1711
1711
  if (token.isPrefix !== true) {
@@ -1735,38 +1735,38 @@ var require_scan = __commonJS((exports, module) => {
1735
1735
  let finished = false;
1736
1736
  let braces = 0;
1737
1737
  let prev;
1738
- let code142;
1738
+ let code162;
1739
1739
  let token = { value: "", depth: 0, isGlob: false };
1740
1740
  const eos = () => index2 >= length22;
1741
1741
  const peek = () => str.charCodeAt(index2 + 1);
1742
1742
  const advance = () => {
1743
- prev = code142;
1743
+ prev = code162;
1744
1744
  return str.charCodeAt(++index2);
1745
1745
  };
1746
1746
  while (index2 < length22) {
1747
- code142 = advance();
1747
+ code162 = advance();
1748
1748
  let next;
1749
- if (code142 === CHAR_BACKWARD_SLASH) {
1749
+ if (code162 === CHAR_BACKWARD_SLASH) {
1750
1750
  backslashes = token.backslashes = true;
1751
- code142 = advance();
1752
- if (code142 === CHAR_LEFT_CURLY_BRACE) {
1751
+ code162 = advance();
1752
+ if (code162 === CHAR_LEFT_CURLY_BRACE) {
1753
1753
  braceEscaped = true;
1754
1754
  }
1755
1755
  continue;
1756
1756
  }
1757
- if (braceEscaped === true || code142 === CHAR_LEFT_CURLY_BRACE) {
1757
+ if (braceEscaped === true || code162 === CHAR_LEFT_CURLY_BRACE) {
1758
1758
  braces++;
1759
- while (eos() !== true && (code142 = advance())) {
1760
- if (code142 === CHAR_BACKWARD_SLASH) {
1759
+ while (eos() !== true && (code162 = advance())) {
1760
+ if (code162 === CHAR_BACKWARD_SLASH) {
1761
1761
  backslashes = token.backslashes = true;
1762
1762
  advance();
1763
1763
  continue;
1764
1764
  }
1765
- if (code142 === CHAR_LEFT_CURLY_BRACE) {
1765
+ if (code162 === CHAR_LEFT_CURLY_BRACE) {
1766
1766
  braces++;
1767
1767
  continue;
1768
1768
  }
1769
- if (braceEscaped !== true && code142 === CHAR_DOT && (code142 = advance()) === CHAR_DOT) {
1769
+ if (braceEscaped !== true && code162 === CHAR_DOT && (code162 = advance()) === CHAR_DOT) {
1770
1770
  isBrace = token.isBrace = true;
1771
1771
  isGlob = token.isGlob = true;
1772
1772
  finished = true;
@@ -1775,7 +1775,7 @@ var require_scan = __commonJS((exports, module) => {
1775
1775
  }
1776
1776
  break;
1777
1777
  }
1778
- if (braceEscaped !== true && code142 === CHAR_COMMA) {
1778
+ if (braceEscaped !== true && code162 === CHAR_COMMA) {
1779
1779
  isBrace = token.isBrace = true;
1780
1780
  isGlob = token.isGlob = true;
1781
1781
  finished = true;
@@ -1784,7 +1784,7 @@ var require_scan = __commonJS((exports, module) => {
1784
1784
  }
1785
1785
  break;
1786
1786
  }
1787
- if (code142 === CHAR_RIGHT_CURLY_BRACE) {
1787
+ if (code162 === CHAR_RIGHT_CURLY_BRACE) {
1788
1788
  braces--;
1789
1789
  if (braces === 0) {
1790
1790
  braceEscaped = false;
@@ -1799,7 +1799,7 @@ var require_scan = __commonJS((exports, module) => {
1799
1799
  }
1800
1800
  break;
1801
1801
  }
1802
- if (code142 === CHAR_FORWARD_SLASH) {
1802
+ if (code162 === CHAR_FORWARD_SLASH) {
1803
1803
  slashes.push(index2);
1804
1804
  tokens.push(token);
1805
1805
  token = { value: "", depth: 0, isGlob: false };
@@ -1813,22 +1813,22 @@ var require_scan = __commonJS((exports, module) => {
1813
1813
  continue;
1814
1814
  }
1815
1815
  if (opts.noext !== true) {
1816
- const isExtglobChar = code142 === CHAR_PLUS || code142 === CHAR_AT || code142 === CHAR_ASTERISK || code142 === CHAR_QUESTION_MARK || code142 === CHAR_EXCLAMATION_MARK;
1816
+ const isExtglobChar = code162 === CHAR_PLUS || code162 === CHAR_AT || code162 === CHAR_ASTERISK || code162 === CHAR_QUESTION_MARK || code162 === CHAR_EXCLAMATION_MARK;
1817
1817
  if (isExtglobChar === true && peek() === CHAR_LEFT_PARENTHESES) {
1818
1818
  isGlob = token.isGlob = true;
1819
1819
  isExtglob = token.isExtglob = true;
1820
1820
  finished = true;
1821
- if (code142 === CHAR_EXCLAMATION_MARK && index2 === start) {
1821
+ if (code162 === CHAR_EXCLAMATION_MARK && index2 === start) {
1822
1822
  negatedExtglob = true;
1823
1823
  }
1824
1824
  if (scanToEnd === true) {
1825
- while (eos() !== true && (code142 = advance())) {
1826
- if (code142 === CHAR_BACKWARD_SLASH) {
1825
+ while (eos() !== true && (code162 = advance())) {
1826
+ if (code162 === CHAR_BACKWARD_SLASH) {
1827
1827
  backslashes = token.backslashes = true;
1828
- code142 = advance();
1828
+ code162 = advance();
1829
1829
  continue;
1830
1830
  }
1831
- if (code142 === CHAR_RIGHT_PARENTHESES) {
1831
+ if (code162 === CHAR_RIGHT_PARENTHESES) {
1832
1832
  isGlob = token.isGlob = true;
1833
1833
  finished = true;
1834
1834
  break;
@@ -1839,7 +1839,7 @@ var require_scan = __commonJS((exports, module) => {
1839
1839
  break;
1840
1840
  }
1841
1841
  }
1842
- if (code142 === CHAR_ASTERISK) {
1842
+ if (code162 === CHAR_ASTERISK) {
1843
1843
  if (prev === CHAR_ASTERISK)
1844
1844
  isGlobstar = token.isGlobstar = true;
1845
1845
  isGlob = token.isGlob = true;
@@ -1849,7 +1849,7 @@ var require_scan = __commonJS((exports, module) => {
1849
1849
  }
1850
1850
  break;
1851
1851
  }
1852
- if (code142 === CHAR_QUESTION_MARK) {
1852
+ if (code162 === CHAR_QUESTION_MARK) {
1853
1853
  isGlob = token.isGlob = true;
1854
1854
  finished = true;
1855
1855
  if (scanToEnd === true) {
@@ -1857,7 +1857,7 @@ var require_scan = __commonJS((exports, module) => {
1857
1857
  }
1858
1858
  break;
1859
1859
  }
1860
- if (code142 === CHAR_LEFT_SQUARE_BRACKET) {
1860
+ if (code162 === CHAR_LEFT_SQUARE_BRACKET) {
1861
1861
  while (eos() !== true && (next = advance())) {
1862
1862
  if (next === CHAR_BACKWARD_SLASH) {
1863
1863
  backslashes = token.backslashes = true;
@@ -1876,21 +1876,21 @@ var require_scan = __commonJS((exports, module) => {
1876
1876
  }
1877
1877
  break;
1878
1878
  }
1879
- if (opts.nonegate !== true && code142 === CHAR_EXCLAMATION_MARK && index2 === start) {
1879
+ if (opts.nonegate !== true && code162 === CHAR_EXCLAMATION_MARK && index2 === start) {
1880
1880
  negated = token.negated = true;
1881
1881
  start++;
1882
1882
  continue;
1883
1883
  }
1884
- if (opts.noparen !== true && code142 === CHAR_LEFT_PARENTHESES) {
1884
+ if (opts.noparen !== true && code162 === CHAR_LEFT_PARENTHESES) {
1885
1885
  isGlob = token.isGlob = true;
1886
1886
  if (scanToEnd === true) {
1887
- while (eos() !== true && (code142 = advance())) {
1888
- if (code142 === CHAR_LEFT_PARENTHESES) {
1887
+ while (eos() !== true && (code162 = advance())) {
1888
+ if (code162 === CHAR_LEFT_PARENTHESES) {
1889
1889
  backslashes = token.backslashes = true;
1890
- code142 = advance();
1890
+ code162 = advance();
1891
1891
  continue;
1892
1892
  }
1893
- if (code142 === CHAR_RIGHT_PARENTHESES) {
1893
+ if (code162 === CHAR_RIGHT_PARENTHESES) {
1894
1894
  finished = true;
1895
1895
  break;
1896
1896
  }
@@ -1956,7 +1956,7 @@ var require_scan = __commonJS((exports, module) => {
1956
1956
  };
1957
1957
  if (opts.tokens === true) {
1958
1958
  state.maxDepth = 0;
1959
- if (!isPathSeparator(code142)) {
1959
+ if (!isPathSeparator(code162)) {
1960
1960
  tokens.push(token);
1961
1961
  }
1962
1962
  state.tokens = tokens;
@@ -3711,7 +3711,7 @@ var handleArgParsing = ({ options }, args, parseOptions) => {
3711
3711
  };
3712
3712
  var hasOptions = (args) => !!args.find((arg) => typeof arg === "string" && (arg.startsWith(`--`) || arg.startsWith(`-`)) && arg !== "--" && arg !== "-");
3713
3713
  var isAnonymousCommand = (args, names) => {
3714
- return hasOptions(args) && !names.some((name12) => args.includes(name12));
3714
+ return hasOptions(args) && !names.some((name2) => args.includes(name2));
3715
3715
  };
3716
3716
  function makeFullPath(cli2, path3 = []) {
3717
3717
  if (cli2.parent) {
@@ -3787,8 +3787,8 @@ class CLI {
3787
3787
  plugins = [];
3788
3788
  mws = [];
3789
3789
  constructor(opts = {}) {
3790
- const { name: name12, prefix: prefix2, helpFn, ...parseOptions } = opts;
3791
- this.name = name12;
3790
+ const { name: name2, prefix: prefix2, helpFn, ...parseOptions } = opts;
3791
+ this.name = name2;
3792
3792
  this.prefix = prefix2 || "";
3793
3793
  this.#parseOptions = parseOptions;
3794
3794
  this.helpFn = helpFn;
@@ -4211,7 +4211,7 @@ var specPin = async ({
4211
4211
  baseURL: baseURL4,
4212
4212
  providerName: providerName12,
4213
4213
  cid,
4214
- name: name12,
4214
+ name: name2,
4215
4215
  token,
4216
4216
  first,
4217
4217
  verbose
@@ -4226,7 +4226,7 @@ var specPin = async ({
4226
4226
  },
4227
4227
  body: JSON.stringify({
4228
4228
  cid,
4229
- name: name12
4229
+ name: name2
4230
4230
  })
4231
4231
  });
4232
4232
  if (verbose)
@@ -4496,6 +4496,11 @@ function getVersion() {
4496
4496
  return version;
4497
4497
  }
4498
4498
  class BaseError extends Error {
4499
+ static setStaticOptions(options) {
4500
+ BaseError.prototype.docsOrigin = options.docsOrigin;
4501
+ BaseError.prototype.showVersion = options.showVersion;
4502
+ BaseError.prototype.version = options.version;
4503
+ }
4499
4504
  constructor(shortMessage, options = {}) {
4500
4505
  const details = (() => {
4501
4506
  if (options.cause instanceof BaseError) {
@@ -4515,16 +4520,18 @@ class BaseError extends Error {
4515
4520
  return options.cause.docsPath || options.docsPath;
4516
4521
  return options.docsPath;
4517
4522
  })();
4518
- const docsBaseUrl = options.docsOrigin ?? "https://oxlib.sh";
4523
+ const docsBaseUrl = options.docsOrigin ?? BaseError.prototype.docsOrigin;
4519
4524
  const docs = `${docsBaseUrl}${docsPath ?? ""}`;
4525
+ const showVersion = Boolean(options.version ?? BaseError.prototype.showVersion);
4526
+ const version22 = options.version ?? BaseError.prototype.version;
4520
4527
  const message2 = [
4521
4528
  shortMessage || "An error occurred.",
4522
4529
  ...options.metaMessages ? ["", ...options.metaMessages] : [],
4523
- ...details || docsPath || options.version ? [
4530
+ ...details || docsPath || showVersion ? [
4524
4531
  "",
4525
4532
  details ? `Details: ${details}` : void 0,
4526
4533
  docsPath ? `See: ${docs}` : void 0,
4527
- options.version ? `Version: ${options.version}` : void 0
4534
+ showVersion ? `Version: ${version22}` : void 0
4528
4535
  ] : []
4529
4536
  ].filter((x) => typeof x === "string").join(`
4530
4537
  `);
@@ -4541,6 +4548,12 @@ class BaseError extends Error {
4541
4548
  writable: true,
4542
4549
  value: void 0
4543
4550
  });
4551
+ Object.defineProperty(this, "docsOrigin", {
4552
+ enumerable: true,
4553
+ configurable: true,
4554
+ writable: true,
4555
+ value: void 0
4556
+ });
4544
4557
  Object.defineProperty(this, "docsPath", {
4545
4558
  enumerable: true,
4546
4559
  configurable: true,
@@ -4553,6 +4566,12 @@ class BaseError extends Error {
4553
4566
  writable: true,
4554
4567
  value: void 0
4555
4568
  });
4569
+ Object.defineProperty(this, "showVersion", {
4570
+ enumerable: true,
4571
+ configurable: true,
4572
+ writable: true,
4573
+ value: void 0
4574
+ });
4556
4575
  Object.defineProperty(this, "version", {
4557
4576
  enumerable: true,
4558
4577
  configurable: true,
@@ -4574,14 +4593,29 @@ class BaseError extends Error {
4574
4593
  this.cause = options.cause;
4575
4594
  this.details = details;
4576
4595
  this.docs = docs;
4596
+ this.docsOrigin = docsBaseUrl;
4577
4597
  this.docsPath = docsPath;
4578
4598
  this.shortMessage = shortMessage;
4579
- this.version = options.version ?? `ox@${getVersion()}`;
4599
+ this.showVersion = showVersion;
4600
+ this.version = version22;
4580
4601
  }
4581
4602
  walk(fn) {
4582
4603
  return walk(this, fn);
4583
4604
  }
4584
4605
  }
4606
+ Object.defineProperty(BaseError, "defaultStaticOptions", {
4607
+ enumerable: true,
4608
+ configurable: true,
4609
+ writable: true,
4610
+ value: {
4611
+ docsOrigin: "https://oxlib.sh",
4612
+ showVersion: false,
4613
+ version: `ox@${getVersion()}`
4614
+ }
4615
+ });
4616
+ (() => {
4617
+ BaseError.setStaticOptions(BaseError.defaultStaticOptions);
4618
+ })();
4585
4619
  function walk(err, fn) {
4586
4620
  if (fn?.(err))
4587
4621
  return err;
@@ -8010,7 +8044,7 @@ var uploadCar = async ({ file, ...args }) => {
8010
8044
  return res;
8011
8045
  };
8012
8046
  var uploadOnS3 = async ({
8013
- name: name12,
8047
+ name: name2,
8014
8048
  car,
8015
8049
  token,
8016
8050
  bucketName,
@@ -8018,7 +8052,7 @@ var uploadOnS3 = async ({
8018
8052
  providerName: providerName32,
8019
8053
  verbose
8020
8054
  }) => {
8021
- const file = new File([car], name12);
8055
+ const file = new File([car], name2);
8022
8056
  const res = await uploadCar({ apiUrl, file, token, bucketName });
8023
8057
  const text2 = await res.text();
8024
8058
  if (!res.ok)
@@ -8032,7 +8066,7 @@ var baseURL3 = "https://rpc.filebase.io/api/v0";
8032
8066
  var uploadOnFilebase = async ({
8033
8067
  first,
8034
8068
  car,
8035
- name: name12,
8069
+ name: name2,
8036
8070
  token,
8037
8071
  bucketName,
8038
8072
  verbose,
@@ -8046,7 +8080,7 @@ var uploadOnFilebase = async ({
8046
8080
  apiUrl: "s3.filebase.com",
8047
8081
  providerName: providerName3,
8048
8082
  verbose,
8049
- name: name12,
8083
+ name: name2,
8050
8084
  car,
8051
8085
  token
8052
8086
  });
@@ -8060,7 +8094,7 @@ var uploadOnFilebase = async ({
8060
8094
  },
8061
8095
  body: JSON.stringify({
8062
8096
  cid,
8063
- name: name12
8097
+ name: name2
8064
8098
  })
8065
8099
  });
8066
8100
  if (verbose)
@@ -8330,10 +8364,10 @@ function getObjectType(value) {
8330
8364
  return;
8331
8365
  }
8332
8366
  class Type {
8333
- constructor(major, name22, terminal) {
8367
+ constructor(major, name2, terminal) {
8334
8368
  this.major = major;
8335
8369
  this.majorEncoded = major << 5;
8336
- this.name = name22;
8370
+ this.name = name2;
8337
8371
  this.terminal = terminal;
8338
8372
  }
8339
8373
  toString() {
@@ -9504,8 +9538,8 @@ class Tokeniser {
9504
9538
  return token;
9505
9539
  }
9506
9540
  }
9507
- var DONE = Symbol.for("DONE");
9508
- var BREAK = Symbol.for("BREAK");
9541
+ var DONE = /* @__PURE__ */ Symbol.for("DONE");
9542
+ var BREAK = /* @__PURE__ */ Symbol.for("BREAK");
9509
9543
  function tokenToArray(token, tokeniser, options) {
9510
9544
  const arr = [];
9511
9545
  for (let i = 0; i < token.value; i++) {
@@ -9618,7 +9652,7 @@ __export(exports_base32, {
9618
9652
  base32hex: () => base32hex,
9619
9653
  base32: () => base32
9620
9654
  });
9621
- function base(ALPHABET, name22) {
9655
+ function base(ALPHABET, name2) {
9622
9656
  if (ALPHABET.length >= 255) {
9623
9657
  throw new TypeError("Alphabet too long");
9624
9658
  }
@@ -9736,17 +9770,17 @@ function base(ALPHABET, name22) {
9736
9770
  }
9737
9771
  return vch;
9738
9772
  }
9739
- function decode22(string3) {
9773
+ function decode25(string3) {
9740
9774
  var buffer2 = decodeUnsafe(string3);
9741
9775
  if (buffer2) {
9742
9776
  return buffer2;
9743
9777
  }
9744
- throw new Error(`Non-${name22} character`);
9778
+ throw new Error(`Non-${name2} character`);
9745
9779
  }
9746
9780
  return {
9747
9781
  encode: encode210,
9748
9782
  decodeUnsafe,
9749
- decode: decode22
9783
+ decode: decode25
9750
9784
  };
9751
9785
  }
9752
9786
  var src = base;
@@ -9756,8 +9790,8 @@ class Encoder {
9756
9790
  name;
9757
9791
  prefix;
9758
9792
  baseEncode;
9759
- constructor(name22, prefix2, baseEncode) {
9760
- this.name = name22;
9793
+ constructor(name2, prefix2, baseEncode) {
9794
+ this.name = name2;
9761
9795
  this.prefix = prefix2;
9762
9796
  this.baseEncode = baseEncode;
9763
9797
  }
@@ -9774,8 +9808,8 @@ class Decoder {
9774
9808
  prefix;
9775
9809
  baseDecode;
9776
9810
  prefixCodePoint;
9777
- constructor(name22, prefix2, baseDecode) {
9778
- this.name = name22;
9811
+ constructor(name2, prefix2, baseDecode) {
9812
+ this.name = name2;
9779
9813
  this.prefix = prefix2;
9780
9814
  const prefixCodePoint = prefix2.codePointAt(0);
9781
9815
  if (prefixCodePoint === void 0) {
@@ -9829,13 +9863,13 @@ class Codec {
9829
9863
  baseDecode;
9830
9864
  encoder;
9831
9865
  decoder;
9832
- constructor(name22, prefix2, baseEncode, baseDecode) {
9833
- this.name = name22;
9866
+ constructor(name2, prefix2, baseEncode, baseDecode) {
9867
+ this.name = name2;
9834
9868
  this.prefix = prefix2;
9835
9869
  this.baseEncode = baseEncode;
9836
9870
  this.baseDecode = baseDecode;
9837
- this.encoder = new Encoder(name22, prefix2, baseEncode);
9838
- this.decoder = new Decoder(name22, prefix2, baseDecode);
9871
+ this.encoder = new Encoder(name2, prefix2, baseEncode);
9872
+ this.decoder = new Decoder(name2, prefix2, baseDecode);
9839
9873
  }
9840
9874
  encode(input2) {
9841
9875
  return this.encoder.encode(input2);
@@ -9844,19 +9878,19 @@ class Codec {
9844
9878
  return this.decoder.decode(input2);
9845
9879
  }
9846
9880
  }
9847
- function from8({ name: name22, prefix: prefix2, encode: encode210, decode: decode22 }) {
9848
- return new Codec(name22, prefix2, encode210, decode22);
9881
+ function from8({ name: name2, prefix: prefix2, encode: encode210, decode: decode25 }) {
9882
+ return new Codec(name2, prefix2, encode210, decode25);
9849
9883
  }
9850
- function baseX({ name: name22, prefix: prefix2, alphabet: alphabet2 }) {
9851
- const { encode: encode210, decode: decode22 } = base_x_default(alphabet2, name22);
9884
+ function baseX({ name: name2, prefix: prefix2, alphabet: alphabet2 }) {
9885
+ const { encode: encode210, decode: decode25 } = base_x_default(alphabet2, name2);
9852
9886
  return from8({
9853
9887
  prefix: prefix2,
9854
- name: name22,
9888
+ name: name2,
9855
9889
  encode: encode210,
9856
- decode: (text2) => coerce(decode22(text2))
9890
+ decode: (text2) => coerce(decode25(text2))
9857
9891
  });
9858
9892
  }
9859
- function decode2(string3, alphabetIdx, bitsPerChar, name22) {
9893
+ function decode2(string3, alphabetIdx, bitsPerChar, name2) {
9860
9894
  let end = string3.length;
9861
9895
  while (string3[end - 1] === "=") {
9862
9896
  --end;
@@ -9868,7 +9902,7 @@ function decode2(string3, alphabetIdx, bitsPerChar, name22) {
9868
9902
  for (let i = 0; i < end; ++i) {
9869
9903
  const value = alphabetIdx[string3[i]];
9870
9904
  if (value === void 0) {
9871
- throw new SyntaxError(`Non-${name22} character`);
9905
+ throw new SyntaxError(`Non-${name2} character`);
9872
9906
  }
9873
9907
  buffer2 = buffer2 << bitsPerChar | value;
9874
9908
  bits += bitsPerChar;
@@ -9913,16 +9947,16 @@ function createAlphabetIdx(alphabet2) {
9913
9947
  }
9914
9948
  return alphabetIdx;
9915
9949
  }
9916
- function rfc4648({ name: name22, prefix: prefix2, bitsPerChar, alphabet: alphabet2 }) {
9950
+ function rfc4648({ name: name2, prefix: prefix2, bitsPerChar, alphabet: alphabet2 }) {
9917
9951
  const alphabetIdx = createAlphabetIdx(alphabet2);
9918
9952
  return from8({
9919
9953
  prefix: prefix2,
9920
- name: name22,
9954
+ name: name2,
9921
9955
  encode(input2) {
9922
9956
  return encode2(input2, alphabet2, bitsPerChar);
9923
9957
  },
9924
9958
  decode(input2) {
9925
- return decode2(input2, alphabetIdx, bitsPerChar, name22);
9959
+ return decode2(input2, alphabetIdx, bitsPerChar, name2);
9926
9960
  }
9927
9961
  });
9928
9962
  }
@@ -10074,8 +10108,8 @@ var varint = {
10074
10108
  var _brrp_varint = varint;
10075
10109
  var varint_default = _brrp_varint;
10076
10110
  function decode4(data, offset = 0) {
10077
- const code32 = varint_default.decode(data, offset);
10078
- return [code32, varint_default.decode.bytes];
10111
+ const code3 = varint_default.decode(data, offset);
10112
+ return [code3, varint_default.decode.bytes];
10079
10113
  }
10080
10114
  function encodeTo(int, target, offset = 0) {
10081
10115
  varint_default.encode(int, target, offset);
@@ -10084,25 +10118,25 @@ function encodeTo(int, target, offset = 0) {
10084
10118
  function encodingLength(int) {
10085
10119
  return varint_default.encodingLength(int);
10086
10120
  }
10087
- function create(code32, digest22) {
10121
+ function create(code3, digest22) {
10088
10122
  const size42 = digest22.byteLength;
10089
- const sizeOffset = encodingLength(code32);
10123
+ const sizeOffset = encodingLength(code3);
10090
10124
  const digestOffset = sizeOffset + encodingLength(size42);
10091
10125
  const bytes2 = new Uint8Array(digestOffset + size42);
10092
- encodeTo(code32, bytes2, 0);
10126
+ encodeTo(code3, bytes2, 0);
10093
10127
  encodeTo(size42, bytes2, sizeOffset);
10094
10128
  bytes2.set(digest22, digestOffset);
10095
- return new Digest2(code32, size42, digest22, bytes2);
10129
+ return new Digest2(code3, size42, digest22, bytes2);
10096
10130
  }
10097
10131
  function decode5(multihash) {
10098
10132
  const bytes2 = coerce(multihash);
10099
- const [code32, sizeOffset] = decode4(bytes2);
10133
+ const [code3, sizeOffset] = decode4(bytes2);
10100
10134
  const [size42, digestOffset] = decode4(bytes2.subarray(sizeOffset));
10101
10135
  const digest22 = bytes2.subarray(sizeOffset + digestOffset);
10102
10136
  if (digest22.byteLength !== size42) {
10103
10137
  throw new Error("Incorrect length");
10104
10138
  }
10105
- return new Digest2(code32, size42, digest22, bytes2);
10139
+ return new Digest2(code3, size42, digest22, bytes2);
10106
10140
  }
10107
10141
  function equals2(a, b) {
10108
10142
  if (a === b) {
@@ -10117,8 +10151,8 @@ class Digest2 {
10117
10151
  size;
10118
10152
  digest;
10119
10153
  bytes;
10120
- constructor(code32, size42, digest22, bytes2) {
10121
- this.code = code32;
10154
+ constructor(code3, size42, digest22, bytes2) {
10155
+ this.code = code3;
10122
10156
  this.size = size42;
10123
10157
  this.digest = digest22;
10124
10158
  this.bytes = bytes2;
@@ -10149,8 +10183,8 @@ class CID {
10149
10183
  multihash;
10150
10184
  bytes;
10151
10185
  "/";
10152
- constructor(version22, code32, multihash, bytes2) {
10153
- this.code = code32;
10186
+ constructor(version22, code3, multihash, bytes2) {
10187
+ this.code = code3;
10154
10188
  this.version = version22;
10155
10189
  this.multihash = multihash;
10156
10190
  this.bytes = bytes2;
@@ -10171,8 +10205,8 @@ class CID {
10171
10205
  return this;
10172
10206
  }
10173
10207
  case 1: {
10174
- const { code: code32, multihash } = this;
10175
- if (code32 !== DAG_PB_CODE) {
10208
+ const { code: code3, multihash } = this;
10209
+ if (code3 !== DAG_PB_CODE) {
10176
10210
  throw new Error("Cannot convert a non dag-pb CID to CIDv0");
10177
10211
  }
10178
10212
  if (multihash.code !== SHA_256_CODE) {
@@ -10188,8 +10222,8 @@ class CID {
10188
10222
  toV1() {
10189
10223
  switch (this.version) {
10190
10224
  case 0: {
10191
- const { code: code32, digest: digest22 } = this.multihash;
10192
- const multihash = create(code32, digest22);
10225
+ const { code: code3, digest: digest22 } = this.multihash;
10226
+ const multihash = create(code3, digest22);
10193
10227
  return CID.createV1(this.code, multihash);
10194
10228
  }
10195
10229
  case 1: {
@@ -10217,7 +10251,7 @@ class CID {
10217
10251
  return this;
10218
10252
  }
10219
10253
  [Symbol.toStringTag] = "CID";
10220
- [Symbol.for("nodejs.util.inspect.custom")]() {
10254
+ [/* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom")]() {
10221
10255
  return `CID(${this.toString()})`;
10222
10256
  }
10223
10257
  static asCID(input2) {
@@ -10228,18 +10262,18 @@ class CID {
10228
10262
  if (value instanceof CID) {
10229
10263
  return value;
10230
10264
  } else if (value["/"] != null && value["/"] === value.bytes || value.asCID === value) {
10231
- const { version: version22, code: code32, multihash, bytes: bytes2 } = value;
10232
- return new CID(version22, code32, multihash, bytes2 ?? encodeCID(version22, code32, multihash.bytes));
10265
+ const { version: version22, code: code3, multihash, bytes: bytes2 } = value;
10266
+ return new CID(version22, code3, multihash, bytes2 ?? encodeCID(version22, code3, multihash.bytes));
10233
10267
  } else if (value[cidSymbol] === true) {
10234
- const { version: version22, multihash, code: code32 } = value;
10268
+ const { version: version22, multihash, code: code3 } = value;
10235
10269
  const digest22 = decode5(multihash);
10236
- return CID.create(version22, code32, digest22);
10270
+ return CID.create(version22, code3, digest22);
10237
10271
  } else {
10238
10272
  return null;
10239
10273
  }
10240
10274
  }
10241
- static create(version22, code32, digest22) {
10242
- if (typeof code32 !== "number") {
10275
+ static create(version22, code3, digest22) {
10276
+ if (typeof code3 !== "number") {
10243
10277
  throw new Error("String codecs are no longer supported");
10244
10278
  }
10245
10279
  if (!(digest22.bytes instanceof Uint8Array)) {
@@ -10247,15 +10281,15 @@ class CID {
10247
10281
  }
10248
10282
  switch (version22) {
10249
10283
  case 0: {
10250
- if (code32 !== DAG_PB_CODE) {
10284
+ if (code3 !== DAG_PB_CODE) {
10251
10285
  throw new Error(`Version 0 CID must use dag-pb (code: ${DAG_PB_CODE}) block encoding`);
10252
10286
  } else {
10253
- return new CID(version22, code32, digest22, digest22.bytes);
10287
+ return new CID(version22, code3, digest22, digest22.bytes);
10254
10288
  }
10255
10289
  }
10256
10290
  case 1: {
10257
- const bytes2 = encodeCID(version22, code32, digest22.bytes);
10258
- return new CID(version22, code32, digest22, bytes2);
10291
+ const bytes2 = encodeCID(version22, code3, digest22.bytes);
10292
+ return new CID(version22, code3, digest22, bytes2);
10259
10293
  }
10260
10294
  default: {
10261
10295
  throw new Error("Invalid version");
@@ -10265,8 +10299,8 @@ class CID {
10265
10299
  static createV0(digest22) {
10266
10300
  return CID.create(0, DAG_PB_CODE, digest22);
10267
10301
  }
10268
- static createV1(code32, digest22) {
10269
- return CID.create(1, code32, digest22);
10302
+ static createV1(code3, digest22) {
10303
+ return CID.create(1, code3, digest22);
10270
10304
  }
10271
10305
  static decode(bytes2) {
10272
10306
  const [cid, remainder] = CID.decodeFirst(bytes2);
@@ -10378,23 +10412,17 @@ function toStringV1(bytes2, cache22, base22) {
10378
10412
  }
10379
10413
  var DAG_PB_CODE = 112;
10380
10414
  var SHA_256_CODE = 18;
10381
- function encodeCID(version22, code32, multihash) {
10415
+ function encodeCID(version22, code3, multihash) {
10382
10416
  const codeOffset = encodingLength(version22);
10383
- const hashOffset = codeOffset + encodingLength(code32);
10417
+ const hashOffset = codeOffset + encodingLength(code3);
10384
10418
  const bytes2 = new Uint8Array(hashOffset + multihash.byteLength);
10385
10419
  encodeTo(version22, bytes2, 0);
10386
- encodeTo(code32, bytes2, codeOffset);
10420
+ encodeTo(code3, bytes2, codeOffset);
10387
10421
  bytes2.set(multihash, hashOffset);
10388
10422
  return bytes2;
10389
10423
  }
10390
- var cidSymbol = Symbol.for("@ipld/js-cid/CID");
10424
+ var cidSymbol = /* @__PURE__ */ Symbol.for("@ipld/js-cid/CID");
10391
10425
  var CID_CBOR_TAG = 42;
10392
- function toByteView(buf2) {
10393
- if (buf2 instanceof ArrayBuffer) {
10394
- return new Uint8Array(buf2, 0, buf2.byteLength);
10395
- }
10396
- return buf2;
10397
- }
10398
10426
  function cidEncoder(obj) {
10399
10427
  if (obj.asCID !== obj && obj["/"] !== obj.bytes) {
10400
10428
  return null;
@@ -10458,10 +10486,6 @@ var decodeOptions = {
10458
10486
  ..._decodeOptions,
10459
10487
  tags: _decodeOptions.tags.slice()
10460
10488
  };
10461
- var name2 = "dag-cbor";
10462
- var code3 = 113;
10463
- var encode4 = (node) => encode(node, _encodeOptions);
10464
- var decode6 = (data) => decode(toByteView(data), _decodeOptions);
10465
10489
  var DAG_PB_CODE2 = 112;
10466
10490
  function createLegacy(digest22) {
10467
10491
  return CID.create(0, DAG_PB_CODE2, digest22);
@@ -11864,7 +11888,7 @@ var chains = {
11864
11888
  [filecoinMainnet.id]: filecoinMainnet,
11865
11889
  [filecoinCalibration.id]: filecoinCalibration
11866
11890
  };
11867
- var version2 = "1.1.1";
11891
+ var version2 = "1.2.3";
11868
11892
  class BaseError3 extends Error {
11869
11893
  constructor(shortMessage, args = {}) {
11870
11894
  const details = args.cause instanceof BaseError3 ? args.cause.details : args.cause?.message ? args.cause.message : args.details;
@@ -11937,7 +11961,7 @@ function formatAbiParameter(abiParameter) {
11937
11961
  type2 += ", ";
11938
11962
  }
11939
11963
  const result = execTyped(tupleRegex, abiParameter.type);
11940
- type2 += `)${result?.array ?? ""}`;
11964
+ type2 += `)${result?.array || ""}`;
11941
11965
  return formatAbiParameter({
11942
11966
  ...abiParameter,
11943
11967
  type: type2
@@ -12246,7 +12270,7 @@ function getParameterCacheKey(param, type2, structs) {
12246
12270
  }
12247
12271
  if (type2)
12248
12272
  return `${type2}:${param}${structKey}`;
12249
- return param;
12273
+ return `${param}${structKey}`;
12250
12274
  }
12251
12275
  var parameterCache = /* @__PURE__ */ new Map([
12252
12276
  ["address", { type: "address" }],
@@ -12533,7 +12557,7 @@ function parseStructs(signatures) {
12533
12557
  return resolvedStructs;
12534
12558
  }
12535
12559
  var typeWithoutTupleRegex = /^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*)(?<array>(?:\[\d*?\])+?)?$/;
12536
- function resolveStructs(abiParameters, structs, ancestors = /* @__PURE__ */ new Set()) {
12560
+ function resolveStructs(abiParameters = [], structs = {}, ancestors = /* @__PURE__ */ new Set()) {
12537
12561
  const components = [];
12538
12562
  const length22 = abiParameters.length;
12539
12563
  for (let i = 0; i < length22; i++) {
@@ -12552,7 +12576,7 @@ function resolveStructs(abiParameters, structs, ancestors = /* @__PURE__ */ new
12552
12576
  components.push({
12553
12577
  ...abiParameter,
12554
12578
  type: `tuple${array2 ?? ""}`,
12555
- components: resolveStructs(structs[type2] ?? [], structs, /* @__PURE__ */ new Set([...ancestors, type2]))
12579
+ components: resolveStructs(structs[type2], structs, /* @__PURE__ */ new Set([...ancestors, type2]))
12556
12580
  });
12557
12581
  } else {
12558
12582
  if (isSolidityType(type2))
@@ -13673,7 +13697,7 @@ function decode9(...parameters) {
13673
13697
  })();
13674
13698
  if (size2(data) < 4)
13675
13699
  throw new InvalidSelectorSizeError({ data });
13676
- if (abiError.inputs.length === 0)
13700
+ if (abiError.inputs?.length === 0)
13677
13701
  return;
13678
13702
  const values2 = decode8(abiError.inputs, slice(data, 4), options);
13679
13703
  if (values2 && Object.keys(values2).length === 1) {
@@ -13965,6 +13989,42 @@ function validateReference(type2) {
13965
13989
  if (type2 === "address" || type2 === "bool" || type2 === "string" || type2.startsWith("bytes") || type2.startsWith("uint") || type2.startsWith("int"))
13966
13990
  throw new InvalidStructTypeError({ type: type2 });
13967
13991
  }
13992
+ function fromRpc2(log2, _options = {}) {
13993
+ return {
13994
+ ...log2,
13995
+ blockNumber: log2.blockNumber ? BigInt(log2.blockNumber) : null,
13996
+ logIndex: log2.logIndex ? Number(log2.logIndex) : null,
13997
+ transactionIndex: log2.transactionIndex ? Number(log2.transactionIndex) : null
13998
+ };
13999
+ }
14000
+ var fromRpcStatus = {
14001
+ "0x0": "reverted",
14002
+ "0x1": "success"
14003
+ };
14004
+ var fromRpcType = {
14005
+ "0x0": "legacy",
14006
+ "0x1": "eip2930",
14007
+ "0x2": "eip1559",
14008
+ "0x3": "eip4844",
14009
+ "0x4": "eip7702"
14010
+ };
14011
+ function fromRpc3(receipt) {
14012
+ if (!receipt)
14013
+ return null;
14014
+ return {
14015
+ ...receipt,
14016
+ blobGasPrice: receipt.blobGasPrice ? BigInt(receipt.blobGasPrice) : void 0,
14017
+ blobGasUsed: receipt.blobGasUsed ? BigInt(receipt.blobGasUsed) : void 0,
14018
+ blockNumber: BigInt(receipt.blockNumber ?? 0n),
14019
+ cumulativeGasUsed: BigInt(receipt.cumulativeGasUsed ?? 0n),
14020
+ effectiveGasPrice: BigInt(receipt.effectiveGasPrice ?? 0n),
14021
+ gasUsed: BigInt(receipt.gasUsed ?? 0n),
14022
+ logs: receipt.logs.map((log2) => fromRpc2(log2, { pending: false })),
14023
+ status: fromRpcStatus[receipt.status],
14024
+ transactionIndex: Number(receipt.transactionIndex ?? 0),
14025
+ type: fromRpcType[receipt.type] || receipt.type
14026
+ };
14027
+ }
13968
14028
  function fromTupleList(accessList) {
13969
14029
  const list3 = [];
13970
14030
  for (let i = 0; i < accessList.length; i++) {
@@ -14318,42 +14378,6 @@ function serialize(envelope, options = {}) {
14318
14378
  ];
14319
14379
  return concat(serializedType, fromHex5(serialized));
14320
14380
  }
14321
- function fromRpc2(log2, _options = {}) {
14322
- return {
14323
- ...log2,
14324
- blockNumber: log2.blockNumber ? BigInt(log2.blockNumber) : null,
14325
- logIndex: log2.logIndex ? Number(log2.logIndex) : null,
14326
- transactionIndex: log2.transactionIndex ? Number(log2.transactionIndex) : null
14327
- };
14328
- }
14329
- var fromRpcStatus = {
14330
- "0x0": "reverted",
14331
- "0x1": "success"
14332
- };
14333
- var fromRpcType = {
14334
- "0x0": "legacy",
14335
- "0x1": "eip2930",
14336
- "0x2": "eip1559",
14337
- "0x3": "eip4844",
14338
- "0x4": "eip7702"
14339
- };
14340
- function fromRpc3(receipt) {
14341
- if (!receipt)
14342
- return null;
14343
- return {
14344
- ...receipt,
14345
- blobGasPrice: receipt.blobGasPrice ? BigInt(receipt.blobGasPrice) : void 0,
14346
- blobGasUsed: receipt.blobGasUsed ? BigInt(receipt.blobGasUsed) : void 0,
14347
- blockNumber: BigInt(receipt.blockNumber ?? 0n),
14348
- cumulativeGasUsed: BigInt(receipt.cumulativeGasUsed ?? 0n),
14349
- effectiveGasPrice: BigInt(receipt.effectiveGasPrice ?? 0n),
14350
- gasUsed: BigInt(receipt.gasUsed ?? 0n),
14351
- logs: receipt.logs.map((log2) => fromRpc2(log2, { pending: false })),
14352
- status: fromRpcStatus[receipt.status],
14353
- transactionIndex: Number(receipt.transactionIndex ?? 0),
14354
- type: fromRpcType[receipt.type] || receipt.type
14355
- };
14356
- }
14357
14381
  var simulateTransaction = async ({
14358
14382
  provider,
14359
14383
  to: to2,
@@ -14408,7 +14432,6 @@ var sendTransaction = async ({
14408
14432
  const maxPriorityFeePerGas = priorityFeePerGas;
14409
14433
  const maxFeePerGas = baseFeePerGas * 2n + maxPriorityFeePerGas;
14410
14434
  const envelope = from16({
14411
- from: from172,
14412
14435
  chainId,
14413
14436
  maxFeePerGas,
14414
14437
  maxPriorityFeePerGas,
@@ -17154,13 +17177,86 @@ __export(exports_delegation, {
17154
17177
  Delegation: () => Delegation,
17155
17178
  ArchiveSchema: () => ArchiveSchema
17156
17179
  });
17180
+ var CID_CBOR_TAG2 = 42;
17181
+ function toByteView(buf2) {
17182
+ if (buf2 instanceof ArrayBuffer) {
17183
+ return new Uint8Array(buf2, 0, buf2.byteLength);
17184
+ }
17185
+ return buf2;
17186
+ }
17187
+ function cidEncoder2(obj) {
17188
+ if (obj.asCID !== obj && obj["/"] !== obj.bytes) {
17189
+ return null;
17190
+ }
17191
+ const cid = CID.asCID(obj);
17192
+ if (!cid) {
17193
+ return null;
17194
+ }
17195
+ const bytes2 = new Uint8Array(cid.bytes.byteLength + 1);
17196
+ bytes2.set(cid.bytes, 1);
17197
+ return [
17198
+ new Token(Type.tag, CID_CBOR_TAG2),
17199
+ new Token(Type.bytes, bytes2)
17200
+ ];
17201
+ }
17202
+ function undefinedEncoder2() {
17203
+ throw new Error("`undefined` is not supported by the IPLD Data Model and cannot be encoded");
17204
+ }
17205
+ function numberEncoder2(num) {
17206
+ if (Number.isNaN(num)) {
17207
+ throw new Error("`NaN` is not supported by the IPLD Data Model and cannot be encoded");
17208
+ }
17209
+ if (num === Infinity || num === -Infinity) {
17210
+ throw new Error("`Infinity` and `-Infinity` is not supported by the IPLD Data Model and cannot be encoded");
17211
+ }
17212
+ return null;
17213
+ }
17214
+ var _encodeOptions2 = {
17215
+ float64: true,
17216
+ typeEncoders: {
17217
+ Object: cidEncoder2,
17218
+ undefined: undefinedEncoder2,
17219
+ number: numberEncoder2
17220
+ }
17221
+ };
17222
+ var encodeOptions2 = {
17223
+ ..._encodeOptions2,
17224
+ typeEncoders: {
17225
+ ..._encodeOptions2.typeEncoders
17226
+ }
17227
+ };
17228
+ function cidDecoder2(bytes2) {
17229
+ if (bytes2[0] !== 0) {
17230
+ throw new Error("Invalid CID for CBOR tag 42; expected leading 0x00");
17231
+ }
17232
+ return CID.decode(bytes2.subarray(1));
17233
+ }
17234
+ var _decodeOptions2 = {
17235
+ allowIndefinite: false,
17236
+ coerceUndefinedToNull: true,
17237
+ allowNaN: false,
17238
+ allowInfinity: false,
17239
+ allowBigInt: true,
17240
+ strict: true,
17241
+ useMaps: false,
17242
+ rejectDuplicateMapKeys: true,
17243
+ tags: []
17244
+ };
17245
+ _decodeOptions2.tags[CID_CBOR_TAG2] = cidDecoder2;
17246
+ var decodeOptions2 = {
17247
+ ..._decodeOptions2,
17248
+ tags: _decodeOptions2.tags.slice()
17249
+ };
17250
+ var code9 = 113;
17251
+ var encode14 = (node) => encode(node, _encodeOptions2);
17252
+ var decode15 = (data) => decode(toByteView(data), _decodeOptions2);
17157
17253
  var exports_identity = {};
17158
17254
  __export(exports_identity, {
17159
17255
  identity: () => identity
17160
17256
  });
17161
- var code9 = 0;
17257
+ var code10 = 0;
17162
17258
  var name8 = "identity";
17163
- var encode14 = coerce;
17259
+ var encode15 = coerce;
17164
17260
  function digest3(input2, options) {
17165
17261
  if (options?.truncate != null && options.truncate !== input2.byteLength) {
17166
17262
  if (options.truncate < 0 || options.truncate > input2.byteLength) {
@@ -17168,9 +17264,9 @@ function digest3(input2, options) {
17168
17264
  }
17169
17265
  input2 = input2.subarray(0, options.truncate);
17170
17266
  }
17171
- return create(code9, encode14(input2));
17267
+ return create(code10, encode15(input2));
17172
17268
  }
17173
- var identity = { code: code9, name: name8, encode: encode14, digest: digest3 };
17269
+ var identity = { code: code10, name: name8, encode: encode15, digest: digest3 };
17174
17270
  var readPayload = (data) => readPayloadWith(data, {
17175
17271
  readPrincipal,
17176
17272
  readProof
@@ -17365,7 +17461,7 @@ function mapSorter2(e1, e2) {
17365
17461
  throw new Error(`${encodeErrPrefix} unexpected duplicate map keys, this is not supported`);
17366
17462
  }
17367
17463
  var defaultEncodeOptions2 = { addBreakTokens: true, mapSorter: mapSorter2 };
17368
- function encode15(data, options) {
17464
+ function encode16(data, options) {
17369
17465
  options = Object.assign({}, defaultEncodeOptions2, options);
17370
17466
  return encodeCustom(data, new JSONEncoder(), options);
17371
17467
  }
@@ -17721,7 +17817,7 @@ class Tokenizer {
17721
17817
  }
17722
17818
  }
17723
17819
  }
17724
- function decode15(data, options) {
17820
+ function decode16(data, options) {
17725
17821
  options = Object.assign({ tokenizer: new Tokenizer(data, options) }, options);
17726
17822
  return decode(data, options);
17727
17823
  }
@@ -17731,7 +17827,7 @@ function toByteView2(buf2) {
17731
17827
  }
17732
17828
  return buf2;
17733
17829
  }
17734
- function cidEncoder2(obj) {
17830
+ function cidEncoder3(obj) {
17735
17831
  if (obj.asCID !== obj && obj["/"] !== obj.bytes) {
17736
17832
  return null;
17737
17833
  }
@@ -17765,10 +17861,10 @@ function taBytesEncoder(obj) {
17765
17861
  function abBytesEncoder(ab) {
17766
17862
  return bytesEncoder(new Uint8Array(ab));
17767
17863
  }
17768
- function undefinedEncoder2() {
17864
+ function undefinedEncoder3() {
17769
17865
  throw new Error("`undefined` is not supported by the IPLD Data Model and cannot be encoded");
17770
17866
  }
17771
- function numberEncoder2(num) {
17867
+ function numberEncoder3(num) {
17772
17868
  if (Number.isNaN(num)) {
17773
17869
  throw new Error("`NaN` is not supported by the IPLD Data Model and cannot be encoded");
17774
17870
  }
@@ -17777,9 +17873,9 @@ function numberEncoder2(num) {
17777
17873
  }
17778
17874
  return null;
17779
17875
  }
17780
- var encodeOptions2 = {
17876
+ var encodeOptions3 = {
17781
17877
  typeEncoders: {
17782
- Object: cidEncoder2,
17878
+ Object: cidEncoder3,
17783
17879
  Buffer: bytesEncoder,
17784
17880
  Uint8Array: bytesEncoder,
17785
17881
  Int8Array: taBytesEncoder,
@@ -17794,8 +17890,8 @@ var encodeOptions2 = {
17794
17890
  BigUint64Array: taBytesEncoder,
17795
17891
  DataView: taBytesEncoder,
17796
17892
  ArrayBuffer: abBytesEncoder,
17797
- undefined: undefinedEncoder2,
17798
- number: numberEncoder2
17893
+ undefined: undefinedEncoder3,
17894
+ number: numberEncoder3
17799
17895
  }
17800
17896
  };
17801
17897
  class DagJsonTokenizer extends Tokenizer {
@@ -17851,7 +17947,7 @@ class DagJsonTokenizer extends Tokenizer {
17851
17947
  return token;
17852
17948
  }
17853
17949
  }
17854
- var decodeOptions2 = {
17950
+ var decodeOptions3 = {
17855
17951
  allowIndefinite: false,
17856
17952
  allowUndefined: false,
17857
17953
  allowNaN: false,
@@ -17862,12 +17958,12 @@ var decodeOptions2 = {
17862
17958
  rejectDuplicateMapKeys: true,
17863
17959
  tags: []
17864
17960
  };
17865
- decodeOptions2.tags[42] = CID.parse;
17866
- var encode16 = (node) => encode15(node, encodeOptions2);
17867
- var decode16 = (data) => {
17961
+ decodeOptions3.tags[42] = CID.parse;
17962
+ var encode17 = (node) => encode16(node, encodeOptions3);
17963
+ var decode17 = (data) => {
17868
17964
  const buf2 = toByteView2(data);
17869
- const options = Object.assign(decodeOptions2, { tokenizer: new DagJsonTokenizer(buf2, decodeOptions2) });
17870
- return decode15(buf2, options);
17965
+ const options = Object.assign(decodeOptions3, { tokenizer: new DagJsonTokenizer(buf2, decodeOptions3) });
17966
+ return decode16(buf2, options);
17871
17967
  };
17872
17968
  var utf8Decoder = new TextDecoder();
17873
17969
  var utf8Encoder = new TextEncoder();
@@ -17881,12 +17977,12 @@ var formatSignPayload = (payload, version32, alg) => `${formatHeader(version32,
17881
17977
  var formatHeader = (version32, alg) => base64url.baseEncode(encodeHeader(version32, alg));
17882
17978
  var formatPayload = (data) => base64url.baseEncode(encodePayload(data));
17883
17979
  var formatSignature = (signature) => base64url.baseEncode(signature.raw);
17884
- var encodeHeader = (v, alg) => encode16({
17980
+ var encodeHeader = (v, alg) => encode17({
17885
17981
  alg,
17886
17982
  ucv: v,
17887
17983
  typ: "JWT"
17888
17984
  });
17889
- var encodePayload = (data) => encode16({
17985
+ var encodePayload = (data) => encode17({
17890
17986
  iss: format3(data.iss),
17891
17987
  aud: format3(data.aud),
17892
17988
  att: data.att,
@@ -17897,7 +17993,7 @@ var encodePayload = (data) => encode16({
17897
17993
  ...data.nbf && { nbf: data.nbf }
17898
17994
  });
17899
17995
  var encodeProof = (proof) => proof.toString();
17900
- var toJSON3 = (data) => JSON.parse(decode10(encode16(data)));
17996
+ var toJSON3 = (data) => JSON.parse(decode10(encode17(data)));
17901
17997
  class View {
17902
17998
  constructor(model) {
17903
17999
  this.model = model;
@@ -17984,11 +18080,11 @@ class View {
17984
18080
  };
17985
18081
  }
17986
18082
  }
17987
- var code10 = code3;
18083
+ var code11 = code9;
17988
18084
  var from19 = (model) => new CBORView(model);
17989
- var encode17 = (model) => {
18085
+ var encode18 = (model) => {
17990
18086
  const { fct, nnc, nbf, ...payload } = readPayload(model);
17991
- return encode4({
18087
+ return encode14({
17992
18088
  ...fct.length > 0 && { fct },
17993
18089
  ...nnc != null && { nnc },
17994
18090
  ...nbf && { nbf },
@@ -18004,8 +18100,8 @@ var encodeSignature = (signature, context) => {
18004
18100
  throw new Error(`Expected signature ${context}, instead got ${JSON.stringify(signature)}`, { cause });
18005
18101
  }
18006
18102
  };
18007
- var decode17 = (bytes2) => {
18008
- const model = decode6(bytes2);
18103
+ var decode18 = (bytes2) => {
18104
+ const model = decode15(bytes2);
18009
18105
  return new CBORView({
18010
18106
  ...readPayload(model),
18011
18107
  v: readVersion(model.v, "v"),
@@ -18014,13 +18110,13 @@ var decode17 = (bytes2) => {
18014
18110
  };
18015
18111
  class CBORView extends View {
18016
18112
  get code() {
18017
- return code10;
18113
+ return code11;
18018
18114
  }
18019
18115
  format() {
18020
18116
  return format7(this.model);
18021
18117
  }
18022
18118
  encode() {
18023
- return encode17(this.model);
18119
+ return encode18(this.model);
18024
18120
  }
18025
18121
  }
18026
18122
  var parse7 = (jwt) => {
@@ -18034,7 +18130,7 @@ var parse7 = (jwt) => {
18034
18130
  };
18035
18131
  };
18036
18132
  var parseHeader = (header) => {
18037
- const { ucv, alg, typ } = decode16(base64url.baseDecode(header));
18133
+ const { ucv, alg, typ } = decode17(base64url.baseDecode(header));
18038
18134
  return {
18039
18135
  typ: readLiteral(typ, "JWT", "typ"),
18040
18136
  ucv: readVersion(ucv, "ucv"),
@@ -18042,14 +18138,14 @@ var parseHeader = (header) => {
18042
18138
  };
18043
18139
  };
18044
18140
  var parsePayload = (source) => {
18045
- const payload = decode16(base64url.baseDecode(source));
18141
+ const payload = decode17(base64url.baseDecode(source));
18046
18142
  return readJWTPayload(payload);
18047
18143
  };
18048
- var decode18 = (bytes2) => {
18144
+ var decode19 = (bytes2) => {
18049
18145
  const jwt = decode10(bytes2);
18050
18146
  return new JWTView({ ...parse7(jwt), jwt });
18051
18147
  };
18052
- var encode18 = ({ jwt }) => encode9(jwt);
18148
+ var encode19 = ({ jwt }) => encode9(jwt);
18053
18149
  var format8 = ({ jwt }) => jwt;
18054
18150
  class JWTView extends View {
18055
18151
  constructor(model) {
@@ -18063,7 +18159,7 @@ class JWTView extends View {
18063
18159
  return format8(this.model);
18064
18160
  }
18065
18161
  encode() {
18066
- return encode18(this.model);
18162
+ return encode19(this.model);
18067
18163
  }
18068
18164
  }
18069
18165
  var exports_sha2 = {};
@@ -18083,19 +18179,19 @@ var sha512 = from9({
18083
18179
  });
18084
18180
  var VERSION = "0.9.1";
18085
18181
  var defaultHasher = sha2563;
18086
- var decode19 = (bytes2) => {
18182
+ var decode20 = (bytes2) => {
18087
18183
  try {
18088
- return decode17(bytes2);
18089
- } catch (_) {
18090
18184
  return decode18(bytes2);
18185
+ } catch (_) {
18186
+ return decode19(bytes2);
18091
18187
  }
18092
18188
  };
18093
18189
  var write = async (ucan22, { hasher = defaultHasher } = {}) => {
18094
- const [code112, bytes2] = ucan22.jwt ? [code6, encode18(ucan22)] : [code10, encode17(ucan22)];
18190
+ const [code122, bytes2] = ucan22.jwt ? [code6, encode19(ucan22)] : [code11, encode18(ucan22)];
18095
18191
  const digest4 = await hasher.digest(bytes2);
18096
18192
  return {
18097
18193
  bytes: bytes2,
18098
- cid: create2(code112, digest4),
18194
+ cid: create2(code122, digest4),
18099
18195
  data: ucan22
18100
18196
  };
18101
18197
  };
@@ -18133,13 +18229,96 @@ var now = () => Math.floor(Date.now() / 1e3);
18133
18229
  var exports_cbor3 = {};
18134
18230
  __export(exports_cbor3, {
18135
18231
  write: () => write2,
18136
- name: () => name2,
18232
+ name: () => name9,
18137
18233
  link: () => link2,
18138
- encode: () => encode19,
18139
- decode: () => decode6,
18234
+ encode: () => encode21,
18235
+ decode: () => decode21,
18140
18236
  contentType: () => contentType,
18141
- code: () => code3
18237
+ code: () => code12
18142
18238
  });
18239
+ var CID_CBOR_TAG3 = 42;
18240
+ function toByteView3(buf2) {
18241
+ if (buf2 instanceof ArrayBuffer) {
18242
+ return new Uint8Array(buf2, 0, buf2.byteLength);
18243
+ }
18244
+ return buf2;
18245
+ }
18246
+ function cidEncoder4(obj) {
18247
+ if (obj.asCID !== obj && obj["/"] !== obj.bytes) {
18248
+ return null;
18249
+ }
18250
+ const cid = CID.asCID(obj);
18251
+ if (!cid) {
18252
+ return null;
18253
+ }
18254
+ const bytes2 = new Uint8Array(cid.bytes.byteLength + 1);
18255
+ bytes2.set(cid.bytes, 1);
18256
+ return [
18257
+ new Token(Type.tag, CID_CBOR_TAG3),
18258
+ new Token(Type.bytes, bytes2)
18259
+ ];
18260
+ }
18261
+ function undefinedEncoder4() {
18262
+ throw new Error("`undefined` is not supported by the IPLD Data Model and cannot be encoded");
18263
+ }
18264
+ function numberEncoder4(num) {
18265
+ if (Number.isNaN(num)) {
18266
+ throw new Error("`NaN` is not supported by the IPLD Data Model and cannot be encoded");
18267
+ }
18268
+ if (num === Infinity || num === -Infinity) {
18269
+ throw new Error("`Infinity` and `-Infinity` is not supported by the IPLD Data Model and cannot be encoded");
18270
+ }
18271
+ return null;
18272
+ }
18273
+ function mapEncoder(map) {
18274
+ for (const key of map.keys()) {
18275
+ if (typeof key !== "string" || key.length === 0) {
18276
+ throw new Error("Non-string Map keys are not supported by the IPLD Data Model and cannot be encoded");
18277
+ }
18278
+ }
18279
+ return null;
18280
+ }
18281
+ var _encodeOptions3 = {
18282
+ float64: true,
18283
+ typeEncoders: {
18284
+ Map: mapEncoder,
18285
+ Object: cidEncoder4,
18286
+ undefined: undefinedEncoder4,
18287
+ number: numberEncoder4
18288
+ }
18289
+ };
18290
+ var encodeOptions4 = {
18291
+ ..._encodeOptions3,
18292
+ typeEncoders: {
18293
+ ..._encodeOptions3.typeEncoders
18294
+ }
18295
+ };
18296
+ function cidDecoder3(bytes2) {
18297
+ if (bytes2[0] !== 0) {
18298
+ throw new Error("Invalid CID for CBOR tag 42; expected leading 0x00");
18299
+ }
18300
+ return CID.decode(bytes2.subarray(1));
18301
+ }
18302
+ var _decodeOptions3 = {
18303
+ allowIndefinite: false,
18304
+ coerceUndefinedToNull: true,
18305
+ allowNaN: false,
18306
+ allowInfinity: false,
18307
+ allowBigInt: true,
18308
+ strict: true,
18309
+ useMaps: false,
18310
+ rejectDuplicateMapKeys: true,
18311
+ tags: []
18312
+ };
18313
+ _decodeOptions3.tags[CID_CBOR_TAG3] = cidDecoder3;
18314
+ var decodeOptions4 = {
18315
+ ..._decodeOptions3,
18316
+ tags: _decodeOptions3.tags.slice()
18317
+ };
18318
+ var name9 = "dag-cbor";
18319
+ var code12 = 113;
18320
+ var encode20 = (node) => encode(node, _encodeOptions3);
18321
+ var decode21 = (data) => decode(toByteView3(data), _decodeOptions3);
18143
18322
  var contentType = "application/vnd.ipld.dag-cbor";
18144
18323
  var prepare = (data, seen) => {
18145
18324
  if (seen.has(data)) {
@@ -18185,12 +18364,12 @@ var prepare = (data, seen) => {
18185
18364
  }
18186
18365
  return data;
18187
18366
  };
18188
- var encode19 = (data) => encode4(prepare(data, /* @__PURE__ */ new Set()));
18367
+ var encode21 = (data) => encode20(prepare(data, /* @__PURE__ */ new Set()));
18189
18368
  var link2 = async (bytes2, { hasher = sha2563 } = {}) => {
18190
- return create2(code3, await hasher.digest(bytes2));
18369
+ return create2(code12, await hasher.digest(bytes2));
18191
18370
  };
18192
18371
  var write2 = async (data, options) => {
18193
- const bytes2 = encode19(data);
18372
+ const bytes2 = encode21(data);
18194
18373
  const cid = await link2(bytes2, options);
18195
18374
  return { cid, bytes: bytes2 };
18196
18375
  };
@@ -18242,14 +18421,86 @@ var addEveryInto = (source, store) => {
18242
18421
  var exports_car = {};
18243
18422
  __export(exports_car, {
18244
18423
  write: () => write3,
18245
- name: () => name9,
18424
+ name: () => name10,
18246
18425
  link: () => link3,
18247
- encode: () => encode20,
18248
- decode: () => decode20,
18426
+ encode: () => encode23,
18427
+ decode: () => decode23,
18249
18428
  createWriter: () => createWriter2,
18250
18429
  contentType: () => contentType2,
18251
- code: () => code11
18430
+ code: () => code13
18252
18431
  });
18432
+ var CID_CBOR_TAG4 = 42;
18433
+ function toByteView4(buf2) {
18434
+ if (buf2 instanceof ArrayBuffer) {
18435
+ return new Uint8Array(buf2, 0, buf2.byteLength);
18436
+ }
18437
+ return buf2;
18438
+ }
18439
+ function cidEncoder5(obj) {
18440
+ if (obj.asCID !== obj && obj["/"] !== obj.bytes) {
18441
+ return null;
18442
+ }
18443
+ const cid = CID.asCID(obj);
18444
+ if (!cid) {
18445
+ return null;
18446
+ }
18447
+ const bytes2 = new Uint8Array(cid.bytes.byteLength + 1);
18448
+ bytes2.set(cid.bytes, 1);
18449
+ return [
18450
+ new Token(Type.tag, CID_CBOR_TAG4),
18451
+ new Token(Type.bytes, bytes2)
18452
+ ];
18453
+ }
18454
+ function undefinedEncoder5() {
18455
+ throw new Error("`undefined` is not supported by the IPLD Data Model and cannot be encoded");
18456
+ }
18457
+ function numberEncoder5(num) {
18458
+ if (Number.isNaN(num)) {
18459
+ throw new Error("`NaN` is not supported by the IPLD Data Model and cannot be encoded");
18460
+ }
18461
+ if (num === Infinity || num === -Infinity) {
18462
+ throw new Error("`Infinity` and `-Infinity` is not supported by the IPLD Data Model and cannot be encoded");
18463
+ }
18464
+ return null;
18465
+ }
18466
+ var _encodeOptions4 = {
18467
+ float64: true,
18468
+ typeEncoders: {
18469
+ Object: cidEncoder5,
18470
+ undefined: undefinedEncoder5,
18471
+ number: numberEncoder5
18472
+ }
18473
+ };
18474
+ var encodeOptions5 = {
18475
+ ..._encodeOptions4,
18476
+ typeEncoders: {
18477
+ ..._encodeOptions4.typeEncoders
18478
+ }
18479
+ };
18480
+ function cidDecoder4(bytes2) {
18481
+ if (bytes2[0] !== 0) {
18482
+ throw new Error("Invalid CID for CBOR tag 42; expected leading 0x00");
18483
+ }
18484
+ return CID.decode(bytes2.subarray(1));
18485
+ }
18486
+ var _decodeOptions4 = {
18487
+ allowIndefinite: false,
18488
+ coerceUndefinedToNull: true,
18489
+ allowNaN: false,
18490
+ allowInfinity: false,
18491
+ allowBigInt: true,
18492
+ strict: true,
18493
+ useMaps: false,
18494
+ rejectDuplicateMapKeys: true,
18495
+ tags: []
18496
+ };
18497
+ _decodeOptions4.tags[CID_CBOR_TAG4] = cidDecoder4;
18498
+ var decodeOptions5 = {
18499
+ ..._decodeOptions4,
18500
+ tags: _decodeOptions4.tags.slice()
18501
+ };
18502
+ var encode22 = (node) => encode(node, _encodeOptions4);
18503
+ var decode22 = (data) => decode(toByteView4(data), _decodeOptions4);
18253
18504
  var import_varint2 = __toESM(require_varint(), 1);
18254
18505
  var CIDV0_BYTES = {
18255
18506
  SHA2_256: 18,
@@ -18475,7 +18726,7 @@ function readHeader(reader, strictVersion) {
18475
18726
  throw new Error("Invalid CAR header (zero length)");
18476
18727
  }
18477
18728
  const header = reader.exactly(length22, true);
18478
- const block = decode6(header);
18729
+ const block = decode22(header);
18479
18730
  if (CarV1HeaderOrV2Pragma.toTyped(block) === void 0) {
18480
18731
  throw new Error("Invalid CAR header format");
18481
18732
  }
@@ -18723,7 +18974,7 @@ var addBlock = (writer, { cid, bytes: bytes2 }) => {
18723
18974
  var close = (writer, options = {}) => {
18724
18975
  const { resize = false } = options;
18725
18976
  const { roots, bytes: bytes2, byteOffset, headerSize } = writer;
18726
- const headerBytes = encode4({ version: 1, roots });
18977
+ const headerBytes = encode22({ version: 1, roots });
18727
18978
  const varintBytes = import_varint3.default.encode(headerBytes.length);
18728
18979
  const size5 = varintBytes.length + headerBytes.byteLength;
18729
18980
  const offset = headerSize - size5;
@@ -18786,8 +19037,8 @@ var createWriter = (buffer2, options = {}) => {
18786
19037
  return writer;
18787
19038
  };
18788
19039
  var contentType2 = "application/vnd.ipld.car";
18789
- var name9 = "CAR";
18790
- var code11 = 514;
19040
+ var name10 = "CAR";
19041
+ var code13 = 514;
18791
19042
  class Writer {
18792
19043
  constructor(blocks = [], byteLength = 0) {
18793
19044
  this.written = /* @__PURE__ */ new Set();
@@ -18829,14 +19080,14 @@ class Writer {
18829
19080
  }
18830
19081
  }
18831
19082
  var createWriter2 = () => new Writer();
18832
- var encode20 = ({ roots = [], blocks }) => {
19083
+ var encode23 = ({ roots = [], blocks }) => {
18833
19084
  const writer = new Writer();
18834
19085
  if (blocks) {
18835
19086
  writer.write(...blocks.values());
18836
19087
  }
18837
19088
  return writer.flush(...roots);
18838
19089
  };
18839
- var decode20 = (bytes2) => {
19090
+ var decode23 = (bytes2) => {
18840
19091
  const reader = CarBufferReader2.fromBytes(bytes2);
18841
19092
  const roots = [];
18842
19093
  const blocks = /* @__PURE__ */ new Map();
@@ -18852,10 +19103,10 @@ var decode20 = (bytes2) => {
18852
19103
  return { roots, blocks };
18853
19104
  };
18854
19105
  var link3 = async (bytes2, { hasher = sha2563 } = {}) => {
18855
- return create2(code11, await hasher.digest(bytes2));
19106
+ return create2(code13, await hasher.digest(bytes2));
18856
19107
  };
18857
19108
  var write3 = async (data, options) => {
18858
- const bytes2 = encode20(data);
19109
+ const bytes2 = encode23(data);
18859
19110
  const cid = await link3(bytes2, options);
18860
19111
  return { bytes: bytes2, cid };
18861
19112
  };
@@ -18940,8 +19191,8 @@ class Failure extends Error {
18940
19191
  return this.describe();
18941
19192
  }
18942
19193
  toJSON() {
18943
- const { name: name102, message: message2, stack } = this;
18944
- return { name: name102, message: message2, stack };
19194
+ const { name: name112, message: message2, stack } = this;
19195
+ return { name: name112, message: message2, stack };
18945
19196
  }
18946
19197
  }
18947
19198
  class API {
@@ -19714,15 +19965,15 @@ __export(exports_link2, {
19714
19965
  create: () => create2
19715
19966
  });
19716
19967
  class LinkSchema extends API {
19717
- readWith(cid, { code: code122, multihash = {}, version: version32 }) {
19968
+ readWith(cid, { code: code142, multihash = {}, version: version32 }) {
19718
19969
  if (cid == null) {
19719
19970
  return error2(`Expected link but got ${cid} instead`);
19720
19971
  } else {
19721
19972
  if (!isLink(cid)) {
19722
19973
  return error2(`Expected link to be a CID instead of ${cid}`);
19723
19974
  } else {
19724
- if (code122 != null && cid.code !== code122) {
19725
- return error2(`Expected link to be CID with 0x${code122.toString(16)} codec`);
19975
+ if (code142 != null && cid.code !== code142) {
19976
+ return error2(`Expected link to be CID with 0x${code142.toString(16)} codec`);
19726
19977
  }
19727
19978
  if (multihash.code != null && cid.multihash.code !== multihash.code)
19728
19979
  return error2(`Expected link to be CID with 0x${multihash.code.toString(16)} hashing algorithm`);
@@ -19954,7 +20205,7 @@ class Delegation {
19954
20205
  return this.root.bytes;
19955
20206
  }
19956
20207
  get data() {
19957
- const data = decode21(this.root);
20208
+ const data = decode24(this.root);
19958
20209
  Object.defineProperties(this, { data: { value: data, enumerable: false } });
19959
20210
  return data;
19960
20211
  }
@@ -20024,7 +20275,7 @@ var archive = async (delegation) => {
20024
20275
  [`ucan@${delegation.version}`]: delegation.root.cid
20025
20276
  });
20026
20277
  store.set(`${variant2.cid}`, variant2);
20027
- const bytes2 = encode20({
20278
+ const bytes2 = encode23({
20028
20279
  roots: [variant2],
20029
20280
  blocks: store
20030
20281
  });
@@ -20038,13 +20289,13 @@ var ArchiveSchema = variant({
20038
20289
  });
20039
20290
  var extract2 = async (archive22) => {
20040
20291
  try {
20041
- const { roots, blocks } = decode20(archive22);
20292
+ const { roots, blocks } = decode23(archive22);
20042
20293
  const [root2] = roots;
20043
20294
  if (root2 == null) {
20044
20295
  return error2("CAR archive does not contain a root block");
20045
20296
  }
20046
20297
  const { bytes: bytes2 } = root2;
20047
- const variant2 = decode6(bytes2);
20298
+ const variant2 = decode21(bytes2);
20048
20299
  const [, link5] = ArchiveSchema.match(variant2);
20049
20300
  return ok(view2({ root: link5, blocks }));
20050
20301
  } catch (cause) {
@@ -20060,10 +20311,10 @@ var it = function* (delegation) {
20060
20311
  }
20061
20312
  };
20062
20313
  var decodeCache = /* @__PURE__ */ new WeakMap();
20063
- var decode21 = ({ bytes: bytes2 }) => {
20314
+ var decode24 = ({ bytes: bytes2 }) => {
20064
20315
  const data = decodeCache.get(bytes2);
20065
20316
  if (!data) {
20066
- const data2 = decode19(bytes2);
20317
+ const data2 = decode20(bytes2);
20067
20318
  decodeCache.set(bytes2, data2);
20068
20319
  return data2;
20069
20320
  }
@@ -20098,7 +20349,7 @@ var delegate = async ({ issuer, audience, proofs: proofs2 = [], attachedBlocks =
20098
20349
  return delegation;
20099
20350
  };
20100
20351
  var exportDAG = function* (root2, blocks, attachedLinks) {
20101
- for (const link5 of decode21(root2).proofs) {
20352
+ for (const link5 of decode24(root2).proofs) {
20102
20353
  const root3 = blocks.get(`${link5}`);
20103
20354
  if (root3) {
20104
20355
  yield* exportSubDAG(root3, blocks);
@@ -20113,7 +20364,7 @@ var exportDAG = function* (root2, blocks, attachedLinks) {
20113
20364
  yield root2;
20114
20365
  };
20115
20366
  var exportSubDAG = function* (root2, blocks) {
20116
- for (const link5 of decode21(root2).proofs) {
20367
+ for (const link5 of decode24(root2).proofs) {
20117
20368
  const root3 = blocks.get(`${link5}`);
20118
20369
  if (root3) {
20119
20370
  yield* exportSubDAG(root3, blocks);
@@ -20145,7 +20396,7 @@ var view2 = ({ root: root2, blocks }, fallback) => {
20145
20396
  var proofs = (delegation) => {
20146
20397
  const proofs2 = [];
20147
20398
  const { root: root2, blocks } = delegation;
20148
- for (const link5 of decode21(root2).proofs) {
20399
+ for (const link5 of decode24(root2).proofs) {
20149
20400
  const root3 = blocks.get(link5.toString());
20150
20401
  proofs2.push(root3 ? create8({ root: root3, blocks }) : link5);
20151
20402
  }
@@ -20195,7 +20446,8 @@ class IssuedInvocation {
20195
20446
  lifetimeInSeconds,
20196
20447
  notBefore,
20197
20448
  nonce,
20198
- facts = []
20449
+ facts = [],
20450
+ attachedBlocks
20199
20451
  }) {
20200
20452
  this.issuer = issuer;
20201
20453
  this.audience = audience;
@@ -20206,7 +20458,7 @@ class IssuedInvocation {
20206
20458
  this.notBefore = notBefore;
20207
20459
  this.nonce = nonce;
20208
20460
  this.facts = facts;
20209
- this.attachedBlocks = /* @__PURE__ */ new Map();
20461
+ this.attachedBlocks = attachedBlocks || /* @__PURE__ */ new Map();
20210
20462
  }
20211
20463
  attach(block) {
20212
20464
  this.attachedBlocks.set(`${block.cid}`, block);
@@ -20241,7 +20493,7 @@ var view4 = ({ root: root2, blocks }, fallback) => {
20241
20493
  if (block == null) {
20242
20494
  return fallback !== void 0 ? fallback : notFound(root2);
20243
20495
  }
20244
- const data = decode6(block.bytes);
20496
+ const data = decode21(block.bytes);
20245
20497
  return new Receipt({ root: { ...block, data }, store: blocks });
20246
20498
  };
20247
20499
  class Receipt {
@@ -20333,7 +20585,7 @@ class Receipt {
20333
20585
  }
20334
20586
  }
20335
20587
  verifySignature(signingPrincipal) {
20336
- return this.signature.verify(signingPrincipal, encode19(this.root.data.ocm));
20588
+ return this.signature.verify(signingPrincipal, encode21(this.root.data.ocm));
20337
20589
  }
20338
20590
  buildIPLDView() {
20339
20591
  return this;
@@ -20387,7 +20639,7 @@ class ReceptBuilder {
20387
20639
  iss: this.issuer.did(),
20388
20640
  prf
20389
20641
  };
20390
- const signature = await this.issuer.sign(encode19(outcome));
20642
+ const signature = await this.issuer.sign(encode21(outcome));
20391
20643
  const model = {
20392
20644
  ocm: outcome,
20393
20645
  sig: signature
@@ -20555,12 +20807,12 @@ var execute = async (invocations, connection) => {
20555
20807
  const receipts = input2.invocationLinks.map((link5) => output.get(link5));
20556
20808
  return receipts;
20557
20809
  } catch (error3) {
20558
- const { message: message2, name: name102 = "Error", ...cause } = error3;
20810
+ const { message: message2, name: name112 = "Error", ...cause } = error3;
20559
20811
  const receipts = [];
20560
20812
  for await (const ran of input2.invocationLinks) {
20561
20813
  const receipt = await exports_receipt.issue({
20562
20814
  ran,
20563
- result: { error: { ...cause, name: name102, message: message2 } },
20815
+ result: { error: { ...cause, name: name112, message: message2 } },
20564
20816
  issuer: {
20565
20817
  did() {
20566
20818
  return connection.id.did();
@@ -20587,8 +20839,8 @@ __export(exports_car2, {
20587
20839
  });
20588
20840
  var exports_request = {};
20589
20841
  __export(exports_request, {
20590
- encode: () => encode21,
20591
- decode: () => decode23,
20842
+ encode: () => encode24,
20843
+ decode: () => decode26,
20592
20844
  contentType: () => contentType3,
20593
20845
  codec: () => exports_car
20594
20846
  });
@@ -20597,7 +20849,7 @@ var HEADERS = Object.freeze({
20597
20849
  "content-type": contentType3,
20598
20850
  accept: contentType3
20599
20851
  });
20600
- var encode21 = (message2, options) => {
20852
+ var encode24 = (message2, options) => {
20601
20853
  const blocks = /* @__PURE__ */ new Map();
20602
20854
  for (const block of message2.iterateIPLDBlocks()) {
20603
20855
  blocks.set(`${block.cid}`, block);
@@ -20611,15 +20863,15 @@ var encode21 = (message2, options) => {
20611
20863
  body
20612
20864
  };
20613
20865
  };
20614
- var decode23 = async ({ headers, body }) => {
20866
+ var decode26 = async ({ headers, body }) => {
20615
20867
  const { roots, blocks } = exports_car.decode(body);
20616
20868
  const message2 = exports_message.view({ root: roots[0].cid, store: blocks });
20617
20869
  return message2;
20618
20870
  };
20619
20871
  var exports_response = {};
20620
20872
  __export(exports_response, {
20621
- encode: () => encode22,
20622
- decode: () => decode24,
20873
+ encode: () => encode25,
20874
+ decode: () => decode27,
20623
20875
  contentType: () => contentType4,
20624
20876
  codec: () => exports_car
20625
20877
  });
@@ -20627,7 +20879,7 @@ var contentType4 = exports_car.contentType;
20627
20879
  var HEADERS2 = Object.freeze({
20628
20880
  "content-type": contentType4
20629
20881
  });
20630
- var encode22 = (message2, options) => {
20882
+ var encode25 = (message2, options) => {
20631
20883
  const blocks = /* @__PURE__ */ new Map();
20632
20884
  for (const block of message2.iterateIPLDBlocks()) {
20633
20885
  blocks.set(`${block.cid}`, block);
@@ -20641,7 +20893,7 @@ var encode22 = (message2, options) => {
20641
20893
  body
20642
20894
  };
20643
20895
  };
20644
- var decode24 = async ({ headers, body }) => {
20896
+ var decode27 = async ({ headers, body }) => {
20645
20897
  const { roots, blocks } = exports_car.decode(body);
20646
20898
  const message2 = exports_message.view({ root: roots[0].cid, store: blocks });
20647
20899
  return message2;
@@ -21123,13 +21375,13 @@ var alphabetCharsToBytes = alphabet.reduce((p, c, i) => {
21123
21375
  p[codePoint] = i;
21124
21376
  return p;
21125
21377
  }, []);
21126
- function encode23(data) {
21378
+ function encode26(data) {
21127
21379
  return data.reduce((p, c) => {
21128
21380
  p += alphabetBytesToChars[c];
21129
21381
  return p;
21130
21382
  }, "");
21131
21383
  }
21132
- function decode25(str) {
21384
+ function decode28(str) {
21133
21385
  const byts = [];
21134
21386
  for (const char of str) {
21135
21387
  const codePoint = char.codePointAt(0);
@@ -21147,8 +21399,8 @@ function decode25(str) {
21147
21399
  var base256emoji = from8({
21148
21400
  prefix: "\u{1F680}",
21149
21401
  name: "base256emoji",
21150
- encode: encode23,
21151
- decode: decode25
21402
+ encode: encode26,
21403
+ decode: decode28
21152
21404
  });
21153
21405
  var exports_base8 = {};
21154
21406
  __export(exports_base8, {
@@ -21174,17 +21426,17 @@ var textEncoder2 = new TextEncoder();
21174
21426
  var textDecoder2 = new TextDecoder();
21175
21427
  var bases = { ...exports_identity2, ...exports_base2, ...exports_base8, ...exports_base10, ...exports_base16, ...exports_base32, ...exports_base36, ...exports_base58, ...exports_base64, ...exports_base256emoji };
21176
21428
  var hashes = { ...exports_sha2, ...exports_identity };
21177
- function createCodec(name102, prefix2, encode242, decode262) {
21429
+ function createCodec(name112, prefix2, encode272, decode292) {
21178
21430
  return {
21179
- name: name102,
21431
+ name: name112,
21180
21432
  prefix: prefix2,
21181
21433
  encoder: {
21182
- name: name102,
21434
+ name: name112,
21183
21435
  prefix: prefix2,
21184
- encode: encode242
21436
+ encode: encode272
21185
21437
  },
21186
21438
  decoder: {
21187
- decode: decode262
21439
+ decode: decode292
21188
21440
  }
21189
21441
  };
21190
21442
  }
@@ -21313,14 +21565,14 @@ var extract3 = (archive22) => {
21313
21565
  if (!roots.length) {
21314
21566
  return error(new UnknownFormat("missing root block"));
21315
21567
  }
21316
- const { code: code122 } = roots[0].cid;
21317
- if (code122 !== code3) {
21318
- return error(new UnknownFormat(`unexpected root CID codec: 0x${code122.toString(16)}`));
21568
+ const { code: code142 } = roots[0].cid;
21569
+ if (code142 !== code12) {
21570
+ return error(new UnknownFormat(`unexpected root CID codec: 0x${code142.toString(16)}`));
21319
21571
  }
21320
21572
  return view6({ root: roots[0], blocks });
21321
21573
  };
21322
21574
  var view6 = ({ root: root2, blocks }) => {
21323
- const [version4, dagIndexData] = ShardedDAGIndexSchema.match(decode6(root2.bytes));
21575
+ const [version4, dagIndexData] = ShardedDAGIndexSchema.match(decode21(root2.bytes));
21324
21576
  switch (version4) {
21325
21577
  case version4: {
21326
21578
  const dagIndex = create10(dagIndexData.content);
@@ -21329,7 +21581,7 @@ var view6 = ({ root: root2, blocks }) => {
21329
21581
  if (!shard) {
21330
21582
  return error(new DecodeFailure(`missing shard block: ${shardLink}`));
21331
21583
  }
21332
- const blobIndexData = BlobIndexSchema.from(decode6(shard.bytes));
21584
+ const blobIndexData = BlobIndexSchema.from(decode21(shard.bytes));
21333
21585
  const blobIndex = new DigestMap();
21334
21586
  for (const [digest4, [offset, length22]] of blobIndexData[1]) {
21335
21587
  blobIndex.set(decode5(digest4), [offset, length22]);
@@ -21401,15 +21653,15 @@ var archive2 = async (model) => {
21401
21653
  };
21402
21654
  for (const s of shards) {
21403
21655
  const slices = [...s[1].entries()].sort((a, b) => compare2(a[0].digest, b[0].digest)).map((e) => [e[0].bytes, e[1]]);
21404
- const bytes3 = encode4([s[0].bytes, slices]);
21656
+ const bytes3 = encode20([s[0].bytes, slices]);
21405
21657
  const digest5 = await sha2563.digest(bytes3);
21406
- const cid2 = create2(code3, digest5);
21658
+ const cid2 = create2(code12, digest5);
21407
21659
  blocks.set(cid2.toString(), { cid: cid2, bytes: bytes3 });
21408
21660
  index2.shards.push(cid2);
21409
21661
  }
21410
- const bytes2 = encode4({ [version3]: index2 });
21662
+ const bytes2 = encode20({ [version3]: index2 });
21411
21663
  const digest4 = await sha2563.digest(bytes2);
21412
- const cid = create2(code3, digest4);
21664
+ const cid = create2(code12, digest4);
21413
21665
  roots.push({ cid, bytes: bytes2 });
21414
21666
  } catch (err) {
21415
21667
  return error({
@@ -21428,7 +21680,7 @@ var archive2 = async (model) => {
21428
21680
  });
21429
21681
  }
21430
21682
  };
21431
- var symbol = Symbol.for("@achingbrain/uint8arraylist");
21683
+ var symbol = /* @__PURE__ */ Symbol.for("@achingbrain/uint8arraylist");
21432
21684
  function findBufAndOffset(bufs, index2) {
21433
21685
  if (index2 == null || index2 < 0) {
21434
21686
  throw new RangeError("index is out of bounds");
@@ -21808,11 +22060,83 @@ class Uint8ArrayList {
21808
22060
  return list3;
21809
22061
  }
21810
22062
  }
22063
+ var CID_CBOR_TAG5 = 42;
22064
+ function toByteView5(buf2) {
22065
+ if (buf2 instanceof ArrayBuffer) {
22066
+ return new Uint8Array(buf2, 0, buf2.byteLength);
22067
+ }
22068
+ return buf2;
22069
+ }
22070
+ function cidEncoder6(obj) {
22071
+ if (obj.asCID !== obj && obj["/"] !== obj.bytes) {
22072
+ return null;
22073
+ }
22074
+ const cid = CID.asCID(obj);
22075
+ if (!cid) {
22076
+ return null;
22077
+ }
22078
+ const bytes2 = new Uint8Array(cid.bytes.byteLength + 1);
22079
+ bytes2.set(cid.bytes, 1);
22080
+ return [
22081
+ new Token(Type.tag, CID_CBOR_TAG5),
22082
+ new Token(Type.bytes, bytes2)
22083
+ ];
22084
+ }
22085
+ function undefinedEncoder6() {
22086
+ throw new Error("`undefined` is not supported by the IPLD Data Model and cannot be encoded");
22087
+ }
22088
+ function numberEncoder6(num) {
22089
+ if (Number.isNaN(num)) {
22090
+ throw new Error("`NaN` is not supported by the IPLD Data Model and cannot be encoded");
22091
+ }
22092
+ if (num === Infinity || num === -Infinity) {
22093
+ throw new Error("`Infinity` and `-Infinity` is not supported by the IPLD Data Model and cannot be encoded");
22094
+ }
22095
+ return null;
22096
+ }
22097
+ var _encodeOptions5 = {
22098
+ float64: true,
22099
+ typeEncoders: {
22100
+ Object: cidEncoder6,
22101
+ undefined: undefinedEncoder6,
22102
+ number: numberEncoder6
22103
+ }
22104
+ };
22105
+ var encodeOptions6 = {
22106
+ ..._encodeOptions5,
22107
+ typeEncoders: {
22108
+ ..._encodeOptions5.typeEncoders
22109
+ }
22110
+ };
22111
+ function cidDecoder5(bytes2) {
22112
+ if (bytes2[0] !== 0) {
22113
+ throw new Error("Invalid CID for CBOR tag 42; expected leading 0x00");
22114
+ }
22115
+ return CID.decode(bytes2.subarray(1));
22116
+ }
22117
+ var _decodeOptions5 = {
22118
+ allowIndefinite: false,
22119
+ coerceUndefinedToNull: true,
22120
+ allowNaN: false,
22121
+ allowInfinity: false,
22122
+ allowBigInt: true,
22123
+ strict: true,
22124
+ useMaps: false,
22125
+ rejectDuplicateMapKeys: true,
22126
+ tags: []
22127
+ };
22128
+ _decodeOptions5.tags[CID_CBOR_TAG5] = cidDecoder5;
22129
+ var decodeOptions6 = {
22130
+ ..._decodeOptions5,
22131
+ tags: _decodeOptions5.tags.slice()
22132
+ };
22133
+ var encode27 = (node) => encode(node, _encodeOptions5);
22134
+ var decode29 = (data) => decode(toByteView5(data), _decodeOptions5);
21811
22135
  var MSB2 = 128;
21812
22136
  var REST2 = 127;
21813
22137
  var MSBALL2 = ~REST2;
21814
22138
  var INT2 = Math.pow(2, 31);
21815
- var encode24 = (num) => {
22139
+ var encode28 = (num) => {
21816
22140
  const out = [];
21817
22141
  let offset = 0;
21818
22142
  while (num >= INT2) {
@@ -21826,7 +22150,7 @@ var encode24 = (num) => {
21826
22150
  out[offset] = num | 0;
21827
22151
  return out;
21828
22152
  };
21829
- var decode26 = (buf2, offset) => {
22153
+ var decode30 = (buf2, offset) => {
21830
22154
  let res = 0;
21831
22155
  offset = offset || 0;
21832
22156
  let shift = 0;
@@ -21872,14 +22196,14 @@ class CARReaderStream extends TransformStream {
21872
22196
  if (buffer2.length < wanted)
21873
22197
  break;
21874
22198
  if (state === State.ReadHeaderLength) {
21875
- const [length22, bytes2] = decode26(buffer2);
22199
+ const [length22, bytes2] = decode30(buffer2);
21876
22200
  buffer2.consume(bytes2);
21877
22201
  prevOffset = offset;
21878
22202
  offset += bytes2;
21879
22203
  state = State.ReadHeader;
21880
22204
  wanted = length22;
21881
22205
  } else if (state === State.ReadHeader) {
21882
- const header = decode6(buffer2.slice(0, wanted));
22206
+ const header = decode29(buffer2.slice(0, wanted));
21883
22207
  resolveHeader && resolveHeader(header);
21884
22208
  buffer2.consume(wanted);
21885
22209
  prevOffset = offset;
@@ -21887,7 +22211,7 @@ class CARReaderStream extends TransformStream {
21887
22211
  state = State.ReadBlockLength;
21888
22212
  wanted = 8;
21889
22213
  } else if (state === State.ReadBlockLength) {
21890
- const [length22, bytes2] = decode26(buffer2);
22214
+ const [length22, bytes2] = decode30(buffer2);
21891
22215
  buffer2.consume(bytes2);
21892
22216
  prevOffset = offset;
21893
22217
  offset += bytes2;
@@ -21905,12 +22229,12 @@ class CARReaderStream extends TransformStream {
21905
22229
  buffer2.consume(34);
21906
22230
  offset += 34;
21907
22231
  } else {
21908
- const [version4, versionBytes] = decode26(buffer2);
22232
+ const [version4, versionBytes] = decode30(buffer2);
21909
22233
  if (version4 !== 1)
21910
22234
  throw new Error(`unexpected CID version (${version4})`);
21911
22235
  buffer2.consume(versionBytes);
21912
22236
  offset += versionBytes;
21913
- const [codec, codecBytes] = decode26(buffer2);
22237
+ const [codec, codecBytes] = decode30(buffer2);
21914
22238
  buffer2.consume(codecBytes);
21915
22239
  offset += codecBytes;
21916
22240
  const multihashBytes = getMultihashLength2(buffer2);
@@ -21943,20 +22267,20 @@ class CARReaderStream extends TransformStream {
21943
22267
  }
21944
22268
  }
21945
22269
  var getMultihashLength2 = (bytes2) => {
21946
- const [, codeBytes] = decode26(bytes2);
21947
- const [length22, lengthBytes] = decode26(bytes2, codeBytes);
22270
+ const [, codeBytes] = decode30(bytes2);
22271
+ const [length22, lengthBytes] = decode30(bytes2, codeBytes);
21948
22272
  return codeBytes + lengthBytes + length22;
21949
22273
  };
21950
22274
  var encodeHeader2 = (roots) => {
21951
- const headerBytes = encode4({ version: 1, roots });
21952
- const varintBytes = encode24(headerBytes.length);
22275
+ const headerBytes = encode27({ version: 1, roots });
22276
+ const varintBytes = encode28(headerBytes.length);
21953
22277
  const header = new Uint8Array(varintBytes.length + headerBytes.length);
21954
22278
  header.set(varintBytes, 0);
21955
22279
  header.set(headerBytes, varintBytes.length);
21956
22280
  return header;
21957
22281
  };
21958
22282
  var encodeBlock = (block) => {
21959
- const varintBytes = encode24(block.cid.bytes.length + block.bytes.length);
22283
+ const varintBytes = encode28(block.cid.bytes.length + block.bytes.length);
21960
22284
  const bytes2 = new Uint8Array(varintBytes.length + block.cid.bytes.length + block.bytes.length);
21961
22285
  bytes2.set(varintBytes);
21962
22286
  bytes2.set(block.cid.bytes, varintBytes.length);
@@ -21983,14 +22307,14 @@ var encoder4 = new TextEncoder();
21983
22307
  var decoder3 = new TextDecoder();
21984
22308
  var exports_response2 = {};
21985
22309
  __export(exports_response2, {
21986
- encode: () => encode25,
22310
+ encode: () => encode29,
21987
22311
  contentType: () => contentType6
21988
22312
  });
21989
22313
  var contentType6 = "application/cbor";
21990
22314
  var HEADERS3 = Object.freeze({
21991
22315
  "content-type": contentType6
21992
22316
  });
21993
- var encode25 = (message2, options) => {
22317
+ var encode29 = (message2, options) => {
21994
22318
  const legacyResults = [];
21995
22319
  for (const receipt of message2.receipts.values()) {
21996
22320
  const result2 = receipt.out;
@@ -22003,7 +22327,7 @@ var encode25 = (message2, options) => {
22003
22327
  });
22004
22328
  }
22005
22329
  }
22006
- const body = encode19(legacyResults);
22330
+ const body = encode21(legacyResults);
22007
22331
  return {
22008
22332
  headers: HEADERS3,
22009
22333
  body
@@ -22011,12 +22335,12 @@ var encode25 = (message2, options) => {
22011
22335
  };
22012
22336
  var exports_request2 = {};
22013
22337
  __export(exports_request2, {
22014
- decode: () => decode27,
22338
+ decode: () => decode31,
22015
22339
  contentType: () => contentType7
22016
22340
  });
22017
22341
  var contentType7 = "application/car";
22018
- var decode27 = async ({ body }) => {
22019
- const { roots, blocks } = decode20(body);
22342
+ var decode31 = async ({ body }) => {
22343
+ const { roots, blocks } = decode23(body);
22020
22344
  const run = [];
22021
22345
  for (const { cid } of roots) {
22022
22346
  const invocation = exports_invocation.view({
@@ -22601,9 +22925,9 @@ var defaultDerives = (claimed, delegated) => {
22601
22925
  const caveats = delegated.nb || {};
22602
22926
  const nb = claimed.nb || {};
22603
22927
  const kv = entries(caveats);
22604
- for (const [name102, value] of kv) {
22605
- if (nb[name102] != value) {
22606
- return exports_schema3.error(`${String(name102)}: ${nb[name102]} violates ${value}`);
22928
+ for (const [name112, value] of kv) {
22929
+ if (nb[name112] != value) {
22930
+ return exports_schema3.error(`${String(name112)}: ${nb[name112]} violates ${value}`);
22607
22931
  }
22608
22932
  }
22609
22933
  return { ok: true };
@@ -22671,7 +22995,8 @@ var filecoinOffer = capability({
22671
22995
  with: exports_schema3.did(),
22672
22996
  nb: exports_schema3.struct({
22673
22997
  content: exports_schema3.link(),
22674
- piece: PieceLink
22998
+ piece: PieceLink,
22999
+ PDP: exports_schema3.link({ version: 1 }).optional()
22675
23000
  }),
22676
23001
  derives: (claim, from242) => {
22677
23002
  return and3(equalWith(claim, from242)) || and3(checkLink(claim.nb.content, from242.nb.content, "nb.content")) || and3(checkLink(claim.nb.piece, from242.nb.piece, "nb.piece")) || ok({});
@@ -23118,33 +23443,33 @@ __export(exports_rsa, {
23118
23443
  signatureCode: () => signatureCode3,
23119
23444
  signatureAlgorithm: () => signatureAlgorithm3,
23120
23445
  or: () => or8,
23121
- name: () => name10,
23446
+ name: () => name11,
23122
23447
  generate: () => generate2,
23123
23448
  from: () => from24,
23124
- decode: () => decode32,
23125
- code: () => code12,
23449
+ decode: () => decode36,
23450
+ code: () => code14,
23126
23451
  Verifier: () => RSAVerifier
23127
23452
  });
23128
23453
  var webcrypto2 = crypto6.webcrypto;
23129
- var tagWith = (code122, bytes2) => {
23130
- const offset = exports_varint.encodingLength(code122);
23454
+ var tagWith = (code142, bytes2) => {
23455
+ const offset = exports_varint.encodingLength(code142);
23131
23456
  const multiformat = new Uint8Array(bytes2.byteLength + offset);
23132
- exports_varint.encodeTo(code122, multiformat, 0);
23457
+ exports_varint.encodeTo(code142, multiformat, 0);
23133
23458
  multiformat.set(bytes2, offset);
23134
23459
  return multiformat;
23135
23460
  };
23136
- var untagWith = (code122, source, byteOffset = 0) => {
23461
+ var untagWith = (code142, source, byteOffset = 0) => {
23137
23462
  const bytes2 = byteOffset !== 0 ? source.subarray(byteOffset) : source;
23138
23463
  const [tag, size5] = exports_varint.decode(bytes2);
23139
- if (tag !== code122) {
23140
- throw new Error(`Expected multiformat with 0x${code122.toString(16)} tag instead got 0x${tag.toString(16)}`);
23464
+ if (tag !== code142) {
23465
+ throw new Error(`Expected multiformat with 0x${code142.toString(16)} tag instead got 0x${tag.toString(16)}`);
23141
23466
  } else {
23142
23467
  return new Uint8Array(bytes2.buffer, bytes2.byteOffset + size5);
23143
23468
  }
23144
23469
  };
23145
23470
  var encodingLength2 = exports_varint.encodingLength;
23146
23471
  var encodeTo2 = exports_varint.encodeTo;
23147
- var decode28 = exports_varint.decode;
23472
+ var decode32 = exports_varint.decode;
23148
23473
  var TAG_SIZE2 = 1;
23149
23474
  var INT_TAG = 2;
23150
23475
  var BITSTRING_TAG = 3;
@@ -23304,8 +23629,8 @@ var SPKI_PARAMS_ENCODED = new Uint8Array([
23304
23629
  5,
23305
23630
  0
23306
23631
  ]);
23307
- var encode26 = (key) => encodeSequence([SPKI_PARAMS_ENCODED, encodeBitString(key)]);
23308
- var decode29 = (info) => {
23632
+ var encode30 = (key) => encodeSequence([SPKI_PARAMS_ENCODED, encodeBitString(key)]);
23633
+ var decode33 = (info) => {
23309
23634
  const offset = enterSequence(info, 0);
23310
23635
  const keyOffset = skipSequence(info, offset);
23311
23636
  return readBitString(info, keyOffset);
@@ -23330,17 +23655,17 @@ var PKSC8_HEADER = new Uint8Array([
23330
23655
  5,
23331
23656
  0
23332
23657
  ]);
23333
- var decode30 = (info) => {
23658
+ var decode34 = (info) => {
23334
23659
  let offset = 0;
23335
23660
  offset = enterSequence(info, offset);
23336
23661
  offset = skipInt(info, offset);
23337
23662
  offset = skipSequence(info, offset);
23338
23663
  return readOctetString(info, offset);
23339
23664
  };
23340
- var encode27 = (key) => encodeSequence([PKSC8_HEADER, encodeOctetString(key)]);
23341
- var encode28 = ({ n, e }) => encodeSequence([encodeInt(n), encodeInt(e)]);
23665
+ var encode31 = (key) => encodeSequence([PKSC8_HEADER, encodeOctetString(key)]);
23666
+ var encode32 = ({ n, e }) => encodeSequence([encodeInt(n), encodeInt(e)]);
23342
23667
  var VERSION2 = new Uint8Array();
23343
- var decode31 = (source, byteOffset = 0) => {
23668
+ var decode35 = (source, byteOffset = 0) => {
23344
23669
  const [v, n, e, d, p, q, dp, dq, qi] = readSequenceWith([
23345
23670
  readInt2,
23346
23671
  readInt2,
@@ -23354,8 +23679,8 @@ var decode31 = (source, byteOffset = 0) => {
23354
23679
  ], source, byteOffset);
23355
23680
  return { v, n, e, d, p, q, dp, dq, qi };
23356
23681
  };
23357
- var name10 = "RSA";
23358
- var code12 = 4869;
23682
+ var name11 = "RSA";
23683
+ var code14 = 4869;
23359
23684
  var verifierCode = 4613;
23360
23685
  var signatureCode3 = RS256;
23361
23686
  var signatureAlgorithm3 = "RS256";
@@ -23378,7 +23703,7 @@ var generate2 = async ({
23378
23703
  hash: { name: HASH_ALG }
23379
23704
  }, extractable, ["sign", "verify"]);
23380
23705
  const spki = await webcrypto2.subtle.exportKey("spki", publicKey);
23381
- const publicBytes = tagWith(verifierCode, decode29(new Uint8Array(spki)));
23706
+ const publicBytes = tagWith(verifierCode, decode33(new Uint8Array(spki)));
23382
23707
  const verifier = new RSAVerifier({ bytes: publicBytes, publicKey });
23383
23708
  if (!extractable) {
23384
23709
  return new UnextractableRSASigner({
@@ -23387,7 +23712,7 @@ var generate2 = async ({
23387
23712
  });
23388
23713
  } else {
23389
23714
  const pkcs8 = await webcrypto2.subtle.exportKey("pkcs8", privateKey);
23390
- const bytes2 = tagWith(code12, decode30(new Uint8Array(pkcs8)));
23715
+ const bytes2 = tagWith(code14, decode34(new Uint8Array(pkcs8)));
23391
23716
  return new ExtractableRSASigner({
23392
23717
  privateKey,
23393
23718
  bytes: bytes2,
@@ -23400,7 +23725,7 @@ var from24 = ({ id, keys: keys2 }) => {
23400
23725
  const did2 = id;
23401
23726
  const key = keys2[did2];
23402
23727
  if (key instanceof Uint8Array) {
23403
- return decode32(key);
23728
+ return decode36(key);
23404
23729
  } else {
23405
23730
  return new UnextractableRSASigner({
23406
23731
  privateKey: key,
@@ -23412,12 +23737,12 @@ var from24 = ({ id, keys: keys2 }) => {
23412
23737
  }
23413
23738
  };
23414
23739
  var or8 = (other) => or4({ from: from24 }, other);
23415
- var decode32 = (bytes2) => {
23416
- const rsa = decode31(untagWith(code12, bytes2));
23417
- const publicBytes = tagWith(verifierCode, encode28(rsa));
23740
+ var decode36 = (bytes2) => {
23741
+ const rsa = decode35(untagWith(code14, bytes2));
23742
+ const publicBytes = tagWith(verifierCode, encode32(rsa));
23418
23743
  return new ExtractableRSASigner({
23419
23744
  bytes: bytes2,
23420
- privateKey: webcrypto2.subtle.importKey("pkcs8", encode27(untagWith(code12, bytes2)), IMPORT_PARAMS, true, ["sign"]),
23745
+ privateKey: webcrypto2.subtle.importKey("pkcs8", encode31(untagWith(code14, bytes2)), IMPORT_PARAMS, true, ["sign"]),
23421
23746
  verifier: RSAVerifier.decode(publicBytes)
23422
23747
  });
23423
23748
  };
@@ -23435,7 +23760,7 @@ class RSAVerifier {
23435
23760
  static decode(bytes2) {
23436
23761
  return new this({
23437
23762
  bytes: bytes2,
23438
- publicKey: webcrypto2.subtle.importKey("spki", encode26(untagWith(verifierCode, bytes2)), IMPORT_PARAMS, true, ["verify"])
23763
+ publicKey: webcrypto2.subtle.importKey("spki", encode30(untagWith(verifierCode, bytes2)), IMPORT_PARAMS, true, ["verify"])
23439
23764
  });
23440
23765
  }
23441
23766
  static parse(did2) {
@@ -23472,7 +23797,7 @@ class RSASigner {
23472
23797
  return this;
23473
23798
  }
23474
23799
  get code() {
23475
- return code12;
23800
+ return code14;
23476
23801
  }
23477
23802
  get signatureCode() {
23478
23803
  return signatureCode3;
@@ -23787,7 +24112,7 @@ async function readHeader2(reader, strictVersion) {
23787
24112
  throw new Error("Invalid CAR header (zero length)");
23788
24113
  }
23789
24114
  const header = await reader.exactly(length22, true);
23790
- const block = decode6(header);
24115
+ const block = decode22(header);
23791
24116
  if (CarV1HeaderOrV2Pragma.toTyped(block) === void 0) {
23792
24117
  throw new Error("Invalid CAR header format");
23793
24118
  }
@@ -24066,7 +24391,7 @@ async function decodeIterator(reader) {
24066
24391
  var import_varint6 = __toESM(require_varint(), 1);
24067
24392
  var CAR_V1_VERSION = 1;
24068
24393
  function createHeader(roots) {
24069
- const headerBytes = encode4({ version: CAR_V1_VERSION, roots });
24394
+ const headerBytes = encode22({ version: CAR_V1_VERSION, roots });
24070
24395
  const varintBytes = import_varint6.default.encode(headerBytes.length);
24071
24396
  const header = new Uint8Array(varintBytes.length + headerBytes.length);
24072
24397
  header.set(varintBytes, 0);
@@ -24284,7 +24609,7 @@ class CarWriter2 extends CarWriter {
24284
24609
  }
24285
24610
  }
24286
24611
  var import_varint7 = __toESM(require_varint(), 1);
24287
- async function decode33(car) {
24612
+ async function decode37(car) {
24288
24613
  const iterator = await CarBlockIterator.fromIterable(car.stream());
24289
24614
  const blocks = [];
24290
24615
  for await (const block of iterator) {
@@ -24293,12 +24618,12 @@ async function decode33(car) {
24293
24618
  const roots = await iterator.getRoots();
24294
24619
  return { blocks, roots };
24295
24620
  }
24296
- var code13 = 514;
24621
+ var code15 = 514;
24297
24622
  var NO_ROOTS_HEADER_LENGTH = 18;
24298
24623
  function headerEncodingLength(root2) {
24299
24624
  if (!root2)
24300
24625
  return NO_ROOTS_HEADER_LENGTH;
24301
- const headerLength2 = encode4({ version: 1, roots: [root2] }).length;
24626
+ const headerLength2 = encode20({ version: 1, roots: [root2] }).length;
24302
24627
  const varintLength = import_varint7.default.encodingLength(headerLength2);
24303
24628
  return varintLength + headerLength2;
24304
24629
  }
@@ -24307,7 +24632,7 @@ function blockHeaderEncodingLength(block) {
24307
24632
  const varintLength = import_varint7.default.encodingLength(payloadLength);
24308
24633
  return varintLength + block.cid.bytes.length;
24309
24634
  }
24310
- async function encode29(blocks, root2) {
24635
+ async function encode33(blocks, root2) {
24311
24636
  const { writer, out } = CarWriter2.create(root2);
24312
24637
  let error3;
24313
24638
  (async () => {
@@ -24338,7 +24663,8 @@ var add3 = capability({
24338
24663
  can: "space/index/add",
24339
24664
  with: SpaceDID,
24340
24665
  nb: exports_schema3.struct({
24341
- index: exports_schema3.link({ code: exports_car.code, version: 1 })
24666
+ index: exports_schema3.link({ code: exports_car.code, version: 1 }),
24667
+ content: exports_schema3.link().optional()
24342
24668
  }),
24343
24669
  derives: (claimed, delegated) => and3(equalWith(claimed, delegated)) || and3(equal(claimed.nb.index, delegated.nb.index, "index")) || ok({})
24344
24670
  });
@@ -24439,7 +24765,7 @@ async function add6({ issuer, with: resource, proofs: proofs2 }, root2, shards)
24439
24765
  }
24440
24766
  var ability3 = add5.can;
24441
24767
  var uploadCAR = async (conf, car) => {
24442
- const { blocks, roots } = await decode33(car);
24768
+ const { blocks, roots } = await decode37(car);
24443
24769
  const root2 = roots[0];
24444
24770
  const slices = /* @__PURE__ */ new Map();
24445
24771
  let currentLength = 0;
@@ -24458,7 +24784,7 @@ var uploadCAR = async (conf, car) => {
24458
24784
  for (const slice4 of slices.values())
24459
24785
  slice4[0] += diff;
24460
24786
  }
24461
- const singleCar = await encode29(blocks, root2);
24787
+ const singleCar = await encode33(blocks, root2);
24462
24788
  const bytes2 = new Uint8Array(await singleCar.arrayBuffer());
24463
24789
  const digest4 = await sha2563.digest(bytes2);
24464
24790
  await add2(conf, digest4, bytes2);
@@ -24474,7 +24800,7 @@ var uploadCAR = async (conf, car) => {
24474
24800
  cause: offer.out.error
24475
24801
  });
24476
24802
  }
24477
- const carCid = create2(code13, digest4);
24803
+ const carCid = create2(code15, digest4);
24478
24804
  const index2 = exports_sharded_dag_index.create(root2);
24479
24805
  for (const [slice4, pos] of slices)
24480
24806
  index2.setSlice(digest4, slice4, pos);
@@ -24484,7 +24810,7 @@ var uploadCAR = async (conf, car) => {
24484
24810
  throw new Error("failed to archive DAG index", { cause: indexBytes.error });
24485
24811
  }
24486
24812
  const indexDigest = await sha2563.digest(indexBytes.ok);
24487
- const indexLink = create2(code13, indexDigest);
24813
+ const indexLink = create2(code15, indexDigest);
24488
24814
  await add2(conf, indexDigest, indexBytes.ok);
24489
24815
  await add4(conf, indexLink);
24490
24816
  await add6(conf, root2, [carCid]);
@@ -24720,8 +25046,8 @@ var tokensToProviderNames = (keys2) => {
24720
25046
  return providers;
24721
25047
  };
24722
25048
  var findEnvVarProviderName = (provider) => {
24723
- for (const [token, { name: name112 }] of Object.entries(PROVIDERS)) {
24724
- if (provider === name112)
25049
+ for (const [token, { name: name122 }] of Object.entries(PROVIDERS)) {
25050
+ if (provider === name122)
24725
25051
  return token;
24726
25052
  }
24727
25053
  };
@@ -24981,12 +25307,12 @@ var walk2 = async (dir, verbose = false) => {
24981
25307
  absolute: false
24982
25308
  })) {
24983
25309
  const size5 = (await stat(path22)).size;
24984
- const name112 = relative(dir, path22);
25310
+ const name122 = relative(dir, path22);
24985
25311
  if (verbose)
24986
- logger.text(`${name112} (${fileSize(size5, 2)})`);
25312
+ logger.text(`${name122} (${fileSize(size5, 2)})`);
24987
25313
  total += size5;
24988
25314
  files.push({
24989
- path: name112,
25315
+ path: name122,
24990
25316
  content: createReadStream(path22),
24991
25317
  size: size5
24992
25318
  });
@@ -25023,6 +25349,26 @@ class NotFoundError2 extends Error {
25023
25349
  super(message2);
25024
25350
  }
25025
25351
  }
25352
+ function isAsyncIterable(thing) {
25353
+ return thing[Symbol.asyncIterator] != null;
25354
+ }
25355
+ function all2(source) {
25356
+ if (isAsyncIterable(source)) {
25357
+ return (async () => {
25358
+ const arr2 = [];
25359
+ for await (const entry of source) {
25360
+ arr2.push(entry);
25361
+ }
25362
+ return arr2;
25363
+ })();
25364
+ }
25365
+ const arr = [];
25366
+ for (const entry of source) {
25367
+ arr.push(entry);
25368
+ }
25369
+ return arr;
25370
+ }
25371
+ var src_default = all2;
25026
25372
  class BaseBlockstore {
25027
25373
  has(key, options) {
25028
25374
  return Promise.reject(new Error(".has is not implemented"));
@@ -25031,19 +25377,19 @@ class BaseBlockstore {
25031
25377
  return Promise.reject(new Error(".put is not implemented"));
25032
25378
  }
25033
25379
  async *putMany(source, options) {
25034
- for await (const { cid, block } of source) {
25035
- await this.put(cid, block, options);
25380
+ for await (const { cid, bytes: bytes2 } of source) {
25381
+ await this.put(cid, bytes2, options);
25036
25382
  yield cid;
25037
25383
  }
25038
25384
  }
25039
25385
  get(key, options) {
25040
- return Promise.reject(new Error(".get is not implemented"));
25386
+ throw new Error(".get is not implemented");
25041
25387
  }
25042
25388
  async *getMany(source, options) {
25043
25389
  for await (const key of source) {
25044
25390
  yield {
25045
25391
  cid: key,
25046
- block: await this.get(key, options)
25392
+ bytes: this.get(key, options)
25047
25393
  };
25048
25394
  }
25049
25395
  }
@@ -25060,6 +25406,9 @@ class BaseBlockstore {
25060
25406
  throw new Error(".getAll is not implemented");
25061
25407
  }
25062
25408
  }
25409
+ function isPromise(p) {
25410
+ return typeof p?.then === "function";
25411
+ }
25063
25412
  class MemoryBlockstore extends BaseBlockstore {
25064
25413
  data;
25065
25414
  constructor() {
@@ -25067,17 +25416,34 @@ class MemoryBlockstore extends BaseBlockstore {
25067
25416
  this.data = /* @__PURE__ */ new Map();
25068
25417
  }
25069
25418
  put(key, val, options) {
25419
+ options?.signal?.throwIfAborted();
25420
+ let buf2;
25421
+ if (val instanceof Uint8Array) {
25422
+ buf2 = [val];
25423
+ } else {
25424
+ const result2 = src_default(val);
25425
+ if (isPromise(result2)) {
25426
+ return result2.then((val2) => {
25427
+ return this._put(key, val2, options);
25428
+ });
25429
+ } else {
25430
+ buf2 = result2;
25431
+ }
25432
+ }
25433
+ return this._put(key, buf2, options);
25434
+ }
25435
+ _put(key, val, options) {
25070
25436
  options?.signal?.throwIfAborted();
25071
25437
  this.data.set(base32.encode(key.multihash.bytes), val);
25072
25438
  return key;
25073
25439
  }
25074
- get(key, options) {
25440
+ *get(key, options) {
25075
25441
  options?.signal?.throwIfAborted();
25076
25442
  const buf2 = this.data.get(base32.encode(key.multihash.bytes));
25077
25443
  if (buf2 == null) {
25078
25444
  throw new NotFoundError2();
25079
25445
  }
25080
- return buf2;
25446
+ yield* buf2;
25081
25447
  }
25082
25448
  has(key, options) {
25083
25449
  options?.signal?.throwIfAborted();
@@ -25087,23 +25453,25 @@ class MemoryBlockstore extends BaseBlockstore {
25087
25453
  options?.signal?.throwIfAborted();
25088
25454
  this.data.delete(base32.encode(key.multihash.bytes));
25089
25455
  }
25090
- async *getAll(options) {
25456
+ *getAll(options) {
25091
25457
  options?.signal?.throwIfAborted();
25092
25458
  for (const [key, value] of this.data.entries()) {
25093
25459
  yield {
25094
25460
  cid: CID.createV1(code6, decode5(base32.decode(key))),
25095
- block: value
25461
+ bytes: (async function* () {
25462
+ yield* value;
25463
+ })()
25096
25464
  };
25097
25465
  options?.signal?.throwIfAborted();
25098
25466
  }
25099
25467
  }
25100
25468
  }
25101
- function isAsyncIterable(thing) {
25469
+ function isAsyncIterable2(thing) {
25102
25470
  return thing[Symbol.asyncIterator] != null;
25103
25471
  }
25104
25472
  function batch(source, size5 = 1) {
25105
25473
  size5 = Number(size5);
25106
- if (isAsyncIterable(source)) {
25474
+ if (isAsyncIterable2(source)) {
25107
25475
  return (async function* () {
25108
25476
  let things = [];
25109
25477
  if (size5 < 1) {
@@ -25146,9 +25514,9 @@ function batch(source, size5 = 1) {
25146
25514
  }
25147
25515
  })();
25148
25516
  }
25149
- var src_default = batch;
25517
+ var src_default2 = batch;
25150
25518
  async function* parallelBatch(source, size5 = 1) {
25151
- for await (const tasks of src_default(source, size5)) {
25519
+ for await (const tasks of src_default2(source, size5)) {
25152
25520
  const things = tasks.map(async (p) => {
25153
25521
  return p().then((value) => ({ ok: true, value }), (err) => ({ ok: false, err }));
25154
25522
  });
@@ -25191,16 +25559,16 @@ var fixedSize = (options = {}) => {
25191
25559
  }
25192
25560
  };
25193
25561
  };
25194
- var exports_src3 = {};
25195
- __export(exports_src3, {
25562
+ var exports_src6 = {};
25563
+ __export(exports_src6, {
25196
25564
  validate: () => validate5,
25197
25565
  prepare: () => prepare2,
25198
- name: () => name11,
25199
- encode: () => encode30,
25200
- decode: () => decode34,
25566
+ name: () => name12,
25567
+ encode: () => encode34,
25568
+ decode: () => decode38,
25201
25569
  createNode: () => createNode,
25202
25570
  createLink: () => createLink,
25203
- code: () => code14
25571
+ code: () => code16
25204
25572
  });
25205
25573
  var textDecoder3 = new TextDecoder();
25206
25574
  function decodeVarint2(bytes2, offset) {
@@ -25842,18 +26210,18 @@ function validate5(node) {
25842
26210
  function createNode(data, links = []) {
25843
26211
  return prepare2({ Data: data, Links: links });
25844
26212
  }
25845
- function createLink(name112, size5, cid) {
25846
- return asLink({ Hash: cid, Name: name112, Tsize: size5 });
26213
+ function createLink(name122, size5, cid) {
26214
+ return asLink({ Hash: cid, Name: name122, Tsize: size5 });
25847
26215
  }
25848
- function toByteView3(buf2) {
26216
+ function toByteView6(buf2) {
25849
26217
  if (buf2 instanceof ArrayBuffer) {
25850
26218
  return new Uint8Array(buf2, 0, buf2.byteLength);
25851
26219
  }
25852
26220
  return buf2;
25853
26221
  }
25854
- var name11 = "dag-pb";
25855
- var code14 = 112;
25856
- function encode30(node) {
26222
+ var name12 = "dag-pb";
26223
+ var code16 = 112;
26224
+ function encode34(node) {
25857
26225
  validate5(node);
25858
26226
  const pbn = {};
25859
26227
  if (node.Links) {
@@ -25876,8 +26244,8 @@ function encode30(node) {
25876
26244
  }
25877
26245
  return encodeNode(pbn);
25878
26246
  }
25879
- function decode34(bytes2) {
25880
- const buf2 = toByteView3(bytes2);
26247
+ function decode38(bytes2) {
26248
+ const buf2 = toByteView6(bytes2);
25881
26249
  const pbn = decodeNode(buf2);
25882
26250
  const node = {};
25883
26251
  if (pbn.Data) {
@@ -26820,12 +27188,12 @@ var CODEC_TYPES;
26820
27188
  CODEC_TYPES2[CODEC_TYPES2["END_GROUP"] = 4] = "END_GROUP";
26821
27189
  CODEC_TYPES2[CODEC_TYPES2["BIT32"] = 5] = "BIT32";
26822
27190
  })(CODEC_TYPES || (CODEC_TYPES = {}));
26823
- function createCodec2(name12, type5, encode31, decode35) {
27191
+ function createCodec2(name13, type5, encode35, decode39) {
26824
27192
  return {
26825
- name: name12,
27193
+ name: name13,
26826
27194
  type: type5,
26827
- encode: encode31,
26828
- decode: decode35
27195
+ encode: encode35,
27196
+ decode: decode39
26829
27197
  };
26830
27198
  }
26831
27199
  function enumeration(v) {
@@ -26835,18 +27203,18 @@ function enumeration(v) {
26835
27203
  }
26836
27204
  return v[val];
26837
27205
  }
26838
- const encode31 = function enumEncode(val, writer) {
27206
+ const encode35 = function enumEncode(val, writer) {
26839
27207
  const enumValue = findValue(val);
26840
27208
  writer.int32(enumValue);
26841
27209
  };
26842
- const decode35 = function enumDecode(reader) {
27210
+ const decode39 = function enumDecode(reader) {
26843
27211
  const val = reader.int32();
26844
27212
  return findValue(val);
26845
27213
  };
26846
- return createCodec2("enum", CODEC_TYPES.VARINT, encode31, decode35);
27214
+ return createCodec2("enum", CODEC_TYPES.VARINT, encode35, decode39);
26847
27215
  }
26848
- function message(encode31, decode35) {
26849
- return createCodec2("message", CODEC_TYPES.LENGTH_DELIMITED, encode31, decode35);
27216
+ function message(encode35, decode39) {
27217
+ return createCodec2("message", CODEC_TYPES.LENGTH_DELIMITED, encode35, decode39);
26850
27218
  }
26851
27219
  var Data;
26852
27220
  (function(Data2) {
@@ -27216,7 +27584,7 @@ class CustomProgressEvent extends Event {
27216
27584
  }
27217
27585
  var persist = async (buffer2, blockstore, options) => {
27218
27586
  if (options.codec == null) {
27219
- options.codec = exports_src3;
27587
+ options.codec = exports_src6;
27220
27588
  }
27221
27589
  const multihash = await sha2563.digest(buffer2);
27222
27590
  const cid = CID.create(options.cidVersion, options.codec.code, multihash);
@@ -27230,7 +27598,7 @@ function defaultBufferImporter(options) {
27230
27598
  yield async () => {
27231
27599
  let unixfs;
27232
27600
  const opts = {
27233
- codec: exports_src3,
27601
+ codec: exports_src6,
27234
27602
  cidVersion: options.cidVersion,
27235
27603
  onProgress: options.onProgress
27236
27604
  };
@@ -27242,7 +27610,7 @@ function defaultBufferImporter(options) {
27242
27610
  type: options.leafType,
27243
27611
  data: block
27244
27612
  });
27245
- block = encode30({
27613
+ block = encode34({
27246
27614
  Data: unixfs.marshal(),
27247
27615
  Links: []
27248
27616
  });
@@ -27279,7 +27647,7 @@ var defaultDirBuilder = async (dir, blockstore, options) => {
27279
27647
  mtime: dir.mtime,
27280
27648
  mode: dir.mode
27281
27649
  });
27282
- const block = encode30(prepare2({ Data: unixfs.marshal() }));
27650
+ const block = encode34(prepare2({ Data: unixfs.marshal() }));
27283
27651
  const cid = await persist(block, blockstore, options);
27284
27652
  const path22 = dir.path;
27285
27653
  return {
@@ -27335,7 +27703,7 @@ var reduce = (file, blockstore, options) => {
27335
27703
  data: leaf.block
27336
27704
  });
27337
27705
  node2 = { Data: leaf.unixfs.marshal(), Links: [] };
27338
- leaf.block = encode30(prepare2(node2));
27706
+ leaf.block = encode34(prepare2(node2));
27339
27707
  leaf.cid = await persist(leaf.block, blockstore, {
27340
27708
  ...options,
27341
27709
  cidVersion: options.cidVersion
@@ -27391,7 +27759,7 @@ var reduce = (file, blockstore, options) => {
27391
27759
  Data: f.marshal(),
27392
27760
  Links: links
27393
27761
  };
27394
- const block = encode30(prepare2(node));
27762
+ const block = encode34(prepare2(node));
27395
27763
  const cid = await persist(block, blockstore, options);
27396
27764
  options.onProgress?.(new CustomProgressEvent("unixfs:importer:progress:file:layout", {
27397
27765
  cid,
@@ -27414,7 +27782,7 @@ var defaultFileBuilder = async (file, block, options) => {
27414
27782
  function isIterable(thing) {
27415
27783
  return Symbol.iterator in thing;
27416
27784
  }
27417
- function isAsyncIterable2(thing) {
27785
+ function isAsyncIterable3(thing) {
27418
27786
  return Symbol.asyncIterator in thing;
27419
27787
  }
27420
27788
  function contentAsAsyncIterable(content2) {
@@ -27427,7 +27795,7 @@ function contentAsAsyncIterable(content2) {
27427
27795
  return (async function* () {
27428
27796
  yield* content2;
27429
27797
  })();
27430
- } else if (isAsyncIterable2(content2)) {
27798
+ } else if (isAsyncIterable3(content2)) {
27431
27799
  return content2;
27432
27800
  }
27433
27801
  } catch {
@@ -27506,7 +27874,7 @@ function balanced(options) {
27506
27874
  const maxChildrenPerNode = options?.maxChildrenPerNode ?? DEFAULT_MAX_CHILDREN_PER_NODE;
27507
27875
  return async function balancedLayout(source, reduce2) {
27508
27876
  const roots = [];
27509
- for await (const chunked of src_default(source, maxChildrenPerNode)) {
27877
+ for await (const chunked of src_default2(source, maxChildrenPerNode)) {
27510
27878
  roots.push(await reduce2(chunked));
27511
27879
  }
27512
27880
  if (roots.length > 1) {
@@ -27552,14 +27920,14 @@ class DirFlat extends Dir {
27552
27920
  super(props, options);
27553
27921
  this._children = /* @__PURE__ */ new Map();
27554
27922
  }
27555
- async put(name12, value) {
27923
+ async put(name13, value) {
27556
27924
  this.cid = void 0;
27557
27925
  this.size = void 0;
27558
27926
  this.nodeSize = void 0;
27559
- this._children.set(name12, value);
27927
+ this._children.set(name13, value);
27560
27928
  }
27561
- async get(name12) {
27562
- return Promise.resolve(this._children.get(name12));
27929
+ async get(name13) {
27930
+ return Promise.resolve(this._children.get(name13));
27563
27931
  }
27564
27932
  childCount() {
27565
27933
  return this._children.size;
@@ -27583,16 +27951,16 @@ class DirFlat extends Dir {
27583
27951
  return this.nodeSize;
27584
27952
  }
27585
27953
  this.nodeSize = 0;
27586
- for (const [name12, child] of this._children.entries()) {
27954
+ for (const [name13, child] of this._children.entries()) {
27587
27955
  if (child.size != null && child.cid != null) {
27588
- this.nodeSize += name12.length + (this.options.cidVersion === 1 ? CID_V1.bytes.byteLength : CID_V0.bytes.byteLength);
27956
+ this.nodeSize += name13.length + (this.options.cidVersion === 1 ? CID_V1.bytes.byteLength : CID_V0.bytes.byteLength);
27589
27957
  }
27590
27958
  }
27591
27959
  return this.nodeSize;
27592
27960
  }
27593
27961
  async *flush(block) {
27594
27962
  const links = [];
27595
- for (const [name12, child] of this._children.entries()) {
27963
+ for (const [name13, child] of this._children.entries()) {
27596
27964
  let result2 = child;
27597
27965
  if (child instanceof Dir) {
27598
27966
  for await (const entry of child.flush(block)) {
@@ -27602,7 +27970,7 @@ class DirFlat extends Dir {
27602
27970
  }
27603
27971
  if (result2.size != null && result2.cid != null) {
27604
27972
  links.push({
27605
- Name: name12,
27973
+ Name: name13,
27606
27974
  Tsize: Number(result2.size),
27607
27975
  Hash: result2.cid
27608
27976
  });
@@ -27614,7 +27982,7 @@ class DirFlat extends Dir {
27614
27982
  mode: this.mode
27615
27983
  });
27616
27984
  const node = { Data: unixfs.marshal(), Links: links };
27617
- const buffer2 = encode30(prepare2(node));
27985
+ const buffer2 = encode34(prepare2(node));
27618
27986
  const cid = await persist(buffer2, block, this.options);
27619
27987
  const size5 = buffer2.length + node.Links.reduce((acc, curr) => acc + (curr.Tsize ?? 0), 0);
27620
27988
  this.cid = cid;
@@ -28004,14 +28372,14 @@ class DirSharded extends Dir {
28004
28372
  bits: options.shardFanoutBits ?? DEFAULT_FANOUT_BITS
28005
28373
  });
28006
28374
  }
28007
- async put(name12, value) {
28375
+ async put(name13, value) {
28008
28376
  this.cid = void 0;
28009
28377
  this.size = void 0;
28010
28378
  this.nodeSize = void 0;
28011
- await this._bucket.put(name12, value);
28379
+ await this._bucket.put(name13, value);
28012
28380
  }
28013
- async get(name12) {
28014
- return this._bucket.get(name12);
28381
+ async get(name13) {
28382
+ return this._bucket.get(name13);
28015
28383
  }
28016
28384
  childCount() {
28017
28385
  return this._bucket.leafCount();
@@ -28117,7 +28485,7 @@ async function* flush2(bucket, blockstore, shardRoot, options) {
28117
28485
  Data: dir.marshal(),
28118
28486
  Links: links
28119
28487
  };
28120
- const buffer2 = encode30(prepare2(node));
28488
+ const buffer2 = encode34(prepare2(node));
28121
28489
  const cid = await persist(buffer2, blockstore, options);
28122
28490
  const size5 = BigInt(buffer2.byteLength) + childrenSize;
28123
28491
  yield {
@@ -28177,7 +28545,7 @@ function calculateSize(bucket, shardRoot, options) {
28177
28545
  mtime: shardRoot?.mtime,
28178
28546
  mode: shardRoot?.mode
28179
28547
  });
28180
- const buffer2 = encode30(prepare2({
28548
+ const buffer2 = encode34(prepare2({
28181
28549
  Data: dir.marshal(),
28182
28550
  Links: links
28183
28551
  }));
@@ -28362,8 +28730,20 @@ async function* importer(source, blockstore, options = {}) {
28362
28730
  }
28363
28731
  }
28364
28732
  var tmp = tmpdir();
28365
- var packCAR = async (files, name12, dir = tmp) => {
28366
- const output = `${dir}/${name12}.car`;
28733
+ var concatBytes4 = (chunks) => {
28734
+ let total = 0;
28735
+ for (const c of chunks)
28736
+ total += c.byteLength;
28737
+ const out = new Uint8Array(total);
28738
+ let offset = 0;
28739
+ for (const c of chunks) {
28740
+ out.set(c, offset);
28741
+ offset += c.byteLength;
28742
+ }
28743
+ return out;
28744
+ };
28745
+ var packCAR = async (files, name13, dir = tmp) => {
28746
+ const output = `${dir}/${name13}.car`;
28367
28747
  const blockstore = new MemoryBlockstore();
28368
28748
  let rootCID = null;
28369
28749
  for await (const entry of importer(files, blockstore, {
@@ -28381,10 +28761,12 @@ var packCAR = async (files, name12, dir = tmp) => {
28381
28761
  writeStream.write(chunk);
28382
28762
  }
28383
28763
  })();
28384
- for await (const { cid } of blockstore.getAll()) {
28764
+ for await (const { cid, bytes: bytes2 } of blockstore.getAll()) {
28385
28765
  try {
28386
- const bytes2 = await blockstore.get(cid);
28387
- await writer.put({ cid, bytes: bytes2 });
28766
+ await writer.put({
28767
+ cid,
28768
+ bytes: concatBytes4(await Array.fromAsync(bytes2))
28769
+ });
28388
28770
  } catch (error3) {
28389
28771
  console.warn(`Failed to add block ${cid.toString()} to CAR:`, error3);
28390
28772
  }
@@ -28412,7 +28794,7 @@ var updateDnsLink = async ({
28412
28794
  cid,
28413
28795
  zoneId,
28414
28796
  apiKey,
28415
- name: name12,
28797
+ name: name13,
28416
28798
  verbose
28417
28799
  }) => {
28418
28800
  const res = await fetch(`${CLOUDFLARE_API_URL}/zones/${zoneId}/web3/hostnames`, {
@@ -28427,7 +28809,7 @@ var updateDnsLink = async ({
28427
28809
  throw new DnsLinkError(json.errors[0].message);
28428
28810
  if (!json.result.length)
28429
28811
  throw new MissingDnsLinkError();
28430
- const record = json.result.find((item) => name12 === item.name);
28812
+ const record = json.result.find((item) => name13 === item.name);
28431
28813
  if (!record)
28432
28814
  throw new MissingDnsLinkError();
28433
28815
  const res2 = await fetch(`${CLOUDFLARE_API_URL}/zones/${zoneId}/web3/hostnames/${record.id}`, {
@@ -28447,7 +28829,7 @@ var updateDnsLink = async ({
28447
28829
  };
28448
28830
  var dnsLinkAction = async ({
28449
28831
  cid,
28450
- name: name12,
28832
+ name: name13,
28451
28833
  options = {}
28452
28834
  }) => {
28453
28835
  const { verbose = false } = options;
@@ -28459,7 +28841,7 @@ var dnsLinkAction = async ({
28459
28841
  throw new MissingKeyError(`CF_ZONE_ID`);
28460
28842
  logger.info(`Updating DNSLink`);
28461
28843
  try {
28462
- const response = await updateDnsLink({ cid, zoneId, apiKey, name: name12, verbose });
28844
+ const response = await updateDnsLink({ cid, zoneId, apiKey, name: name13, verbose });
28463
28845
  if (response.errors.length !== 0)
28464
28846
  return logger.error(response.errors[0].message);
28465
28847
  logger.success(`https://${response.result.name} now points to ${response.result.dnslink}`);
@@ -28654,14 +29036,14 @@ function read_replacement_table(w, next) {
28654
29036
  function read_trie(next) {
28655
29037
  let ret = [];
28656
29038
  let sorted = read_sorted(next);
28657
- expand(decode35([]), []);
29039
+ expand(decode39([]), []);
28658
29040
  return ret;
28659
- function decode35(Q) {
29041
+ function decode39(Q) {
28660
29042
  let S = next();
28661
29043
  let B = read_array_while(() => {
28662
29044
  let cps = read_sorted(next).map((i) => sorted[i]);
28663
29045
  if (cps.length)
28664
- return decode35(cps);
29046
+ return decode39(cps);
28665
29047
  });
28666
29048
  return { S, B, Q };
28667
29049
  }
@@ -29084,15 +29466,15 @@ function should_escape(cp) {
29084
29466
  init();
29085
29467
  return ESCAPE.has(cp);
29086
29468
  }
29087
- function ens_normalize(name12) {
29088
- return flatten(split3(name12, nfc, filter_fe0f));
29469
+ function ens_normalize(name13) {
29470
+ return flatten(split3(name13, nfc, filter_fe0f));
29089
29471
  }
29090
- function split3(name12, nf, ef) {
29091
- if (!name12)
29472
+ function split3(name13, nf, ef) {
29473
+ if (!name13)
29092
29474
  return [];
29093
29475
  init();
29094
29476
  let offset = 0;
29095
- return name12.split(STOP_CH).map((label) => {
29477
+ return name13.split(STOP_CH).map((label) => {
29096
29478
  let input2 = explode_cp(label);
29097
29479
  let info = {
29098
29480
  input: input2,
@@ -29300,11 +29682,11 @@ function labelhash(label) {
29300
29682
  return fromBytes(result2);
29301
29683
  return unwrapLabelhash(label) || keccak256(fromString(label));
29302
29684
  }
29303
- function namehash(name12) {
29685
+ function namehash(name13) {
29304
29686
  let result2 = new Uint8Array(32).fill(0);
29305
- if (!name12)
29687
+ if (!name13)
29306
29688
  return fromBytes(result2);
29307
- const labels = name12.split(".");
29689
+ const labels = name13.split(".");
29308
29690
  for (let i = labels.length - 1; i >= 0; i -= 1) {
29309
29691
  const hashFromEncodedLabel = unwrapLabelhash(labels[i]);
29310
29692
  const hashed = hashFromEncodedLabel ? fromHex(hashFromEncodedLabel) : keccak256(fromString2(labels[i]), { as: "Bytes" });
@@ -29312,8 +29694,8 @@ function namehash(name12) {
29312
29694
  }
29313
29695
  return fromBytes(result2);
29314
29696
  }
29315
- function normalize(name12) {
29316
- return ens_normalize(name12);
29697
+ function normalize(name13) {
29698
+ return ens_normalize(name13);
29317
29699
  }
29318
29700
  var abi14 = {
29319
29701
  constant: true,
@@ -29334,7 +29716,7 @@ var abi14 = {
29334
29716
  stateMutability: "view",
29335
29717
  type: "function"
29336
29718
  };
29337
- var encodeEnsAddressRecordRequest = (name12) => encodeData2(abi14, [namehash(name12)]);
29719
+ var encodeEnsAddressRecordRequest = (name13) => encodeData2(abi14, [namehash(name13)]);
29338
29720
  var abi15 = {
29339
29721
  inputs: [
29340
29722
  {
@@ -29394,15 +29776,15 @@ function packetToBytes(packet) {
29394
29776
  }
29395
29777
  var resolveEnsName = async ({
29396
29778
  provider,
29397
- name: name12
29779
+ name: name13
29398
29780
  }) => {
29399
29781
  const result2 = await provider.request({
29400
29782
  method: "eth_call",
29401
29783
  params: [
29402
29784
  {
29403
29785
  data: encodeData2(abi15, [
29404
- toHex(packetToBytes(name12)),
29405
- encodeEnsAddressRecordRequest(name12)
29786
+ toHex(packetToBytes(name13)),
29787
+ encodeEnsAddressRecordRequest(name13)
29406
29788
  ]),
29407
29789
  to: "0xeEeEEEeE14D718C2B47D9923Deab1335E144EeEe"
29408
29790
  },
@@ -29475,19 +29857,19 @@ var prepareUpdateEnsArgs = ({
29475
29857
  codec: codec2 = "ipfs"
29476
29858
  }) => {
29477
29859
  const node = namehash(normalize(domain));
29478
- let code15;
29860
+ let code17;
29479
29861
  let bytes2;
29480
29862
  switch (codec2) {
29481
29863
  case "ipfs":
29482
- code15 = IFPS_CODEC;
29864
+ code17 = IFPS_CODEC;
29483
29865
  bytes2 = CID.parse(cid).toV1().bytes;
29484
29866
  break;
29485
29867
  case "swarm":
29486
- code15 = SWARM_CODEC;
29868
+ code17 = SWARM_CODEC;
29487
29869
  bytes2 = referenceToCID(`0x${cid}`).bytes;
29488
29870
  break;
29489
29871
  }
29490
- const codeBytes = Uint8Array.from(varint6.encode(code15));
29872
+ const codeBytes = Uint8Array.from(varint6.encode(code17));
29491
29873
  return {
29492
29874
  contentHash: toHex(concatUint8Arrays(codeBytes, bytes2)).slice(2),
29493
29875
  node
@@ -29897,23 +30279,25 @@ Open in a browser: ${isTTY ? styleText2("underline", safeLink) : safeLink}`);
29897
30279
  data,
29898
30280
  from: from25
29899
30281
  });
29900
- const hash2 = await sendTransaction({
29901
- privateKey: pk,
29902
- provider,
29903
- chainId: chain.id,
29904
- to: resolverAddress,
29905
- data,
29906
- from: from25
29907
- });
29908
- logger.info(`Transaction pending: ${chain.blockExplorers.default.url}/tx/${hash2}`);
29909
- try {
29910
- await waitForTransaction(provider, hash2);
29911
- } catch (e) {
29912
- return logger.error(e);
30282
+ if (!dryRun) {
30283
+ const hash2 = await sendTransaction({
30284
+ privateKey: pk,
30285
+ provider,
30286
+ chainId: chain.id,
30287
+ to: resolverAddress,
30288
+ data,
30289
+ from: from25
30290
+ });
30291
+ logger.info(`Transaction pending: ${chain.blockExplorers.default.url}/tx/${hash2}`);
30292
+ try {
30293
+ await waitForTransaction(provider, hash2);
30294
+ } catch (e) {
30295
+ return logger.error(e);
30296
+ }
30297
+ logger.success("Transaction succeeded");
30298
+ const browserLink = `https://${domain}.limo`;
30299
+ logger.info(`Open in a browser: ${isTTY ? styleText2("underline", browserLink) : browserLink}`);
29913
30300
  }
29914
- logger.success("Transaction succeeded");
29915
- const browserLink = `https://${domain}.limo`;
29916
- logger.info(`Open in a browser: ${isTTY ? styleText2("underline", browserLink) : browserLink}`);
29917
30301
  }
29918
30302
  };
29919
30303
  function createTar(files, opts = {}) {
@@ -30039,21 +30423,21 @@ var packAction = async ({
30039
30423
  dir = ".";
30040
30424
  }
30041
30425
  const normalizedPath = path2.join(process.cwd(), dir);
30042
- const name12 = customName || path2.basename(normalizedPath);
30426
+ const name13 = customName || path2.basename(normalizedPath);
30043
30427
  const [size5, files] = await walk2(normalizedPath, verbose);
30044
30428
  if (size5 === 0)
30045
30429
  throw new MissingDirectoryError(dir);
30046
- const distName = [".", "dist"].includes(dir) ? name12 : dir;
30430
+ const distName = [".", "dist"].includes(dir) ? name13 : dir;
30047
30431
  logger.start(`Packing ${isTTY ? styleText3("cyan", distName) : distName} (${fileSize(size5, 2)})`);
30048
30432
  if (tar) {
30049
30433
  const tar2 = await packTAR(files);
30050
30434
  const blob4 = new Blob([tar2]);
30051
30435
  return { blob: blob4, size: size5 };
30052
30436
  } else {
30053
- const { rootCID, blob: blob4 } = await packCAR(files, name12, dist);
30437
+ const { rootCID, blob: blob4 } = await packCAR(files, name13, dist);
30054
30438
  const cid = rootCID.toString();
30055
30439
  logger.info(`Root CID: ${isTTY ? styleText3("white", cid) : cid}`);
30056
- return { name: name12, cid, blob: blob4, files, size: size5 };
30440
+ return { name: name13, cid, blob: blob4, files, size: size5 };
30057
30441
  }
30058
30442
  };
30059
30443
  var AsciiBar = import_ascii_bar.default.default;
@@ -30093,7 +30477,7 @@ var deployAction = async ({
30093
30477
  logger.info(`Deploying with providers: ${(swarmProviders.length ? swarmProviders : ipfsProviders).map((p) => p.name).join(", ")}`);
30094
30478
  let cid = void 0;
30095
30479
  const {
30096
- name: name12,
30480
+ name: name13,
30097
30481
  cid: ipfsCid,
30098
30482
  blob: blob4,
30099
30483
  size: size5
@@ -30156,7 +30540,7 @@ var deployAction = async ({
30156
30540
  throw new MissingKeyError("FILECOIN_SP_URL");
30157
30541
  try {
30158
30542
  await provider.upload({
30159
- name: name12,
30543
+ name: name13,
30160
30544
  car: blob4,
30161
30545
  token,
30162
30546
  bucketName,
@@ -30641,7 +31025,7 @@ cli.command("ping", ([cid, endpoint], options) => pingAction({
30641
31025
  }
30642
31026
  ]
30643
31027
  });
30644
- cli.command("dnslink", ([cid, name12], options) => dnsLinkAction({ cid, name: name12, options }), {
31028
+ cli.command("dnslink", ([cid, name13], options) => dnsLinkAction({ cid, name: name13, options }), {
30645
31029
  options: [
30646
31030
  {
30647
31031
  name: "verbose",