nostr-double-ratchet 0.0.5 → 0.0.6

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.
@@ -1,7 +1,7 @@
1
1
  var oi = Object.defineProperty;
2
2
  var si = (e, t, n) => t in e ? oi(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
3
  var ee = (e, t, n) => si(e, typeof t != "symbol" ? t + "" : t, n);
4
- function mn(e) {
4
+ function En(e) {
5
5
  if (!Number.isSafeInteger(e) || e < 0)
6
6
  throw new Error(`Wrong positive integer: ${e}`);
7
7
  }
@@ -14,7 +14,7 @@ function Pn(e, ...t) {
14
14
  function ai(e) {
15
15
  if (typeof e != "function" || typeof e.create != "function")
16
16
  throw new Error("Hash should be wrapped by utils.wrapConstructor");
17
- mn(e.outputLen), mn(e.blockLen);
17
+ En(e.outputLen), En(e.blockLen);
18
18
  }
19
19
  function rt(e, t = !0) {
20
20
  if (e.destroyed)
@@ -28,9 +28,9 @@ function ci(e, t) {
28
28
  if (e.length < n)
29
29
  throw new Error(`digestInto() expects output buffer of length at least ${n}`);
30
30
  }
31
- const At = typeof globalThis == "object" && "crypto" in globalThis ? globalThis.crypto : void 0;
31
+ const St = typeof globalThis == "object" && "crypto" in globalThis ? globalThis.crypto : void 0;
32
32
  /*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
33
- const On = (e) => e instanceof Uint8Array, St = (e) => new DataView(e.buffer, e.byteOffset, e.byteLength), ne = (e, t) => e << 32 - t | e >>> t, li = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
33
+ const On = (e) => e instanceof Uint8Array, At = (e) => new DataView(e.buffer, e.byteOffset, e.byteLength), ne = (e, t) => e << 32 - t | e >>> t, li = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
34
34
  if (!li)
35
35
  throw new Error("Non little-endian hardware is not supported");
36
36
  function ui(e) {
@@ -63,8 +63,8 @@ function hi(e) {
63
63
  return t.outputLen = n.outputLen, t.blockLen = n.blockLen, t.create = () => e(), t;
64
64
  }
65
65
  function Hn(e = 32) {
66
- if (At && typeof At.getRandomValues == "function")
67
- return At.getRandomValues(new Uint8Array(e));
66
+ if (St && typeof St.getRandomValues == "function")
67
+ return St.getRandomValues(new Uint8Array(e));
68
68
  throw new Error("crypto.getRandomValues must be defined");
69
69
  }
70
70
  function di(e, t, n, r) {
@@ -75,7 +75,7 @@ function di(e, t, n, r) {
75
75
  }
76
76
  let yi = class extends Mn {
77
77
  constructor(t, n, r, i) {
78
- super(), this.blockLen = t, this.outputLen = n, this.padOffset = r, this.isLE = i, this.finished = !1, this.length = 0, this.pos = 0, this.destroyed = !1, this.buffer = new Uint8Array(t), this.view = St(this.buffer);
78
+ super(), this.blockLen = t, this.outputLen = n, this.padOffset = r, this.isLE = i, this.finished = !1, this.length = 0, this.pos = 0, this.destroyed = !1, this.buffer = new Uint8Array(t), this.view = At(this.buffer);
79
79
  }
80
80
  update(t) {
81
81
  rt(this);
@@ -85,7 +85,7 @@ let yi = class extends Mn {
85
85
  for (let s = 0; s < o; ) {
86
86
  const c = Math.min(i - this.pos, o - s);
87
87
  if (c === i) {
88
- const a = St(t);
88
+ const a = At(t);
89
89
  for (; i <= o - s; s += i)
90
90
  this.process(a, s);
91
91
  continue;
@@ -102,7 +102,7 @@ let yi = class extends Mn {
102
102
  for (let u = s; u < i; u++)
103
103
  n[u] = 0;
104
104
  di(r, i - 8, BigInt(this.length * 8), o), this.process(r, 0);
105
- const c = St(t), a = this.outputLen;
105
+ const c = At(t), a = this.outputLen;
106
106
  if (a % 4)
107
107
  throw new Error("_sha2: outputLen should be aligned to 32bit");
108
108
  const l = a / 4, f = this.get();
@@ -233,13 +233,13 @@ let bi = class extends yi {
233
233
  };
234
234
  const Lt = /* @__PURE__ */ hi(() => new bi());
235
235
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
236
- const qn = BigInt(0), lt = BigInt(1), vi = BigInt(2), ut = (e) => e instanceof Uint8Array, mi = /* @__PURE__ */ Array.from({ length: 256 }, (e, t) => t.toString(16).padStart(2, "0"));
236
+ const qn = BigInt(0), lt = BigInt(1), vi = BigInt(2), ut = (e) => e instanceof Uint8Array, Ei = /* @__PURE__ */ Array.from({ length: 256 }, (e, t) => t.toString(16).padStart(2, "0"));
237
237
  function He(e) {
238
238
  if (!ut(e))
239
239
  throw new Error("Uint8Array expected");
240
240
  let t = "";
241
241
  for (let n = 0; n < e.length; n++)
242
- t += mi[e[n]];
242
+ t += Ei[e[n]];
243
243
  return t;
244
244
  }
245
245
  function Dn(e) {
@@ -280,7 +280,7 @@ function xe(e, t) {
280
280
  function Wt(e, t) {
281
281
  return xe(e, t).reverse();
282
282
  }
283
- function Ei(e) {
283
+ function mi(e) {
284
284
  return qe(Dn(e));
285
285
  }
286
286
  function Z(e, t, n) {
@@ -317,12 +317,12 @@ function xi(e, t) {
317
317
  return !1;
318
318
  return !0;
319
319
  }
320
- function Ai(e) {
320
+ function Si(e) {
321
321
  if (typeof e != "string")
322
322
  throw new Error(`utf8ToBytes expected string, got ${typeof e}`);
323
323
  return new Uint8Array(new TextEncoder().encode(e));
324
324
  }
325
- function Si(e) {
325
+ function Ai(e) {
326
326
  let t;
327
327
  for (t = 0; e > qn; e >>= lt, t += 1)
328
328
  ;
@@ -331,7 +331,7 @@ function Si(e) {
331
331
  function Ki(e, t) {
332
332
  return e >> BigInt(t) & lt;
333
333
  }
334
- const Bi = (e, t, n) => e | (n ? lt : qn) << BigInt(t), Gt = (e) => (vi << BigInt(e - 1)) - lt, Kt = (e) => new Uint8Array(e), En = (e) => Uint8Array.from(e);
334
+ const Ni = (e, t, n) => e | (n ? lt : qn) << BigInt(t), Gt = (e) => (vi << BigInt(e - 1)) - lt, Kt = (e) => new Uint8Array(e), mn = (e) => Uint8Array.from(e);
335
335
  function jn(e, t, n) {
336
336
  if (typeof e != "number" || e < 2)
337
337
  throw new Error("hashLen must be a number");
@@ -343,7 +343,7 @@ function jn(e, t, n) {
343
343
  const s = () => {
344
344
  r.fill(1), i.fill(0), o = 0;
345
345
  }, c = (...u) => n(i, r, ...u), a = (u = Kt()) => {
346
- i = c(En([0]), u), r = c(), u.length !== 0 && (i = c(En([1]), u), r = c());
346
+ i = c(mn([0]), u), r = c(), u.length !== 0 && (i = c(mn([1]), u), r = c());
347
347
  }, l = () => {
348
348
  if (o++ >= 1e3)
349
349
  throw new Error("drbg: tried 1000 values");
@@ -364,7 +364,7 @@ function jn(e, t, n) {
364
364
  return s(), p;
365
365
  };
366
366
  }
367
- const Ni = {
367
+ const Bi = {
368
368
  bigint: (e) => typeof e == "bigint",
369
369
  function: (e) => typeof e == "function",
370
370
  boolean: (e) => typeof e == "boolean",
@@ -377,7 +377,7 @@ const Ni = {
377
377
  };
378
378
  function Je(e, t, n = {}) {
379
379
  const r = (i, o, s) => {
380
- const c = Ni[o];
380
+ const c = Bi[o];
381
381
  if (typeof c != "function")
382
382
  throw new Error(`Invalid validator "${o}", expected function`);
383
383
  const a = e[i];
@@ -393,9 +393,9 @@ function Je(e, t, n = {}) {
393
393
  const Ci = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
394
394
  __proto__: null,
395
395
  bitGet: Ki,
396
- bitLen: Si,
396
+ bitLen: Ai,
397
397
  bitMask: Gt,
398
- bitSet: Bi,
398
+ bitSet: Ni,
399
399
  bytesToHex: He,
400
400
  bytesToNumberBE: G,
401
401
  bytesToNumberLE: Ft,
@@ -408,12 +408,12 @@ const Ci = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
408
408
  numberToBytesBE: xe,
409
409
  numberToBytesLE: Wt,
410
410
  numberToHexUnpadded: Dn,
411
- numberToVarBytesBE: Ei,
412
- utf8ToBytes: Ai,
411
+ numberToVarBytesBE: mi,
412
+ utf8ToBytes: Si,
413
413
  validateObject: Je
414
414
  }, Symbol.toStringTag, { value: "Module" }));
415
415
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
416
- const j = BigInt(0), q = BigInt(1), Be = BigInt(2), Ii = BigInt(3), $t = BigInt(4), xn = BigInt(5), An = BigInt(8);
416
+ const j = BigInt(0), q = BigInt(1), Ne = BigInt(2), Ii = BigInt(3), $t = BigInt(4), xn = BigInt(5), Sn = BigInt(8);
417
417
  BigInt(9);
418
418
  BigInt(16);
419
419
  function V(e, t) {
@@ -449,11 +449,11 @@ function Tt(e, t) {
449
449
  return V(i, t);
450
450
  }
451
451
  function ki(e) {
452
- const t = (e - q) / Be;
452
+ const t = (e - q) / Ne;
453
453
  let n, r, i;
454
- for (n = e - q, r = 0; n % Be === j; n /= Be, r++)
454
+ for (n = e - q, r = 0; n % Ne === j; n /= Ne, r++)
455
455
  ;
456
- for (i = Be; i < e && Ui(i, t, e) !== e - q; i++)
456
+ for (i = Ne; i < e && Ui(i, t, e) !== e - q; i++)
457
457
  ;
458
458
  if (r === 1) {
459
459
  const s = (e + q) / $t;
@@ -464,7 +464,7 @@ function ki(e) {
464
464
  return f;
465
465
  };
466
466
  }
467
- const o = (n + q) / Be;
467
+ const o = (n + q) / Ne;
468
468
  return function(c, a) {
469
469
  if (c.pow(a, t) === c.neg(c.ONE))
470
470
  throw new Error("Cannot find square root");
@@ -491,10 +491,10 @@ function _i(e) {
491
491
  return o;
492
492
  };
493
493
  }
494
- if (e % An === xn) {
495
- const t = (e - xn) / An;
494
+ if (e % Sn === xn) {
495
+ const t = (e - xn) / Sn;
496
496
  return function(r, i) {
497
- const o = r.mul(i, Be), s = r.pow(o, t), c = r.mul(i, s), a = r.mul(r.mul(c, Be), s), l = r.mul(c, r.sub(a, r.ONE));
497
+ const o = r.mul(i, Ne), s = r.pow(o, t), c = r.mul(i, s), a = r.mul(r.mul(c, Ne), s), l = r.mul(c, r.sub(a, r.ONE));
498
498
  if (!r.eql(r.sqr(l), i))
499
499
  throw new Error("Cannot find square root");
500
500
  return l;
@@ -617,7 +617,7 @@ function Oi(e, t, n = !1) {
617
617
  return n ? Wt(c, i) : xe(c, i);
618
618
  }
619
619
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
620
- const Mi = BigInt(0), Bt = BigInt(1);
620
+ const Mi = BigInt(0), Nt = BigInt(1);
621
621
  function Hi(e, t) {
622
622
  const n = (i, o) => {
623
623
  const s = o.negate();
@@ -632,7 +632,7 @@ function Hi(e, t) {
632
632
  unsafeLadder(i, o) {
633
633
  let s = e.ZERO, c = i;
634
634
  for (; o > Mi; )
635
- o & Bt && (s = s.add(c)), c = c.double(), o >>= Bt;
635
+ o & Nt && (s = s.add(c)), c = c.double(), o >>= Nt;
636
636
  return s;
637
637
  },
638
638
  /**
@@ -670,9 +670,9 @@ function Hi(e, t) {
670
670
  for (let g = 0; g < c; g++) {
671
671
  const h = g * a;
672
672
  let y = Number(s & u);
673
- s >>= p, y > a && (y -= d, s += Bt);
674
- const w = h, E = h + Math.abs(y) - 1, K = g % 2 !== 0, k = y < 0;
675
- y === 0 ? f = f.add(n(K, o[w])) : l = l.add(n(k, o[E]));
673
+ s >>= p, y > a && (y -= d, s += Nt);
674
+ const w = h, m = h + Math.abs(y) - 1, K = g % 2 !== 0, k = y < 0;
675
+ y === 0 ? f = f.add(n(K, o[w])) : l = l.add(n(k, o[m]));
676
676
  }
677
677
  return { p: l, f };
678
678
  },
@@ -722,7 +722,7 @@ function qi(e) {
722
722
  }
723
723
  return Object.freeze({ ...t });
724
724
  }
725
- const { bytesToNumberBE: Di, hexToBytes: ji } = Ci, Ne = {
725
+ const { bytesToNumberBE: Di, hexToBytes: ji } = Ci, Be = {
726
726
  // asn.1 DER encoding utils
727
727
  Err: class extends Error {
728
728
  constructor(t = "") {
@@ -730,7 +730,7 @@ const { bytesToNumberBE: Di, hexToBytes: ji } = Ci, Ne = {
730
730
  }
731
731
  },
732
732
  _parseInt(e) {
733
- const { Err: t } = Ne;
733
+ const { Err: t } = Be;
734
734
  if (e.length < 2 || e[0] !== 2)
735
735
  throw new t("Invalid signature integer tag");
736
736
  const n = e[1], r = e.subarray(2, n + 2);
@@ -743,7 +743,7 @@ const { bytesToNumberBE: Di, hexToBytes: ji } = Ci, Ne = {
743
743
  return { d: Di(r), l: e.subarray(n + 2) };
744
744
  },
745
745
  toSig(e) {
746
- const { Err: t } = Ne, n = typeof e == "string" ? ji(e) : e;
746
+ const { Err: t } = Be, n = typeof e == "string" ? ji(e) : e;
747
747
  if (!(n instanceof Uint8Array))
748
748
  throw new Error("ui8a expected");
749
749
  let r = n.length;
@@ -751,7 +751,7 @@ const { bytesToNumberBE: Di, hexToBytes: ji } = Ci, Ne = {
751
751
  throw new t("Invalid signature tag");
752
752
  if (n[1] !== r - 2)
753
753
  throw new t("Invalid signature: incorrect length");
754
- const { d: i, l: o } = Ne._parseInt(n.subarray(2)), { d: s, l: c } = Ne._parseInt(o);
754
+ const { d: i, l: o } = Be._parseInt(n.subarray(2)), { d: s, l: c } = Be._parseInt(o);
755
755
  if (c.length)
756
756
  throw new t("Invalid signature: left bytes after parsing");
757
757
  return { r: i, s };
@@ -765,7 +765,7 @@ const { bytesToNumberBE: Di, hexToBytes: ji } = Ci, Ne = {
765
765
  }
766
766
  }, ce = BigInt(0), Y = BigInt(1);
767
767
  BigInt(2);
768
- const Sn = BigInt(3);
768
+ const An = BigInt(3);
769
769
  BigInt(4);
770
770
  function zi(e) {
771
771
  const t = qi(e), { Fp: n } = t, r = t.toBytes || ((g, h, y) => {
@@ -776,8 +776,8 @@ function zi(e) {
776
776
  return { x: y, y: w };
777
777
  });
778
778
  function o(g) {
779
- const { a: h, b: y } = t, w = n.sqr(g), E = n.mul(w, g);
780
- return n.add(n.add(E, n.mul(g, h)), y);
779
+ const { a: h, b: y } = t, w = n.sqr(g), m = n.mul(w, g);
780
+ return n.add(n.add(m, n.mul(g, h)), y);
781
781
  }
782
782
  if (!n.eql(n.sqr(t.Gy), o(t.Gx)))
783
783
  throw new Error("bad generator point: equation left != right");
@@ -789,7 +789,7 @@ function zi(e) {
789
789
  throw new Error("Expected valid bigint: 0 < bigint < curve.n");
790
790
  }
791
791
  function a(g) {
792
- const { allowedPrivateKeyLengths: h, nByteLength: y, wrapPrivateKey: w, n: E } = t;
792
+ const { allowedPrivateKeyLengths: h, nByteLength: y, wrapPrivateKey: w, n: m } = t;
793
793
  if (h && typeof g != "bigint") {
794
794
  if (g instanceof Uint8Array && (g = He(g)), typeof g != "string" || !h.includes(g.length))
795
795
  throw new Error("Invalid key");
@@ -801,7 +801,7 @@ function zi(e) {
801
801
  } catch {
802
802
  throw new Error(`private key must be ${y} bytes, hex or bigint, not ${typeof g}`);
803
803
  }
804
- return w && (K = V(K, E)), c(K), K;
804
+ return w && (K = V(K, m)), c(K), K;
805
805
  }
806
806
  const l = /* @__PURE__ */ new Map();
807
807
  function f(g) {
@@ -825,8 +825,8 @@ function zi(e) {
825
825
  throw new Error("invalid affine point");
826
826
  if (h instanceof u)
827
827
  throw new Error("projective point not allowed");
828
- const E = (K) => n.eql(K, n.ZERO);
829
- return E(y) && E(w) ? u.ZERO : new u(y, w, n.ONE);
828
+ const m = (K) => n.eql(K, n.ZERO);
829
+ return m(y) && m(w) ? u.ZERO : new u(y, w, n.ONE);
830
830
  }
831
831
  get x() {
832
832
  return this.toAffine().x;
@@ -842,7 +842,7 @@ function zi(e) {
842
842
  */
843
843
  static normalizeZ(h) {
844
844
  const y = n.invertBatch(h.map((w) => w.pz));
845
- return h.map((w, E) => w.toAffine(y[E])).map(u.fromAffine);
845
+ return h.map((w, m) => w.toAffine(y[m])).map(u.fromAffine);
846
846
  }
847
847
  /**
848
848
  * Converts hash string or Uint8Array to Point.
@@ -870,8 +870,8 @@ function zi(e) {
870
870
  const { x: h, y } = this.toAffine();
871
871
  if (!n.isValid(h) || !n.isValid(y))
872
872
  throw new Error("bad point: x or y not FE");
873
- const w = n.sqr(y), E = o(h);
874
- if (!n.eql(w, E))
873
+ const w = n.sqr(y), m = o(h);
874
+ if (!n.eql(w, m))
875
875
  throw new Error("bad point: equation left != right");
876
876
  if (!this.isTorsionFree())
877
877
  throw new Error("bad point: not in prime-order subgroup");
@@ -887,8 +887,8 @@ function zi(e) {
887
887
  */
888
888
  equals(h) {
889
889
  f(h);
890
- const { px: y, py: w, pz: E } = this, { px: K, py: k, pz: C } = h, m = n.eql(n.mul(y, C), n.mul(K, E)), x = n.eql(n.mul(w, C), n.mul(k, E));
891
- return m && x;
890
+ const { px: y, py: w, pz: m } = this, { px: K, py: k, pz: C } = h, E = n.eql(n.mul(y, C), n.mul(K, m)), x = n.eql(n.mul(w, C), n.mul(k, m));
891
+ return E && x;
892
892
  }
893
893
  /**
894
894
  * Flips point to one corresponding to (x, -y) in Affine coordinates.
@@ -901,9 +901,9 @@ function zi(e) {
901
901
  // https://eprint.iacr.org/2015/1060, algorithm 3
902
902
  // Cost: 8M + 3S + 3*a + 2*b3 + 15add.
903
903
  double() {
904
- const { a: h, b: y } = t, w = n.mul(y, Sn), { px: E, py: K, pz: k } = this;
905
- let C = n.ZERO, m = n.ZERO, x = n.ZERO, A = n.mul(E, E), O = n.mul(K, K), U = n.mul(k, k), B = n.mul(E, K);
906
- return B = n.add(B, B), x = n.mul(E, k), x = n.add(x, x), C = n.mul(h, x), m = n.mul(w, U), m = n.add(C, m), C = n.sub(O, m), m = n.add(O, m), m = n.mul(C, m), C = n.mul(B, C), x = n.mul(w, x), U = n.mul(h, U), B = n.sub(A, U), B = n.mul(h, B), B = n.add(B, x), x = n.add(A, A), A = n.add(x, A), A = n.add(A, U), A = n.mul(A, B), m = n.add(m, A), U = n.mul(K, k), U = n.add(U, U), A = n.mul(U, B), C = n.sub(C, A), x = n.mul(U, O), x = n.add(x, x), x = n.add(x, x), new u(C, m, x);
904
+ const { a: h, b: y } = t, w = n.mul(y, An), { px: m, py: K, pz: k } = this;
905
+ let C = n.ZERO, E = n.ZERO, x = n.ZERO, S = n.mul(m, m), O = n.mul(K, K), U = n.mul(k, k), N = n.mul(m, K);
906
+ return N = n.add(N, N), x = n.mul(m, k), x = n.add(x, x), C = n.mul(h, x), E = n.mul(w, U), E = n.add(C, E), C = n.sub(O, E), E = n.add(O, E), E = n.mul(C, E), C = n.mul(N, C), x = n.mul(w, x), U = n.mul(h, U), N = n.sub(S, U), N = n.mul(h, N), N = n.add(N, x), x = n.add(S, S), S = n.add(x, S), S = n.add(S, U), S = n.mul(S, N), E = n.add(E, S), U = n.mul(K, k), U = n.add(U, U), S = n.mul(U, N), C = n.sub(C, S), x = n.mul(U, O), x = n.add(x, x), x = n.add(x, x), new u(C, E, x);
907
907
  }
908
908
  // Renes-Costello-Batina exception-free addition formula.
909
909
  // There is 30% faster Jacobian formula, but it is not complete.
@@ -911,13 +911,13 @@ function zi(e) {
911
911
  // Cost: 12M + 0S + 3*a + 3*b3 + 23add.
912
912
  add(h) {
913
913
  f(h);
914
- const { px: y, py: w, pz: E } = this, { px: K, py: k, pz: C } = h;
915
- let m = n.ZERO, x = n.ZERO, A = n.ZERO;
916
- const O = t.a, U = n.mul(t.b, Sn);
917
- let B = n.mul(y, K), T = n.mul(w, k), R = n.mul(E, C), H = n.add(y, w), b = n.add(K, k);
918
- H = n.mul(H, b), b = n.add(B, T), H = n.sub(H, b), b = n.add(y, E);
914
+ const { px: y, py: w, pz: m } = this, { px: K, py: k, pz: C } = h;
915
+ let E = n.ZERO, x = n.ZERO, S = n.ZERO;
916
+ const O = t.a, U = n.mul(t.b, An);
917
+ let N = n.mul(y, K), T = n.mul(w, k), R = n.mul(m, C), H = n.add(y, w), b = n.add(K, k);
918
+ H = n.mul(H, b), b = n.add(N, T), H = n.sub(H, b), b = n.add(y, m);
919
919
  let v = n.add(K, C);
920
- return b = n.mul(b, v), v = n.add(B, R), b = n.sub(b, v), v = n.add(w, E), m = n.add(k, C), v = n.mul(v, m), m = n.add(T, R), v = n.sub(v, m), A = n.mul(O, b), m = n.mul(U, R), A = n.add(m, A), m = n.sub(T, A), A = n.add(T, A), x = n.mul(m, A), T = n.add(B, B), T = n.add(T, B), R = n.mul(O, R), b = n.mul(U, b), T = n.add(T, R), R = n.sub(B, R), R = n.mul(O, R), b = n.add(b, R), B = n.mul(T, b), x = n.add(x, B), B = n.mul(v, b), m = n.mul(H, m), m = n.sub(m, B), B = n.mul(H, T), A = n.mul(v, A), A = n.add(A, B), new u(m, x, A);
920
+ return b = n.mul(b, v), v = n.add(N, R), b = n.sub(b, v), v = n.add(w, m), E = n.add(k, C), v = n.mul(v, E), E = n.add(T, R), v = n.sub(v, E), S = n.mul(O, b), E = n.mul(U, R), S = n.add(E, S), E = n.sub(T, S), S = n.add(T, S), x = n.mul(E, S), T = n.add(N, N), T = n.add(T, N), R = n.mul(O, R), b = n.mul(U, b), T = n.add(T, R), R = n.sub(N, R), R = n.mul(O, R), b = n.add(b, R), N = n.mul(T, b), x = n.add(x, N), N = n.mul(v, b), E = n.mul(H, E), E = n.sub(E, N), N = n.mul(H, T), S = n.mul(v, S), S = n.add(S, N), new u(E, x, S);
921
921
  }
922
922
  subtract(h) {
923
923
  return this.add(h.negate());
@@ -927,8 +927,8 @@ function zi(e) {
927
927
  }
928
928
  wNAF(h) {
929
929
  return p.wNAFCached(this, l, h, (y) => {
930
- const w = n.invertBatch(y.map((E) => E.pz));
931
- return y.map((E, K) => E.toAffine(w[K])).map(u.fromAffine);
930
+ const w = n.invertBatch(y.map((m) => m.pz));
931
+ return y.map((m, K) => m.toAffine(w[K])).map(u.fromAffine);
932
932
  });
933
933
  }
934
934
  /**
@@ -945,10 +945,10 @@ function zi(e) {
945
945
  const { endo: w } = t;
946
946
  if (!w)
947
947
  return p.unsafeLadder(this, h);
948
- let { k1neg: E, k1: K, k2neg: k, k2: C } = w.splitScalar(h), m = y, x = y, A = this;
948
+ let { k1neg: m, k1: K, k2neg: k, k2: C } = w.splitScalar(h), E = y, x = y, S = this;
949
949
  for (; K > ce || C > ce; )
950
- K & Y && (m = m.add(A)), C & Y && (x = x.add(A)), A = A.double(), K >>= Y, C >>= Y;
951
- return E && (m = m.negate()), k && (x = x.negate()), x = new u(n.mul(x.px, w.beta), x.py, x.pz), m.add(x);
950
+ K & Y && (E = E.add(S)), C & Y && (x = x.add(S)), S = S.double(), K >>= Y, C >>= Y;
951
+ return m && (E = E.negate()), k && (x = x.negate()), x = new u(n.mul(x.px, w.beta), x.py, x.pz), E.add(x);
952
952
  }
953
953
  /**
954
954
  * Constant time multiplication.
@@ -961,17 +961,17 @@ function zi(e) {
961
961
  */
962
962
  multiply(h) {
963
963
  c(h);
964
- let y = h, w, E;
964
+ let y = h, w, m;
965
965
  const { endo: K } = t;
966
966
  if (K) {
967
- const { k1neg: k, k1: C, k2neg: m, k2: x } = K.splitScalar(y);
968
- let { p: A, f: O } = this.wNAF(C), { p: U, f: B } = this.wNAF(x);
969
- A = p.constTimeNegate(k, A), U = p.constTimeNegate(m, U), U = new u(n.mul(U.px, K.beta), U.py, U.pz), w = A.add(U), E = O.add(B);
967
+ const { k1neg: k, k1: C, k2neg: E, k2: x } = K.splitScalar(y);
968
+ let { p: S, f: O } = this.wNAF(C), { p: U, f: N } = this.wNAF(x);
969
+ S = p.constTimeNegate(k, S), U = p.constTimeNegate(E, U), U = new u(n.mul(U.px, K.beta), U.py, U.pz), w = S.add(U), m = O.add(N);
970
970
  } else {
971
971
  const { p: k, f: C } = this.wNAF(y);
972
- w = k, E = C;
972
+ w = k, m = C;
973
973
  }
974
- return u.normalizeZ([w, E])[0];
974
+ return u.normalizeZ([w, m])[0];
975
975
  }
976
976
  /**
977
977
  * Efficiently calculate `aP + bQ`. Unsafe, can expose private key, if used incorrectly.
@@ -980,19 +980,19 @@ function zi(e) {
980
980
  * @returns non-zero affine point
981
981
  */
982
982
  multiplyAndAddUnsafe(h, y, w) {
983
- const E = u.BASE, K = (C, m) => m === ce || m === Y || !C.equals(E) ? C.multiplyUnsafe(m) : C.multiply(m), k = K(this, y).add(K(h, w));
983
+ const m = u.BASE, K = (C, E) => E === ce || E === Y || !C.equals(m) ? C.multiplyUnsafe(E) : C.multiply(E), k = K(this, y).add(K(h, w));
984
984
  return k.is0() ? void 0 : k;
985
985
  }
986
986
  // Converts Projective point to affine (x, y) coordinates.
987
987
  // Can accept precomputed Z^-1 - for example, from invertBatch.
988
988
  // (x, y, z) ∋ (x=x/z, y=y/z)
989
989
  toAffine(h) {
990
- const { px: y, py: w, pz: E } = this, K = this.is0();
991
- h == null && (h = K ? n.ONE : n.inv(E));
992
- const k = n.mul(y, h), C = n.mul(w, h), m = n.mul(E, h);
990
+ const { px: y, py: w, pz: m } = this, K = this.is0();
991
+ h == null && (h = K ? n.ONE : n.inv(m));
992
+ const k = n.mul(y, h), C = n.mul(w, h), E = n.mul(m, h);
993
993
  if (K)
994
994
  return { x: n.ZERO, y: n.ZERO };
995
- if (!n.eql(m, n.ONE))
995
+ if (!n.eql(E, n.ONE))
996
996
  throw new Error("invZ was invalid");
997
997
  return { x: k, y: C };
998
998
  }
@@ -1050,23 +1050,23 @@ function Zi(e) {
1050
1050
  }
1051
1051
  const { ProjectivePoint: l, normPrivateKeyToScalar: f, weierstrassEquation: u, isWithinCurveOrder: d } = zi({
1052
1052
  ...t,
1053
- toBytes(b, v, S) {
1054
- const I = v.toAffine(), N = n.toBytes(I.x), _ = Ie;
1055
- return S ? _(Uint8Array.from([v.hasEvenY() ? 2 : 3]), N) : _(Uint8Array.from([4]), N, n.toBytes(I.y));
1053
+ toBytes(b, v, A) {
1054
+ const I = v.toAffine(), B = n.toBytes(I.x), _ = Ie;
1055
+ return A ? _(Uint8Array.from([v.hasEvenY() ? 2 : 3]), B) : _(Uint8Array.from([4]), B, n.toBytes(I.y));
1056
1056
  },
1057
1057
  fromBytes(b) {
1058
- const v = b.length, S = b[0], I = b.subarray(1);
1059
- if (v === i && (S === 2 || S === 3)) {
1060
- const N = G(I);
1061
- if (!s(N))
1058
+ const v = b.length, A = b[0], I = b.subarray(1);
1059
+ if (v === i && (A === 2 || A === 3)) {
1060
+ const B = G(I);
1061
+ if (!s(B))
1062
1062
  throw new Error("Point is not on curve");
1063
- const _ = u(N);
1063
+ const _ = u(B);
1064
1064
  let P = n.sqrt(_);
1065
1065
  const $ = (P & Y) === Y;
1066
- return (S & 1) === 1 !== $ && (P = n.neg(P)), { x: N, y: P };
1067
- } else if (v === o && S === 4) {
1068
- const N = n.fromBytes(I.subarray(0, n.BYTES)), _ = n.fromBytes(I.subarray(n.BYTES, 2 * n.BYTES));
1069
- return { x: N, y: _ };
1066
+ return (A & 1) === 1 !== $ && (P = n.neg(P)), { x: B, y: P };
1067
+ } else if (v === o && A === 4) {
1068
+ const B = n.fromBytes(I.subarray(0, n.BYTES)), _ = n.fromBytes(I.subarray(n.BYTES, 2 * n.BYTES));
1069
+ return { x: B, y: _ };
1070
1070
  } else
1071
1071
  throw new Error(`Point of length ${v} was invalid. Expected ${i} compressed bytes or ${o} uncompressed bytes`);
1072
1072
  }
@@ -1078,21 +1078,21 @@ function Zi(e) {
1078
1078
  function h(b) {
1079
1079
  return g(b) ? c(-b) : b;
1080
1080
  }
1081
- const y = (b, v, S) => G(b.slice(v, S));
1081
+ const y = (b, v, A) => G(b.slice(v, A));
1082
1082
  class w {
1083
- constructor(v, S, I) {
1084
- this.r = v, this.s = S, this.recovery = I, this.assertValidity();
1083
+ constructor(v, A, I) {
1084
+ this.r = v, this.s = A, this.recovery = I, this.assertValidity();
1085
1085
  }
1086
1086
  // pair (bytes of r, bytes of s)
1087
1087
  static fromCompact(v) {
1088
- const S = t.nByteLength;
1089
- return v = Z("compactSignature", v, S * 2), new w(y(v, 0, S), y(v, S, 2 * S));
1088
+ const A = t.nByteLength;
1089
+ return v = Z("compactSignature", v, A * 2), new w(y(v, 0, A), y(v, A, 2 * A));
1090
1090
  }
1091
1091
  // DER encoded ECDSA signature
1092
1092
  // https://bitcoin.stackexchange.com/questions/57644/what-are-the-parts-of-a-bitcoin-transaction-input-script
1093
1093
  static fromDER(v) {
1094
- const { r: S, s: I } = Ne.toSig(Z("DER", v));
1095
- return new w(S, I);
1094
+ const { r: A, s: I } = Be.toSig(Z("DER", v));
1095
+ return new w(A, I);
1096
1096
  }
1097
1097
  assertValidity() {
1098
1098
  if (!d(this.r))
@@ -1104,13 +1104,13 @@ function Zi(e) {
1104
1104
  return new w(this.r, this.s, v);
1105
1105
  }
1106
1106
  recoverPublicKey(v) {
1107
- const { r: S, s: I, recovery: N } = this, _ = x(Z("msgHash", v));
1108
- if (N == null || ![0, 1, 2, 3].includes(N))
1107
+ const { r: A, s: I, recovery: B } = this, _ = x(Z("msgHash", v));
1108
+ if (B == null || ![0, 1, 2, 3].includes(B))
1109
1109
  throw new Error("recovery id invalid");
1110
- const P = N === 2 || N === 3 ? S + t.n : S;
1110
+ const P = B === 2 || B === 3 ? A + t.n : A;
1111
1111
  if (P >= n.ORDER)
1112
1112
  throw new Error("recovery id 2 or 3 invalid");
1113
- const $ = N & 1 ? "03" : "02", X = l.fromHex($ + p(P)), ye = a(P), ke = c(-_ * ye), ze = c(I * ye), pe = l.BASE.multiplyAndAddUnsafe(X, ke, ze);
1113
+ const $ = B & 1 ? "03" : "02", X = l.fromHex($ + p(P)), ye = a(P), ke = c(-_ * ye), ze = c(I * ye), pe = l.BASE.multiplyAndAddUnsafe(X, ke, ze);
1114
1114
  if (!pe)
1115
1115
  throw new Error("point at infinify");
1116
1116
  return pe.assertValidity(), pe;
@@ -1127,7 +1127,7 @@ function Zi(e) {
1127
1127
  return qe(this.toDERHex());
1128
1128
  }
1129
1129
  toDERHex() {
1130
- return Ne.hexFromSig({ r: this.r, s: this.s });
1130
+ return Be.hexFromSig({ r: this.r, s: this.s });
1131
1131
  }
1132
1132
  // padded bytes of r, then padded bytes of s
1133
1133
  toCompactRawBytes() {
@@ -1137,7 +1137,7 @@ function Zi(e) {
1137
1137
  return p(this.r) + p(this.s);
1138
1138
  }
1139
1139
  }
1140
- const E = {
1140
+ const m = {
1141
1141
  isValidPrivateKey(b) {
1142
1142
  try {
1143
1143
  return f(b), !0;
@@ -1170,43 +1170,43 @@ function Zi(e) {
1170
1170
  return l.fromPrivateKey(b).toRawBytes(v);
1171
1171
  }
1172
1172
  function k(b) {
1173
- const v = b instanceof Uint8Array, S = typeof b == "string", I = (v || S) && b.length;
1174
- return v ? I === i || I === o : S ? I === 2 * i || I === 2 * o : b instanceof l;
1173
+ const v = b instanceof Uint8Array, A = typeof b == "string", I = (v || A) && b.length;
1174
+ return v ? I === i || I === o : A ? I === 2 * i || I === 2 * o : b instanceof l;
1175
1175
  }
1176
- function C(b, v, S = !0) {
1176
+ function C(b, v, A = !0) {
1177
1177
  if (k(b))
1178
1178
  throw new Error("first arg must be private key");
1179
1179
  if (!k(v))
1180
1180
  throw new Error("second arg must be public key");
1181
- return l.fromHex(v).multiply(f(b)).toRawBytes(S);
1181
+ return l.fromHex(v).multiply(f(b)).toRawBytes(A);
1182
1182
  }
1183
- const m = t.bits2int || function(b) {
1184
- const v = G(b), S = b.length * 8 - t.nBitLength;
1185
- return S > 0 ? v >> BigInt(S) : v;
1183
+ const E = t.bits2int || function(b) {
1184
+ const v = G(b), A = b.length * 8 - t.nBitLength;
1185
+ return A > 0 ? v >> BigInt(A) : v;
1186
1186
  }, x = t.bits2int_modN || function(b) {
1187
- return c(m(b));
1188
- }, A = Gt(t.nBitLength);
1187
+ return c(E(b));
1188
+ }, S = Gt(t.nBitLength);
1189
1189
  function O(b) {
1190
1190
  if (typeof b != "bigint")
1191
1191
  throw new Error("bigint expected");
1192
- if (!(ce <= b && b < A))
1192
+ if (!(ce <= b && b < S))
1193
1193
  throw new Error(`bigint expected < 2^${t.nBitLength}`);
1194
1194
  return xe(b, t.nByteLength);
1195
1195
  }
1196
- function U(b, v, S = B) {
1197
- if (["recovered", "canonical"].some((Ke) => Ke in S))
1196
+ function U(b, v, A = N) {
1197
+ if (["recovered", "canonical"].some((Ke) => Ke in A))
1198
1198
  throw new Error("sign() legacy options not supported");
1199
- const { hash: I, randomBytes: N } = t;
1200
- let { lowS: _, prehash: P, extraEntropy: $ } = S;
1199
+ const { hash: I, randomBytes: B } = t;
1200
+ let { lowS: _, prehash: P, extraEntropy: $ } = A;
1201
1201
  _ == null && (_ = !0), b = Z("msgHash", b), P && (b = Z("prehashed msgHash", I(b)));
1202
1202
  const X = x(b), ye = f(v), ke = [O(ye), O(X)];
1203
1203
  if ($ != null) {
1204
- const Ke = $ === !0 ? N(n.BYTES) : $;
1204
+ const Ke = $ === !0 ? B(n.BYTES) : $;
1205
1205
  ke.push(Z("extraEntropy", Ke));
1206
1206
  }
1207
1207
  const ze = Ie(...ke), pe = X;
1208
1208
  function xt(Ke) {
1209
- const _e = m(Ke);
1209
+ const _e = E(Ke);
1210
1210
  if (!d(_e))
1211
1211
  return;
1212
1212
  const wn = a(_e), Le = l.BASE.multiply(_e).toAffine(), Q = c(Le.x);
@@ -1220,34 +1220,34 @@ function Zi(e) {
1220
1220
  }
1221
1221
  return { seed: ze, k2sig: xt };
1222
1222
  }
1223
- const B = { lowS: t.lowS, prehash: !1 }, T = { lowS: t.lowS, prehash: !1 };
1224
- function R(b, v, S = B) {
1225
- const { seed: I, k2sig: N } = U(b, v, S), _ = t;
1226
- return jn(_.hash.outputLen, _.nByteLength, _.hmac)(I, N);
1223
+ const N = { lowS: t.lowS, prehash: !1 }, T = { lowS: t.lowS, prehash: !1 };
1224
+ function R(b, v, A = N) {
1225
+ const { seed: I, k2sig: B } = U(b, v, A), _ = t;
1226
+ return jn(_.hash.outputLen, _.nByteLength, _.hmac)(I, B);
1227
1227
  }
1228
1228
  l.BASE._setWindowSize(8);
1229
- function H(b, v, S, I = T) {
1229
+ function H(b, v, A, I = T) {
1230
1230
  var Le;
1231
- const N = b;
1232
- if (v = Z("msgHash", v), S = Z("publicKey", S), "strict" in I)
1231
+ const B = b;
1232
+ if (v = Z("msgHash", v), A = Z("publicKey", A), "strict" in I)
1233
1233
  throw new Error("options.strict was renamed to lowS");
1234
1234
  const { lowS: _, prehash: P } = I;
1235
1235
  let $, X;
1236
1236
  try {
1237
- if (typeof N == "string" || N instanceof Uint8Array)
1237
+ if (typeof B == "string" || B instanceof Uint8Array)
1238
1238
  try {
1239
- $ = w.fromDER(N);
1239
+ $ = w.fromDER(B);
1240
1240
  } catch (Q) {
1241
- if (!(Q instanceof Ne.Err))
1241
+ if (!(Q instanceof Be.Err))
1242
1242
  throw Q;
1243
- $ = w.fromCompact(N);
1243
+ $ = w.fromCompact(B);
1244
1244
  }
1245
- else if (typeof N == "object" && typeof N.r == "bigint" && typeof N.s == "bigint") {
1246
- const { r: Q, s: $e } = N;
1245
+ else if (typeof B == "object" && typeof B.r == "bigint" && typeof B.s == "bigint") {
1246
+ const { r: Q, s: $e } = B;
1247
1247
  $ = new w(Q, $e);
1248
1248
  } else
1249
1249
  throw new Error("PARSE");
1250
- X = l.fromHex(S);
1250
+ X = l.fromHex(A);
1251
1251
  } catch (Q) {
1252
1252
  if (Q.message === "PARSE")
1253
1253
  throw new Error("signature must be Signature instance, Uint8Array or hex string");
@@ -1267,7 +1267,7 @@ function Zi(e) {
1267
1267
  verify: H,
1268
1268
  ProjectivePoint: l,
1269
1269
  Signature: w,
1270
- utils: E
1270
+ utils: m
1271
1271
  };
1272
1272
  }
1273
1273
  let Wn = class extends Mn {
@@ -1322,10 +1322,10 @@ function Wi(e, t) {
1322
1322
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
1323
1323
  const ft = BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"), it = BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"), Jn = BigInt(1), ot = BigInt(2), Kn = (e, t) => (e + t / ot) / t;
1324
1324
  function Yn(e) {
1325
- const t = ft, n = BigInt(3), r = BigInt(6), i = BigInt(11), o = BigInt(22), s = BigInt(23), c = BigInt(44), a = BigInt(88), l = e * e * e % t, f = l * l * e % t, u = J(f, n, t) * f % t, d = J(u, n, t) * f % t, p = J(d, ot, t) * l % t, g = J(p, i, t) * p % t, h = J(g, o, t) * g % t, y = J(h, c, t) * h % t, w = J(y, a, t) * y % t, E = J(w, c, t) * h % t, K = J(E, n, t) * f % t, k = J(K, s, t) * g % t, C = J(k, r, t) * l % t, m = J(C, ot, t);
1326
- if (!Rt.eql(Rt.sqr(m), e))
1325
+ const t = ft, n = BigInt(3), r = BigInt(6), i = BigInt(11), o = BigInt(22), s = BigInt(23), c = BigInt(44), a = BigInt(88), l = e * e * e % t, f = l * l * e % t, u = J(f, n, t) * f % t, d = J(u, n, t) * f % t, p = J(d, ot, t) * l % t, g = J(p, i, t) * p % t, h = J(g, o, t) * g % t, y = J(h, c, t) * h % t, w = J(y, a, t) * y % t, m = J(w, c, t) * h % t, K = J(m, n, t) * f % t, k = J(K, s, t) * g % t, C = J(k, r, t) * l % t, E = J(C, ot, t);
1326
+ if (!Rt.eql(Rt.sqr(E), e))
1327
1327
  throw new Error("Cannot find square root");
1328
- return m;
1328
+ return E;
1329
1329
  }
1330
1330
  const Rt = Pi(ft, void 0, void 0, { sqrt: Yn }), Ue = Wi({
1331
1331
  a: BigInt(0),
@@ -1354,16 +1354,16 @@ const Rt = Pi(ft, void 0, void 0, { sqrt: Yn }), Ue = Wi({
1354
1354
  return { k1neg: u, k1: l, k2neg: d, k2: f };
1355
1355
  }
1356
1356
  }
1357
- }, Lt), ht = BigInt(0), Xn = (e) => typeof e == "bigint" && ht < e && e < ft, Gi = (e) => typeof e == "bigint" && ht < e && e < it, Bn = {};
1357
+ }, Lt), ht = BigInt(0), Xn = (e) => typeof e == "bigint" && ht < e && e < ft, Gi = (e) => typeof e == "bigint" && ht < e && e < it, Nn = {};
1358
1358
  function st(e, ...t) {
1359
- let n = Bn[e];
1359
+ let n = Nn[e];
1360
1360
  if (n === void 0) {
1361
1361
  const r = Lt(Uint8Array.from(e, (i) => i.charCodeAt(0)));
1362
- n = Ie(r, r), Bn[e] = n;
1362
+ n = Ie(r, r), Nn[e] = n;
1363
1363
  }
1364
1364
  return Lt(Ie(n, ...t));
1365
1365
  }
1366
- const Jt = (e) => e.toRawBytes(!0).slice(1), Pt = (e) => xe(e, 32), Nt = (e) => V(e, ft), We = (e) => V(e, it), Yt = Ue.ProjectivePoint, Ji = (e, t, n) => Yt.BASE.multiplyAndAddUnsafe(e, t, n);
1366
+ const Jt = (e) => e.toRawBytes(!0).slice(1), Pt = (e) => xe(e, 32), Bt = (e) => V(e, ft), We = (e) => V(e, it), Yt = Ue.ProjectivePoint, Ji = (e, t, n) => Yt.BASE.multiplyAndAddUnsafe(e, t, n);
1367
1367
  function Ot(e) {
1368
1368
  let t = Ue.utils.normPrivateKeyToScalar(e), n = Yt.fromPrivateKey(t);
1369
1369
  return { scalar: n.hasEvenY() ? t : We(-t), bytes: Jt(n) };
@@ -1371,9 +1371,9 @@ function Ot(e) {
1371
1371
  function Qn(e) {
1372
1372
  if (!Xn(e))
1373
1373
  throw new Error("bad x: need 0 < x < p");
1374
- const t = Nt(e * e), n = Nt(t * e + BigInt(7));
1374
+ const t = Bt(e * e), n = Bt(t * e + BigInt(7));
1375
1375
  let r = Yn(n);
1376
- r % ot !== ht && (r = Nt(-r));
1376
+ r % ot !== ht && (r = Bt(-r));
1377
1377
  const i = new Yt(e, r, Jn);
1378
1378
  return i.assertValidity(), i;
1379
1379
  }
@@ -1691,7 +1691,7 @@ class fo extends sr {
1691
1691
  super(), this.A = -1056596264, this.B = 914150663, this.C = 812702999, this.D = -150054599, this.E = -4191439, this.F = 1750603025, this.G = 1694076839, this.H = -1090891868, this.outputLen = 28;
1692
1692
  }
1693
1693
  }
1694
- const Ae = rr(() => new sr());
1694
+ const Se = rr(() => new sr());
1695
1695
  rr(() => new fo());
1696
1696
  /*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) */
1697
1697
  function je(e) {
@@ -1781,7 +1781,7 @@ function ar(e) {
1781
1781
  throw new Error("normalize fn should be function");
1782
1782
  return { encode: (t) => t, decode: (t) => e(t) };
1783
1783
  }
1784
- function Nn(e, t, n) {
1784
+ function Bn(e, t, n) {
1785
1785
  if (t < 2)
1786
1786
  throw new Error(`convertRadix: wrong from=${t}, base cannot be less than 2`);
1787
1787
  if (n < 2)
@@ -1846,16 +1846,16 @@ function ho(e) {
1846
1846
  encode: (t) => {
1847
1847
  if (!(t instanceof Uint8Array))
1848
1848
  throw new Error("radix.encode input should be Uint8Array");
1849
- return Nn(Array.from(t), 2 ** 8, e);
1849
+ return Bn(Array.from(t), 2 ** 8, e);
1850
1850
  },
1851
1851
  decode: (t) => {
1852
1852
  if (!Array.isArray(t) || t.length && typeof t[0] != "number")
1853
1853
  throw new Error("radix.decode input should be array of strings");
1854
- return Uint8Array.from(Nn(t, e, 2 ** 8));
1854
+ return Uint8Array.from(Bn(t, e, 2 ** 8));
1855
1855
  }
1856
1856
  };
1857
1857
  }
1858
- function Se(e, t = !1) {
1858
+ function Ae(e, t = !1) {
1859
1859
  if (je(e), e <= 0 || e > 32)
1860
1860
  throw new Error("radix2: bits should be in (0..32]");
1861
1861
  if (at(8, e) > 32 || at(e, 8) > 32)
@@ -1883,10 +1883,10 @@ function Cn(e) {
1883
1883
  }
1884
1884
  };
1885
1885
  }
1886
- const yo = fe(Se(4), he("0123456789ABCDEF"), de("")), po = fe(Se(5), he("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"), yt(5), de(""));
1887
- fe(Se(5), he("0123456789ABCDEFGHIJKLMNOPQRSTUV"), yt(5), de(""));
1888
- fe(Se(5), he("0123456789ABCDEFGHJKMNPQRSTVWXYZ"), de(""), ar((e) => e.toUpperCase().replace(/O/g, "0").replace(/[IL]/g, "1")));
1889
- const ue = fe(Se(6), he("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"), yt(6), de("")), go = fe(Se(6), he("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"), yt(6), de("")), Qt = (e) => fe(ho(58), he(e), de("")), qt = Qt("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");
1886
+ const yo = fe(Ae(4), he("0123456789ABCDEF"), de("")), po = fe(Ae(5), he("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"), yt(5), de(""));
1887
+ fe(Ae(5), he("0123456789ABCDEFGHIJKLMNOPQRSTUV"), yt(5), de(""));
1888
+ fe(Ae(5), he("0123456789ABCDEFGHJKMNPQRSTVWXYZ"), de(""), ar((e) => e.toUpperCase().replace(/O/g, "0").replace(/[IL]/g, "1")));
1889
+ const ue = fe(Ae(6), he("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"), yt(6), de("")), go = fe(Ae(6), he("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"), yt(6), de("")), Qt = (e) => fe(ho(58), he(e), de("")), qt = Qt("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");
1890
1890
  Qt("123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ");
1891
1891
  Qt("rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz");
1892
1892
  const In = [0, 2, 3, 5, 6, 7, 9, 10, 11], wo = {
@@ -1936,7 +1936,7 @@ function kn(e, t, n = 1) {
1936
1936
  return i ^= n, Dt.encode(Ht([i % 2 ** 30], 30, 5, !1));
1937
1937
  }
1938
1938
  function lr(e) {
1939
- const t = e === "bech32" ? 1 : 734539939, n = Se(5), r = n.decode, i = n.encode, o = Cn(r);
1939
+ const t = e === "bech32" ? 1 : 734539939, n = Ae(5), r = n.decode, i = n.encode, o = Cn(r);
1940
1940
  function s(f, u, d = 90) {
1941
1941
  if (typeof f != "string")
1942
1942
  throw new Error(`bech32.encode prefix should be string, not ${typeof f}`);
@@ -1979,11 +1979,11 @@ lr("bech32m");
1979
1979
  const bo = {
1980
1980
  encode: (e) => new TextDecoder().decode(e),
1981
1981
  decode: (e) => new TextEncoder().encode(e)
1982
- }, vo = fe(Se(4), he("0123456789abcdef"), de(""), ar((e) => {
1982
+ }, vo = fe(Ae(4), he("0123456789abcdef"), de(""), ar((e) => {
1983
1983
  if (typeof e != "string" || e.length % 2)
1984
1984
  throw new TypeError(`hex.decode: expected string, got ${typeof e} with length ${e.length}`);
1985
1985
  return e.toLowerCase();
1986
- })), mo = {
1986
+ })), Eo = {
1987
1987
  utf8: bo,
1988
1988
  hex: vo,
1989
1989
  base16: yo,
@@ -1993,7 +1993,7 @@ const bo = {
1993
1993
  base58: qt,
1994
1994
  base58xmr: wo
1995
1995
  };
1996
- `${Object.keys(mo).join(", ")}`;
1996
+ `${Object.keys(Eo).join(", ")}`;
1997
1997
  function Ut(e) {
1998
1998
  if (!Number.isSafeInteger(e) || e < 0)
1999
1999
  throw new Error(`positive integer expected, not ${e}`);
@@ -2002,11 +2002,11 @@ function _n(e) {
2002
2002
  if (typeof e != "boolean")
2003
2003
  throw new Error(`boolean expected, not ${e}`);
2004
2004
  }
2005
- function Eo(e) {
2005
+ function mo(e) {
2006
2006
  return e instanceof Uint8Array || e != null && typeof e == "object" && e.constructor.name === "Uint8Array";
2007
2007
  }
2008
2008
  function le(e, ...t) {
2009
- if (!Eo(e))
2009
+ if (!mo(e))
2010
2010
  throw new Error("Uint8Array expected");
2011
2011
  if (t.length > 0 && !t.includes(e.length))
2012
2012
  throw new Error(`Uint8Array expected of length ${t}, not of length=${e.length}`);
@@ -2015,12 +2015,12 @@ function le(e, ...t) {
2015
2015
  const F = (e) => new Uint32Array(e.buffer, e.byteOffset, Math.floor(e.byteLength / 4)), xo = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
2016
2016
  if (!xo)
2017
2017
  throw new Error("Non little-endian hardware is not supported");
2018
- function Ao(e, t) {
2018
+ function So(e, t) {
2019
2019
  if (t == null || typeof t != "object")
2020
2020
  throw new Error("options must be defined");
2021
2021
  return Object.assign(e, t);
2022
2022
  }
2023
- function So(e, t) {
2023
+ function Ao(e, t) {
2024
2024
  if (e.length !== t.length)
2025
2025
  return !1;
2026
2026
  let n = 0;
@@ -2028,9 +2028,9 @@ function So(e, t) {
2028
2028
  n |= e[r] ^ t[r];
2029
2029
  return n === 0;
2030
2030
  }
2031
- const Ko = /* @__NO_SIDE_EFFECTS__ */ (e, t) => (Object.assign(t, e), t), Ee = 16, Bo = 283;
2031
+ const Ko = /* @__NO_SIDE_EFFECTS__ */ (e, t) => (Object.assign(t, e), t), me = 16, No = 283;
2032
2032
  function en(e) {
2033
- return e << 1 ^ Bo & -(e >> 7);
2033
+ return e << 1 ^ No & -(e >> 7);
2034
2034
  }
2035
2035
  function Pe(e, t) {
2036
2036
  let n = 0;
@@ -2049,7 +2049,7 @@ const jt = /* @__PURE__ */ (() => {
2049
2049
  r |= r << 8, t[e[n]] = (r ^ r >> 4 ^ r >> 5 ^ r >> 6 ^ r >> 7 ^ 99) & 255;
2050
2050
  }
2051
2051
  return t;
2052
- })(), No = /* @__PURE__ */ jt.map((e, t) => jt.indexOf(t)), Co = (e) => e << 24 | e >>> 8, kt = (e) => e << 8 | e >>> 24;
2052
+ })(), Bo = /* @__PURE__ */ jt.map((e, t) => jt.indexOf(t)), Co = (e) => e << 24 | e >>> 8, kt = (e) => e << 8 | e >>> 24;
2053
2053
  function ur(e, t) {
2054
2054
  if (e.length !== 256)
2055
2055
  throw new Error("Wrong sbox length");
@@ -2061,7 +2061,7 @@ function ur(e, t) {
2061
2061
  }
2062
2062
  return { sbox: e, sbox2: a, T0: n, T1: r, T2: i, T3: o, T01: s, T23: c };
2063
2063
  }
2064
- const tn = /* @__PURE__ */ ur(jt, (e) => Pe(e, 3) << 24 | e << 16 | e << 8 | Pe(e, 2)), fr = /* @__PURE__ */ ur(No, (e) => Pe(e, 11) << 24 | Pe(e, 13) << 16 | Pe(e, 9) << 8 | Pe(e, 14)), Io = /* @__PURE__ */ (() => {
2064
+ const tn = /* @__PURE__ */ ur(jt, (e) => Pe(e, 3) << 24 | e << 16 | e << 8 | Pe(e, 2)), fr = /* @__PURE__ */ ur(Bo, (e) => Pe(e, 11) << 24 | Pe(e, 13) << 16 | Pe(e, 9) << 8 | Pe(e, 14)), Io = /* @__PURE__ */ (() => {
2065
2065
  const e = new Uint8Array(16);
2066
2066
  for (let t = 0, n = 1; t < 16; t++, n = en(n))
2067
2067
  e[t] = n;
@@ -2092,7 +2092,7 @@ function Uo(e) {
2092
2092
  }
2093
2093
  return n;
2094
2094
  }
2095
- function me(e, t, n, r, i, o) {
2095
+ function Ee(e, t, n, r, i, o) {
2096
2096
  return e[n << 8 & 65280 | r >>> 8 & 255] ^ t[i >>> 8 & 65280 | o >>> 24 & 255];
2097
2097
  }
2098
2098
  function se(e, t, n, r, i) {
@@ -2104,8 +2104,8 @@ function Ln(e, t, n, r, i) {
2104
2104
  t ^= e[a++], n ^= e[a++], r ^= e[a++], i ^= e[a++];
2105
2105
  const l = e.length / 4 - 2;
2106
2106
  for (let g = 0; g < l; g++) {
2107
- const h = e[a++] ^ me(s, c, t, n, r, i), y = e[a++] ^ me(s, c, n, r, i, t), w = e[a++] ^ me(s, c, r, i, t, n), E = e[a++] ^ me(s, c, i, t, n, r);
2108
- t = h, n = y, r = w, i = E;
2107
+ const h = e[a++] ^ Ee(s, c, t, n, r, i), y = e[a++] ^ Ee(s, c, n, r, i, t), w = e[a++] ^ Ee(s, c, r, i, t, n), m = e[a++] ^ Ee(s, c, i, t, n, r);
2108
+ t = h, n = y, r = w, i = m;
2109
2109
  }
2110
2110
  const f = e[a++] ^ se(o, t, n, r, i), u = e[a++] ^ se(o, n, r, i, t), d = e[a++] ^ se(o, r, i, t, n), p = e[a++] ^ se(o, i, t, n, r);
2111
2111
  return { s0: f, s1: u, s2: d, s3: p };
@@ -2116,8 +2116,8 @@ function ko(e, t, n, r, i) {
2116
2116
  t ^= e[a++], n ^= e[a++], r ^= e[a++], i ^= e[a++];
2117
2117
  const l = e.length / 4 - 2;
2118
2118
  for (let g = 0; g < l; g++) {
2119
- const h = e[a++] ^ me(s, c, t, i, r, n), y = e[a++] ^ me(s, c, n, t, i, r), w = e[a++] ^ me(s, c, r, n, t, i), E = e[a++] ^ me(s, c, i, r, n, t);
2120
- t = h, n = y, r = w, i = E;
2119
+ const h = e[a++] ^ Ee(s, c, t, i, r, n), y = e[a++] ^ Ee(s, c, n, t, i, r), w = e[a++] ^ Ee(s, c, r, n, t, i), m = e[a++] ^ Ee(s, c, i, r, n, t);
2120
+ t = h, n = y, r = w, i = m;
2121
2121
  }
2122
2122
  const f = e[a++] ^ se(o, t, i, r, n), u = e[a++] ^ se(o, n, t, i, r), d = e[a++] ^ se(o, r, n, t, i), p = e[a++] ^ se(o, i, r, n, t);
2123
2123
  return { s0: f, s1: u, s2: d, s3: p };
@@ -2130,18 +2130,18 @@ function dr(e, t) {
2130
2130
  return t;
2131
2131
  }
2132
2132
  function _o(e) {
2133
- if (le(e), e.length % Ee !== 0)
2134
- throw new Error(`aes/(cbc-ecb).decrypt ciphertext should consist of blocks with size ${Ee}`);
2133
+ if (le(e), e.length % me !== 0)
2134
+ throw new Error(`aes/(cbc-ecb).decrypt ciphertext should consist of blocks with size ${me}`);
2135
2135
  }
2136
2136
  function Lo(e, t, n) {
2137
2137
  let r = e.length;
2138
- const i = r % Ee;
2138
+ const i = r % me;
2139
2139
  if (!t && i !== 0)
2140
2140
  throw new Error("aec/(cbc-ecb): unpadded plaintext with disabled padding");
2141
2141
  const o = F(e);
2142
2142
  if (t) {
2143
- let a = Ee - i;
2144
- a || (a = Ee), r = r + a;
2143
+ let a = me - i;
2144
+ a || (a = me), r = r + a;
2145
2145
  }
2146
2146
  const s = dr(r, n), c = F(s);
2147
2147
  return { b: o, o: c, out: s };
@@ -2164,8 +2164,8 @@ function $o(e, t) {
2164
2164
  function To(e) {
2165
2165
  const t = new Uint8Array(16), n = F(t);
2166
2166
  t.set(e);
2167
- const r = Ee - e.length;
2168
- for (let i = Ee - r; i < Ee; i++)
2167
+ const r = me - e.length;
2168
+ for (let i = me - r; i < me; i++)
2169
2169
  t[i] = r;
2170
2170
  return n;
2171
2171
  }
@@ -2189,10 +2189,10 @@ const yr = /* @__PURE__ */ Ko({ blockSize: 16, nonceLength: 16 }, function(t, n,
2189
2189
  const c = Uo(t), a = F(n), l = dr(o.length, s), f = F(o), u = F(l);
2190
2190
  let d = a[0], p = a[1], g = a[2], h = a[3];
2191
2191
  for (let y = 0; y + 4 <= f.length; ) {
2192
- const w = d, E = p, K = g, k = h;
2192
+ const w = d, m = p, K = g, k = h;
2193
2193
  d = f[y + 0], p = f[y + 1], g = f[y + 2], h = f[y + 3];
2194
- const { s0: C, s1: m, s2: x, s3: A } = ko(c, d, p, g, h);
2195
- u[y++] = C ^ w, u[y++] = m ^ E, u[y++] = x ^ K, u[y++] = A ^ k;
2194
+ const { s0: C, s1: E, s2: x, s3: S } = ko(c, d, p, g, h);
2195
+ u[y++] = C ^ w, u[y++] = E ^ m, u[y++] = x ^ K, u[y++] = S ^ k;
2196
2196
  }
2197
2197
  return c.fill(0), $o(l, i);
2198
2198
  }
@@ -2216,8 +2216,8 @@ function Ho(e, t, n, r, i, o, s, c) {
2216
2216
  const y = g / 4;
2217
2217
  if (g % 4 !== 0)
2218
2218
  throw new Error("arx: invalid block position");
2219
- for (let w = 0, E; w < Mo; w++)
2220
- E = y + w, p[E] = d[E] ^ f[w];
2219
+ for (let w = 0, m; w < Mo; w++)
2220
+ m = y + w, p[m] = d[m] ^ f[w];
2221
2221
  g += Xe;
2222
2222
  continue;
2223
2223
  }
@@ -2227,7 +2227,7 @@ function Ho(e, t, n, r, i, o, s, c) {
2227
2227
  }
2228
2228
  }
2229
2229
  function qo(e, t) {
2230
- const { allowShortKeys: n, extendNonceFn: r, counterLength: i, counterRight: o, rounds: s } = Ao({ allowShortKeys: !1, counterLength: 8, counterRight: !1, rounds: 20 }, t);
2230
+ const { allowShortKeys: n, extendNonceFn: r, counterLength: i, counterRight: o, rounds: s } = So({ allowShortKeys: !1, counterLength: 8, counterRight: !1, rounds: 20 }, t);
2231
2231
  if (typeof e != "function")
2232
2232
  throw new Error("core must be a function");
2233
2233
  return Ut(i), Ut(s), _n(o), _n(n), (c, a, l, f, u = 0) => {
@@ -2252,10 +2252,10 @@ function qo(e, t) {
2252
2252
  throw new Error("arx: extended nonce must be 24 bytes");
2253
2253
  r(y, w, F(a.subarray(0, 16)), w), a = a.subarray(16);
2254
2254
  }
2255
- const E = 16 - i;
2256
- if (E !== a.length)
2257
- throw new Error(`arx: nonce must be ${E} or 16 bytes`);
2258
- if (E !== 12) {
2255
+ const m = 16 - i;
2256
+ if (m !== a.length)
2257
+ throw new Error(`arx: nonce must be ${m} or 16 bytes`);
2258
+ if (m !== 12) {
2259
2259
  const k = new Uint8Array(12);
2260
2260
  k.set(a, o ? 0 : 12 - a.length), a = k, p.push(a);
2261
2261
  }
@@ -2266,11 +2266,11 @@ function qo(e, t) {
2266
2266
  };
2267
2267
  }
2268
2268
  function Do(e, t, n, r, i, o = 20) {
2269
- let s = e[0], c = e[1], a = e[2], l = e[3], f = t[0], u = t[1], d = t[2], p = t[3], g = t[4], h = t[5], y = t[6], w = t[7], E = i, K = n[0], k = n[1], C = n[2], m = s, x = c, A = a, O = l, U = f, B = u, T = d, R = p, H = g, b = h, v = y, S = w, I = E, N = K, _ = k, P = C;
2269
+ let s = e[0], c = e[1], a = e[2], l = e[3], f = t[0], u = t[1], d = t[2], p = t[3], g = t[4], h = t[5], y = t[6], w = t[7], m = i, K = n[0], k = n[1], C = n[2], E = s, x = c, S = a, O = l, U = f, N = u, T = d, R = p, H = g, b = h, v = y, A = w, I = m, B = K, _ = k, P = C;
2270
2270
  for (let X = 0; X < o; X += 2)
2271
- m = m + U | 0, I = L(I ^ m, 16), H = H + I | 0, U = L(U ^ H, 12), m = m + U | 0, I = L(I ^ m, 8), H = H + I | 0, U = L(U ^ H, 7), x = x + B | 0, N = L(N ^ x, 16), b = b + N | 0, B = L(B ^ b, 12), x = x + B | 0, N = L(N ^ x, 8), b = b + N | 0, B = L(B ^ b, 7), A = A + T | 0, _ = L(_ ^ A, 16), v = v + _ | 0, T = L(T ^ v, 12), A = A + T | 0, _ = L(_ ^ A, 8), v = v + _ | 0, T = L(T ^ v, 7), O = O + R | 0, P = L(P ^ O, 16), S = S + P | 0, R = L(R ^ S, 12), O = O + R | 0, P = L(P ^ O, 8), S = S + P | 0, R = L(R ^ S, 7), m = m + B | 0, P = L(P ^ m, 16), v = v + P | 0, B = L(B ^ v, 12), m = m + B | 0, P = L(P ^ m, 8), v = v + P | 0, B = L(B ^ v, 7), x = x + T | 0, I = L(I ^ x, 16), S = S + I | 0, T = L(T ^ S, 12), x = x + T | 0, I = L(I ^ x, 8), S = S + I | 0, T = L(T ^ S, 7), A = A + R | 0, N = L(N ^ A, 16), H = H + N | 0, R = L(R ^ H, 12), A = A + R | 0, N = L(N ^ A, 8), H = H + N | 0, R = L(R ^ H, 7), O = O + U | 0, _ = L(_ ^ O, 16), b = b + _ | 0, U = L(U ^ b, 12), O = O + U | 0, _ = L(_ ^ O, 8), b = b + _ | 0, U = L(U ^ b, 7);
2271
+ E = E + U | 0, I = L(I ^ E, 16), H = H + I | 0, U = L(U ^ H, 12), E = E + U | 0, I = L(I ^ E, 8), H = H + I | 0, U = L(U ^ H, 7), x = x + N | 0, B = L(B ^ x, 16), b = b + B | 0, N = L(N ^ b, 12), x = x + N | 0, B = L(B ^ x, 8), b = b + B | 0, N = L(N ^ b, 7), S = S + T | 0, _ = L(_ ^ S, 16), v = v + _ | 0, T = L(T ^ v, 12), S = S + T | 0, _ = L(_ ^ S, 8), v = v + _ | 0, T = L(T ^ v, 7), O = O + R | 0, P = L(P ^ O, 16), A = A + P | 0, R = L(R ^ A, 12), O = O + R | 0, P = L(P ^ O, 8), A = A + P | 0, R = L(R ^ A, 7), E = E + N | 0, P = L(P ^ E, 16), v = v + P | 0, N = L(N ^ v, 12), E = E + N | 0, P = L(P ^ E, 8), v = v + P | 0, N = L(N ^ v, 7), x = x + T | 0, I = L(I ^ x, 16), A = A + I | 0, T = L(T ^ A, 12), x = x + T | 0, I = L(I ^ x, 8), A = A + I | 0, T = L(T ^ A, 7), S = S + R | 0, B = L(B ^ S, 16), H = H + B | 0, R = L(R ^ H, 12), S = S + R | 0, B = L(B ^ S, 8), H = H + B | 0, R = L(R ^ H, 7), O = O + U | 0, _ = L(_ ^ O, 16), b = b + _ | 0, U = L(U ^ b, 12), O = O + U | 0, _ = L(_ ^ O, 8), b = b + _ | 0, U = L(U ^ b, 7);
2272
2272
  let $ = 0;
2273
- r[$++] = s + m | 0, r[$++] = c + x | 0, r[$++] = a + A | 0, r[$++] = l + O | 0, r[$++] = f + U | 0, r[$++] = u + B | 0, r[$++] = d + T | 0, r[$++] = p + R | 0, r[$++] = g + H | 0, r[$++] = h + b | 0, r[$++] = y + v | 0, r[$++] = w + S | 0, r[$++] = E + I | 0, r[$++] = K + N | 0, r[$++] = k + _ | 0, r[$++] = C + P | 0;
2273
+ r[$++] = s + E | 0, r[$++] = c + x | 0, r[$++] = a + S | 0, r[$++] = l + O | 0, r[$++] = f + U | 0, r[$++] = u + N | 0, r[$++] = d + T | 0, r[$++] = p + R | 0, r[$++] = g + H | 0, r[$++] = h + b | 0, r[$++] = y + v | 0, r[$++] = w + A | 0, r[$++] = m + I | 0, r[$++] = K + B | 0, r[$++] = k + _ | 0, r[$++] = C + P | 0;
2274
2274
  }
2275
2275
  const br = /* @__PURE__ */ qo(Do, {
2276
2276
  counterRight: !1,
@@ -2318,7 +2318,7 @@ function nn(e, t, n) {
2318
2318
  return oe.hash(e), n === void 0 && (n = new Uint8Array(e.outputLen)), pt(e, Ge(n), Ge(t));
2319
2319
  }
2320
2320
  const _t = new Uint8Array([0]), Tn = new Uint8Array();
2321
- function mr(e, t, n, r = 32) {
2321
+ function Er(e, t, n, r = 32) {
2322
2322
  if (oe.hash(e), oe.number(r), r > 255 * e.outputLen)
2323
2323
  throw new Error("Length should be <= 255*HashLen");
2324
2324
  const i = Math.ceil(r / e.outputLen);
@@ -2332,7 +2332,7 @@ var jo = Object.defineProperty, D = (e, t) => {
2332
2332
  for (var n in t)
2333
2333
  jo(e, n, { get: t[n], enumerable: !0 });
2334
2334
  }, Te = Symbol("verified"), zo = (e) => e instanceof Object;
2335
- function Er(e) {
2335
+ function mr(e) {
2336
2336
  if (!zo(e) || typeof e.kind != "number" || typeof e.content != "string" || typeof e.created_at != "number" || typeof e.pubkey != "string" || !e.pubkey.match(/^[a-f0-9]{64}$/) || !Array.isArray(e.tags))
2337
2337
  return !1;
2338
2338
  for (let t = 0; t < e.tags.length; t++) {
@@ -2433,12 +2433,12 @@ var xr = class {
2433
2433
  }
2434
2434
  };
2435
2435
  function Yo(e) {
2436
- if (!Er(e))
2436
+ if (!mr(e))
2437
2437
  throw new Error("can't serialize event with wrong or missing properties");
2438
2438
  return JSON.stringify([0, e.pubkey, e.created_at, e.kind, e.tags, e.content]);
2439
2439
  }
2440
2440
  function tt(e) {
2441
- let t = Ae(te.encode(Yo(e)));
2441
+ let t = Se(te.encode(Yo(e)));
2442
2442
  return M(t);
2443
2443
  }
2444
2444
  var gt = new Jo(), Oe = gt.generateSecretKey, Ce = gt.getPublicKey, ae = gt.finalizeEvent, on = gt.verifyEvent, Xo = {};
@@ -2447,11 +2447,11 @@ D(Xo, {
2447
2447
  BadgeAward: () => as,
2448
2448
  BadgeDefinition: () => Vs,
2449
2449
  BlockedRelaysList: () => Us,
2450
- BookmarkList: () => Ns,
2450
+ BookmarkList: () => Bs,
2451
2451
  Bookmarksets: () => Ds,
2452
2452
  Calendar: () => oa,
2453
2453
  CalendarEventRSVP: () => sa,
2454
- ChannelCreation: () => Nr,
2454
+ ChannelCreation: () => Br,
2455
2455
  ChannelHideMessage: () => Ur,
2456
2456
  ChannelMessage: () => Ir,
2457
2457
  ChannelMetadata: () => Cr,
@@ -2480,7 +2480,7 @@ D(Xo, {
2480
2480
  HTTPAuth: () => cn,
2481
2481
  Handlerinformation: () => ca,
2482
2482
  Handlerrecommendation: () => aa,
2483
- Highlights: () => As,
2483
+ Highlights: () => Ss,
2484
2484
  InterestsList: () => _s,
2485
2485
  Interestsets: () => Zs,
2486
2486
  JobFeedback: () => vs,
@@ -2492,7 +2492,7 @@ D(Xo, {
2492
2492
  LiveEvent: () => Qs,
2493
2493
  LongFormArticle: () => Gs,
2494
2494
  Metadata: () => es,
2495
- Mutelist: () => Ss,
2495
+ Mutelist: () => As,
2496
2496
  NWCWalletInfo: () => Ts,
2497
2497
  NWCWalletRequest: () => Lr,
2498
2498
  NWCWalletResponse: () => Ps,
@@ -2504,7 +2504,7 @@ D(Xo, {
2504
2504
  PublicChatsList: () => Is,
2505
2505
  Reaction: () => an,
2506
2506
  RecommendRelay: () => ns,
2507
- RelayList: () => Bs,
2507
+ RelayList: () => Ns,
2508
2508
  Relaysets: () => qs,
2509
2509
  Report: () => ds,
2510
2510
  Reporting: () => ys,
@@ -2515,30 +2515,30 @@ D(Xo, {
2515
2515
  UserEmojiList: () => Ls,
2516
2516
  UserStatuses: () => ea,
2517
2517
  Zap: () => xs,
2518
- ZapGoal: () => ms,
2519
- ZapRequest: () => Es,
2518
+ ZapGoal: () => Es,
2519
+ ZapRequest: () => ms,
2520
2520
  classifyKind: () => Qo,
2521
2521
  isEphemeralKind: () => Kr,
2522
- isParameterizedReplaceableKind: () => Br,
2523
- isRegularKind: () => Ar,
2524
- isReplaceableKind: () => Sr
2522
+ isParameterizedReplaceableKind: () => Nr,
2523
+ isRegularKind: () => Sr,
2524
+ isReplaceableKind: () => Ar
2525
2525
  });
2526
- function Ar(e) {
2526
+ function Sr(e) {
2527
2527
  return 1e3 <= e && e < 1e4 || [1, 2, 4, 5, 6, 7, 8, 16, 40, 41, 42, 43, 44].includes(e);
2528
2528
  }
2529
- function Sr(e) {
2529
+ function Ar(e) {
2530
2530
  return [0, 3].includes(e) || 1e4 <= e && e < 2e4;
2531
2531
  }
2532
2532
  function Kr(e) {
2533
2533
  return 2e4 <= e && e < 3e4;
2534
2534
  }
2535
- function Br(e) {
2535
+ function Nr(e) {
2536
2536
  return 3e4 <= e && e < 4e4;
2537
2537
  }
2538
2538
  function Qo(e) {
2539
- return Ar(e) ? "regular" : Sr(e) ? "replaceable" : Kr(e) ? "ephemeral" : Br(e) ? "parameterized" : "unknown";
2539
+ return Sr(e) ? "regular" : Ar(e) ? "replaceable" : Kr(e) ? "ephemeral" : Nr(e) ? "parameterized" : "unknown";
2540
2540
  }
2541
- var es = 0, ts = 1, ns = 2, rs = 3, is = 4, os = 4, ss = 5, sn = 6, an = 7, as = 8, cs = 16, Nr = 40, Cr = 41, Ir = 42, Ur = 43, kr = 44, ls = 1040, us = 1063, fs = 1311, hs = 1971, ds = 1984, ys = 1984, ps = 1985, gs = 4550, ws = 5999, bs = 6999, vs = 7e3, ms = 9041, Es = 9734, xs = 9735, As = 9802, Ss = 1e4, Ks = 10001, Bs = 10002, Ns = 10003, Cs = 10004, Is = 10005, Us = 10006, ks = 10007, _s = 10015, Ls = 10030, $s = 10096, Ts = 13194, Rs = 21e3, _r = 22242, Lr = 23194, Ps = 23195, Os = 24133, cn = 27235, Ms = 3e4, Hs = 30001, qs = 30002, Ds = 30003, js = 30004, zs = 30008, Vs = 30009, Zs = 30015, Fs = 30017, Ws = 30018, Gs = 30023, Js = 30024, Ys = 30030, Xs = 30078, Qs = 30311, ea = 30315, ta = 30402, na = 30403, ra = 31922, ia = 31923, oa = 31924, sa = 31925, aa = 31989, ca = 31990, la = 34550, ua = {};
2541
+ var es = 0, ts = 1, ns = 2, rs = 3, is = 4, os = 4, ss = 5, sn = 6, an = 7, as = 8, cs = 16, Br = 40, Cr = 41, Ir = 42, Ur = 43, kr = 44, ls = 1040, us = 1063, fs = 1311, hs = 1971, ds = 1984, ys = 1984, ps = 1985, gs = 4550, ws = 5999, bs = 6999, vs = 7e3, Es = 9041, ms = 9734, xs = 9735, Ss = 9802, As = 1e4, Ks = 10001, Ns = 10002, Bs = 10003, Cs = 10004, Is = 10005, Us = 10006, ks = 10007, _s = 10015, Ls = 10030, $s = 10096, Ts = 13194, Rs = 21e3, _r = 22242, Lr = 23194, Ps = 23195, Os = 24133, cn = 27235, Ms = 3e4, Hs = 30001, qs = 30002, Ds = 30003, js = 30004, zs = 30008, Vs = 30009, Zs = 30015, Fs = 30017, Ws = 30018, Gs = 30023, Js = 30024, Ys = 30030, Xs = 30078, Qs = 30311, ea = 30315, ta = 30402, na = 30403, ra = 31922, ia = 31923, oa = 31924, sa = 31925, aa = 31989, ca = 31990, la = 34550, ua = {};
2542
2542
  D(ua, {
2543
2543
  getHex64: () => ln,
2544
2544
  getInt: () => $r,
@@ -2609,12 +2609,12 @@ D(Fe, {
2609
2609
  decode: () => wt,
2610
2610
  encodeBytes: () => bt,
2611
2611
  naddrEncode: () => Ka,
2612
- neventEncode: () => Sa,
2612
+ neventEncode: () => Aa,
2613
2613
  noteEncode: () => xa,
2614
- nprofileEncode: () => Aa,
2615
- npubEncode: () => Ea,
2616
- nrelayEncode: () => Ba,
2617
- nsecEncode: () => ma
2614
+ nprofileEncode: () => Sa,
2615
+ npubEncode: () => ma,
2616
+ nrelayEncode: () => Na,
2617
+ nsecEncode: () => Ea
2618
2618
  });
2619
2619
  var un = 5e3, Tr = /[\x21-\x7E]{1,83}1[023456789acdefghjklmnpqrstuvwxyz]{6,}/;
2620
2620
  function va(e) {
@@ -2709,10 +2709,10 @@ function Qe(e) {
2709
2709
  }
2710
2710
  return t;
2711
2711
  }
2712
- function ma(e) {
2712
+ function Ea(e) {
2713
2713
  return bt("nsec", e);
2714
2714
  }
2715
- function Ea(e) {
2715
+ function ma(e) {
2716
2716
  return bt("npub", W(e));
2717
2717
  }
2718
2718
  function xa(e) {
@@ -2725,14 +2725,14 @@ function Ye(e, t) {
2725
2725
  function bt(e, t) {
2726
2726
  return Ye(e, t);
2727
2727
  }
2728
- function Aa(e) {
2728
+ function Sa(e) {
2729
2729
  let t = vt({
2730
2730
  0: [W(e.pubkey)],
2731
2731
  1: (e.relays || []).map((n) => te.encode(n))
2732
2732
  });
2733
2733
  return Ye("nprofile", t);
2734
2734
  }
2735
- function Sa(e) {
2735
+ function Aa(e) {
2736
2736
  let t;
2737
2737
  e.kind !== void 0 && (t = va(e.kind));
2738
2738
  let n = vt({
@@ -2754,7 +2754,7 @@ function Ka(e) {
2754
2754
  });
2755
2755
  return Ye("naddr", n);
2756
2756
  }
2757
- function Ba(e) {
2757
+ function Na(e) {
2758
2758
  let t = vt({
2759
2759
  0: [te.encode(e)]
2760
2760
  });
@@ -2769,8 +2769,8 @@ function vt(e) {
2769
2769
  });
2770
2770
  }), dt(...t);
2771
2771
  }
2772
- var Na = {};
2773
- D(Na, {
2772
+ var Ba = {};
2773
+ D(Ba, {
2774
2774
  decrypt: () => Ca,
2775
2775
  encrypt: () => Rr
2776
2776
  });
@@ -2795,18 +2795,18 @@ D(Ia, {
2795
2795
  searchDomain: () => ka,
2796
2796
  useFetchImplementation: () => Ua
2797
2797
  });
2798
- var Or = /^(?:([\w.+-]+)@)?([\w_-]+(\.[\w_-]+)+)$/, mt;
2798
+ var Or = /^(?:([\w.+-]+)@)?([\w_-]+(\.[\w_-]+)+)$/, Et;
2799
2799
  try {
2800
- mt = fetch;
2800
+ Et = fetch;
2801
2801
  } catch {
2802
2802
  }
2803
2803
  function Ua(e) {
2804
- mt = e;
2804
+ Et = e;
2805
2805
  }
2806
2806
  async function ka(e, t = "") {
2807
2807
  try {
2808
2808
  const n = `https://${e}/.well-known/nostr.json?name=${t}`;
2809
- return (await (await mt(n, { redirect: "error" })).json()).names;
2809
+ return (await (await Et(n, { redirect: "error" })).json()).names;
2810
2810
  } catch {
2811
2811
  return {};
2812
2812
  }
@@ -2818,7 +2818,7 @@ async function Mr(e) {
2818
2818
  return null;
2819
2819
  const [n, r = "_", i] = t;
2820
2820
  try {
2821
- const s = `https://${i}/.well-known/nostr.json?name=${r}`, c = await (await mt(s, { redirect: "error" })).json();
2821
+ const s = `https://${i}/.well-known/nostr.json?name=${r}`, c = await (await Et(s, { redirect: "error" })).json();
2822
2822
  let a = c.names[r];
2823
2823
  return a ? { pubkey: a, relays: (o = c.relays) == null ? void 0 : o[a] } : null;
2824
2824
  } catch {
@@ -2967,16 +2967,16 @@ function Da(e, { skipVerification: t } = {}) {
2967
2967
  }
2968
2968
  var ja = {};
2969
2969
  D(ja, {
2970
- NOSTR_URI_REGEX: () => Et,
2970
+ NOSTR_URI_REGEX: () => mt,
2971
2971
  parse: () => Va,
2972
2972
  test: () => za
2973
2973
  });
2974
- var Et = new RegExp(`nostr:(${Tr.source})`);
2974
+ var mt = new RegExp(`nostr:(${Tr.source})`);
2975
2975
  function za(e) {
2976
- return typeof e == "string" && new RegExp(`^${Et.source}$`).test(e);
2976
+ return typeof e == "string" && new RegExp(`^${mt.source}$`).test(e);
2977
2977
  }
2978
2978
  function Va(e) {
2979
- const t = e.match(new RegExp(`^${Et.source}$`));
2979
+ const t = e.match(new RegExp(`^${mt.source}$`));
2980
2980
  if (!t)
2981
2981
  throw new Error(`Invalid Nostr URI: ${e}`);
2982
2982
  return {
@@ -3023,7 +3023,7 @@ D(Ga, {
3023
3023
  regex: () => fn,
3024
3024
  replaceAll: () => Ya
3025
3025
  });
3026
- var fn = () => new RegExp(`\\b${Et.source}\\b`, "g");
3026
+ var fn = () => new RegExp(`\\b${mt.source}\\b`, "g");
3027
3027
  function* Ja(e) {
3028
3028
  const t = e.matchAll(fn());
3029
3029
  for (const n of t)
@@ -3064,7 +3064,7 @@ var Qa = (e, t) => {
3064
3064
  return;
3065
3065
  return ae(
3066
3066
  {
3067
- kind: Nr,
3067
+ kind: Br,
3068
3068
  tags: [...e.tags ?? []],
3069
3069
  content: n,
3070
3070
  created_at: e.created_at
@@ -3191,10 +3191,10 @@ D(z, {
3191
3191
  var zr = 1, Vr = 65535;
3192
3192
  function Zr(e, t) {
3193
3193
  const n = Ue.getSharedSecret(e, "02" + t).subarray(1, 33);
3194
- return nn(Ae, n, "nip44-v2");
3194
+ return nn(Se, n, "nip44-v2");
3195
3195
  }
3196
3196
  function Fr(e, t) {
3197
- const n = mr(Ae, e, t, 76);
3197
+ const n = Er(Se, e, t, 76);
3198
3198
  return {
3199
3199
  chacha_key: n.subarray(0, 32),
3200
3200
  chacha_nonce: n.subarray(32, 44),
@@ -3229,7 +3229,7 @@ function Wr(e, t, n) {
3229
3229
  if (n.length !== 32)
3230
3230
  throw new Error("AAD associated data must be 32 bytes");
3231
3231
  const r = dt(n, t);
3232
- return pt(Ae, e, r);
3232
+ return pt(Se, e, r);
3233
3233
  }
3234
3234
  function dc(e) {
3235
3235
  if (typeof e != "string")
@@ -3263,7 +3263,7 @@ function Gr(e, t, n = ir(32)) {
3263
3263
  }
3264
3264
  function Jr(e, t) {
3265
3265
  const { nonce: n, ciphertext: r, mac: i } = dc(e), { chacha_key: o, chacha_nonce: s, hmac_key: c } = Fr(t, n), a = Wr(c, r, n);
3266
- if (!So(a, i))
3266
+ if (!Ao(a, i))
3267
3267
  throw new Error("invalid MAC");
3268
3268
  const l = br(o, s, r);
3269
3269
  return hc(l);
@@ -3302,9 +3302,9 @@ async function wc(e, t, n) {
3302
3302
  }
3303
3303
  var bc = {};
3304
3304
  D(bc, {
3305
- getZapEndpoint: () => mc,
3306
- makeZapReceipt: () => Ac,
3307
- makeZapRequest: () => Ec,
3305
+ getZapEndpoint: () => Ec,
3306
+ makeZapReceipt: () => Sc,
3307
+ makeZapRequest: () => mc,
3308
3308
  useFetchImplementation: () => vc,
3309
3309
  validateZapRequest: () => xc
3310
3310
  });
@@ -3316,7 +3316,7 @@ try {
3316
3316
  function vc(e) {
3317
3317
  pn = e;
3318
3318
  }
3319
- async function mc(e) {
3319
+ async function Ec(e) {
3320
3320
  try {
3321
3321
  let t = "", { lud06: n, lud16: r } = JSON.parse(e.content);
3322
3322
  if (n) {
@@ -3334,7 +3334,7 @@ async function mc(e) {
3334
3334
  }
3335
3335
  return null;
3336
3336
  }
3337
- function Ec({
3337
+ function mc({
3338
3338
  profile: e,
3339
3339
  event: t,
3340
3340
  amount: n,
@@ -3364,7 +3364,7 @@ function xc(e) {
3364
3364
  } catch {
3365
3365
  return "Invalid zap request JSON.";
3366
3366
  }
3367
- if (!Er(t))
3367
+ if (!mr(t))
3368
3368
  return "Zap request is not a valid Nostr event.";
3369
3369
  if (!on(t))
3370
3370
  return "Invalid signature on zap request.";
@@ -3376,7 +3376,7 @@ function xc(e) {
3376
3376
  let r = t.tags.find(([o, s]) => o === "e" && s);
3377
3377
  return r && !r[1].match(/^[a-f0-9]{64}$/) ? "Zap request 'e' tag is not valid hex." : t.tags.find(([o, s]) => o === "relays" && s) ? null : "Zap request doesn't have a 'relays' tag.";
3378
3378
  }
3379
- function Ac({
3379
+ function Sc({
3380
3380
  zapRequest: e,
3381
3381
  preimage: t,
3382
3382
  bolt11: n,
@@ -3390,8 +3390,8 @@ function Ac({
3390
3390
  };
3391
3391
  return t && s.tags.push(["preimage", t]), s;
3392
3392
  }
3393
- var Sc = {};
3394
- D(Sc, {
3393
+ var Ac = {};
3394
+ D(Ac, {
3395
3395
  getToken: () => Kc,
3396
3396
  hashPayload: () => gn,
3397
3397
  unpackEventFromToken: () => Xr,
@@ -3401,7 +3401,7 @@ D(Sc, {
3401
3401
  validateEventPayloadTag: () => ri,
3402
3402
  validateEventTimestamp: () => Qr,
3403
3403
  validateEventUrlTag: () => ti,
3404
- validateToken: () => Bc
3404
+ validateToken: () => Nc
3405
3405
  });
3406
3406
  var Yr = "Nostr ";
3407
3407
  async function Kc(e, t, n, r = !1, i) {
@@ -3418,7 +3418,7 @@ async function Kc(e, t, n, r = !1, i) {
3418
3418
  const s = await n(o);
3419
3419
  return (r ? Yr : "") + ue.encode(te.encode(JSON.stringify(s)));
3420
3420
  }
3421
- async function Bc(e, t, n) {
3421
+ async function Nc(e, t, n) {
3422
3422
  const r = await Xr(e).catch((o) => {
3423
3423
  throw o;
3424
3424
  });
@@ -3450,7 +3450,7 @@ function ni(e, t) {
3450
3450
  return n ? n.length > 0 && n[1].toLowerCase() === t.toLowerCase() : !1;
3451
3451
  }
3452
3452
  function gn(e) {
3453
- const t = Ae(te.encode(JSON.stringify(e)));
3453
+ const t = Se(te.encode(JSON.stringify(e)));
3454
3454
  return M(t);
3455
3455
  }
3456
3456
  function ri(e, t) {
@@ -3476,7 +3476,7 @@ async function ii(e, t, n, r) {
3476
3476
  return !0;
3477
3477
  }
3478
3478
  const Me = 4, Tc = 100;
3479
- var Nc = /* @__PURE__ */ ((e) => (e[e.Us = 0] = "Us", e[e.Them = 1] = "Them", e))(Nc || {});
3479
+ var Bc = /* @__PURE__ */ ((e) => (e[e.Us = 0] = "Us", e[e.Them = 1] = "Them", e))(Bc || {});
3480
3480
  function Rc(e) {
3481
3481
  return JSON.stringify({
3482
3482
  rootKey: M(e.rootKey),
@@ -3544,9 +3544,9 @@ async function* Oc(e) {
3544
3544
  }
3545
3545
  }
3546
3546
  function Re(e, t = new Uint8Array(32), n = 1) {
3547
- const r = nn(Ae, e, t), i = [];
3547
+ const r = nn(Se, e, t), i = [];
3548
3548
  for (let o = 1; o <= n; o++)
3549
- i.push(mr(Ae, r, new Uint8Array([o]), 32));
3549
+ i.push(Er(Se, r, new Uint8Array([o]), 32));
3550
3550
  return i;
3551
3551
  }
3552
3552
  function Rn(e, t) {
@@ -3723,7 +3723,7 @@ new TextDecoder("utf-8");
3723
3723
  new TextEncoder();
3724
3724
  function et(e, t) {
3725
3725
  const n = Ue.getSharedSecret(e, "02" + t).subarray(1, 33);
3726
- return nn(Ae, n, "nip44-v2");
3726
+ return nn(Se, n, "nip44-v2");
3727
3727
  }
3728
3728
  class nt {
3729
3729
  constructor(t, n, r, i, o, s, c = []) {
@@ -3741,18 +3741,29 @@ class nt {
3741
3741
  );
3742
3742
  }
3743
3743
  static fromUrl(t) {
3744
- const n = new URL(t), r = n.pathname.slice(1), i = n.searchParams.get("s"), o = n.hash.slice(1);
3744
+ const r = new URL(t).hash.slice(1);
3745
3745
  if (!r)
3746
- throw new Error("Inviter not found in the URL");
3747
- if (!i)
3748
- throw new Error("Session key not found in the URL");
3749
- const s = Fe.decode(r), c = Fe.decode(i);
3750
- if (typeof s.data != "string")
3746
+ throw new Error("No invite data found in the URL hash.");
3747
+ const i = decodeURIComponent(r);
3748
+ let o;
3749
+ try {
3750
+ o = JSON.parse(i);
3751
+ } catch (u) {
3752
+ throw new Error("Invite data in URL hash is not valid JSON: " + u);
3753
+ }
3754
+ const { inviter: s, sessionKey: c, linkSecret: a } = o;
3755
+ if (!s || !c || !a)
3756
+ throw new Error("Missing required fields (inviter, sessionKey, linkSecret) in invite data.");
3757
+ const l = Fe.decode(s), f = Fe.decode(c);
3758
+ if (typeof l.data != "string")
3751
3759
  throw new Error("Decoded inviter is not a string");
3752
- if (typeof c.data != "string")
3760
+ if (typeof f.data != "string")
3753
3761
  throw new Error("Decoded session key is not a string");
3754
- const a = s.data, l = c.data;
3755
- return new nt(l, o, a);
3762
+ return new nt(
3763
+ f.data,
3764
+ a,
3765
+ l.data
3766
+ );
3756
3767
  }
3757
3768
  static deserialize(t) {
3758
3769
  const n = JSON.parse(t);
@@ -3778,8 +3789,12 @@ class nt {
3778
3789
  });
3779
3790
  }
3780
3791
  getUrl(t = "https://iris.to") {
3781
- const n = new URL(`${t}/${Fe.npubEncode(this.inviter)}`);
3782
- return n.searchParams.set("s", Fe.npubEncode(this.inviterSessionPublicKey)), n.hash = this.linkSecret, n.toString();
3792
+ const n = {
3793
+ inviter: Fe.npubEncode(this.inviter),
3794
+ sessionKey: Fe.npubEncode(this.inviterSessionPublicKey),
3795
+ linkSecret: this.linkSecret
3796
+ }, r = new URL(t);
3797
+ return r.hash = encodeURIComponent(JSON.stringify(n)), console.log("url", r.toString()), r.toString();
3783
3798
  }
3784
3799
  /**
3785
3800
  * Accepts the invite and creates a new channel with the inviter.
@@ -3838,7 +3853,7 @@ export {
3838
3853
  Me as EVENT_KIND,
3839
3854
  nt as InviteLink,
3840
3855
  Tc as MAX_SKIP,
3841
- Nc as Sender,
3856
+ Bc as Sender,
3842
3857
  Oc as createMessageStream,
3843
3858
  Pc as deserializeChannelState,
3844
3859
  Re as kdf,