nostr-double-ratchet 0.0.19 → 0.0.21

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,17 +1,17 @@
1
- var bi = Object.defineProperty;
2
- var vi = (e, t, n) => t in e ? bi(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
- var te = (e, t, n) => vi(e, typeof t != "symbol" ? t + "" : t, n);
1
+ var vi = Object.defineProperty;
2
+ var Ei = (e, t, n) => t in e ? vi(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
+ var te = (e, t, n) => Ei(e, typeof t != "symbol" ? t + "" : t, n);
4
4
  function Kn(e) {
5
5
  if (!Number.isSafeInteger(e) || e < 0)
6
6
  throw new Error(`Wrong positive integer: ${e}`);
7
7
  }
8
- function zn(e, ...t) {
8
+ function Vn(e, ...t) {
9
9
  if (!(e instanceof Uint8Array))
10
10
  throw new Error("Expected Uint8Array");
11
11
  if (t.length > 0 && !t.includes(e.length))
12
12
  throw new Error(`Expected Uint8Array of length ${t}, not of length=${e.length}`);
13
13
  }
14
- function Ei(e) {
14
+ function mi(e) {
15
15
  if (typeof e != "function" || typeof e.create != "function")
16
16
  throw new Error("Hash should be wrapped by utils.wrapConstructor");
17
17
  Kn(e.outputLen), Kn(e.blockLen);
@@ -22,16 +22,16 @@ function et(e, t = !0) {
22
22
  if (t && e.finished)
23
23
  throw new Error("Hash#digest() has already been called");
24
24
  }
25
- function mi(e, t) {
26
- zn(e);
25
+ function xi(e, t) {
26
+ Vn(e);
27
27
  const n = t.outputLen;
28
28
  if (e.length < n)
29
29
  throw new Error(`digestInto() expects output buffer of length at least ${n}`);
30
30
  }
31
31
  const xt = typeof globalThis == "object" && "crypto" in globalThis ? globalThis.crypto : void 0;
32
32
  /*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
33
- const Vn = (e) => e instanceof Uint8Array, St = (e) => new DataView(e.buffer, e.byteOffset, e.byteLength), re = (e, t) => e << 32 - t | e >>> t, xi = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
34
- if (!xi)
33
+ const Wn = (e) => e instanceof Uint8Array, Nt = (e) => new DataView(e.buffer, e.byteOffset, e.byteLength), re = (e, t) => e << 32 - t | e >>> t, Ni = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
34
+ if (!Ni)
35
35
  throw new Error("Non little-endian hardware is not supported");
36
36
  function Si(e) {
37
37
  if (typeof e != "string")
@@ -39,43 +39,43 @@ function Si(e) {
39
39
  return new Uint8Array(new TextEncoder().encode(e));
40
40
  }
41
41
  function Zt(e) {
42
- if (typeof e == "string" && (e = Si(e)), !Vn(e))
42
+ if (typeof e == "string" && (e = Si(e)), !Wn(e))
43
43
  throw new Error(`expected Uint8Array, got ${typeof e}`);
44
44
  return e;
45
45
  }
46
- function Ni(...e) {
46
+ function Ai(...e) {
47
47
  const t = new Uint8Array(e.reduce((r, i) => r + i.length, 0));
48
48
  let n = 0;
49
49
  return e.forEach((r) => {
50
- if (!Vn(r))
50
+ if (!Wn(r))
51
51
  throw new Error("Uint8Array expected");
52
52
  t.set(r, n), n += r.length;
53
53
  }), t;
54
54
  }
55
- let Wn = class {
55
+ let Zn = class {
56
56
  // Safe version that clones internal state
57
57
  clone() {
58
58
  return this._cloneInto();
59
59
  }
60
60
  };
61
- function Ai(e) {
61
+ function Ki(e) {
62
62
  const t = (r) => e().update(Zt(r)).digest(), n = e();
63
63
  return t.outputLen = n.outputLen, t.blockLen = n.blockLen, t.create = () => e(), t;
64
64
  }
65
- function Zn(e = 32) {
65
+ function Gn(e = 32) {
66
66
  if (xt && typeof xt.getRandomValues == "function")
67
67
  return xt.getRandomValues(new Uint8Array(e));
68
68
  throw new Error("crypto.getRandomValues must be defined");
69
69
  }
70
- function Ki(e, t, n, r) {
70
+ function Ci(e, t, n, r) {
71
71
  if (typeof e.setBigUint64 == "function")
72
72
  return e.setBigUint64(t, n, r);
73
73
  const i = BigInt(32), s = BigInt(4294967295), o = Number(n >> i & s), c = Number(n & s), a = r ? 4 : 0, l = r ? 0 : 4;
74
74
  e.setUint32(t + a, o, r), e.setUint32(t + l, c, r);
75
75
  }
76
- let Ci = class extends Wn {
76
+ let Bi = class extends Zn {
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 = Nt(this.buffer);
79
79
  }
80
80
  update(t) {
81
81
  et(this);
@@ -85,7 +85,7 @@ let Ci = class extends Wn {
85
85
  for (let o = 0; o < s; ) {
86
86
  const c = Math.min(i - this.pos, s - o);
87
87
  if (c === i) {
88
- const a = St(t);
88
+ const a = Nt(t);
89
89
  for (; i <= s - o; o += i)
90
90
  this.process(a, o);
91
91
  continue;
@@ -95,14 +95,14 @@ let Ci = class extends Wn {
95
95
  return this.length += t.length, this.roundClean(), this;
96
96
  }
97
97
  digestInto(t) {
98
- et(this), mi(t, this), this.finished = !0;
98
+ et(this), xi(t, this), this.finished = !0;
99
99
  const { buffer: n, view: r, blockLen: i, isLE: s } = this;
100
100
  let { pos: o } = this;
101
101
  n[o++] = 128, this.buffer.subarray(o).fill(0), this.padOffset > i - o && (this.process(r, 0), o = 0);
102
102
  for (let u = o; u < i; u++)
103
103
  n[u] = 0;
104
- Ki(r, i - 8, BigInt(this.length * 8), s), this.process(r, 0);
105
- const c = St(t), a = this.outputLen;
104
+ Ci(r, i - 8, BigInt(this.length * 8), s), this.process(r, 0);
105
+ const c = Nt(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();
@@ -123,7 +123,7 @@ let Ci = class extends Wn {
123
123
  return t.length = i, t.pos = c, t.finished = s, t.destroyed = o, i % n && t.buffer.set(r), t;
124
124
  }
125
125
  };
126
- const Bi = (e, t, n) => e & t ^ ~e & n, ki = (e, t, n) => e & t ^ e & n ^ t & n, _i = /* @__PURE__ */ new Uint32Array([
126
+ const ki = (e, t, n) => e & t ^ ~e & n, _i = (e, t, n) => e & t ^ e & n ^ t & n, Ii = /* @__PURE__ */ new Uint32Array([
127
127
  1116352408,
128
128
  1899447441,
129
129
  3049323471,
@@ -198,7 +198,7 @@ const Bi = (e, t, n) => e & t ^ ~e & n, ki = (e, t, n) => e & t ^ e & n ^ t & n,
198
198
  528734635,
199
199
  1541459225
200
200
  ]), ve = /* @__PURE__ */ new Uint32Array(64);
201
- let Ii = class extends Ci {
201
+ let Ui = class extends Bi {
202
202
  constructor() {
203
203
  super(64, 32, 8, !1), this.A = be[0] | 0, this.B = be[1] | 0, this.C = be[2] | 0, this.D = be[3] | 0, this.E = be[4] | 0, this.F = be[5] | 0, this.G = be[6] | 0, this.H = be[7] | 0;
204
204
  }
@@ -214,12 +214,12 @@ let Ii = class extends Ci {
214
214
  for (let u = 0; u < 16; u++, n += 4)
215
215
  ve[u] = t.getUint32(n, !1);
216
216
  for (let u = 16; u < 64; u++) {
217
- const g = ve[u - 15], b = ve[u - 2], p = re(g, 7) ^ re(g, 18) ^ g >>> 3, h = re(b, 17) ^ re(b, 19) ^ b >>> 10;
218
- ve[u] = h + ve[u - 7] + p + ve[u - 16] | 0;
217
+ const p = ve[u - 15], b = ve[u - 2], y = re(p, 7) ^ re(p, 18) ^ p >>> 3, h = re(b, 17) ^ re(b, 19) ^ b >>> 10;
218
+ ve[u] = h + ve[u - 7] + y + ve[u - 16] | 0;
219
219
  }
220
220
  let { A: r, B: i, C: s, D: o, E: c, F: a, G: l, H: f } = this;
221
221
  for (let u = 0; u < 64; u++) {
222
- const g = re(c, 6) ^ re(c, 11) ^ re(c, 25), b = f + g + Bi(c, a, l) + _i[u] + ve[u] | 0, h = (re(r, 2) ^ re(r, 13) ^ re(r, 22)) + ki(r, i, s) | 0;
222
+ const p = re(c, 6) ^ re(c, 11) ^ re(c, 25), b = f + p + ki(c, a, l) + Ii[u] + ve[u] | 0, h = (re(r, 2) ^ re(r, 13) ^ re(r, 22)) + _i(r, i, s) | 0;
223
223
  f = l, l = a, a = c, c = o + b | 0, o = s, s = i, i = r, r = b + h | 0;
224
224
  }
225
225
  r = r + this.A | 0, i = i + this.B | 0, s = s + this.C | 0, o = o + this.D | 0, c = c + this.E | 0, a = a + this.F | 0, l = l + this.G | 0, f = f + this.H | 0, this.set(r, i, s, o, c, a, l, f);
@@ -231,18 +231,18 @@ let Ii = class extends Ci {
231
231
  this.set(0, 0, 0, 0, 0, 0, 0, 0), this.buffer.fill(0);
232
232
  }
233
233
  };
234
- const $t = /* @__PURE__ */ Ai(() => new Ii());
234
+ const $t = /* @__PURE__ */ Ki(() => new Ui());
235
235
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
236
- const Gn = BigInt(0), ot = BigInt(1), Ui = BigInt(2), at = (e) => e instanceof Uint8Array, Li = /* @__PURE__ */ Array.from({ length: 256 }, (e, t) => t.toString(16).padStart(2, "0"));
237
- function De(e) {
236
+ const Fn = BigInt(0), ot = BigInt(1), Li = BigInt(2), at = (e) => e instanceof Uint8Array, $i = /* @__PURE__ */ Array.from({ length: 256 }, (e, t) => t.toString(16).padStart(2, "0"));
237
+ function qe(e) {
238
238
  if (!at(e))
239
239
  throw new Error("Uint8Array expected");
240
240
  let t = "";
241
241
  for (let n = 0; n < e.length; n++)
242
- t += Li[e[n]];
242
+ t += $i[e[n]];
243
243
  return t;
244
244
  }
245
- function Fn(e) {
245
+ function Jn(e) {
246
246
  const t = e.toString(16);
247
247
  return t.length & 1 ? `0${t}` : t;
248
248
  }
@@ -251,7 +251,7 @@ function Gt(e) {
251
251
  throw new Error("hex string expected, got " + typeof e);
252
252
  return BigInt(e === "" ? "0" : `0x${e}`);
253
253
  }
254
- function je(e) {
254
+ function De(e) {
255
255
  if (typeof e != "string")
256
256
  throw new Error("hex string expected, got " + typeof e);
257
257
  const t = e.length;
@@ -267,27 +267,27 @@ function je(e) {
267
267
  return n;
268
268
  }
269
269
  function F(e) {
270
- return Gt(De(e));
270
+ return Gt(qe(e));
271
271
  }
272
272
  function Ft(e) {
273
273
  if (!at(e))
274
274
  throw new Error("Uint8Array expected");
275
- return Gt(De(Uint8Array.from(e).reverse()));
275
+ return Gt(qe(Uint8Array.from(e).reverse()));
276
276
  }
277
- function Ne(e, t) {
278
- return je(e.toString(16).padStart(t * 2, "0"));
277
+ function Se(e, t) {
278
+ return De(e.toString(16).padStart(t * 2, "0"));
279
279
  }
280
280
  function Jt(e, t) {
281
- return Ne(e, t).reverse();
281
+ return Se(e, t).reverse();
282
282
  }
283
- function $i(e) {
284
- return je(Fn(e));
283
+ function Ti(e) {
284
+ return De(Jn(e));
285
285
  }
286
286
  function W(e, t, n) {
287
287
  let r;
288
288
  if (typeof t == "string")
289
289
  try {
290
- r = je(t);
290
+ r = De(t);
291
291
  } catch (s) {
292
292
  throw new Error(`${e} must be valid hex string, got "${t}". Cause: ${s}`);
293
293
  }
@@ -300,7 +300,7 @@ function W(e, t, n) {
300
300
  throw new Error(`${e} expected ${n} bytes, got ${i}`);
301
301
  return r;
302
302
  }
303
- function Ie(...e) {
303
+ function _e(...e) {
304
304
  const t = new Uint8Array(e.reduce((r, i) => r + i.length, 0));
305
305
  let n = 0;
306
306
  return e.forEach((r) => {
@@ -309,7 +309,7 @@ function Ie(...e) {
309
309
  t.set(r, n), n += r.length;
310
310
  }), t;
311
311
  }
312
- function Ti(e, t) {
312
+ function Ri(e, t) {
313
313
  if (e.length !== t.length)
314
314
  return !1;
315
315
  for (let n = 0; n < e.length; n++)
@@ -317,54 +317,54 @@ function Ti(e, t) {
317
317
  return !1;
318
318
  return !0;
319
319
  }
320
- function Ri(e) {
320
+ function Oi(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 Oi(e) {
325
+ function Mi(e) {
326
326
  let t;
327
- for (t = 0; e > Gn; e >>= ot, t += 1)
327
+ for (t = 0; e > Fn; e >>= ot, t += 1)
328
328
  ;
329
329
  return t;
330
330
  }
331
- function Mi(e, t) {
331
+ function Pi(e, t) {
332
332
  return e >> BigInt(t) & ot;
333
333
  }
334
- const Pi = (e, t, n) => e | (n ? ot : Gn) << BigInt(t), Yt = (e) => (Ui << BigInt(e - 1)) - ot, Nt = (e) => new Uint8Array(e), Cn = (e) => Uint8Array.from(e);
335
- function Jn(e, t, n) {
334
+ const Hi = (e, t, n) => e | (n ? ot : Fn) << BigInt(t), Yt = (e) => (Li << BigInt(e - 1)) - ot, St = (e) => new Uint8Array(e), Cn = (e) => Uint8Array.from(e);
335
+ function Yn(e, t, n) {
336
336
  if (typeof e != "number" || e < 2)
337
337
  throw new Error("hashLen must be a number");
338
338
  if (typeof t != "number" || t < 2)
339
339
  throw new Error("qByteLen must be a number");
340
340
  if (typeof n != "function")
341
341
  throw new Error("hmacFn must be a function");
342
- let r = Nt(e), i = Nt(e), s = 0;
342
+ let r = St(e), i = St(e), s = 0;
343
343
  const o = () => {
344
344
  r.fill(1), i.fill(0), s = 0;
345
- }, c = (...u) => n(i, r, ...u), a = (u = Nt()) => {
345
+ }, c = (...u) => n(i, r, ...u), a = (u = St()) => {
346
346
  i = c(Cn([0]), u), r = c(), u.length !== 0 && (i = c(Cn([1]), u), r = c());
347
347
  }, l = () => {
348
348
  if (s++ >= 1e3)
349
349
  throw new Error("drbg: tried 1000 values");
350
350
  let u = 0;
351
- const g = [];
351
+ const p = [];
352
352
  for (; u < t; ) {
353
353
  r = c();
354
354
  const b = r.slice();
355
- g.push(b), u += r.length;
355
+ p.push(b), u += r.length;
356
356
  }
357
- return Ie(...g);
357
+ return _e(...p);
358
358
  };
359
- return (u, g) => {
359
+ return (u, p) => {
360
360
  o(), a(u);
361
361
  let b;
362
- for (; !(b = g(l())); )
362
+ for (; !(b = p(l())); )
363
363
  a();
364
364
  return o(), b;
365
365
  };
366
366
  }
367
- const Hi = {
367
+ const qi = {
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 Hi = {
377
377
  };
378
378
  function Ye(e, t, n = {}) {
379
379
  const r = (i, s, o) => {
380
- const c = Hi[s];
380
+ const c = qi[s];
381
381
  if (typeof c != "function")
382
382
  throw new Error(`Invalid validator "${s}", expected function`);
383
383
  const a = e[i];
@@ -390,37 +390,37 @@ function Ye(e, t, n = {}) {
390
390
  r(i, s, !0);
391
391
  return e;
392
392
  }
393
- const qi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
393
+ const Di = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
394
394
  __proto__: null,
395
- bitGet: Mi,
396
- bitLen: Oi,
395
+ bitGet: Pi,
396
+ bitLen: Mi,
397
397
  bitMask: Yt,
398
- bitSet: Pi,
399
- bytesToHex: De,
398
+ bitSet: Hi,
399
+ bytesToHex: qe,
400
400
  bytesToNumberBE: F,
401
401
  bytesToNumberLE: Ft,
402
- concatBytes: Ie,
403
- createHmacDrbg: Jn,
402
+ concatBytes: _e,
403
+ createHmacDrbg: Yn,
404
404
  ensureBytes: W,
405
- equalBytes: Ti,
406
- hexToBytes: je,
405
+ equalBytes: Ri,
406
+ hexToBytes: De,
407
407
  hexToNumber: Gt,
408
- numberToBytesBE: Ne,
408
+ numberToBytesBE: Se,
409
409
  numberToBytesLE: Jt,
410
- numberToHexUnpadded: Fn,
411
- numberToVarBytesBE: $i,
412
- utf8ToBytes: Ri,
410
+ numberToHexUnpadded: Jn,
411
+ numberToVarBytesBE: Ti,
412
+ utf8ToBytes: Oi,
413
413
  validateObject: Ye
414
414
  }, Symbol.toStringTag, { value: "Module" }));
415
415
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
416
- const z = BigInt(0), j = BigInt(1), Ce = BigInt(2), Di = BigInt(3), Tt = BigInt(4), Bn = BigInt(5), kn = BigInt(8);
416
+ const z = BigInt(0), j = BigInt(1), Ce = BigInt(2), ji = BigInt(3), Tt = BigInt(4), Bn = BigInt(5), kn = BigInt(8);
417
417
  BigInt(9);
418
418
  BigInt(16);
419
419
  function V(e, t) {
420
420
  const n = e % t;
421
421
  return n >= z ? n : t + n;
422
422
  }
423
- function ji(e, t, n) {
423
+ function zi(e, t, n) {
424
424
  if (n <= z || t < z)
425
425
  throw new Error("Expected power/modulo > 0");
426
426
  if (n === j)
@@ -448,12 +448,12 @@ function Rt(e, t) {
448
448
  throw new Error("invert: does not exist");
449
449
  return V(i, t);
450
450
  }
451
- function zi(e) {
451
+ function Vi(e) {
452
452
  const t = (e - j) / Ce;
453
453
  let n, r, i;
454
454
  for (n = e - j, r = 0; n % Ce === z; n /= Ce, r++)
455
455
  ;
456
- for (i = Ce; i < e && ji(i, t, e) !== e - j; i++)
456
+ for (i = Ce; i < e && zi(i, t, e) !== e - j; i++)
457
457
  ;
458
458
  if (r === 1) {
459
459
  const o = (e + j) / Tt;
@@ -468,21 +468,21 @@ function zi(e) {
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");
471
- let l = r, f = c.pow(c.mul(c.ONE, i), n), u = c.pow(a, s), g = c.pow(a, n);
472
- for (; !c.eql(g, c.ONE); ) {
473
- if (c.eql(g, c.ZERO))
471
+ let l = r, f = c.pow(c.mul(c.ONE, i), n), u = c.pow(a, s), p = c.pow(a, n);
472
+ for (; !c.eql(p, c.ONE); ) {
473
+ if (c.eql(p, c.ZERO))
474
474
  return c.ZERO;
475
475
  let b = 1;
476
- for (let h = c.sqr(g); b < l && !c.eql(h, c.ONE); b++)
476
+ for (let h = c.sqr(p); b < l && !c.eql(h, c.ONE); b++)
477
477
  h = c.sqr(h);
478
- const p = c.pow(f, j << BigInt(l - b - 1));
479
- f = c.sqr(p), u = c.mul(u, p), g = c.mul(g, f), l = b;
478
+ const y = c.pow(f, j << BigInt(l - b - 1));
479
+ f = c.sqr(y), u = c.mul(u, y), p = c.mul(p, f), l = b;
480
480
  }
481
481
  return u;
482
482
  };
483
483
  }
484
- function Vi(e) {
485
- if (e % Tt === Di) {
484
+ function Wi(e) {
485
+ if (e % Tt === ji) {
486
486
  const t = (e + j) / Tt;
487
487
  return function(r, i) {
488
488
  const s = r.pow(i, t);
@@ -500,9 +500,9 @@ function Vi(e) {
500
500
  return l;
501
501
  };
502
502
  }
503
- return zi(e);
503
+ return Vi(e);
504
504
  }
505
- const Wi = [
505
+ const Zi = [
506
506
  "create",
507
507
  "isValid",
508
508
  "is0",
@@ -521,16 +521,16 @@ const Wi = [
521
521
  "mulN",
522
522
  "sqrN"
523
523
  ];
524
- function Zi(e) {
524
+ function Gi(e) {
525
525
  const t = {
526
526
  ORDER: "bigint",
527
527
  MASK: "bigint",
528
528
  BYTES: "isSafeInteger",
529
529
  BITS: "isSafeInteger"
530
- }, n = Wi.reduce((r, i) => (r[i] = "function", r), t);
530
+ }, n = Zi.reduce((r, i) => (r[i] = "function", r), t);
531
531
  return Ye(e, n);
532
532
  }
533
- function Gi(e, t, n) {
533
+ function Fi(e, t, n) {
534
534
  if (n < z)
535
535
  throw new Error("Expected power > 0");
536
536
  if (n === z)
@@ -542,21 +542,21 @@ function Gi(e, t, n) {
542
542
  n & j && (r = e.mul(r, i)), i = e.sqr(i), n >>= j;
543
543
  return r;
544
544
  }
545
- function Fi(e, t) {
545
+ function Ji(e, t) {
546
546
  const n = new Array(t.length), r = t.reduce((s, o, c) => e.is0(o) ? s : (n[c] = s, e.mul(s, o)), e.ONE), i = e.inv(r);
547
547
  return t.reduceRight((s, o, c) => e.is0(o) ? s : (n[c] = e.mul(s, n[c]), e.mul(s, o)), i), n;
548
548
  }
549
- function Yn(e, t) {
549
+ function Xn(e, t) {
550
550
  const n = t !== void 0 ? t : e.toString(2).length, r = Math.ceil(n / 8);
551
551
  return { nBitLength: n, nByteLength: r };
552
552
  }
553
- function Ji(e, t, n = !1, r = {}) {
553
+ function Yi(e, t, n = !1, r = {}) {
554
554
  if (e <= z)
555
555
  throw new Error(`Expected Field ORDER > 0, got ${e}`);
556
- const { nBitLength: i, nByteLength: s } = Yn(e, t);
556
+ const { nBitLength: i, nByteLength: s } = Xn(e, t);
557
557
  if (s > 2048)
558
558
  throw new Error("Field lengths over 2048 bytes are not supported");
559
- const o = Vi(e), c = Object.freeze({
559
+ const o = Wi(e), c = Object.freeze({
560
560
  ORDER: e,
561
561
  BITS: i,
562
562
  BYTES: s,
@@ -577,7 +577,7 @@ function Ji(e, t, n = !1, r = {}) {
577
577
  add: (a, l) => V(a + l, e),
578
578
  sub: (a, l) => V(a - l, e),
579
579
  mul: (a, l) => V(a * l, e),
580
- pow: (a, l) => Gi(c, a, l),
580
+ pow: (a, l) => Fi(c, a, l),
581
581
  div: (a, l) => V(a * Rt(l, e), e),
582
582
  // Same as above, but doesn't normalize
583
583
  sqrN: (a) => a * a,
@@ -586,11 +586,11 @@ function Ji(e, t, n = !1, r = {}) {
586
586
  mulN: (a, l) => a * l,
587
587
  inv: (a) => Rt(a, e),
588
588
  sqrt: r.sqrt || ((a) => o(c, a)),
589
- invertBatch: (a) => Fi(c, a),
589
+ invertBatch: (a) => Ji(c, a),
590
590
  // TODO: do we really need constant cmov?
591
591
  // We don't have const-time bigints anyway, so probably will be not very useful
592
592
  cmov: (a, l, f) => f ? l : a,
593
- toBytes: (a) => n ? Jt(a, s) : Ne(a, s),
593
+ toBytes: (a) => n ? Jt(a, s) : Se(a, s),
594
594
  fromBytes: (a) => {
595
595
  if (a.length !== s)
596
596
  throw new Error(`Fp.fromBytes: expected ${s}, got ${a.length}`);
@@ -599,26 +599,26 @@ function Ji(e, t, n = !1, r = {}) {
599
599
  });
600
600
  return Object.freeze(c);
601
601
  }
602
- function Xn(e) {
602
+ function Qn(e) {
603
603
  if (typeof e != "bigint")
604
604
  throw new Error("field order must be bigint");
605
605
  const t = e.toString(2).length;
606
606
  return Math.ceil(t / 8);
607
607
  }
608
- function Qn(e) {
609
- const t = Xn(e);
608
+ function er(e) {
609
+ const t = Qn(e);
610
610
  return t + Math.ceil(t / 2);
611
611
  }
612
- function Yi(e, t, n = !1) {
613
- const r = e.length, i = Xn(t), s = Qn(t);
612
+ function Xi(e, t, n = !1) {
613
+ const r = e.length, i = Qn(t), s = er(t);
614
614
  if (r < 16 || r < s || r > 1024)
615
615
  throw new Error(`expected ${s}-1024 bytes of input, got ${r}`);
616
616
  const o = n ? F(e) : Ft(e), c = V(o, t - j) + j;
617
- return n ? Jt(c, i) : Ne(c, i);
617
+ return n ? Jt(c, i) : Se(c, i);
618
618
  }
619
619
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
620
- const Xi = BigInt(0), At = BigInt(1);
621
- function Qi(e, t) {
620
+ const Qi = BigInt(0), At = BigInt(1);
621
+ function es(e, t) {
622
622
  const n = (i, s) => {
623
623
  const o = s.negate();
624
624
  return i ? o : s;
@@ -631,7 +631,7 @@ function Qi(e, t) {
631
631
  // non-const time multiplication ladder
632
632
  unsafeLadder(i, s) {
633
633
  let o = e.ZERO, c = i;
634
- for (; s > Xi; )
634
+ for (; s > Qi; )
635
635
  s & At && (o = o.add(c)), c = c.double(), s >>= At;
636
636
  return o;
637
637
  },
@@ -650,7 +650,7 @@ function Qi(e, t) {
650
650
  let l = i, f = l;
651
651
  for (let u = 0; u < o; u++) {
652
652
  f = l, a.push(f);
653
- for (let g = 1; g < c; g++)
653
+ for (let p = 1; p < c; p++)
654
654
  f = f.add(l), a.push(f);
655
655
  l = f.double();
656
656
  }
@@ -666,13 +666,13 @@ function Qi(e, t) {
666
666
  wNAF(i, s, o) {
667
667
  const { windows: c, windowSize: a } = r(i);
668
668
  let l = e.ZERO, f = e.BASE;
669
- const u = BigInt(2 ** i - 1), g = 2 ** i, b = BigInt(i);
670
- for (let p = 0; p < c; p++) {
671
- const h = p * a;
669
+ const u = BigInt(2 ** i - 1), p = 2 ** i, b = BigInt(i);
670
+ for (let y = 0; y < c; y++) {
671
+ const h = y * a;
672
672
  let d = Number(o & u);
673
- o >>= b, d > a && (d -= g, o += At);
674
- const y = h, m = h + Math.abs(d) - 1, A = p % 2 !== 0, I = d < 0;
675
- d === 0 ? f = f.add(n(A, s[y])) : l = l.add(n(I, s[m]));
673
+ o >>= b, d > a && (d -= p, o += At);
674
+ const g = h, m = h + Math.abs(d) - 1, A = y % 2 !== 0, I = d < 0;
675
+ d === 0 ? f = f.add(n(A, s[g])) : l = l.add(n(I, s[m]));
676
676
  }
677
677
  return { p: l, f };
678
678
  },
@@ -683,8 +683,8 @@ function Qi(e, t) {
683
683
  }
684
684
  };
685
685
  }
686
- function er(e) {
687
- return Zi(e.Fp), Ye(e, {
686
+ function tr(e) {
687
+ return Gi(e.Fp), Ye(e, {
688
688
  n: "bigint",
689
689
  h: "bigint",
690
690
  Gx: "field",
@@ -693,14 +693,14 @@ function er(e) {
693
693
  nBitLength: "isSafeInteger",
694
694
  nByteLength: "isSafeInteger"
695
695
  }), Object.freeze({
696
- ...Yn(e.n, e.nBitLength),
696
+ ...Xn(e.n, e.nBitLength),
697
697
  ...e,
698
698
  p: e.Fp.ORDER
699
699
  });
700
700
  }
701
701
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
702
- function es(e) {
703
- const t = er(e);
702
+ function ts(e) {
703
+ const t = tr(e);
704
704
  Ye(t, {
705
705
  a: "field",
706
706
  b: "field"
@@ -722,7 +722,7 @@ function es(e) {
722
722
  }
723
723
  return Object.freeze({ ...t });
724
724
  }
725
- const { bytesToNumberBE: ts, hexToBytes: ns } = qi, ke = {
725
+ const { bytesToNumberBE: ns, hexToBytes: rs } = Di, Be = {
726
726
  // asn.1 DER encoding utils
727
727
  Err: class extends Error {
728
728
  constructor(t = "") {
@@ -730,7 +730,7 @@ const { bytesToNumberBE: ts, hexToBytes: ns } = qi, ke = {
730
730
  }
731
731
  },
732
732
  _parseInt(e) {
733
- const { Err: t } = ke;
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);
@@ -740,10 +740,10 @@ const { bytesToNumberBE: ts, hexToBytes: ns } = qi, ke = {
740
740
  throw new t("Invalid signature integer: negative");
741
741
  if (r[0] === 0 && !(r[1] & 128))
742
742
  throw new t("Invalid signature integer: unnecessary leading zero");
743
- return { d: ts(r), l: e.subarray(n + 2) };
743
+ return { d: ns(r), l: e.subarray(n + 2) };
744
744
  },
745
745
  toSig(e) {
746
- const { Err: t } = ke, n = typeof e == "string" ? ns(e) : e;
746
+ const { Err: t } = Be, n = typeof e == "string" ? rs(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: ts, hexToBytes: ns } = qi, ke = {
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: s } = ke._parseInt(n.subarray(2)), { d: o, l: c } = ke._parseInt(s);
754
+ const { d: i, l: s } = Be._parseInt(n.subarray(2)), { d: o, l: c } = Be._parseInt(s);
755
755
  if (c.length)
756
756
  throw new t("Invalid signature: left bytes after parsing");
757
757
  return { r: i, s: o };
@@ -767,66 +767,66 @@ const { bytesToNumberBE: ts, hexToBytes: ns } = qi, ke = {
767
767
  BigInt(2);
768
768
  const _n = BigInt(3);
769
769
  BigInt(4);
770
- function rs(e) {
771
- const t = es(e), { Fp: n } = t, r = t.toBytes || ((p, h, d) => {
772
- const y = h.toAffine();
773
- return Ie(Uint8Array.from([4]), n.toBytes(y.x), n.toBytes(y.y));
774
- }), i = t.fromBytes || ((p) => {
775
- const h = p.subarray(1), d = n.fromBytes(h.subarray(0, n.BYTES)), y = n.fromBytes(h.subarray(n.BYTES, 2 * n.BYTES));
776
- return { x: d, y };
770
+ function is(e) {
771
+ const t = ts(e), { Fp: n } = t, r = t.toBytes || ((y, h, d) => {
772
+ const g = h.toAffine();
773
+ return _e(Uint8Array.from([4]), n.toBytes(g.x), n.toBytes(g.y));
774
+ }), i = t.fromBytes || ((y) => {
775
+ const h = y.subarray(1), d = n.fromBytes(h.subarray(0, n.BYTES)), g = n.fromBytes(h.subarray(n.BYTES, 2 * n.BYTES));
776
+ return { x: d, y: g };
777
777
  });
778
- function s(p) {
779
- const { a: h, b: d } = t, y = n.sqr(p), m = n.mul(y, p);
780
- return n.add(n.add(m, n.mul(p, h)), d);
778
+ function s(y) {
779
+ const { a: h, b: d } = t, g = n.sqr(y), m = n.mul(g, y);
780
+ return n.add(n.add(m, n.mul(y, h)), d);
781
781
  }
782
782
  if (!n.eql(n.sqr(t.Gy), s(t.Gx)))
783
783
  throw new Error("bad generator point: equation left != right");
784
- function o(p) {
785
- return typeof p == "bigint" && ae < p && p < t.n;
784
+ function o(y) {
785
+ return typeof y == "bigint" && ae < y && y < t.n;
786
786
  }
787
- function c(p) {
788
- if (!o(p))
787
+ function c(y) {
788
+ if (!o(y))
789
789
  throw new Error("Expected valid bigint: 0 < bigint < curve.n");
790
790
  }
791
- function a(p) {
792
- const { allowedPrivateKeyLengths: h, nByteLength: d, wrapPrivateKey: y, n: m } = t;
793
- if (h && typeof p != "bigint") {
794
- if (p instanceof Uint8Array && (p = De(p)), typeof p != "string" || !h.includes(p.length))
791
+ function a(y) {
792
+ const { allowedPrivateKeyLengths: h, nByteLength: d, wrapPrivateKey: g, n: m } = t;
793
+ if (h && typeof y != "bigint") {
794
+ if (y instanceof Uint8Array && (y = qe(y)), typeof y != "string" || !h.includes(y.length))
795
795
  throw new Error("Invalid key");
796
- p = p.padStart(d * 2, "0");
796
+ y = y.padStart(d * 2, "0");
797
797
  }
798
798
  let A;
799
799
  try {
800
- A = typeof p == "bigint" ? p : F(W("private key", p, d));
800
+ A = typeof y == "bigint" ? y : F(W("private key", y, d));
801
801
  } catch {
802
- throw new Error(`private key must be ${d} bytes, hex or bigint, not ${typeof p}`);
802
+ throw new Error(`private key must be ${d} bytes, hex or bigint, not ${typeof y}`);
803
803
  }
804
- return y && (A = V(A, m)), c(A), A;
804
+ return g && (A = V(A, m)), c(A), A;
805
805
  }
806
806
  const l = /* @__PURE__ */ new Map();
807
- function f(p) {
808
- if (!(p instanceof u))
807
+ function f(y) {
808
+ if (!(y instanceof u))
809
809
  throw new Error("ProjectivePoint expected");
810
810
  }
811
811
  class u {
812
- constructor(h, d, y) {
813
- if (this.px = h, this.py = d, this.pz = y, h == null || !n.isValid(h))
812
+ constructor(h, d, g) {
813
+ if (this.px = h, this.py = d, this.pz = g, h == null || !n.isValid(h))
814
814
  throw new Error("x required");
815
815
  if (d == null || !n.isValid(d))
816
816
  throw new Error("y required");
817
- if (y == null || !n.isValid(y))
817
+ if (g == null || !n.isValid(g))
818
818
  throw new Error("z required");
819
819
  }
820
820
  // Does not validate if the point is on-curve.
821
821
  // Use fromHex instead, or call assertValidity() later.
822
822
  static fromAffine(h) {
823
- const { x: d, y } = h || {};
824
- if (!h || !n.isValid(d) || !n.isValid(y))
823
+ const { x: d, y: g } = h || {};
824
+ if (!h || !n.isValid(d) || !n.isValid(g))
825
825
  throw new Error("invalid affine point");
826
826
  if (h instanceof u)
827
827
  throw new Error("projective point not allowed");
828
828
  const m = (A) => n.eql(A, n.ZERO);
829
- return m(d) && m(y) ? u.ZERO : new u(d, y, n.ONE);
829
+ return m(d) && m(g) ? u.ZERO : new u(d, g, n.ONE);
830
830
  }
831
831
  get x() {
832
832
  return this.toAffine().x;
@@ -841,8 +841,8 @@ function rs(e) {
841
841
  * Optimization: converts a list of projective points to a list of identical points with Z=1.
842
842
  */
843
843
  static normalizeZ(h) {
844
- const d = n.invertBatch(h.map((y) => y.pz));
845
- return h.map((y, m) => y.toAffine(d[m])).map(u.fromAffine);
844
+ const d = n.invertBatch(h.map((g) => g.pz));
845
+ return h.map((g, m) => g.toAffine(d[m])).map(u.fromAffine);
846
846
  }
847
847
  /**
848
848
  * Converts hash string or Uint8Array to Point.
@@ -870,8 +870,8 @@ function rs(e) {
870
870
  const { x: h, y: d } = this.toAffine();
871
871
  if (!n.isValid(h) || !n.isValid(d))
872
872
  throw new Error("bad point: x or y not FE");
873
- const y = n.sqr(d), m = s(h);
874
- if (!n.eql(y, m))
873
+ const g = n.sqr(d), m = s(h);
874
+ if (!n.eql(g, 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,7 +887,7 @@ function rs(e) {
887
887
  */
888
888
  equals(h) {
889
889
  f(h);
890
- const { px: d, py: y, pz: m } = this, { px: A, py: I, pz: B } = h, E = n.eql(n.mul(d, B), n.mul(A, m)), x = n.eql(n.mul(y, B), n.mul(I, m));
890
+ const { px: d, py: g, pz: m } = this, { px: A, py: I, pz: B } = h, E = n.eql(n.mul(d, B), n.mul(A, m)), x = n.eql(n.mul(g, B), n.mul(I, m));
891
891
  return E && x;
892
892
  }
893
893
  /**
@@ -901,9 +901,9 @@ function rs(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: d } = t, y = n.mul(d, _n), { px: m, py: A, pz: I } = this;
905
- let B = n.ZERO, E = n.ZERO, x = n.ZERO, S = n.mul(m, m), P = n.mul(A, A), _ = n.mul(I, I), K = n.mul(m, A);
906
- return K = n.add(K, K), x = n.mul(m, I), x = n.add(x, x), B = n.mul(h, x), E = n.mul(y, _), E = n.add(B, E), B = n.sub(P, E), E = n.add(P, E), E = n.mul(B, E), B = n.mul(K, B), x = n.mul(y, x), _ = n.mul(h, _), K = n.sub(S, _), K = n.mul(h, K), K = n.add(K, x), x = n.add(S, S), S = n.add(x, S), S = n.add(S, _), S = n.mul(S, K), E = n.add(E, S), _ = n.mul(A, I), _ = n.add(_, _), S = n.mul(_, K), B = n.sub(B, S), x = n.mul(_, P), x = n.add(x, x), x = n.add(x, x), new u(B, E, x);
904
+ const { a: h, b: d } = t, g = n.mul(d, _n), { px: m, py: A, pz: I } = this;
905
+ let B = n.ZERO, E = n.ZERO, x = n.ZERO, N = n.mul(m, m), P = n.mul(A, A), _ = n.mul(I, I), K = n.mul(m, A);
906
+ return K = n.add(K, K), x = n.mul(m, I), x = n.add(x, x), B = n.mul(h, x), E = n.mul(g, _), E = n.add(B, E), B = n.sub(P, E), E = n.add(P, E), E = n.mul(B, E), B = n.mul(K, B), x = n.mul(g, x), _ = n.mul(h, _), K = n.sub(N, _), K = n.mul(h, K), K = n.add(K, x), x = n.add(N, N), N = n.add(x, N), N = n.add(N, _), N = n.mul(N, K), E = n.add(E, N), _ = n.mul(A, I), _ = n.add(_, _), N = n.mul(_, K), B = n.sub(B, N), x = n.mul(_, P), x = n.add(x, x), x = n.add(x, x), new u(B, 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 rs(e) {
911
911
  // Cost: 12M + 0S + 3*a + 3*b3 + 23add.
912
912
  add(h) {
913
913
  f(h);
914
- const { px: d, py: y, pz: m } = this, { px: A, py: I, pz: B } = h;
915
- let E = n.ZERO, x = n.ZERO, S = n.ZERO;
914
+ const { px: d, py: g, pz: m } = this, { px: A, py: I, pz: B } = h;
915
+ let E = n.ZERO, x = n.ZERO, N = n.ZERO;
916
916
  const P = t.a, _ = n.mul(t.b, _n);
917
- let K = n.mul(d, A), T = n.mul(y, I), R = n.mul(m, B), H = n.add(d, y), w = n.add(A, I);
917
+ let K = n.mul(d, A), T = n.mul(g, I), R = n.mul(m, B), H = n.add(d, g), w = n.add(A, I);
918
918
  H = n.mul(H, w), w = n.add(K, T), H = n.sub(H, w), w = n.add(d, m);
919
919
  let v = n.add(A, B);
920
- return w = n.mul(w, v), v = n.add(K, R), w = n.sub(w, v), v = n.add(y, m), E = n.add(I, B), v = n.mul(v, E), E = n.add(T, R), v = n.sub(v, E), S = n.mul(P, w), E = n.mul(_, R), S = n.add(E, S), E = n.sub(T, S), S = n.add(T, S), x = n.mul(E, S), T = n.add(K, K), T = n.add(T, K), R = n.mul(P, R), w = n.mul(_, w), T = n.add(T, R), R = n.sub(K, R), R = n.mul(P, R), w = n.add(w, R), K = n.mul(T, w), x = n.add(x, K), K = n.mul(v, w), E = n.mul(H, E), E = n.sub(E, K), K = n.mul(H, T), S = n.mul(v, S), S = n.add(S, K), new u(E, x, S);
920
+ return w = n.mul(w, v), v = n.add(K, R), w = n.sub(w, v), v = n.add(g, m), E = n.add(I, B), v = n.mul(v, E), E = n.add(T, R), v = n.sub(v, E), N = n.mul(P, w), E = n.mul(_, R), N = n.add(E, N), E = n.sub(T, N), N = n.add(T, N), x = n.mul(E, N), T = n.add(K, K), T = n.add(T, K), R = n.mul(P, R), w = n.mul(_, w), T = n.add(T, R), R = n.sub(K, R), R = n.mul(P, R), w = n.add(w, R), K = n.mul(T, w), x = n.add(x, K), K = n.mul(v, w), E = n.mul(H, E), E = n.sub(E, K), K = n.mul(H, T), N = n.mul(v, N), N = n.add(N, K), new u(E, x, N);
921
921
  }
922
922
  subtract(h) {
923
923
  return this.add(h.negate());
@@ -927,8 +927,8 @@ function rs(e) {
927
927
  }
928
928
  wNAF(h) {
929
929
  return b.wNAFCached(this, l, h, (d) => {
930
- const y = n.invertBatch(d.map((m) => m.pz));
931
- return d.map((m, A) => m.toAffine(y[A])).map(u.fromAffine);
930
+ const g = n.invertBatch(d.map((m) => m.pz));
931
+ return d.map((m, A) => m.toAffine(g[A])).map(u.fromAffine);
932
932
  });
933
933
  }
934
934
  /**
@@ -942,13 +942,13 @@ function rs(e) {
942
942
  return d;
943
943
  if (c(h), h === Y)
944
944
  return this;
945
- const { endo: y } = t;
946
- if (!y)
945
+ const { endo: g } = t;
946
+ if (!g)
947
947
  return b.unsafeLadder(this, h);
948
- let { k1neg: m, k1: A, k2neg: I, k2: B } = y.splitScalar(h), E = d, x = d, S = this;
948
+ let { k1neg: m, k1: A, k2neg: I, k2: B } = g.splitScalar(h), E = d, x = d, N = this;
949
949
  for (; A > ae || B > ae; )
950
- A & Y && (E = E.add(S)), B & Y && (x = x.add(S)), S = S.double(), A >>= Y, B >>= Y;
951
- return m && (E = E.negate()), I && (x = x.negate()), x = new u(n.mul(x.px, y.beta), x.py, x.pz), E.add(x);
950
+ A & Y && (E = E.add(N)), B & Y && (x = x.add(N)), N = N.double(), A >>= Y, B >>= Y;
951
+ return m && (E = E.negate()), I && (x = x.negate()), x = new u(n.mul(x.px, g.beta), x.py, x.pz), E.add(x);
952
952
  }
953
953
  /**
954
954
  * Constant time multiplication.
@@ -961,17 +961,17 @@ function rs(e) {
961
961
  */
962
962
  multiply(h) {
963
963
  c(h);
964
- let d = h, y, m;
964
+ let d = h, g, m;
965
965
  const { endo: A } = t;
966
966
  if (A) {
967
967
  const { k1neg: I, k1: B, k2neg: E, k2: x } = A.splitScalar(d);
968
- let { p: S, f: P } = this.wNAF(B), { p: _, f: K } = this.wNAF(x);
969
- S = b.constTimeNegate(I, S), _ = b.constTimeNegate(E, _), _ = new u(n.mul(_.px, A.beta), _.py, _.pz), y = S.add(_), m = P.add(K);
968
+ let { p: N, f: P } = this.wNAF(B), { p: _, f: K } = this.wNAF(x);
969
+ N = b.constTimeNegate(I, N), _ = b.constTimeNegate(E, _), _ = new u(n.mul(_.px, A.beta), _.py, _.pz), g = N.add(_), m = P.add(K);
970
970
  } else {
971
971
  const { p: I, f: B } = this.wNAF(d);
972
- y = I, m = B;
972
+ g = I, m = B;
973
973
  }
974
- return u.normalizeZ([y, m])[0];
974
+ return u.normalizeZ([g, m])[0];
975
975
  }
976
976
  /**
977
977
  * Efficiently calculate `aP + bQ`. Unsafe, can expose private key, if used incorrectly.
@@ -979,17 +979,17 @@ function rs(e) {
979
979
  * The trick could be useful if both P and Q are not G (not in our case).
980
980
  * @returns non-zero affine point
981
981
  */
982
- multiplyAndAddUnsafe(h, d, y) {
983
- const m = u.BASE, A = (B, E) => E === ae || E === Y || !B.equals(m) ? B.multiplyUnsafe(E) : B.multiply(E), I = A(this, d).add(A(h, y));
982
+ multiplyAndAddUnsafe(h, d, g) {
983
+ const m = u.BASE, A = (B, E) => E === ae || E === Y || !B.equals(m) ? B.multiplyUnsafe(E) : B.multiply(E), I = A(this, d).add(A(h, g));
984
984
  return I.is0() ? void 0 : I;
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: d, py: y, pz: m } = this, A = this.is0();
990
+ const { px: d, py: g, pz: m } = this, A = this.is0();
991
991
  h == null && (h = A ? n.ONE : n.inv(m));
992
- const I = n.mul(d, h), B = n.mul(y, h), E = n.mul(m, h);
992
+ const I = n.mul(d, h), B = n.mul(g, h), E = n.mul(m, h);
993
993
  if (A)
994
994
  return { x: n.ZERO, y: n.ZERO };
995
995
  if (!n.eql(E, n.ONE))
@@ -1012,11 +1012,11 @@ function rs(e) {
1012
1012
  return this.assertValidity(), r(u, this, h);
1013
1013
  }
1014
1014
  toHex(h = !0) {
1015
- return De(this.toRawBytes(h));
1015
+ return qe(this.toRawBytes(h));
1016
1016
  }
1017
1017
  }
1018
1018
  u.BASE = new u(t.Gx, t.Gy, n.ONE), u.ZERO = new u(n.ZERO, n.ONE, n.ZERO);
1019
- const g = t.nBitLength, b = Qi(u, t.endo ? Math.ceil(g / 2) : g);
1019
+ const p = t.nBitLength, b = es(u, t.endo ? Math.ceil(p / 2) : p);
1020
1020
  return {
1021
1021
  CURVE: t,
1022
1022
  ProjectivePoint: u,
@@ -1025,8 +1025,8 @@ function rs(e) {
1025
1025
  isWithinCurveOrder: o
1026
1026
  };
1027
1027
  }
1028
- function is(e) {
1029
- const t = er(e);
1028
+ function ss(e) {
1029
+ const t = tr(e);
1030
1030
  return Ye(t, {
1031
1031
  hash: "hash",
1032
1032
  hmac: "function",
@@ -1037,8 +1037,8 @@ function is(e) {
1037
1037
  lowS: "boolean"
1038
1038
  }), Object.freeze({ lowS: !0, ...t });
1039
1039
  }
1040
- function ss(e) {
1041
- const t = is(e), { Fp: n, n: r } = t, i = n.BYTES + 1, s = 2 * n.BYTES + 1;
1040
+ function os(e) {
1041
+ const t = ss(e), { Fp: n, n: r } = t, i = n.BYTES + 1, s = 2 * n.BYTES + 1;
1042
1042
  function o(w) {
1043
1043
  return ae < w && w < n.ORDER;
1044
1044
  }
@@ -1048,90 +1048,90 @@ function ss(e) {
1048
1048
  function a(w) {
1049
1049
  return Rt(w, r);
1050
1050
  }
1051
- const { ProjectivePoint: l, normPrivateKeyToScalar: f, weierstrassEquation: u, isWithinCurveOrder: g } = rs({
1051
+ const { ProjectivePoint: l, normPrivateKeyToScalar: f, weierstrassEquation: u, isWithinCurveOrder: p } = is({
1052
1052
  ...t,
1053
- toBytes(w, v, N) {
1054
- const k = v.toAffine(), C = n.toBytes(k.x), U = Ie;
1055
- return N ? U(Uint8Array.from([v.hasEvenY() ? 2 : 3]), C) : U(Uint8Array.from([4]), C, n.toBytes(k.y));
1053
+ toBytes(w, v, S) {
1054
+ const k = v.toAffine(), C = n.toBytes(k.x), U = _e;
1055
+ return S ? U(Uint8Array.from([v.hasEvenY() ? 2 : 3]), C) : U(Uint8Array.from([4]), C, n.toBytes(k.y));
1056
1056
  },
1057
1057
  fromBytes(w) {
1058
- const v = w.length, N = w[0], k = w.subarray(1);
1059
- if (v === i && (N === 2 || N === 3)) {
1058
+ const v = w.length, S = w[0], k = w.subarray(1);
1059
+ if (v === i && (S === 2 || S === 3)) {
1060
1060
  const C = F(k);
1061
1061
  if (!o(C))
1062
1062
  throw new Error("Point is not on curve");
1063
1063
  const U = u(C);
1064
1064
  let O = n.sqrt(U);
1065
1065
  const $ = (O & Y) === Y;
1066
- return (N & 1) === 1 !== $ && (O = n.neg(O)), { x: C, y: O };
1067
- } else if (v === s && N === 4) {
1066
+ return (S & 1) === 1 !== $ && (O = n.neg(O)), { x: C, y: O };
1067
+ } else if (v === s && S === 4) {
1068
1068
  const C = n.fromBytes(k.subarray(0, n.BYTES)), U = n.fromBytes(k.subarray(n.BYTES, 2 * n.BYTES));
1069
1069
  return { x: C, y: U };
1070
1070
  } else
1071
1071
  throw new Error(`Point of length ${v} was invalid. Expected ${i} compressed bytes or ${s} uncompressed bytes`);
1072
1072
  }
1073
- }), b = (w) => De(Ne(w, t.nByteLength));
1074
- function p(w) {
1073
+ }), b = (w) => qe(Se(w, t.nByteLength));
1074
+ function y(w) {
1075
1075
  const v = r >> Y;
1076
1076
  return w > v;
1077
1077
  }
1078
1078
  function h(w) {
1079
- return p(w) ? c(-w) : w;
1079
+ return y(w) ? c(-w) : w;
1080
1080
  }
1081
- const d = (w, v, N) => F(w.slice(v, N));
1082
- class y {
1083
- constructor(v, N, k) {
1084
- this.r = v, this.s = N, this.recovery = k, this.assertValidity();
1081
+ const d = (w, v, S) => F(w.slice(v, S));
1082
+ class g {
1083
+ constructor(v, S, k) {
1084
+ this.r = v, this.s = S, this.recovery = k, this.assertValidity();
1085
1085
  }
1086
1086
  // pair (bytes of r, bytes of s)
1087
1087
  static fromCompact(v) {
1088
- const N = t.nByteLength;
1089
- return v = W("compactSignature", v, N * 2), new y(d(v, 0, N), d(v, N, 2 * N));
1088
+ const S = t.nByteLength;
1089
+ return v = W("compactSignature", v, S * 2), new g(d(v, 0, S), d(v, S, 2 * S));
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: N, s: k } = ke.toSig(W("DER", v));
1095
- return new y(N, k);
1094
+ const { r: S, s: k } = Be.toSig(W("DER", v));
1095
+ return new g(S, k);
1096
1096
  }
1097
1097
  assertValidity() {
1098
- if (!g(this.r))
1098
+ if (!p(this.r))
1099
1099
  throw new Error("r must be 0 < r < CURVE.n");
1100
- if (!g(this.s))
1100
+ if (!p(this.s))
1101
1101
  throw new Error("s must be 0 < s < CURVE.n");
1102
1102
  }
1103
1103
  addRecoveryBit(v) {
1104
- return new y(this.r, this.s, v);
1104
+ return new g(this.r, this.s, v);
1105
1105
  }
1106
1106
  recoverPublicKey(v) {
1107
- const { r: N, s: k, recovery: C } = this, U = x(W("msgHash", v));
1107
+ const { r: S, s: k, recovery: C } = this, U = x(W("msgHash", v));
1108
1108
  if (C == null || ![0, 1, 2, 3].includes(C))
1109
1109
  throw new Error("recovery id invalid");
1110
- const O = C === 2 || C === 3 ? N + t.n : N;
1110
+ const O = C === 2 || C === 3 ? S + t.n : S;
1111
1111
  if (O >= n.ORDER)
1112
1112
  throw new Error("recovery id 2 or 3 invalid");
1113
- const $ = C & 1 ? "03" : "02", Q = l.fromHex($ + b(O)), ge = a(O), Le = c(-U * ge), We = c(k * ge), we = l.BASE.multiplyAndAddUnsafe(Q, Le, We);
1113
+ const $ = C & 1 ? "03" : "02", Q = l.fromHex($ + b(O)), ge = a(O), Ue = c(-U * ge), Ve = c(k * ge), we = l.BASE.multiplyAndAddUnsafe(Q, Ue, Ve);
1114
1114
  if (!we)
1115
1115
  throw new Error("point at infinify");
1116
1116
  return we.assertValidity(), we;
1117
1117
  }
1118
1118
  // Signatures should be low-s, to prevent malleability.
1119
1119
  hasHighS() {
1120
- return p(this.s);
1120
+ return y(this.s);
1121
1121
  }
1122
1122
  normalizeS() {
1123
- return this.hasHighS() ? new y(this.r, c(-this.s), this.recovery) : this;
1123
+ return this.hasHighS() ? new g(this.r, c(-this.s), this.recovery) : this;
1124
1124
  }
1125
1125
  // DER-encoded
1126
1126
  toDERRawBytes() {
1127
- return je(this.toDERHex());
1127
+ return De(this.toDERHex());
1128
1128
  }
1129
1129
  toDERHex() {
1130
- return ke.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() {
1134
- return je(this.toCompactHex());
1134
+ return De(this.toCompactHex());
1135
1135
  }
1136
1136
  toCompactHex() {
1137
1137
  return b(this.r) + b(this.s);
@@ -1151,8 +1151,8 @@ function ss(e) {
1151
1151
  * (groupLen + ceil(groupLen / 2)) with modulo bias being negligible.
1152
1152
  */
1153
1153
  randomPrivateKey: () => {
1154
- const w = Qn(t.n);
1155
- return Yi(t.randomBytes(w), t.n);
1154
+ const w = er(t.n);
1155
+ return Xi(t.randomBytes(w), t.n);
1156
1156
  },
1157
1157
  /**
1158
1158
  * Creates precompute table for an arbitrary EC point. Makes point "cached".
@@ -1170,84 +1170,84 @@ function ss(e) {
1170
1170
  return l.fromPrivateKey(w).toRawBytes(v);
1171
1171
  }
1172
1172
  function I(w) {
1173
- const v = w instanceof Uint8Array, N = typeof w == "string", k = (v || N) && w.length;
1174
- return v ? k === i || k === s : N ? k === 2 * i || k === 2 * s : w instanceof l;
1173
+ const v = w instanceof Uint8Array, S = typeof w == "string", k = (v || S) && w.length;
1174
+ return v ? k === i || k === s : S ? k === 2 * i || k === 2 * s : w instanceof l;
1175
1175
  }
1176
- function B(w, v, N = !0) {
1176
+ function B(w, v, S = !0) {
1177
1177
  if (I(w))
1178
1178
  throw new Error("first arg must be private key");
1179
1179
  if (!I(v))
1180
1180
  throw new Error("second arg must be public key");
1181
- return l.fromHex(v).multiply(f(w)).toRawBytes(N);
1181
+ return l.fromHex(v).multiply(f(w)).toRawBytes(S);
1182
1182
  }
1183
1183
  const E = t.bits2int || function(w) {
1184
- const v = F(w), N = w.length * 8 - t.nBitLength;
1185
- return N > 0 ? v >> BigInt(N) : v;
1184
+ const v = F(w), S = w.length * 8 - t.nBitLength;
1185
+ return S > 0 ? v >> BigInt(S) : v;
1186
1186
  }, x = t.bits2int_modN || function(w) {
1187
1187
  return c(E(w));
1188
- }, S = Yt(t.nBitLength);
1188
+ }, N = Yt(t.nBitLength);
1189
1189
  function P(w) {
1190
1190
  if (typeof w != "bigint")
1191
1191
  throw new Error("bigint expected");
1192
- if (!(ae <= w && w < S))
1192
+ if (!(ae <= w && w < N))
1193
1193
  throw new Error(`bigint expected < 2^${t.nBitLength}`);
1194
- return Ne(w, t.nByteLength);
1194
+ return Se(w, t.nByteLength);
1195
1195
  }
1196
- function _(w, v, N = K) {
1197
- if (["recovered", "canonical"].some((Ke) => Ke in N))
1196
+ function _(w, v, S = K) {
1197
+ if (["recovered", "canonical"].some((Ke) => Ke in S))
1198
1198
  throw new Error("sign() legacy options not supported");
1199
1199
  const { hash: k, randomBytes: C } = t;
1200
- let { lowS: U, prehash: O, extraEntropy: $ } = N;
1200
+ let { lowS: U, prehash: O, extraEntropy: $ } = S;
1201
1201
  U == null && (U = !0), w = W("msgHash", w), O && (w = W("prehashed msgHash", k(w)));
1202
- const Q = x(w), ge = f(v), Le = [P(ge), P(Q)];
1202
+ const Q = x(w), ge = f(v), Ue = [P(ge), P(Q)];
1203
1203
  if ($ != null) {
1204
1204
  const Ke = $ === !0 ? C(n.BYTES) : $;
1205
- Le.push(W("extraEntropy", Ke));
1205
+ Ue.push(W("extraEntropy", Ke));
1206
1206
  }
1207
- const We = Ie(...Le), we = Q;
1207
+ const Ve = _e(...Ue), we = Q;
1208
1208
  function mt(Ke) {
1209
- const $e = E(Ke);
1210
- if (!g($e))
1209
+ const Le = E(Ke);
1210
+ if (!p(Le))
1211
1211
  return;
1212
- const Sn = a($e), Te = l.BASE.multiply($e).toAffine(), ee = c(Te.x);
1212
+ const Nn = a(Le), $e = l.BASE.multiply(Le).toAffine(), ee = c($e.x);
1213
1213
  if (ee === ae)
1214
1214
  return;
1215
- const Re = c(Sn * c(we + ee * ge));
1216
- if (Re === ae)
1215
+ const Te = c(Nn * c(we + ee * ge));
1216
+ if (Te === ae)
1217
1217
  return;
1218
- let Nn = (Te.x === ee ? 0 : 2) | Number(Te.y & Y), An = Re;
1219
- return U && p(Re) && (An = h(Re), Nn ^= 1), new y(ee, An, Nn);
1218
+ let Sn = ($e.x === ee ? 0 : 2) | Number($e.y & Y), An = Te;
1219
+ return U && y(Te) && (An = h(Te), Sn ^= 1), new g(ee, An, Sn);
1220
1220
  }
1221
- return { seed: We, k2sig: mt };
1221
+ return { seed: Ve, k2sig: mt };
1222
1222
  }
1223
1223
  const K = { lowS: t.lowS, prehash: !1 }, T = { lowS: t.lowS, prehash: !1 };
1224
- function R(w, v, N = K) {
1225
- const { seed: k, k2sig: C } = _(w, v, N), U = t;
1226
- return Jn(U.hash.outputLen, U.nByteLength, U.hmac)(k, C);
1224
+ function R(w, v, S = K) {
1225
+ const { seed: k, k2sig: C } = _(w, v, S), U = t;
1226
+ return Yn(U.hash.outputLen, U.nByteLength, U.hmac)(k, C);
1227
1227
  }
1228
1228
  l.BASE._setWindowSize(8);
1229
- function H(w, v, N, k = T) {
1230
- var Te;
1229
+ function H(w, v, S, k = T) {
1230
+ var $e;
1231
1231
  const C = w;
1232
- if (v = W("msgHash", v), N = W("publicKey", N), "strict" in k)
1232
+ if (v = W("msgHash", v), S = W("publicKey", S), "strict" in k)
1233
1233
  throw new Error("options.strict was renamed to lowS");
1234
1234
  const { lowS: U, prehash: O } = k;
1235
1235
  let $, Q;
1236
1236
  try {
1237
1237
  if (typeof C == "string" || C instanceof Uint8Array)
1238
1238
  try {
1239
- $ = y.fromDER(C);
1239
+ $ = g.fromDER(C);
1240
1240
  } catch (ee) {
1241
- if (!(ee instanceof ke.Err))
1241
+ if (!(ee instanceof Be.Err))
1242
1242
  throw ee;
1243
- $ = y.fromCompact(C);
1243
+ $ = g.fromCompact(C);
1244
1244
  }
1245
1245
  else if (typeof C == "object" && typeof C.r == "bigint" && typeof C.s == "bigint") {
1246
- const { r: ee, s: Re } = C;
1247
- $ = new y(ee, Re);
1246
+ const { r: ee, s: Te } = C;
1247
+ $ = new g(ee, Te);
1248
1248
  } else
1249
1249
  throw new Error("PARSE");
1250
- Q = l.fromHex(N);
1250
+ Q = l.fromHex(S);
1251
1251
  } catch (ee) {
1252
1252
  if (ee.message === "PARSE")
1253
1253
  throw new Error("signature must be Signature instance, Uint8Array or hex string");
@@ -1256,8 +1256,8 @@ function ss(e) {
1256
1256
  if (U && $.hasHighS())
1257
1257
  return !1;
1258
1258
  O && (v = t.hash(v));
1259
- const { r: ge, s: Le } = $, We = x(v), we = a(Le), mt = c(We * we), Ke = c(ge * we), $e = (Te = l.BASE.multiplyAndAddUnsafe(Q, mt, Ke)) == null ? void 0 : Te.toAffine();
1260
- return $e ? c($e.x) === ge : !1;
1259
+ const { r: ge, s: Ue } = $, Ve = x(v), we = a(Ue), mt = c(Ve * we), Ke = c(ge * we), Le = ($e = l.BASE.multiplyAndAddUnsafe(Q, mt, Ke)) == null ? void 0 : $e.toAffine();
1260
+ return Le ? c(Le.x) === ge : !1;
1261
1261
  }
1262
1262
  return {
1263
1263
  CURVE: t,
@@ -1266,13 +1266,13 @@ function ss(e) {
1266
1266
  sign: R,
1267
1267
  verify: H,
1268
1268
  ProjectivePoint: l,
1269
- Signature: y,
1269
+ Signature: g,
1270
1270
  utils: m
1271
1271
  };
1272
1272
  }
1273
- let tr = class extends Wn {
1273
+ let nr = class extends Zn {
1274
1274
  constructor(t, n) {
1275
- super(), this.finished = !1, this.destroyed = !1, Ei(t);
1275
+ super(), this.finished = !1, this.destroyed = !1, mi(t);
1276
1276
  const r = Zt(n);
1277
1277
  if (this.iHash = t.create(), typeof this.iHash.update != "function")
1278
1278
  throw new Error("Expected instance of class which extends utils.Hash");
@@ -1290,7 +1290,7 @@ let tr = class extends Wn {
1290
1290
  return et(this), this.iHash.update(t), this;
1291
1291
  }
1292
1292
  digestInto(t) {
1293
- et(this), zn(t, this.outputLen), this.finished = !0, this.iHash.digestInto(t), this.oHash.update(t), this.oHash.digestInto(t), this.destroy();
1293
+ et(this), Vn(t, this.outputLen), this.finished = !0, this.iHash.digestInto(t), this.oHash.update(t), this.oHash.digestInto(t), this.destroy();
1294
1294
  }
1295
1295
  digest() {
1296
1296
  const t = new Uint8Array(this.oHash.outputLen);
@@ -1305,29 +1305,29 @@ let tr = class extends Wn {
1305
1305
  this.destroyed = !0, this.oHash.destroy(), this.iHash.destroy();
1306
1306
  }
1307
1307
  };
1308
- const nr = (e, t, n) => new tr(e, t).update(n).digest();
1309
- nr.create = (e, t) => new tr(e, t);
1308
+ const rr = (e, t, n) => new nr(e, t).update(n).digest();
1309
+ rr.create = (e, t) => new nr(e, t);
1310
1310
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
1311
- function os(e) {
1311
+ function as(e) {
1312
1312
  return {
1313
1313
  hash: e,
1314
- hmac: (t, ...n) => nr(e, t, Ni(...n)),
1315
- randomBytes: Zn
1314
+ hmac: (t, ...n) => rr(e, t, Ai(...n)),
1315
+ randomBytes: Gn
1316
1316
  };
1317
1317
  }
1318
- function as(e, t) {
1319
- const n = (r) => ss({ ...e, ...os(r) });
1318
+ function cs(e, t) {
1319
+ const n = (r) => os({ ...e, ...as(r) });
1320
1320
  return Object.freeze({ ...n(t), create: n });
1321
1321
  }
1322
1322
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
1323
- const ct = BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"), tt = BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"), rr = BigInt(1), nt = BigInt(2), In = (e, t) => (e + t / nt) / t;
1324
- function ir(e) {
1325
- const t = ct, n = BigInt(3), r = BigInt(6), i = BigInt(11), s = BigInt(22), o = 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, g = J(u, n, t) * f % t, b = J(g, nt, t) * l % t, p = J(b, i, t) * b % t, h = J(p, s, t) * p % t, d = J(h, c, t) * h % t, y = J(d, a, t) * d % t, m = J(y, c, t) * h % t, A = J(m, n, t) * f % t, I = J(A, o, t) * p % t, B = J(I, r, t) * l % t, E = J(B, nt, t);
1323
+ const ct = BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"), tt = BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"), ir = BigInt(1), nt = BigInt(2), In = (e, t) => (e + t / nt) / t;
1324
+ function sr(e) {
1325
+ const t = ct, n = BigInt(3), r = BigInt(6), i = BigInt(11), s = BigInt(22), o = 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, p = J(u, n, t) * f % t, b = J(p, nt, t) * l % t, y = J(b, i, t) * b % t, h = J(y, s, t) * y % t, d = J(h, c, t) * h % t, g = J(d, a, t) * d % t, m = J(g, c, t) * h % t, A = J(m, n, t) * f % t, I = J(A, o, t) * y % t, B = J(I, r, t) * l % t, E = J(B, nt, t);
1326
1326
  if (!Ot.eql(Ot.sqr(E), e))
1327
1327
  throw new Error("Cannot find square root");
1328
1328
  return E;
1329
1329
  }
1330
- const Ot = Ji(ct, void 0, void 0, { sqrt: ir }), Ue = as({
1330
+ const Ot = Yi(ct, void 0, void 0, { sqrt: sr }), Ie = cs({
1331
1331
  a: BigInt(0),
1332
1332
  b: BigInt(7),
1333
1333
  Fp: Ot,
@@ -1346,92 +1346,92 @@ const Ot = Ji(ct, void 0, void 0, { sqrt: ir }), Ue = as({
1346
1346
  endo: {
1347
1347
  beta: BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),
1348
1348
  splitScalar: (e) => {
1349
- const t = tt, n = BigInt("0x3086d221a7d46bcde86c90e49284eb15"), r = -rr * BigInt("0xe4437ed6010e88286f547fa90abfe4c3"), i = BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"), s = n, o = BigInt("0x100000000000000000000000000000000"), c = In(s * e, t), a = In(-r * e, t);
1349
+ const t = tt, n = BigInt("0x3086d221a7d46bcde86c90e49284eb15"), r = -ir * BigInt("0xe4437ed6010e88286f547fa90abfe4c3"), i = BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"), s = n, o = BigInt("0x100000000000000000000000000000000"), c = In(s * e, t), a = In(-r * e, t);
1350
1350
  let l = V(e - c * n - a * i, t), f = V(-c * r - a * s, t);
1351
- const u = l > o, g = f > o;
1352
- if (u && (l = t - l), g && (f = t - f), l > o || f > o)
1351
+ const u = l > o, p = f > o;
1352
+ if (u && (l = t - l), p && (f = t - f), l > o || f > o)
1353
1353
  throw new Error("splitScalar: Endomorphism failed, k=" + e);
1354
- return { k1neg: u, k1: l, k2neg: g, k2: f };
1354
+ return { k1neg: u, k1: l, k2neg: p, k2: f };
1355
1355
  }
1356
1356
  }
1357
- }, $t), ut = BigInt(0), sr = (e) => typeof e == "bigint" && ut < e && e < ct, cs = (e) => typeof e == "bigint" && ut < e && e < tt, Un = {};
1357
+ }, $t), ut = BigInt(0), or = (e) => typeof e == "bigint" && ut < e && e < ct, us = (e) => typeof e == "bigint" && ut < e && e < tt, Un = {};
1358
1358
  function rt(e, ...t) {
1359
1359
  let n = Un[e];
1360
1360
  if (n === void 0) {
1361
1361
  const r = $t(Uint8Array.from(e, (i) => i.charCodeAt(0)));
1362
- n = Ie(r, r), Un[e] = n;
1362
+ n = _e(r, r), Un[e] = n;
1363
1363
  }
1364
- return $t(Ie(n, ...t));
1364
+ return $t(_e(n, ...t));
1365
1365
  }
1366
- const Xt = (e) => e.toRawBytes(!0).slice(1), Mt = (e) => Ne(e, 32), Kt = (e) => V(e, ct), Fe = (e) => V(e, tt), Qt = Ue.ProjectivePoint, us = (e, t, n) => Qt.BASE.multiplyAndAddUnsafe(e, t, n);
1366
+ const Xt = (e) => e.toRawBytes(!0).slice(1), Mt = (e) => Se(e, 32), Kt = (e) => V(e, ct), Fe = (e) => V(e, tt), Qt = Ie.ProjectivePoint, ls = (e, t, n) => Qt.BASE.multiplyAndAddUnsafe(e, t, n);
1367
1367
  function Pt(e) {
1368
- let t = Ue.utils.normPrivateKeyToScalar(e), n = Qt.fromPrivateKey(t);
1368
+ let t = Ie.utils.normPrivateKeyToScalar(e), n = Qt.fromPrivateKey(t);
1369
1369
  return { scalar: n.hasEvenY() ? t : Fe(-t), bytes: Xt(n) };
1370
1370
  }
1371
- function or(e) {
1372
- if (!sr(e))
1371
+ function ar(e) {
1372
+ if (!or(e))
1373
1373
  throw new Error("bad x: need 0 < x < p");
1374
1374
  const t = Kt(e * e), n = Kt(t * e + BigInt(7));
1375
- let r = ir(n);
1375
+ let r = sr(n);
1376
1376
  r % nt !== ut && (r = Kt(-r));
1377
- const i = new Qt(e, r, rr);
1377
+ const i = new Qt(e, r, ir);
1378
1378
  return i.assertValidity(), i;
1379
1379
  }
1380
- function ar(...e) {
1380
+ function cr(...e) {
1381
1381
  return Fe(F(rt("BIP0340/challenge", ...e)));
1382
1382
  }
1383
- function ls(e) {
1383
+ function fs(e) {
1384
1384
  return Pt(e).bytes;
1385
1385
  }
1386
- function fs(e, t, n = Zn(32)) {
1386
+ function hs(e, t, n = Gn(32)) {
1387
1387
  const r = W("message", e), { bytes: i, scalar: s } = Pt(t), o = W("auxRand", n, 32), c = Mt(s ^ F(rt("BIP0340/aux", o))), a = rt("BIP0340/nonce", c, i, r), l = Fe(F(a));
1388
1388
  if (l === ut)
1389
1389
  throw new Error("sign failed: k is zero");
1390
- const { bytes: f, scalar: u } = Pt(l), g = ar(f, i, r), b = new Uint8Array(64);
1391
- if (b.set(f, 0), b.set(Mt(Fe(u + g * s)), 32), !cr(b, r, i))
1390
+ const { bytes: f, scalar: u } = Pt(l), p = cr(f, i, r), b = new Uint8Array(64);
1391
+ if (b.set(f, 0), b.set(Mt(Fe(u + p * s)), 32), !ur(b, r, i))
1392
1392
  throw new Error("sign: Invalid signature produced");
1393
1393
  return b;
1394
1394
  }
1395
- function cr(e, t, n) {
1395
+ function ur(e, t, n) {
1396
1396
  const r = W("signature", e, 64), i = W("message", t), s = W("publicKey", n, 32);
1397
1397
  try {
1398
- const o = or(F(s)), c = F(r.subarray(0, 32));
1399
- if (!sr(c))
1398
+ const o = ar(F(s)), c = F(r.subarray(0, 32));
1399
+ if (!or(c))
1400
1400
  return !1;
1401
1401
  const a = F(r.subarray(32, 64));
1402
- if (!cs(a))
1402
+ if (!us(a))
1403
1403
  return !1;
1404
- const l = ar(Mt(c), Xt(o), i), f = us(o, a, Fe(-l));
1404
+ const l = cr(Mt(c), Xt(o), i), f = ls(o, a, Fe(-l));
1405
1405
  return !(!f || !f.hasEvenY() || f.toAffine().x !== c);
1406
1406
  } catch {
1407
1407
  return !1;
1408
1408
  }
1409
1409
  }
1410
- const Ze = {
1411
- getPublicKey: ls,
1412
- sign: fs,
1413
- verify: cr,
1410
+ const We = {
1411
+ getPublicKey: fs,
1412
+ sign: hs,
1413
+ verify: ur,
1414
1414
  utils: {
1415
- randomPrivateKey: Ue.utils.randomPrivateKey,
1416
- lift_x: or,
1415
+ randomPrivateKey: Ie.utils.randomPrivateKey,
1416
+ lift_x: ar,
1417
1417
  pointToBytes: Xt,
1418
- numberToBytesBE: Ne,
1418
+ numberToBytesBE: Se,
1419
1419
  bytesToNumberBE: F,
1420
1420
  taggedHash: rt,
1421
1421
  mod: V
1422
1422
  }
1423
1423
  }, Ct = typeof globalThis == "object" && "crypto" in globalThis ? globalThis.crypto : void 0;
1424
1424
  /*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
1425
- const en = (e) => e instanceof Uint8Array, Bt = (e) => new DataView(e.buffer, e.byteOffset, e.byteLength), ie = (e, t) => e << 32 - t | e >>> t, hs = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
1426
- if (!hs)
1425
+ const en = (e) => e instanceof Uint8Array, Bt = (e) => new DataView(e.buffer, e.byteOffset, e.byteLength), ie = (e, t) => e << 32 - t | e >>> t, ds = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
1426
+ if (!ds)
1427
1427
  throw new Error("Non little-endian hardware is not supported");
1428
- const ds = Array.from({ length: 256 }, (e, t) => t.toString(16).padStart(2, "0"));
1428
+ const ps = Array.from({ length: 256 }, (e, t) => t.toString(16).padStart(2, "0"));
1429
1429
  function M(e) {
1430
1430
  if (!en(e))
1431
1431
  throw new Error("Uint8Array expected");
1432
1432
  let t = "";
1433
1433
  for (let n = 0; n < e.length; n++)
1434
- t += ds[e[n]];
1434
+ t += ps[e[n]];
1435
1435
  return t;
1436
1436
  }
1437
1437
  function G(e) {
@@ -1449,13 +1449,13 @@ function G(e) {
1449
1449
  }
1450
1450
  return n;
1451
1451
  }
1452
- function ps(e) {
1452
+ function ys(e) {
1453
1453
  if (typeof e != "string")
1454
1454
  throw new Error(`utf8ToBytes expected string, got ${typeof e}`);
1455
1455
  return new Uint8Array(new TextEncoder().encode(e));
1456
1456
  }
1457
1457
  function Je(e) {
1458
- if (typeof e == "string" && (e = ps(e)), !en(e))
1458
+ if (typeof e == "string" && (e = ys(e)), !en(e))
1459
1459
  throw new Error(`expected Uint8Array, got ${typeof e}`);
1460
1460
  return e;
1461
1461
  }
@@ -1468,17 +1468,17 @@ function lt(...e) {
1468
1468
  t.set(r, n), n += r.length;
1469
1469
  }), t;
1470
1470
  }
1471
- class ur {
1471
+ class lr {
1472
1472
  // Safe version that clones internal state
1473
1473
  clone() {
1474
1474
  return this._cloneInto();
1475
1475
  }
1476
1476
  }
1477
- function lr(e) {
1477
+ function fr(e) {
1478
1478
  const t = (r) => e().update(Je(r)).digest(), n = e();
1479
1479
  return t.outputLen = n.outputLen, t.blockLen = n.blockLen, t.create = () => e(), t;
1480
1480
  }
1481
- function fr(e = 32) {
1481
+ function hr(e = 32) {
1482
1482
  if (Ct && typeof Ct.getRandomValues == "function")
1483
1483
  return Ct.getRandomValues(new Uint8Array(e));
1484
1484
  throw new Error("crypto.getRandomValues must be defined");
@@ -1487,48 +1487,48 @@ function Ht(e) {
1487
1487
  if (!Number.isSafeInteger(e) || e < 0)
1488
1488
  throw new Error(`Wrong positive integer: ${e}`);
1489
1489
  }
1490
- function ys(e) {
1490
+ function gs(e) {
1491
1491
  if (typeof e != "boolean")
1492
1492
  throw new Error(`Expected boolean, not ${e}`);
1493
1493
  }
1494
- function hr(e, ...t) {
1494
+ function dr(e, ...t) {
1495
1495
  if (!(e instanceof Uint8Array))
1496
1496
  throw new Error("Expected Uint8Array");
1497
1497
  if (t.length > 0 && !t.includes(e.length))
1498
1498
  throw new Error(`Expected Uint8Array of length ${t}, not of length=${e.length}`);
1499
1499
  }
1500
- function gs(e) {
1500
+ function ws(e) {
1501
1501
  if (typeof e != "function" || typeof e.create != "function")
1502
1502
  throw new Error("Hash should be wrapped by utils.wrapConstructor");
1503
1503
  Ht(e.outputLen), Ht(e.blockLen);
1504
1504
  }
1505
- function ws(e, t = !0) {
1505
+ function bs(e, t = !0) {
1506
1506
  if (e.destroyed)
1507
1507
  throw new Error("Hash instance has been destroyed");
1508
1508
  if (t && e.finished)
1509
1509
  throw new Error("Hash#digest() has already been called");
1510
1510
  }
1511
- function bs(e, t) {
1512
- hr(e);
1511
+ function vs(e, t) {
1512
+ dr(e);
1513
1513
  const n = t.outputLen;
1514
1514
  if (e.length < n)
1515
1515
  throw new Error(`digestInto() expects output buffer of length at least ${n}`);
1516
1516
  }
1517
1517
  const se = {
1518
1518
  number: Ht,
1519
- bool: ys,
1520
- bytes: hr,
1521
- hash: gs,
1522
- exists: ws,
1523
- output: bs
1519
+ bool: gs,
1520
+ bytes: dr,
1521
+ hash: ws,
1522
+ exists: bs,
1523
+ output: vs
1524
1524
  };
1525
- function vs(e, t, n, r) {
1525
+ function Es(e, t, n, r) {
1526
1526
  if (typeof e.setBigUint64 == "function")
1527
1527
  return e.setBigUint64(t, n, r);
1528
1528
  const i = BigInt(32), s = BigInt(4294967295), o = Number(n >> i & s), c = Number(n & s), a = r ? 4 : 0, l = r ? 0 : 4;
1529
1529
  e.setUint32(t + a, o, r), e.setUint32(t + l, c, r);
1530
1530
  }
1531
- class Es extends ur {
1531
+ class ms extends lr {
1532
1532
  constructor(t, n, r, i) {
1533
1533
  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 = Bt(this.buffer);
1534
1534
  }
@@ -1556,7 +1556,7 @@ class Es extends ur {
1556
1556
  n[o++] = 128, this.buffer.subarray(o).fill(0), this.padOffset > i - o && (this.process(r, 0), o = 0);
1557
1557
  for (let u = o; u < i; u++)
1558
1558
  n[u] = 0;
1559
- vs(r, i - 8, BigInt(this.length * 8), s), this.process(r, 0);
1559
+ Es(r, i - 8, BigInt(this.length * 8), s), this.process(r, 0);
1560
1560
  const c = Bt(t), a = this.outputLen;
1561
1561
  if (a % 4)
1562
1562
  throw new Error("_sha2: outputLen should be aligned to 32bit");
@@ -1578,7 +1578,7 @@ class Es extends ur {
1578
1578
  return t.length = i, t.pos = c, t.finished = s, t.destroyed = o, i % n && t.buffer.set(r), t;
1579
1579
  }
1580
1580
  }
1581
- const ms = (e, t, n) => e & t ^ ~e & n, xs = (e, t, n) => e & t ^ e & n ^ t & n, Ss = new Uint32Array([
1581
+ const xs = (e, t, n) => e & t ^ ~e & n, Ns = (e, t, n) => e & t ^ e & n ^ t & n, Ss = new Uint32Array([
1582
1582
  1116352408,
1583
1583
  1899447441,
1584
1584
  3049323471,
@@ -1653,7 +1653,7 @@ const ms = (e, t, n) => e & t ^ ~e & n, xs = (e, t, n) => e & t ^ e & n ^ t & n,
1653
1653
  528734635,
1654
1654
  1541459225
1655
1655
  ]), me = new Uint32Array(64);
1656
- class dr extends Es {
1656
+ class pr extends ms {
1657
1657
  constructor() {
1658
1658
  super(64, 32, 8, !1), this.A = Ee[0] | 0, this.B = Ee[1] | 0, this.C = Ee[2] | 0, this.D = Ee[3] | 0, this.E = Ee[4] | 0, this.F = Ee[5] | 0, this.G = Ee[6] | 0, this.H = Ee[7] | 0;
1659
1659
  }
@@ -1669,12 +1669,12 @@ class dr extends Es {
1669
1669
  for (let u = 0; u < 16; u++, n += 4)
1670
1670
  me[u] = t.getUint32(n, !1);
1671
1671
  for (let u = 16; u < 64; u++) {
1672
- const g = me[u - 15], b = me[u - 2], p = ie(g, 7) ^ ie(g, 18) ^ g >>> 3, h = ie(b, 17) ^ ie(b, 19) ^ b >>> 10;
1673
- me[u] = h + me[u - 7] + p + me[u - 16] | 0;
1672
+ const p = me[u - 15], b = me[u - 2], y = ie(p, 7) ^ ie(p, 18) ^ p >>> 3, h = ie(b, 17) ^ ie(b, 19) ^ b >>> 10;
1673
+ me[u] = h + me[u - 7] + y + me[u - 16] | 0;
1674
1674
  }
1675
1675
  let { A: r, B: i, C: s, D: o, E: c, F: a, G: l, H: f } = this;
1676
1676
  for (let u = 0; u < 64; u++) {
1677
- const g = ie(c, 6) ^ ie(c, 11) ^ ie(c, 25), b = f + g + ms(c, a, l) + Ss[u] + me[u] | 0, h = (ie(r, 2) ^ ie(r, 13) ^ ie(r, 22)) + xs(r, i, s) | 0;
1677
+ const p = ie(c, 6) ^ ie(c, 11) ^ ie(c, 25), b = f + p + xs(c, a, l) + Ss[u] + me[u] | 0, h = (ie(r, 2) ^ ie(r, 13) ^ ie(r, 22)) + Ns(r, i, s) | 0;
1678
1678
  f = l, l = a, a = c, c = o + b | 0, o = s, s = i, i = r, r = b + h | 0;
1679
1679
  }
1680
1680
  r = r + this.A | 0, i = i + this.B | 0, s = s + this.C | 0, o = o + this.D | 0, c = c + this.E | 0, a = a + this.F | 0, l = l + this.G | 0, f = f + this.H | 0, this.set(r, i, s, o, c, a, l, f);
@@ -1686,15 +1686,15 @@ class dr extends Es {
1686
1686
  this.set(0, 0, 0, 0, 0, 0, 0, 0), this.buffer.fill(0);
1687
1687
  }
1688
1688
  }
1689
- class Ns extends dr {
1689
+ class As extends pr {
1690
1690
  constructor() {
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 fe = lr(() => new dr());
1695
- lr(() => new Ns());
1694
+ const fe = fr(() => new pr());
1695
+ fr(() => new As());
1696
1696
  /*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) */
1697
- function Ve(e) {
1697
+ function ze(e) {
1698
1698
  if (!Number.isSafeInteger(e))
1699
1699
  throw new Error(`Wrong integer: ${e}`);
1700
1700
  }
@@ -1708,7 +1708,7 @@ function pe(e) {
1708
1708
  if (!Array.isArray(t) || t.length && typeof t[0] != "number")
1709
1709
  throw new Error("alphabet.encode input should be an array of numbers");
1710
1710
  return t.map((n) => {
1711
- if (Ve(n), n < 0 || n >= e.length)
1711
+ if (ze(n), n < 0 || n >= e.length)
1712
1712
  throw new Error(`Digit index outside alphabet: ${n} (alphabet: ${e.length})`);
1713
1713
  return e[n];
1714
1714
  });
@@ -1747,7 +1747,7 @@ function ye(e = "") {
1747
1747
  };
1748
1748
  }
1749
1749
  function ft(e, t = "=") {
1750
- if (Ve(e), typeof t != "string")
1750
+ if (ze(e), typeof t != "string")
1751
1751
  throw new Error("padding chr should be string");
1752
1752
  return {
1753
1753
  encode(n) {
@@ -1776,7 +1776,7 @@ function ft(e, t = "=") {
1776
1776
  }
1777
1777
  };
1778
1778
  }
1779
- function pr(e) {
1779
+ function yr(e) {
1780
1780
  if (typeof e != "function")
1781
1781
  throw new Error("normalize fn should be function");
1782
1782
  return { encode: (t) => t, decode: (t) => e(t) };
@@ -1793,7 +1793,7 @@ function Ln(e, t, n) {
1793
1793
  let r = 0;
1794
1794
  const i = [], s = Array.from(e);
1795
1795
  for (s.forEach((o) => {
1796
- if (Ve(o), o < 0 || o >= t)
1796
+ if (ze(o), o < 0 || o >= t)
1797
1797
  throw new Error(`Wrong integer: ${o}`);
1798
1798
  }); ; ) {
1799
1799
  let o = 0, c = !0;
@@ -1814,7 +1814,7 @@ function Ln(e, t, n) {
1814
1814
  i.push(0);
1815
1815
  return i.reverse();
1816
1816
  }
1817
- const yr = (e, t) => t ? yr(t, e % t) : e, it = (e, t) => e + (t - yr(e, t));
1817
+ const gr = (e, t) => t ? gr(t, e % t) : e, it = (e, t) => e + (t - gr(e, t));
1818
1818
  function qt(e, t, n, r) {
1819
1819
  if (!Array.isArray(e))
1820
1820
  throw new Error("convertRadix2: data should be array");
@@ -1827,7 +1827,7 @@ function qt(e, t, n, r) {
1827
1827
  let i = 0, s = 0;
1828
1828
  const o = 2 ** n - 1, c = [];
1829
1829
  for (const a of e) {
1830
- if (Ve(a), a >= 2 ** t)
1830
+ if (ze(a), a >= 2 ** t)
1831
1831
  throw new Error(`convertRadix2: invalid data word=${a} from=${t}`);
1832
1832
  if (i = i << t | a, s + t > 32)
1833
1833
  throw new Error(`convertRadix2: carry overflow pos=${s} from=${t}`);
@@ -1841,8 +1841,8 @@ function qt(e, t, n, r) {
1841
1841
  throw new Error(`Non-zero padding: ${i}`);
1842
1842
  return r && s > 0 && c.push(i >>> 0), c;
1843
1843
  }
1844
- function As(e) {
1845
- return Ve(e), {
1844
+ function Ks(e) {
1845
+ return ze(e), {
1846
1846
  encode: (t) => {
1847
1847
  if (!(t instanceof Uint8Array))
1848
1848
  throw new Error("radix.encode input should be Uint8Array");
@@ -1856,7 +1856,7 @@ function As(e) {
1856
1856
  };
1857
1857
  }
1858
1858
  function Ae(e, t = !1) {
1859
- if (Ve(e), e <= 0 || e > 32)
1859
+ if (ze(e), e <= 0 || e > 32)
1860
1860
  throw new Error("radix2: bits should be in (0..32]");
1861
1861
  if (it(8, e) > 32 || it(e, 8) > 32)
1862
1862
  throw new Error("radix2: carry overflow");
@@ -1883,13 +1883,13 @@ function $n(e) {
1883
1883
  }
1884
1884
  };
1885
1885
  }
1886
- const Ks = de(Ae(4), pe("0123456789ABCDEF"), ye("")), Cs = de(Ae(5), pe("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"), ft(5), ye(""));
1886
+ const Cs = de(Ae(4), pe("0123456789ABCDEF"), ye("")), Bs = de(Ae(5), pe("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"), ft(5), ye(""));
1887
1887
  de(Ae(5), pe("0123456789ABCDEFGHIJKLMNOPQRSTUV"), ft(5), ye(""));
1888
- de(Ae(5), pe("0123456789ABCDEFGHJKMNPQRSTVWXYZ"), ye(""), pr((e) => e.toUpperCase().replace(/O/g, "0").replace(/[IL]/g, "1")));
1889
- const he = de(Ae(6), pe("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"), ft(6), ye("")), Bs = de(Ae(6), pe("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"), ft(6), ye("")), tn = (e) => de(As(58), pe(e), ye("")), Dt = tn("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");
1888
+ de(Ae(5), pe("0123456789ABCDEFGHJKMNPQRSTVWXYZ"), ye(""), yr((e) => e.toUpperCase().replace(/O/g, "0").replace(/[IL]/g, "1")));
1889
+ const he = de(Ae(6), pe("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"), ft(6), ye("")), ks = de(Ae(6), pe("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"), ft(6), ye("")), tn = (e) => de(Ks(58), pe(e), ye("")), Dt = tn("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");
1890
1890
  tn("123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ");
1891
1891
  tn("rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz");
1892
- const Tn = [0, 2, 3, 5, 6, 7, 9, 10, 11], ks = {
1892
+ const Tn = [0, 2, 3, 5, 6, 7, 9, 10, 11], _s = {
1893
1893
  encode(e) {
1894
1894
  let t = "";
1895
1895
  for (let n = 0; n < e.length; n += 8) {
@@ -1910,7 +1910,7 @@ const Tn = [0, 2, 3, 5, 6, 7, 9, 10, 11], ks = {
1910
1910
  return Uint8Array.from(t);
1911
1911
  }
1912
1912
  }, jt = de(pe("qpzry9x8gf2tvdw0s3jn54khce6mua7l"), ye("")), Rn = [996825010, 642813549, 513874426, 1027748829, 705979059];
1913
- function Ge(e) {
1913
+ function Ze(e) {
1914
1914
  const t = e >> 25;
1915
1915
  let n = (e & 33554431) << 5;
1916
1916
  for (let r = 0; r < Rn.length; r++)
@@ -1924,27 +1924,27 @@ function On(e, t, n = 1) {
1924
1924
  const o = e.charCodeAt(s);
1925
1925
  if (o < 33 || o > 126)
1926
1926
  throw new Error(`Invalid prefix (${e})`);
1927
- i = Ge(i) ^ o >> 5;
1927
+ i = Ze(i) ^ o >> 5;
1928
1928
  }
1929
- i = Ge(i);
1929
+ i = Ze(i);
1930
1930
  for (let s = 0; s < r; s++)
1931
- i = Ge(i) ^ e.charCodeAt(s) & 31;
1931
+ i = Ze(i) ^ e.charCodeAt(s) & 31;
1932
1932
  for (let s of t)
1933
- i = Ge(i) ^ s;
1933
+ i = Ze(i) ^ s;
1934
1934
  for (let s = 0; s < 6; s++)
1935
- i = Ge(i);
1935
+ i = Ze(i);
1936
1936
  return i ^= n, jt.encode(qt([i % 2 ** 30], 30, 5, !1));
1937
1937
  }
1938
- function gr(e) {
1938
+ function wr(e) {
1939
1939
  const t = e === "bech32" ? 1 : 734539939, n = Ae(5), r = n.decode, i = n.encode, s = $n(r);
1940
- function o(f, u, g = 90) {
1940
+ function o(f, u, p = 90) {
1941
1941
  if (typeof f != "string")
1942
1942
  throw new Error(`bech32.encode prefix should be string, not ${typeof f}`);
1943
1943
  if (!Array.isArray(u) || u.length && typeof u[0] != "number")
1944
1944
  throw new Error(`bech32.encode words should be array of numbers, not ${typeof u}`);
1945
1945
  const b = f.length + 7 + u.length;
1946
- if (g !== !1 && b > g)
1947
- throw new TypeError(`Length ${b} exceeds limit ${g}`);
1946
+ if (p !== !1 && b > p)
1947
+ throw new TypeError(`Length ${b} exceeds limit ${p}`);
1948
1948
  return f = f.toLowerCase(), `${f}1${jt.encode(u)}${On(f, u, t)}`;
1949
1949
  }
1950
1950
  function c(f, u = 90) {
@@ -1952,48 +1952,48 @@ function gr(e) {
1952
1952
  throw new Error(`bech32.decode input should be string, not ${typeof f}`);
1953
1953
  if (f.length < 8 || u !== !1 && f.length > u)
1954
1954
  throw new TypeError(`Wrong string length: ${f.length} (${f}). Expected (8..${u})`);
1955
- const g = f.toLowerCase();
1956
- if (f !== g && f !== f.toUpperCase())
1955
+ const p = f.toLowerCase();
1956
+ if (f !== p && f !== f.toUpperCase())
1957
1957
  throw new Error("String must be lowercase or uppercase");
1958
- f = g;
1958
+ f = p;
1959
1959
  const b = f.lastIndexOf("1");
1960
1960
  if (b === 0 || b === -1)
1961
1961
  throw new Error('Letter "1" must be present between prefix and data only');
1962
- const p = f.slice(0, b), h = f.slice(b + 1);
1962
+ const y = f.slice(0, b), h = f.slice(b + 1);
1963
1963
  if (h.length < 6)
1964
1964
  throw new Error("Data must be at least 6 characters long");
1965
- const d = jt.decode(h).slice(0, -6), y = On(p, d, t);
1966
- if (!h.endsWith(y))
1967
- throw new Error(`Invalid checksum in ${f}: expected "${y}"`);
1968
- return { prefix: p, words: d };
1965
+ const d = jt.decode(h).slice(0, -6), g = On(y, d, t);
1966
+ if (!h.endsWith(g))
1967
+ throw new Error(`Invalid checksum in ${f}: expected "${g}"`);
1968
+ return { prefix: y, words: d };
1969
1969
  }
1970
1970
  const a = $n(c);
1971
1971
  function l(f) {
1972
- const { prefix: u, words: g } = c(f, !1);
1973
- return { prefix: u, words: g, bytes: r(g) };
1972
+ const { prefix: u, words: p } = c(f, !1);
1973
+ return { prefix: u, words: p, bytes: r(p) };
1974
1974
  }
1975
1975
  return { encode: o, decode: c, decodeToBytes: l, decodeUnsafe: a, fromWords: r, fromWordsUnsafe: s, toWords: i };
1976
1976
  }
1977
- const ze = gr("bech32");
1978
- gr("bech32m");
1979
- const _s = {
1977
+ const je = wr("bech32");
1978
+ wr("bech32m");
1979
+ const Is = {
1980
1980
  encode: (e) => new TextDecoder().decode(e),
1981
1981
  decode: (e) => new TextEncoder().encode(e)
1982
- }, Is = de(Ae(4), pe("0123456789abcdef"), ye(""), pr((e) => {
1982
+ }, Us = de(Ae(4), pe("0123456789abcdef"), ye(""), yr((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
- })), Us = {
1987
- utf8: _s,
1988
- hex: Is,
1989
- base16: Ks,
1990
- base32: Cs,
1986
+ })), Ls = {
1987
+ utf8: Is,
1988
+ hex: Us,
1989
+ base16: Cs,
1990
+ base32: Bs,
1991
1991
  base64: he,
1992
- base64url: Bs,
1992
+ base64url: ks,
1993
1993
  base58: Dt,
1994
- base58xmr: ks
1994
+ base58xmr: _s
1995
1995
  };
1996
- `${Object.keys(Us).join(", ")}`;
1996
+ `${Object.keys(Ls).join(", ")}`;
1997
1997
  function kt(e) {
1998
1998
  if (!Number.isSafeInteger(e) || e < 0)
1999
1999
  throw new Error(`positive integer expected, not ${e}`);
@@ -2002,25 +2002,25 @@ function Mn(e) {
2002
2002
  if (typeof e != "boolean")
2003
2003
  throw new Error(`boolean expected, not ${e}`);
2004
2004
  }
2005
- function Ls(e) {
2005
+ function $s(e) {
2006
2006
  return e instanceof Uint8Array || e != null && typeof e == "object" && e.constructor.name === "Uint8Array";
2007
2007
  }
2008
2008
  function ce(e, ...t) {
2009
- if (!Ls(e))
2009
+ if (!$s(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}`);
2013
2013
  }
2014
2014
  /*! noble-ciphers - MIT License (c) 2023 Paul Miller (paulmillr.com) */
2015
- const Z = (e) => new Uint32Array(e.buffer, e.byteOffset, Math.floor(e.byteLength / 4)), $s = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
2016
- if (!$s)
2015
+ const Z = (e) => new Uint32Array(e.buffer, e.byteOffset, Math.floor(e.byteLength / 4)), Ts = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
2016
+ if (!Ts)
2017
2017
  throw new Error("Non little-endian hardware is not supported");
2018
- function Ts(e, t) {
2018
+ function Rs(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 Rs(e, t) {
2023
+ function Os(e, t) {
2024
2024
  if (e.length !== t.length)
2025
2025
  return !1;
2026
2026
  let n = 0;
@@ -2028,11 +2028,11 @@ function Rs(e, t) {
2028
2028
  n |= e[r] ^ t[r];
2029
2029
  return n === 0;
2030
2030
  }
2031
- const Os = /* @__NO_SIDE_EFFECTS__ */ (e, t) => (Object.assign(t, e), t), Se = 16, Ms = 283;
2031
+ const Ms = /* @__NO_SIDE_EFFECTS__ */ (e, t) => (Object.assign(t, e), t), Ne = 16, Ps = 283;
2032
2032
  function nn(e) {
2033
- return e << 1 ^ Ms & -(e >> 7);
2033
+ return e << 1 ^ Ps & -(e >> 7);
2034
2034
  }
2035
- function He(e, t) {
2035
+ function Pe(e, t) {
2036
2036
  let n = 0;
2037
2037
  for (; t > 0; t >>= 1)
2038
2038
  n ^= e & -(t & 1), e = nn(e);
@@ -2049,8 +2049,8 @@ const zt = /* @__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
- })(), Ps = /* @__PURE__ */ zt.map((e, t) => zt.indexOf(t)), Hs = (e) => e << 24 | e >>> 8, _t = (e) => e << 8 | e >>> 24;
2053
- function wr(e, t) {
2052
+ })(), Hs = /* @__PURE__ */ zt.map((e, t) => zt.indexOf(t)), qs = (e) => e << 24 | e >>> 8, _t = (e) => e << 8 | e >>> 24;
2053
+ function br(e, t) {
2054
2054
  if (e.length !== 256)
2055
2055
  throw new Error("Wrong sbox length");
2056
2056
  const n = new Uint32Array(256).map((l, f) => t(e[f])), r = n.map(_t), i = r.map(_t), s = i.map(_t), o = new Uint32Array(256 * 256), c = new Uint32Array(256 * 256), a = new Uint16Array(256 * 256);
@@ -2061,13 +2061,13 @@ function wr(e, t) {
2061
2061
  }
2062
2062
  return { sbox: e, sbox2: a, T0: n, T1: r, T2: i, T3: s, T01: o, T23: c };
2063
2063
  }
2064
- const rn = /* @__PURE__ */ wr(zt, (e) => He(e, 3) << 24 | e << 16 | e << 8 | He(e, 2)), br = /* @__PURE__ */ wr(Ps, (e) => He(e, 11) << 24 | He(e, 13) << 16 | He(e, 9) << 8 | He(e, 14)), qs = /* @__PURE__ */ (() => {
2064
+ const rn = /* @__PURE__ */ br(zt, (e) => Pe(e, 3) << 24 | e << 16 | e << 8 | Pe(e, 2)), vr = /* @__PURE__ */ br(Hs, (e) => Pe(e, 11) << 24 | Pe(e, 13) << 16 | Pe(e, 9) << 8 | Pe(e, 14)), Ds = /* @__PURE__ */ (() => {
2065
2065
  const e = new Uint8Array(16);
2066
2066
  for (let t = 0, n = 1; t < 16; t++, n = nn(n))
2067
2067
  e[t] = n;
2068
2068
  return e;
2069
2069
  })();
2070
- function vr(e) {
2070
+ function Er(e) {
2071
2071
  ce(e);
2072
2072
  const t = e.length;
2073
2073
  if (![16, 24, 32].includes(t))
@@ -2076,12 +2076,12 @@ function vr(e) {
2076
2076
  o.set(r);
2077
2077
  for (let c = i; c < o.length; c++) {
2078
2078
  let a = o[c - 1];
2079
- c % i === 0 ? a = s(Hs(a)) ^ qs[c / i - 1] : i > 6 && c % i === 4 && (a = s(a)), o[c] = o[c - i] ^ a;
2079
+ c % i === 0 ? a = s(qs(a)) ^ Ds[c / i - 1] : i > 6 && c % i === 4 && (a = s(a)), o[c] = o[c - i] ^ a;
2080
2080
  }
2081
2081
  return o;
2082
2082
  }
2083
- function Ds(e) {
2084
- const t = vr(e), n = t.slice(), r = t.length, { sbox2: i } = rn, { T0: s, T1: o, T2: c, T3: a } = br;
2083
+ function js(e) {
2084
+ const t = Er(e), n = t.slice(), r = t.length, { sbox2: i } = rn, { T0: s, T1: o, T2: c, T3: a } = vr;
2085
2085
  for (let l = 0; l < r; l += 4)
2086
2086
  for (let f = 0; f < 4; f++)
2087
2087
  n[l + f] = t[r - l - 4 + f];
@@ -2103,50 +2103,50 @@ function Pn(e, t, n, r, i) {
2103
2103
  let a = 0;
2104
2104
  t ^= e[a++], n ^= e[a++], r ^= e[a++], i ^= e[a++];
2105
2105
  const l = e.length / 4 - 2;
2106
- for (let p = 0; p < l; p++) {
2107
- const h = e[a++] ^ xe(o, c, t, n, r, i), d = e[a++] ^ xe(o, c, n, r, i, t), y = e[a++] ^ xe(o, c, r, i, t, n), m = e[a++] ^ xe(o, c, i, t, n, r);
2108
- t = h, n = d, r = y, i = m;
2106
+ for (let y = 0; y < l; y++) {
2107
+ const h = e[a++] ^ xe(o, c, t, n, r, i), d = e[a++] ^ xe(o, c, n, r, i, t), g = e[a++] ^ xe(o, c, r, i, t, n), m = e[a++] ^ xe(o, c, i, t, n, r);
2108
+ t = h, n = d, r = g, i = m;
2109
2109
  }
2110
- const f = e[a++] ^ oe(s, t, n, r, i), u = e[a++] ^ oe(s, n, r, i, t), g = e[a++] ^ oe(s, r, i, t, n), b = e[a++] ^ oe(s, i, t, n, r);
2111
- return { s0: f, s1: u, s2: g, s3: b };
2110
+ const f = e[a++] ^ oe(s, t, n, r, i), u = e[a++] ^ oe(s, n, r, i, t), p = e[a++] ^ oe(s, r, i, t, n), b = e[a++] ^ oe(s, i, t, n, r);
2111
+ return { s0: f, s1: u, s2: p, s3: b };
2112
2112
  }
2113
- function js(e, t, n, r, i) {
2114
- const { sbox2: s, T01: o, T23: c } = br;
2113
+ function zs(e, t, n, r, i) {
2114
+ const { sbox2: s, T01: o, T23: c } = vr;
2115
2115
  let a = 0;
2116
2116
  t ^= e[a++], n ^= e[a++], r ^= e[a++], i ^= e[a++];
2117
2117
  const l = e.length / 4 - 2;
2118
- for (let p = 0; p < l; p++) {
2119
- const h = e[a++] ^ xe(o, c, t, i, r, n), d = e[a++] ^ xe(o, c, n, t, i, r), y = e[a++] ^ xe(o, c, r, n, t, i), m = e[a++] ^ xe(o, c, i, r, n, t);
2120
- t = h, n = d, r = y, i = m;
2118
+ for (let y = 0; y < l; y++) {
2119
+ const h = e[a++] ^ xe(o, c, t, i, r, n), d = e[a++] ^ xe(o, c, n, t, i, r), g = e[a++] ^ xe(o, c, r, n, t, i), m = e[a++] ^ xe(o, c, i, r, n, t);
2120
+ t = h, n = d, r = g, i = m;
2121
2121
  }
2122
- const f = e[a++] ^ oe(s, t, i, r, n), u = e[a++] ^ oe(s, n, t, i, r), g = e[a++] ^ oe(s, r, n, t, i), b = e[a++] ^ oe(s, i, r, n, t);
2123
- return { s0: f, s1: u, s2: g, s3: b };
2122
+ const f = e[a++] ^ oe(s, t, i, r, n), u = e[a++] ^ oe(s, n, t, i, r), p = e[a++] ^ oe(s, r, n, t, i), b = e[a++] ^ oe(s, i, r, n, t);
2123
+ return { s0: f, s1: u, s2: p, s3: b };
2124
2124
  }
2125
- function Er(e, t) {
2125
+ function mr(e, t) {
2126
2126
  if (!t)
2127
2127
  return new Uint8Array(e);
2128
2128
  if (ce(t), t.length < e)
2129
2129
  throw new Error(`aes: wrong destination length, expected at least ${e}, got: ${t.length}`);
2130
2130
  return t;
2131
2131
  }
2132
- function zs(e) {
2133
- if (ce(e), e.length % Se !== 0)
2134
- throw new Error(`aes/(cbc-ecb).decrypt ciphertext should consist of blocks with size ${Se}`);
2132
+ function Vs(e) {
2133
+ if (ce(e), e.length % Ne !== 0)
2134
+ throw new Error(`aes/(cbc-ecb).decrypt ciphertext should consist of blocks with size ${Ne}`);
2135
2135
  }
2136
- function Vs(e, t, n) {
2136
+ function Ws(e, t, n) {
2137
2137
  let r = e.length;
2138
- const i = r % Se;
2138
+ const i = r % Ne;
2139
2139
  if (!t && i !== 0)
2140
2140
  throw new Error("aec/(cbc-ecb): unpadded plaintext with disabled padding");
2141
2141
  const s = Z(e);
2142
2142
  if (t) {
2143
- let a = Se - i;
2144
- a || (a = Se), r = r + a;
2143
+ let a = Ne - i;
2144
+ a || (a = Ne), r = r + a;
2145
2145
  }
2146
- const o = Er(r, n), c = Z(o);
2146
+ const o = mr(r, n), c = Z(o);
2147
2147
  return { b: s, o: c, out: o };
2148
2148
  }
2149
- function Ws(e, t) {
2149
+ function Zs(e, t) {
2150
2150
  if (!t)
2151
2151
  return e;
2152
2152
  const n = e.length;
@@ -2161,43 +2161,43 @@ function Ws(e, t) {
2161
2161
  throw new Error("aes/pcks5: wrong padding");
2162
2162
  return i;
2163
2163
  }
2164
- function Zs(e) {
2164
+ function Gs(e) {
2165
2165
  const t = new Uint8Array(16), n = Z(t);
2166
2166
  t.set(e);
2167
- const r = Se - e.length;
2168
- for (let i = Se - r; i < Se; i++)
2167
+ const r = Ne - e.length;
2168
+ for (let i = Ne - r; i < Ne; i++)
2169
2169
  t[i] = r;
2170
2170
  return n;
2171
2171
  }
2172
- const mr = /* @__PURE__ */ Os({ blockSize: 16, nonceLength: 16 }, function(t, n, r = {}) {
2172
+ const xr = /* @__PURE__ */ Ms({ blockSize: 16, nonceLength: 16 }, function(t, n, r = {}) {
2173
2173
  ce(t), ce(n, 16);
2174
2174
  const i = !r.disablePadding;
2175
2175
  return {
2176
2176
  encrypt: (s, o) => {
2177
- const c = vr(t), { b: a, o: l, out: f } = Vs(s, i, o), u = Z(n);
2178
- let g = u[0], b = u[1], p = u[2], h = u[3], d = 0;
2177
+ const c = Er(t), { b: a, o: l, out: f } = Ws(s, i, o), u = Z(n);
2178
+ let p = u[0], b = u[1], y = u[2], h = u[3], d = 0;
2179
2179
  for (; d + 4 <= a.length; )
2180
- g ^= a[d + 0], b ^= a[d + 1], p ^= a[d + 2], h ^= a[d + 3], { s0: g, s1: b, s2: p, s3: h } = Pn(c, g, b, p, h), l[d++] = g, l[d++] = b, l[d++] = p, l[d++] = h;
2180
+ p ^= a[d + 0], b ^= a[d + 1], y ^= a[d + 2], h ^= a[d + 3], { s0: p, s1: b, s2: y, s3: h } = Pn(c, p, b, y, h), l[d++] = p, l[d++] = b, l[d++] = y, l[d++] = h;
2181
2181
  if (i) {
2182
- const y = Zs(s.subarray(d * 4));
2183
- g ^= y[0], b ^= y[1], p ^= y[2], h ^= y[3], { s0: g, s1: b, s2: p, s3: h } = Pn(c, g, b, p, h), l[d++] = g, l[d++] = b, l[d++] = p, l[d++] = h;
2182
+ const g = Gs(s.subarray(d * 4));
2183
+ p ^= g[0], b ^= g[1], y ^= g[2], h ^= g[3], { s0: p, s1: b, s2: y, s3: h } = Pn(c, p, b, y, h), l[d++] = p, l[d++] = b, l[d++] = y, l[d++] = h;
2184
2184
  }
2185
2185
  return c.fill(0), f;
2186
2186
  },
2187
2187
  decrypt: (s, o) => {
2188
- zs(s);
2189
- const c = Ds(t), a = Z(n), l = Er(s.length, o), f = Z(s), u = Z(l);
2190
- let g = a[0], b = a[1], p = a[2], h = a[3];
2188
+ Vs(s);
2189
+ const c = js(t), a = Z(n), l = mr(s.length, o), f = Z(s), u = Z(l);
2190
+ let p = a[0], b = a[1], y = a[2], h = a[3];
2191
2191
  for (let d = 0; d + 4 <= f.length; ) {
2192
- const y = g, m = b, A = p, I = h;
2193
- g = f[d + 0], b = f[d + 1], p = f[d + 2], h = f[d + 3];
2194
- const { s0: B, s1: E, s2: x, s3: S } = js(c, g, b, p, h);
2195
- u[d++] = B ^ y, u[d++] = E ^ m, u[d++] = x ^ A, u[d++] = S ^ I;
2192
+ const g = p, m = b, A = y, I = h;
2193
+ p = f[d + 0], b = f[d + 1], y = f[d + 2], h = f[d + 3];
2194
+ const { s0: B, s1: E, s2: x, s3: N } = zs(c, p, b, y, h);
2195
+ u[d++] = B ^ g, u[d++] = E ^ m, u[d++] = x ^ A, u[d++] = N ^ I;
2196
2196
  }
2197
- return c.fill(0), Ws(l, i);
2197
+ return c.fill(0), Zs(l, i);
2198
2198
  }
2199
2199
  };
2200
- }), xr = (e) => Uint8Array.from(e.split("").map((t) => t.charCodeAt(0))), Gs = xr("expand 16-byte k"), Fs = xr("expand 32-byte k"), Js = Z(Gs), Sr = Z(Fs);
2200
+ }), Nr = (e) => Uint8Array.from(e.split("").map((t) => t.charCodeAt(0))), Fs = Nr("expand 16-byte k"), Js = Nr("expand 32-byte k"), Ys = Z(Fs), Sr = Z(Js);
2201
2201
  Sr.slice();
2202
2202
  function L(e, t) {
2203
2203
  return e << t | e >>> 32 - t;
@@ -2205,52 +2205,52 @@ function L(e, t) {
2205
2205
  function Vt(e) {
2206
2206
  return e.byteOffset % 4 === 0;
2207
2207
  }
2208
- const Xe = 64, Ys = 16, Nr = 2 ** 32 - 1, Hn = new Uint32Array();
2209
- function Xs(e, t, n, r, i, s, o, c) {
2210
- const a = i.length, l = new Uint8Array(Xe), f = Z(l), u = Vt(i) && Vt(s), g = u ? Z(i) : Hn, b = u ? Z(s) : Hn;
2211
- for (let p = 0; p < a; o++) {
2212
- if (e(t, n, r, f, o, c), o >= Nr)
2208
+ const Xe = 64, Xs = 16, Ar = 2 ** 32 - 1, Hn = new Uint32Array();
2209
+ function Qs(e, t, n, r, i, s, o, c) {
2210
+ const a = i.length, l = new Uint8Array(Xe), f = Z(l), u = Vt(i) && Vt(s), p = u ? Z(i) : Hn, b = u ? Z(s) : Hn;
2211
+ for (let y = 0; y < a; o++) {
2212
+ if (e(t, n, r, f, o, c), o >= Ar)
2213
2213
  throw new Error("arx: counter overflow");
2214
- const h = Math.min(Xe, a - p);
2214
+ const h = Math.min(Xe, a - y);
2215
2215
  if (u && h === Xe) {
2216
- const d = p / 4;
2217
- if (p % 4 !== 0)
2216
+ const d = y / 4;
2217
+ if (y % 4 !== 0)
2218
2218
  throw new Error("arx: invalid block position");
2219
- for (let y = 0, m; y < Ys; y++)
2220
- m = d + y, b[m] = g[m] ^ f[y];
2221
- p += Xe;
2219
+ for (let g = 0, m; g < Xs; g++)
2220
+ m = d + g, b[m] = p[m] ^ f[g];
2221
+ y += Xe;
2222
2222
  continue;
2223
2223
  }
2224
- for (let d = 0, y; d < h; d++)
2225
- y = p + d, s[y] = i[y] ^ l[d];
2226
- p += h;
2224
+ for (let d = 0, g; d < h; d++)
2225
+ g = y + d, s[g] = i[g] ^ l[d];
2226
+ y += h;
2227
2227
  }
2228
2228
  }
2229
- function Qs(e, t) {
2230
- const { allowShortKeys: n, extendNonceFn: r, counterLength: i, counterRight: s, rounds: o } = Ts({ allowShortKeys: !1, counterLength: 8, counterRight: !1, rounds: 20 }, t);
2229
+ function eo(e, t) {
2230
+ const { allowShortKeys: n, extendNonceFn: r, counterLength: i, counterRight: s, rounds: o } = Rs({ 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 kt(i), kt(o), Mn(s), Mn(n), (c, a, l, f, u = 0) => {
2234
2234
  ce(c), ce(a), ce(l);
2235
- const g = l.length;
2236
- if (f || (f = new Uint8Array(g)), ce(f), kt(u), u < 0 || u >= Nr)
2235
+ const p = l.length;
2236
+ if (f || (f = new Uint8Array(p)), ce(f), kt(u), u < 0 || u >= Ar)
2237
2237
  throw new Error("arx: counter overflow");
2238
- if (f.length < g)
2239
- throw new Error(`arx: output (${f.length}) is shorter than data (${g})`);
2238
+ if (f.length < p)
2239
+ throw new Error(`arx: output (${f.length}) is shorter than data (${p})`);
2240
2240
  const b = [];
2241
- let p = c.length, h, d;
2242
- if (p === 32)
2241
+ let y = c.length, h, d;
2242
+ if (y === 32)
2243
2243
  h = c.slice(), b.push(h), d = Sr;
2244
- else if (p === 16 && n)
2245
- h = new Uint8Array(32), h.set(c), h.set(c, 16), d = Js, b.push(h);
2244
+ else if (y === 16 && n)
2245
+ h = new Uint8Array(32), h.set(c), h.set(c, 16), d = Ys, b.push(h);
2246
2246
  else
2247
- throw new Error(`arx: invalid 32-byte key, got length=${p}`);
2247
+ throw new Error(`arx: invalid 32-byte key, got length=${y}`);
2248
2248
  Vt(a) || (a = a.slice(), b.push(a));
2249
- const y = Z(h);
2249
+ const g = Z(h);
2250
2250
  if (r) {
2251
2251
  if (a.length !== 24)
2252
2252
  throw new Error("arx: extended nonce must be 24 bytes");
2253
- r(d, y, Z(a.subarray(0, 16)), y), a = a.subarray(16);
2253
+ r(d, g, Z(a.subarray(0, 16)), g), a = a.subarray(16);
2254
2254
  }
2255
2255
  const m = 16 - i;
2256
2256
  if (m !== a.length)
@@ -2260,24 +2260,24 @@ function Qs(e, t) {
2260
2260
  I.set(a, s ? 0 : 12 - a.length), a = I, b.push(a);
2261
2261
  }
2262
2262
  const A = Z(a);
2263
- for (Xs(e, d, y, A, l, f, u, o); b.length > 0; )
2263
+ for (Qs(e, d, g, A, l, f, u, o); b.length > 0; )
2264
2264
  b.pop().fill(0);
2265
2265
  return f;
2266
2266
  };
2267
2267
  }
2268
- function eo(e, t, n, r, i, s = 20) {
2269
- let o = e[0], c = e[1], a = e[2], l = e[3], f = t[0], u = t[1], g = t[2], b = t[3], p = t[4], h = t[5], d = t[6], y = t[7], m = i, A = n[0], I = n[1], B = n[2], E = o, x = c, S = a, P = l, _ = f, K = u, T = g, R = b, H = p, w = h, v = d, N = y, k = m, C = A, U = I, O = B;
2268
+ function to(e, t, n, r, i, s = 20) {
2269
+ let o = e[0], c = e[1], a = e[2], l = e[3], f = t[0], u = t[1], p = t[2], b = t[3], y = t[4], h = t[5], d = t[6], g = t[7], m = i, A = n[0], I = n[1], B = n[2], E = o, x = c, N = a, P = l, _ = f, K = u, T = p, R = b, H = y, w = h, v = d, S = g, k = m, C = A, U = I, O = B;
2270
2270
  for (let Q = 0; Q < s; Q += 2)
2271
- E = E + _ | 0, k = L(k ^ E, 16), H = H + k | 0, _ = L(_ ^ H, 12), E = E + _ | 0, k = L(k ^ E, 8), H = H + k | 0, _ = L(_ ^ H, 7), x = x + K | 0, C = L(C ^ x, 16), w = w + C | 0, K = L(K ^ w, 12), x = x + K | 0, C = L(C ^ x, 8), w = w + C | 0, K = L(K ^ w, 7), S = S + T | 0, U = L(U ^ S, 16), v = v + U | 0, T = L(T ^ v, 12), S = S + T | 0, U = L(U ^ S, 8), v = v + U | 0, T = L(T ^ v, 7), P = P + R | 0, O = L(O ^ P, 16), N = N + O | 0, R = L(R ^ N, 12), P = P + R | 0, O = L(O ^ P, 8), N = N + O | 0, R = L(R ^ N, 7), E = E + K | 0, O = L(O ^ E, 16), v = v + O | 0, K = L(K ^ v, 12), E = E + K | 0, O = L(O ^ E, 8), v = v + O | 0, K = L(K ^ v, 7), x = x + T | 0, k = L(k ^ x, 16), N = N + k | 0, T = L(T ^ N, 12), x = x + T | 0, k = L(k ^ x, 8), N = N + k | 0, T = L(T ^ N, 7), S = S + R | 0, C = L(C ^ S, 16), H = H + C | 0, R = L(R ^ H, 12), S = S + R | 0, C = L(C ^ S, 8), H = H + C | 0, R = L(R ^ H, 7), P = P + _ | 0, U = L(U ^ P, 16), w = w + U | 0, _ = L(_ ^ w, 12), P = P + _ | 0, U = L(U ^ P, 8), w = w + U | 0, _ = L(_ ^ w, 7);
2271
+ E = E + _ | 0, k = L(k ^ E, 16), H = H + k | 0, _ = L(_ ^ H, 12), E = E + _ | 0, k = L(k ^ E, 8), H = H + k | 0, _ = L(_ ^ H, 7), x = x + K | 0, C = L(C ^ x, 16), w = w + C | 0, K = L(K ^ w, 12), x = x + K | 0, C = L(C ^ x, 8), w = w + C | 0, K = L(K ^ w, 7), N = N + T | 0, U = L(U ^ N, 16), v = v + U | 0, T = L(T ^ v, 12), N = N + T | 0, U = L(U ^ N, 8), v = v + U | 0, T = L(T ^ v, 7), P = P + R | 0, O = L(O ^ P, 16), S = S + O | 0, R = L(R ^ S, 12), P = P + R | 0, O = L(O ^ P, 8), S = S + O | 0, R = L(R ^ S, 7), E = E + K | 0, O = L(O ^ E, 16), v = v + O | 0, K = L(K ^ v, 12), E = E + K | 0, O = L(O ^ E, 8), v = v + O | 0, K = L(K ^ v, 7), x = x + T | 0, k = L(k ^ x, 16), S = S + k | 0, T = L(T ^ S, 12), x = x + T | 0, k = L(k ^ x, 8), S = S + k | 0, T = L(T ^ S, 7), N = N + R | 0, C = L(C ^ N, 16), H = H + C | 0, R = L(R ^ H, 12), N = N + R | 0, C = L(C ^ N, 8), H = H + C | 0, R = L(R ^ H, 7), P = P + _ | 0, U = L(U ^ P, 16), w = w + U | 0, _ = L(_ ^ w, 12), P = P + _ | 0, U = L(U ^ P, 8), w = w + U | 0, _ = L(_ ^ w, 7);
2272
2272
  let $ = 0;
2273
- r[$++] = o + E | 0, r[$++] = c + x | 0, r[$++] = a + S | 0, r[$++] = l + P | 0, r[$++] = f + _ | 0, r[$++] = u + K | 0, r[$++] = g + T | 0, r[$++] = b + R | 0, r[$++] = p + H | 0, r[$++] = h + w | 0, r[$++] = d + v | 0, r[$++] = y + N | 0, r[$++] = m + k | 0, r[$++] = A + C | 0, r[$++] = I + U | 0, r[$++] = B + O | 0;
2273
+ r[$++] = o + E | 0, r[$++] = c + x | 0, r[$++] = a + N | 0, r[$++] = l + P | 0, r[$++] = f + _ | 0, r[$++] = u + K | 0, r[$++] = p + T | 0, r[$++] = b + R | 0, r[$++] = y + H | 0, r[$++] = h + w | 0, r[$++] = d + v | 0, r[$++] = g + S | 0, r[$++] = m + k | 0, r[$++] = A + C | 0, r[$++] = I + U | 0, r[$++] = B + O | 0;
2274
2274
  }
2275
- const Ar = /* @__PURE__ */ Qs(eo, {
2275
+ const Kr = /* @__PURE__ */ eo(to, {
2276
2276
  counterRight: !1,
2277
2277
  counterLength: 4,
2278
2278
  allowShortKeys: !1
2279
2279
  });
2280
- class Kr extends ur {
2280
+ class Cr extends lr {
2281
2281
  constructor(t, n) {
2282
2282
  super(), this.finished = !1, this.destroyed = !1, se.hash(t);
2283
2283
  const r = Je(n);
@@ -2312,13 +2312,13 @@ class Kr extends ur {
2312
2312
  this.destroyed = !0, this.oHash.destroy(), this.iHash.destroy();
2313
2313
  }
2314
2314
  }
2315
- const ht = (e, t, n) => new Kr(e, t).update(n).digest();
2316
- ht.create = (e, t) => new Kr(e, t);
2315
+ const ht = (e, t, n) => new Cr(e, t).update(n).digest();
2316
+ ht.create = (e, t) => new Cr(e, t);
2317
2317
  function sn(e, t, n) {
2318
2318
  return se.hash(e), n === void 0 && (n = new Uint8Array(e.outputLen)), ht(e, Je(n), Je(t));
2319
2319
  }
2320
2320
  const It = new Uint8Array([0]), qn = new Uint8Array();
2321
- function Cr(e, t, n, r = 32) {
2321
+ function Br(e, t, n, r = 32) {
2322
2322
  if (se.hash(e), se.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);
@@ -2328,12 +2328,12 @@ function Cr(e, t, n, r = 32) {
2328
2328
  It[0] = l + 1, c.update(l === 0 ? qn : a).update(n).update(It).digestInto(a), s.set(a, e.outputLen * l), o._cloneInto(c);
2329
2329
  return o.destroy(), c.destroy(), a.fill(0), It.fill(0), s.slice(0, r);
2330
2330
  }
2331
- var to = Object.defineProperty, D = (e, t) => {
2331
+ var no = Object.defineProperty, D = (e, t) => {
2332
2332
  for (var n in t)
2333
- to(e, n, { get: t[n], enumerable: !0 });
2334
- }, Oe = Symbol("verified"), no = (e) => e instanceof Object;
2333
+ no(e, n, { get: t[n], enumerable: !0 });
2334
+ }, Re = Symbol("verified"), ro = (e) => e instanceof Object;
2335
2335
  function dt(e) {
2336
- if (!no(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))
2336
+ if (!ro(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++) {
2339
2339
  let n = e.tags[t];
@@ -2345,28 +2345,28 @@ function dt(e) {
2345
2345
  }
2346
2346
  return !0;
2347
2347
  }
2348
- var ro = {};
2349
- D(ro, {
2350
- Queue: () => ao,
2351
- QueueNode: () => Br,
2348
+ var io = {};
2349
+ D(io, {
2350
+ Queue: () => co,
2351
+ QueueNode: () => kr,
2352
2352
  binarySearch: () => on,
2353
- insertEventIntoAscendingList: () => oo,
2354
- insertEventIntoDescendingList: () => so,
2355
- normalizeURL: () => io,
2353
+ insertEventIntoAscendingList: () => ao,
2354
+ insertEventIntoDescendingList: () => oo,
2355
+ normalizeURL: () => so,
2356
2356
  utf8Decoder: () => ue,
2357
2357
  utf8Encoder: () => ne
2358
2358
  });
2359
2359
  var ue = new TextDecoder("utf-8"), ne = new TextEncoder();
2360
- function io(e) {
2360
+ function so(e) {
2361
2361
  e.indexOf("://") === -1 && (e = "wss://" + e);
2362
2362
  let t = new URL(e);
2363
2363
  return t.pathname = t.pathname.replace(/\/+/g, "/"), t.pathname.endsWith("/") && (t.pathname = t.pathname.slice(0, -1)), (t.port === "80" && t.protocol === "ws:" || t.port === "443" && t.protocol === "wss:") && (t.port = ""), t.searchParams.sort(), t.hash = "", t.toString();
2364
2364
  }
2365
- function so(e, t) {
2365
+ function oo(e, t) {
2366
2366
  const [n, r] = on(e, (i) => t.id === i.id ? 0 : t.created_at === i.created_at ? -1 : i.created_at - t.created_at);
2367
2367
  return r || e.splice(n, 0, t), e;
2368
2368
  }
2369
- function oo(e, t) {
2369
+ function ao(e, t) {
2370
2370
  const [n, r] = on(e, (i) => t.id === i.id ? 0 : t.created_at === i.created_at ? -1 : t.created_at - i.created_at);
2371
2371
  return r || e.splice(n, 0, t), e;
2372
2372
  }
@@ -2380,21 +2380,21 @@ function on(e, t) {
2380
2380
  }
2381
2381
  return [n, !1];
2382
2382
  }
2383
- var Br = class {
2383
+ var kr = class {
2384
2384
  constructor(e) {
2385
2385
  te(this, "value");
2386
2386
  te(this, "next", null);
2387
2387
  te(this, "prev", null);
2388
2388
  this.value = e;
2389
2389
  }
2390
- }, ao = class {
2390
+ }, co = class {
2391
2391
  constructor() {
2392
2392
  te(this, "first");
2393
2393
  te(this, "last");
2394
2394
  this.first = null, this.last = null;
2395
2395
  }
2396
2396
  enqueue(e) {
2397
- const t = new Br(e);
2397
+ const t = new kr(e);
2398
2398
  return this.last ? this.last === this.first ? (this.last = t, this.last.prev = this.first, this.first.next = t) : (t.prev = this.last, this.last.next = t, this.last = t) : (this.first = t, this.last = t), !0;
2399
2399
  }
2400
2400
  dequeue() {
@@ -2407,163 +2407,163 @@ var Br = class {
2407
2407
  const e = this.first;
2408
2408
  return this.first = e.next, e.value;
2409
2409
  }
2410
- }, co = class {
2410
+ }, uo = class {
2411
2411
  generateSecretKey() {
2412
- return Ze.utils.randomPrivateKey();
2412
+ return We.utils.randomPrivateKey();
2413
2413
  }
2414
2414
  getPublicKey(e) {
2415
- return M(Ze.getPublicKey(e));
2415
+ return M(We.getPublicKey(e));
2416
2416
  }
2417
2417
  finalizeEvent(e, t) {
2418
2418
  const n = e;
2419
- return n.pubkey = M(Ze.getPublicKey(t)), n.id = qe(n), n.sig = M(Ze.sign(qe(n), t)), n[Oe] = !0, n;
2419
+ return n.pubkey = M(We.getPublicKey(t)), n.id = He(n), n.sig = M(We.sign(He(n), t)), n[Re] = !0, n;
2420
2420
  }
2421
2421
  verifyEvent(e) {
2422
- if (typeof e[Oe] == "boolean")
2423
- return e[Oe];
2424
- const t = qe(e);
2422
+ if (typeof e[Re] == "boolean")
2423
+ return e[Re];
2424
+ const t = He(e);
2425
2425
  if (t !== e.id)
2426
- return e[Oe] = !1, !1;
2426
+ return e[Re] = !1, !1;
2427
2427
  try {
2428
- const n = Ze.verify(e.sig, t, e.pubkey);
2429
- return e[Oe] = n, n;
2428
+ const n = We.verify(e.sig, t, e.pubkey);
2429
+ return e[Re] = n, n;
2430
2430
  } catch {
2431
- return e[Oe] = !1, !1;
2431
+ return e[Re] = !1, !1;
2432
2432
  }
2433
2433
  }
2434
2434
  };
2435
- function uo(e) {
2435
+ function lo(e) {
2436
2436
  if (!dt(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
- function qe(e) {
2441
- let t = fe(ne.encode(uo(e)));
2440
+ function He(e) {
2441
+ let t = fe(ne.encode(lo(e)));
2442
2442
  return M(t);
2443
2443
  }
2444
- var pt = new co(), _e = pt.generateSecretKey, le = pt.getPublicKey, X = pt.finalizeEvent, yt = pt.verifyEvent, lo = {};
2445
- D(lo, {
2446
- Application: () => da,
2447
- BadgeAward: () => Eo,
2448
- BadgeDefinition: () => oa,
2449
- BlockedRelaysList: () => zo,
2450
- BookmarkList: () => qo,
2451
- Bookmarksets: () => ra,
2452
- Calendar: () => Ea,
2453
- CalendarEventRSVP: () => ma,
2454
- ChannelCreation: () => $r,
2455
- ChannelHideMessage: () => Or,
2456
- ChannelMessage: () => Rr,
2457
- ChannelMetadata: () => Tr,
2458
- ChannelMuteUser: () => Mr,
2459
- ClassifiedListing: () => ga,
2460
- ClientAuth: () => Hr,
2461
- CommunitiesList: () => Do,
2462
- CommunityDefinition: () => Na,
2463
- CommunityPostApproval: () => _o,
2464
- Contacts: () => wo,
2465
- CreateOrUpdateProduct: () => ua,
2466
- CreateOrUpdateStall: () => ca,
2467
- Curationsets: () => ia,
2468
- Date: () => ba,
2469
- DirectMessageRelaysList: () => Go,
2470
- DraftClassifiedListing: () => wa,
2471
- DraftLong: () => fa,
2472
- Emojisets: () => ha,
2473
- EncryptedDirectMessage: () => bo,
2474
- EventDeletion: () => vo,
2475
- FileMetadata: () => No,
2476
- FileServerPreference: () => Fo,
2477
- Followsets: () => ea,
2478
- GenericRepost: () => xo,
2479
- Genericlists: () => ta,
2480
- GiftWrap: () => Pr,
2444
+ var pt = new uo(), ke = pt.generateSecretKey, le = pt.getPublicKey, X = pt.finalizeEvent, yt = pt.verifyEvent, fo = {};
2445
+ D(fo, {
2446
+ Application: () => pa,
2447
+ BadgeAward: () => mo,
2448
+ BadgeDefinition: () => aa,
2449
+ BlockedRelaysList: () => Vo,
2450
+ BookmarkList: () => Do,
2451
+ Bookmarksets: () => ia,
2452
+ Calendar: () => ma,
2453
+ CalendarEventRSVP: () => xa,
2454
+ ChannelCreation: () => Tr,
2455
+ ChannelHideMessage: () => Mr,
2456
+ ChannelMessage: () => Or,
2457
+ ChannelMetadata: () => Rr,
2458
+ ChannelMuteUser: () => Pr,
2459
+ ClassifiedListing: () => wa,
2460
+ ClientAuth: () => qr,
2461
+ CommunitiesList: () => jo,
2462
+ CommunityDefinition: () => Aa,
2463
+ CommunityPostApproval: () => Io,
2464
+ Contacts: () => bo,
2465
+ CreateOrUpdateProduct: () => la,
2466
+ CreateOrUpdateStall: () => ua,
2467
+ Curationsets: () => sa,
2468
+ Date: () => va,
2469
+ DirectMessageRelaysList: () => Fo,
2470
+ DraftClassifiedListing: () => ba,
2471
+ DraftLong: () => ha,
2472
+ Emojisets: () => da,
2473
+ EncryptedDirectMessage: () => vo,
2474
+ EventDeletion: () => Eo,
2475
+ FileMetadata: () => Ao,
2476
+ FileServerPreference: () => Jo,
2477
+ Followsets: () => ta,
2478
+ GenericRepost: () => No,
2479
+ Genericlists: () => na,
2480
+ GiftWrap: () => Hr,
2481
2481
  HTTPAuth: () => un,
2482
2482
  Handlerinformation: () => Sa,
2483
- Handlerrecommendation: () => xa,
2484
- Highlights: () => Oo,
2485
- InterestsList: () => Wo,
2486
- Interestsets: () => aa,
2487
- JobFeedback: () => Lo,
2488
- JobRequest: () => Io,
2489
- JobResult: () => Uo,
2490
- Label: () => ko,
2491
- LightningPubRPC: () => Yo,
2492
- LiveChatMessage: () => Ao,
2493
- LiveEvent: () => pa,
2494
- LongFormArticle: () => la,
2495
- Metadata: () => po,
2496
- Mutelist: () => Mo,
2497
- NWCWalletInfo: () => Jo,
2498
- NWCWalletRequest: () => qr,
2499
- NWCWalletResponse: () => Xo,
2500
- NostrConnect: () => Qo,
2483
+ Handlerrecommendation: () => Na,
2484
+ Highlights: () => Mo,
2485
+ InterestsList: () => Zo,
2486
+ Interestsets: () => ca,
2487
+ JobFeedback: () => $o,
2488
+ JobRequest: () => Uo,
2489
+ JobResult: () => Lo,
2490
+ Label: () => _o,
2491
+ LightningPubRPC: () => Xo,
2492
+ LiveChatMessage: () => Ko,
2493
+ LiveEvent: () => ya,
2494
+ LongFormArticle: () => fa,
2495
+ Metadata: () => yo,
2496
+ Mutelist: () => Po,
2497
+ NWCWalletInfo: () => Yo,
2498
+ NWCWalletRequest: () => Dr,
2499
+ NWCWalletResponse: () => Qo,
2500
+ NostrConnect: () => ea,
2501
2501
  OpenTimestamps: () => So,
2502
- Pinlist: () => Po,
2503
- PrivateDirectMessage: () => mo,
2504
- ProblemTracker: () => Ko,
2505
- ProfileBadges: () => sa,
2506
- PublicChatsList: () => jo,
2502
+ Pinlist: () => Ho,
2503
+ PrivateDirectMessage: () => xo,
2504
+ ProblemTracker: () => Co,
2505
+ ProfileBadges: () => oa,
2506
+ PublicChatsList: () => zo,
2507
2507
  Reaction: () => cn,
2508
- RecommendRelay: () => go,
2509
- RelayList: () => Ho,
2510
- Relaysets: () => na,
2511
- Report: () => Co,
2512
- Reporting: () => Bo,
2508
+ RecommendRelay: () => wo,
2509
+ RelayList: () => qo,
2510
+ Relaysets: () => ra,
2511
+ Report: () => Bo,
2512
+ Reporting: () => ko,
2513
2513
  Repost: () => an,
2514
- Seal: () => Lr,
2515
- SearchRelaysList: () => Vo,
2516
- ShortTextNote: () => yo,
2517
- Time: () => va,
2518
- UserEmojiList: () => Zo,
2519
- UserStatuses: () => ya,
2520
- Zap: () => Ro,
2521
- ZapGoal: () => $o,
2522
- ZapRequest: () => To,
2523
- classifyKind: () => fo,
2524
- isEphemeralKind: () => Ir,
2525
- isKind: () => ho,
2526
- isParameterizedReplaceableKind: () => Ur,
2527
- isRegularKind: () => kr,
2528
- isReplaceableKind: () => _r
2514
+ Seal: () => $r,
2515
+ SearchRelaysList: () => Wo,
2516
+ ShortTextNote: () => go,
2517
+ Time: () => Ea,
2518
+ UserEmojiList: () => Go,
2519
+ UserStatuses: () => ga,
2520
+ Zap: () => Oo,
2521
+ ZapGoal: () => To,
2522
+ ZapRequest: () => Ro,
2523
+ classifyKind: () => ho,
2524
+ isEphemeralKind: () => Ur,
2525
+ isKind: () => po,
2526
+ isParameterizedReplaceableKind: () => Lr,
2527
+ isRegularKind: () => _r,
2528
+ isReplaceableKind: () => Ir
2529
2529
  });
2530
- function kr(e) {
2530
+ function _r(e) {
2531
2531
  return 1e3 <= e && e < 1e4 || [1, 2, 4, 5, 6, 7, 8, 16, 40, 41, 42, 43, 44].includes(e);
2532
2532
  }
2533
- function _r(e) {
2533
+ function Ir(e) {
2534
2534
  return [0, 3].includes(e) || 1e4 <= e && e < 2e4;
2535
2535
  }
2536
- function Ir(e) {
2536
+ function Ur(e) {
2537
2537
  return 2e4 <= e && e < 3e4;
2538
2538
  }
2539
- function Ur(e) {
2539
+ function Lr(e) {
2540
2540
  return 3e4 <= e && e < 4e4;
2541
2541
  }
2542
- function fo(e) {
2543
- return kr(e) ? "regular" : _r(e) ? "replaceable" : Ir(e) ? "ephemeral" : Ur(e) ? "parameterized" : "unknown";
2542
+ function ho(e) {
2543
+ return _r(e) ? "regular" : Ir(e) ? "replaceable" : Ur(e) ? "ephemeral" : Lr(e) ? "parameterized" : "unknown";
2544
2544
  }
2545
- function ho(e, t) {
2545
+ function po(e, t) {
2546
2546
  const n = t instanceof Array ? t : [t];
2547
2547
  return dt(e) && n.includes(e.kind) || !1;
2548
2548
  }
2549
- var po = 0, yo = 1, go = 2, wo = 3, bo = 4, vo = 5, an = 6, cn = 7, Eo = 8, Lr = 13, mo = 14, xo = 16, $r = 40, Tr = 41, Rr = 42, Or = 43, Mr = 44, So = 1040, Pr = 1059, No = 1063, Ao = 1311, Ko = 1971, Co = 1984, Bo = 1984, ko = 1985, _o = 4550, Io = 5999, Uo = 6999, Lo = 7e3, $o = 9041, To = 9734, Ro = 9735, Oo = 9802, Mo = 1e4, Po = 10001, Ho = 10002, qo = 10003, Do = 10004, jo = 10005, zo = 10006, Vo = 10007, Wo = 10015, Zo = 10030, Go = 10050, Fo = 10096, Jo = 13194, Yo = 21e3, Hr = 22242, qr = 23194, Xo = 23195, Qo = 24133, un = 27235, ea = 3e4, ta = 30001, na = 30002, ra = 30003, ia = 30004, sa = 30008, oa = 30009, aa = 30015, ca = 30017, ua = 30018, la = 30023, fa = 30024, ha = 30030, da = 30078, pa = 30311, ya = 30315, ga = 30402, wa = 30403, ba = 31922, va = 31923, Ea = 31924, ma = 31925, xa = 31989, Sa = 31990, Na = 34550, Aa = {};
2550
- D(Aa, {
2549
+ var yo = 0, go = 1, wo = 2, bo = 3, vo = 4, Eo = 5, an = 6, cn = 7, mo = 8, $r = 13, xo = 14, No = 16, Tr = 40, Rr = 41, Or = 42, Mr = 43, Pr = 44, So = 1040, Hr = 1059, Ao = 1063, Ko = 1311, Co = 1971, Bo = 1984, ko = 1984, _o = 1985, Io = 4550, Uo = 5999, Lo = 6999, $o = 7e3, To = 9041, Ro = 9734, Oo = 9735, Mo = 9802, Po = 1e4, Ho = 10001, qo = 10002, Do = 10003, jo = 10004, zo = 10005, Vo = 10006, Wo = 10007, Zo = 10015, Go = 10030, Fo = 10050, Jo = 10096, Yo = 13194, Xo = 21e3, qr = 22242, Dr = 23194, Qo = 23195, ea = 24133, un = 27235, ta = 3e4, na = 30001, ra = 30002, ia = 30003, sa = 30004, oa = 30008, aa = 30009, ca = 30015, ua = 30017, la = 30018, fa = 30023, ha = 30024, da = 30030, pa = 30078, ya = 30311, ga = 30315, wa = 30402, ba = 30403, va = 31922, Ea = 31923, ma = 31924, xa = 31925, Na = 31989, Sa = 31990, Aa = 34550, Ka = {};
2550
+ D(Ka, {
2551
2551
  getHex64: () => ln,
2552
- getInt: () => Dr,
2553
- getSubscriptionId: () => Ka,
2554
- matchEventId: () => Ca,
2555
- matchEventKind: () => ka,
2556
- matchEventPubkey: () => Ba
2552
+ getInt: () => jr,
2553
+ getSubscriptionId: () => Ca,
2554
+ matchEventId: () => Ba,
2555
+ matchEventKind: () => _a,
2556
+ matchEventPubkey: () => ka
2557
2557
  });
2558
2558
  function ln(e, t) {
2559
2559
  let n = t.length + 3, r = e.indexOf(`"${t}":`) + n, i = e.slice(r).indexOf('"') + r + 1;
2560
2560
  return e.slice(i, i + 64);
2561
2561
  }
2562
- function Dr(e, t) {
2562
+ function jr(e, t) {
2563
2563
  let n = t.length, r = e.indexOf(`"${t}":`) + n + 3, i = e.slice(r), s = Math.min(i.indexOf(","), i.indexOf("}"));
2564
2564
  return parseInt(i.slice(0, s), 10);
2565
2565
  }
2566
- function Ka(e) {
2566
+ function Ca(e) {
2567
2567
  let t = e.slice(0, 22).indexOf('"EVENT"');
2568
2568
  if (t === -1)
2569
2569
  return null;
@@ -2576,22 +2576,22 @@ function Ka(e) {
2576
2576
  let s = r + 1 + i;
2577
2577
  return e.slice(r + 1, s);
2578
2578
  }
2579
- function Ca(e, t) {
2579
+ function Ba(e, t) {
2580
2580
  return t === ln(e, "id");
2581
2581
  }
2582
- function Ba(e, t) {
2582
+ function ka(e, t) {
2583
2583
  return t === ln(e, "pubkey");
2584
2584
  }
2585
- function ka(e, t) {
2586
- return t === Dr(e, "kind");
2585
+ function _a(e, t) {
2586
+ return t === jr(e, "kind");
2587
2587
  }
2588
- var _a = {};
2589
- D(_a, {
2590
- makeAuthEvent: () => Ia
2588
+ var Ia = {};
2589
+ D(Ia, {
2590
+ makeAuthEvent: () => Ua
2591
2591
  });
2592
- function Ia(e, t) {
2592
+ function Ua(e, t) {
2593
2593
  return {
2594
- kind: Hr,
2594
+ kind: qr,
2595
2595
  created_at: Math.floor(Date.now() / 1e3),
2596
2596
  tags: [
2597
2597
  ["relay", e],
@@ -2600,31 +2600,31 @@ function Ia(e, t) {
2600
2600
  content: ""
2601
2601
  };
2602
2602
  }
2603
- var Ua;
2603
+ var La;
2604
2604
  try {
2605
- Ua = WebSocket;
2605
+ La = WebSocket;
2606
2606
  } catch {
2607
2607
  }
2608
- var La;
2608
+ var $a;
2609
2609
  try {
2610
- La = WebSocket;
2610
+ $a = WebSocket;
2611
2611
  } catch {
2612
2612
  }
2613
- var $a = {};
2614
- D($a, {
2615
- BECH32_REGEX: () => jr,
2613
+ var Ta = {};
2614
+ D(Ta, {
2615
+ BECH32_REGEX: () => zr,
2616
2616
  Bech32MaxSize: () => fn,
2617
- NostrTypeGuard: () => Ta,
2617
+ NostrTypeGuard: () => Ra,
2618
2618
  decode: () => gt,
2619
2619
  encodeBytes: () => bt,
2620
- naddrEncode: () => Da,
2621
- neventEncode: () => qa,
2622
- noteEncode: () => Pa,
2623
- nprofileEncode: () => Ha,
2624
- npubEncode: () => Ma,
2625
- nsecEncode: () => Oa
2620
+ naddrEncode: () => ja,
2621
+ neventEncode: () => Da,
2622
+ noteEncode: () => Ha,
2623
+ nprofileEncode: () => qa,
2624
+ npubEncode: () => Pa,
2625
+ nsecEncode: () => Ma
2626
2626
  });
2627
- var Ta = {
2627
+ var Ra = {
2628
2628
  isNProfile: (e) => /^nprofile1[a-z\d]+$/.test(e || ""),
2629
2629
  isNEvent: (e) => /^nevent1[a-z\d]+$/.test(e || ""),
2630
2630
  isNAddr: (e) => /^naddr1[a-z\d]+$/.test(e || ""),
@@ -2632,14 +2632,14 @@ var Ta = {
2632
2632
  isNPub: (e) => /^npub1[a-z\d]{58}$/.test(e || ""),
2633
2633
  isNote: (e) => /^note1[a-z\d]+$/.test(e || ""),
2634
2634
  isNcryptsec: (e) => /^ncryptsec1[a-z\d]+$/.test(e || "")
2635
- }, fn = 5e3, jr = /[\x21-\x7E]{1,83}1[023456789acdefghjklmnpqrstuvwxyz]{6,}/;
2636
- function Ra(e) {
2635
+ }, fn = 5e3, zr = /[\x21-\x7E]{1,83}1[023456789acdefghjklmnpqrstuvwxyz]{6,}/;
2636
+ function Oa(e) {
2637
2637
  const t = new Uint8Array(4);
2638
2638
  return t[0] = e >> 24 & 255, t[1] = e >> 16 & 255, t[2] = e >> 8 & 255, t[3] = e & 255, t;
2639
2639
  }
2640
2640
  function gt(e) {
2641
2641
  var i, s, o, c, a, l, f;
2642
- let { prefix: t, words: n } = ze.decode(e, fn), r = new Uint8Array(ze.fromWords(n));
2642
+ let { prefix: t, words: n } = je.decode(e, fn), r = new Uint8Array(je.fromWords(n));
2643
2643
  switch (t) {
2644
2644
  case "nprofile": {
2645
2645
  let u = Ut(r);
@@ -2651,7 +2651,7 @@ function gt(e) {
2651
2651
  type: "nprofile",
2652
2652
  data: {
2653
2653
  pubkey: M(u[0][0]),
2654
- relays: u[1] ? u[1].map((g) => ue.decode(g)) : []
2654
+ relays: u[1] ? u[1].map((p) => ue.decode(p)) : []
2655
2655
  }
2656
2656
  };
2657
2657
  }
@@ -2669,7 +2669,7 @@ function gt(e) {
2669
2669
  type: "nevent",
2670
2670
  data: {
2671
2671
  id: M(u[0][0]),
2672
- relays: u[1] ? u[1].map((g) => ue.decode(g)) : [],
2672
+ relays: u[1] ? u[1].map((p) => ue.decode(p)) : [],
2673
2673
  author: (o = u[2]) != null && o[0] ? M(u[2][0]) : void 0,
2674
2674
  kind: (c = u[3]) != null && c[0] ? parseInt(M(u[3][0]), 16) : void 0
2675
2675
  }
@@ -2693,7 +2693,7 @@ function gt(e) {
2693
2693
  identifier: ue.decode(u[0][0]),
2694
2694
  pubkey: M(u[2][0]),
2695
2695
  kind: parseInt(M(u[3][0]), 16),
2696
- relays: u[1] ? u[1].map((g) => ue.decode(g)) : []
2696
+ relays: u[1] ? u[1].map((p) => ue.decode(p)) : []
2697
2697
  }
2698
2698
  };
2699
2699
  }
@@ -2716,32 +2716,32 @@ function Ut(e) {
2716
2716
  }
2717
2717
  return t;
2718
2718
  }
2719
- function Oa(e) {
2719
+ function Ma(e) {
2720
2720
  return bt("nsec", e);
2721
2721
  }
2722
- function Ma(e) {
2722
+ function Pa(e) {
2723
2723
  return bt("npub", G(e));
2724
2724
  }
2725
- function Pa(e) {
2725
+ function Ha(e) {
2726
2726
  return bt("note", G(e));
2727
2727
  }
2728
2728
  function wt(e, t) {
2729
- let n = ze.toWords(t);
2730
- return ze.encode(e, n, fn);
2729
+ let n = je.toWords(t);
2730
+ return je.encode(e, n, fn);
2731
2731
  }
2732
2732
  function bt(e, t) {
2733
2733
  return wt(e, t);
2734
2734
  }
2735
- function Ha(e) {
2735
+ function qa(e) {
2736
2736
  let t = hn({
2737
2737
  0: [G(e.pubkey)],
2738
2738
  1: (e.relays || []).map((n) => ne.encode(n))
2739
2739
  });
2740
2740
  return wt("nprofile", t);
2741
2741
  }
2742
- function qa(e) {
2742
+ function Da(e) {
2743
2743
  let t;
2744
- e.kind !== void 0 && (t = Ra(e.kind));
2744
+ e.kind !== void 0 && (t = Oa(e.kind));
2745
2745
  let n = hn({
2746
2746
  0: [G(e.id)],
2747
2747
  1: (e.relays || []).map((r) => ne.encode(r)),
@@ -2750,7 +2750,7 @@ function qa(e) {
2750
2750
  });
2751
2751
  return wt("nevent", n);
2752
2752
  }
2753
- function Da(e) {
2753
+ function ja(e) {
2754
2754
  let t = new ArrayBuffer(4);
2755
2755
  new DataView(t).setUint32(0, e.kind, !1);
2756
2756
  let n = hn({
@@ -2770,42 +2770,42 @@ function hn(e) {
2770
2770
  });
2771
2771
  }), lt(...t);
2772
2772
  }
2773
- var ja = {};
2774
- D(ja, {
2775
- decrypt: () => za,
2776
- encrypt: () => zr
2773
+ var za = {};
2774
+ D(za, {
2775
+ decrypt: () => Va,
2776
+ encrypt: () => Vr
2777
2777
  });
2778
- async function zr(e, t, n) {
2779
- const r = e instanceof Uint8Array ? M(e) : e, i = Ue.getSharedSecret(r, "02" + t), s = Vr(i);
2780
- let o = Uint8Array.from(fr(16)), c = ne.encode(n), a = mr(s, o).encrypt(c), l = he.encode(new Uint8Array(a)), f = he.encode(new Uint8Array(o.buffer));
2778
+ async function Vr(e, t, n) {
2779
+ const r = e instanceof Uint8Array ? M(e) : e, i = Ie.getSharedSecret(r, "02" + t), s = Wr(i);
2780
+ let o = Uint8Array.from(hr(16)), c = ne.encode(n), a = xr(s, o).encrypt(c), l = he.encode(new Uint8Array(a)), f = he.encode(new Uint8Array(o.buffer));
2781
2781
  return `${l}?iv=${f}`;
2782
2782
  }
2783
- async function za(e, t, n) {
2783
+ async function Va(e, t, n) {
2784
2784
  const r = e instanceof Uint8Array ? M(e) : e;
2785
- let [i, s] = n.split("?iv="), o = Ue.getSharedSecret(r, "02" + t), c = Vr(o), a = he.decode(s), l = he.decode(i), f = mr(c, a).decrypt(l);
2785
+ let [i, s] = n.split("?iv="), o = Ie.getSharedSecret(r, "02" + t), c = Wr(o), a = he.decode(s), l = he.decode(i), f = xr(c, a).decrypt(l);
2786
2786
  return ue.decode(f);
2787
2787
  }
2788
- function Vr(e) {
2788
+ function Wr(e) {
2789
2789
  return e.slice(1, 33);
2790
2790
  }
2791
- var Va = {};
2792
- D(Va, {
2791
+ var Wa = {};
2792
+ D(Wa, {
2793
2793
  NIP05_REGEX: () => dn,
2794
- isNip05: () => Wa,
2795
- isValid: () => Fa,
2796
- queryProfile: () => Wr,
2797
- searchDomain: () => Ga,
2798
- useFetchImplementation: () => Za
2794
+ isNip05: () => Za,
2795
+ isValid: () => Ja,
2796
+ queryProfile: () => Zr,
2797
+ searchDomain: () => Fa,
2798
+ useFetchImplementation: () => Ga
2799
2799
  });
2800
- var dn = /^(?:([\w.+-]+)@)?([\w_-]+(\.[\w_-]+)+)$/, Wa = (e) => dn.test(e || ""), vt;
2800
+ var dn = /^(?:([\w.+-]+)@)?([\w_-]+(\.[\w_-]+)+)$/, Za = (e) => dn.test(e || ""), vt;
2801
2801
  try {
2802
2802
  vt = fetch;
2803
2803
  } catch {
2804
2804
  }
2805
- function Za(e) {
2805
+ function Ga(e) {
2806
2806
  vt = e;
2807
2807
  }
2808
- async function Ga(e, t = "") {
2808
+ async function Fa(e, t = "") {
2809
2809
  try {
2810
2810
  const n = `https://${e}/.well-known/nostr.json?name=${t}`, r = await vt(n, { redirect: "manual" });
2811
2811
  if (r.status !== 200)
@@ -2815,7 +2815,7 @@ async function Ga(e, t = "") {
2815
2815
  return {};
2816
2816
  }
2817
2817
  }
2818
- async function Wr(e) {
2818
+ async function Zr(e) {
2819
2819
  var i;
2820
2820
  const t = e.match(dn);
2821
2821
  if (!t)
@@ -2831,15 +2831,15 @@ async function Wr(e) {
2831
2831
  return null;
2832
2832
  }
2833
2833
  }
2834
- async function Fa(e, t) {
2835
- const n = await Wr(t);
2834
+ async function Ja(e, t) {
2835
+ const n = await Zr(t);
2836
2836
  return n ? n.pubkey === e : !1;
2837
2837
  }
2838
- var Ja = {};
2839
- D(Ja, {
2840
- parse: () => Ya
2838
+ var Ya = {};
2839
+ D(Ya, {
2840
+ parse: () => Xa
2841
2841
  });
2842
- function Ya(e) {
2842
+ function Xa(e) {
2843
2843
  const t = {
2844
2844
  reply: void 0,
2845
2845
  root: void 0,
@@ -2906,31 +2906,31 @@ function Ya(e) {
2906
2906
  }
2907
2907
  }), t;
2908
2908
  }
2909
- var Xa = {};
2910
- D(Xa, {
2911
- fetchRelayInformation: () => ec,
2912
- useFetchImplementation: () => Qa
2909
+ var Qa = {};
2910
+ D(Qa, {
2911
+ fetchRelayInformation: () => tc,
2912
+ useFetchImplementation: () => ec
2913
2913
  });
2914
- var Zr;
2914
+ var Gr;
2915
2915
  try {
2916
- Zr = fetch;
2916
+ Gr = fetch;
2917
2917
  } catch {
2918
2918
  }
2919
- function Qa(e) {
2920
- Zr = e;
2919
+ function ec(e) {
2920
+ Gr = e;
2921
2921
  }
2922
- async function ec(e) {
2922
+ async function tc(e) {
2923
2923
  return await (await fetch(e.replace("ws://", "http://").replace("wss://", "https://"), {
2924
2924
  headers: { Accept: "application/nostr+json" }
2925
2925
  })).json();
2926
2926
  }
2927
- var tc = {};
2928
- D(tc, {
2929
- fastEventHash: () => Fr,
2930
- getPow: () => Gr,
2931
- minePow: () => nc
2927
+ var nc = {};
2928
+ D(nc, {
2929
+ fastEventHash: () => Jr,
2930
+ getPow: () => Fr,
2931
+ minePow: () => rc
2932
2932
  });
2933
- function Gr(e) {
2933
+ function Fr(e) {
2934
2934
  let t = 0;
2935
2935
  for (let n = 0; n < 64; n += 8) {
2936
2936
  const r = parseInt(e.substring(n, n + 8), 16);
@@ -2943,28 +2943,28 @@ function Gr(e) {
2943
2943
  }
2944
2944
  return t;
2945
2945
  }
2946
- function nc(e, t) {
2946
+ function rc(e, t) {
2947
2947
  let n = 0;
2948
2948
  const r = e, i = ["nonce", n.toString(), t.toString()];
2949
2949
  for (r.tags.push(i); ; ) {
2950
2950
  const s = Math.floor((/* @__PURE__ */ new Date()).getTime() / 1e3);
2951
- if (s !== r.created_at && (n = 0, r.created_at = s), i[1] = (++n).toString(), r.id = Fr(r), Gr(r.id) >= t)
2951
+ if (s !== r.created_at && (n = 0, r.created_at = s), i[1] = (++n).toString(), r.id = Jr(r), Fr(r.id) >= t)
2952
2952
  break;
2953
2953
  }
2954
2954
  return r;
2955
2955
  }
2956
- function Fr(e) {
2956
+ function Jr(e) {
2957
2957
  return M(
2958
2958
  fe(ne.encode(JSON.stringify([0, e.pubkey, e.created_at, e.kind, e.tags, e.content])))
2959
2959
  );
2960
2960
  }
2961
- var rc = {};
2962
- D(rc, {
2963
- finishRepostEvent: () => ic,
2964
- getRepostedEvent: () => sc,
2965
- getRepostedEventPointer: () => Jr
2961
+ var ic = {};
2962
+ D(ic, {
2963
+ finishRepostEvent: () => sc,
2964
+ getRepostedEvent: () => oc,
2965
+ getRepostedEventPointer: () => Yr
2966
2966
  });
2967
- function ic(e, t, n, r) {
2967
+ function sc(e, t, n, r) {
2968
2968
  return X(
2969
2969
  {
2970
2970
  kind: an,
@@ -2975,7 +2975,7 @@ function ic(e, t, n, r) {
2975
2975
  r
2976
2976
  );
2977
2977
  }
2978
- function Jr(e) {
2978
+ function Yr(e) {
2979
2979
  if (e.kind !== an)
2980
2980
  return;
2981
2981
  let t, n;
@@ -2990,8 +2990,8 @@ function Jr(e) {
2990
2990
  author: n == null ? void 0 : n[1]
2991
2991
  };
2992
2992
  }
2993
- function sc(e, { skipVerification: t } = {}) {
2994
- const n = Jr(e);
2993
+ function oc(e, { skipVerification: t } = {}) {
2994
+ const n = Yr(e);
2995
2995
  if (n === void 0 || e.content === "")
2996
2996
  return;
2997
2997
  let r;
@@ -3003,17 +3003,17 @@ function sc(e, { skipVerification: t } = {}) {
3003
3003
  if (r.id === n.id && !(!t && !yt(r)))
3004
3004
  return r;
3005
3005
  }
3006
- var oc = {};
3007
- D(oc, {
3006
+ var ac = {};
3007
+ D(ac, {
3008
3008
  NOSTR_URI_REGEX: () => Et,
3009
- parse: () => cc,
3010
- test: () => ac
3009
+ parse: () => uc,
3010
+ test: () => cc
3011
3011
  });
3012
- var Et = new RegExp(`nostr:(${jr.source})`);
3013
- function ac(e) {
3012
+ var Et = new RegExp(`nostr:(${zr.source})`);
3013
+ function cc(e) {
3014
3014
  return typeof e == "string" && new RegExp(`^${Et.source}$`).test(e);
3015
3015
  }
3016
- function cc(e) {
3016
+ function uc(e) {
3017
3017
  const t = e.match(new RegExp(`^${Et.source}$`));
3018
3018
  if (!t)
3019
3019
  throw new Error(`Invalid Nostr URI: ${e}`);
@@ -3023,12 +3023,12 @@ function cc(e) {
3023
3023
  decoded: gt(t[1])
3024
3024
  };
3025
3025
  }
3026
- var uc = {};
3027
- D(uc, {
3028
- finishReactionEvent: () => lc,
3029
- getReactedEventPointer: () => fc
3026
+ var lc = {};
3027
+ D(lc, {
3028
+ finishReactionEvent: () => fc,
3029
+ getReactedEventPointer: () => hc
3030
3030
  });
3031
- function lc(e, t, n) {
3031
+ function fc(e, t, n) {
3032
3032
  const r = t.tags.filter((i) => i.length >= 2 && (i[0] === "e" || i[0] === "p"));
3033
3033
  return X(
3034
3034
  {
@@ -3040,7 +3040,7 @@ function lc(e, t, n) {
3040
3040
  n
3041
3041
  );
3042
3042
  }
3043
- function fc(e) {
3043
+ function hc(e) {
3044
3044
  if (e.kind !== cn)
3045
3045
  return;
3046
3046
  let t, n;
@@ -3055,14 +3055,14 @@ function fc(e) {
3055
3055
  author: n[1]
3056
3056
  };
3057
3057
  }
3058
- var hc = {};
3059
- D(hc, {
3060
- matchAll: () => dc,
3058
+ var dc = {};
3059
+ D(dc, {
3060
+ matchAll: () => pc,
3061
3061
  regex: () => pn,
3062
- replaceAll: () => pc
3062
+ replaceAll: () => yc
3063
3063
  });
3064
3064
  var pn = () => new RegExp(`\\b${Et.source}\\b`, "g");
3065
- function* dc(e) {
3065
+ function* pc(e) {
3066
3066
  const t = e.matchAll(pn());
3067
3067
  for (const n of t)
3068
3068
  try {
@@ -3077,22 +3077,22 @@ function* dc(e) {
3077
3077
  } catch {
3078
3078
  }
3079
3079
  }
3080
- function pc(e, t) {
3080
+ function yc(e, t) {
3081
3081
  return e.replaceAll(pn(), (n, r) => t({
3082
3082
  uri: n,
3083
3083
  value: r,
3084
3084
  decoded: gt(r)
3085
3085
  }));
3086
3086
  }
3087
- var yc = {};
3088
- D(yc, {
3089
- channelCreateEvent: () => gc,
3090
- channelHideMessageEvent: () => vc,
3091
- channelMessageEvent: () => bc,
3092
- channelMetadataEvent: () => wc,
3093
- channelMuteUserEvent: () => Ec
3087
+ var gc = {};
3088
+ D(gc, {
3089
+ channelCreateEvent: () => wc,
3090
+ channelHideMessageEvent: () => Ec,
3091
+ channelMessageEvent: () => vc,
3092
+ channelMetadataEvent: () => bc,
3093
+ channelMuteUserEvent: () => mc
3094
3094
  });
3095
- var gc = (e, t) => {
3095
+ var wc = (e, t) => {
3096
3096
  let n;
3097
3097
  if (typeof e.content == "object")
3098
3098
  n = JSON.stringify(e.content);
@@ -3102,14 +3102,14 @@ var gc = (e, t) => {
3102
3102
  return;
3103
3103
  return X(
3104
3104
  {
3105
- kind: $r,
3105
+ kind: Tr,
3106
3106
  tags: [...e.tags ?? []],
3107
3107
  content: n,
3108
3108
  created_at: e.created_at
3109
3109
  },
3110
3110
  t
3111
3111
  );
3112
- }, wc = (e, t) => {
3112
+ }, bc = (e, t) => {
3113
3113
  let n;
3114
3114
  if (typeof e.content == "object")
3115
3115
  n = JSON.stringify(e.content);
@@ -3119,25 +3119,25 @@ var gc = (e, t) => {
3119
3119
  return;
3120
3120
  return X(
3121
3121
  {
3122
- kind: Tr,
3122
+ kind: Rr,
3123
3123
  tags: [["e", e.channel_create_event_id], ...e.tags ?? []],
3124
3124
  content: n,
3125
3125
  created_at: e.created_at
3126
3126
  },
3127
3127
  t
3128
3128
  );
3129
- }, bc = (e, t) => {
3129
+ }, vc = (e, t) => {
3130
3130
  const n = [["e", e.channel_create_event_id, e.relay_url, "root"]];
3131
3131
  return e.reply_to_channel_message_event_id && n.push(["e", e.reply_to_channel_message_event_id, e.relay_url, "reply"]), X(
3132
3132
  {
3133
- kind: Rr,
3133
+ kind: Or,
3134
3134
  tags: [...n, ...e.tags ?? []],
3135
3135
  content: e.content,
3136
3136
  created_at: e.created_at
3137
3137
  },
3138
3138
  t
3139
3139
  );
3140
- }, vc = (e, t) => {
3140
+ }, Ec = (e, t) => {
3141
3141
  let n;
3142
3142
  if (typeof e.content == "object")
3143
3143
  n = JSON.stringify(e.content);
@@ -3147,14 +3147,14 @@ var gc = (e, t) => {
3147
3147
  return;
3148
3148
  return X(
3149
3149
  {
3150
- kind: Or,
3150
+ kind: Mr,
3151
3151
  tags: [["e", e.channel_message_event_id], ...e.tags ?? []],
3152
3152
  content: n,
3153
3153
  created_at: e.created_at
3154
3154
  },
3155
3155
  t
3156
3156
  );
3157
- }, Ec = (e, t) => {
3157
+ }, mc = (e, t) => {
3158
3158
  let n;
3159
3159
  if (typeof e.content == "object")
3160
3160
  n = JSON.stringify(e.content);
@@ -3164,22 +3164,22 @@ var gc = (e, t) => {
3164
3164
  return;
3165
3165
  return X(
3166
3166
  {
3167
- kind: Mr,
3167
+ kind: Pr,
3168
3168
  tags: [["p", e.pubkey_to_mute], ...e.tags ?? []],
3169
3169
  content: n,
3170
3170
  created_at: e.created_at
3171
3171
  },
3172
3172
  t
3173
3173
  );
3174
- }, mc = {};
3175
- D(mc, {
3176
- EMOJI_SHORTCODE_REGEX: () => Yr,
3177
- matchAll: () => xc,
3174
+ }, xc = {};
3175
+ D(xc, {
3176
+ EMOJI_SHORTCODE_REGEX: () => Xr,
3177
+ matchAll: () => Nc,
3178
3178
  regex: () => yn,
3179
3179
  replaceAll: () => Sc
3180
3180
  });
3181
- var Yr = /:(\w+):/, yn = () => new RegExp(`\\B${Yr.source}\\B`, "g");
3182
- function* xc(e) {
3181
+ var Xr = /:(\w+):/, yn = () => new RegExp(`\\B${Xr.source}\\B`, "g");
3182
+ function* Nc(e) {
3183
3183
  const t = e.matchAll(yn());
3184
3184
  for (const n of t)
3185
3185
  try {
@@ -3199,20 +3199,20 @@ function Sc(e, t) {
3199
3199
  name: r
3200
3200
  }));
3201
3201
  }
3202
- var Nc = {};
3203
- D(Nc, {
3204
- useFetchImplementation: () => Ac,
3205
- validateGithub: () => Kc
3202
+ var Ac = {};
3203
+ D(Ac, {
3204
+ useFetchImplementation: () => Kc,
3205
+ validateGithub: () => Cc
3206
3206
  });
3207
3207
  var gn;
3208
3208
  try {
3209
3209
  gn = fetch;
3210
3210
  } catch {
3211
3211
  }
3212
- function Ac(e) {
3212
+ function Kc(e) {
3213
3213
  gn = e;
3214
3214
  }
3215
- async function Kc(e, t, n) {
3215
+ async function Cc(e, t, n) {
3216
3216
  try {
3217
3217
  return await (await gn(`https://gist.github.com/${t}/${n}/raw`)).text() === `Verifying that I control the following Nostr public key: ${e}`;
3218
3218
  } catch {
@@ -3224,15 +3224,15 @@ D(q, {
3224
3224
  decrypt: () => En,
3225
3225
  encrypt: () => vn,
3226
3226
  getConversationKey: () => wn,
3227
- v2: () => Ic
3227
+ v2: () => Uc
3228
3228
  });
3229
- var Xr = 1, Qr = 65535;
3229
+ var Qr = 1, ei = 65535;
3230
3230
  function wn(e, t) {
3231
- const n = Ue.getSharedSecret(e, "02" + t).subarray(1, 33);
3231
+ const n = Ie.getSharedSecret(e, "02" + t).subarray(1, 33);
3232
3232
  return sn(fe, n, "nip44-v2");
3233
3233
  }
3234
- function ei(e, t) {
3235
- const n = Cr(fe, e, t, 76);
3234
+ function ti(e, t) {
3235
+ const n = Br(fe, e, t, 76);
3236
3236
  return {
3237
3237
  chacha_key: n.subarray(0, 32),
3238
3238
  chacha_nonce: n.subarray(32, 44),
@@ -3247,29 +3247,29 @@ function bn(e) {
3247
3247
  const t = 1 << Math.floor(Math.log2(e - 1)) + 1, n = t <= 256 ? 32 : t / 8;
3248
3248
  return n * (Math.floor((e - 1) / n) + 1);
3249
3249
  }
3250
- function Cc(e) {
3251
- if (!Number.isSafeInteger(e) || e < Xr || e > Qr)
3250
+ function Bc(e) {
3251
+ if (!Number.isSafeInteger(e) || e < Qr || e > ei)
3252
3252
  throw new Error("invalid plaintext size: must be between 1 and 65535 bytes");
3253
3253
  const t = new Uint8Array(2);
3254
3254
  return new DataView(t.buffer).setUint16(0, e, !1), t;
3255
3255
  }
3256
- function Bc(e) {
3257
- const t = ne.encode(e), n = t.length, r = Cc(n), i = new Uint8Array(bn(n) - n);
3256
+ function kc(e) {
3257
+ const t = ne.encode(e), n = t.length, r = Bc(n), i = new Uint8Array(bn(n) - n);
3258
3258
  return lt(r, t, i);
3259
3259
  }
3260
- function kc(e) {
3260
+ function _c(e) {
3261
3261
  const t = new DataView(e.buffer).getUint16(0), n = e.subarray(2, 2 + t);
3262
- if (t < Xr || t > Qr || n.length !== t || e.length !== 2 + bn(t))
3262
+ if (t < Qr || t > ei || n.length !== t || e.length !== 2 + bn(t))
3263
3263
  throw new Error("invalid padding");
3264
3264
  return ue.decode(n);
3265
3265
  }
3266
- function ti(e, t, n) {
3266
+ function ni(e, t, n) {
3267
3267
  if (n.length !== 32)
3268
3268
  throw new Error("AAD associated data must be 32 bytes");
3269
3269
  const r = lt(n, t);
3270
3270
  return ht(fe, e, r);
3271
3271
  }
3272
- function _c(e) {
3272
+ function Ic(e) {
3273
3273
  if (typeof e != "string")
3274
3274
  throw new Error("payload must be a valid string");
3275
3275
  const t = e.length;
@@ -3295,70 +3295,70 @@ function _c(e) {
3295
3295
  mac: n.subarray(-32)
3296
3296
  };
3297
3297
  }
3298
- function vn(e, t, n = fr(32)) {
3299
- const { chacha_key: r, chacha_nonce: i, hmac_key: s } = ei(t, n), o = Bc(e), c = Ar(r, i, o), a = ti(s, c, n);
3298
+ function vn(e, t, n = hr(32)) {
3299
+ const { chacha_key: r, chacha_nonce: i, hmac_key: s } = ti(t, n), o = kc(e), c = Kr(r, i, o), a = ni(s, c, n);
3300
3300
  return he.encode(lt(new Uint8Array([2]), n, c, a));
3301
3301
  }
3302
3302
  function En(e, t) {
3303
- const { nonce: n, ciphertext: r, mac: i } = _c(e), { chacha_key: s, chacha_nonce: o, hmac_key: c } = ei(t, n), a = ti(c, r, n);
3304
- if (!Rs(a, i))
3303
+ const { nonce: n, ciphertext: r, mac: i } = Ic(e), { chacha_key: s, chacha_nonce: o, hmac_key: c } = ti(t, n), a = ni(c, r, n);
3304
+ if (!Os(a, i))
3305
3305
  throw new Error("invalid MAC");
3306
- const l = Ar(s, o, r);
3307
- return kc(l);
3306
+ const l = Kr(s, o, r);
3307
+ return _c(l);
3308
3308
  }
3309
- var Ic = {
3309
+ var Uc = {
3310
3310
  utils: {
3311
3311
  getConversationKey: wn,
3312
3312
  calcPaddedLen: bn
3313
3313
  },
3314
3314
  encrypt: vn,
3315
3315
  decrypt: En
3316
- }, Uc = {};
3317
- D(Uc, {
3318
- makeNwcRequestEvent: () => $c,
3319
- parseConnectionString: () => Lc
3316
+ }, Lc = {};
3317
+ D(Lc, {
3318
+ makeNwcRequestEvent: () => Tc,
3319
+ parseConnectionString: () => $c
3320
3320
  });
3321
- function Lc(e) {
3321
+ function $c(e) {
3322
3322
  const { pathname: t, searchParams: n } = new URL(e), r = t, i = n.get("relay"), s = n.get("secret");
3323
3323
  if (!r || !i || !s)
3324
3324
  throw new Error("invalid connection string");
3325
3325
  return { pubkey: r, relay: i, secret: s };
3326
3326
  }
3327
- async function $c(e, t, n) {
3328
- const i = await zr(t, e, JSON.stringify({
3327
+ async function Tc(e, t, n) {
3328
+ const i = await Vr(t, e, JSON.stringify({
3329
3329
  method: "pay_invoice",
3330
3330
  params: {
3331
3331
  invoice: n
3332
3332
  }
3333
3333
  })), s = {
3334
- kind: qr,
3334
+ kind: Dr,
3335
3335
  created_at: Math.round(Date.now() / 1e3),
3336
3336
  content: i,
3337
3337
  tags: [["p", e]]
3338
3338
  };
3339
3339
  return X(s, t);
3340
3340
  }
3341
- var Tc = {};
3342
- D(Tc, {
3343
- getZapEndpoint: () => Oc,
3344
- makeZapReceipt: () => Hc,
3345
- makeZapRequest: () => Mc,
3346
- useFetchImplementation: () => Rc,
3347
- validateZapRequest: () => Pc
3341
+ var Rc = {};
3342
+ D(Rc, {
3343
+ getZapEndpoint: () => Mc,
3344
+ makeZapReceipt: () => qc,
3345
+ makeZapRequest: () => Pc,
3346
+ useFetchImplementation: () => Oc,
3347
+ validateZapRequest: () => Hc
3348
3348
  });
3349
3349
  var mn;
3350
3350
  try {
3351
3351
  mn = fetch;
3352
3352
  } catch {
3353
3353
  }
3354
- function Rc(e) {
3354
+ function Oc(e) {
3355
3355
  mn = e;
3356
3356
  }
3357
- async function Oc(e) {
3357
+ async function Mc(e) {
3358
3358
  try {
3359
3359
  let t = "", { lud06: n, lud16: r } = JSON.parse(e.content);
3360
3360
  if (n) {
3361
- let { words: o } = ze.decode(n, 1e3), c = ze.fromWords(o);
3361
+ let { words: o } = je.decode(n, 1e3), c = je.fromWords(o);
3362
3362
  t = ue.decode(c);
3363
3363
  } else if (r) {
3364
3364
  let [o, c] = r.split("@");
@@ -3372,7 +3372,7 @@ async function Oc(e) {
3372
3372
  }
3373
3373
  return null;
3374
3374
  }
3375
- function Mc({
3375
+ function Pc({
3376
3376
  profile: e,
3377
3377
  event: t,
3378
3378
  amount: n,
@@ -3395,7 +3395,7 @@ function Mc({
3395
3395
  };
3396
3396
  return t && s.tags.push(["e", t]), s;
3397
3397
  }
3398
- function Pc(e) {
3398
+ function Hc(e) {
3399
3399
  let t;
3400
3400
  try {
3401
3401
  t = JSON.parse(e);
@@ -3414,7 +3414,7 @@ function Pc(e) {
3414
3414
  let r = t.tags.find(([s, o]) => s === "e" && o);
3415
3415
  return r && !r[1].match(/^[a-f0-9]{64}$/) ? "Zap request 'e' tag is not valid hex." : t.tags.find(([s, o]) => s === "relays" && o) ? null : "Zap request doesn't have a 'relays' tag.";
3416
3416
  }
3417
- function Hc({
3417
+ function qc({
3418
3418
  zapRequest: e,
3419
3419
  preimage: t,
3420
3420
  bolt11: n,
@@ -3428,55 +3428,55 @@ function Hc({
3428
3428
  };
3429
3429
  return t && o.tags.push(["preimage", t]), o;
3430
3430
  }
3431
- var qc = {};
3432
- D(qc, {
3433
- createRumor: () => oi,
3434
- createSeal: () => ai,
3435
- createWrap: () => ci,
3436
- unwrapEvent: () => ui,
3437
- unwrapManyEvents: () => zc,
3431
+ var Dc = {};
3432
+ D(Dc, {
3433
+ createRumor: () => ai,
3434
+ createSeal: () => ci,
3435
+ createWrap: () => ui,
3436
+ unwrapEvent: () => li,
3437
+ unwrapManyEvents: () => Vc,
3438
3438
  wrapEvent: () => Wt,
3439
- wrapManyEvents: () => jc
3439
+ wrapManyEvents: () => zc
3440
3440
  });
3441
- var Dc = 2 * 24 * 60 * 60, ni = () => Math.round(Date.now() / 1e3), ri = () => Math.round(ni() - Math.random() * Dc), ii = (e, t) => wn(e, t), si = (e, t, n) => vn(JSON.stringify(e), ii(t, n)), Dn = (e, t) => JSON.parse(En(e.content, ii(t, e.pubkey)));
3442
- function oi(e, t) {
3441
+ var jc = 2 * 24 * 60 * 60, ri = () => Math.round(Date.now() / 1e3), ii = () => Math.round(ri() - Math.random() * jc), si = (e, t) => wn(e, t), oi = (e, t, n) => vn(JSON.stringify(e), si(t, n)), Dn = (e, t) => JSON.parse(En(e.content, si(t, e.pubkey)));
3442
+ function ai(e, t) {
3443
3443
  const n = {
3444
- created_at: ni(),
3444
+ created_at: ri(),
3445
3445
  content: "",
3446
3446
  tags: [],
3447
3447
  ...e,
3448
3448
  pubkey: le(t)
3449
3449
  };
3450
- return n.id = qe(n), n;
3450
+ return n.id = He(n), n;
3451
3451
  }
3452
- function ai(e, t, n) {
3452
+ function ci(e, t, n) {
3453
3453
  return X(
3454
3454
  {
3455
- kind: Lr,
3456
- content: si(e, t, n),
3457
- created_at: ri(),
3455
+ kind: $r,
3456
+ content: oi(e, t, n),
3457
+ created_at: ii(),
3458
3458
  tags: []
3459
3459
  },
3460
3460
  t
3461
3461
  );
3462
3462
  }
3463
- function ci(e, t) {
3464
- const n = _e();
3463
+ function ui(e, t) {
3464
+ const n = ke();
3465
3465
  return X(
3466
3466
  {
3467
- kind: Pr,
3468
- content: si(e, n, t),
3469
- created_at: ri(),
3467
+ kind: Hr,
3468
+ content: oi(e, n, t),
3469
+ created_at: ii(),
3470
3470
  tags: [["p", t]]
3471
3471
  },
3472
3472
  n
3473
3473
  );
3474
3474
  }
3475
3475
  function Wt(e, t, n) {
3476
- const r = oi(e, t), i = ai(r, t, n);
3477
- return ci(i, n);
3476
+ const r = ai(e, t), i = ci(r, t, n);
3477
+ return ui(i, n);
3478
3478
  }
3479
- function jc(e, t, n) {
3479
+ function zc(e, t, n) {
3480
3480
  if (!n || n.length === 0)
3481
3481
  throw new Error("At least one recipient is required.");
3482
3482
  const r = le(t), i = [Wt(e, t, r)];
@@ -3484,31 +3484,31 @@ function jc(e, t, n) {
3484
3484
  i.push(Wt(e, t, s));
3485
3485
  }), i;
3486
3486
  }
3487
- function ui(e, t) {
3487
+ function li(e, t) {
3488
3488
  const n = Dn(e, t);
3489
3489
  return Dn(n, t);
3490
3490
  }
3491
- function zc(e, t) {
3491
+ function Vc(e, t) {
3492
3492
  let n = [];
3493
3493
  return e.forEach((r) => {
3494
- n.push(ui(r, t));
3494
+ n.push(li(r, t));
3495
3495
  }), n.sort((r, i) => r.created_at - i.created_at), n;
3496
3496
  }
3497
- var Vc = {};
3498
- D(Vc, {
3499
- getToken: () => Wc,
3497
+ var Wc = {};
3498
+ D(Wc, {
3499
+ getToken: () => Zc,
3500
3500
  hashPayload: () => xn,
3501
- unpackEventFromToken: () => fi,
3502
- validateEvent: () => wi,
3503
- validateEventKind: () => di,
3504
- validateEventMethodTag: () => yi,
3505
- validateEventPayloadTag: () => gi,
3506
- validateEventTimestamp: () => hi,
3507
- validateEventUrlTag: () => pi,
3508
- validateToken: () => Zc
3501
+ unpackEventFromToken: () => hi,
3502
+ validateEvent: () => bi,
3503
+ validateEventKind: () => pi,
3504
+ validateEventMethodTag: () => gi,
3505
+ validateEventPayloadTag: () => wi,
3506
+ validateEventTimestamp: () => di,
3507
+ validateEventUrlTag: () => yi,
3508
+ validateToken: () => Gc
3509
3509
  });
3510
- var li = "Nostr ";
3511
- async function Wc(e, t, n, r = !1, i) {
3510
+ var fi = "Nostr ";
3511
+ async function Zc(e, t, n, r = !1, i) {
3512
3512
  const s = {
3513
3513
  kind: un,
3514
3514
  tags: [
@@ -3520,36 +3520,36 @@ async function Wc(e, t, n, r = !1, i) {
3520
3520
  };
3521
3521
  i && s.tags.push(["payload", xn(i)]);
3522
3522
  const o = await n(s);
3523
- return (r ? li : "") + he.encode(ne.encode(JSON.stringify(o)));
3523
+ return (r ? fi : "") + he.encode(ne.encode(JSON.stringify(o)));
3524
3524
  }
3525
- async function Zc(e, t, n) {
3526
- const r = await fi(e).catch((s) => {
3525
+ async function Gc(e, t, n) {
3526
+ const r = await hi(e).catch((s) => {
3527
3527
  throw s;
3528
3528
  });
3529
- return await wi(r, t, n).catch((s) => {
3529
+ return await bi(r, t, n).catch((s) => {
3530
3530
  throw s;
3531
3531
  });
3532
3532
  }
3533
- async function fi(e) {
3533
+ async function hi(e) {
3534
3534
  if (!e)
3535
3535
  throw new Error("Missing token");
3536
- e = e.replace(li, "");
3536
+ e = e.replace(fi, "");
3537
3537
  const t = ue.decode(he.decode(e));
3538
3538
  if (!t || t.length === 0 || !t.startsWith("{"))
3539
3539
  throw new Error("Invalid token");
3540
3540
  return JSON.parse(t);
3541
3541
  }
3542
- function hi(e) {
3542
+ function di(e) {
3543
3543
  return e.created_at ? Math.round((/* @__PURE__ */ new Date()).getTime() / 1e3) - e.created_at < 60 : !1;
3544
3544
  }
3545
- function di(e) {
3545
+ function pi(e) {
3546
3546
  return e.kind === un;
3547
3547
  }
3548
- function pi(e, t) {
3548
+ function yi(e, t) {
3549
3549
  const n = e.tags.find((r) => r[0] === "u");
3550
3550
  return n ? n.length > 0 && n[1] === t : !1;
3551
3551
  }
3552
- function yi(e, t) {
3552
+ function gi(e, t) {
3553
3553
  const n = e.tags.find((r) => r[0] === "method");
3554
3554
  return n ? n.length > 0 && n[1].toLowerCase() === t.toLowerCase() : !1;
3555
3555
  }
@@ -3557,30 +3557,30 @@ function xn(e) {
3557
3557
  const t = fe(ne.encode(JSON.stringify(e)));
3558
3558
  return M(t);
3559
3559
  }
3560
- function gi(e, t) {
3560
+ function wi(e, t) {
3561
3561
  const n = e.tags.find((i) => i[0] === "payload");
3562
3562
  if (!n)
3563
3563
  return !1;
3564
3564
  const r = xn(t);
3565
3565
  return n.length > 0 && n[1] === r;
3566
3566
  }
3567
- async function wi(e, t, n, r) {
3567
+ async function bi(e, t, n, r) {
3568
3568
  if (!yt(e))
3569
3569
  throw new Error("Invalid nostr event, signature invalid");
3570
- if (!di(e))
3570
+ if (!pi(e))
3571
3571
  throw new Error("Invalid nostr event, kind invalid");
3572
- if (!hi(e))
3572
+ if (!di(e))
3573
3573
  throw new Error("Invalid nostr event, created_at timestamp invalid");
3574
- if (!pi(e, t))
3574
+ if (!yi(e, t))
3575
3575
  throw new Error("Invalid nostr event, url tag invalid");
3576
- if (!yi(e, n))
3576
+ if (!gi(e, n))
3577
3577
  throw new Error("Invalid nostr event, method tag invalid");
3578
- if (r && typeof r == "object" && Object.keys(r).length > 0 && !gi(e, r))
3578
+ if (r && typeof r == "object" && Object.keys(r).length > 0 && !wi(e, r))
3579
3579
  throw new Error("Invalid nostr event, payload tag does not match request body hash");
3580
3580
  return !0;
3581
3581
  }
3582
- const Be = 30078, jn = 30078, Gc = 14, ru = 100;
3583
- function iu(e) {
3582
+ const Ge = 30078, jn = 30078, zn = 1059, Fc = 14, au = 100;
3583
+ function cu(e) {
3584
3584
  return JSON.stringify({
3585
3585
  rootKey: M(e.rootKey),
3586
3586
  theirCurrentNostrPublicKey: e.theirCurrentNostrPublicKey,
@@ -3612,7 +3612,7 @@ function iu(e) {
3612
3612
  )
3613
3613
  });
3614
3614
  }
3615
- function su(e) {
3615
+ function uu(e) {
3616
3616
  const t = JSON.parse(e);
3617
3617
  return {
3618
3618
  rootKey: G(t.rootKey),
@@ -3645,7 +3645,7 @@ function su(e) {
3645
3645
  )
3646
3646
  };
3647
3647
  }
3648
- async function* ou(e) {
3648
+ async function* lu(e) {
3649
3649
  const t = [];
3650
3650
  let n = null;
3651
3651
  const r = e.onEvent((i) => {
@@ -3660,21 +3660,21 @@ async function* ou(e) {
3660
3660
  r();
3661
3661
  }
3662
3662
  }
3663
- function Me(e, t = new Uint8Array(32), n = 1) {
3663
+ function Oe(e, t = new Uint8Array(32), n = 1) {
3664
3664
  const r = sn(fe, e, t), i = [];
3665
3665
  for (let s = 1; s <= n; s++)
3666
- i.push(Cr(fe, r, new Uint8Array([s]), 32));
3666
+ i.push(Br(fe, r, new Uint8Array([s]), 32));
3667
3667
  return i;
3668
3668
  }
3669
3669
  function Lt(e, t) {
3670
3670
  return `${e}:${t}`;
3671
3671
  }
3672
- function au(e) {
3672
+ function fu(e) {
3673
3673
  var n;
3674
3674
  const t = (n = e.tags) == null ? void 0 : n.find((r) => r[0] === "ms");
3675
3675
  return t ? parseInt(t[1]) : e.created_at * 1e3;
3676
3676
  }
3677
- const Fc = 1e3, Jc = "0000000000000000000000000000000000000000000000000000000000000000";
3677
+ const Jc = 1e3, Yc = "0000000000000000000000000000000000000000000000000000000000000000";
3678
3678
  class st {
3679
3679
  // 1. CHANNEL PUBLIC INTERFACE
3680
3680
  constructor(t, n) {
@@ -3696,10 +3696,10 @@ class st {
3696
3696
  * @returns A new Session instance
3697
3697
  */
3698
3698
  static init(t, n, r, i, s, o) {
3699
- const c = _e(), [a, l] = Me(s, q.getConversationKey(c, n), 2);
3699
+ const c = ke(), [a, l] = Oe(s, q.getConversationKey(c, n), 2);
3700
3700
  let f, u;
3701
3701
  i ? (f = { publicKey: le(r), privateKey: r }, u = { publicKey: le(c), privateKey: c }) : u = { publicKey: le(r), privateKey: r };
3702
- const g = {
3702
+ const p = {
3703
3703
  rootKey: i ? a : s,
3704
3704
  theirNextNostrPublicKey: n,
3705
3705
  ourCurrentNostrKey: f,
@@ -3711,7 +3711,7 @@ class st {
3711
3711
  previousSendingChainMessageCount: 0,
3712
3712
  skippedMessageKeys: {},
3713
3713
  skippedHeaderKeys: {}
3714
- }, b = new st(t, g);
3714
+ }, b = new st(t, p);
3715
3715
  return o && (b.name = o), b;
3716
3716
  }
3717
3717
  /**
@@ -3724,7 +3724,7 @@ class st {
3724
3724
  send(t) {
3725
3725
  return this.sendEvent({
3726
3726
  content: t,
3727
- kind: Gc
3727
+ kind: Fc
3728
3728
  });
3729
3729
  }
3730
3730
  /**
@@ -3742,18 +3742,18 @@ class st {
3742
3742
  const n = Date.now(), r = {
3743
3743
  ...t,
3744
3744
  content: t.content || "",
3745
- kind: t.kind || Be,
3745
+ kind: t.kind || Ge,
3746
3746
  created_at: t.created_at || Math.floor(n / 1e3),
3747
3747
  tags: t.tags || [],
3748
- pubkey: t.pubkey || Jc
3748
+ pubkey: t.pubkey || Yc
3749
3749
  };
3750
- r.tags.some(([l]) => l === "ms") || r.tags.push(["ms", String(n)]), r.id = qe(r);
3750
+ r.tags.some(([l]) => l === "ms") || r.tags.push(["ms", String(n)]), r.id = He(r);
3751
3751
  const [i, s] = this.ratchetEncrypt(JSON.stringify(r)), o = q.getConversationKey(this.state.ourCurrentNostrKey.privateKey, this.state.theirNextNostrPublicKey), c = q.encrypt(JSON.stringify(i), o);
3752
3752
  return { event: X({
3753
3753
  content: s,
3754
- kind: Be,
3754
+ kind: Ge,
3755
3755
  tags: [["header", c]],
3756
- created_at: Math.floor(Date.now() / 1e3)
3756
+ created_at: Math.floor(n / 1e3)
3757
3757
  }, this.state.ourCurrentNostrKey.privateKey), innerEvent: r };
3758
3758
  }
3759
3759
  /**
@@ -3774,7 +3774,7 @@ class st {
3774
3774
  }
3775
3775
  // 2. RATCHET FUNCTIONS
3776
3776
  ratchetEncrypt(t) {
3777
- const [n, r] = Me(this.state.sendingChainKey, new Uint8Array([1]), 2);
3777
+ const [n, r] = Oe(this.state.sendingChainKey, new Uint8Array([1]), 2);
3778
3778
  return this.state.sendingChainKey = n, [{
3779
3779
  number: this.state.sendingChainMessageNumber++,
3780
3780
  nextPublicKey: this.state.ourNextNostrKey.publicKey,
@@ -3785,7 +3785,7 @@ class st {
3785
3785
  const i = this.trySkippedMessageKeys(t, n, r);
3786
3786
  if (i) return i;
3787
3787
  this.skipMessageKeys(t.number, r);
3788
- const [s, o] = Me(this.state.receivingChainKey, new Uint8Array([1]), 2);
3788
+ const [s, o] = Oe(this.state.receivingChainKey, new Uint8Array([1]), 2);
3789
3789
  this.state.receivingChainKey = s, this.state.receivingChainMessageNumber++;
3790
3790
  try {
3791
3791
  return q.decrypt(n, o);
@@ -3800,22 +3800,22 @@ class st {
3800
3800
  }
3801
3801
  ratchetStep(t) {
3802
3802
  this.state.previousSendingChainMessageCount = this.state.sendingChainMessageNumber, this.state.sendingChainMessageNumber = 0, this.state.receivingChainMessageNumber = 0, this.state.theirNextNostrPublicKey = t;
3803
- const n = q.getConversationKey(this.state.ourNextNostrKey.privateKey, this.state.theirNextNostrPublicKey), [r, i] = Me(this.state.rootKey, n, 2);
3803
+ const n = q.getConversationKey(this.state.ourNextNostrKey.privateKey, this.state.theirNextNostrPublicKey), [r, i] = Oe(this.state.rootKey, n, 2);
3804
3804
  this.state.receivingChainKey = i, this.state.ourCurrentNostrKey = this.state.ourNextNostrKey;
3805
- const s = _e();
3805
+ const s = ke();
3806
3806
  this.state.ourNextNostrKey = {
3807
3807
  publicKey: le(s),
3808
3808
  privateKey: s
3809
3809
  };
3810
- const o = q.getConversationKey(this.state.ourNextNostrKey.privateKey, this.state.theirNextNostrPublicKey), [c, a] = Me(r, o, 2);
3810
+ const o = q.getConversationKey(this.state.ourNextNostrKey.privateKey, this.state.theirNextNostrPublicKey), [c, a] = Oe(r, o, 2);
3811
3811
  this.state.rootKey = c, this.state.sendingChainKey = a;
3812
3812
  }
3813
3813
  // 3. MESSAGE KEY FUNCTIONS
3814
3814
  skipMessageKeys(t, n) {
3815
- if (this.state.receivingChainMessageNumber + Fc < t)
3815
+ if (this.state.receivingChainMessageNumber + Jc < t)
3816
3816
  throw new Error("Too many skipped messages");
3817
3817
  for (; this.state.receivingChainMessageNumber < t; ) {
3818
- const [r, i] = Me(this.state.receivingChainKey, new Uint8Array([1]), 2);
3818
+ const [r, i] = Oe(this.state.receivingChainKey, new Uint8Array([1]), 2);
3819
3819
  this.state.receivingChainKey = r;
3820
3820
  const s = Lt(n, this.state.receivingChainMessageNumber);
3821
3821
  if (this.state.skippedMessageKeys[s] = i, !this.state.skippedHeaderKeys[n]) {
@@ -3831,11 +3831,10 @@ class st {
3831
3831
  }
3832
3832
  }
3833
3833
  trySkippedMessageKeys(t, n, r) {
3834
- var s;
3835
3834
  const i = Lt(r, t.number);
3836
3835
  if (i in this.state.skippedMessageKeys) {
3837
- const o = this.state.skippedMessageKeys[i];
3838
- return delete this.state.skippedMessageKeys[i], Object.keys(this.state.skippedMessageKeys).some((a) => a.startsWith(`${r}:`)) || (delete this.state.skippedHeaderKeys[r], (s = this.nostrUnsubscribe) == null || s.call(this), this.nostrUnsubscribe = void 0), q.decrypt(n, o);
3836
+ const s = this.state.skippedMessageKeys[i];
3837
+ return delete this.state.skippedMessageKeys[i], Object.keys(this.state.skippedMessageKeys).some((c) => c.startsWith(`${r}:`)) || delete this.state.skippedHeaderKeys[r], q.decrypt(n, s);
3839
3838
  }
3840
3839
  return null;
3841
3840
  }
@@ -3868,7 +3867,7 @@ class st {
3868
3867
  const [n, r, i] = this.decryptHeader(t);
3869
3868
  if (!i)
3870
3869
  this.state.theirNextNostrPublicKey !== n.nextPublicKey && (this.state.theirCurrentNostrPublicKey = this.state.theirNextNostrPublicKey, this.state.theirNextNostrPublicKey = n.nextPublicKey, (c = this.nostrUnsubscribe) == null || c.call(this), this.nostrUnsubscribe = this.nostrNextUnsubscribe, this.nostrNextUnsubscribe = this.nostrSubscribe(
3871
- { authors: [this.state.theirNextNostrPublicKey], kinds: [Be] },
3870
+ { authors: [this.state.theirNextNostrPublicKey], kinds: [Ge] },
3872
3871
  (a) => this.handleNostrEvent(a)
3873
3872
  )), r && (this.skipMessageKeys(n.previousChainLength, t.pubkey), this.ratchetStep(n.nextPublicKey));
3874
3873
  else if (!(Lt(t.pubkey, n.number) in this.state.skippedMessageKeys))
@@ -3878,7 +3877,7 @@ class st {
3878
3877
  console.error("Invalid event received", o);
3879
3878
  return;
3880
3879
  }
3881
- if (o.id !== qe(o)) {
3880
+ if (o.id !== He(o)) {
3882
3881
  console.error("Event hash does not match", o);
3883
3882
  return;
3884
3883
  }
@@ -3887,12 +3886,12 @@ class st {
3887
3886
  subscribeToNostrEvents() {
3888
3887
  if (this.nostrNextUnsubscribe) return;
3889
3888
  this.nostrNextUnsubscribe = this.nostrSubscribe(
3890
- { authors: [this.state.theirNextNostrPublicKey], kinds: [Be] },
3889
+ { authors: [this.state.theirNextNostrPublicKey], kinds: [Ge] },
3891
3890
  (n) => this.handleNostrEvent(n)
3892
3891
  );
3893
3892
  const t = Object.keys(this.state.skippedHeaderKeys);
3894
3893
  this.state.theirCurrentNostrPublicKey && !t.includes(this.state.theirCurrentNostrPublicKey) && t.push(this.state.theirCurrentNostrPublicKey), this.nostrUnsubscribe = this.nostrSubscribe(
3895
- { authors: t, kinds: [Be] },
3894
+ { authors: t, kinds: [Ge] },
3896
3895
  (n) => this.handleNostrEvent(n)
3897
3896
  );
3898
3897
  }
@@ -3900,18 +3899,19 @@ class st {
3900
3899
  new TextDecoder("utf-8");
3901
3900
  new TextEncoder();
3902
3901
  function Qe(e, t) {
3903
- const n = Ue.getSharedSecret(e, "02" + t).subarray(1, 33);
3902
+ const n = Ie.getSharedSecret(e, "02" + t).subarray(1, 33);
3904
3903
  return sn(fe, n, "nip44-v2");
3905
3904
  }
3906
- class Pe {
3905
+ const Xc = 2 * 24 * 60 * 60, Qc = () => Math.round(Date.now() / 1e3), eu = () => Math.round(Qc() - Math.random() * Xc);
3906
+ class Me {
3907
3907
  constructor(t, n, r, i, s, o, c = []) {
3908
3908
  this.inviterEphemeralPublicKey = t, this.sharedSecret = n, this.inviter = r, this.inviterEphemeralPrivateKey = i, this.label = s, this.maxUses = o, this.usedBy = c;
3909
3909
  }
3910
3910
  static createNew(t, n, r) {
3911
3911
  if (!t)
3912
3912
  throw new Error("Inviter public key is required");
3913
- const i = _e(), s = le(i), o = M(_e());
3914
- return new Pe(
3913
+ const i = ke(), s = le(i), o = M(ke());
3914
+ return new Me(
3915
3915
  s,
3916
3916
  o,
3917
3917
  t,
@@ -3934,7 +3934,7 @@ class Pe {
3934
3934
  const { inviter: o, ephemeralKey: c, sharedSecret: a } = s;
3935
3935
  if (!o || !c || !a)
3936
3936
  throw new Error("Missing required fields (inviter, ephemeralKey, sharedSecret) in invite data.");
3937
- return new Pe(
3937
+ return new Me(
3938
3938
  c,
3939
3939
  a,
3940
3940
  o
@@ -3942,7 +3942,7 @@ class Pe {
3942
3942
  }
3943
3943
  static deserialize(t) {
3944
3944
  const n = JSON.parse(t);
3945
- return new Pe(
3945
+ return new Me(
3946
3946
  n.inviterEphemeralPublicKey,
3947
3947
  n.sharedSecret,
3948
3948
  n.inviter,
@@ -3964,7 +3964,7 @@ class Pe {
3964
3964
  const r = (o = n.find(([a]) => a === "ephemeralKey")) == null ? void 0 : o[1], i = (c = n.find(([a]) => a === "sharedSecret")) == null ? void 0 : c[1], s = t.pubkey;
3965
3965
  if (!r || !i)
3966
3966
  throw new Error("Invalid invite event: missing session key or sharedSecret");
3967
- return new Pe(
3967
+ return new Me(
3968
3968
  r,
3969
3969
  i,
3970
3970
  s
@@ -3975,14 +3975,14 @@ class Pe {
3975
3975
  kinds: [jn],
3976
3976
  authors: [t],
3977
3977
  limit: 1,
3978
- "#d": ["nostr-double-ratchet/invites/public"]
3978
+ "#d": ["double-ratchet/invites/public"]
3979
3979
  };
3980
3980
  let s = 0;
3981
3981
  return n(i, (c) => {
3982
3982
  if (!(!c.created_at || c.created_at <= s)) {
3983
3983
  s = c.created_at;
3984
3984
  try {
3985
- const a = Pe.fromEvent(c);
3985
+ const a = Me.fromEvent(c);
3986
3986
  r(a);
3987
3987
  } catch (a) {
3988
3988
  console.error("Error processing invite:", a, "event:", c);
@@ -4024,8 +4024,8 @@ class Pe {
4024
4024
  tags: [
4025
4025
  ["ephemeralKey", this.inviterEphemeralPublicKey],
4026
4026
  ["sharedSecret", this.sharedSecret],
4027
- ["d", "nostr-double-ratchet/invites/public"],
4028
- ["l", "nostr-double-ratchet/invites"]
4027
+ ["d", "double-ratchet/invites/public"],
4028
+ ["l", "double-ratchet/invites"]
4029
4029
  ]
4030
4030
  };
4031
4031
  }
@@ -4045,25 +4045,24 @@ class Pe {
4045
4045
  * so the inviter can create the session on their side.
4046
4046
  */
4047
4047
  async accept(t, n, r) {
4048
- const i = _e(), s = le(i), o = this.inviter || this.inviterEphemeralPublicKey, c = G(this.sharedSecret), a = st.init(t, this.inviterEphemeralPublicKey, i, !0, c, void 0), l = _e(), f = le(l), g = await (typeof r == "function" ? r : (h, d) => Promise.resolve(q.encrypt(h, Qe(r, d))))(s, o), b = {
4048
+ const i = ke(), s = le(i), o = this.inviter || this.inviterEphemeralPublicKey, c = G(this.sharedSecret), a = st.init(t, this.inviterEphemeralPublicKey, i, !0, c, void 0), f = await (typeof r == "function" ? r : (h, d) => Promise.resolve(q.encrypt(h, Qe(r, d))))(s, o), u = {
4049
4049
  pubkey: n,
4050
- tags: [["sharedSecret", this.sharedSecret]],
4051
- content: await q.encrypt(g, c),
4050
+ content: await q.encrypt(f, c),
4052
4051
  created_at: Math.floor(Date.now() / 1e3)
4053
- }, p = {
4054
- kind: Be,
4055
- pubkey: f,
4056
- content: q.encrypt(JSON.stringify(b), Qe(l, this.inviterEphemeralPublicKey)),
4057
- created_at: Math.floor(Date.now() / 1e3),
4052
+ }, p = ke(), b = le(p), y = {
4053
+ kind: zn,
4054
+ pubkey: b,
4055
+ content: q.encrypt(JSON.stringify(u), Qe(p, this.inviterEphemeralPublicKey)),
4056
+ created_at: eu(),
4058
4057
  tags: [["p", this.inviterEphemeralPublicKey]]
4059
4058
  };
4060
- return { session: a, event: X(p, l) };
4059
+ return { session: a, event: X(y, p) };
4061
4060
  }
4062
4061
  listen(t, n, r) {
4063
4062
  if (!this.inviterEphemeralPrivateKey)
4064
4063
  throw new Error("Inviter session key is not available");
4065
4064
  const i = {
4066
- kinds: [Be],
4065
+ kinds: [zn],
4067
4066
  "#p": [this.inviterEphemeralPublicKey]
4068
4067
  };
4069
4068
  return n(i, async (s) => {
@@ -4072,15 +4071,10 @@ class Pe {
4072
4071
  console.error("Invite has reached maximum number of uses");
4073
4072
  return;
4074
4073
  }
4075
- const o = await q.decrypt(s.content, Qe(this.inviterEphemeralPrivateKey, s.pubkey)), c = JSON.parse(o);
4076
- if (!c.tags || !c.tags.some(([h, d]) => h === "sharedSecret" && d === this.sharedSecret)) {
4077
- console.error("Invalid secret from event", s);
4078
- return;
4079
- }
4080
- const a = G(this.sharedSecret), l = c.pubkey;
4074
+ const o = await q.decrypt(s.content, Qe(this.inviterEphemeralPrivateKey, s.pubkey)), c = JSON.parse(o), a = G(this.sharedSecret), l = c.pubkey;
4081
4075
  this.usedBy.push(l);
4082
- const f = await q.decrypt(c.content, a), g = await (typeof t == "function" ? t : (h, d) => Promise.resolve(q.decrypt(h, Qe(t, d))))(f, l), b = s.id, p = st.init(n, g, this.inviterEphemeralPrivateKey, !1, a, b);
4083
- r(p, l);
4076
+ const f = await q.decrypt(c.content, a), p = await (typeof t == "function" ? t : (h, d) => Promise.resolve(q.decrypt(h, Qe(t, d))))(f, l), b = s.id, y = st.init(n, p, this.inviterEphemeralPrivateKey, !1, a, b);
4077
+ r(y, l);
4084
4078
  } catch (o) {
4085
4079
  console.error("Error processing invite message:", o, "event", s);
4086
4080
  }
@@ -4088,16 +4082,17 @@ class Pe {
4088
4082
  }
4089
4083
  }
4090
4084
  export {
4091
- Gc as CHAT_MESSAGE_KIND,
4085
+ Fc as CHAT_MESSAGE_KIND,
4092
4086
  jn as INVITE_EVENT_KIND,
4093
- Pe as Invite,
4094
- ru as MAX_SKIP,
4095
- Be as MESSAGE_EVENT_KIND,
4087
+ zn as INVITE_RESPONSE_KIND,
4088
+ Me as Invite,
4089
+ au as MAX_SKIP,
4090
+ Ge as MESSAGE_EVENT_KIND,
4096
4091
  st as Session,
4097
- ou as createEventStream,
4098
- su as deserializeSessionState,
4099
- au as getMillisecondTimestamp,
4100
- Me as kdf,
4101
- iu as serializeSessionState,
4092
+ lu as createEventStream,
4093
+ uu as deserializeSessionState,
4094
+ fu as getMillisecondTimestamp,
4095
+ Oe as kdf,
4096
+ cu as serializeSessionState,
4102
4097
  Lt as skippedMessageIndexKey
4103
4098
  };