PageSourceSearch

https://ungovernable.network/js/vendor/nostr-tools.bundle.js

js ungovernable.network collected 2026-10-06 19:50:51 UTC 200,846 bytes, 7,782 lines download raw bytes

1"use strict";
2var NostrTools = (() => {
3  var __defProp = Object.defineProperty;
4  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5  var __getOwnPropNames = Object.getOwnPropertyNames;
6  var __hasOwnProp = Object.prototype.hasOwnProperty;
7  var __export = (target, all) => {
8    for (var name in all)
9      __defProp(target, name, { get: all[name], enumerable: true });
10  };
11  var __copyProps = (to, from, except, desc) => {
12    if (from && typeof from === "object" || typeof from === "function") {
13      for (let key of __getOwnPropNames(from))
14        if (!__hasOwnProp.call(to, key) && key !== except)
15          __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16    }
17    return to;
18  };
19  var __toCommonJS = (mod2) => __copyProps(__defProp({}, "__esModule", { value: true }), mod2);
20
21  // index.ts
22  var nostr_tools_exports = {};
23  __export(nostr_tools_exports, {
24    Kind: () => Kind,
25    SimplePool: () => SimplePool,
26    eventsGenerator: () => eventsGenerator,
27    finishEvent: () => finishEvent,
28    fj: () => fakejson_exports,
29    generatePrivateKey: () => generatePrivateKey,
30    getBlankEvent: () => getBlankEvent,
31    getEventHash: () => getEventHash,
32    getPublicKey: () => getPublicKey,
33    getSignature: () => getSignature,
34    matchFilter: () => matchFilter,
35    matchFilters: () => matchFilters,
36    mergeFilters: () => mergeFilters,
37    nip04: () => nip04_exports,
38    nip05: () => nip05_exports,
39    nip06: () => nip06_exports,
40    nip10: () => nip10_exports,
41    nip13: () => nip13_exports,
42    nip18: () => nip18_exports,
43    nip19: () => nip19_exports,
44    nip21: () => nip21_exports,
45    nip25: () => nip25_exports,
46    nip26: () => nip26_exports,
47    nip27: () => nip27_exports,
48    nip28: () => nip28_exports,
49    nip39: () => nip39_exports,
50    nip42: () => nip42_exports,
51    nip44: () => nip44_exports,
52    nip47: () => nip47_exports,
53    nip57: () => nip57_exports,
54    nip98: () => nip98_exports,
55    parseReferences: () => parseReferences,
56    relayInit: () => relayInit,
57    serializeEvent: () => serializeEvent,
58    signEvent: () => signEvent,
59    utils: () => utils_exports2,
60    validateEvent: () => validateEvent,
61    verifiedSymbol: () => verifiedSymbol,
62    verifySignature: () => verifySignature
63  });
64
65  
vendor: 1,373 bytes, lines 65-109
65// node_modules/@noble/hashes/esm/_assert.js
66  function number(n) {
67    if (!Number.isSafeInteger(n) || n < 0)
68      throw new Error(`Wrong positive integer: ${n}`);
69  }
70  function bool(b) {
71    if (typeof b !== "boolean")
72      throw new Error(`Expected boolean, not ${b}`);
73  }
74  function bytes(b, ...lengths) {
75    if (!(b instanceof Uint8Array))
76      throw new Error("Expected Uint8Array");
77    if (lengths.length > 0 && !lengths.includes(b.length))
78      throw new Error(`Expected Uint8Array of length ${lengths}, not of length=${b.length}`);
79  }
80  function hash(hash3) {
81    if (typeof hash3 !== "function" || typeof hash3.create !== "function")
82      throw new Error("Hash should be wrapped by utils.wrapConstructor");
83    number(hash3.outputLen);
84    number(hash3.blockLen);
85  }
86  function exists(instance, checkFinished = true) {
87    if (instance.destroyed)
88      throw new Error("Hash instance has been destroyed");
89    if (checkFinished && instance.finished)
90      throw new Error("Hash#digest() has already been called");
91  }
92  function output(out, instance) {
93    bytes(out);
94    const min = instance.outputLen;
95    if (out.length < min) {
96      throw new Error(`digestInto() expects output buffer of length at least ${min}`);
97    }
98  }
99  var assert = {
100    number,
101    bool,
102    bytes,
103    hash,
104    exists,
105    output
106  };
107  var assert_default = assert;
108
109  
vendor: 150 bytes, lines 109-112
109// node_modules/@noble/hashes/esm/crypto.js
110  var crypto2 = typeof globalThis === "object" && "crypto" in globalThis ? globalThis.crypto : void 0;
111
112  
vendor: 2,984 bytes, lines 112-196
112// node_modules/@noble/hashes/esm/utils.js
113  var u8a = (a) => a instanceof Uint8Array;
114  var createView = (arr) => new DataView(arr.buffer, arr.byteOffset, arr.byteLength);
115  var rotr = (word, shift) => word << 32 - shift | word >>> shift;
116  var isLE = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
117  if (!isLE)
118    throw new Error("Non little-endian hardware is not supported");
119  var hexes = Array.from({ length: 256 }, (v, i) => i.toString(16).padStart(2, "0"));
120  function bytesToHex(bytes3) {
121    if (!u8a(bytes3))
122      throw new Error("Uint8Array expected");
123    let hex2 = "";
124    for (let i = 0; i < bytes3.length; i++) {
125      hex2 += hexes[bytes3[i]];
126    }
127    return hex2;
128  }
129  function hexToBytes(hex2) {
130    if (typeof hex2 !== "string")
131      throw new Error("hex string expected, got " + typeof hex2);
132    const len = hex2.length;
133    if (len % 2)
134      throw new Error("padded hex string expected, got unpadded hex of length " + len);
135    const array = new Uint8Array(len / 2);
136    for (let i = 0; i < array.length; i++) {
137      const j = i * 2;
138      const hexByte = hex2.slice(j, j + 2);
139      const byte = Number.parseInt(hexByte, 16);
140      if (Number.isNaN(byte) || byte < 0)
141        throw new Error("Invalid byte sequence");
142      array[i] = byte;
143    }
144    return array;
145  }
146  function utf8ToBytes(str) {
147    if (typeof str !== "string")
148      throw new Error(`utf8ToBytes expected string, got ${typeof str}`);
149    return new Uint8Array(new TextEncoder().encode(str));
150  }
151  function toBytes(data) {
152    if (typeof data === "string")
153      data = utf8ToBytes(data);
154    if (!u8a(data))
155      throw new Error(`expected Uint8Array, got ${typeof data}`);
156    return data;
157  }
158  function concatBytes(...arrays) {
159    const r = new Uint8Array(arrays.reduce((sum, a) => sum + a.length, 0));
160    let pad = 0;
161    arrays.forEach((a) => {
162      if (!u8a(a))
163        throw new Error("Uint8Array expected");
164      r.set(a, pad);
165      pad += a.length;
166    });
167    return r;
168  }
169  var Hash = class {
170    clone() {
171      return this._cloneInto();
172    }
173  };
174  var isPlainObject = (obj) => Object.prototype.toString.call(obj) === "[object Object]" && obj.constructor === Object;
175  function checkOpts(defaults, opts) {
176    if (opts !== void 0 && (typeof opts !== "object" || !isPlainObject(opts)))
177      throw new Error("Options should be object or undefined");
178    const merged = Object.assign(defaults, opts);
179    return merged;
180  }
181  function wrapConstructor(hashCons) {
182    const hashC = (msg) => hashCons().update(toBytes(msg)).digest();
183    const tmp = hashCons();
184    hashC.outputLen = tmp.outputLen;
185    hashC.blockLen = tmp.blockLen;
186    hashC.create = () => hashCons();
187    return hashC;
188  }
189  function randomBytes(bytesLength = 32) {
190    if (crypto2 && typeof crypto2.getRandomValues === "function") {
191      return crypto2.getRandomValues(new Uint8Array(bytesLength));
192    }
193    throw new Error("crypto.getRandomValues must be defined");
194  }
195
196  
vendor: 3,235 bytes, lines 196-296
196// node_modules/@noble/hashes/esm/_sha2.js
197  function setBigUint64(view, byteOffset, value, isLE3) {
198    if (typeof view.setBigUint64 === "function")
199      return view.setBigUint64(byteOffset, value, isLE3);
200    const _32n2 = BigInt(32);
201    const _u32_max = BigInt(4294967295);
202    const wh = Number(value >> _32n2 & _u32_max);
203    const wl = Number(value & _u32_max);
204    const h = isLE3 ? 4 : 0;
205    const l = isLE3 ? 0 : 4;
206    view.setUint32(byteOffset + h, wh, isLE3);
207    view.setUint32(byteOffset + l, wl, isLE3);
208  }
209  var SHA2 = class extends Hash {
210    constructor(blockLen, outputLen, padOffset, isLE3) {
211      super();
212      this.blockLen = blockLen;
213      this.outputLen = outputLen;
214      this.padOffset = padOffset;
215      this.isLE = isLE3;
216      this.finished = false;
217      this.length = 0;
218      this.pos = 0;
219      this.destroyed = false;
220      this.buffer = new Uint8Array(blockLen);
221      this.view = createView(this.buffer);
222    }
223    update(data) {
224      assert_default.exists(this);
225      const { view, buffer, blockLen } = this;
226      data = toBytes(data);
227      const len = data.length;
228      for (let pos = 0; pos < len; ) {
229        const take = Math.min(blockLen - this.pos, len - pos);
230        if (take === blockLen) {
231          const dataView = createView(data);
232          for (; blockLen <= len - pos; pos += blockLen)
233            this.process(dataView, pos);
234          continue;
235        }
236        buffer.set(data.subarray(pos, pos + take), this.pos);
237        this.pos += take;
238        pos += take;
239        if (this.pos === blockLen) {
240          this.process(view, 0);
241          this.pos = 0;
242        }
243      }
244      this.length += data.length;
245      this.roundClean();
246      return this;
247    }
248    digestInto(out) {
249      assert_default.exists(this);
250      assert_default.output(out, this);
251      this.finished = true;
252      const { buffer, view, blockLen, isLE: isLE3 } = this;
253      let { pos } = this;
254      buffer[pos++] = 128;
255      this.buffer.subarray(pos).fill(0);
256      if (this.padOffset > blockLen - pos) {
257        this.process(view, 0);
258        pos = 0;
259      }
260      for (let i = pos; i < blockLen; i++)
261        buffer[i] = 0;
262      setBigUint64(view, blockLen - 8, BigInt(this.length * 8), isLE3);
263      this.process(view, 0);
264      const oview = createView(out);
265      const len = this.outputLen;
266      if (len % 4)
267        throw new Error("_sha2: outputLen should be aligned to 32bit");
268      const outLen = len / 4;
269      const state = this.get();
270      if (outLen > state.length)
271        throw new Error("_sha2: outputLen bigger than state");
272      for (let i = 0; i < outLen; i++)
273        oview.setUint32(4 * i, state[i], isLE3);
274    }
275    digest() {
276      const { buffer, outputLen } = this;
277      this.digestInto(buffer);
278      const res = buffer.slice(0, outputLen);
279      this.destroy();
280      return res;
281    }
282    _cloneInto(to) {
283      to || (to = new this.constructor());
284      to.set(...this.get());
285      const { blockLen, buffer, length, finished, destroyed, pos } = this;
286      to.length = length;
287      to.pos = pos;
288      to.finished = finished;
289      to.destroyed = destroyed;
290      if (length % blockLen)
291        to.buffer.set(buffer);
292      return to;
293    }
294  };
295
296  
vendor: 3,783 bytes, lines 296-462
296// node_modules/@noble/hashes/esm/sha256.js
297  var Chi = (a, b, c) => a & b ^ ~a & c;
298  var Maj = (a, b, c) => a & b ^ a & c ^ b & c;
299  var SHA256_K = new Uint32Array([
300    1116352408,
301    1899447441,
302    3049323471,
303    3921009573,
304    961987163,
305    1508970993,
306    2453635748,
307    2870763221,
308    3624381080,
309    310598401,
310    607225278,
311    1426881987,
312    1925078388,
313    2162078206,
314    2614888103,
315    3248222580,
316    3835390401,
317    4022224774,
318    264347078,
319    604807628,
320    770255983,
321    1249150122,
322    1555081692,
323    1996064986,
324    2554220882,
325    2821834349,
326    2952996808,
327    3210313671,
328    3336571891,
329    3584528711,
330    113926993,
331    338241895,
332    666307205,
333    773529912,
334    1294757372,
335    1396182291,
336    1695183700,
337    1986661051,
338    2177026350,
339    2456956037,
340    2730485921,
341    2820302411,
342    3259730800,
343    3345764771,
344    3516065817,
345    3600352804,
346    4094571909,
347    275423344,
348    430227734,
349    506948616,
350    659060556,
351    883997877,
352    958139571,
353    1322822218,
354    1537002063,
355    1747873779,
356    1955562222,
357    2024104815,
358    2227730452,
359    2361852424,
360    2428436474,
361    2756734187,
362    3204031479,
363    3329325298
364  ]);
365  var IV = new Uint32Array([
366    1779033703,
367    3144134277,
368    1013904242,
369    2773480762,
370    1359893119,
371    2600822924,
372    528734635,
373    1541459225
374  ]);
375  var SHA256_W = new Uint32Array(64);
376  var SHA256 = class extends SHA2 {
377    constructor() {
378      super(64, 32, 8, false);
379      this.A = IV[0] | 0;
380      this.B = IV[1] | 0;
381      this.C = IV[2] | 0;
382      this.D = IV[3] | 0;
383      this.E = IV[4] | 0;
384      this.F = IV[5] | 0;
385      this.G = IV[6] | 0;
386      this.H = IV[7] | 0;
387    }
388    get() {
389      const { A, B, C, D, E, F, G, H } = this;
390      return [A, B, C, D, E, F, G, H];
391    }
392    set(A, B, C, D, E, F, G, H) {
393      this.A = A | 0;
394      this.B = B | 0;
395      this.C = C | 0;
396      this.D = D | 0;
397      this.E = E | 0;
398      this.F = F | 0;
399      this.G = G | 0;
400      this.H = H | 0;
401    }
402    process(view, offset) {
403      for (let i = 0; i < 16; i++, offset += 4)
404        SHA256_W[i] = view.getUint32(offset, false);
405      for (let i = 16; i < 64; i++) {
406        const W15 = SHA256_W[i - 15];
407        const W2 = SHA256_W[i - 2];
408        const s0 = rotr(W15, 7) ^ rotr(W15, 18) ^ W15 >>> 3;
409        const s1 = rotr(W2, 17) ^ rotr(W2, 19) ^ W2 >>> 10;
410        SHA256_W[i] = s1 + SHA256_W[i - 7] + s0 + SHA256_W[i - 16] | 0;
411      }
412      let { A, B, C, D, E, F, G, H } = this;
413      for (let i = 0; i < 64; i++) {
414        const sigma1 = rotr(E, 6) ^ rotr(E, 11) ^ rotr(E, 25);
415        const T1 = H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i] | 0;
416        const sigma0 = rotr(A, 2) ^ rotr(A, 13) ^ rotr(A, 22);
417        const T2 = sigma0 + Maj(A, B, C) | 0;
418        H = G;
419        G = F;
420        F = E;
421        E = D + T1 | 0;
422        D = C;
423        C = B;
424        B = A;
425        A = T1 + T2 | 0;
426      }
427      A = A + this.A | 0;
428      B = B + this.B | 0;
429      C = C + this.C | 0;
430      D = D + this.D | 0;
431      E = E + this.E | 0;
432      F = F + this.F | 0;
433      G = G + this.G | 0;
434      H = H + this.H | 0;
435      this.set(A, B, C, D, E, F, G, H);
436    }
437    roundClean() {
438      SHA256_W.fill(0);
439    }
440    destroy() {
441      this.set(0, 0, 0, 0, 0, 0, 0, 0);
442      this.buffer.fill(0);
443    }
444  };
445  var SHA224 = class extends SHA256 {
446    constructor() {
447      super();
448      this.A = 3238371032 | 0;
449      this.B = 914150663 | 0;
450      this.C = 812702999 | 0;
451      this.D = 4144912697 | 0;
452      this.E = 4290775857 | 0;
453      this.F = 1750603025 | 0;
454      this.G = 1694076839 | 0;
455      this.H = 3204075428 | 0;
456      this.outputLen = 28;
457    }
458  };
459  var sha256 = wrapConstructor(() => new SHA256());
460  var sha224 = wrapConstructor(() => new SHA224());
461
462  
vendor: 6,923 bytes, lines 462-676
462// node_modules/@noble/curves/esm/abstract/utils.js
463  var utils_exports = {};
464  __export(utils_exports, {
465    bitGet: () => bitGet,
466    bitLen: () => bitLen,
467    bitMask: () => bitMask,
468    bitSet: () => bitSet,
469    bytesToHex: () => bytesToHex2,
470    bytesToNumberBE: () => bytesToNumberBE,
471    bytesToNumberLE: () => bytesToNumberLE,
472    concatBytes: () => concatBytes2,
473    createHmacDrbg: () => createHmacDrbg,
474    ensureBytes: () => ensureBytes,
475    equalBytes: () => equalBytes,
476    hexToBytes: () => hexToBytes2,
477    hexToNumber: () => hexToNumber,
478    numberToBytesBE: () => numberToBytesBE,
479    numberToBytesLE: () => numberToBytesLE,
480    numberToHexUnpadded: () => numberToHexUnpadded,
481    numberToVarBytesBE: () => numberToVarBytesBE,
482    utf8ToBytes: () => utf8ToBytes2,
483    validateObject: () => validateObject
484  });
485  var _0n = BigInt(0);
486  var _1n = BigInt(1);
487  var _2n = BigInt(2);
488  var u8a2 = (a) => a instanceof Uint8Array;
489  var hexes2 = Array.from({ length: 256 }, (v, i) => i.toString(16).padStart(2, "0"));
490  function bytesToHex2(bytes3) {
491    if (!u8a2(bytes3))
492      throw new Error("Uint8Array expected");
493    let hex2 = "";
494    for (let i = 0; i < bytes3.length; i++) {
495      hex2 += hexes2[bytes3[i]];
496    }
497    return hex2;
498  }
499  function numberToHexUnpadded(num) {
500    const hex2 = num.toString(16);
501    return hex2.length & 1 ? `0${hex2}` : hex2;
502  }
503  function hexToNumber(hex2) {
504    if (typeof hex2 !== "string")
505      throw new Error("hex string expected, got " + typeof hex2);
506    return BigInt(hex2 === "" ? "0" : `0x${hex2}`);
507  }
508  function hexToBytes2(hex2) {
509    if (typeof hex2 !== "string")
510      throw new Error("hex string expected, got " + typeof hex2);
511    const len = hex2.length;
512    if (len % 2)
513      throw new Error("padded hex string expected, got unpadded hex of length " + len);
514    const array = new Uint8Array(len / 2);
515    for (let i = 0; i < array.length; i++) {
516      const j = i * 2;
517      const hexByte = hex2.slice(j, j + 2);
518      const byte = Number.parseInt(hexByte, 16);
519      if (Number.isNaN(byte) || byte < 0)
520        throw new Error("Invalid byte sequence");
521      array[i] = byte;
522    }
523    return array;
524  }
525  function bytesToNumberBE(bytes3) {
526    return hexToNumber(bytesToHex2(bytes3));
527  }
528  function bytesToNumberLE(bytes3) {
529    if (!u8a2(bytes3))
530      throw new Error("Uint8Array expected");
531    return hexToNumber(bytesToHex2(Uint8Array.from(bytes3).reverse()));
532  }
533  function numberToBytesBE(n, len) {
534    return hexToBytes2(n.toString(16).padStart(len * 2, "0"));
535  }
536  function numberToBytesLE(n, len) {
537    return numberToBytesBE(n, len).reverse();
538  }
539  function numberToVarBytesBE(n) {
540    return hexToBytes2(numberToHexUnpadded(n));
541  }
542  function ensureBytes(title, hex2, expectedLength) {
543    let res;
544    if (typeof hex2 === "string") {
545      try {
546        res = hexToBytes2(hex2);
547      } catch (e) {
548        throw new Error(`${title} must be valid hex string, got "${hex2}". Cause: ${e}`);
549      }
550    } else if (u8a2(hex2)) {
551      res = Uint8Array.from(hex2);
552    } else {
553      throw new Error(`${title} must be hex string or Uint8Array`);
554    }
555    const len = res.length;
556    if (typeof expectedLength === "number" && len !== expectedLength)
557      throw new Error(`${title} expected ${expectedLength} bytes, got ${len}`);
558    return res;
559  }
560  function concatBytes2(...arrays) {
561    const r = new Uint8Array(arrays.reduce((sum, a) => sum + a.length, 0));
562    let pad = 0;
563    arrays.forEach((a) => {
564      if (!u8a2(a))
565        throw new Error("Uint8Array expected");
566      r.set(a, pad);
567      pad += a.length;
568    });
569    return r;
570  }
571  function equalBytes(b1, b2) {
572    if (b1.length !== b2.length)
573      return false;
574    for (let i = 0; i < b1.length; i++)
575      if (b1[i] !== b2[i])
576        return false;
577    return true;
578  }
579  function utf8ToBytes2(str) {
580    if (typeof str !== "string")
581      throw new Error(`utf8ToBytes expected string, got ${typeof str}`);
582    return new Uint8Array(new TextEncoder().encode(str));
583  }
584  function bitLen(n) {
585    let len;
586    for (len = 0; n > _0n; n >>= _1n, len += 1)
587      ;
588    return len;
589  }
590  function bitGet(n, pos) {
591    return n >> BigInt(pos) & _1n;
592  }
593  var bitSet = (n, pos, value) => {
594    return n | (value ? _1n : _0n) << BigInt(pos);
595  };
596  var bitMask = (n) => (_2n << BigInt(n - 1)) - _1n;
597  var u8n = (data) => new Uint8Array(data);
598  var u8fr = (arr) => Uint8Array.from(arr);
599  function createHmacDrbg(hashLen, qByteLen, hmacFn) {
600    if (typeof hashLen !== "number" || hashLen < 2)
601      throw new Error("hashLen must be a number");
602    if (typeof qByteLen !== "number" || qByteLen < 2)
603      throw new Error("qByteLen must be a number");
604    if (typeof hmacFn !== "function")
605      throw new Error("hmacFn must be a function");
606    let v = u8n(hashLen);
607    let k = u8n(hashLen);
608    let i = 0;
609    const reset = () => {
610      v.fill(1);
611      k.fill(0);
612      i = 0;
613    };
614    const h = (...b) => hmacFn(k, v, ...b);
615    const reseed = (seed = u8n()) => {
616      k = h(u8fr([0]), seed);
617      v = h();
618      if (seed.length === 0)
619        return;
620      k = h(u8fr([1]), seed);
621      v = h();
622    };
623    const gen = () => {
624      if (i++ >= 1e3)
625        throw new Error("drbg: tried 1000 values");
626      let len = 0;
627      const out = [];
628      while (len < qByteLen) {
629        v = h();
630        const sl = v.slice();
631        out.push(sl);
632        len += v.length;
633      }
634      return concatBytes2(...out);
635    };
636    const genUntil = (seed, pred) => {
637      reset();
638      reseed(seed);
639      let res = void 0;
640      while (!(res = pred(gen())))
641        reseed();
642      reset();
643      return res;
644    };
645    return genUntil;
646  }
647  var validatorFns = {
648    bigint: (val) => typeof val === "bigint",
649    function: (val) => typeof val === "function",
650    boolean: (val) => typeof val === "boolean",
651    string: (val) => typeof val === "string",
652    isSafeInteger: (val) => Number.isSafeInteger(val),
653    array: (val) => Array.isArray(val),
654    field: (val, object) => object.Fp.isValid(val),
655    hash: (val) => typeof val === "function" && Number.isSafeInteger(val.outputLen)
656  };
657  function validateObject(object, validators, optValidators = {}) {
658    const checkField = (fieldName, type, isOptional) => {
659      const checkVal = validatorFns[type];
660      if (typeof checkVal !== "function")
661        throw new Error(`Invalid validator "${type}", expected function`);
662      const val = object[fieldName];
663      if (isOptional && val === void 0)
664        return;
665      if (!checkVal(val, object)) {
666        throw new Error(`Invalid param ${String(fieldName)}=${val} (${typeof val}), expected ${type}`);
667      }
668    };
669    for (const [fieldName, type] of Object.entries(validators))
670      checkField(fieldName, type, false);
671    for (const [fieldName, type] of Object.entries(optValidators))
672      checkField(fieldName, type, true);
673    return object;
674  }
675
676  
vendor: 7,534 bytes, lines 676-928
676// node_modules/@noble/curves/esm/abstract/modular.js
677  var _0n2 = BigInt(0);
678  var _1n2 = BigInt(1);
679  var _2n2 = BigInt(2);
680  var _3n = BigInt(3);
681  var _4n = BigInt(4);
682  var _5n = BigInt(5);
683  var _8n = BigInt(8);
684  var _9n = BigInt(9);
685  var _16n = BigInt(16);
686  function mod(a, b) {
687    const result = a % b;
688    return result >= _0n2 ? result : b + result;
689  }
690  function pow(num, power, modulo) {
691    if (modulo <= _0n2 || power < _0n2)
692      throw new Error("Expected power/modulo > 0");
693    if (modulo === _1n2)
694      return _0n2;
695    let res = _1n2;
696    while (power > _0n2) {
697      if (power & _1n2)
698        res = res * num % modulo;
699      num = num * num % modulo;
700      power >>= _1n2;
701    }
702    return res;
703  }
704  function pow2(x, power, modulo) {
705    let res = x;
706    while (power-- > _0n2) {
707      res *= res;
708      res %= modulo;
709    }
710    return res;
711  }
712  function invert(number3, modulo) {
713    if (number3 === _0n2 || modulo <= _0n2) {
714      throw new Error(`invert: expected positive integers, got n=${number3} mod=${modulo}`);
715    }
716    let a = mod(number3, modulo);
717    let b = modulo;
718    let x = _0n2, y = _1n2, u = _1n2, v = _0n2;
719    while (a !== _0n2) {
720      const q = b / a;
721      const r = b % a;
722      const m = x - u * q;
723      const n = y - v * q;
724      b = a, a = r, x = u, y = v, u = m, v = n;
725    }
726    const gcd2 = b;
727    if (gcd2 !== _1n2)
728      throw new Error("invert: does not exist");
729    return mod(x, modulo);
730  }
731  function tonelliShanks(P) {
732    const legendreC = (P - _1n2) / _2n2;
733    let Q, S, Z;
734    for (Q = P - _1n2, S = 0; Q % _2n2 === _0n2; Q /= _2n2, S++)
735      ;
736    for (Z = _2n2; Z < P && pow(Z, legendreC, P) !== P - _1n2; Z++)
737      ;
738    if (S === 1) {
739      const p1div4 = (P + _1n2) / _4n;
740      return function tonelliFast(Fp2, n) {
741        const root = Fp2.pow(n, p1div4);
742        if (!Fp2.eql(Fp2.sqr(root), n))
743          throw new Error("Cannot find square root");
744        return root;
745      };
746    }
747    const Q1div2 = (Q + _1n2) / _2n2;
748    return function tonelliSlow(Fp2, n) {
749      if (Fp2.pow(n, legendreC) === Fp2.neg(Fp2.ONE))
750        throw new Error("Cannot find square root");
751      let r = S;
752      let g = Fp2.pow(Fp2.mul(Fp2.ONE, Z), Q);
753      let x = Fp2.pow(n, Q1div2);
754      let b = Fp2.pow(n, Q);
755      while (!Fp2.eql(b, Fp2.ONE)) {
756        if (Fp2.eql(b, Fp2.ZERO))
757          return Fp2.ZERO;
758        let m = 1;
759        for (let t2 = Fp2.sqr(b); m < r; m++) {
760          if (Fp2.eql(t2, Fp2.ONE))
761            break;
762          t2 = Fp2.sqr(t2);
763        }
764        const ge2 = Fp2.pow(g, _1n2 << BigInt(r - m - 1));
765        g = Fp2.sqr(ge2);
766        x = Fp2.mul(x, ge2);
767        b = Fp2.mul(b, g);
768        r = m;
769      }
770      return x;
771    };
772  }
773  function FpSqrt(P) {
774    if (P % _4n === _3n) {
775      const p1div4 = (P + _1n2) / _4n;
776      return function sqrt3mod4(Fp2, n) {
777        const root = Fp2.pow(n, p1div4);
778        if (!Fp2.eql(Fp2.sqr(root), n))
779          throw new Error("Cannot find square root");
780        return root;
781      };
782    }
783    if (P % _8n === _5n) {
784      const c1 = (P - _5n) / _8n;
785      return function sqrt5mod8(Fp2, n) {
786        const n2 = Fp2.mul(n, _2n2);
787        const v = Fp2.pow(n2, c1);
788        const nv = Fp2.mul(n, v);
789        const i = Fp2.mul(Fp2.mul(nv, _2n2), v);
790        const root = Fp2.mul(nv, Fp2.sub(i, Fp2.ONE));
791        if (!Fp2.eql(Fp2.sqr(root), n))
792          throw new Error("Cannot find square root");
793        return root;
794      };
795    }
796    if (P % _16n === _9n) {
797    }
798    return tonelliShanks(P);
799  }
800  var FIELD_FIELDS = [
801    "create",
802    "isValid",
803    "is0",
804    "neg",
805    "inv",
806    "sqrt",
807    "sqr",
808    "eql",
809    "add",
810    "sub",
811    "mul",
812    "pow",
813    "div",
814    "addN",
815    "subN",
816    "mulN",
817    "sqrN"
818  ];
819  function validateField(field) {
820    const initial = {
821      ORDER: "bigint",
822      MASK: "bigint",
823      BYTES: "isSafeInteger",
824      BITS: "isSafeInteger"
825    };
826    const opts = FIELD_FIELDS.reduce((map, val) => {
827      map[val] = "function";
828      return map;
829    }, initial);
830    return validateObject(field, opts);
831  }
832  function FpPow(f2, num, power) {
833    if (power < _0n2)
834      throw new Error("Expected power > 0");
835    if (power === _0n2)
836      return f2.ONE;
837    if (power === _1n2)
838      return num;
839    let p = f2.ONE;
840    let d = num;
841    while (power > _0n2) {
842      if (power & _1n2)
843        p = f2.mul(p, d);
844      d = f2.sqr(d);
845      power >>= _1n2;
846    }
847    return p;
848  }
849  function FpInvertBatch(f2, nums) {
850    const tmp = new Array(nums.length);
851    const lastMultiplied = nums.reduce((acc, num, i) => {
852      if (f2.is0(num))
853        return acc;
854      tmp[i] = acc;
855      return f2.mul(acc, num);
856    }, f2.ONE);
857    const inverted = f2.inv(lastMultiplied);
858    nums.reduceRight((acc, num, i) => {
859      if (f2.is0(num))
860        return acc;
861      tmp[i] = f2.mul(acc, tmp[i]);
862      return f2.mul(acc, num);
863    }, inverted);
864    return tmp;
865  }
866  function nLength(n, nBitLength) {
867    const _nBitLength = nBitLength !== void 0 ? nBitLength : n.toString(2).length;
868    const nByteLength = Math.ceil(_nBitLength / 8);
869    return { nBitLength: _nBitLength, nByteLength };
870  }
871  function Field(ORDER, bitLen2, isLE3 = false, redef = {}) {
872    if (ORDER <= _0n2)
873      throw new Error(`Expected Fp ORDER > 0, got ${ORDER}`);
874    const { nBitLength: BITS, nByteLength: BYTES } = nLength(ORDER, bitLen2);
875    if (BYTES > 2048)
876      throw new Error("Field lengths over 2048 bytes are not supported");
877    const sqrtP = FpSqrt(ORDER);
878    const f2 = Object.freeze({
879      ORDER,
880      BITS,
881      BYTES,
882      MASK: bitMask(BITS),
883      ZERO: _0n2,
884      ONE: _1n2,
885      create: (num) => mod(num, ORDER),
886      isValid: (num) => {
887        if (typeof num !== "bigint")
888          throw new Error(`Invalid field element: expected bigint, got ${typeof num}`);
889        return _0n2 <= num && num < ORDER;
890      },
891      is0: (num) => num === _0n2,
892      isOdd: (num) => (num & _1n2) === _1n2,
893      neg: (num) => mod(-num, ORDER),
894      eql: (lhs, rhs) => lhs === rhs,
895      sqr: (num) => mod(num * num, ORDER),
896      add: (lhs, rhs) => mod(lhs + rhs, ORDER),
897      sub: (lhs, rhs) => mod(lhs - rhs, ORDER),
898      mul: (lhs, rhs) => mod(lhs * rhs, ORDER),
899      pow: (num, power) => FpPow(f2, num, power),
900      div: (lhs, rhs) => mod(lhs * invert(rhs, ORDER), ORDER),
901      sqrN: (num) => num * num,
902      addN: (lhs, rhs) => lhs + rhs,
903      subN: (lhs, rhs) => lhs - rhs,
904      mulN: (lhs, rhs) => lhs * rhs,
905      inv: (num) => invert(num, ORDER),
906      sqrt: redef.sqrt || ((n) => sqrtP(f2, n)),
907      invertBatch: (lst) => FpInvertBatch(f2, lst),
908      cmov: (a, b, c) => c ? b : a,
909      toBytes: (num) => isLE3 ? numberToBytesLE(num, BYTES) : numberToBytesBE(num, BYTES),
910      fromBytes: (bytes3) => {
911        if (bytes3.length !== BYTES)
912          throw new Error(`Fp.fromBytes: expected ${BYTES}, got ${bytes3.length}`);
913        return isLE3 ? bytesToNumberLE(bytes3) : bytesToNumberBE(bytes3);
914      }
915    });
916    return Object.freeze(f2);
917  }
918  function hashToPrivateScalar(hash3, groupOrder, isLE3 = false) {
919    hash3 = ensureBytes("privateHash", hash3);
920    const hashLen = hash3.length;
921    const minLen = nLength(groupOrder).nByteLength + 8;
922    if (minLen < 24 || hashLen < minLen || hashLen > 1024)
923      throw new Error(`hashToPrivateScalar: expected ${minLen}-1024 bytes of input, got ${hashLen}`);
924    const num = isLE3 ? bytesToNumberLE(hash3) : bytesToNumberBE(hash3);
925    return mod(num, groupOrder - _1n2) + _1n2;
926  }
927
928  
vendor: 2,810 bytes, lines 928-1028
928// node_modules/@noble/curves/esm/abstract/curve.js
929  var _0n3 = BigInt(0);
930  var _1n3 = BigInt(1);
931  function wNAF(c, bits) {
932    const constTimeNegate = (condition, item) => {
933      const neg = item.negate();
934      return condition ? neg : item;
935    };
936    const opts = (W) => {
937      const windows = Math.ceil(bits / W) + 1;
938      const windowSize = 2 ** (W - 1);
939      return { windows, windowSize };
940    };
941    return {
942      constTimeNegate,
943      unsafeLadder(elm, n) {
944        let p = c.ZERO;
945        let d = elm;
946        while (n > _0n3) {
947          if (n & _1n3)
948            p = p.add(d);
949          d = d.double();
950          n >>= _1n3;
951        }
952        return p;
953      },
954      precomputeWindow(elm, W) {
955        const { windows, windowSize } = opts(W);
956        const points = [];
957        let p = elm;
958        let base = p;
959        for (let window = 0; window < windows; window++) {
960          base = p;
961          points.push(base);
962          for (let i = 1; i < windowSize; i++) {
963            base = base.add(p);
964            points.push(base);
965          }
966          p = base.double();
967        }
968        return points;
969      },
970      wNAF(W, precomputes, n) {
971        const { windows, windowSize } = opts(W);
972        let p = c.ZERO;
973        let f2 = c.BASE;
974        const mask = BigInt(2 ** W - 1);
975        const maxNumber = 2 ** W;
976        const shiftBy = BigInt(W);
977        for (let window = 0; window < windows; window++) {
978          const offset = window * windowSize;
979          let wbits = Number(n & mask);
980          n >>= shiftBy;
981          if (wbits > windowSize) {
982            wbits -= maxNumber;
983            n += _1n3;
984          }
985          const offset1 = offset;
986          const offset2 = offset + Math.abs(wbits) - 1;
987          const cond1 = window % 2 !== 0;
988          const cond2 = wbits < 0;
989          if (wbits === 0) {
990            f2 = f2.add(constTimeNegate(cond1, precomputes[offset1]));
991          } else {
992            p = p.add(constTimeNegate(cond2, precomputes[offset2]));
993          }
994        }
995        return { p, f: f2 };
996      },
997      wNAFCached(P, precomputesMap, n, transform) {
998        const W = P._WINDOW_SIZE || 1;
999        let comp = precomputesMap.get(P);
1000        if (!comp) {
1001          comp = this.precomputeWindow(P, W);
1002          if (W !== 1) {
1003            precomputesMap.set(P, transform(comp));
1004          }
1005        }
1006        return this.wNAF(W, comp, n);
1007      }
1008    };
1009  }
1010  function validateBasic(curve) {
1011    validateField(curve.Fp);
1012    validateObject(curve, {
1013      n: "bigint",
1014      h: "bigint",
1015      Gx: "field",
1016      Gy: "field"
1017    }, {
1018      nBitLength: "isSafeInteger",
1019      nByteLength: "isSafeInteger"
1020    });
1021    return Object.freeze({
1022      ...nLength(curve.n, curve.nBitLength),
1023      ...curve,
1024      ...{ p: curve.Fp.ORDER }
1025    });
1026  }
1027
1028  
vendor: 25,110 bytes, lines 1028-1750
1028// node_modules/@noble/curves/esm/abstract/weierstrass.js
1029  function validatePointOpts(curve) {
1030    const opts = validateBasic(curve);
1031    validateObject(opts, {
1032      a: "field",
1033      b: "field"
1034    }, {
1035      allowedPrivateKeyLengths: "array",
1036      wrapPrivateKey: "boolean",
1037      isTorsionFree: "function",
1038      clearCofactor: "function",
1039      allowInfinityPoint: "boolean",
1040      fromBytes: "function",
1041      toBytes: "function"
1042    });
1043    const { endo, Fp: Fp2, a } = opts;
1044    if (endo) {
1045      if (!Fp2.eql(a, Fp2.ZERO)) {
1046        throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");
1047      }
1048      if (typeof endo !== "object" || typeof endo.beta !== "bigint" || typeof endo.splitScalar !== "function") {
1049        throw new Error("Expected endomorphism with beta: bigint and splitScalar: function");
1050      }
1051    }
1052    return Object.freeze({ ...opts });
1053  }
1054  var { bytesToNumberBE: b2n, hexToBytes: h2b } = utils_exports;
1055  var DER = {
1056    Err: class DERErr extends Error {
1057      constructor(m = "") {
1058        super(m);
1059      }
1060    },
1061    _parseInt(data) {
1062      const { Err: E } = DER;
1063      if (data.length < 2 || data[0] !== 2)
1064        throw new E("Invalid signature integer tag");
1065      const len = data[1];
1066      const res = data.subarray(2, len + 2);
1067      if (!len || res.length !== len)
1068        throw new E("Invalid signature integer: wrong length");
1069      if (res[0] & 128)
1070        throw new E("Invalid signature integer: negative");
1071      if (res[0] === 0 && !(res[1] & 128))
1072        throw new E("Invalid signature integer: unnecessary leading zero");
1073      return { d: b2n(res), l: data.subarray(len + 2) };
1074    },
1075    toSig(hex2) {
1076      const { Err: E } = DER;
1077      const data = typeof hex2 === "string" ? h2b(hex2) : hex2;
1078      if (!(data instanceof Uint8Array))
1079        throw new Error("ui8a expected");
1080      let l = data.length;
1081      if (l < 2 || data[0] != 48)
1082        throw new E("Invalid signature tag");
1083      if (data[1] !== l - 2)
1084        throw new E("Invalid signature: incorrect length");
1085      const { d: r, l: sBytes } = DER._parseInt(data.subarray(2));
1086      const { d: s, l: rBytesLeft } = DER._parseInt(sBytes);
1087      if (rBytesLeft.length)
1088        throw new E("Invalid signature: left bytes after parsing");
1089      return { r, s };
1090    },
1091    hexFromSig(sig) {
1092      const slice = (s2) => Number.parseInt(s2[0], 16) & 8 ? "00" + s2 : s2;
1093      const h = (num) => {
1094        const hex2 = num.toString(16);
1095        return hex2.length & 1 ? `0${hex2}` : hex2;
1096      };
1097      const s = slice(h(sig.s));
1098      const r = slice(h(sig.r));
1099      const shl = s.length / 2;
1100      const rhl = r.length / 2;
1101      const sl = h(shl);
1102      const rl = h(rhl);
1103      return `30${h(rhl + shl + 4)}02${rl}${r}02${sl}${s}`;
1104    }
1105  };
1106  var _0n4 = BigInt(0);
1107  var _1n4 = BigInt(1);
1108  var _2n3 = BigInt(2);
1109  var _3n2 = BigInt(3);
1110  var _4n2 = BigInt(4);
1111  function weierstrassPoints(opts) {
1112    const CURVE = validatePointOpts(opts);
1113    const { Fp: Fp2 } = CURVE;
1114    const toBytes3 = CURVE.toBytes || ((c, point, isCompressed) => {
1115      const a = point.toAffine();
1116      return concatBytes2(Uint8Array.from([4]), Fp2.toBytes(a.x), Fp2.toBytes(a.y));
1117    });
1118    const fromBytes = CURVE.fromBytes || ((bytes3) => {
1119      const tail = bytes3.subarray(1);
1120      const x = Fp2.fromBytes(tail.subarray(0, Fp2.BYTES));
1121      const y = Fp2.fromBytes(tail.subarray(Fp2.BYTES, 2 * Fp2.BYTES));
1122      return { x, y };
1123    });
1124    function weierstrassEquation(x) {
1125      const { a, b } = CURVE;
1126      const x2 = Fp2.sqr(x);
1127      const x3 = Fp2.mul(x2, x);
1128      return Fp2.add(Fp2.add(x3, Fp2.mul(x, a)), b);
1129    }
1130    if (!Fp2.eql(Fp2.sqr(CURVE.Gy), weierstrassEquation(CURVE.Gx)))
1131      throw new Error("bad generator point: equation left != right");
1132    function isWithinCurveOrder(num) {
1133      return typeof num === "bigint" && _0n4 < num && num < CURVE.n;
1134    }
1135    function assertGE(num) {
1136      if (!isWithinCurveOrder(num))
1137        throw new Error("Expected valid bigint: 0 < bigint < curve.n");
1138    }
1139    function normPrivateKeyToScalar(key) {
1140      const { allowedPrivateKeyLengths: lengths, nByteLength, wrapPrivateKey, n } = CURVE;
1141      if (lengths && typeof key !== "bigint") {
1142        if (key instanceof Uint8Array)
1143          key = bytesToHex2(key);
1144        if (typeof key !== "string" || !lengths.includes(key.length))
1145          throw new Error("Invalid key");
1146        key = key.padStart(nByteLength * 2, "0");
1147      }
1148      let num;
1149      try {
1150        num = typeof key === "bigint" ? key : bytesToNumberBE(ensureBytes("private key", key, nByteLength));
1151      } catch (error) {
1152        throw new Error(`private key must be ${nByteLength} bytes, hex or bigint, not ${typeof key}`);
1153      }
1154      if (wrapPrivateKey)
1155        num = mod(num, n);
1156      assertGE(num);
1157      return num;
1158    }
1159    const pointPrecomputes = /* @__PURE__ */ new Map();
1160    function assertPrjPoint(other) {
1161      if (!(other instanceof Point3))
1162        throw new Error("ProjectivePoint expected");
1163    }
1164    class Point3 {
1165      constructor(px, py, pz) {
1166        this.px = px;
1167        this.py = py;
1168        this.pz = pz;
1169        if (px == null || !Fp2.isValid(px))
1170          throw new Error("x required");
1171        if (py == null || !Fp2.isValid(py))
1172          throw new Error("y required");
1173        if (pz == null || !Fp2.isValid(pz))
1174          throw new Error("z required");
1175      }
1176      static fromAffine(p) {
1177        const { x, y } = p || {};
1178        if (!p || !Fp2.isValid(x) || !Fp2.isValid(y))
1179          throw new Error("invalid affine point");
1180        if (p instanceof Point3)
1181          throw new Error("projective point not allowed");
1182        const is0 = (i) => Fp2.eql(i, Fp2.ZERO);
1183        if (is0(x) && is0(y))
1184          return Point3.ZERO;
1185        return new Point3(x, y, Fp2.ONE);
1186      }
1187      get x() {
1188        return this.toAffine().x;
1189      }
1190      get y() {
1191        return this.toAffine().y;
1192      }
1193      static normalizeZ(points) {
1194        const toInv = Fp2.invertBatch(points.map((p) => p.pz));
1195        return points.map((p, i) => p.toAffine(toInv[i])).map(Point3.fromAffine);
1196      }
1197      static fromHex(hex2) {
1198        const P = Point3.fromAffine(fromBytes(ensureBytes("pointHex", hex2)));
1199        P.assertValidity();
1200        return P;
1201      }
1202      static fromPrivateKey(privateKey) {
1203        return Point3.BASE.multiply(normPrivateKeyToScalar(privateKey));
1204      }
1205      _setWindowSize(windowSize) {
1206        this._WINDOW_SIZE = windowSize;
1207        pointPrecomputes.delete(this);
1208      }
1209      assertValidity() {
1210        if (this.is0()) {
1211          if (CURVE.allowInfinityPoint)
1212            return;
1213          throw new Error("bad point: ZERO");
1214        }
1215        const { x, y } = this.toAffine();
1216        if (!Fp2.isValid(x) || !Fp2.isValid(y))
1217          throw new Error("bad point: x or y not FE");
1218        const left = Fp2.sqr(y);
1219        const right = weierstrassEquation(x);
1220        if (!Fp2.eql(left, right))
1221          throw new Error("bad point: equation left != right");
1222        if (!this.isTorsionFree())
1223          throw new Error("bad point: not in prime-order subgroup");
1224      }
1225      hasEvenY() {
1226        const { y } = this.toAffine();
1227        if (Fp2.isOdd)
1228          return !Fp2.isOdd(y);
1229        throw new Error("Field doesn't support isOdd");
1230      }
1231      equals(other) {
1232        assertPrjPoint(other);
1233        const { px: X1, py: Y1, pz: Z1 } = this;
1234        const { px: X2, py: Y2, pz: Z2 } = other;
1235        const U1 = Fp2.eql(Fp2.mul(X1, Z2), Fp2.mul(X2, Z1));
1236        const U2 = Fp2.eql(Fp2.mul(Y1, Z2), Fp2.mul(Y2, Z1));
1237        return U1 && U2;
1238      }
1239      negate() {
1240        return new Point3(this.px, Fp2.neg(this.py), this.pz);
1241      }
1242      double() {
1243        const { a, b } = CURVE;
1244        const b3 = Fp2.mul(b, _3n2);
1245        const { px: X1, py: Y1, pz: Z1 } = this;
1246        let X3 = Fp2.ZERO, Y3 = Fp2.ZERO, Z3 = Fp2.ZERO;
1247        let t0 = Fp2.mul(X1, X1);
1248        let t1 = Fp2.mul(Y1, Y1);
1249        let t2 = Fp2.mul(Z1, Z1);
1250        let t3 = Fp2.mul(X1, Y1);
1251        t3 = Fp2.add(t3, t3);
1252        Z3 = Fp2.mul(X1, Z1);
1253        Z3 = Fp2.add(Z3, Z3);
1254        X3 = Fp2.mul(a, Z3);
1255        Y3 = Fp2.mul(b3, t2);
1256        Y3 = Fp2.add(X3, Y3);
1257        X3 = Fp2.sub(t1, Y3);
1258        Y3 = Fp2.add(t1, Y3);
1259        Y3 = Fp2.mul(X3, Y3);
1260        X3 = Fp2.mul(t3, X3);
1261        Z3 = Fp2.mul(b3, Z3);
1262        t2 = Fp2.mul(a, t2);
1263        t3 = Fp2.sub(t0, t2);
1264        t3 = Fp2.mul(a, t3);
1265        t3 = Fp2.add(t3, Z3);
1266        Z3 = Fp2.add(t0, t0);
1267        t0 = Fp2.add(Z3, t0);
1268        t0 = Fp2.add(t0, t2);
1269        t0 = Fp2.mul(t0, t3);
1270        Y3 = Fp2.add(Y3, t0);
1271        t2 = Fp2.mul(Y1, Z1);
1272        t2 = Fp2.add(t2, t2);
1273        t0 = Fp2.mul(t2, t3);
1274        X3 = Fp2.sub(X3, t0);
1275        Z3 = Fp2.mul(t2, t1);
1276        Z3 = Fp2.add(Z3, Z3);
1277        Z3 = Fp2.add(Z3, Z3);
1278        return new Point3(X3, Y3, Z3);
1279      }
1280      add(other) {
1281        assertPrjPoint(other);
1282        const { px: X1, py: Y1, pz: Z1 } = this;
1283        const { px: X2, py: Y2, pz: Z2 } = other;
1284        let X3 = Fp2.ZERO, Y3 = Fp2.ZERO, Z3 = Fp2.ZERO;
1285        const a = CURVE.a;
1286        const b3 = Fp2.mul(CURVE.b, _3n2);
1287        let t0 = Fp2.mul(X1, X2);
1288        let t1 = Fp2.mul(Y1, Y2);
1289        let t2 = Fp2.mul(Z1, Z2);
1290        let t3 = Fp2.add(X1, Y1);
1291        let t4 = Fp2.add(X2, Y2);
1292        t3 = Fp2.mul(t3, t4);
1293        t4 = Fp2.add(t0, t1);
1294        t3 = Fp2.sub(t3, t4);
1295        t4 = Fp2.add(X1, Z1);
1296        let t5 = Fp2.add(X2, Z2);
1297        t4 = Fp2.mul(t4, t5);
1298        t5 = Fp2.add(t0, t2);
1299        t4 = Fp2.sub(t4, t5);
1300        t5 = Fp2.add(Y1, Z1);
1301        X3 = Fp2.add(Y2, Z2);
1302        t5 = Fp2.mul(t5, X3);
1303        X3 = Fp2.add(t1, t2);
1304        t5 = Fp2.sub(t5, X3);
1305        Z3 = Fp2.mul(a, t4);
1306        X3 = Fp2.mul(b3, t2);
1307        Z3 = Fp2.add(X3, Z3);
1308        X3 = Fp2.sub(t1, Z3);
1309        Z3 = Fp2.add(t1, Z3);
1310        Y3 = Fp2.mul(X3, Z3);
1311        t1 = Fp2.add(t0, t0);
1312        t1 = Fp2.add(t1, t0);
1313        t2 = Fp2.mul(a, t2);
1314        t4 = Fp2.mul(b3, t4);
1315        t1 = Fp2.add(t1, t2);
1316        t2 = Fp2.sub(t0, t2);
1317        t2 = Fp2.mul(a, t2);
1318        t4 = Fp2.add(t4, t2);
1319        t0 = Fp2.mul(t1, t4);
1320        Y3 = Fp2.add(Y3, t0);
1321        t0 = Fp2.mul(t5, t4);
1322        X3 = Fp2.mul(t3, X3);
1323        X3 = Fp2.sub(X3, t0);
1324        t0 = Fp2.mul(t3, t1);
1325        Z3 = Fp2.mul(t5, Z3);
1326        Z3 = Fp2.add(Z3, t0);
1327        return new Point3(X3, Y3, Z3);
1328      }
1329      subtract(other) {
1330        return this.add(other.negate());
1331      }
1332      is0() {
1333        return this.equals(Point3.ZERO);
1334      }
1335      wNAF(n) {
1336        return wnaf.wNAFCached(this, pointPrecomputes, n, (comp) => {
1337          const toInv = Fp2.invertBatch(comp.map((p) => p.pz));
1338          return comp.map((p, i) => p.toAffine(toInv[i])).map(Point3.fromAffine);
1339        });
1340      }
1341      multiplyUnsafe(n) {
1342        const I = Point3.ZERO;
1343        if (n === _0n4)
1344          return I;
1345        assertGE(n);
1346        if (n === _1n4)
1347          return this;
1348        const { endo } = CURVE;
1349        if (!endo)
1350          return wnaf.unsafeLadder(this, n);
1351        let { k1neg, k1, k2neg, k2 } = endo.splitScalar(n);
1352        let k1p = I;
1353        let k2p = I;
1354        let d = this;
1355        while (k1 > _0n4 || k2 > _0n4) {
1356          if (k1 & _1n4)
1357            k1p = k1p.add(d);
1358          if (k2 & _1n4)
1359            k2p = k2p.add(d);
1360          d = d.double();
1361          k1 >>= _1n4;
1362          k2 >>= _1n4;
1363        }
1364        if (k1neg)
1365          k1p = k1p.negate();
1366        if (k2neg)
1367          k2p = k2p.negate();
1368        k2p = new Point3(Fp2.mul(k2p.px, endo.beta), k2p.py, k2p.pz);
1369        return k1p.add(k2p);
1370      }
1371      multiply(scalar) {
1372        assertGE(scalar);
1373        let n = scalar;
1374        let point, fake;
1375        const { endo } = CURVE;
1376        if (endo) {
1377          const { k1neg, k1, k2neg, k2 } = endo.splitScalar(n);
1378          let { p: k1p, f: f1p } = this.wNAF(k1);
1379          let { p: k2p, f: f2p } = this.wNAF(k2);
1380          k1p = wnaf.constTimeNegate(k1neg, k1p);
1381          k2p = wnaf.constTimeNegate(k2neg, k2p);
1382          k2p = new Point3(Fp2.mul(k2p.px, endo.beta), k2p.py, k2p.pz);
1383          point = k1p.add(k2p);
1384          fake = f1p.add(f2p);
1385        } else {
1386          const { p, f: f2 } = this.wNAF(n);
1387          point = p;
1388          fake = f2;
1389        }
1390        return Point3.normalizeZ([point, fake])[0];
1391      }
1392      multiplyAndAddUnsafe(Q, a, b) {
1393        const G = Point3.BASE;
1394        const mul = (P, a2) => a2 === _0n4 || a2 === _1n4 || !P.equals(G) ? P.multiplyUnsafe(a2) : P.multiply(a2);
1395        const sum = mul(this, a).add(mul(Q, b));
1396        return sum.is0() ? void 0 : sum;
1397      }
1398      toAffine(iz) {
1399        const { px: x, py: y, pz: z } = this;
1400        const is0 = this.is0();
1401        if (iz == null)
1402          iz = is0 ? Fp2.ONE : Fp2.inv(z);
1403        const ax = Fp2.mul(x, iz);
1404        const ay = Fp2.mul(y, iz);
1405        const zz = Fp2.mul(z, iz);
1406        if (is0)
1407          return { x: Fp2.ZERO, y: Fp2.ZERO };
1408        if (!Fp2.eql(zz, Fp2.ONE))
1409          throw new Error("invZ was invalid");
1410        return { x: ax, y: ay };
1411      }
1412      isTorsionFree() {
1413        const { h: cofactor, isTorsionFree } = CURVE;
1414        if (cofactor === _1n4)
1415          return true;
1416        if (isTorsionFree)
1417          return isTorsionFree(Point3, this);
1418        throw new Error("isTorsionFree() has not been declared for the elliptic curve");
1419      }
1420      clearCofactor() {
1421        const { h: cofactor, clearCofactor } = CURVE;
1422        if (cofactor === _1n4)
1423          return this;
1424        if (clearCofactor)
1425          return clearCofactor(Point3, this);
1426        return this.multiplyUnsafe(CURVE.h);
1427      }
1428      toRawBytes(isCompressed = true) {
1429        this.assertValidity();
1430        return toBytes3(Point3, this, isCompressed);
1431      }
1432      toHex(isCompressed = true) {
1433        return bytesToHex2(this.toRawBytes(isCompressed));
1434      }
1435    }
1436    Point3.BASE = new Point3(CURVE.Gx, CURVE.Gy, Fp2.ONE);
1437    Point3.ZERO = new Point3(Fp2.ZERO, Fp2.ONE, Fp2.ZERO);
1438    const _bits = CURVE.nBitLength;
1439    const wnaf = wNAF(Point3, CURVE.endo ? Math.ceil(_bits / 2) : _bits);
1440    return {
1441      CURVE,
1442      ProjectivePoint: Point3,
1443      normPrivateKeyToScalar,
1444      weierstrassEquation,
1445      isWithinCurveOrder
1446    };
1447  }
1448  function validateOpts(curve) {
1449    const opts = validateBasic(curve);
1450    validateObject(opts, {
1451      hash: "hash",
1452      hmac: "function",
1453      randomBytes: "function"
1454    }, {
1455      bits2int: "function",
1456      bits2int_modN: "function",
1457      lowS: "boolean"
1458    });
1459    return Object.freeze({ lowS: true, ...opts });
1460  }
1461  function weierstrass(curveDef) {
1462    const CURVE = validateOpts(curveDef);
1463    const { Fp: Fp2, n: CURVE_ORDER } = CURVE;
1464    const compressedLen = Fp2.BYTES + 1;
1465    const uncompressedLen = 2 * Fp2.BYTES + 1;
1466    function isValidFieldElement(num) {
1467      return _0n4 < num && num < Fp2.ORDER;
1468    }
1469    function modN2(a) {
1470      return mod(a, CURVE_ORDER);
1471    }
1472    function invN(a) {
1473      return invert(a, CURVE_ORDER);
1474    }
1475    const { ProjectivePoint: Point3, normPrivateKeyToScalar, weierstrassEquation, isWithinCurveOrder } = weierstrassPoints({
1476      ...CURVE,
1477      toBytes(c, point, isCompressed) {
1478        const a = point.toAffine();
1479        const x = Fp2.toBytes(a.x);
1480        const cat = concatBytes2;
1481        if (isCompressed) {
1482          return cat(Uint8Array.from([point.hasEvenY() ? 2 : 3]), x);
1483        } else {
1484          return cat(Uint8Array.from([4]), x, Fp2.toBytes(a.y));
1485        }
1486      },
1487      fromBytes(bytes3) {
1488        const len = bytes3.length;
1489        const head = bytes3[0];
1490        const tail = bytes3.subarray(1);
1491        if (len === compressedLen && (head === 2 || head === 3)) {
1492          const x = bytesToNumberBE(tail);
1493          if (!isValidFieldElement(x))
1494            throw new Error("Point is not on curve");
1495          const y2 = weierstrassEquation(x);
1496          let y = Fp2.sqrt(y2);
1497          const isYOdd = (y & _1n4) === _1n4;
1498          const isHeadOdd = (head & 1) === 1;
1499          if (isHeadOdd !== isYOdd)
1500            y = Fp2.neg(y);
1501          return { x, y };
1502        } else if (len === uncompressedLen && head === 4) {
1503          const x = Fp2.fromBytes(tail.subarray(0, Fp2.BYTES));
1504          const y = Fp2.fromBytes(tail.subarray(Fp2.BYTES, 2 * Fp2.BYTES));
1505          return { x, y };
1506        } else {
1507          throw new Error(`Point of length ${len} was invalid. Expected ${compressedLen} compressed bytes or ${uncompressedLen} uncompressed bytes`);
1508        }
1509      }
1510    });
1511    const numToNByteStr = (num) => bytesToHex2(numberToBytesBE(num, CURVE.nByteLength));
1512    function isBiggerThanHalfOrder(number3) {
1513      const HALF = CURVE_ORDER >> _1n4;
1514      return number3 > HALF;
1515    }
1516    function normalizeS(s) {
1517      return isBiggerThanHalfOrder(s) ? modN2(-s) : s;
1518    }
1519    const slcNum = (b, from, to) => bytesToNumberBE(b.slice(from, to));
1520    class Signature {
1521      constructor(r, s, recovery) {
1522        this.r = r;
1523        this.s = s;
1524        this.recovery = recovery;
1525        this.assertValidity();
1526      }
1527      static fromCompact(hex2) {
1528        const l = CURVE.nByteLength;
1529        hex2 = ensureBytes("compactSignature", hex2, l * 2);
1530        return new Signature(slcNum(hex2, 0, l), slcNum(hex2, l, 2 * l));
1531      }
1532      static fromDER(hex2) {
1533        const { r, s } = DER.toSig(ensureBytes("DER", hex2));
1534        return new Signature(r, s);
1535      }
1536      assertValidity() {
1537        if (!isWithinCurveOrder(this.r))
1538          throw new Error("r must be 0 < r < CURVE.n");
1539        if (!isWithinCurveOrder(this.s))
1540          throw new Error("s must be 0 < s < CURVE.n");
1541      }
1542      addRecoveryBit(recovery) {
1543        return new Signature(this.r, this.s, recovery);
1544      }
1545      recoverPublicKey(msgHash) {
1546        const { r, s, recovery: rec } = this;
1547        const h = bits2int_modN(ensureBytes("msgHash", msgHash));
1548        if (rec == null || ![0, 1, 2, 3].includes(rec))
1549          throw new Error("recovery id invalid");
1550        const radj = rec === 2 || rec === 3 ? r + CURVE.n : r;
1551        if (radj >= Fp2.ORDER)
1552          throw new Error("recovery id 2 or 3 invalid");
1553        const prefix = (rec & 1) === 0 ? "02" : "03";
1554        const R = Point3.fromHex(prefix + numToNByteStr(radj));
1555        const ir = invN(radj);
1556        const u1 = modN2(-h * ir);
1557        const u2 = modN2(s * ir);
1558        const Q = Point3.BASE.multiplyAndAddUnsafe(R, u1, u2);
1559        if (!Q)
1560          throw new Error("point at infinify");
1561        Q.assertValidity();
1562        return Q;
1563      }
1564      hasHighS() {
1565        return isBiggerThanHalfOrder(this.s);
1566      }
1567      normalizeS() {
1568        return this.hasHighS() ? new Signature(this.r, modN2(-this.s), this.recovery) : this;
1569      }
1570      toDERRawBytes() {
1571        return hexToBytes2(this.toDERHex());
1572      }
1573      toDERHex() {
1574        return DER.hexFromSig({ r: this.r, s: this.s });
1575      }
1576      toCompactRawBytes() {
1577        return hexToBytes2(this.toCompactHex());
1578      }
1579      toCompactHex() {
1580        return numToNByteStr(this.r) + numToNByteStr(this.s);
1581      }
1582    }
1583    const utils3 = {
1584      isValidPrivateKey(privateKey) {
1585        try {
1586          normPrivateKeyToScalar(privateKey);
1587          return true;
1588        } catch (error) {
1589          return false;
1590        }
1591      },
1592      normPrivateKeyToScalar,
1593      randomPrivateKey: () => {
1594        const rand = CURVE.randomBytes(Fp2.BYTES + 8);
1595        const num = hashToPrivateScalar(rand, CURVE_ORDER);
1596        return numberToBytesBE(num, CURVE.nByteLength);
1597      },
1598      precompute(windowSize = 8, point = Point3.BASE) {
1599        point._setWindowSize(windowSize);
1600        point.multiply(BigInt(3));
1601        return point;
1602      }
1603    };
1604    function getPublicKey2(privateKey, isCompressed = true) {
1605      return Point3.fromPrivateKey(privateKey).toRawBytes(isCompressed);
1606    }
1607    function isProbPub(item) {
1608      const arr = item instanceof Uint8Array;
1609      const str = typeof item === "string";
1610      const len = (arr || str) && item.length;
1611      if (arr)
1612        return len === compressedLen || len === uncompressedLen;
1613      if (str)
1614        return len === 2 * compressedLen || len === 2 * uncompressedLen;
1615      if (item instanceof Point3)
1616        return true;
1617      return false;
1618    }
1619    function getSharedSecret(privateA, publicB, isCompressed = true) {
1620      if (isProbPub(privateA))
1621        throw new Error("first arg must be private key");
1622      if (!isProbPub(publicB))
1623        throw new Error("second arg must be public key");
1624      const b = Point3.fromHex(publicB);
1625      return b.multiply(normPrivateKeyToScalar(privateA)).toRawBytes(isCompressed);
1626    }
1627    const bits2int = CURVE.bits2int || function(bytes3) {
1628      const num = bytesToNumberBE(bytes3);
1629      const delta = bytes3.length * 8 - CURVE.nBitLength;
1630      return delta > 0 ? num >> BigInt(delta) : num;
1631    };
1632    const bits2int_modN = CURVE.bits2int_modN || function(bytes3) {
1633      return modN2(bits2int(bytes3));
1634    };
1635    const ORDER_MASK = bitMask(CURVE.nBitLength);
1636    function int2octets(num) {
1637      if (typeof num !== "bigint")
1638        throw new Error("bigint expected");
1639      if (!(_0n4 <= num && num < ORDER_MASK))
1640        throw new Error(`bigint expected < 2^${CURVE.nBitLength}`);
1641      return numberToBytesBE(num, CURVE.nByteLength);
1642    }
1643    function prepSig(msgHash, privateKey, opts = defaultSigOpts) {
1644      if (["recovered", "canonical"].some((k) => k in opts))
1645        throw new Error("sign() legacy options not supported");
1646      const { hash: hash3, randomBytes: randomBytes2 } = CURVE;
1647      let { lowS, prehash, extraEntropy: ent } = opts;
1648      if (lowS == null)
1649        lowS = true;
1650      msgHash = ensureBytes("msgHash", msgHash);
1651      if (prehash)
1652        msgHash = ensureBytes("prehashed msgHash", hash3(msgHash));
1653      const h1int = bits2int_modN(msgHash);
1654      const d = normPrivateKeyToScalar(privateKey);
1655      const seedArgs = [int2octets(d), int2octets(h1int)];
1656      if (ent != null) {
1657        const e = ent === true ? randomBytes2(Fp2.BYTES) : ent;
1658        seedArgs.push(ensureBytes("extraEntropy", e, Fp2.BYTES));
1659      }
1660      const seed = concatBytes2(...seedArgs);
1661      const m = h1int;
1662      function k2sig(kBytes) {
1663        const k = bits2int(kBytes);
1664        if (!isWithinCurveOrder(k))
1665          return;
1666        const ik = invN(k);
1667        const q = Point3.BASE.multiply(k).toAffine();
1668        const r = modN2(q.x);
1669        if (r === _0n4)
1670          return;
1671        const s = modN2(ik * modN2(m + r * d));
1672        if (s === _0n4)
1673          return;
1674        let recovery = (q.x === r ? 0 : 2) | Number(q.y & _1n4);
1675        let normS = s;
1676        if (lowS && isBiggerThanHalfOrder(s)) {
1677          normS = normalizeS(s);
1678          recovery ^= 1;
1679        }
1680        return new Signature(r, normS, recovery);
1681      }
1682      return { seed, k2sig };
1683    }
1684    const defaultSigOpts = { lowS: CURVE.lowS, prehash: false };
1685    const defaultVerOpts = { lowS: CURVE.lowS, prehash: false };
1686    function sign(msgHash, privKey, opts = defaultSigOpts) {
1687      const { seed, k2sig } = prepSig(msgHash, privKey, opts);
1688      const C = CURVE;
1689      const drbg = createHmacDrbg(C.hash.outputLen, C.nByteLength, C.hmac);
1690      return drbg(seed, k2sig);
1691    }
1692    Point3.BASE._setWindowSize(8);
1693    function verify(signature, msgHash, publicKey, opts = defaultVerOpts) {
1694      const sg = signature;
1695      msgHash = ensureBytes("msgHash", msgHash);
1696      publicKey = ensureBytes("publicKey", publicKey);
1697      if ("strict" in opts)
1698        throw new Error("options.strict was renamed to lowS");
1699      const { lowS, prehash } = opts;
1700      let _sig = void 0;
1701      let P;
1702      try {
1703        if (typeof sg === "string" || sg instanceof Uint8Array) {
1704          try {
1705            _sig = Signature.fromDER(sg);
1706          } catch (derError) {
1707            if (!(derError instanceof DER.Err))
1708              throw derError;
1709            _sig = Signature.fromCompact(sg);
1710          }
1711        } else if (typeof sg === "object" && typeof sg.r === "bigint" && typeof sg.s === "bigint") {
1712          const { r: r2, s: s2 } = sg;
1713          _sig = new Signature(r2, s2);
1714        } else {
1715          throw new Error("PARSE");
1716        }
1717        P = Point3.fromHex(publicKey);
1718      } catch (error) {
1719        if (error.message === "PARSE")
1720          throw new Error(`signature must be Signature instance, Uint8Array or hex string`);
1721        return false;
1722      }
1723      if (lowS && _sig.hasHighS())
1724        return false;
1725      if (prehash)
1726        msgHash = CURVE.hash(msgHash);
1727      const { r, s } = _sig;
1728      const h = bits2int_modN(msgHash);
1729      const is = invN(s);
1730      const u1 = modN2(h * is);
1731      const u2 = modN2(r * is);
1732      const R = Point3.BASE.multiplyAndAddUnsafe(P, u1, u2)?.toAffine();
1733      if (!R)
1734        return false;
1735      const v = modN2(R.x);
1736      return v === r;
1737    }
1738    return {
1739      CURVE,
1740      getPublicKey: getPublicKey2,
1741      getSharedSecret,
1742      sign,
1743      verify,
1744      ProjectivePoint: Point3,
1745      Signature,
1746      utils: utils3
1747    };
1748  }
1749
1750  
vendor: 2,085 bytes, lines 1750-1815
1750// node_modules/@noble/hashes/esm/hmac.js
1751  var HMAC = class extends Hash {
1752    constructor(hash3, _key) {
1753      super();
1754      this.finished = false;
1755      this.destroyed = false;
1756      assert_default.hash(hash3);
1757      const key = toBytes(_key);
1758      this.iHash = hash3.create();
1759      if (typeof this.iHash.update !== "function")
1760        throw new Error("Expected instance of class which extends utils.Hash");
1761      this.blockLen = this.iHash.blockLen;
1762      this.outputLen = this.iHash.outputLen;
1763      const blockLen = this.blockLen;
1764      const pad = new Uint8Array(blockLen);
1765      pad.set(key.length > blockLen ? hash3.create().update(key).digest() : key);
1766      for (let i = 0; i < pad.length; i++)
1767        pad[i] ^= 54;
1768      this.iHash.update(pad);
1769      this.oHash = hash3.create();
1770      for (let i = 0; i < pad.length; i++)
1771        pad[i] ^= 54 ^ 92;
1772      this.oHash.update(pad);
1773      pad.fill(0);
1774    }
1775    update(buf) {
1776      assert_default.exists(this);
1777      this.iHash.update(buf);
1778      return this;
1779    }
1780    digestInto(out) {
1781      assert_default.exists(this);
1782      assert_default.bytes(out, this.outputLen);
1783      this.finished = true;
1784      this.iHash.digestInto(out);
1785      this.oHash.update(out);
1786      this.oHash.digestInto(out);
1787      this.destroy();
1788    }
1789    digest() {
1790      const out = new Uint8Array(this.oHash.outputLen);
1791      this.digestInto(out);
1792      return out;
1793    }
1794    _cloneInto(to) {
1795      to || (to = Object.create(Object.getPrototypeOf(this), {}));
1796      const { oHash, iHash, finished, destroyed, blockLen, outputLen } = this;
1797      to = to;
1798      to.finished = finished;
1799      to.destroyed = destroyed;
1800      to.blockLen = blockLen;
1801      to.outputLen = outputLen;
1802      to.oHash = oHash._cloneInto(to.oHash);
1803      to.iHash = iHash._cloneInto(to.iHash);
1804      return to;
1805    }
1806    destroy() {
1807      this.destroyed = true;
1808      this.oHash.destroy();
1809      this.iHash.destroy();
1810    }
1811  };
1812  var hmac = (hash3, key, message) => new HMAC(hash3, key).update(message).digest();
1813  hmac.create = (hash3, key) => new HMAC(hash3, key);
1814
1815  
vendor: 398 bytes, lines 1815-1828
1815// node_modules/@noble/curves/esm/_shortw_utils.js
1816  function getHash(hash3) {
1817    return {
1818      hash: hash3,
1819      hmac: (key, ...msgs) => hmac(hash3, key, concatBytes(...msgs)),
1820      randomBytes
1821    };
1822  }
1823  function createCurve(curveDef, defHash) {
1824    const create = (hash3) => weierstrass({ ...curveDef, ...getHash(hash3) });
1825    return Object.freeze({ ...create(defHash), create });
1826  }
1827
1828  
vendor: 32,704 bytes, lines 1828-2881
1828// node_modules/@noble/curves/esm/secp256k1.js
1829  var secp256k1P = BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f");
1830  var secp256k1N = BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141");
1831  var _1n5 = BigInt(1);
1832  var _2n4 = BigInt(2);
1833  var divNearest = (a, b) => (a + b / _2n4) / b;
1834  function sqrtMod(y) {
1835    const P = secp256k1P;
1836    const _3n3 = BigInt(3), _6n = BigInt(6), _11n = BigInt(11), _22n = BigInt(22);
1837    const _23n = BigInt(23), _44n = BigInt(44), _88n = BigInt(88);
1838    const b2 = y * y * y % P;
1839    const b3 = b2 * b2 * y % P;
1840    const b6 = pow2(b3, _3n3, P) * b3 % P;
1841    const b9 = pow2(b6, _3n3, P) * b3 % P;
1842    const b11 = pow2(b9, _2n4, P) * b2 % P;
1843    const b22 = pow2(b11, _11n, P) * b11 % P;
1844    const b44 = pow2(b22, _22n, P) * b22 % P;
1845    const b88 = pow2(b44, _44n, P) * b44 % P;
1846    const b176 = pow2(b88, _88n, P) * b88 % P;
1847    const b220 = pow2(b176, _44n, P) * b44 % P;
1848    const b223 = pow2(b220, _3n3, P) * b3 % P;
1849    const t1 = pow2(b223, _23n, P) * b22 % P;
1850    const t2 = pow2(t1, _6n, P) * b2 % P;
1851    const root = pow2(t2, _2n4, P);
1852    if (!Fp.eql(Fp.sqr(root), y))
1853      throw new Error("Cannot find square root");
1854    return root;
1855  }
1856  var Fp = Field(secp256k1P, void 0, void 0, { sqrt: sqrtMod });
1857  var secp256k1 = createCurve({
1858    a: BigInt(0),
1859    b: BigInt(7),
1860    Fp,
1861    n: secp256k1N,
1862    Gx: BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),
1863    Gy: BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),
1864    h: BigInt(1),
1865    lowS: true,
1866    endo: {
1867      beta: BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),
1868      splitScalar: (k) => {
1869        const n = secp256k1N;
1870        const a1 = BigInt("0x3086d221a7d46bcde86c90e49284eb15");
1871        const b1 = -_1n5 * BigInt("0xe4437ed6010e88286f547fa90abfe4c3");
1872        const a2 = BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8");
1873        const b2 = a1;
1874        const POW_2_128 = BigInt("0x100000000000000000000000000000000");
1875        const c1 = divNearest(b2 * k, n);
1876        const c2 = divNearest(-b1 * k, n);
1877        let k1 = mod(k - c1 * a1 - c2 * a2, n);
1878        let k2 = mod(-c1 * b1 - c2 * b2, n);
1879        const k1neg = k1 > POW_2_128;
1880        const k2neg = k2 > POW_2_128;
1881        if (k1neg)
1882          k1 = n - k1;
1883        if (k2neg)
1884          k2 = n - k2;
1885        if (k1 > POW_2_128 || k2 > POW_2_128) {
1886          throw new Error("splitScalar: Endomorphism failed, k=" + k);
1887        }
1888        return { k1neg, k1, k2neg, k2 };
1889      }
1890    }
1891  }, sha256);
1892  var _0n5 = BigInt(0);
1893  var fe = (x) => typeof x === "bigint" && _0n5 < x && x < secp256k1P;
1894  var ge = (x) => typeof x === "bigint" && _0n5 < x && x < secp256k1N;
1895  var TAGGED_HASH_PREFIXES = {};
1896  function taggedHash(tag, ...messages) {
1897    let tagP = TAGGED_HASH_PREFIXES[tag];
1898    if (tagP === void 0) {
1899      const tagH = sha256(Uint8Array.from(tag, (c) => c.charCodeAt(0)));
1900      tagP = concatBytes2(tagH, tagH);
1901      TAGGED_HASH_PREFIXES[tag] = tagP;
1902    }
1903    return sha256(concatBytes2(tagP, ...messages));
1904  }
1905  var pointToBytes = (point) => point.toRawBytes(true).slice(1);
1906  var numTo32b = (n) => numberToBytesBE(n, 32);
1907  var modP = (x) => mod(x, secp256k1P);
1908  var modN = (x) => mod(x, secp256k1N);
1909  var Point = secp256k1.ProjectivePoint;
1910  var GmulAdd = (Q, a, b) => Point.BASE.multiplyAndAddUnsafe(Q, a, b);
1911  function schnorrGetExtPubKey(priv) {
1912    let d_ = secp256k1.utils.normPrivateKeyToScalar(priv);
1913    let p = Point.fromPrivateKey(d_);
1914    const scalar = p.hasEvenY() ? d_ : modN(-d_);
1915    return { scalar, bytes: pointToBytes(p) };
1916  }
1917  function lift_x(x) {
1918    if (!fe(x))
1919      throw new Error("bad x: need 0 < x < p");
1920    const xx = modP(x * x);
1921    const c = modP(xx * x + BigInt(7));
1922    let y = sqrtMod(c);
1923    if (y % _2n4 !== _0n5)
1924      y = modP(-y);
1925    const p = new Point(x, y, _1n5);
1926    p.assertValidity();
1927    return p;
1928  }
1929  function challenge(...args) {
1930    return modN(bytesToNumberBE(taggedHash("BIP0340/challenge", ...args)));
1931  }
1932  function schnorrGetPublicKey(privateKey) {
1933    return schnorrGetExtPubKey(privateKey).bytes;
1934  }
1935  function schnorrSign(message, privateKey, auxRand = randomBytes(32)) {
1936    const m = ensureBytes("message", message);
1937    const { bytes: px, scalar: d } = schnorrGetExtPubKey(privateKey);
1938    const a = ensureBytes("auxRand", auxRand, 32);
1939    const t = numTo32b(d ^ bytesToNumberBE(taggedHash("BIP0340/aux", a)));
1940    const rand = taggedHash("BIP0340/nonce", t, px, m);
1941    const k_ = modN(bytesToNumberBE(rand));
1942    if (k_ === _0n5)
1943      throw new Error("sign failed: k is zero");
1944    const { bytes: rx, scalar: k } = schnorrGetExtPubKey(k_);
1945    const e = challenge(rx, px, m);
1946    const sig = new Uint8Array(64);
1947    sig.set(rx, 0);
1948    sig.set(numTo32b(modN(k + e * d)), 32);
1949    if (!schnorrVerify(sig, m, px))
1950      throw new Error("sign: Invalid signature produced");
1951    return sig;
1952  }
1953  function schnorrVerify(signature, message, publicKey) {
1954    const sig = ensureBytes("signature", signature, 64);
1955    const m = ensureBytes("message", message);
1956    const pub = ensureBytes("publicKey", publicKey, 32);
1957    try {
1958      const P = lift_x(bytesToNumberBE(pub));
1959      const r = bytesToNumberBE(sig.subarray(0, 32));
1960      if (!fe(r))
1961        return false;
1962      const s = bytesToNumberBE(sig.subarray(32, 64));
1963      if (!ge(s))
1964        return false;
1965      const e = challenge(numTo32b(r), pointToBytes(P), m);
1966      const R = GmulAdd(P, s, modN(-e));
1967      if (!R || !R.hasEvenY() || R.toAffine().x !== r)
1968        return false;
1969      return true;
1970    } catch (error) {
1971      return false;
1972    }
1973  }
1974  var schnorr = /* @__PURE__ */ (() => ({
1975    getPublicKey: schnorrGetPublicKey,
1976    sign: schnorrSign,
1977    verify: schnorrVerify,
1978    utils: {
1979      randomPrivateKey: secp256k1.utils.randomPrivateKey,
1980      lift_x,
1981      pointToBytes,
1982      numberToBytesBE,
1983      bytesToNumberBE,
1984      taggedHash,
1985      mod
1986    }
1987  }))();
1988
1989  // keys.ts
1990  function generatePrivateKey() {
1991    return bytesToHex(schnorr.utils.randomPrivateKey());
1992  }
1993  function getPublicKey(privateKey) {
1994    return bytesToHex(schnorr.getPublicKey(privateKey));
1995  }
1996
1997  // utils.ts
1998  var utils_exports2 = {};
1999  __export(utils_exports2, {
2000    MessageNode: () => MessageNode,
2001    MessageQueue: () => MessageQueue,
2002    insertEventIntoAscendingList: () => insertEventIntoAscendingList,
2003    insertEventIntoDescendingList: () => insertEventIntoDescendingList,
2004    normalizeURL: () => normalizeURL,
2005    utf8Decoder: () => utf8Decoder,
2006    utf8Encoder: () => utf8Encoder
2007  });
2008  var utf8Decoder = new TextDecoder("utf-8");
2009  var utf8Encoder = new TextEncoder();
2010  function normalizeURL(url) {
2011    let p = new URL(url);
2012    p.pathname = p.pathname.replace(/\/+/g, "/");
2013    if (p.pathname.endsWith("/"))
2014      p.pathname = p.pathname.slice(0, -1);
2015    if (p.port === "80" && p.protocol === "ws:" || p.port === "443" && p.protocol === "wss:")
2016      p.port = "";
2017    p.searchParams.sort();
2018    p.hash = "";
2019    return p.toString();
2020  }
2021  function insertEventIntoDescendingList(sortedArray, event) {
2022    let start = 0;
2023    let end = sortedArray.length - 1;
2024    let midPoint;
2025    let position = start;
2026    if (end < 0) {
2027      position = 0;
2028    } else if (event.created_at < sortedArray[end].created_at) {
2029      position = end + 1;
2030    } else if (event.created_at >= sortedArray[start].created_at) {
2031      position = start;
2032    } else
2033      while (true) {
2034        if (end <= start + 1) {
2035          position = end;
2036          break;
2037        }
2038        midPoint = Math.floor(start + (end - start) / 2);
2039        if (sortedArray[midPoint].created_at > event.created_at) {
2040          start = midPoint;
2041        } else if (sortedArray[midPoint].created_at < event.created_at) {
2042          end = midPoint;
2043        } else {
2044          position = midPoint;
2045          break;
2046        }
2047      }
2048    if (sortedArray[position]?.id !== event.id) {
2049      return [...sortedArray.slice(0, position), event, ...sortedArray.slice(position)];
2050    }
2051    return sortedArray;
2052  }
2053  function insertEventIntoAscendingList(sortedArray, event) {
2054    let start = 0;
2055    let end = sortedArray.length - 1;
2056    let midPoint;
2057    let position = start;
2058    if (end < 0) {
2059      position = 0;
2060    } else if (event.created_at > sortedArray[end].created_at) {
2061      position = end + 1;
2062    } else if (event.created_at <= sortedArray[start].created_at) {
2063      position = start;
2064    } else
2065      while (true) {
2066        if (end <= start + 1) {
2067          position = end;
2068          break;
2069        }
2070        midPoint = Math.floor(start + (end - start) / 2);
2071        if (sortedArray[midPoint].created_at < event.created_at) {
2072          start = midPoint;
2073        } else if (sortedArray[midPoint].created_at > event.created_at) {
2074          end = midPoint;
2075        } else {
2076          position = midPoint;
2077          break;
2078        }
2079      }
2080    if (sortedArray[position]?.id !== event.id) {
2081      return [...sortedArray.slice(0, position), event, ...sortedArray.slice(position)];
2082    }
2083    return sortedArray;
2084  }
2085  var MessageNode = class {
2086    _value;
2087    _next;
2088    get value() {
2089      return this._value;
2090    }
2091    set value(message) {
2092      this._value = message;
2093    }
2094    get next() {
2095      return this._next;
2096    }
2097    set next(node) {
2098      this._next = node;
2099    }
2100    constructor(message) {
2101      this._value = message;
2102      this._next = null;
2103    }
2104  };
2105  var MessageQueue = class {
2106    _first;
2107    _last;
2108    get first() {
2109      return this._first;
2110    }
2111    set first(messageNode) {
2112      this._first = messageNode;
2113    }
2114    get last() {
2115      return this._last;
2116    }
2117    set last(messageNode) {
2118      this._last = messageNode;
2119    }
2120    _size;
2121    get size() {
2122      return this._size;
2123    }
2124    set size(v) {
2125      this._size = v;
2126    }
2127    constructor() {
2128      this._first = null;
2129      this._last = null;
2130      this._size = 0;
2131    }
2132    enqueue(message) {
2133      const newNode = new MessageNode(message);
2134      if (this._size === 0 || !this._last) {
2135        this._first = newNode;
2136        this._last = newNode;
2137      } else {
2138        this._last.next = newNode;
2139        this._last = newNode;
2140      }
2141      this._size++;
2142      return true;
2143    }
2144    dequeue() {
2145      if (this._size === 0 || !this._first)
2146        return null;
2147      let prev = this._first;
2148      this._first = prev.next;
2149      prev.next = null;
2150      this._size--;
2151      return prev.value;
2152    }
2153  };
2154
2155  // event.ts
2156  var verifiedSymbol = Symbol("verified");
2157  var Kind = /* @__PURE__ */ ((Kind3) => {
2158    Kind3[Kind3["Metadata"] = 0] = "Metadata";
2159    Kind3[Kind3["Text"] = 1] = "Text";
2160    Kind3[Kind3["RecommendRelay"] = 2] = "RecommendRelay";
2161    Kind3[Kind3["Contacts"] = 3] = "Contacts";
2162    Kind3[Kind3["EncryptedDirectMessage"] = 4] = "EncryptedDirectMessage";
2163    Kind3[Kind3["EventDeletion"] = 5] = "EventDeletion";
2164    Kind3[Kind3["Repost"] = 6] = "Repost";
2165    Kind3[Kind3["Reaction"] = 7] = "Reaction";
2166    Kind3[Kind3["BadgeAward"] = 8] = "BadgeAward";
2167    Kind3[Kind3["ChannelCreation"] = 40] = "ChannelCreation";
2168    Kind3[Kind3["ChannelMetadata"] = 41] = "ChannelMetadata";
2169    Kind3[Kind3["ChannelMessage"] = 42] = "ChannelMessage";
2170    Kind3[Kind3["ChannelHideMessage"] = 43] = "ChannelHideMessage";
2171    Kind3[Kind3["ChannelMuteUser"] = 44] = "ChannelMuteUser";
2172    Kind3[Kind3["Blank"] = 255] = "Blank";
2173    Kind3[Kind3["Report"] = 1984] = "Report";
2174    Kind3[Kind3["ZapRequest"] = 9734] = "ZapRequest";
2175    Kind3[Kind3["Zap"] = 9735] = "Zap";
2176    Kind3[Kind3["RelayList"] = 10002] = "RelayList";
2177    Kind3[Kind3["ClientAuth"] = 22242] = "ClientAuth";
2178    Kind3[Kind3["NwcRequest"] = 23194] = "NwcRequest";
2179    Kind3[Kind3["HttpAuth"] = 27235] = "HttpAuth";
2180    Kind3[Kind3["ProfileBadge"] = 30008] = "ProfileBadge";
2181    Kind3[Kind3["BadgeDefinition"] = 30009] = "BadgeDefinition";
2182    Kind3[Kind3["Article"] = 30023] = "Article";
2183    Kind3[Kind3["FileMetadata"] = 1063] = "FileMetadata";
2184    return Kind3;
2185  })(Kind || {});
2186  function getBlankEvent(kind = 255 /* Blank */) {
2187    return {
2188      kind,
2189      content: "",
2190      tags: [],
2191      created_at: 0
2192    };
2193  }
2194  function finishEvent(t, privateKey) {
2195    const event = t;
2196    event.pubkey = getPublicKey(privateKey);
2197    event.id = getEventHash(event);
2198    event.sig = getSignature(event, privateKey);
2199    event[verifiedSymbol] = true;
2200    return event;
2201  }
2202  function serializeEvent(evt) {
2203    if (!validateEvent(evt))
2204      throw new Error("can't serialize event with wrong or missing properties");
2205    return JSON.stringify([0, evt.pubkey, evt.created_at, evt.kind, evt.tags, evt.content]);
2206  }
2207  function getEventHash(event) {
2208    let eventHash = sha256(utf8Encoder.encode(serializeEvent(event)));
2209    return bytesToHex(eventHash);
2210  }
2211  var isRecord = (obj) => obj instanceof Object;
2212  function validateEvent(event) {
2213    if (!isRecord(event))
2214      return false;
2215    if (typeof event.kind !== "number")
2216      return false;
2217    if (typeof event.content !== "string")
2218      return false;
2219    if (typeof event.created_at !== "number")
2220      return false;
2221    if (typeof event.pubkey !== "string")
2222      return false;
2223    if (!event.pubkey.match(/^[a-f0-9]{64}$/))
2224      return false;
2225    if (!Array.isArray(event.tags))
2226      return false;
2227    for (let i = 0; i < event.tags.length; i++) {
2228      let tag = event.tags[i];
2229      if (!Array.isArray(tag))
2230        return false;
2231      for (let j = 0; j < tag.length; j++) {
2232        if (typeof tag[j] === "object")
2233          return false;
2234      }
2235    }
2236    return true;
2237  }
2238  function verifySignature(event) {
2239    if (typeof event[verifiedSymbol] === "boolean")
2240      return event[verifiedSymbol];
2241    const hash3 = getEventHash(event);
2242    if (hash3 !== event.id) {
2243      return event[verifiedSymbol] = false;
2244    }
2245    try {
2246      return event[verifiedSymbol] = schnorr.verify(event.sig, hash3, event.pubkey);
2247    } catch (err) {
2248      return event[verifiedSymbol] = false;
2249    }
2250  }
2251  function signEvent(event, key) {
2252    console.warn(
2253      "nostr-tools: `signEvent` is deprecated and will be removed or changed in the future. Please use `getSignature` instead."
2254    );
2255    return getSignature(event, key);
2256  }
2257  function getSignature(event, key) {
2258    return bytesToHex(schnorr.sign(getEventHash(event), key));
2259  }
2260
2261  // filter.ts
2262  function matchFilter(filter, event) {
2263    if (filter.ids && filter.ids.indexOf(event.id) === -1) {
2264      if (!filter.ids.some((prefix) => event.id.startsWith(prefix))) {
2265        return false;
2266      }
2267    }
2268    if (filter.kinds && filter.kinds.indexOf(event.kind) === -1)
2269      return false;
2270    if (filter.authors && filter.authors.indexOf(event.pubkey) === -1) {
2271      if (!filter.authors.some((prefix) => event.pubkey.startsWith(prefix))) {
2272        return false;
2273      }
2274    }
2275    for (let f2 in filter) {
2276      if (f2[0] === "#") {
2277        let tagName = f2.slice(1);
2278        let values = filter[`#${tagName}`];
2279        if (values && !event.tags.find(([t, v]) => t === f2.slice(1) && values.indexOf(v) !== -1))
2280          return false;
2281      }
2282    }
2283    if (filter.since && event.created_at < filter.since)
2284      return false;
2285    if (filter.until && event.created_at > filter.until)
2286      return false;
2287    return true;
2288  }
2289  function matchFilters(filters, event) {
2290    for (let i = 0; i < filters.length; i++) {
2291      if (matchFilter(filters[i], event))
2292        return true;
2293    }
2294    return false;
2295  }
2296  function mergeFilters(...filters) {
2297    let result = {};
2298    for (let i = 0; i < filters.length; i++) {
2299      let filter = filters[i];
2300      Object.entries(filter).forEach(([property, values]) => {
2301        if (property === "kinds" || property === "ids" || property === "authors" || property[0] === "#") {
2302          result[property] = result[property] || [];
2303          for (let v = 0; v < values.length; v++) {
2304            let value = values[v];
2305            if (!result[property].includes(value))
2306              result[property].push(value);
2307          }
2308        }
2309      });
2310      if (filter.limit && (!result.limit || filter.limit > result.limit))
2311        result.limit = filter.limit;
2312      if (filter.until && (!result.until || filter.until > result.until))
2313        result.until = filter.until;
2314      if (filter.since && (!result.since || filter.since < result.since))
2315        result.since = filter.since;
2316    }
2317    return result;
2318  }
2319
2320  // fakejson.ts
2321  var fakejson_exports = {};
2322  __export(fakejson_exports, {
2323    getHex64: () => getHex64,
2324    getInt: () => getInt,
2325    getSubscriptionId: () => getSubscriptionId,
2326    matchEventId: () => matchEventId,
2327    matchEventKind: () => matchEventKind,
2328    matchEventPubkey: () => matchEventPubkey
2329  });
2330  function getHex64(json, field) {
2331    let len = field.length + 3;
2332    let idx = json.indexOf(`"${field}":`) + len;
2333    let s = json.slice(idx).indexOf(`"`) + idx + 1;
2334    return json.slice(s, s + 64);
2335  }
2336  function getInt(json, field) {
2337    let len = field.length;
2338    let idx = json.indexOf(`"${field}":`) + len + 3;
2339    let sliced = json.slice(idx);
2340    let end = Math.min(sliced.indexOf(","), sliced.indexOf("}"));
2341    return parseInt(sliced.slice(0, end), 10);
2342  }
2343  function getSubscriptionId(json) {
2344    let idx = json.slice(0, 22).indexOf(`"EVENT"`);
2345    if (idx === -1)
2346      return null;
2347    let pstart = json.slice(idx + 7 + 1).indexOf(`"`);
2348    if (pstart === -1)
2349      return null;
2350    let start = idx + 7 + 1 + pstart;
2351    let pend = json.slice(start + 1, 80).indexOf(`"`);
2352    if (pend === -1)
2353      return null;
2354    let end = start + 1 + pend;
2355    return json.slice(start + 1, end);
2356  }
2357  function matchEventId(json, id) {
2358    return id === getHex64(json, "id");
2359  }
2360  function matchEventPubkey(json, pubkey) {
2361    return pubkey === getHex64(json, "pubkey");
2362  }
2363  function matchEventKind(json, kind) {
2364    return kind === getInt(json, "kind");
2365  }
2366
2367  // relay.ts
2368  var newListeners = () => ({
2369    connect: [],
2370    disconnect: [],
2371    error: [],
2372    notice: [],
2373    auth: []
2374  });
2375  function relayInit(url, options = {}) {
2376    let { listTimeout = 3e3, getTimeout = 3e3, countTimeout = 3e3 } = options;
2377    var ws;
2378    var openSubs = {};
2379    var listeners = newListeners();
2380    var subListeners = {};
2381    var pubListeners = {};
2382    var connectionPromise;
2383    async function connectRelay() {
2384      if (connectionPromise)
2385        return connectionPromise;
2386      connectionPromise = new Promise((resolve, reject) => {
2387        try {
2388          ws = new WebSocket(url);
2389        } catch (err) {
2390          reject(err);
2391        }
2392        ws.onopen = () => {
2393          listeners.connect.forEach((cb) => cb());
2394          resolve();
2395        };
2396        ws.onerror = () => {
2397          connectionPromise = void 0;
2398          listeners.error.forEach((cb) => cb());
2399          reject();
2400        };
2401        ws.onclose = async () => {
2402          connectionPromise = void 0;
2403          listeners.disconnect.forEach((cb) => cb());
2404        };
2405        let incomingMessageQueue = new MessageQueue();
2406        let handleNextInterval;
2407        ws.onmessage = (e) => {
2408          incomingMessageQueue.enqueue(e.data);
2409          if (!handleNextInterval) {
2410            handleNextInterval = setInterval(handleNext, 0);
2411          }
2412        };
2413        function handleNext() {
2414          if (incomingMessageQueue.size === 0) {
2415            clearInterval(handleNextInterval);
2416            handleNextInterval = null;
2417            return;
2418          }
2419          var json = incomingMessageQueue.dequeue();
2420          if (!json)
2421            return;
2422          let subid = getSubscriptionId(json);
2423          if (subid) {
2424            let so = openSubs[subid];
2425            if (so && so.alreadyHaveEvent && so.alreadyHaveEvent(getHex64(json, "id"), url)) {
2426              return;
2427            }
2428          }
2429          try {
2430            let data = JSON.parse(json);
2431            switch (data[0]) {
2432              case "EVENT": {
2433                let id2 = data[1];
2434                let event = data[2];
2435                if (validateEvent(event) && openSubs[id2] && (openSubs[id2].skipVerification || verifySignature(event)) && matchFilters(openSubs[id2].filters, event)) {
2436                  openSubs[id2];
2437                  (subListeners[id2]?.event || []).forEach((cb) => cb(event));
2438                }
2439                return;
2440              }
2441              case "COUNT":
2442                let id = data[1];
2443                let payload = data[2];
2444                if (openSubs[id]) {
2445                  ;
2446                  (subListeners[id]?.count || []).forEach((cb) => cb(payload));
2447                }
2448                return;
2449              case "EOSE": {
2450                let id2 = data[1];
2451                if (id2 in subListeners) {
2452                  subListeners[id2].eose.forEach((cb) => cb());
2453                  subListeners[id2].eose = [];
2454                }
2455                return;
2456              }
2457              case "OK": {
2458                let id2 = data[1];
2459                let ok = data[2];
2460                let reason = data[3] || "";
2461                if (id2 in pubListeners) {
2462                  let { resolve: resolve2, reject: reject2 } = pubListeners[id2];
2463                  if (ok)
2464                    resolve2(null);
2465                  else
2466                    reject2(new Error(reason));
2467                }
2468                return;
2469              }
2470              case "NOTICE":
2471                let notice = data[1];
2472                listeners.notice.forEach((cb) => cb(notice));
2473                return;
2474              case "AUTH": {
2475                let challenge2 = data[1];
2476                listeners.auth?.forEach((cb) => cb(challenge2));
2477                return;
2478              }
2479            }
2480          } catch (err) {
2481            return;
2482          }
2483        }
2484      });
2485      return connectionPromise;
2486    }
2487    function connected() {
2488      return ws?.readyState === 1;
2489    }
2490    async function connect() {
2491      if (connected())
2492        return;
2493      await connectRelay();
2494    }
2495    async function trySend(params) {
2496      let msg = JSON.stringify(params);
2497      if (!connected()) {
2498        await new Promise((resolve) => setTimeout(resolve, 1e3));
2499        if (!connected()) {
2500          return;
2501        }
2502      }
2503      try {
2504        ws.send(msg);
2505      } catch (err) {
2506        console.log(err);
2507      }
2508    }
2509    const sub = (filters, {
2510      verb = "REQ",
2511      skipVerification = false,
2512      alreadyHaveEvent = null,
2513      id = Math.random().toString().slice(2)
2514    } = {}) => {
2515      let subid = id;
2516      openSubs[subid] = {
2517        id: subid,
2518        filters,
2519        skipVerification,
2520        alreadyHaveEvent
2521      };
2522      trySend([verb, subid, ...filters]);
2523      let subscription = {
2524        sub: (newFilters, newOpts = {}) => sub(newFilters || filters, {
2525          skipVerification: newOpts.skipVerification || skipVerification,
2526          alreadyHaveEvent: newOpts.alreadyHaveEvent || alreadyHaveEvent,
2527          id: subid
2528        }),
2529        unsub: () => {
2530          delete openSubs[subid];
2531          delete subListeners[subid];
2532          trySend(["CLOSE", subid]);
2533        },
2534        on: (type, cb) => {
2535          subListeners[subid] = subListeners[subid] || {
2536            event: [],
2537            count: [],
2538            eose: []
2539          };
2540          subListeners[subid][type].push(cb);
2541        },
2542        off: (type, cb) => {
2543          let listeners2 = subListeners[subid];
2544          let idx = listeners2[type].indexOf(cb);
2545          if (idx >= 0)
2546            listeners2[type].splice(idx, 1);
2547        },
2548        get events() {
2549          return eventsGenerator(subscription);
2550        }
2551      };
2552      return subscription;
2553    };
2554    function _publishEvent(event, type) {
2555      return new Promise((resolve, reject) => {
2556        if (!event.id) {
2557          reject(new Error(`event ${event} has no id`));
2558          return;
2559        }
2560        let id = event.id;
2561        trySend([type, event]);
2562        pubListeners[id] = { resolve, reject };
2563      });
2564    }
2565    return {
2566      url,
2567      sub,
2568      on: (type, cb) => {
2569        listeners[type].push(cb);
2570        if (type === "connect" && ws?.readyState === 1) {
2571          ;
2572          cb();
2573        }
2574      },
2575      off: (type, cb) => {
2576        let index = listeners[type].indexOf(cb);
2577        if (index !== -1)
2578          listeners[type].splice(index, 1);
2579      },
2580      list: (filters, opts) => new Promise((resolve) => {
2581        let s = sub(filters, opts);
2582        let events = [];
2583        let timeout = setTimeout(() => {
2584          s.unsub();
2585          resolve(events);
2586        }, listTimeout);
2587        s.on("eose", () => {
2588          s.unsub();
2589          clearTimeout(timeout);
2590          resolve(events);
2591        });
2592        s.on("event", (event) => {
2593          events.push(event);
2594        });
2595      }),
2596      get: (filter, opts) => new Promise((resolve) => {
2597        let s = sub([filter], opts);
2598        let timeout = setTimeout(() => {
2599          s.unsub();
2600          resolve(null);
2601        }, getTimeout);
2602        s.on("event", (event) => {
2603          s.unsub();
2604          clearTimeout(timeout);
2605          resolve(event);
2606        });
2607      }),
2608      count: (filters) => new Promise((resolve) => {
2609        let s = sub(filters, { ...sub, verb: "COUNT" });
2610        let timeout = setTimeout(() => {
2611          s.unsub();
2612          resolve(null);
2613        }, countTimeout);
2614        s.on("count", (event) => {
2615          s.unsub();
2616          clearTimeout(timeout);
2617          resolve(event);
2618        });
2619      }),
2620      async publish(event) {
2621        await _publishEvent(event, "EVENT");
2622      },
2623      async auth(event) {
2624        await _publishEvent(event, "AUTH");
2625      },
2626      connect,
2627      close() {
2628        listeners = newListeners();
2629        subListeners = {};
2630        pubListeners = {};
2631        if (ws?.readyState === WebSocket.OPEN) {
2632          ws.close();
2633        }
2634      },
2635      get status() {
2636        return ws?.readyState ?? 3;
2637      }
2638    };
2639  }
2640  async function* eventsGenerator(sub) {
2641    let nextResolve;
2642    const eventQueue = [];
2643    const pushToQueue = (event) => {
2644      if (nextResolve) {
2645        nextResolve(event);
2646        nextResolve = void 0;
2647      } else {
2648        eventQueue.push(event);
2649      }
2650    };
2651    sub.on("event", pushToQueue);
2652    try {
2653      while (true) {
2654        if (eventQueue.length > 0) {
2655          yield eventQueue.shift();
2656        } else {
2657          const event = await new Promise((resolve) => {
2658            nextResolve = resolve;
2659          });
2660          yield event;
2661        }
2662      }
2663    } finally {
2664      sub.off("event", pushToQueue);
2665    }
2666  }
2667
2668  // pool.ts
2669  var SimplePool = class {
2670    _conn;
2671    _seenOn = {};
2672    batchedByKey = {};
2673    eoseSubTimeout;
2674    getTimeout;
2675    seenOnEnabled = true;
2676    batchInterval = 100;
2677    constructor(options = {}) {
2678      this._conn = {};
2679      this.eoseSubTimeout = options.eoseSubTimeout || 3400;
2680      this.getTimeout = options.getTimeout || 3400;
2681      this.seenOnEnabled = options.seenOnEnabled !== false;
2682      this.batchInterval = options.batchInterval || 100;
2683    }
2684    close(relays) {
2685      relays.forEach((url) => {
2686        let relay = this._conn[normalizeURL(url)];
2687        if (relay)
2688          relay.close();
2689      });
2690    }
2691    async ensureRelay(url) {
2692      const nm = normalizeURL(url);
2693      if (!this._conn[nm]) {
2694        this._conn[nm] = relayInit(nm, {
2695          getTimeout: this.getTimeout * 0.9,
2696          listTimeout: this.getTimeout * 0.9
2697        });
2698      }
2699      const relay = this._conn[nm];
2700      await relay.connect();
2701      return relay;
2702    }
2703    sub(relays, filters, opts) {
2704      let _knownIds = /* @__PURE__ */ new Set();
2705      let modifiedOpts = { ...opts || {} };
2706      modifiedOpts.alreadyHaveEvent = (id, url) => {
2707        if (opts?.alreadyHaveEvent?.(id, url)) {
2708          return true;
2709        }
2710        if (this.seenOnEnabled) {
2711          let set = this._seenOn[id] || /* @__PURE__ */ new Set();
2712          set.add(url);
2713          this._seenOn[id] = set;
2714        }
2715        return _knownIds.has(id);
2716      };
2717      let subs = [];
2718      let eventListeners = /* @__PURE__ */ new Set();
2719      let eoseListeners = /* @__PURE__ */ new Set();
2720      let eosesMissing = relays.length;
2721      let eoseSent = false;
2722      let eoseTimeout = setTimeout(
2723        () => {
2724          eoseSent = true;
2725          for (let cb of eoseListeners.values())
2726            cb();
2727        },
2728        opts?.eoseSubTimeout || this.eoseSubTimeout
2729      );
2730      relays.filter((r, i, a) => a.indexOf(r) === i).forEach(async (relay) => {
2731        let r;
2732        try {
2733          r = await this.ensureRelay(relay);
2734        } catch (err) {
2735          handleEose();
2736          return;
2737        }
2738        if (!r)
2739          return;
2740        let s = r.sub(filters, modifiedOpts);
2741        s.on("event", (event) => {
2742          _knownIds.add(event.id);
2743          for (let cb of eventListeners.values())
2744            cb(event);
2745        });
2746        s.on("eose", () => {
2747          if (eoseSent)
2748            return;
2749          handleEose();
2750        });
2751        subs.push(s);
2752        function handleEose() {
2753          eosesMissing--;
2754          if (eosesMissing === 0) {
2755            clearTimeout(eoseTimeout);
2756            for (let cb of eoseListeners.values())
2757              cb();
2758          }
2759        }
2760      });
2761      let greaterSub = {
2762        sub(filters2, opts2) {
2763          subs.forEach((sub) => sub.sub(filters2, opts2));
2764          return greaterSub;
2765        },
2766        unsub() {
2767          subs.forEach((sub) => sub.unsub());
2768        },
2769        on(type, cb) {
2770          if (type === "event") {
2771            eventListeners.add(cb);
2772          } else if (type === "eose") {
2773            eoseListeners.add(cb);
2774          }
2775        },
2776        off(type, cb) {
2777          if (type === "event") {
2778            eventListeners.delete(cb);
2779          } else if (type === "eose")
2780            eoseListeners.delete(cb);
2781        },
2782        get events() {
2783          return eventsGenerator(greaterSub);
2784        }
2785      };
2786      return greaterSub;
2787    }
2788    get(relays, filter, opts) {
2789      return new Promise((resolve) => {
2790        let sub = this.sub(relays, [filter], opts);
2791        let timeout = setTimeout(() => {
2792          sub.unsub();
2793          resolve(null);
2794        }, this.getTimeout);
2795        sub.on("event", (event) => {
2796          resolve(event);
2797          clearTimeout(timeout);
2798          sub.unsub();
2799        });
2800      });
2801    }
2802    list(relays, filters, opts) {
2803      return new Promise((resolve) => {
2804        let events = [];
2805        let sub = this.sub(relays, filters, opts);
2806        sub.on("event", (event) => {
2807          events.push(event);
2808        });
2809        sub.on("eose", () => {
2810          sub.unsub();
2811          resolve(events);
2812        });
2813      });
2814    }
2815    batchedList(batchKey, relays, filters) {
2816      return new Promise((resolve) => {
2817        if (!this.batchedByKey[batchKey]) {
2818          this.batchedByKey[batchKey] = [
2819            {
2820              filters,
2821              relays,
2822              resolve,
2823              events: []
2824            }
2825          ];
2826          setTimeout(() => {
2827            Object.keys(this.batchedByKey).forEach(async (batchKey2) => {
2828              const batchedRequests = this.batchedByKey[batchKey2];
2829              const filters2 = [];
2830              const relays2 = [];
2831              batchedRequests.forEach((br) => {
2832                filters2.push(...br.filters);
2833                relays2.push(...br.relays);
2834              });
2835              const sub = this.sub(relays2, [mergeFilters(...filters2)]);
2836              sub.on("event", (event) => {
2837                batchedRequests.forEach((br) => matchFilters(br.filters, event) && br.events.push(event));
2838              });
2839              sub.on("eose", () => {
2840                sub.unsub();
2841                batchedRequests.forEach((br) => br.resolve(br.events));
2842              });
2843              delete this.batchedByKey[batchKey2];
2844            });
2845          }, this.batchInterval);
2846        } else {
2847          this.batchedByKey[batchKey].push({
2848            filters,
2849            relays,
2850            resolve,
2851            events: []
2852          });
2853        }
2854      });
2855    }
2856    publish(relays, event) {
2857      return relays.map(async (relay) => {
2858        let r = await this.ensureRelay(relay);
2859        return r.publish(event);
2860      });
2861    }
2862    seenOn(id) {
2863      return Array.from(this._seenOn[id]?.values?.() || []);
2864    }
2865  };
2866
2867  // nip19.ts
2868  var nip19_exports = {};
2869  __export(nip19_exports, {
2870    BECH32_REGEX: () => BECH32_REGEX,
2871    decode: () => decode,
2872    naddrEncode: () => naddrEncode,
2873    neventEncode: () => neventEncode,
2874    noteEncode: () => noteEncode,
2875    nprofileEncode: () => nprofileEncode,
2876    npubEncode: () => npubEncode,
2877    nrelayEncode: () => nrelayEncode,
2878    nsecEncode: () => nsecEncode
2879  });
2880
2881  
vendor: 26,692 bytes, lines 2881-3627
2881// node_modules/@scure/base/lib/esm/index.js
2882  function assertNumber(n) {
2883    if (!Number.isSafeInteger(n))
2884      throw new Error(`Wrong integer: ${n}`);
2885  }
2886  function chain(...args) {
2887    const wrap = (a, b) => (c) => a(b(c));
2888    const encode = Array.from(args).reverse().reduce((acc, i) => acc ? wrap(acc, i.encode) : i.encode, void 0);
2889    const decode2 = args.reduce((acc, i) => acc ? wrap(acc, i.decode) : i.decode, void 0);
2890    return { encode, decode: decode2 };
2891  }
2892  function alphabet(alphabet2) {
2893    return {
2894      encode: (digits) => {
2895        if (!Array.isArray(digits) || digits.length && typeof digits[0] !== "number")
2896          throw new Error("alphabet.encode input should be an array of numbers");
2897        return digits.map((i) => {
2898          assertNumber(i);
2899          if (i < 0 || i >= alphabet2.length)
2900            throw new Error(`Digit index outside alphabet: ${i} (alphabet: ${alphabet2.length})`);
2901          return alphabet2[i];
2902        });
2903      },
2904      decode: (input) => {
2905        if (!Array.isArray(input) || input.length && typeof input[0] !== "string")
2906          throw new Error("alphabet.decode input should be array of strings");
2907        return input.map((letter) => {
2908          if (typeof letter !== "string")
2909            throw new Error(`alphabet.decode: not string element=${letter}`);
2910          const index = alphabet2.indexOf(letter);
2911          if (index === -1)
2912            throw new Error(`Unknown letter: "${letter}". Allowed: ${alphabet2}`);
2913          return index;
2914        });
2915      }
2916    };
2917  }
2918  function join(separator = "") {
2919    if (typeof separator !== "string")
2920      throw new Error("join separator should be string");
2921    return {
2922      encode: (from) => {
2923        if (!Array.isArray(from) || from.length && typeof from[0] !== "string")
2924          throw new Error("join.encode input should be array of strings");
2925        for (let i of from)
2926          if (typeof i !== "string")
2927            throw new Error(`join.encode: non-string input=${i}`);
2928        return from.join(separator);
2929      },
2930      decode: (to) => {
2931        if (typeof to !== "string")
2932          throw new Error("join.decode input should be string");
2933        return to.split(separator);
2934      }
2935    };
2936  }
2937  function padding(bits, chr = "=") {
2938    assertNumber(bits);
2939    if (typeof chr !== "string")
2940      throw new Error("padding chr should be string");
2941    return {
2942      encode(data) {
2943        if (!Array.isArray(data) || data.length && typeof data[0] !== "string")
2944          throw new Error("padding.encode input should be array of strings");
2945        for (let i of data)
2946          if (typeof i !== "string")
2947            throw new Error(`padding.encode: non-string input=${i}`);
2948        while (data.length * bits % 8)
2949          data.push(chr);
2950        return data;
2951      },
2952      decode(input) {
2953        if (!Array.isArray(input) || input.length && typeof input[0] !== "string")
2954          throw new Error("padding.encode input should be array of strings");
2955        for (let i of input)
2956          if (typeof i !== "string")
2957            throw new Error(`padding.decode: non-string input=${i}`);
2958        let end = input.length;
2959        if (end * bits % 8)
2960          throw new Error("Invalid padding: string should have whole number of bytes");
2961        for (; end > 0 && input[end - 1] === chr; end--) {
2962          if (!((end - 1) * bits % 8))
2963            throw new Error("Invalid padding: string has too much padding");
2964        }
2965        return input.slice(0, end);
2966      }
2967    };
2968  }
2969  function normalize(fn) {
2970    if (typeof fn !== "function")
2971      throw new Error("normalize fn should be function");
2972    return { encode: (from) => from, decode: (to) => fn(to) };
2973  }
2974  function convertRadix(data, from, to) {
2975    if (from < 2)
2976      throw new Error(`convertRadix: wrong from=${from}, base cannot be less than 2`);
2977    if (to < 2)
2978      throw new Error(`convertRadix: wrong to=${to}, base cannot be less than 2`);
2979    if (!Array.isArray(data))
2980      throw new Error("convertRadix: data should be array");
2981    if (!data.length)
2982      return [];
2983    let pos = 0;
2984    const res = [];
2985    const digits = Array.from(data);
2986    digits.forEach((d) => {
2987      assertNumber(d);
2988      if (d < 0 || d >= from)
2989        throw new Error(`Wrong integer: ${d}`);
2990    });
2991    while (true) {
2992      let carry = 0;
2993      let done = true;
2994      for (let i = pos; i < digits.length; i++) {
2995        const digit = digits[i];
2996        const digitBase = from * carry + digit;
2997        if (!Number.isSafeInteger(digitBase) || from * carry / from !== carry || digitBase - digit !== from * carry) {
2998          throw new Error("convertRadix: carry overflow");
2999        }
3000        carry = digitBase % to;
3001        digits[i] = Math.floor(digitBase / to);
3002        if (!Number.isSafeInteger(digits[i]) || digits[i] * to + carry !== digitBase)
3003          throw new Error("convertRadix: carry overflow");
3004        if (!done)
3005          continue;
3006        else if (!digits[i])
3007          pos = i;
3008        else
3009          done = false;
3010      }
3011      res.push(carry);
3012      if (done)
3013        break;
3014    }
3015    for (let i = 0; i < data.length - 1 && data[i] === 0; i++)
3016      res.push(0);
3017    return res.reverse();
3018  }
3019  var gcd = (a, b) => !b ? a : gcd(b, a % b);
3020  var radix2carry = (from, to) => from + (to - gcd(from, to));
3021  function convertRadix2(data, from, to, padding2) {
3022    if (!Array.isArray(data))
3023      throw new Error("convertRadix2: data should be array");
3024    if (from <= 0 || from > 32)
3025      throw new Error(`convertRadix2: wrong from=${from}`);
3026    if (to <= 0 || to > 32)
3027      throw new Error(`convertRadix2: wrong to=${to}`);
3028    if (radix2carry(from, to) > 32) {
3029      throw new Error(`convertRadix2: carry overflow from=${from} to=${to} carryBits=${radix2carry(from, to)}`);
3030    }
3031    let carry = 0;
3032    let pos = 0;
3033    const mask = 2 ** to - 1;
3034    const res = [];
3035    for (const n of data) {
3036      assertNumber(n);
3037      if (n >= 2 ** from)
3038        throw new Error(`convertRadix2: invalid data word=${n} from=${from}`);
3039      carry = carry << from | n;
3040      if (pos + from > 32)
3041        throw new Error(`convertRadix2: carry overflow pos=${pos} from=${from}`);
3042      pos += from;
3043      for (; pos >= to; pos -= to)
3044        res.push((carry >> pos - to & mask) >>> 0);
3045      carry &= 2 ** pos - 1;
3046    }
3047    carry = carry << to - pos & mask;
3048    if (!padding2 && pos >= from)
3049      throw new Error("Excess padding");
3050    if (!padding2 && carry)
3051      throw new Error(`Non-zero padding: ${carry}`);
3052    if (padding2 && pos > 0)
3053      res.push(carry >>> 0);
3054    return res;
3055  }
3056  function radix(num) {
3057    assertNumber(num);
3058    return {
3059      encode: (bytes3) => {
3060        if (!(bytes3 instanceof Uint8Array))
3061          throw new Error("radix.encode input should be Uint8Array");
3062        return convertRadix(Array.from(bytes3), 2 ** 8, num);
3063      },
3064      decode: (digits) => {
3065        if (!Array.isArray(digits) || digits.length && typeof digits[0] !== "number")
3066          throw new Error("radix.decode input should be array of strings");
3067        return Uint8Array.from(convertRadix(digits, num, 2 ** 8));
3068      }
3069    };
3070  }
3071  function radix2(bits, revPadding = false) {
3072    assertNumber(bits);
3073    if (bits <= 0 || bits > 32)
3074      throw new Error("radix2: bits should be in (0..32]");
3075    if (radix2carry(8, bits) > 32 || radix2carry(bits, 8) > 32)
3076      throw new Error("radix2: carry overflow");
3077    return {
3078      encode: (bytes3) => {
3079        if (!(bytes3 instanceof Uint8Array))
3080          throw new Error("radix2.encode input should be Uint8Array");
3081        return convertRadix2(Array.from(bytes3), 8, bits, !revPadding);
3082      },
3083      decode: (digits) => {
3084        if (!Array.isArray(digits) || digits.length && typeof digits[0] !== "number")
3085          throw new Error("radix2.decode input should be array of strings");
3086        return Uint8Array.from(convertRadix2(digits, bits, 8, revPadding));
3087      }
3088    };
3089  }
3090  function unsafeWrapper(fn) {
3091    if (typeof fn !== "function")
3092      throw new Error("unsafeWrapper fn should be function");
3093    return function(...args) {
3094      try {
3095        return fn.apply(null, args);
3096      } catch (e) {
3097      }
3098    };
3099  }
3100  function checksum(len, fn) {
3101    assertNumber(len);
3102    if (typeof fn !== "function")
3103      throw new Error("checksum fn should be function");
3104    return {
3105      encode(data) {
3106        if (!(data instanceof Uint8Array))
3107          throw new Error("checksum.encode: input should be Uint8Array");
3108        const checksum2 = fn(data).slice(0, len);
3109        const res = new Uint8Array(data.length + len);
3110        res.set(data);
3111        res.set(checksum2, data.length);
3112        return res;
3113      },
3114      decode(data) {
3115        if (!(data instanceof Uint8Array))
3116          throw new Error("checksum.decode: input should be Uint8Array");
3117        const payload = data.slice(0, -len);
3118        const newChecksum = fn(payload).slice(0, len);
3119        const oldChecksum = data.slice(-len);
3120        for (let i = 0; i < len; i++)
3121          if (newChecksum[i] !== oldChecksum[i])
3122            throw new Error("Invalid checksum");
3123        return payload;
3124      }
3125    };
3126  }
3127  var utils = { alphabet, chain, checksum, radix, radix2, join, padding };
3128  var base16 = chain(radix2(4), alphabet("0123456789ABCDEF"), join(""));
3129  var base32 = chain(radix2(5), alphabet("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"), padding(5), join(""));
3130  var base32hex = chain(radix2(5), alphabet("0123456789ABCDEFGHIJKLMNOPQRSTUV"), padding(5), join(""));
3131  var base32crockford = chain(radix2(5), alphabet("0123456789ABCDEFGHJKMNPQRSTVWXYZ"), join(""), normalize((s) => s.toUpperCase().replace(/O/g, "0").replace(/[IL]/g, "1")));
3132  var base64 = chain(radix2(6), alphabet("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"), padding(6), join(""));
3133  var base64url = chain(radix2(6), alphabet("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"), padding(6), join(""));
3134  var genBase58 = (abc) => chain(radix(58), alphabet(abc), join(""));
3135  var base58 = genBase58("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");
3136  var base58flickr = genBase58("123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ");
3137  var base58xrp = genBase58("rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz");
3138  var XMR_BLOCK_LEN = [0, 2, 3, 5, 6, 7, 9, 10, 11];
3139  var base58xmr = {
3140    encode(data) {
3141      let res = "";
3142      for (let i = 0; i < data.length; i += 8) {
3143        const block = data.subarray(i, i + 8);
3144        res += base58.encode(block).padStart(XMR_BLOCK_LEN[block.length], "1");
3145      }
3146      return res;
3147    },
3148    decode(str) {
3149      let res = [];
3150      for (let i = 0; i < str.length; i += 11) {
3151        const slice = str.slice(i, i + 11);
3152        const blockLen = XMR_BLOCK_LEN.indexOf(slice.length);
3153        const block = base58.decode(slice);
3154        for (let j = 0; j < block.length - blockLen; j++) {
3155          if (block[j] !== 0)
3156            throw new Error("base58xmr: wrong padding");
3157        }
3158        res = res.concat(Array.from(block.slice(block.length - blockLen)));
3159      }
3160      return Uint8Array.from(res);
3161    }
3162  };
3163  var base58check = (sha2562) => chain(checksum(4, (data) => sha2562(sha2562(data))), base58);
3164  var BECH_ALPHABET = chain(alphabet("qpzry9x8gf2tvdw0s3jn54khce6mua7l"), join(""));
3165  var POLYMOD_GENERATORS = [996825010, 642813549, 513874426, 1027748829, 705979059];
3166  function bech32Polymod(pre) {
3167    const b = pre >> 25;
3168    let chk = (pre & 33554431) << 5;
3169    for (let i = 0; i < POLYMOD_GENERATORS.length; i++) {
3170      if ((b >> i & 1) === 1)
3171        chk ^= POLYMOD_GENERATORS[i];
3172    }
3173    return chk;
3174  }
3175  function bechChecksum(prefix, words, encodingConst = 1) {
3176    const len = prefix.length;
3177    let chk = 1;
3178    for (let i = 0; i < len; i++) {
3179      const c = prefix.charCodeAt(i);
3180      if (c < 33 || c > 126)
3181        throw new Error(`Invalid prefix (${prefix})`);
3182      chk = bech32Polymod(chk) ^ c >> 5;
3183    }
3184    chk = bech32Polymod(chk);
3185    for (let i = 0; i < len; i++)
3186      chk = bech32Polymod(chk) ^ prefix.charCodeAt(i) & 31;
3187    for (let v of words)
3188      chk = bech32Polymod(chk) ^ v;
3189    for (let i = 0; i < 6; i++)
3190      chk = bech32Polymod(chk);
3191    chk ^= encodingConst;
3192    return BECH_ALPHABET.encode(convertRadix2([chk % 2 ** 30], 30, 5, false));
3193  }
3194  function genBech32(encoding) {
3195    const ENCODING_CONST = encoding === "bech32" ? 1 : 734539939;
3196    const _words = radix2(5);
3197    const fromWords = _words.decode;
3198    const toWords = _words.encode;
3199    const fromWordsUnsafe = unsafeWrapper(fromWords);
3200    function encode(prefix, words, limit = 90) {
3201      if (typeof prefix !== "string")
3202        throw new Error(`bech32.encode prefix should be string, not ${typeof prefix}`);
3203      if (!Array.isArray(words) || words.length && typeof words[0] !== "number")
3204        throw new Error(`bech32.encode words should be array of numbers, not ${typeof words}`);
3205      const actualLength = prefix.length + 7 + words.length;
3206      if (limit !== false && actualLength > limit)
3207        throw new TypeError(`Length ${actualLength} exceeds limit ${limit}`);
3208      prefix = prefix.toLowerCase();
3209      return `${prefix}1${BECH_ALPHABET.encode(words)}${bechChecksum(prefix, words, ENCODING_CONST)}`;
3210    }
3211    function decode2(str, limit = 90) {
3212      if (typeof str !== "string")
3213        throw new Error(`bech32.decode input should be string, not ${typeof str}`);
3214      if (str.length < 8 || limit !== false && str.length > limit)
3215        throw new TypeError(`Wrong string length: ${str.length} (${str}). Expected (8..${limit})`);
3216      const lowered = str.toLowerCase();
3217      if (str !== lowered && str !== str.toUpperCase())
3218        throw new Error(`String must be lowercase or uppercase`);
3219      str = lowered;
3220      const sepIndex = str.lastIndexOf("1");
3221      if (sepIndex === 0 || sepIndex === -1)
3222        throw new Error(`Letter "1" must be present between prefix and data only`);
3223      const prefix = str.slice(0, sepIndex);
3224      const _words2 = str.slice(sepIndex + 1);
3225      if (_words2.length < 6)
3226        throw new Error("Data must be at least 6 characters long");
3227      const words = BECH_ALPHABET.decode(_words2).slice(0, -6);
3228      const sum = bechChecksum(prefix, words, ENCODING_CONST);
3229      if (!_words2.endsWith(sum))
3230        throw new Error(`Invalid checksum in ${str}: expected "${sum}"`);
3231      return { prefix, words };
3232    }
3233    const decodeUnsafe = unsafeWrapper(decode2);
3234    function decodeToBytes(str) {
3235      const { prefix, words } = decode2(str, false);
3236      return { prefix, words, bytes: fromWords(words) };
3237    }
3238    return { encode, decode: decode2, decodeToBytes, decodeUnsafe, fromWords, fromWordsUnsafe, toWords };
3239  }
3240  var bech32 = genBech32("bech32");
3241  var bech32m = genBech32("bech32m");
3242  var utf8 = {
3243    encode: (data) => new TextDecoder().decode(data),
3244    decode: (str) => new TextEncoder().encode(str)
3245  };
3246  var hex = chain(radix2(4), alphabet("0123456789abcdef"), join(""), normalize((s) => {
3247    if (typeof s !== "string" || s.length % 2)
3248      throw new TypeError(`hex.decode: expected string, got ${typeof s} with length ${s.length}`);
3249    return s.toLowerCase();
3250  }));
3251  var CODERS = {
3252    utf8,
3253    hex,
3254    base16,
3255    base32,
3256    base64,
3257    base64url,
3258    base58,
3259    base58xmr
3260  };
3261  var coderTypeError = `Invalid encoding type. Available types: ${Object.keys(CODERS).join(", ")}`;
3262
3263  // nip19.ts
3264  var Bech32MaxSize = 5e3;
3265  var BECH32_REGEX = /[\x21-\x7E]{1,83}1[023456789acdefghjklmnpqrstuvwxyz]{6,}/;
3266  function integerToUint8Array(number3) {
3267    const uint8Array = new Uint8Array(4);
3268    uint8Array[0] = number3 >> 24 & 255;
3269    uint8Array[1] = number3 >> 16 & 255;
3270    uint8Array[2] = number3 >> 8 & 255;
3271    uint8Array[3] = number3 & 255;
3272    return uint8Array;
3273  }
3274  function decode(nip19) {
3275    let { prefix, words } = bech32.decode(nip19, Bech32MaxSize);
3276    let data = new Uint8Array(bech32.fromWords(words));
3277    switch (prefix) {
3278      case "nprofile": {
3279        let tlv = parseTLV(data);
3280        if (!tlv[0]?.[0])
3281          throw new Error("missing TLV 0 for nprofile");
3282        if (tlv[0][0].length !== 32)
3283          throw new Error("TLV 0 should be 32 bytes");
3284        return {
3285          type: "nprofile",
3286          data: {
3287            pubkey: bytesToHex(tlv[0][0]),
3288            relays: tlv[1] ? tlv[1].map((d) => utf8Decoder.decode(d)) : []
3289          }
3290        };
3291      }
3292      case "nevent": {
3293        let tlv = parseTLV(data);
3294        if (!tlv[0]?.[0])
3295          throw new Error("missing TLV 0 for nevent");
3296        if (tlv[0][0].length !== 32)
3297          throw new Error("TLV 0 should be 32 bytes");
3298        if (tlv[2] && tlv[2][0].length !== 32)
3299          throw new Error("TLV 2 should be 32 bytes");
3300        if (tlv[3] && tlv[3][0].length !== 4)
3301          throw new Error("TLV 3 should be 4 bytes");
3302        return {
3303          type: "nevent",
3304          data: {
3305            id: bytesToHex(tlv[0][0]),
3306            relays: tlv[1] ? tlv[1].map((d) => utf8Decoder.decode(d)) : [],
3307            author: tlv[2]?.[0] ? bytesToHex(tlv[2][0]) : void 0,
3308            kind: tlv[3]?.[0] ? parseInt(bytesToHex(tlv[3][0]), 16) : void 0
3309          }
3310        };
3311      }
3312      case "naddr": {
3313        let tlv = parseTLV(data);
3314        if (!tlv[0]?.[0])
3315          throw new Error("missing TLV 0 for naddr");
3316        if (!tlv[2]?.[0])
3317          throw new Error("missing TLV 2 for naddr");
3318        if (tlv[2][0].length !== 32)
3319          throw new Error("TLV 2 should be 32 bytes");
3320        if (!tlv[3]?.[0])
3321          throw new Error("missing TLV 3 for naddr");
3322        if (tlv[3][0].length !== 4)
3323          throw new Error("TLV 3 should be 4 bytes");
3324        return {
3325          type: "naddr",
3326          data: {
3327            identifier: utf8Decoder.decode(tlv[0][0]),
3328            pubkey: bytesToHex(tlv[2][0]),
3329            kind: parseInt(bytesToHex(tlv[3][0]), 16),
3330            relays: tlv[1] ? tlv[1].map((d) => utf8Decoder.decode(d)) : []
3331          }
3332        };
3333      }
3334      case "nrelay": {
3335        let tlv = parseTLV(data);
3336        if (!tlv[0]?.[0])
3337          throw new Error("missing TLV 0 for nrelay");
3338        return {
3339          type: "nrelay",
3340          data: utf8Decoder.decode(tlv[0][0])
3341        };
3342      }
3343      case "nsec":
3344      case "npub":
3345      case "note":
3346        return { type: prefix, data: bytesToHex(data) };
3347      default:
3348        throw new Error(`unknown prefix ${prefix}`);
3349    }
3350  }
3351  function parseTLV(data) {
3352    let result = {};
3353    let rest = data;
3354    while (rest.length > 0) {
3355      let t = rest[0];
3356      let l = rest[1];
3357      if (!l)
3358        throw new Error(`malformed TLV ${t}`);
3359      let v = rest.slice(2, 2 + l);
3360      rest = rest.slice(2 + l);
3361      if (v.length < l)
3362        throw new Error(`not enough data to read on TLV ${t}`);
3363      result[t] = result[t] || [];
3364      result[t].push(v);
3365    }
3366    return result;
3367  }
3368  function nsecEncode(hex2) {
3369    return encodeBytes("nsec", hex2);
3370  }
3371  function npubEncode(hex2) {
3372    return encodeBytes("npub", hex2);
3373  }
3374  function noteEncode(hex2) {
3375    return encodeBytes("note", hex2);
3376  }
3377  function encodeBech32(prefix, data) {
3378    let words = bech32.toWords(data);
3379    return bech32.encode(prefix, words, Bech32MaxSize);
3380  }
3381  function encodeBytes(prefix, hex2) {
3382    let data = hexToBytes(hex2);
3383    return encodeBech32(prefix, data);
3384  }
3385  function nprofileEncode(profile) {
3386    let data = encodeTLV({
3387      0: [hexToBytes(profile.pubkey)],
3388      1: (profile.relays || []).map((url) => utf8Encoder.encode(url))
3389    });
3390    return encodeBech32("nprofile", data);
3391  }
3392  function neventEncode(event) {
3393    let kindArray;
3394    if (event.kind != void 0) {
3395      kindArray = integerToUint8Array(event.kind);
3396    }
3397    let data = encodeTLV({
3398      0: [hexToBytes(event.id)],
3399      1: (event.relays || []).map((url) => utf8Encoder.encode(url)),
3400      2: event.author ? [hexToBytes(event.author)] : [],
3401      3: kindArray ? [new Uint8Array(kindArray)] : []
3402    });
3403    return encodeBech32("nevent", data);
3404  }
3405  function naddrEncode(addr) {
3406    let kind = new ArrayBuffer(4);
3407    new DataView(kind).setUint32(0, addr.kind, false);
3408    let data = encodeTLV({
3409      0: [utf8Encoder.encode(addr.identifier)],
3410      1: (addr.relays || []).map((url) => utf8Encoder.encode(url)),
3411      2: [hexToBytes(addr.pubkey)],
3412      3: [new Uint8Array(kind)]
3413    });
3414    return encodeBech32("naddr", data);
3415  }
3416  function nrelayEncode(url) {
3417    let data = encodeTLV({
3418      0: [utf8Encoder.encode(url)]
3419    });
3420    return encodeBech32("nrelay", data);
3421  }
3422  function encodeTLV(tlv) {
3423    let entries = [];
3424    Object.entries(tlv).forEach(([t, vs]) => {
3425      vs.forEach((v) => {
3426        let entry = new Uint8Array(v.length + 2);
3427        entry.set([parseInt(t)], 0);
3428        entry.set([v.length], 1);
3429        entry.set(v, 2);
3430        entries.push(entry);
3431      });
3432    });
3433    return concatBytes(...entries);
3434  }
3435
3436  // references.ts
3437  var mentionRegex = /\bnostr:((note|npub|naddr|nevent|nprofile)1\w+)\b|#\[(\d+)\]/g;
3438  function parseReferences(evt) {
3439    let references = [];
3440    for (let ref of evt.content.matchAll(mentionRegex)) {
3441      if (ref[2]) {
3442        try {
3443          let { type, data } = decode(ref[1]);
3444          switch (type) {
3445            case "npub": {
3446              references.push({
3447                text: ref[0],
3448                profile: { pubkey: data, relays: [] }
3449              });
3450              break;
3451            }
3452            case "nprofile": {
3453              references.push({
3454                text: ref[0],
3455                profile: data
3456              });
3457              break;
3458            }
3459            case "note": {
3460              references.push({
3461                text: ref[0],
3462                event: { id: data, relays: [] }
3463              });
3464              break;
3465            }
3466            case "nevent": {
3467              references.push({
3468                text: ref[0],
3469                event: data
3470              });
3471              break;
3472            }
3473            case "naddr": {
3474              references.push({
3475                text: ref[0],
3476                address: data
3477              });
3478              break;
3479            }
3480          }
3481        } catch (err) {
3482        }
3483      } else if (ref[3]) {
3484        let idx = parseInt(ref[3], 10);
3485        let tag = evt.tags[idx];
3486        if (!tag)
3487          continue;
3488        switch (tag[0]) {
3489          case "p": {
3490            references.push({
3491              text: ref[0],
3492              profile: { pubkey: tag[1], relays: tag[2] ? [tag[2]] : [] }
3493            });
3494            break;
3495          }
3496          case "e": {
3497            references.push({
3498              text: ref[0],
3499              event: { id: tag[1], relays: tag[2] ? [tag[2]] : [] }
3500            });
3501            break;
3502          }
3503          case "a": {
3504            try {
3505              let [kind, pubkey, identifier] = tag[1].split(":");
3506              references.push({
3507                text: ref[0],
3508                address: {
3509                  identifier,
3510                  pubkey,
3511                  kind: parseInt(kind, 10),
3512                  relays: tag[2] ? [tag[2]] : []
3513                }
3514              });
3515            } catch (err) {
3516            }
3517            break;
3518          }
3519        }
3520      }
3521    }
3522    return references;
3523  }
3524
3525  // nip04.ts
3526  var nip04_exports = {};
3527  __export(nip04_exports, {
3528    decrypt: () => decrypt,
3529    encrypt: () => encrypt
3530  });
3531  if (typeof crypto !== "undefined" && !crypto.subtle && crypto.webcrypto) {
3532    crypto.subtle = crypto.webcrypto.subtle;
3533  }
3534  async function encrypt(privkey, pubkey, text) {
3535    const key = secp256k1.getSharedSecret(privkey, "02" + pubkey);
3536    const normalizedKey = getNormalizedX(key);
3537    let iv = Uint8Array.from(randomBytes(16));
3538    let plaintext = utf8Encoder.encode(text);
3539    let cryptoKey = await crypto.subtle.importKey("raw", normalizedKey, { name: "AES-CBC" }, false, ["encrypt"]);
3540    let ciphertext = await crypto.subtle.encrypt({ name: "AES-CBC", iv }, cryptoKey, plaintext);
3541    let ctb64 = base64.encode(new Uint8Array(ciphertext));
3542    let ivb64 = base64.encode(new Uint8Array(iv.buffer));
3543    return `${ctb64}?iv=${ivb64}`;
3544  }
3545  async function decrypt(privkey, pubkey, data) {
3546    let [ctb64, ivb64] = data.split("?iv=");
3547    let key = secp256k1.getSharedSecret(privkey, "02" + pubkey);
3548    let normalizedKey = getNormalizedX(key);
3549    let cryptoKey = await crypto.subtle.importKey("raw", normalizedKey, { name: "AES-CBC" }, false, ["decrypt"]);
3550    let ciphertext = base64.decode(ctb64);
3551    let iv = base64.decode(ivb64);
3552    let plaintext = await crypto.subtle.decrypt({ name: "AES-CBC", iv }, cryptoKey, ciphertext);
3553    let text = utf8Decoder.decode(plaintext);
3554    return text;
3555  }
3556  function getNormalizedX(key) {
3557    return key.slice(1, 33);
3558  }
3559
3560  // nip05.ts
3561  var nip05_exports = {};
3562  __export(nip05_exports, {
3563    NIP05_REGEX: () => NIP05_REGEX,
3564    queryProfile: () => queryProfile,
3565    searchDomain: () => searchDomain,
3566    useFetchImplementation: () => useFetchImplementation
3567  });
3568  var NIP05_REGEX = /^(?:([\w.+-]+)@)?([\w.-]+)$/;
3569  var _fetch;
3570  try {
3571    _fetch = fetch;
3572  } catch {
3573  }
3574  function useFetchImplementation(fetchImplementation) {
3575    _fetch = fetchImplementation;
3576  }
3577  async function searchDomain(domain, query = "") {
3578    try {
3579      let res = await (await _fetch(`https://${domain}/.well-known/nostr.json?name=${query}`)).json();
3580      return res.names;
3581    } catch (_) {
3582      return {};
3583    }
3584  }
3585  async function queryProfile(fullname) {
3586    const match = fullname.match(NIP05_REGEX);
3587    if (!match)
3588      return null;
3589    const [_, name = "_", domain] = match;
3590    try {
3591      const res = await _fetch(`https://${domain}/.well-known/nostr.json?name=${name}`);
3592      const { names, relays } = parseNIP05Result(await res.json());
3593      const pubkey = names[name];
3594      return pubkey ? { pubkey, relays: relays?.[pubkey] } : null;
3595    } catch (_e) {
3596      return null;
3597    }
3598  }
3599  function parseNIP05Result(json) {
3600    const result = {
3601      names: {}
3602    };
3603    for (const [name, pubkey] of Object.entries(json.names)) {
3604      if (typeof name === "string" && typeof pubkey === "string") {
3605        result.names[name] = pubkey;
3606      }
3607    }
3608    if (json.relays) {
3609      result.relays = {};
3610      for (const [pubkey, relays] of Object.entries(json.relays)) {
3611        if (typeof pubkey === "string" && Array.isArray(relays)) {
3612          result.relays[pubkey] = relays.filter((relay) => typeof relay === "string");
3613        }
3614      }
3615    }
3616    return result;
3617  }
3618
3619  // nip06.ts
3620  var nip06_exports = {};
3621  __export(nip06_exports, {
3622    generateSeedWords: () => generateSeedWords,
3623    privateKeyFromSeedWords: () => privateKeyFromSeedWords,
3624    validateWords: () => validateWords
3625  });
3626
3627  
vendor: 13,205 bytes, lines 3627-5677
3627// node_modules/@scure/bip39/esm/wordlists/english.js
3628  var wordlist = `abandon
3629ability
3630able
3631about
3632above
3633absent
3634absorb
3635abstract
3636absurd
3637abuse
3638access
3639accident
3640account
3641accuse
3642achieve
3643acid
3644acoustic
3645acquire
3646across
3647act
3648action
3649actor
3650actress
3651actual
3652adapt
3653add
3654addict
3655address
3656adjust
3657admit
3658adult
3659advance
3660advice
3661aerobic
3662affair
3663afford
3664afraid
3665again
3666age
3667agent
3668agree
3669ahead
3670aim
3671air
3672airport
3673aisle
3674alarm
3675album
3676alcohol
3677alert
3678alien
3679all
3680alley
3681allow
3682almost
3683alone
3684alpha
3685already
3686also
3687alter
3688always
3689amateur
3690amazing
3691among
3692amount
3693amused
3694analyst
3695anchor
3696ancient
3697anger
3698angle
3699angry
3700animal
3701ankle
3702announce
3703annual
3704another
3705answer
3706antenna
3707antique
3708anxiety
3709any
3710apart
3711apology
3712appear
3713apple
3714approve
3715april
3716arch
3717arctic
3718area
3719arena
3720argue
3721arm
3722armed
3723armor
3724army
3725around
3726arrange
3727arrest
3728arrive
3729arrow
3730art
3731artefact
3732artist
3733artwork
3734ask
3735aspect
3736assault
3737asset
3738assist
3739assume
3740asthma
3741athlete
3742atom
3743attack
3744attend
3745attitude
3746attract
3747auction
3748audit
3749august
3750aunt
3751author
3752auto
3753autumn
3754average
3755avocado
3756avoid
3757awake
3758aware
3759away
3760awesome
3761awful
3762awkward
3763axis
3764baby
3765bachelor
3766bacon
3767badge
3768bag
3769balance
3770balcony
3771ball
3772bamboo
3773banana
3774banner
3775bar
3776barely
3777bargain
3778barrel
3779base
3780basic
3781basket
3782battle
3783beach
3784bean
3785beauty
3786because
3787become
3788beef
3789before
3790begin
3791behave
3792behind
3793believe
3794below
3795belt
3796bench
3797benefit
3798best
3799betray
3800better
3801between
3802beyond
3803bicycle
3804bid
3805bike
3806bind
3807biology
3808bird
3809birth
3810bitter
3811black
3812blade
3813blame
3814blanket
3815blast
3816bleak
3817bless
3818blind
3819blood
3820blossom
3821blouse
3822blue
3823blur
3824blush
3825board
3826boat
3827body
3828boil
3829bomb
3830bone
3831bonus
3832book
3833boost
3834border
3835boring
3836borrow
3837boss
3838bottom
3839bounce
3840box
3841boy
3842bracket
3843brain
3844brand
3845brass
3846brave
3847bread
3848breeze
3849brick
3850bridge
3851brief
3852bright
3853bring
3854brisk
3855broccoli
3856broken
3857bronze
3858broom
3859brother
3860brown
3861brush
3862bubble
3863buddy
3864budget
3865buffalo
3866build
3867bulb
3868bulk
3869bullet
3870bundle
3871bunker
3872burden
3873burger
3874burst
3875bus
3876business
3877busy
3878butter
3879buyer
3880buzz
3881cabbage
3882cabin
3883cable
3884cactus
3885cage
3886cake
3887call
3888calm
3889camera
3890camp
3891can
3892canal
3893cancel
3894candy
3895cannon
3896canoe
3897canvas
3898canyon
3899capable
3900capital
3901captain
3902car
3903carbon
3904card
3905cargo
3906carpet
3907carry
3908cart
3909case
3910cash
3911casino
3912castle
3913casual
3914cat
3915catalog
3916catch
3917category
3918cattle
3919caught
3920cause
3921caution
3922cave
3923ceiling
3924celery
3925cement
3926census
3927century
3928cereal
3929certain
3930chair
3931chalk
3932champion
3933change
3934chaos
3935chapter
3936charge
3937chase
3938chat
3939cheap
3940check
3941cheese
3942chef
3943cherry
3944chest
3945chicken
3946chief
3947child
3948chimney
3949choice
3950choose
3951chronic
3952chuckle
3953chunk
3954churn
3955cigar
3956cinnamon
3957circle
3958citizen
3959city
3960civil
3961claim
3962clap
3963clarify
3964claw
3965clay
3966clean
3967clerk
3968clever
3969click
3970client
3971cliff
3972climb
3973clinic
3974clip
3975clock
3976clog
3977close
3978cloth
3979cloud
3980clown
3981club
3982clump
3983cluster
3984clutch
3985coach
3986coast
3987coconut
3988code
3989coffee
3990coil
3991coin
3992collect
3993color
3994column
3995combine
3996come
3997comfort
3998comic
3999common
4000company
4001concert
4002conduct
4003confirm
4004congress
4005connect
4006consider
4007control
4008convince
4009cook
4010cool
4011copper
4012copy
4013coral
4014core
4015corn
4016correct
4017cost
4018cotton
4019couch
4020country
4021couple
4022course
4023cousin
4024cover
4025coyote
4026crack
4027cradle
4028craft
4029cram
4030crane
4031crash
4032crater
4033crawl
4034crazy
4035cream
4036credit
4037creek
4038crew
4039cricket
4040crime
4041crisp
4042critic
4043crop
4044cross
4045crouch
4046crowd
4047crucial
4048cruel
4049cruise
4050crumble
4051crunch
4052crush
4053cry
4054crystal
4055cube
4056culture
4057cup
4058cupboard
4059curious
4060current
4061curtain
4062curve
4063cushion
4064custom
4065cute
4066cycle
4067dad
4068damage
4069damp
4070dance
4071danger
4072daring
4073dash
4074daughter
4075dawn
4076day
4077deal
4078debate
4079debris
4080decade
4081december
4082decide
4083decline
4084decorate
4085decrease
4086deer
4087defense
4088define
4089defy
4090degree
4091delay
4092deliver
4093demand
4094demise
4095denial
4096dentist
4097deny
4098depart
4099depend
4100deposit
4101depth
4102deputy
4103derive
4104describe
4105desert
4106design
4107desk
4108despair
4109destroy
4110detail
4111detect
4112develop
4113device
4114devote
4115diagram
4116dial
4117diamond
4118diary
4119dice
4120diesel
4121diet
4122differ
4123digital
4124dignity
4125dilemma
4126dinner
4127dinosaur
4128direct
4129dirt
4130disagree
4131discover
4132disease
4133dish
4134dismiss
4135disorder
4136display
4137distance
4138divert
4139divide
4140divorce
4141dizzy
4142doctor
4143document
4144dog
4145doll
4146dolphin
4147domain
4148donate
4149donkey
4150donor
4151door
4152dose
4153double
4154dove
4155draft
4156dragon
4157drama
4158drastic
4159draw
4160dream
4161dress
4162drift
4163drill
4164drink
4165drip
4166drive
4167drop
4168drum
4169dry
4170duck
4171dumb
4172dune
4173during
4174dust
4175dutch
4176duty
4177dwarf
4178dynamic
4179eager
4180eagle
4181early
4182earn
4183earth
4184easily
4185east
4186easy
4187echo
4188ecology
4189economy
4190edge
4191edit
4192educate
4193effort
4194egg
4195eight
4196either
4197elbow
4198elder
4199electric
4200elegant
4201element
4202elephant
4203elevator
4204elite
4205else
4206embark
4207embody
4208embrace
4209emerge
4210emotion
4211employ
4212empower
4213empty
4214enable
4215enact
4216end
4217endless
4218endorse
4219enemy
4220energy
4221enforce
4222engage
4223engine
4224enhance
4225enjoy
4226enlist
4227enough
4228enrich
4229enroll
4230ensure
4231enter
4232entire
4233entry
4234envelope
4235episode
4236equal
4237equip
4238era
4239erase
4240erode
4241erosion
4242error
4243erupt
4244escape
4245essay
4246essence
4247estate
4248eternal
4249ethics
4250evidence
4251evil
4252evoke
4253evolve
4254exact
4255example
4256excess
4257exchange
4258excite
4259exclude
4260excuse
4261execute
4262exercise
4263exhaust
4264exhibit
4265exile
4266exist
4267exit
4268exotic
4269expand
4270expect
4271expire
4272explain
4273expose
4274express
4275extend
4276extra
4277eye
4278eyebrow
4279fabric
4280face
4281faculty
4282fade
4283faint
4284faith
4285fall
4286false
4287fame
4288family
4289famous
4290fan
4291fancy
4292fantasy
4293farm
4294fashion
4295fat
4296fatal
4297father
4298fatigue
4299fault
4300favorite
4301feature
4302february
4303federal
4304fee
4305feed
4306feel
4307female
4308fence
4309festival
4310fetch
4311fever
4312few
4313fiber
4314fiction
4315field
4316figure
4317file
4318film
4319filter
4320final
4321find
4322fine
4323finger
4324finish
4325fire
4326firm
4327first
4328fiscal
4329fish
4330fit
4331fitness
4332fix
4333flag
4334flame
4335flash
4336flat
4337flavor
4338flee
4339flight
4340flip
4341float
4342flock
4343floor
4344flower
4345fluid
4346flush
4347fly
4348foam
4349focus
4350fog
4351foil
4352fold
4353follow
4354food
4355foot
4356force
4357forest
4358forget
4359fork
4360fortune
4361forum
4362forward
4363fossil
4364foster
4365found
4366fox
4367fragile
4368frame
4369frequent
4370fresh
4371friend
4372fringe
4373frog
4374front
4375frost
4376frown
4377frozen
4378fruit
4379fuel
4380fun
4381funny
4382furnace
4383fury
4384future
4385gadget
4386gain
4387galaxy
4388gallery
4389game
4390gap
4391garage
4392garbage
4393garden
4394garlic
4395garment
4396gas
4397gasp
4398gate
4399gather
4400gauge
4401gaze
4402general
4403genius
4404genre
4405gentle
4406genuine
4407gesture
4408ghost
4409giant
4410gift
4411giggle
4412ginger
4413giraffe
4414girl
4415give
4416glad
4417glance
4418glare
4419glass
4420glide
4421glimpse
4422globe
4423gloom
4424glory
4425glove
4426glow
4427glue
4428goat
4429goddess
4430gold
4431good
4432goose
4433gorilla
4434gospel
4435gossip
4436govern
4437gown
4438grab
4439grace
4440grain
4441grant
4442grape
4443grass
4444gravity
4445great
4446green
4447grid
4448grief
4449grit
4450grocery
4451group
4452grow
4453grunt
4454guard
4455guess
4456guide
4457guilt
4458guitar
4459gun
4460gym
4461habit
4462hair
4463half
4464hammer
4465hamster
4466hand
4467happy
4468harbor
4469hard
4470harsh
4471harvest
4472hat
4473have
4474hawk
4475hazard
4476head
4477health
4478heart
4479heavy
4480hedgehog
4481height
4482hello
4483helmet
4484help
4485hen
4486hero
4487hidden
4488high
4489hill
4490hint
4491hip
4492hire
4493history
4494hobby
4495hockey
4496hold
4497hole
4498holiday
4499hollow
4500home
4501honey
4502hood
4503hope
4504horn
4505horror
4506horse
4507hospital
4508host
4509hotel
4510hour
4511hover
4512hub
4513huge
4514human
4515humble
4516humor
4517hundred
4518hungry
4519hunt
4520hurdle
4521hurry
4522hurt
4523husband
4524hybrid
4525ice
4526icon
4527idea
4528identify
4529idle
4530ignore
4531ill
4532illegal
4533illness
4534image
4535imitate
4536immense
4537immune
4538impact
4539impose
4540improve
4541impulse
4542inch
4543include
4544income
4545increase
4546index
4547indicate
4548indoor
4549industry
4550infant
4551inflict
4552inform
4553inhale
4554inherit
4555initial
4556inject
4557injury
4558inmate
4559inner
4560innocent
4561input
4562inquiry
4563insane
4564insect
4565inside
4566inspire
4567install
4568intact
4569interest
4570into
4571invest
4572invite
4573involve
4574iron
4575island
4576isolate
4577issue
4578item
4579ivory
4580jacket
4581jaguar
4582jar
4583jazz
4584jealous
4585jeans
4586jelly
4587jewel
4588job
4589join
4590joke
4591journey
4592joy
4593judge
4594juice
4595jump
4596jungle
4597junior
4598junk
4599just
4600kangaroo
4601keen
4602keep
4603ketchup
4604key
4605kick
4606kid
4607kidney
4608kind
4609kingdom
4610kiss
4611kit
4612kitchen
4613kite
4614kitten
4615kiwi
4616knee
4617knife
4618knock
4619know
4620lab
4621label
4622labor
4623ladder
4624lady
4625lake
4626lamp
4627language
4628laptop
4629large
4630later
4631latin
4632laugh
4633laundry
4634lava
4635law
4636lawn
4637lawsuit
4638layer
4639lazy
4640leader
4641leaf
4642learn
4643leave
4644lecture
4645left
4646leg
4647legal
4648legend
4649leisure
4650lemon
4651lend
4652length
4653lens
4654leopard
4655lesson
4656letter
4657level
4658liar
4659liberty
4660library
4661license
4662life
4663lift
4664light
4665like
4666limb
4667limit
4668link
4669lion
4670liquid
4671list
4672little
4673live
4674lizard
4675load
4676loan
4677lobster
4678local
4679lock
4680logic
4681lonely
4682long
4683loop
4684lottery
4685loud
4686lounge
4687love
4688loyal
4689lucky
4690luggage
4691lumber
4692lunar
4693lunch
4694luxury
4695lyrics
4696machine
4697mad
4698magic
4699magnet
4700maid
4701mail
4702main
4703major
4704make
4705mammal
4706man
4707manage
4708mandate
4709mango
4710mansion
4711manual
4712maple
4713marble
4714march
4715margin
4716marine
4717market
4718marriage
4719mask
4720mass
4721master
4722match
4723material
4724math
4725matrix
4726matter
4727maximum
4728maze
4729meadow
4730mean
4731measure
4732meat
4733mechanic
4734medal
4735media
4736melody
4737melt
4738member
4739memory
4740mention
4741menu
4742mercy
4743merge
4744merit
4745merry
4746mesh
4747message
4748metal
4749method
4750middle
4751midnight
4752milk
4753million
4754mimic
4755mind
4756minimum
4757minor
4758minute
4759miracle
4760mirror
4761misery
4762miss
4763mistake
4764mix
4765mixed
4766mixture
4767mobile
4768model
4769modify
4770mom
4771moment
4772monitor
4773monkey
4774monster
4775month
4776moon
4777moral
4778more
4779morning
4780mosquito
4781mother
4782motion
4783motor
4784mountain
4785mouse
4786move
4787movie
4788much
4789muffin
4790mule
4791multiply
4792muscle
4793museum
4794mushroom
4795music
4796must
4797mutual
4798myself
4799mystery
4800myth
4801naive
4802name
4803napkin
4804narrow
4805nasty
4806nation
4807nature
4808near
4809neck
4810need
4811negative
4812neglect
4813neither
4814nephew
4815nerve
4816nest
4817net
4818network
4819neutral
4820never
4821news
4822next
4823nice
4824night
4825noble
4826noise
4827nominee
4828noodle
4829normal
4830north
4831nose
4832notable
4833note
4834nothing
4835notice
4836novel
4837now
4838nuclear
4839number
4840nurse
4841nut
4842oak
4843obey
4844object
4845oblige
4846obscure
4847observe
4848obtain
4849obvious
4850occur
4851ocean
4852october
4853odor
4854off
4855offer
4856office
4857often
4858oil
4859okay
4860old
4861olive
4862olympic
4863omit
4864once
4865one
4866onion
4867online
4868only
4869open
4870opera
4871opinion
4872oppose
4873option
4874orange
4875orbit
4876orchard
4877order
4878ordinary
4879organ
4880orient
4881original
4882orphan
4883ostrich
4884other
4885outdoor
4886outer
4887output
4888outside
4889oval
4890oven
4891over
4892own
4893owner
4894oxygen
4895oyster
4896ozone
4897pact
4898paddle
4899page
4900pair
4901palace
4902palm
4903panda
4904panel
4905panic
4906panther
4907paper
4908parade
4909parent
4910park
4911parrot
4912party
4913pass
4914patch
4915path
4916patient
4917patrol
4918pattern
4919pause
4920pave
4921payment
4922peace
4923peanut
4924pear
4925peasant
4926pelican
4927pen
4928penalty
4929pencil
4930people
4931pepper
4932perfect
4933permit
4934person
4935pet
4936phone
4937photo
4938phrase
4939physical
4940piano
4941picnic
4942picture
4943piece
4944pig
4945pigeon
4946pill
4947pilot
4948pink
4949pioneer
4950pipe
4951pistol
4952pitch
4953pizza
4954place
4955planet
4956plastic
4957plate
4958play
4959please
4960pledge
4961pluck
4962plug
4963plunge
4964poem
4965poet
4966point
4967polar
4968pole
4969police
4970pond
4971pony
4972pool
4973popular
4974portion
4975position
4976possible
4977post
4978potato
4979pottery
4980poverty
4981powder
4982power
4983practice
4984praise
4985predict
4986prefer
4987prepare
4988present
4989pretty
4990prevent
4991price
4992pride
4993primary
4994print
4995priority
4996prison
4997private
4998prize
4999problem
5000process
5001produce
5002profit
5003program
5004project
5005promote
5006proof
5007property
5008prosper
5009protect
5010proud
5011provide
5012public
5013pudding
5014pull
5015pulp
5016pulse
5017pumpkin
5018punch
5019pupil
5020puppy
5021purchase
5022purity
5023purpose
5024purse
5025push
5026put
5027puzzle
5028pyramid
5029quality
5030quantum
5031quarter
5032question
5033quick
5034quit
5035quiz
5036quote
5037rabbit
5038raccoon
5039race
5040rack
5041radar
5042radio
5043rail
5044rain
5045raise
5046rally
5047ramp
5048ranch
5049random
5050range
5051rapid
5052rare
5053rate
5054rather
5055raven
5056raw
5057razor
5058ready
5059real
5060reason
5061rebel
5062rebuild
5063recall
5064receive
5065recipe
5066record
5067recycle
5068reduce
5069reflect
5070reform
5071refuse
5072region
5073regret
5074regular
5075reject
5076relax
5077release
5078relief
5079rely
5080remain
5081remember
5082remind
5083remove
5084render
5085renew
5086rent
5087reopen
5088repair
5089repeat
5090replace
5091report
5092require
5093rescue
5094resemble
5095resist
5096resource
5097response
5098result
5099retire
5100retreat
5101return
5102reunion
5103reveal
5104review
5105reward
5106rhythm
5107rib
5108ribbon
5109rice
5110rich
5111ride
5112ridge
5113rifle
5114right
5115rigid
5116ring
5117riot
5118ripple
5119risk
5120ritual
5121rival
5122river
5123road
5124roast
5125robot
5126robust
5127rocket
5128romance
5129roof
5130rookie
5131room
5132rose
5133rotate
5134rough
5135round
5136route
5137royal
5138rubber
5139rude
5140rug
5141rule
5142run
5143runway
5144rural
5145sad
5146saddle
5147sadness
5148safe
5149sail
5150salad
5151salmon
5152salon
5153salt
5154salute
5155same
5156sample
5157sand
5158satisfy
5159satoshi
5160sauce
5161sausage
5162save
5163say
5164scale
5165scan
5166scare
5167scatter
5168scene
5169scheme
5170school
5171science
5172scissors
5173scorpion
5174scout
5175scrap
5176screen
5177script
5178scrub
5179sea
5180search
5181season
5182seat
5183second
5184secret
5185section
5186security
5187seed
5188seek
5189segment
5190select
5191sell
5192seminar
5193senior
5194sense
5195sentence
5196series
5197service
5198session
5199settle
5200setup
5201seven
5202shadow
5203shaft
5204shallow
5205share
5206shed
5207shell
5208sheriff
5209shield
5210shift
5211shine
5212ship
5213shiver
5214shock
5215shoe
5216shoot
5217shop
5218short
5219shoulder
5220shove
5221shrimp
5222shrug
5223shuffle
5224shy
5225sibling
5226sick
5227side
5228siege
5229sight
5230sign
5231silent
5232silk
5233silly
5234silver
5235similar
5236simple
5237since
5238sing
5239siren
5240sister
5241situate
5242six
5243size
5244skate
5245sketch
5246ski
5247skill
5248skin
5249skirt
5250skull
5251slab
5252slam
5253sleep
5254slender
5255slice
5256slide
5257slight
5258slim
5259slogan
5260slot
5261slow
5262slush
5263small
5264smart
5265smile
5266smoke
5267smooth
5268snack
5269snake
5270snap
5271sniff
5272snow
5273soap
5274soccer
5275social
5276sock
5277soda
5278soft
5279solar
5280soldier
5281solid
5282solution
5283solve
5284someone
5285song
5286soon
5287sorry
5288sort
5289soul
5290sound
5291soup
5292source
5293south
5294space
5295spare
5296spatial
5297spawn
5298speak
5299special
5300speed
5301spell
5302spend
5303sphere
5304spice
5305spider
5306spike
5307spin
5308spirit
5309split
5310spoil
5311sponsor
5312spoon
5313sport
5314spot
5315spray
5316spread
5317spring
5318spy
5319square
5320squeeze
5321squirrel
5322stable
5323stadium
5324staff
5325stage
5326stairs
5327stamp
5328stand
5329start
5330state
5331stay
5332steak
5333steel
5334stem
5335step
5336stereo
5337stick
5338still
5339sting
5340stock
5341stomach
5342stone
5343stool
5344story
5345stove
5346strategy
5347street
5348strike
5349strong
5350struggle
5351student
5352stuff
5353stumble
5354style
5355subject
5356submit
5357subway
5358success
5359such
5360sudden
5361suffer
5362sugar
5363suggest
5364suit
5365summer
5366sun
5367sunny
5368sunset
5369super
5370supply
5371supreme
5372sure
5373surface
5374surge
5375surprise
5376surround
5377survey
5378suspect
5379sustain
5380swallow
5381swamp
5382swap
5383swarm
5384swear
5385sweet
5386swift
5387swim
5388swing
5389switch
5390sword
5391symbol
5392symptom
5393syrup
5394system
5395table
5396tackle
5397tag
5398tail
5399talent
5400talk
5401tank
5402tape
5403target
5404task
5405taste
5406tattoo
5407taxi
5408teach
5409team
5410tell
5411ten
5412tenant
5413tennis
5414tent
5415term
5416test
5417text
5418thank
5419that
5420theme
5421then
5422theory
5423there
5424they
5425thing
5426this
5427thought
5428three
5429thrive
5430throw
5431thumb
5432thunder
5433ticket
5434tide
5435tiger
5436tilt
5437timber
5438time
5439tiny
5440tip
5441tired
5442tissue
5443title
5444toast
5445tobacco
5446today
5447toddler
5448toe
5449together
5450toilet
5451token
5452tomato
5453tomorrow
5454tone
5455tongue
5456tonight
5457tool
5458tooth
5459top
5460topic
5461topple
5462torch
5463tornado
5464tortoise
5465toss
5466total
5467tourist
5468toward
5469tower
5470town
5471toy
5472track
5473trade
5474traffic
5475tragic
5476train
5477transfer
5478trap
5479trash
5480travel
5481tray
5482treat
5483tree
5484trend
5485trial
5486tribe
5487trick
5488trigger
5489trim
5490trip
5491trophy
5492trouble
5493truck
5494true
5495truly
5496trumpet
5497trust
5498truth
5499try
5500tube
5501tuition
5502tumble
5503tuna
5504tunnel
5505turkey
5506turn
5507turtle
5508twelve
5509twenty
5510twice
5511twin
5512twist
5513two
5514type
5515typical
5516ugly
5517umbrella
5518unable
5519unaware
5520uncle
5521uncover
5522under
5523undo
5524unfair
5525unfold
5526unhappy
5527uniform
5528unique
5529unit
5530universe
5531unknown
5532unlock
5533until
5534unusual
5535unveil
5536update
5537upgrade
5538uphold
5539upon
5540upper
5541upset
5542urban
5543urge
5544usage
5545use
5546used
5547useful
5548useless
5549usual
5550utility
5551vacant
5552vacuum
5553vague
5554valid
5555valley
5556valve
5557van
5558vanish
5559vapor
5560various
5561vast
5562vault
5563vehicle
5564velvet
5565vendor
5566venture
5567venue
5568verb
5569verify
5570version
5571very
5572vessel
5573veteran
5574viable
5575vibrant
5576vicious
5577victory
5578video
5579view
5580village
5581vintage
5582violin
5583virtual
5584virus
5585visa
5586visit
5587visual
5588vital
5589vivid
5590vocal
5591voice
5592void
5593volcano
5594volume
5595vote
5596voyage
5597wage
5598wagon
5599wait
5600walk
5601wall
5602walnut
5603want
5604warfare
5605warm
5606warrior
5607wash
5608wasp
5609waste
5610water
5611wave
5612way
5613wealth
5614weapon
5615wear
5616weasel
5617weather
5618web
5619wedding
5620weekend
5621weird
5622welcome
5623west
5624wet
5625whale
5626what
5627wheat
5628wheel
5629when
5630where
5631whip
5632whisper
5633wide
5634width
5635wife
5636wild
5637will
5638win
5639window
5640wine
5641wing
5642wink
5643winner
5644winter
5645wire
5646wisdom
5647wise
5648wish
5649witness
5650wolf
5651woman
5652wonder
5653wood
5654wool
5655word
5656work
5657world
5658worry
5659worth
5660wrap
5661wreck
5662wrestle
5663wrist
5664write
5665wrong
5666yard
5667year
5668yellow
5669you
5670young
5671youth
5672zebra
5673zero
5674zone
5675zoo`.split("\n");
5676
5677  
vendor: 1,623 bytes, lines 5677-5722
5677// node_modules/@noble/hashes/esm/pbkdf2.js
5678  function pbkdf2Init(hash3, _password, _salt, _opts) {
5679    assert_default.hash(hash3);
5680    const opts = checkOpts({ dkLen: 32, asyncTick: 10 }, _opts);
5681    const { c, dkLen, asyncTick } = opts;
5682    assert_default.number(c);
5683    assert_default.number(dkLen);
5684    assert_default.number(asyncTick);
5685    if (c < 1)
5686      throw new Error("PBKDF2: iterations (c) should be >= 1");
5687    const password = toBytes(_password);
5688    const salt2 = toBytes(_salt);
5689    const DK = new Uint8Array(dkLen);
5690    const PRF = hmac.create(hash3, password);
5691    const PRFSalt = PRF._cloneInto().update(salt2);
5692    return { c, dkLen, asyncTick, DK, PRF, PRFSalt };
5693  }
5694  function pbkdf2Output(PRF, PRFSalt, DK, prfW, u) {
5695    PRF.destroy();
5696    PRFSalt.destroy();
5697    if (prfW)
5698      prfW.destroy();
5699    u.fill(0);
5700    return DK;
5701  }
5702  function pbkdf2(hash3, password, salt2, opts) {
5703    const { c, dkLen, DK, PRF, PRFSalt } = pbkdf2Init(hash3, password, salt2, opts);
5704    let prfW;
5705    const arr = new Uint8Array(4);
5706    const view = createView(arr);
5707    const u = new Uint8Array(PRF.outputLen);
5708    for (let ti = 1, pos = 0; pos < dkLen; ti++, pos += PRF.outputLen) {
5709      const Ti = DK.subarray(pos, pos + PRF.outputLen);
5710      view.setInt32(0, ti, false);
5711      (prfW = PRFSalt._cloneInto(prfW)).update(arr).digestInto(u);
5712      Ti.set(u.subarray(0, Ti.length));
5713      for (let ui = 1; ui < c; ui++) {
5714        PRF._cloneInto(prfW).update(u).digestInto(u);
5715        for (let i = 0; i < Ti.length; i++)
5716          Ti[i] ^= u[i];
5717      }
5718    }
5719    return pbkdf2Output(PRF, PRFSalt, DK, prfW, u);
5720  }
5721
5722  
vendor: 2,175 bytes, lines 5722-5788
5722// node_modules/@noble/hashes/esm/_u64.js
5723  var U32_MASK64 = BigInt(2 ** 32 - 1);
5724  var _32n = BigInt(32);
5725  function fromBig(n, le = false) {
5726    if (le)
5727      return { h: Number(n & U32_MASK64), l: Number(n >> _32n & U32_MASK64) };
5728    return { h: Number(n >> _32n & U32_MASK64) | 0, l: Number(n & U32_MASK64) | 0 };
5729  }
5730  function split(lst, le = false) {
5731    let Ah = new Uint32Array(lst.length);
5732    let Al = new Uint32Array(lst.length);
5733    for (let i = 0; i < lst.length; i++) {
5734      const { h, l } = fromBig(lst[i], le);
5735      [Ah[i], Al[i]] = [h, l];
5736    }
5737    return [Ah, Al];
5738  }
5739  var toBig = (h, l) => BigInt(h >>> 0) << _32n | BigInt(l >>> 0);
5740  var shrSH = (h, l, s) => h >>> s;
5741  var shrSL = (h, l, s) => h << 32 - s | l >>> s;
5742  var rotrSH = (h, l, s) => h >>> s | l << 32 - s;
5743  var rotrSL = (h, l, s) => h << 32 - s | l >>> s;
5744  var rotrBH = (h, l, s) => h << 64 - s | l >>> s - 32;
5745  var rotrBL = (h, l, s) => h >>> s - 32 | l << 64 - s;
5746  var rotr32H = (h, l) => l;
5747  var rotr32L = (h, l) => h;
5748  var rotlSH = (h, l, s) => h << s | l >>> 32 - s;
5749  var rotlSL = (h, l, s) => l << s | h >>> 32 - s;
5750  var rotlBH = (h, l, s) => l << s - 32 | h >>> 64 - s;
5751  var rotlBL = (h, l, s) => h << s - 32 | l >>> 64 - s;
5752  function add(Ah, Al, Bh, Bl) {
5753    const l = (Al >>> 0) + (Bl >>> 0);
5754    return { h: Ah + Bh + (l / 2 ** 32 | 0) | 0, l: l | 0 };
5755  }
5756  var add3L = (Al, Bl, Cl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0);
5757  var add3H = (low, Ah, Bh, Ch) => Ah + Bh + Ch + (low / 2 ** 32 | 0) | 0;
5758  var add4L = (Al, Bl, Cl, Dl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0);
5759  var add4H = (low, Ah, Bh, Ch, Dh) => Ah + Bh + Ch + Dh + (low / 2 ** 32 | 0) | 0;
5760  var add5L = (Al, Bl, Cl, Dl, El) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0) + (El >>> 0);
5761  var add5H = (low, Ah, Bh, Ch, Dh, Eh) => Ah + Bh + Ch + Dh + Eh + (low / 2 ** 32 | 0) | 0;
5762  var u64 = {
5763    fromBig,
5764    split,
5765    toBig,
5766    shrSH,
5767    shrSL,
5768    rotrSH,
5769    rotrSL,
5770    rotrBH,
5771    rotrBL,
5772    rotr32H,
5773    rotr32L,
5774    rotlSH,
5775    rotlSL,
5776    rotlBH,
5777    rotlBL,
5778    add,
5779    add3L,
5780    add3H,
5781    add4L,
5782    add4H,
5783    add5H,
5784    add5L
5785  };
5786  var u64_default = u64;
5787
5788  
vendor: 9,230 bytes, lines 5788-6054
5788// node_modules/@noble/hashes/esm/sha512.js
5789  var [SHA512_Kh, SHA512_Kl] = u64_default.split([
5790    "0x428a2f98d728ae22",
5791    "0x7137449123ef65cd",
5792    "0xb5c0fbcfec4d3b2f",
5793    "0xe9b5dba58189dbbc",
5794    "0x3956c25bf348b538",
5795    "0x59f111f1b605d019",
5796    "0x923f82a4af194f9b",
5797    "0xab1c5ed5da6d8118",
5798    "0xd807aa98a3030242",
5799    "0x12835b0145706fbe",
5800    "0x243185be4ee4b28c",
5801    "0x550c7dc3d5ffb4e2",
5802    "0x72be5d74f27b896f",
5803    "0x80deb1fe3b1696b1",
5804    "0x9bdc06a725c71235",
5805    "0xc19bf174cf692694",
5806    "0xe49b69c19ef14ad2",
5807    "0xefbe4786384f25e3",
5808    "0x0fc19dc68b8cd5b5",
5809    "0x240ca1cc77ac9c65",
5810    "0x2de92c6f592b0275",
5811    "0x4a7484aa6ea6e483",
5812    "0x5cb0a9dcbd41fbd4",
5813    "0x76f988da831153b5",
5814    "0x983e5152ee66dfab",
5815    "0xa831c66d2db43210",
5816    "0xb00327c898fb213f",
5817    "0xbf597fc7beef0ee4",
5818    "0xc6e00bf33da88fc2",
5819    "0xd5a79147930aa725",
5820    "0x06ca6351e003826f",
5821    "0x142929670a0e6e70",
5822    "0x27b70a8546d22ffc",
5823    "0x2e1b21385c26c926",
5824    "0x4d2c6dfc5ac42aed",
5825    "0x53380d139d95b3df",
5826    "0x650a73548baf63de",
5827    "0x766a0abb3c77b2a8",
5828    "0x81c2c92e47edaee6",
5829    "0x92722c851482353b",
5830    "0xa2bfe8a14cf10364",
5831    "0xa81a664bbc423001",
5832    "0xc24b8b70d0f89791",
5833    "0xc76c51a30654be30",
5834    "0xd192e819d6ef5218",
5835    "0xd69906245565a910",
5836    "0xf40e35855771202a",
5837    "0x106aa07032bbd1b8",
5838    "0x19a4c116b8d2d0c8",
5839    "0x1e376c085141ab53",
5840    "0x2748774cdf8eeb99",
5841    "0x34b0bcb5e19b48a8",
5842    "0x391c0cb3c5c95a63",
5843    "0x4ed8aa4ae3418acb",
5844    "0x5b9cca4f7763e373",
5845    "0x682e6ff3d6b2b8a3",
5846    "0x748f82ee5defb2fc",
5847    "0x78a5636f43172f60",
5848    "0x84c87814a1f0ab72",
5849    "0x8cc702081a6439ec",
5850    "0x90befffa23631e28",
5851    "0xa4506cebde82bde9",
5852    "0xbef9a3f7b2c67915",
5853    "0xc67178f2e372532b",
5854    "0xca273eceea26619c",
5855    "0xd186b8c721c0c207",
5856    "0xeada7dd6cde0eb1e",
5857    "0xf57d4f7fee6ed178",
5858    "0x06f067aa72176fba",
5859    "0x0a637dc5a2c898a6",
5860    "0x113f9804bef90dae",
5861    "0x1b710b35131c471b",
5862    "0x28db77f523047d84",
5863    "0x32caab7b40c72493",
5864    "0x3c9ebe0a15c9bebc",
5865    "0x431d67c49c100d4c",
5866    "0x4cc5d4becb3e42b6",
5867    "0x597f299cfc657e2a",
5868    "0x5fcb6fab3ad6faec",
5869    "0x6c44198c4a475817"
5870  ].map((n) => BigInt(n)));
5871  var SHA512_W_H = new Uint32Array(80);
5872  var SHA512_W_L = new Uint32Array(80);
5873  var SHA512 = class extends SHA2 {
5874    constructor() {
5875      super(128, 64, 16, false);
5876      this.Ah = 1779033703 | 0;
5877      this.Al = 4089235720 | 0;
5878      this.Bh = 3144134277 | 0;
5879      this.Bl = 2227873595 | 0;
5880      this.Ch = 1013904242 | 0;
5881      this.Cl = 4271175723 | 0;
5882      this.Dh = 2773480762 | 0;
5883      this.Dl = 1595750129 | 0;
5884      this.Eh = 1359893119 | 0;
5885      this.El = 2917565137 | 0;
5886      this.Fh = 2600822924 | 0;
5887      this.Fl = 725511199 | 0;
5888      this.Gh = 528734635 | 0;
5889      this.Gl = 4215389547 | 0;
5890      this.Hh = 1541459225 | 0;
5891      this.Hl = 327033209 | 0;
5892    }
5893    get() {
5894      const { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this;
5895      return [Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl];
5896    }
5897    set(Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl) {
5898      this.Ah = Ah | 0;
5899      this.Al = Al | 0;
5900      this.Bh = Bh | 0;
5901      this.Bl = Bl | 0;
5902      this.Ch = Ch | 0;
5903      this.Cl = Cl | 0;
5904      this.Dh = Dh | 0;
5905      this.Dl = Dl | 0;
5906      this.Eh = Eh | 0;
5907      this.El = El | 0;
5908      this.Fh = Fh | 0;
5909      this.Fl = Fl | 0;
5910      this.Gh = Gh | 0;
5911      this.Gl = Gl | 0;
5912      this.Hh = Hh | 0;
5913      this.Hl = Hl | 0;
5914    }
5915    process(view, offset) {
5916      for (let i = 0; i < 16; i++, offset += 4) {
5917        SHA512_W_H[i] = view.getUint32(offset);
5918        SHA512_W_L[i] = view.getUint32(offset += 4);
5919      }
5920      for (let i = 16; i < 80; i++) {
5921        const W15h = SHA512_W_H[i - 15] | 0;
5922        const W15l = SHA512_W_L[i - 15] | 0;
5923        const s0h = u64_default.rotrSH(W15h, W15l, 1) ^ u64_default.rotrSH(W15h, W15l, 8) ^ u64_default.shrSH(W15h, W15l, 7);
5924        const s0l = u64_default.rotrSL(W15h, W15l, 1) ^ u64_default.rotrSL(W15h, W15l, 8) ^ u64_default.shrSL(W15h, W15l, 7);
5925        const W2h = SHA512_W_H[i - 2] | 0;
5926        const W2l = SHA512_W_L[i - 2] | 0;
5927        const s1h = u64_default.rotrSH(W2h, W2l, 19) ^ u64_default.rotrBH(W2h, W2l, 61) ^ u64_default.shrSH(W2h, W2l, 6);
5928        const s1l = u64_default.rotrSL(W2h, W2l, 19) ^ u64_default.rotrBL(W2h, W2l, 61) ^ u64_default.shrSL(W2h, W2l, 6);
5929        const SUMl = u64_default.add4L(s0l, s1l, SHA512_W_L[i - 7], SHA512_W_L[i - 16]);
5930        const SUMh = u64_default.add4H(SUMl, s0h, s1h, SHA512_W_H[i - 7], SHA512_W_H[i - 16]);
5931        SHA512_W_H[i] = SUMh | 0;
5932        SHA512_W_L[i] = SUMl | 0;
5933      }
5934      let { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this;
5935      for (let i = 0; i < 80; i++) {
5936        const sigma1h = u64_default.rotrSH(Eh, El, 14) ^ u64_default.rotrSH(Eh, El, 18) ^ u64_default.rotrBH(Eh, El, 41);
5937        const sigma1l = u64_default.rotrSL(Eh, El, 14) ^ u64_default.rotrSL(Eh, El, 18) ^ u64_default.rotrBL(Eh, El, 41);
5938        const CHIh = Eh & Fh ^ ~Eh & Gh;
5939        const CHIl = El & Fl ^ ~El & Gl;
5940        const T1ll = u64_default.add5L(Hl, sigma1l, CHIl, SHA512_Kl[i], SHA512_W_L[i]);
5941        const T1h = u64_default.add5H(T1ll, Hh, sigma1h, CHIh, SHA512_Kh[i], SHA512_W_H[i]);
5942        const T1l = T1ll | 0;
5943        const sigma0h = u64_default.rotrSH(Ah, Al, 28) ^ u64_default.rotrBH(Ah, Al, 34) ^ u64_default.rotrBH(Ah, Al, 39);
5944        const sigma0l = u64_default.rotrSL(Ah, Al, 28) ^ u64_default.rotrBL(Ah, Al, 34) ^ u64_default.rotrBL(Ah, Al, 39);
5945        const MAJh = Ah & Bh ^ Ah & Ch ^ Bh & Ch;
5946        const MAJl = Al & Bl ^ Al & Cl ^ Bl & Cl;
5947        Hh = Gh | 0;
5948        Hl = Gl | 0;
5949        Gh = Fh | 0;
5950        Gl = Fl | 0;
5951        Fh = Eh | 0;
5952        Fl = El | 0;
5953        ({ h: Eh, l: El } = u64_default.add(Dh | 0, Dl | 0, T1h | 0, T1l | 0));
5954        Dh = Ch | 0;
5955        Dl = Cl | 0;
5956        Ch = Bh | 0;
5957        Cl = Bl | 0;
5958        Bh = Ah | 0;
5959        Bl = Al | 0;
5960        const All = u64_default.add3L(T1l, sigma0l, MAJl);
5961        Ah = u64_default.add3H(All, T1h, sigma0h, MAJh);
5962        Al = All | 0;
5963      }
5964      ({ h: Ah, l: Al } = u64_default.add(this.Ah | 0, this.Al | 0, Ah | 0, Al | 0));
5965      ({ h: Bh, l: Bl } = u64_default.add(this.Bh | 0, this.Bl | 0, Bh | 0, Bl | 0));
5966      ({ h: Ch, l: Cl } = u64_default.add(this.Ch | 0, this.Cl | 0, Ch | 0, Cl | 0));
5967      ({ h: Dh, l: Dl } = u64_default.add(this.Dh | 0, this.Dl | 0, Dh | 0, Dl | 0));
5968      ({ h: Eh, l: El } = u64_default.add(this.Eh | 0, this.El | 0, Eh | 0, El | 0));
5969      ({ h: Fh, l: Fl } = u64_default.add(this.Fh | 0, this.Fl | 0, Fh | 0, Fl | 0));
5970      ({ h: Gh, l: Gl } = u64_default.add(this.Gh | 0, this.Gl | 0, Gh | 0, Gl | 0));
5971      ({ h: Hh, l: Hl } = u64_default.add(this.Hh | 0, this.Hl | 0, Hh | 0, Hl | 0));
5972      this.set(Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl);
5973    }
5974    roundClean() {
5975      SHA512_W_H.fill(0);
5976      SHA512_W_L.fill(0);
5977    }
5978    destroy() {
5979      this.buffer.fill(0);
5980      this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
5981    }
5982  };
5983  var SHA512_224 = class extends SHA512 {
5984    constructor() {
5985      super();
5986      this.Ah = 2352822216 | 0;
5987      this.Al = 424955298 | 0;
5988      this.Bh = 1944164710 | 0;
5989      this.Bl = 2312950998 | 0;
5990      this.Ch = 502970286 | 0;
5991      this.Cl = 855612546 | 0;
5992      this.Dh = 1738396948 | 0;
5993      this.Dl = 1479516111 | 0;
5994      this.Eh = 258812777 | 0;
5995      this.El = 2077511080 | 0;
5996      this.Fh = 2011393907 | 0;
5997      this.Fl = 79989058 | 0;
5998      this.Gh = 1067287976 | 0;
5999      this.Gl = 1780299464 | 0;
6000      this.Hh = 286451373 | 0;
6001      this.Hl = 2446758561 | 0;
6002      this.outputLen = 28;
6003    }
6004  };
6005  var SHA512_256 = class extends SHA512 {
6006    constructor() {
6007      super();
6008      this.Ah = 573645204 | 0;
6009      this.Al = 4230739756 | 0;
6010      this.Bh = 2673172387 | 0;
6011      this.Bl = 3360449730 | 0;
6012      this.Ch = 596883563 | 0;
6013      this.Cl = 1867755857 | 0;
6014      this.Dh = 2520282905 | 0;
6015      this.Dl = 1497426621 | 0;
6016      this.Eh = 2519219938 | 0;
6017      this.El = 2827943907 | 0;
6018      this.Fh = 3193839141 | 0;
6019      this.Fl = 1401305490 | 0;
6020      this.Gh = 721525244 | 0;
6021      this.Gl = 746961066 | 0;
6022      this.Hh = 246885852 | 0;
6023      this.Hl = 2177182882 | 0;
6024      this.outputLen = 32;
6025    }
6026  };
6027  var SHA384 = class extends SHA512 {
6028    constructor() {
6029      super();
6030      this.Ah = 3418070365 | 0;
6031      this.Al = 3238371032 | 0;
6032      this.Bh = 1654270250 | 0;
6033      this.Bl = 914150663 | 0;
6034      this.Ch = 2438529370 | 0;
6035      this.Cl = 812702999 | 0;
6036      this.Dh = 355462360 | 0;
6037      this.Dl = 4144912697 | 0;
6038      this.Eh = 1731405415 | 0;
6039      this.El = 4290775857 | 0;
6040      this.Fh = 2394180231 | 0;
6041      this.Fl = 1750603025 | 0;
6042      this.Gh = 3675008525 | 0;
6043      this.Gl = 1694076839 | 0;
6044      this.Hh = 1203062813 | 0;
6045      this.Hl = 3204075428 | 0;
6046      this.outputLen = 48;
6047    }
6048  };
6049  var sha512 = wrapConstructor(() => new SHA512());
6050  var sha512_224 = wrapConstructor(() => new SHA512_224());
6051  var sha512_256 = wrapConstructor(() => new SHA512_256());
6052  var sha384 = wrapConstructor(() => new SHA384());
6053
6054  
vendor: 2,278 bytes, lines 6054-6114
6054// node_modules/@scure/bip39/esm/index.js
6055  var isJapanese = (wordlist2) => wordlist2[0] === "\u3042\u3044\u3053\u304F\u3057\u3093";
6056  function nfkd(str) {
6057    if (typeof str !== "string")
6058      throw new TypeError(`Invalid mnemonic type: ${typeof str}`);
6059    return str.normalize("NFKD");
6060  }
6061  function normalize2(str) {
6062    const norm = nfkd(str);
6063    const words = norm.split(" ");
6064    if (![12, 15, 18, 21, 24].includes(words.length))
6065      throw new Error("Invalid mnemonic");
6066    return { nfkd: norm, words };
6067  }
6068  function assertEntropy(entropy) {
6069    assert_default.bytes(entropy, 16, 20, 24, 28, 32);
6070  }
6071  function generateMnemonic(wordlist2, strength = 128) {
6072    assert_default.number(strength);
6073    if (strength % 32 !== 0 || strength > 256)
6074      throw new TypeError("Invalid entropy");
6075    return entropyToMnemonic(randomBytes(strength / 8), wordlist2);
6076  }
6077  var calcChecksum = (entropy) => {
6078    const bitsLeft = 8 - entropy.length / 4;
6079    return new Uint8Array([sha256(entropy)[0] >> bitsLeft << bitsLeft]);
6080  };
6081  function getCoder(wordlist2) {
6082    if (!Array.isArray(wordlist2) || wordlist2.length !== 2048 || typeof wordlist2[0] !== "string")
6083      throw new Error("Worlist: expected array of 2048 strings");
6084    wordlist2.forEach((i) => {
6085      if (typeof i !== "string")
6086        throw new Error(`Wordlist: non-string element: ${i}`);
6087    });
6088    return utils.chain(utils.checksum(1, calcChecksum), utils.radix2(11, true), utils.alphabet(wordlist2));
6089  }
6090  function mnemonicToEntropy(mnemonic, wordlist2) {
6091    const { words } = normalize2(mnemonic);
6092    const entropy = getCoder(wordlist2).decode(words);
6093    assertEntropy(entropy);
6094    return entropy;
6095  }
6096  function entropyToMnemonic(entropy, wordlist2) {
6097    assertEntropy(entropy);
6098    const words = getCoder(wordlist2).encode(entropy);
6099    return words.join(isJapanese(wordlist2) ? "\u3000" : " ");
6100  }
6101  function validateMnemonic(mnemonic, wordlist2) {
6102    try {
6103      mnemonicToEntropy(mnemonic, wordlist2);
6104    } catch (e) {
6105      return false;
6106    }
6107    return true;
6108  }
6109  var salt = (passphrase) => nfkd(`mnemonic${passphrase}`);
6110  function mnemonicToSeedSync(mnemonic, passphrase = "") {
6111    return pbkdf2(sha512, normalize2(mnemonic).nfkd, salt(passphrase), { c: 2048, dkLen: 64 });
6112  }
6113
6114  
vendor: 3,198 bytes, lines 6114-6199
6114// node_modules/@noble/hashes/esm/ripemd160.js
6115  var Rho = new Uint8Array([7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8]);
6116  var Id = Uint8Array.from({ length: 16 }, (_, i) => i);
6117  var Pi = Id.map((i) => (9 * i + 5) % 16);
6118  var idxL = [Id];
6119  var idxR = [Pi];
6120  for (let i = 0; i < 4; i++)
6121    for (let j of [idxL, idxR])
6122      j.push(j[i].map((k) => Rho[k]));
6123  var shifts = [
6124    [11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8],
6125    [12, 13, 11, 15, 6, 9, 9, 7, 12, 15, 11, 13, 7, 8, 7, 7],
6126    [13, 15, 14, 11, 7, 7, 6, 8, 13, 14, 13, 12, 5, 5, 6, 9],
6127    [14, 11, 12, 14, 8, 6, 5, 5, 15, 12, 15, 14, 9, 9, 8, 6],
6128    [15, 12, 13, 13, 9, 5, 8, 6, 14, 11, 12, 11, 8, 6, 5, 5]
6129  ].map((i) => new Uint8Array(i));
6130  var shiftsL = idxL.map((idx, i) => idx.map((j) => shifts[i][j]));
6131  var shiftsR = idxR.map((idx, i) => idx.map((j) => shifts[i][j]));
6132  var Kl = new Uint32Array([0, 1518500249, 1859775393, 2400959708, 2840853838]);
6133  var Kr = new Uint32Array([1352829926, 1548603684, 1836072691, 2053994217, 0]);
6134  var rotl = (word, shift) => word << shift | word >>> 32 - shift;
6135  function f(group, x, y, z) {
6136    if (group === 0)
6137      return x ^ y ^ z;
6138    else if (group === 1)
6139      return x & y | ~x & z;
6140    else if (group === 2)
6141      return (x | ~y) ^ z;
6142    else if (group === 3)
6143      return x & z | y & ~z;
6144    else
6145      return x ^ (y | ~z);
6146  }
6147  var BUF = new Uint32Array(16);
6148  var RIPEMD160 = class extends SHA2 {
6149    constructor() {
6150      super(64, 20, 8, true);
6151      this.h0 = 1732584193 | 0;
6152      this.h1 = 4023233417 | 0;
6153      this.h2 = 2562383102 | 0;
6154      this.h3 = 271733878 | 0;
6155      this.h4 = 3285377520 | 0;
6156    }
6157    get() {
6158      const { h0, h1, h2, h3, h4 } = this;
6159      return [h0, h1, h2, h3, h4];
6160    }
6161    set(h0, h1, h2, h3, h4) {
6162      this.h0 = h0 | 0;
6163      this.h1 = h1 | 0;
6164      this.h2 = h2 | 0;
6165      this.h3 = h3 | 0;
6166      this.h4 = h4 | 0;
6167    }
6168    process(view, offset) {
6169      for (let i = 0; i < 16; i++, offset += 4)
6170        BUF[i] = view.getUint32(offset, true);
6171      let al = this.h0 | 0, ar = al, bl = this.h1 | 0, br = bl, cl = this.h2 | 0, cr = cl, dl = this.h3 | 0, dr = dl, el = this.h4 | 0, er = el;
6172      for (let group = 0; group < 5; group++) {
6173        const rGroup = 4 - group;
6174        const hbl = Kl[group], hbr = Kr[group];
6175        const rl = idxL[group], rr = idxR[group];
6176        const sl = shiftsL[group], sr = shiftsR[group];
6177        for (let i = 0; i < 16; i++) {
6178          const tl = rotl(al + f(group, bl, cl, dl) + BUF[rl[i]] + hbl, sl[i]) + el | 0;
6179          al = el, el = dl, dl = rotl(cl, 10) | 0, cl = bl, bl = tl;
6180        }
6181        for (let i = 0; i < 16; i++) {
6182          const tr = rotl(ar + f(rGroup, br, cr, dr) + BUF[rr[i]] + hbr, sr[i]) + er | 0;
6183          ar = er, er = dr, dr = rotl(cr, 10) | 0, cr = br, br = tr;
6184        }
6185      }
6186      this.set(this.h1 + cl + dr | 0, this.h2 + dl + er | 0, this.h3 + el + ar | 0, this.h4 + al + br | 0, this.h0 + bl + cr | 0);
6187    }
6188    roundClean() {
6189      BUF.fill(0);
6190    }
6191    destroy() {
6192      this.destroyed = true;
6193      this.buffer.fill(0);
6194      this.set(0, 0, 0, 0, 0);
6195    }
6196  };
6197  var ripemd160 = wrapConstructor(() => new RIPEMD160());
6198
6199  
vendor: 21,320 bytes, lines 6199-6920
6199// node_modules/@scure/bip32/lib/esm/index.js
6200  var Point2 = secp256k1.ProjectivePoint;
6201  var base58check2 = base58check(sha256);
6202  function bytesToNumber(bytes3) {
6203    return BigInt(`0x${bytesToHex(bytes3)}`);
6204  }
6205  function numberToBytes(num) {
6206    return hexToBytes(num.toString(16).padStart(64, "0"));
6207  }
6208  var MASTER_SECRET = utf8ToBytes("Bitcoin seed");
6209  var BITCOIN_VERSIONS = { private: 76066276, public: 76067358 };
6210  var HARDENED_OFFSET = 2147483648;
6211  var hash160 = (data) => ripemd160(sha256(data));
6212  var fromU32 = (data) => createView(data).getUint32(0, false);
6213  var toU32 = (n) => {
6214    if (!Number.isSafeInteger(n) || n < 0 || n > 2 ** 32 - 1) {
6215      throw new Error(`Invalid number=${n}. Should be from 0 to 2 ** 32 - 1`);
6216    }
6217    const buf = new Uint8Array(4);
6218    createView(buf).setUint32(0, n, false);
6219    return buf;
6220  };
6221  var HDKey = class {
6222    get fingerprint() {
6223      if (!this.pubHash) {
6224        throw new Error("No publicKey set!");
6225      }
6226      return fromU32(this.pubHash);
6227    }
6228    get identifier() {
6229      return this.pubHash;
6230    }
6231    get pubKeyHash() {
6232      return this.pubHash;
6233    }
6234    get privateKey() {
6235      return this.privKeyBytes || null;
6236    }
6237    get publicKey() {
6238      return this.pubKey || null;
6239    }
6240    get privateExtendedKey() {
6241      const priv = this.privateKey;
6242      if (!priv) {
6243        throw new Error("No private key");
6244      }
6245      return base58check2.encode(this.serialize(this.versions.private, concatBytes(new Uint8Array([0]), priv)));
6246    }
6247    get publicExtendedKey() {
6248      if (!this.pubKey) {
6249        throw new Error("No public key");
6250      }
6251      return base58check2.encode(this.serialize(this.versions.public, this.pubKey));
6252    }
6253    static fromMasterSeed(seed, versions = BITCOIN_VERSIONS) {
6254      bytes(seed);
6255      if (8 * seed.length < 128 || 8 * seed.length > 512) {
6256        throw new Error(`HDKey: wrong seed length=${seed.length}. Should be between 128 and 512 bits; 256 bits is advised)`);
6257      }
6258      const I = hmac(sha512, MASTER_SECRET, seed);
6259      return new HDKey({
6260        versions,
6261        chainCode: I.slice(32),
6262        privateKey: I.slice(0, 32)
6263      });
6264    }
6265    static fromExtendedKey(base58key, versions = BITCOIN_VERSIONS) {
6266      const keyBuffer = base58check2.decode(base58key);
6267      const keyView = createView(keyBuffer);
6268      const version = keyView.getUint32(0, false);
6269      const opt = {
6270        versions,
6271        depth: keyBuffer[4],
6272        parentFingerprint: keyView.getUint32(5, false),
6273        index: keyView.getUint32(9, false),
6274        chainCode: keyBuffer.slice(13, 45)
6275      };
6276      const key = keyBuffer.slice(45);
6277      const isPriv = key[0] === 0;
6278      if (version !== versions[isPriv ? "private" : "public"]) {
6279        throw new Error("Version mismatch");
6280      }
6281      if (isPriv) {
6282        return new HDKey({ ...opt, privateKey: key.slice(1) });
6283      } else {
6284        return new HDKey({ ...opt, publicKey: key });
6285      }
6286    }
6287    static fromJSON(json) {
6288      return HDKey.fromExtendedKey(json.xpriv);
6289    }
6290    constructor(opt) {
6291      this.depth = 0;
6292      this.index = 0;
6293      this.chainCode = null;
6294      this.parentFingerprint = 0;
6295      if (!opt || typeof opt !== "object") {
6296        throw new Error("HDKey.constructor must not be called directly");
6297      }
6298      this.versions = opt.versions || BITCOIN_VERSIONS;
6299      this.depth = opt.depth || 0;
6300      this.chainCode = opt.chainCode;
6301      this.index = opt.index || 0;
6302      this.parentFingerprint = opt.parentFingerprint || 0;
6303      if (!this.depth) {
6304        if (this.parentFingerprint || this.index) {
6305          throw new Error("HDKey: zero depth with non-zero index/parent fingerprint");
6306        }
6307      }
6308      if (opt.publicKey && opt.privateKey) {
6309        throw new Error("HDKey: publicKey and privateKey at same time.");
6310      }
6311      if (opt.privateKey) {
6312        if (!secp256k1.utils.isValidPrivateKey(opt.privateKey)) {
6313          throw new Error("Invalid private key");
6314        }
6315        this.privKey = typeof opt.privateKey === "bigint" ? opt.privateKey : bytesToNumber(opt.privateKey);
6316        this.privKeyBytes = numberToBytes(this.privKey);
6317        this.pubKey = secp256k1.getPublicKey(opt.privateKey, true);
6318      } else if (opt.publicKey) {
6319        this.pubKey = Point2.fromHex(opt.publicKey).toRawBytes(true);
6320      } else {
6321        throw new Error("HDKey: no public or private key provided");
6322      }
6323      this.pubHash = hash160(this.pubKey);
6324    }
6325    derive(path) {
6326      if (!/^[mM]'?/.test(path)) {
6327        throw new Error('Path must start with "m" or "M"');
6328      }
6329      if (/^[mM]'?$/.test(path)) {
6330        return this;
6331      }
6332      const parts = path.replace(/^[mM]'?\//, "").split("/");
6333      let child = this;
6334      for (const c of parts) {
6335        const m = /^(\d+)('?)$/.exec(c);
6336        if (!m || m.length !== 3) {
6337          throw new Error(`Invalid child index: ${c}`);
6338        }
6339        let idx = +m[1];
6340        if (!Number.isSafeInteger(idx) || idx >= HARDENED_OFFSET) {
6341          throw new Error("Invalid index");
6342        }
6343        if (m[2] === "'") {
6344          idx += HARDENED_OFFSET;
6345        }
6346        child = child.deriveChild(idx);
6347      }
6348      return child;
6349    }
6350    deriveChild(index) {
6351      if (!this.pubKey || !this.chainCode) {
6352        throw new Error("No publicKey or chainCode set");
6353      }
6354      let data = toU32(index);
6355      if (index >= HARDENED_OFFSET) {
6356        const priv = this.privateKey;
6357        if (!priv) {
6358          throw new Error("Could not derive hardened child key");
6359        }
6360        data = concatBytes(new Uint8Array([0]), priv, data);
6361      } else {
6362        data = concatBytes(this.pubKey, data);
6363      }
6364      const I = hmac(sha512, this.chainCode, data);
6365      const childTweak = bytesToNumber(I.slice(0, 32));
6366      const chainCode = I.slice(32);
6367      if (!secp256k1.utils.isValidPrivateKey(childTweak)) {
6368        throw new Error("Tweak bigger than curve order");
6369      }
6370      const opt = {
6371        versions: this.versions,
6372        chainCode,
6373        depth: this.depth + 1,
6374        parentFingerprint: this.fingerprint,
6375        index
6376      };
6377      try {
6378        if (this.privateKey) {
6379          const added = mod(this.privKey + childTweak, secp256k1.CURVE.n);
6380          if (!secp256k1.utils.isValidPrivateKey(added)) {
6381            throw new Error("The tweak was out of range or the resulted private key is invalid");
6382          }
6383          opt.privateKey = added;
6384        } else {
6385          const added = Point2.fromHex(this.pubKey).add(Point2.fromPrivateKey(childTweak));
6386          if (added.equals(Point2.ZERO)) {
6387            throw new Error("The tweak was equal to negative P, which made the result key invalid");
6388          }
6389          opt.publicKey = added.toRawBytes(true);
6390        }
6391        return new HDKey(opt);
6392      } catch (err) {
6393        return this.deriveChild(index + 1);
6394      }
6395    }
6396    sign(hash3) {
6397      if (!this.privateKey) {
6398        throw new Error("No privateKey set!");
6399      }
6400      bytes(hash3, 32);
6401      return secp256k1.sign(hash3, this.privKey).toCompactRawBytes();
6402    }
6403    verify(hash3, signature) {
6404      bytes(hash3, 32);
6405      bytes(signature, 64);
6406      if (!this.publicKey) {
6407        throw new Error("No publicKey set!");
6408      }
6409      let sig;
6410      try {
6411        sig = secp256k1.Signature.fromCompact(signature);
6412      } catch (error) {
6413        return false;
6414      }
6415      return secp256k1.verify(sig, hash3, this.publicKey);
6416    }
6417    wipePrivateData() {
6418      this.privKey = void 0;
6419      if (this.privKeyBytes) {
6420        this.privKeyBytes.fill(0);
6421        this.privKeyBytes = void 0;
6422      }
6423      return this;
6424    }
6425    toJSON() {
6426      return {
6427        xpriv: this.privateExtendedKey,
6428        xpub: this.publicExtendedKey
6429      };
6430    }
6431    serialize(version, key) {
6432      if (!this.chainCode) {
6433        throw new Error("No chainCode set");
6434      }
6435      bytes(key, 33);
6436      return concatBytes(toU32(version), new Uint8Array([this.depth]), toU32(this.parentFingerprint), toU32(this.index), this.chainCode, key);
6437    }
6438  };
6439
6440  // nip06.ts
6441  function privateKeyFromSeedWords(mnemonic, passphrase) {
6442    let root = HDKey.fromMasterSeed(mnemonicToSeedSync(mnemonic, passphrase));
6443    let privateKey = root.derive(`m/44'/1237'/0'/0/0`).privateKey;
6444    if (!privateKey)
6445      throw new Error("could not derive private key");
6446    return bytesToHex(privateKey);
6447  }
6448  function generateSeedWords() {
6449    return generateMnemonic(wordlist);
6450  }
6451  function validateWords(words) {
6452    return validateMnemonic(words, wordlist);
6453  }
6454
6455  // nip10.ts
6456  var nip10_exports = {};
6457  __export(nip10_exports, {
6458    parse: () => parse
6459  });
6460  function parse(event) {
6461    const result = {
6462      reply: void 0,
6463      root: void 0,
6464      mentions: [],
6465      profiles: []
6466    };
6467    const eTags = [];
6468    for (const tag of event.tags) {
6469      if (tag[0] === "e" && tag[1]) {
6470        eTags.push(tag);
6471      }
6472      if (tag[0] === "p" && tag[1]) {
6473        result.profiles.push({
6474          pubkey: tag[1],
6475          relays: tag[2] ? [tag[2]] : []
6476        });
6477      }
6478    }
6479    for (let eTagIndex = 0; eTagIndex < eTags.length; eTagIndex++) {
6480      const eTag = eTags[eTagIndex];
6481      const [_, eTagEventId, eTagRelayUrl, eTagMarker] = eTag;
6482      const eventPointer = {
6483        id: eTagEventId,
6484        relays: eTagRelayUrl ? [eTagRelayUrl] : []
6485      };
6486      const isFirstETag = eTagIndex === 0;
6487      const isLastETag = eTagIndex === eTags.length - 1;
6488      if (eTagMarker === "root") {
6489        result.root = eventPointer;
6490        continue;
6491      }
6492      if (eTagMarker === "reply") {
6493        result.reply = eventPointer;
6494        continue;
6495      }
6496      if (eTagMarker === "mention") {
6497        result.mentions.push(eventPointer);
6498        continue;
6499      }
6500      if (isFirstETag) {
6501        result.root = eventPointer;
6502        continue;
6503      }
6504      if (isLastETag) {
6505        result.reply = eventPointer;
6506        continue;
6507      }
6508      result.mentions.push(eventPointer);
6509    }
6510    return result;
6511  }
6512
6513  // nip13.ts
6514  var nip13_exports = {};
6515  __export(nip13_exports, {
6516    getPow: () => getPow,
6517    minePow: () => minePow
6518  });
6519  function getPow(hex2) {
6520    let count = 0;
6521    for (let i = 0; i < hex2.length; i++) {
6522      const nibble = parseInt(hex2[i], 16);
6523      if (nibble === 0) {
6524        count += 4;
6525      } else {
6526        count += Math.clz32(nibble) - 28;
6527        break;
6528      }
6529    }
6530    return count;
6531  }
6532  function minePow(unsigned, difficulty) {
6533    let count = 0;
6534    const event = unsigned;
6535    const tag = ["nonce", count.toString(), difficulty.toString()];
6536    event.tags.push(tag);
6537    while (true) {
6538      const now = Math.floor(new Date().getTime() / 1e3);
6539      if (now !== event.created_at) {
6540        count = 0;
6541        event.created_at = now;
6542      }
6543      tag[1] = (++count).toString();
6544      event.id = getEventHash(event);
6545      if (getPow(event.id) >= difficulty) {
6546        break;
6547      }
6548    }
6549    return event;
6550  }
6551
6552  // nip18.ts
6553  var nip18_exports = {};
6554  __export(nip18_exports, {
6555    finishRepostEvent: () => finishRepostEvent,
6556    getRepostedEvent: () => getRepostedEvent,
6557    getRepostedEventPointer: () => getRepostedEventPointer
6558  });
6559  function finishRepostEvent(t, reposted, relayUrl, privateKey) {
6560    return finishEvent(
6561      {
6562        kind: 6 /* Repost */,
6563        tags: [...t.tags ?? [], ["e", reposted.id, relayUrl], ["p", reposted.pubkey]],
6564        content: t.content === "" ? "" : JSON.stringify(reposted),
6565        created_at: t.created_at
6566      },
6567      privateKey
6568    );
6569  }
6570  function getRepostedEventPointer(event) {
6571    if (event.kind !== 6 /* Repost */) {
6572      return void 0;
6573    }
6574    let lastETag;
6575    let lastPTag;
6576    for (let i = event.tags.length - 1; i >= 0 && (lastETag === void 0 || lastPTag === void 0); i--) {
6577      const tag = event.tags[i];
6578      if (tag.length >= 2) {
6579        if (tag[0] === "e" && lastETag === void 0) {
6580          lastETag = tag;
6581        } else if (tag[0] === "p" && lastPTag === void 0) {
6582          lastPTag = tag;
6583        }
6584      }
6585    }
6586    if (lastETag === void 0) {
6587      return void 0;
6588    }
6589    return {
6590      id: lastETag[1],
6591      relays: [lastETag[2], lastPTag?.[2]].filter((x) => typeof x === "string"),
6592      author: lastPTag?.[1]
6593    };
6594  }
6595  function getRepostedEvent(event, { skipVerification } = {}) {
6596    const pointer = getRepostedEventPointer(event);
6597    if (pointer === void 0 || event.content === "") {
6598      return void 0;
6599    }
6600    let repostedEvent;
6601    try {
6602      repostedEvent = JSON.parse(event.content);
6603    } catch (error) {
6604      return void 0;
6605    }
6606    if (repostedEvent.id !== pointer.id) {
6607      return void 0;
6608    }
6609    if (!skipVerification && !verifySignature(repostedEvent)) {
6610      return void 0;
6611    }
6612    return repostedEvent;
6613  }
6614
6615  // nip21.ts
6616  var nip21_exports = {};
6617  __export(nip21_exports, {
6618    NOSTR_URI_REGEX: () => NOSTR_URI_REGEX,
6619    parse: () => parse2,
6620    test: () => test
6621  });
6622  var NOSTR_URI_REGEX = new RegExp(`nostr:(${BECH32_REGEX.source})`);
6623  function test(value) {
6624    return typeof value === "string" && new RegExp(`^${NOSTR_URI_REGEX.source}$`).test(value);
6625  }
6626  function parse2(uri) {
6627    const match = uri.match(new RegExp(`^${NOSTR_URI_REGEX.source}$`));
6628    if (!match)
6629      throw new Error(`Invalid Nostr URI: ${uri}`);
6630    return {
6631      uri: match[0],
6632      value: match[1],
6633      decoded: decode(match[1])
6634    };
6635  }
6636
6637  // nip25.ts
6638  var nip25_exports = {};
6639  __export(nip25_exports, {
6640    finishReactionEvent: () => finishReactionEvent,
6641    getReactedEventPointer: () => getReactedEventPointer
6642  });
6643  function finishReactionEvent(t, reacted, privateKey) {
6644    const inheritedTags = reacted.tags.filter((tag) => tag.length >= 2 && (tag[0] === "e" || tag[0] === "p"));
6645    return finishEvent(
6646      {
6647        ...t,
6648        kind: 7 /* Reaction */,
6649        tags: [...t.tags ?? [], ...inheritedTags, ["e", reacted.id], ["p", reacted.pubkey]],
6650        content: t.content ?? "+"
6651      },
6652      privateKey
6653    );
6654  }
6655  function getReactedEventPointer(event) {
6656    if (event.kind !== 7 /* Reaction */) {
6657      return void 0;
6658    }
6659    let lastETag;
6660    let lastPTag;
6661    for (let i = event.tags.length - 1; i >= 0 && (lastETag === void 0 || lastPTag === void 0); i--) {
6662      const tag = event.tags[i];
6663      if (tag.length >= 2) {
6664        if (tag[0] === "e" && lastETag === void 0) {
6665          lastETag = tag;
6666        } else if (tag[0] === "p" && lastPTag === void 0) {
6667          lastPTag = tag;
6668        }
6669      }
6670    }
6671    if (lastETag === void 0 || lastPTag === void 0) {
6672      return void 0;
6673    }
6674    return {
6675      id: lastETag[1],
6676      relays: [lastETag[2], lastPTag[2]].filter((x) => x !== void 0),
6677      author: lastPTag[1]
6678    };
6679  }
6680
6681  // nip26.ts
6682  var nip26_exports = {};
6683  __export(nip26_exports, {
6684    createDelegation: () => createDelegation,
6685    getDelegator: () => getDelegator
6686  });
6687  function createDelegation(privateKey, parameters) {
6688    let conditions = [];
6689    if ((parameters.kind || -1) >= 0)
6690      conditions.push(`kind=${parameters.kind}`);
6691    if (parameters.until)
6692      conditions.push(`created_at<${parameters.until}`);
6693    if (parameters.since)
6694      conditions.push(`created_at>${parameters.since}`);
6695    let cond = conditions.join("&");
6696    if (cond === "")
6697      throw new Error("refusing to create a delegation without any conditions");
6698    let sighash = sha256(utf8Encoder.encode(`nostr:delegation:${parameters.pubkey}:${cond}`));
6699    let sig = bytesToHex(schnorr.sign(sighash, privateKey));
6700    return {
6701      from: getPublicKey(privateKey),
6702      to: parameters.pubkey,
6703      cond,
6704      sig
6705    };
6706  }
6707  function getDelegator(event) {
6708    let tag = event.tags.find((tag2) => tag2[0] === "delegation" && tag2.length >= 4);
6709    if (!tag)
6710      return null;
6711    let pubkey = tag[1];
6712    let cond = tag[2];
6713    let sig = tag[3];
6714    let conditions = cond.split("&");
6715    for (let i = 0; i < conditions.length; i++) {
6716      let [key, operator, value] = conditions[i].split(/\b/);
6717      if (key === "kind" && operator === "=" && event.kind === parseInt(value))
6718        continue;
6719      else if (key === "created_at" && operator === "<" && event.created_at < parseInt(value))
6720        continue;
6721      else if (key === "created_at" && operator === ">" && event.created_at > parseInt(value))
6722        continue;
6723      else
6724        return null;
6725    }
6726    let sighash = sha256(utf8Encoder.encode(`nostr:delegation:${event.pubkey}:${cond}`));
6727    if (!schnorr.verify(sig, sighash, pubkey))
6728      return null;
6729    return pubkey;
6730  }
6731
6732  // nip27.ts
6733  var nip27_exports = {};
6734  __export(nip27_exports, {
6735    matchAll: () => matchAll,
6736    regex: () => regex,
6737    replaceAll: () => replaceAll
6738  });
6739  var regex = () => new RegExp(`\\b${NOSTR_URI_REGEX.source}\\b`, "g");
6740  function* matchAll(content) {
6741    const matches = content.matchAll(regex());
6742    for (const match of matches) {
6743      try {
6744        const [uri, value] = match;
6745        yield {
6746          uri,
6747          value,
6748          decoded: decode(value),
6749          start: match.index,
6750          end: match.index + uri.length
6751        };
6752      } catch (_e) {
6753      }
6754    }
6755  }
6756  function replaceAll(content, replacer) {
6757    return content.replaceAll(regex(), (uri, value) => {
6758      return replacer({
6759        uri,
6760        value,
6761        decoded: decode(value)
6762      });
6763    });
6764  }
6765
6766  // nip28.ts
6767  var nip28_exports = {};
6768  __export(nip28_exports, {
6769    channelCreateEvent: () => channelCreateEvent,
6770    channelHideMessageEvent: () => channelHideMessageEvent,
6771    channelMessageEvent: () => channelMessageEvent,
6772    channelMetadataEvent: () => channelMetadataEvent,
6773    channelMuteUserEvent: () => channelMuteUserEvent
6774  });
6775  var channelCreateEvent = (t, privateKey) => {
6776    let content;
6777    if (typeof t.content === "object") {
6778      content = JSON.stringify(t.content);
6779    } else if (typeof t.content === "string") {
6780      content = t.content;
6781    } else {
6782      return void 0;
6783    }
6784    return finishEvent(
6785      {
6786        kind: 40 /* ChannelCreation */,
6787        tags: [...t.tags ?? []],
6788        content,
6789        created_at: t.created_at
6790      },
6791      privateKey
6792    );
6793  };
6794  var channelMetadataEvent = (t, privateKey) => {
6795    let content;
6796    if (typeof t.content === "object") {
6797      content = JSON.stringify(t.content);
6798    } else if (typeof t.content === "string") {
6799      content = t.content;
6800    } else {
6801      return void 0;
6802    }
6803    return finishEvent(
6804      {
6805        kind: 41 /* ChannelMetadata */,
6806        tags: [["e", t.channel_create_event_id], ...t.tags ?? []],
6807        content,
6808        created_at: t.created_at
6809      },
6810      privateKey
6811    );
6812  };
6813  var channelMessageEvent = (t, privateKey) => {
6814    const tags = [["e", t.channel_create_event_id, t.relay_url, "root"]];
6815    if (t.reply_to_channel_message_event_id) {
6816      tags.push(["e", t.reply_to_channel_message_event_id, t.relay_url, "reply"]);
6817    }
6818    return finishEvent(
6819      {
6820        kind: 42 /* ChannelMessage */,
6821        tags: [...tags, ...t.tags ?? []],
6822        content: t.content,
6823        created_at: t.created_at
6824      },
6825      privateKey
6826    );
6827  };
6828  var channelHideMessageEvent = (t, privateKey) => {
6829    let content;
6830    if (typeof t.content === "object") {
6831      content = JSON.stringify(t.content);
6832    } else if (typeof t.content === "string") {
6833      content = t.content;
6834    } else {
6835      return void 0;
6836    }
6837    return finishEvent(
6838      {
6839        kind: 43 /* ChannelHideMessage */,
6840        tags: [["e", t.channel_message_event_id], ...t.tags ?? []],
6841        content,
6842        created_at: t.created_at
6843      },
6844      privateKey
6845    );
6846  };
6847  var channelMuteUserEvent = (t, privateKey) => {
6848    let content;
6849    if (typeof t.content === "object") {
6850      content = JSON.stringify(t.content);
6851    } else if (typeof t.content === "string") {
6852      content = t.content;
6853    } else {
6854      return void 0;
6855    }
6856    return finishEvent(
6857      {
6858        kind: 44 /* ChannelMuteUser */,
6859        tags: [["p", t.pubkey_to_mute], ...t.tags ?? []],
6860        content,
6861        created_at: t.created_at
6862      },
6863      privateKey
6864    );
6865  };
6866
6867  // nip39.ts
6868  var nip39_exports = {};
6869  __export(nip39_exports, {
6870    useFetchImplementation: () => useFetchImplementation2,
6871    validateGithub: () => validateGithub
6872  });
6873  var _fetch2;
6874  try {
6875    _fetch2 = fetch;
6876  } catch {
6877  }
6878  function useFetchImplementation2(fetchImplementation) {
6879    _fetch2 = fetchImplementation;
6880  }
6881  async function validateGithub(pubkey, username, proof) {
6882    try {
6883      let res = await (await _fetch2(`https://gist.github.com/${username}/${proof}/raw`)).text();
6884      return res === `Verifying that I control the following Nostr public key: ${pubkey}`;
6885    } catch (_) {
6886      return false;
6887    }
6888  }
6889
6890  // nip42.ts
6891  var nip42_exports = {};
6892  __export(nip42_exports, {
6893    authenticate: () => authenticate
6894  });
6895  var authenticate = async ({
6896    challenge: challenge2,
6897    relay,
6898    sign
6899  }) => {
6900    const e = {
6901      kind: 22242 /* ClientAuth */,
6902      created_at: Math.floor(Date.now() / 1e3),
6903      tags: [
6904        ["relay", relay.url],
6905        ["challenge", challenge2]
6906      ],
6907      content: ""
6908    };
6909    return relay.auth(await sign(e));
6910  };
6911
6912  // nip44.ts
6913  var nip44_exports = {};
6914  __export(nip44_exports, {
6915    decrypt: () => decrypt2,
6916    encrypt: () => encrypt2,
6917    utils: () => utils2
6918  });
6919
6920  
vendor: 1,635 bytes, lines 6920-6962
6920// node_modules/@noble/ciphers/esm/utils.js
6921  var u8a3 = (a) => a instanceof Uint8Array;
6922  var u32 = (arr) => new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));
6923  var isLE2 = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
6924  if (!isLE2)
6925    throw new Error("Non little-endian hardware is not supported");
6926  function utf8ToBytes3(str) {
6927    if (typeof str !== "string")
6928      throw new Error(`utf8ToBytes expected string, got ${typeof str}`);
6929    return new Uint8Array(new TextEncoder().encode(str));
6930  }
6931  function toBytes2(data) {
6932    if (typeof data === "string")
6933      data = utf8ToBytes3(data);
6934    if (!u8a3(data))
6935      throw new Error(`expected Uint8Array, got ${typeof data}`);
6936    return data;
6937  }
6938  var isPlainObject2 = (obj) => Object.prototype.toString.call(obj) === "[object Object]" && obj.constructor === Object;
6939  function checkOpts2(defaults, opts) {
6940    if (opts !== void 0 && (typeof opts !== "object" || !isPlainObject2(opts)))
6941      throw new Error("options must be object or undefined");
6942    const merged = Object.assign(defaults, opts);
6943    return merged;
6944  }
6945  function ensureBytes2(b, len) {
6946    if (!(b instanceof Uint8Array))
6947      throw new Error("Uint8Array expected");
6948    if (typeof len === "number") {
6949      if (b.length !== len)
6950        throw new Error(`Uint8Array length ${len} expected`);
6951    }
6952  }
6953  function equalBytes2(a, b) {
6954    if (a.length !== b.length)
6955      throw new Error("equalBytes: Different size of Uint8Arrays");
6956    let isSame = true;
6957    for (let i = 0; i < a.length; i++)
6958      isSame && (isSame = a[i] === b[i]);
6959    return isSame;
6960  }
6961
6962  
vendor: 1,407 bytes, lines 6962-6999
6962// node_modules/@noble/ciphers/esm/_assert.js
6963  function number2(n) {
6964    if (!Number.isSafeInteger(n) || n < 0)
6965      throw new Error(`Wrong positive integer: ${n}`);
6966  }
6967  function bool2(b) {
6968    if (typeof b !== "boolean")
6969      throw new Error(`Expected boolean, not ${b}`);
6970  }
6971  function bytes2(b, ...lengths) {
6972    if (!(b instanceof Uint8Array))
6973      throw new Error("Expected Uint8Array");
6974    if (lengths.length > 0 && !lengths.includes(b.length))
6975      throw new Error(`Expected Uint8Array of length ${lengths}, not of length=${b.length}`);
6976  }
6977  function hash2(hash3) {
6978    if (typeof hash3 !== "function" || typeof hash3.create !== "function")
6979      throw new Error("hash must be wrapped by utils.wrapConstructor");
6980    number2(hash3.outputLen);
6981    number2(hash3.blockLen);
6982  }
6983  function exists2(instance, checkFinished = true) {
6984    if (instance.destroyed)
6985      throw new Error("Hash instance has been destroyed");
6986    if (checkFinished && instance.finished)
6987      throw new Error("Hash#digest() has already been called");
6988  }
6989  function output2(out, instance) {
6990    bytes2(out);
6991    const min = instance.outputLen;
6992    if (out.length < min) {
6993      throw new Error(`digestInto() expects output buffer of length at least ${min}`);
6994    }
6995  }
6996  var assert2 = { number: number2, bool: bool2, bytes: bytes2, hash: hash2, exists: exists2, output: output2 };
6997  var assert_default2 = assert2;
6998
6999  
vendor: 8,289 bytes, lines 6999-7255
6999// node_modules/@noble/ciphers/esm/_poly1305.js
7000  var u8to16 = (a, i) => a[i++] & 255 | (a[i++] & 255) << 8;
7001  var Poly1305 = class {
7002    constructor(key) {
7003      this.blockLen = 16;
7004      this.outputLen = 16;
7005      this.buffer = new Uint8Array(16);
7006      this.r = new Uint16Array(10);
7007      this.h = new Uint16Array(10);
7008      this.pad = new Uint16Array(8);
7009      this.pos = 0;
7010      this.finished = false;
7011      key = toBytes2(key);
7012      ensureBytes2(key, 32);
7013      const t0 = u8to16(key, 0);
7014      const t1 = u8to16(key, 2);
7015      const t2 = u8to16(key, 4);
7016      const t3 = u8to16(key, 6);
7017      const t4 = u8to16(key, 8);
7018      const t5 = u8to16(key, 10);
7019      const t6 = u8to16(key, 12);
7020      const t7 = u8to16(key, 14);
7021      this.r[0] = t0 & 8191;
7022      this.r[1] = (t0 >>> 13 | t1 << 3) & 8191;
7023      this.r[2] = (t1 >>> 10 | t2 << 6) & 7939;
7024      this.r[3] = (t2 >>> 7 | t3 << 9) & 8191;
7025      this.r[4] = (t3 >>> 4 | t4 << 12) & 255;
7026      this.r[5] = t4 >>> 1 & 8190;
7027      this.r[6] = (t4 >>> 14 | t5 << 2) & 8191;
7028      this.r[7] = (t5 >>> 11 | t6 << 5) & 8065;
7029      this.r[8] = (t6 >>> 8 | t7 << 8) & 8191;
7030      this.r[9] = t7 >>> 5 & 127;
7031      for (let i = 0; i < 8; i++)
7032        this.pad[i] = u8to16(key, 16 + 2 * i);
7033    }
7034    process(data, offset, isLast = false) {
7035      const hibit = isLast ? 0 : 1 << 11;
7036      const { h, r } = this;
7037      const r0 = r[0];
7038      const r1 = r[1];
7039      const r2 = r[2];
7040      const r3 = r[3];
7041      const r4 = r[4];
7042      const r5 = r[5];
7043      const r6 = r[6];
7044      const r7 = r[7];
7045      const r8 = r[8];
7046      const r9 = r[9];
7047      const t0 = u8to16(data, offset + 0);
7048      const t1 = u8to16(data, offset + 2);
7049      const t2 = u8to16(data, offset + 4);
7050      const t3 = u8to16(data, offset + 6);
7051      const t4 = u8to16(data, offset + 8);
7052      const t5 = u8to16(data, offset + 10);
7053      const t6 = u8to16(data, offset + 12);
7054      const t7 = u8to16(data, offset + 14);
7055      let h0 = h[0] + (t0 & 8191);
7056      let h1 = h[1] + ((t0 >>> 13 | t1 << 3) & 8191);
7057      let h2 = h[2] + ((t1 >>> 10 | t2 << 6) & 8191);
7058      let h3 = h[3] + ((t2 >>> 7 | t3 << 9) & 8191);
7059      let h4 = h[4] + ((t3 >>> 4 | t4 << 12) & 8191);
7060      let h5 = h[5] + (t4 >>> 1 & 8191);
7061      let h6 = h[6] + ((t4 >>> 14 | t5 << 2) & 8191);
7062      let h7 = h[7] + ((t5 >>> 11 | t6 << 5) & 8191);
7063      let h8 = h[8] + ((t6 >>> 8 | t7 << 8) & 8191);
7064      let h9 = h[9] + (t7 >>> 5 | hibit);
7065      let c = 0;
7066      let d0 = c + h0 * r0 + h1 * (5 * r9) + h2 * (5 * r8) + h3 * (5 * r7) + h4 * (5 * r6);
7067      c = d0 >>> 13;
7068      d0 &= 8191;
7069      d0 += h5 * (5 * r5) + h6 * (5 * r4) + h7 * (5 * r3) + h8 * (5 * r2) + h9 * (5 * r1);
7070      c += d0 >>> 13;
7071      d0 &= 8191;
7072      let d1 = c + h0 * r1 + h1 * r0 + h2 * (5 * r9) + h3 * (5 * r8) + h4 * (5 * r7);
7073      c = d1 >>> 13;
7074      d1 &= 8191;
7075      d1 += h5 * (5 * r6) + h6 * (5 * r5) + h7 * (5 * r4) + h8 * (5 * r3) + h9 * (5 * r2);
7076      c += d1 >>> 13;
7077      d1 &= 8191;
7078      let d2 = c + h0 * r2 + h1 * r1 + h2 * r0 + h3 * (5 * r9) + h4 * (5 * r8);
7079      c = d2 >>> 13;
7080      d2 &= 8191;
7081      d2 += h5 * (5 * r7) + h6 * (5 * r6) + h7 * (5 * r5) + h8 * (5 * r4) + h9 * (5 * r3);
7082      c += d2 >>> 13;
7083      d2 &= 8191;
7084      let d3 = c + h0 * r3 + h1 * r2 + h2 * r1 + h3 * r0 + h4 * (5 * r9);
7085      c = d3 >>> 13;
7086      d3 &= 8191;
7087      d3 += h5 * (5 * r8) + h6 * (5 * r7) + h7 * (5 * r6) + h8 * (5 * r5) + h9 * (5 * r4);
7088      c += d3 >>> 13;
7089      d3 &= 8191;
7090      let d4 = c + h0 * r4 + h1 * r3 + h2 * r2 + h3 * r1 + h4 * r0;
7091      c = d4 >>> 13;
7092      d4 &= 8191;
7093      d4 += h5 * (5 * r9) + h6 * (5 * r8) + h7 * (5 * r7) + h8 * (5 * r6) + h9 * (5 * r5);
7094      c += d4 >>> 13;
7095      d4 &= 8191;
7096      let d5 = c + h0 * r5 + h1 * r4 + h2 * r3 + h3 * r2 + h4 * r1;
7097      c = d5 >>> 13;
7098      d5 &= 8191;
7099      d5 += h5 * r0 + h6 * (5 * r9) + h7 * (5 * r8) + h8 * (5 * r7) + h9 * (5 * r6);
7100      c += d5 >>> 13;
7101      d5 &= 8191;
7102      let d6 = c + h0 * r6 + h1 * r5 + h2 * r4 + h3 * r3 + h4 * r2;
7103      c = d6 >>> 13;
7104      d6 &= 8191;
7105      d6 += h5 * r1 + h6 * r0 + h7 * (5 * r9) + h8 * (5 * r8) + h9 * (5 * r7);
7106      c += d6 >>> 13;
7107      d6 &= 8191;
7108      let d7 = c + h0 * r7 + h1 * r6 + h2 * r5 + h3 * r4 + h4 * r3;
7109      c = d7 >>> 13;
7110      d7 &= 8191;
7111      d7 += h5 * r2 + h6 * r1 + h7 * r0 + h8 * (5 * r9) + h9 * (5 * r8);
7112      c += d7 >>> 13;
7113      d7 &= 8191;
7114      let d8 = c + h0 * r8 + h1 * r7 + h2 * r6 + h3 * r5 + h4 * r4;
7115      c = d8 >>> 13;
7116      d8 &= 8191;
7117      d8 += h5 * r3 + h6 * r2 + h7 * r1 + h8 * r0 + h9 * (5 * r9);
7118      c += d8 >>> 13;
7119      d8 &= 8191;
7120      let d9 = c + h0 * r9 + h1 * r8 + h2 * r7 + h3 * r6 + h4 * r5;
7121      c = d9 >>> 13;
7122      d9 &= 8191;
7123      d9 += h5 * r4 + h6 * r3 + h7 * r2 + h8 * r1 + h9 * r0;
7124      c += d9 >>> 13;
7125      d9 &= 8191;
7126      c = (c << 2) + c | 0;
7127      c = c + d0 | 0;
7128      d0 = c & 8191;
7129      c = c >>> 13;
7130      d1 += c;
7131      h[0] = d0;
7132      h[1] = d1;
7133      h[2] = d2;
7134      h[3] = d3;
7135      h[4] = d4;
7136      h[5] = d5;
7137      h[6] = d6;
7138      h[7] = d7;
7139      h[8] = d8;
7140      h[9] = d9;
7141    }
7142    finalize() {
7143      const { h, pad } = this;
7144      const g = new Uint16Array(10);
7145      let c = h[1] >>> 13;
7146      h[1] &= 8191;
7147      for (let i = 2; i < 10; i++) {
7148        h[i] += c;
7149        c = h[i] >>> 13;
7150        h[i] &= 8191;
7151      }
7152      h[0] += c * 5;
7153      c = h[0] >>> 13;
7154      h[0] &= 8191;
7155      h[1] += c;
7156      c = h[1] >>> 13;
7157      h[1] &= 8191;
7158      h[2] += c;
7159      g[0] = h[0] + 5;
7160      c = g[0] >>> 13;
7161      g[0] &= 8191;
7162      for (let i = 1; i < 10; i++) {
7163        g[i] = h[i] + c;
7164        c = g[i] >>> 13;
7165        g[i] &= 8191;
7166      }
7167      g[9] -= 1 << 13;
7168      let mask = (c ^ 1) - 1;
7169      for (let i = 0; i < 10; i++)
7170        g[i] &= mask;
7171      mask = ~mask;
7172      for (let i = 0; i < 10; i++)
7173        h[i] = h[i] & mask | g[i];
7174      h[0] = (h[0] | h[1] << 13) & 65535;
7175      h[1] = (h[1] >>> 3 | h[2] << 10) & 65535;
7176      h[2] = (h[2] >>> 6 | h[3] << 7) & 65535;
7177      h[3] = (h[3] >>> 9 | h[4] << 4) & 65535;
7178      h[4] = (h[4] >>> 12 | h[5] << 1 | h[6] << 14) & 65535;
7179      h[5] = (h[6] >>> 2 | h[7] << 11) & 65535;
7180      h[6] = (h[7] >>> 5 | h[8] << 8) & 65535;
7181      h[7] = (h[8] >>> 8 | h[9] << 5) & 65535;
7182      let f2 = h[0] + pad[0];
7183      h[0] = f2 & 65535;
7184      for (let i = 1; i < 8; i++) {
7185        f2 = (h[i] + pad[i] | 0) + (f2 >>> 16) | 0;
7186        h[i] = f2 & 65535;
7187      }
7188    }
7189    update(data) {
7190      assert_default2.exists(this);
7191      const { buffer, blockLen } = this;
7192      data = toBytes2(data);
7193      const len = data.length;
7194      for (let pos = 0; pos < len; ) {
7195        const take = Math.min(blockLen - this.pos, len - pos);
7196        if (take === blockLen) {
7197          for (; blockLen <= len - pos; pos += blockLen)
7198            this.process(data, pos);
7199          continue;
7200        }
7201        buffer.set(data.subarray(pos, pos + take), this.pos);
7202        this.pos += take;
7203        pos += take;
7204        if (this.pos === blockLen) {
7205          this.process(buffer, 0, false);
7206          this.pos = 0;
7207        }
7208      }
7209      return this;
7210    }
7211    destroy() {
7212      this.h.fill(0);
7213      this.r.fill(0);
7214      this.buffer.fill(0);
7215      this.pad.fill(0);
7216    }
7217    digestInto(out) {
7218      assert_default2.exists(this);
7219      assert_default2.output(out, this);
7220      this.finished = true;
7221      const { buffer, h } = this;
7222      let { pos } = this;
7223      if (pos) {
7224        buffer[pos++] = 1;
7225        for (; pos < 16; pos++)
7226          buffer[pos] = 0;
7227        this.process(buffer, 0, true);
7228      }
7229      this.finalize();
7230      let opos = 0;
7231      for (let i = 0; i < 8; i++) {
7232        out[opos++] = h[i] >>> 0;
7233        out[opos++] = h[i] >>> 8;
7234      }
7235      return out;
7236    }
7237    digest() {
7238      const { buffer, outputLen } = this;
7239      this.digestInto(buffer);
7240      const res = buffer.slice(0, outputLen);
7241      this.destroy();
7242      return res;
7243    }
7244  };
7245  function wrapConstructorWithKey(hashCons) {
7246    const hashC = (msg, key) => hashCons(key).update(toBytes2(msg)).digest();
7247    const tmp = hashCons(new Uint8Array(32));
7248    hashC.outputLen = tmp.outputLen;
7249    hashC.blockLen = tmp.blockLen;
7250    hashC.create = (key) => hashCons(key);
7251    return hashC;
7252  }
7253  var poly1305 = wrapConstructorWithKey((key) => new Poly1305(key));
7254
7255  
vendor: 3,554 bytes, lines 7255-7344
7255// node_modules/@noble/ciphers/esm/_salsa.js
7256  var sigma16 = utf8ToBytes3("expand 16-byte k");
7257  var sigma32 = utf8ToBytes3("expand 32-byte k");
7258  var sigma16_32 = u32(sigma16);
7259  var sigma32_32 = u32(sigma32);
7260  var isAligned32 = (b) => !(b.byteOffset % 4);
7261  var salsaBasic = (opts) => {
7262    const { core, rounds, counterRight, counterLen, allow128bitKeys, extendNonceFn, blockLen } = checkOpts2({ rounds: 20, counterRight: false, counterLen: 8, allow128bitKeys: true, blockLen: 64 }, opts);
7263    assert_default2.number(counterLen);
7264    assert_default2.number(rounds);
7265    assert_default2.number(blockLen);
7266    assert_default2.bool(counterRight);
7267    assert_default2.bool(allow128bitKeys);
7268    const blockLen32 = blockLen / 4;
7269    if (blockLen % 4 !== 0)
7270      throw new Error("Salsa/ChaCha: blockLen must be aligned to 4 bytes");
7271    return (key, nonce, data, output3, counter = 0) => {
7272      assert_default2.bytes(key);
7273      assert_default2.bytes(nonce);
7274      assert_default2.bytes(data);
7275      if (!output3)
7276        output3 = new Uint8Array(data.length);
7277      assert_default2.bytes(output3);
7278      assert_default2.number(counter);
7279      if (counter < 0 || counter >= 2 ** 32 - 1)
7280        throw new Error("Salsa/ChaCha: counter overflow");
7281      if (output3.length < data.length) {
7282        throw new Error(`Salsa/ChaCha: output (${output3.length}) is shorter than data (${data.length})`);
7283      }
7284      const toClean = [];
7285      let k, sigma;
7286      if (key.length === 32) {
7287        k = key;
7288        sigma = sigma32_32;
7289      } else if (key.length === 16 && allow128bitKeys) {
7290        k = new Uint8Array(32);
7291        k.set(key);
7292        k.set(key, 16);
7293        sigma = sigma16_32;
7294        toClean.push(k);
7295      } else
7296        throw new Error(`Salsa/ChaCha: invalid 32-byte key, got length=${key.length}`);
7297      if (extendNonceFn) {
7298        if (nonce.length <= 16)
7299          throw new Error(`Salsa/ChaCha: extended nonce must be bigger than 16 bytes`);
7300        k = extendNonceFn(sigma, k, nonce.subarray(0, 16), new Uint8Array(32));
7301        toClean.push(k);
7302        nonce = nonce.subarray(16);
7303      }
7304      const nonceLen = 16 - counterLen;
7305      if (nonce.length !== nonceLen)
7306        throw new Error(`Salsa/ChaCha: nonce must be ${nonceLen} or 16 bytes`);
7307      if (nonceLen !== 12) {
7308        const nc = new Uint8Array(12);
7309        nc.set(nonce, counterRight ? 0 : 12 - nonce.length);
7310        toClean.push(nonce = nc);
7311      }
7312      const block = new Uint8Array(blockLen);
7313      const b32 = u32(block);
7314      const k32 = u32(k);
7315      const n32 = u32(nonce);
7316      const d32 = isAligned32(data) && u32(data);
7317      const o32 = isAligned32(output3) && u32(output3);
7318      toClean.push(b32);
7319      const len = data.length;
7320      for (let pos = 0, ctr = counter; pos < len; ctr++) {
7321        core(sigma, k32, n32, b32, ctr, rounds);
7322        if (ctr >= 2 ** 32 - 1)
7323          throw new Error("Salsa/ChaCha: counter overflow");
7324        const take = Math.min(blockLen, len - pos);
7325        if (take === blockLen && o32 && d32) {
7326          const pos32 = pos / 4;
7327          if (pos % 4 !== 0)
7328            throw new Error("Salsa/ChaCha: invalid block position");
7329          for (let j = 0; j < blockLen32; j++)
7330            o32[pos32 + j] = d32[pos32 + j] ^ b32[j];
7331          pos += blockLen;
7332          continue;
7333        }
7334        for (let j = 0; j < take; j++)
7335          output3[pos + j] = data[pos + j] ^ block[j];
7336        pos += take;
7337      }
7338      for (let i = 0; i < toClean.length; i++)
7339        toClean[i].fill(0);
7340      return output3;
7341    };
7342  };
7343
7344  
vendor: 3,203 bytes, lines 7344-7443
7344// node_modules/@noble/ciphers/esm/chacha.js
7345  var rotl2 = (a, b) => a << b | a >>> 32 - b;
7346  function chachaCore(c, k, n, out, cnt, rounds = 20) {
7347    let y00 = c[0], y01 = c[1], y02 = c[2], y03 = c[3];
7348    let y04 = k[0], y05 = k[1], y06 = k[2], y07 = k[3];
7349    let y08 = k[4], y09 = k[5], y10 = k[6], y11 = k[7];
7350    let y12 = cnt, y13 = n[0], y14 = n[1], y15 = n[2];
7351    let x00 = y00, x01 = y01, x02 = y02, x03 = y03, x04 = y04, x05 = y05, x06 = y06, x07 = y07, x08 = y08, x09 = y09, x10 = y10, x11 = y11, x12 = y12, x13 = y13, x14 = y14, x15 = y15;
7352    for (let i = 0; i < rounds; i += 2) {
7353      x00 = x00 + x04 | 0;
7354      x12 = rotl2(x12 ^ x00, 16);
7355      x08 = x08 + x12 | 0;
7356      x04 = rotl2(x04 ^ x08, 12);
7357      x00 = x00 + x04 | 0;
7358      x12 = rotl2(x12 ^ x00, 8);
7359      x08 = x08 + x12 | 0;
7360      x04 = rotl2(x04 ^ x08, 7);
7361      x01 = x01 + x05 | 0;
7362      x13 = rotl2(x13 ^ x01, 16);
7363      x09 = x09 + x13 | 0;
7364      x05 = rotl2(x05 ^ x09, 12);
7365      x01 = x01 + x05 | 0;
7366      x13 = rotl2(x13 ^ x01, 8);
7367      x09 = x09 + x13 | 0;
7368      x05 = rotl2(x05 ^ x09, 7);
7369      x02 = x02 + x06 | 0;
7370      x14 = rotl2(x14 ^ x02, 16);
7371      x10 = x10 + x14 | 0;
7372      x06 = rotl2(x06 ^ x10, 12);
7373      x02 = x02 + x06 | 0;
7374      x14 = rotl2(x14 ^ x02, 8);
7375      x10 = x10 + x14 | 0;
7376      x06 = rotl2(x06 ^ x10, 7);
7377      x03 = x03 + x07 | 0;
7378      x15 = rotl2(x15 ^ x03, 16);
7379      x11 = x11 + x15 | 0;
7380      x07 = rotl2(x07 ^ x11, 12);
7381      x03 = x03 + x07 | 0;
7382      x15 = rotl2(x15 ^ x03, 8);
7383      x11 = x11 + x15 | 0;
7384      x07 = rotl2(x07 ^ x11, 7);
7385      x00 = x00 + x05 | 0;
7386      x15 = rotl2(x15 ^ x00, 16);
7387      x10 = x10 + x15 | 0;
7388      x05 = rotl2(x05 ^ x10, 12);
7389      x00 = x00 + x05 | 0;
7390      x15 = rotl2(x15 ^ x00, 8);
7391      x10 = x10 + x15 | 0;
7392      x05 = rotl2(x05 ^ x10, 7);
7393      x01 = x01 + x06 | 0;
7394      x12 = rotl2(x12 ^ x01, 16);
7395      x11 = x11 + x12 | 0;
7396      x06 = rotl2(x06 ^ x11, 12);
7397      x01 = x01 + x06 | 0;
7398      x12 = rotl2(x12 ^ x01, 8);
7399      x11 = x11 + x12 | 0;
7400      x06 = rotl2(x06 ^ x11, 7);
7401      x02 = x02 + x07 | 0;
7402      x13 = rotl2(x13 ^ x02, 16);
7403      x08 = x08 + x13 | 0;
7404      x07 = rotl2(x07 ^ x08, 12);
7405      x02 = x02 + x07 | 0;
7406      x13 = rotl2(x13 ^ x02, 8);
7407      x08 = x08 + x13 | 0;
7408      x07 = rotl2(x07 ^ x08, 7);
7409      x03 = x03 + x04 | 0;
7410      x14 = rotl2(x14 ^ x03, 16);
7411      x09 = x09 + x14 | 0;
7412      x04 = rotl2(x04 ^ x09, 12);
7413      x03 = x03 + x04 | 0;
7414      x14 = rotl2(x14 ^ x03, 8);
7415      x09 = x09 + x14 | 0;
7416      x04 = rotl2(x04 ^ x09, 7);
7417    }
7418    let oi = 0;
7419    out[oi++] = y00 + x00 | 0;
7420    out[oi++] = y01 + x01 | 0;
7421    out[oi++] = y02 + x02 | 0;
7422    out[oi++] = y03 + x03 | 0;
7423    out[oi++] = y04 + x04 | 0;
7424    out[oi++] = y05 + x05 | 0;
7425    out[oi++] = y06 + x06 | 0;
7426    out[oi++] = y07 + x07 | 0;
7427    out[oi++] = y08 + x08 | 0;
7428    out[oi++] = y09 + x09 | 0;
7429    out[oi++] = y10 + x10 | 0;
7430    out[oi++] = y11 + x11 | 0;
7431    out[oi++] = y12 + x12 | 0;
7432    out[oi++] = y13 + x13 | 0;
7433    out[oi++] = y14 + x14 | 0;
7434    out[oi++] = y15 + x15 | 0;
7435  }
7436  var chacha20 = /* @__PURE__ */ salsaBasic({
7437    core: chachaCore,
7438    counterRight: false,
7439    counterLen: 4,
7440    allow128bitKeys: false
7441  });
7442
7443  
vendor: 11,629 bytes, lines 7443-7782
7443// node_modules/@noble/hashes/esm/hkdf.js
7444  function extract(hash3, ikm, salt2) {
7445    assert_default.hash(hash3);
7446    if (salt2 === void 0)
7447      salt2 = new Uint8Array(hash3.outputLen);
7448    return hmac(hash3, toBytes(salt2), toBytes(ikm));
7449  }
7450  var HKDF_COUNTER = new Uint8Array([0]);
7451  var EMPTY_BUFFER = new Uint8Array();
7452  function expand(hash3, prk, info, length = 32) {
7453    assert_default.hash(hash3);
7454    assert_default.number(length);
7455    if (length > 255 * hash3.outputLen)
7456      throw new Error("Length should be <= 255*HashLen");
7457    const blocks = Math.ceil(length / hash3.outputLen);
7458    if (info === void 0)
7459      info = EMPTY_BUFFER;
7460    const okm = new Uint8Array(blocks * hash3.outputLen);
7461    const HMAC2 = hmac.create(hash3, prk);
7462    const HMACTmp = HMAC2._cloneInto();
7463    const T = new Uint8Array(HMAC2.outputLen);
7464    for (let counter = 0; counter < blocks; counter++) {
7465      HKDF_COUNTER[0] = counter + 1;
7466      HMACTmp.update(counter === 0 ? EMPTY_BUFFER : T).update(info).update(HKDF_COUNTER).digestInto(T);
7467      okm.set(T, hash3.outputLen * counter);
7468      HMAC2._cloneInto(HMACTmp);
7469    }
7470    HMAC2.destroy();
7471    HMACTmp.destroy();
7472    T.fill(0);
7473    HKDF_COUNTER.fill(0);
7474    return okm.slice(0, length);
7475  }
7476  var hkdf = (hash3, ikm, salt2, info, length) => expand(hash3, extract(hash3, ikm, salt2), info, length);
7477
7478  // nip44.ts
7479  var utils2 = {
7480    v2: {
7481      maxPlaintextSize: 65536 - 128,
7482      minCiphertextSize: 100,
7483      maxCiphertextSize: 102400,
7484      getConversationKey(privkeyA, pubkeyB) {
7485        const key = secp256k1.getSharedSecret(privkeyA, "02" + pubkeyB);
7486        return key.subarray(1, 33);
7487      },
7488      getMessageKeys(conversationKey, salt2) {
7489        const keys = hkdf(sha256, conversationKey, salt2, "nip44-v2", 76);
7490        return {
7491          encryption: keys.subarray(0, 32),
7492          nonce: keys.subarray(32, 44),
7493          auth: keys.subarray(44, 76)
7494        };
7495      },
7496      calcPadding(len) {
7497        if (!Number.isSafeInteger(len) || len < 0)
7498          throw new Error("expected positive integer");
7499        if (len <= 32)
7500          return 32;
7501        const nextpower = 1 << Math.floor(Math.log2(len - 1)) + 1;
7502        const chunk = nextpower <= 256 ? 32 : nextpower / 8;
7503        return chunk * (Math.floor((len - 1) / chunk) + 1);
7504      },
7505      pad(unpadded) {
7506        const unpaddedB = utf8Encoder.encode(unpadded);
7507        const len = unpaddedB.length;
7508        if (len < 1 || len >= utils2.v2.maxPlaintextSize)
7509          throw new Error("invalid plaintext length: must be between 1b and 64KB");
7510        const paddedLen = utils2.v2.calcPadding(len);
7511        const zeros = new Uint8Array(paddedLen - len);
7512        const lenBuf = new Uint8Array(2);
7513        new DataView(lenBuf.buffer).setUint16(0, len);
7514        return concatBytes(lenBuf, unpaddedB, zeros);
7515      },
7516      unpad(padded) {
7517        const unpaddedLen = new DataView(padded.buffer).getUint16(0);
7518        const unpadded = padded.subarray(2, 2 + unpaddedLen);
7519        if (unpaddedLen === 0 || unpadded.length !== unpaddedLen || padded.length !== 2 + utils2.v2.calcPadding(unpaddedLen))
7520          throw new Error("invalid padding");
7521        return utf8Decoder.decode(unpadded);
7522      }
7523    }
7524  };
7525  function encrypt2(key, plaintext, options = {}) {
7526    const version = options.version ?? 2;
7527    if (version !== 2)
7528      throw new Error("unknown encryption version " + version);
7529    const salt2 = options.salt ?? randomBytes(32);
7530    ensureBytes2(salt2, 32);
7531    const keys = utils2.v2.getMessageKeys(key, salt2);
7532    const padded = utils2.v2.pad(plaintext);
7533    const ciphertext = chacha20(keys.encryption, keys.nonce, padded);
7534    const mac = hmac(sha256, keys.auth, ciphertext);
7535    return base64.encode(concatBytes(new Uint8Array([version]), salt2, ciphertext, mac));
7536  }
7537  function decrypt2(key, ciphertext) {
7538    const u = utils2.v2;
7539    ensureBytes2(key, 32);
7540    const clen = ciphertext.length;
7541    if (clen < u.minCiphertextSize || clen >= u.maxCiphertextSize)
7542      throw new Error("invalid ciphertext length: " + clen);
7543    if (ciphertext[0] === "#")
7544      throw new Error("unknown encryption version");
7545    let data;
7546    try {
7547      data = base64.decode(ciphertext);
7548    } catch (error) {
7549      throw new Error("invalid base64: " + error.message);
7550    }
7551    const vers = data.subarray(0, 1)[0];
7552    if (vers !== 2)
7553      throw new Error("unknown encryption version " + vers);
7554    const salt2 = data.subarray(1, 33);
7555    const ciphertext_ = data.subarray(33, -32);
7556    const mac = data.subarray(-32);
7557    const keys = u.getMessageKeys(key, salt2);
7558    const calculatedMac = hmac(sha256, keys.auth, ciphertext_);
7559    if (!equalBytes2(calculatedMac, mac))
7560      throw new Error("invalid MAC");
7561    const padded = chacha20(keys.encryption, keys.nonce, ciphertext_);
7562    return u.unpad(padded);
7563  }
7564
7565  // nip47.ts
7566  var nip47_exports = {};
7567  __export(nip47_exports, {
7568    makeNwcRequestEvent: () => makeNwcRequestEvent,
7569    parseConnectionString: () => parseConnectionString
7570  });
7571  function parseConnectionString(connectionString) {
7572    const { pathname, searchParams } = new URL(connectionString);
7573    const pubkey = pathname;
7574    const relay = searchParams.get("relay");
7575    const secret = searchParams.get("secret");
7576    if (!pubkey || !relay || !secret) {
7577      throw new Error("invalid connection string");
7578    }
7579    return { pubkey, relay, secret };
7580  }
7581  async function makeNwcRequestEvent({
7582    pubkey,
7583    secret,
7584    invoice
7585  }) {
7586    const content = {
7587      method: "pay_invoice",
7588      params: {
7589        invoice
7590      }
7591    };
7592    const encryptedContent = await encrypt(secret, pubkey, JSON.stringify(content));
7593    const eventTemplate = {
7594      kind: 23194 /* NwcRequest */,
7595      created_at: Math.round(Date.now() / 1e3),
7596      content: encryptedContent,
7597      tags: [["p", pubkey]]
7598    };
7599    return finishEvent(eventTemplate, secret);
7600  }
7601
7602  // nip57.ts
7603  var nip57_exports = {};
7604  __export(nip57_exports, {
7605    getZapEndpoint: () => getZapEndpoint,
7606    makeZapReceipt: () => makeZapReceipt,
7607    makeZapRequest: () => makeZapRequest,
7608    useFetchImplementation: () => useFetchImplementation3,
7609    validateZapRequest: () => validateZapRequest
7610  });
7611  var _fetch3;
7612  try {
7613    _fetch3 = fetch;
7614  } catch {
7615  }
7616  function useFetchImplementation3(fetchImplementation) {
7617    _fetch3 = fetchImplementation;
7618  }
7619  async function getZapEndpoint(metadata) {
7620    try {
7621      let lnurl = "";
7622      let { lud06, lud16 } = JSON.parse(metadata.content);
7623      if (lud06) {
7624        let { words } = bech32.decode(lud06, 1e3);
7625        let data = bech32.fromWords(words);
7626        lnurl = utf8Decoder.decode(data);
7627      } else if (lud16) {
7628        let [name, domain] = lud16.split("@");
7629        lnurl = `https://${domain}/.well-known/lnurlp/${name}`;
7630      } else {
7631        return null;
7632      }
7633      let res = await _fetch3(lnurl);
7634      let body = await res.json();
7635      if (body.allowsNostr && body.nostrPubkey) {
7636        return body.callback;
7637      }
7638    } catch (err) {
7639    }
7640    return null;
7641  }
7642  function makeZapRequest({
7643    profile,
7644    event,
7645    amount,
7646    relays,
7647    comment = ""
7648  }) {
7649    if (!amount)
7650      throw new Error("amount not given");
7651    if (!profile)
7652      throw new Error("profile not given");
7653    let zr = {
7654      kind: 9734,
7655      created_at: Math.round(Date.now() / 1e3),
7656      content: comment,
7657      tags: [
7658        ["p", profile],
7659        ["amount", amount.toString()],
7660        ["relays", ...relays]
7661      ]
7662    };
7663    if (event) {
7664      zr.tags.push(["e", event]);
7665    }
7666    return zr;
7667  }
7668  function validateZapRequest(zapRequestString) {
7669    let zapRequest;
7670    try {
7671      zapRequest = JSON.parse(zapRequestString);
7672    } catch (err) {
7673      return "Invalid zap request JSON.";
7674    }
7675    if (!validateEvent(zapRequest))
7676      return "Zap request is not a valid Nostr event.";
7677    if (!verifySignature(zapRequest))
7678      return "Invalid signature on zap request.";
7679    let p = zapRequest.tags.find(([t, v]) => t === "p" && v);
7680    if (!p)
7681      return "Zap request doesn't have a 'p' tag.";
7682    if (!p[1].match(/^[a-f0-9]{64}$/))
7683      return "Zap request 'p' tag is not valid hex.";
7684    let e = zapRequest.tags.find(([t, v]) => t === "e" && v);
7685    if (e && !e[1].match(/^[a-f0-9]{64}$/))
7686      return "Zap request 'e' tag is not valid hex.";
7687    let relays = zapRequest.tags.find(([t, v]) => t === "relays" && v);
7688    if (!relays)
7689      return "Zap request doesn't have a 'relays' tag.";
7690    return null;
7691  }
7692  function makeZapReceipt({
7693    zapRequest,
7694    preimage,
7695    bolt11,
7696    paidAt
7697  }) {
7698    let zr = JSON.parse(zapRequest);
7699    let tagsFromZapRequest = zr.tags.filter(([t]) => t === "e" || t === "p" || t === "a");
7700    let zap = {
7701      kind: 9735,
7702      created_at: Math.round(paidAt.getTime() / 1e3),
7703      content: "",
7704      tags: [...tagsFromZapRequest, ["bolt11", bolt11], ["description", zapRequest]]
7705    };
7706    if (preimage) {
7707      zap.tags.push(["preimage", preimage]);
7708    }
7709    return zap;
7710  }
7711
7712  // nip98.ts
7713  var nip98_exports = {};
7714  __export(nip98_exports, {
7715    getToken: () => getToken,
7716    unpackEventFromToken: () => unpackEventFromToken,
7717    validateEvent: () => validateEvent2,
7718    validateToken: () => validateToken
7719  });
7720  var _authorizationScheme = "Nostr ";
7721  async function getToken(loginUrl, httpMethod, sign, includeAuthorizationScheme = false) {
7722    if (!loginUrl || !httpMethod)
7723      throw new Error("Missing loginUrl or httpMethod");
7724    const event = getBlankEvent(27235 /* HttpAuth */);
7725    event.tags = [
7726      ["u", loginUrl],
7727      ["method", httpMethod]
7728    ];
7729    event.created_at = Math.round(new Date().getTime() / 1e3);
7730    const signedEvent = await sign(event);
7731    const authorizationScheme = includeAuthorizationScheme ? _authorizationScheme : "";
7732    return authorizationScheme + base64.encode(utf8Encoder.encode(JSON.stringify(signedEvent)));
7733  }
7734  async function validateToken(token, url, method) {
7735    const event = await unpackEventFromToken(token).catch((error) => {
7736      throw error;
7737    });
7738    const valid = await validateEvent2(event, url, method).catch((error) => {
7739      throw error;
7740    });
7741    return valid;
7742  }
7743  async function unpackEventFromToken(token) {
7744    if (!token) {
7745      throw new Error("Missing token");
7746    }
7747    token = token.replace(_authorizationScheme, "");
7748    const eventB64 = utf8Decoder.decode(base64.decode(token));
7749    if (!eventB64 || eventB64.length === 0 || !eventB64.startsWith("{")) {
7750      throw new Error("Invalid token");
7751    }
7752    const event = JSON.parse(eventB64);
7753    return event;
7754  }
7755  async function validateEvent2(event, url, method) {
7756    if (!event) {
7757      throw new Error("Invalid nostr event");
7758    }
7759    if (!verifySignature(event)) {
7760      throw new Error("Invalid nostr event, signature invalid");
7761    }
7762    if (event.kind !== 27235 /* HttpAuth */) {
7763      throw new Error("Invalid nostr event, kind invalid");
7764    }
7765    if (!event.created_at) {
7766      throw new Error("Invalid nostr event, created_at invalid");
7767    }
7768    if (Math.round(new Date().getTime() / 1e3) - event.created_at > 60) {
7769      throw new Error("Invalid nostr event, expired");
7770    }
7771    const urlTag = event.tags.find((t) => t[0] === "u");
7772    if (urlTag?.length !== 1 && urlTag?.[1] !== url) {
7773      throw new Error("Invalid nostr event, url tag invalid");
7774    }
7775    const methodTag = event.tags.find((t) => t[0] === "method");
7776    if (methodTag?.length !== 1 && methodTag?.[1].toLowerCase() !== method.toLowerCase()) {
7777      throw new Error("Invalid nostr event, method tag invalid");
7778    }
7779    return true;
7780  }
7781  return __toCommonJS(nostr_tools_exports);
7782})();

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.