minimal-xec-wallet 2.2.2 → 2.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGES.md CHANGED
@@ -1,5 +1,27 @@
1
1
  # Changelog
2
2
 
3
+ ## [2.2.3] - 2025-02-10
4
+
5
+ ### Fixed
6
+
7
+ #### Message Signing BigInt Error (CRITICAL)
8
+
9
+ Fixed `signMessage()` crashing in the browser with `Cannot mix BigInt and other types, use explicit conversions`.
10
+
11
+ **The Problem:**
12
+ The `signRecoverable` method in `initBrowser-shim.js` called `secp256k1.sign()` and accessed `.r`, `.s`, `.recovery` on the result. But `@noble/curves` v2 `sign()` returns a `Uint8Array`, not a Signature object. Accessing `.r` on a Uint8Array yields `undefined`, and `bigIntToBytes(undefined, 32)` triggers the BigInt TypeError.
13
+
14
+ The same issue affected `recoverSig()` which manually reconstructed a Signature via `new Signature(r, s, recoveryId)` — functional but unnecessarily complex.
15
+
16
+ **The Fix:**
17
+ - `signRecoverable`: use `format: 'recovered'` option which makes `sign()` return the 65-byte `[recovery_id, r(32), s(32)]` format directly
18
+ - `recoverSig`: use `secp256k1.recoverPublicKey(sig, msg)` which natively parses the recovered format and returns compressed public key bytes
19
+
20
+ **Note:** The CLI wallet was unaffected because it runs in Node.js where ecash-lib uses native WASM — the browser shim is never invoked.
21
+
22
+ ### Files Updated
23
+ - `browser-shims/initBrowser-shim.js` — Fix signRecoverable and recoverSig for noble curves v2 API
24
+
3
25
  ## [2.2.2] - 2025-02-10
4
26
 
5
27
  ### Added
@@ -32074,26 +32074,11 @@ class NobleEcc {
32074
32074
  }
32075
32075
 
32076
32076
  signRecoverable (seckey, msg) {
32077
- const sig = secp256k1.sign(msg, seckey, { lowS: true, prehash: false });
32078
- const r = sig.r;
32079
- const s = sig.s;
32080
- const recovery = sig.recovery;
32081
- // 65 bytes: [recovery_id, r(32), s(32)]
32082
- const result = new Uint8Array(65);
32083
- result[0] = recovery;
32084
- result.set(bigIntToBytes(r, 32), 1);
32085
- result.set(bigIntToBytes(s, 32), 33);
32086
- return result
32077
+ return secp256k1.sign(msg, seckey, { lowS: true, prehash: false, format: 'recovered' })
32087
32078
  }
32088
32079
 
32089
32080
  recoverSig (sig, msg) {
32090
- const recoveryId = sig[0];
32091
- const r = bytesToBigInt(sig.slice(1, 33));
32092
- const s = bytesToBigInt(sig.slice(33, 65));
32093
- const Signature = secp256k1.Signature;
32094
- const recSig = new Signature(r, s, recoveryId);
32095
- const point = recSig.recoverPublicKey(msg);
32096
- return point.toRawBytes(true)
32081
+ return secp256k1.recoverPublicKey(sig, msg, { prehash: false })
32097
32082
  }
32098
32083
  }
32099
32084
 
@@ -32080,26 +32080,11 @@
32080
32080
  }
32081
32081
 
32082
32082
  signRecoverable (seckey, msg) {
32083
- const sig = secp256k1.sign(msg, seckey, { lowS: true, prehash: false });
32084
- const r = sig.r;
32085
- const s = sig.s;
32086
- const recovery = sig.recovery;
32087
- // 65 bytes: [recovery_id, r(32), s(32)]
32088
- const result = new Uint8Array(65);
32089
- result[0] = recovery;
32090
- result.set(bigIntToBytes(r, 32), 1);
32091
- result.set(bigIntToBytes(s, 32), 33);
32092
- return result
32083
+ return secp256k1.sign(msg, seckey, { lowS: true, prehash: false, format: 'recovered' })
32093
32084
  }
32094
32085
 
32095
32086
  recoverSig (sig, msg) {
32096
- const recoveryId = sig[0];
32097
- const r = bytesToBigInt(sig.slice(1, 33));
32098
- const s = bytesToBigInt(sig.slice(33, 65));
32099
- const Signature = secp256k1.Signature;
32100
- const recSig = new Signature(r, s, recoveryId);
32101
- const point = recSig.recoverPublicKey(msg);
32102
- return point.toRawBytes(true)
32087
+ return secp256k1.recoverPublicKey(sig, msg, { prehash: false })
32103
32088
  }
32104
32089
  }
32105
32090
 
@@ -52,7 +52,7 @@ t.mode.CTRGladman=function(){var e=t.lib.BlockCipherMode.extend();function n(e){
52
52
  const divNearest=(e,t)=>(e+(e>=0?t:-t)/_2n$1)/t;function _splitEndoScalar(e,t,n){const[[r,i],[o,s]]=t,a=divNearest(s*e,n),u=divNearest(-i*e,n);let c=e-a*r-u*o,l=-a*i-u*s;const h=c<_0n,d=l<_0n;h&&(c=-c),d&&(l=-l);const f=bitMask(Math.ceil(bitLen(n)/2))+_1n;if(c<_0n||c>=f||l<_0n||l>=f)throw new Error("splitScalar (endomorphism): failed, k="+e);return{k1neg:h,k1:c,k2neg:d,k2:l}}function validateSigFormat(e){if(!["compact","recovered","der"].includes(e))throw new Error('Signature format must be "compact", "recovered", or "der"');return e}function validateSigOpts(e,t){const n={};for(let r of Object.keys(t))n[r]=void 0===e[r]?t[r]:e[r];return abool(n.lowS,"lowS"),abool(n.prehash,"prehash"),void 0!==n.format&&validateSigFormat(n.format),n}class DERErr extends Error{constructor(e=""){super(e)}}const DER={Err:DERErr,_tlv:{encode:(e,t)=>{const{Err:n}=DER;if(e<0||e>256)throw new n("tlv.encode: wrong tag");if(1&t.length)throw new n("tlv.encode: unpadded data");const r=t.length/2,i=numberToHexUnpadded(r);if(i.length/2&128)throw new n("tlv.encode: long form length too big");const o=r>127?numberToHexUnpadded(i.length/2|128):"";return numberToHexUnpadded(e)+o+i+t},decode(e,t){const{Err:n}=DER;let r=0;if(e<0||e>256)throw new n("tlv.encode: wrong tag");if(t.length<2||t[r++]!==e)throw new n("tlv.decode: wrong tlv");const i=t[r++];let o=0;if(!!(128&i)){const e=127&i;if(!e)throw new n("tlv.decode(long): indefinite length not supported");if(e>4)throw new n("tlv.decode(long): byte length is too big");const s=t.subarray(r,r+e);if(s.length!==e)throw new n("tlv.decode: length bytes not complete");if(0===s[0])throw new n("tlv.decode(long): zero leftmost byte");for(const e of s)o=o<<8|e;if(r+=e,o<128)throw new n("tlv.decode(long): not minimal encoding")}else o=i;const s=t.subarray(r,r+o);if(s.length!==o)throw new n("tlv.decode: wrong value length");return{v:s,l:t.subarray(r+o)}}},_int:{encode(e){const{Err:t}=DER;if(e<_0n)throw new t("integer: negative integers are not allowed");let n=numberToHexUnpadded(e);if(8&Number.parseInt(n[0],16)&&(n="00"+n),1&n.length)throw new t("unexpected DER parsing assertion: unpadded hex");return n},decode(e){const{Err:t}=DER;if(128&e[0])throw new t("invalid signature integer: negative");if(0===e[0]&&!(128&e[1]))throw new t("invalid signature integer: unnecessary leading zero");return bytesToNumberBE(e)}},toSig(e){const{Err:t,_int:n,_tlv:r}=DER,i=abytes$1(e,void 0,"signature"),{v:o,l:s}=r.decode(48,i);if(s.length)throw new t("invalid signature: left bytes after parsing");const{v:a,l:u}=r.decode(2,o),{v:c,l:l}=r.decode(2,u);if(l.length)throw new t("invalid signature: left bytes after parsing");return{r:n.decode(a),s:n.decode(c)}},hexFromSig(e){const{_tlv:t,_int:n}=DER,r=t.encode(2,n.encode(e.r))+t.encode(2,n.encode(e.s));return t.encode(48,r)}},_0n=BigInt(0),_1n=BigInt(1),_2n$1=BigInt(2),_3n=BigInt(3),_4n=BigInt(4);function weierstrass(e,t={}){const n=createCurveFields("weierstrass",e,t),{Fp:r,Fn:i}=n;let o=n.CURVE;const{h:s,n:a}=o;validateObject(t,{},{allowInfinityPoint:"boolean",clearCofactor:"function",isTorsionFree:"function",fromBytes:"function",toBytes:"function",endo:"object"});const{endo:u}=t;if(u&&(!r.is0(o.a)||"bigint"!=typeof u.beta||!Array.isArray(u.basises)))throw new Error('invalid endo: expected "beta": bigint and "basises": array');const c=getWLengths(r,i);function l(){if(!r.isOdd)throw new Error("compression is not supported: Field does not have .isOdd()")}const h=t.toBytes||function(e,t,n){const{x:i,y:o}=t.toAffine(),s=r.toBytes(i);if(abool(n,"isCompressed"),n){l();return concatBytes$1(pprefix(!r.isOdd(o)),s)}return concatBytes$1(Uint8Array.of(4),s,r.toBytes(o))},d=t.fromBytes||function(e){abytes$1(e,void 0,"Point");const{publicKey:t,publicKeyUncompressed:n}=c,i=e.length,o=e[0],s=e.subarray(1);if(i!==t||2!==o&&3!==o){if(i===n&&4===o){const e=r.BYTES,t=r.fromBytes(s.subarray(0,e)),n=r.fromBytes(s.subarray(e,2*e));if(!p(t,n))throw new Error("bad point: is not on curve");return{x:t,y:n}}throw new Error(`bad point: got length ${i}, expected compressed=${t} or uncompressed=${n}`)}{const e=r.fromBytes(s);if(!r.isValid(e))throw new Error("bad point: is not on curve, wrong x");const t=f(e);let n;try{n=r.sqrt(t)}catch(e){const t=e instanceof Error?": "+e.message:"";throw new Error("bad point: is not on curve, sqrt error"+t)}l();return!(1&~o)!==r.isOdd(n)&&(n=r.neg(n)),{x:e,y:n}}};function f(e){const t=r.sqr(e),n=r.mul(t,e);return r.add(r.add(n,r.mul(e,o.a)),o.b)}function p(e,t){const n=r.sqr(t),i=f(e);return r.eql(n,i)}if(!p(o.Gx,o.Gy))throw new Error("bad curve params: generator point");const y=r.mul(r.pow(o.a,_3n),_4n),g=r.mul(r.sqr(o.b),BigInt(27));if(r.is0(r.add(y,g)))throw new Error("bad curve params: a or b");function m(e,t,n=!1){if(!r.isValid(t)||n&&r.is0(t))throw new Error(`bad point coordinate ${e}`);return t}function b(e){if(!(e instanceof E))throw new Error("Weierstrass Point expected")}function w(e){if(!u||!u.basises)throw new Error("no endo");return _splitEndoScalar(e,u.basises,i.ORDER)}const _=memoized((e,t)=>{const{X:n,Y:i,Z:o}=e;if(r.eql(o,r.ONE))return{x:n,y:i};const s=e.is0();null==t&&(t=s?r.ONE:r.inv(o));const a=r.mul(n,t),u=r.mul(i,t),c=r.mul(o,t);if(s)return{x:r.ZERO,y:r.ZERO};if(!r.eql(c,r.ONE))throw new Error("invZ was invalid");return{x:a,y:u}}),x=memoized(e=>{if(e.is0()){if(t.allowInfinityPoint&&!r.is0(e.Y))return;throw new Error("bad point: ZERO")}const{x:n,y:i}=e.toAffine();if(!r.isValid(n)||!r.isValid(i))throw new Error("bad point: x or y not field elements");if(!p(n,i))throw new Error("bad point: equation left != right");if(!e.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});function S(e,t,n,i,o){return n=new E(r.mul(n.X,e),n.Y,n.Z),t=negateCt(i,t),n=negateCt(o,n),t.add(n)}class E{static BASE=new E(o.Gx,o.Gy,r.ONE);static ZERO=new E(r.ZERO,r.ONE,r.ZERO);static Fp=r;static Fn=i;X;Y;Z;constructor(e,t,n){this.X=m("x",e),this.Y=m("y",t,!0),this.Z=m("z",n),Object.freeze(this)}static CURVE(){return o}static fromAffine(e){const{x:t,y:n}=e||{};if(!e||!r.isValid(t)||!r.isValid(n))throw new Error("invalid affine point");if(e instanceof E)throw new Error("projective point not allowed");return r.is0(t)&&r.is0(n)?E.ZERO:new E(t,n,r.ONE)}static fromBytes(e){const t=E.fromAffine(d(abytes$1(e,void 0,"point")));return t.assertValidity(),t}static fromHex(e){return E.fromBytes(hexToBytes(e))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(e=8,t=!0){return T.createCache(this,e),t||this.multiply(_3n),this}assertValidity(){x(this)}hasEvenY(){const{y:e}=this.toAffine();if(!r.isOdd)throw new Error("Field doesn't support isOdd");return!r.isOdd(e)}equals(e){b(e);const{X:t,Y:n,Z:i}=this,{X:o,Y:s,Z:a}=e,u=r.eql(r.mul(t,a),r.mul(o,i)),c=r.eql(r.mul(n,a),r.mul(s,i));return u&&c}negate(){return new E(this.X,r.neg(this.Y),this.Z)}double(){const{a:e,b:t}=o,n=r.mul(t,_3n),{X:i,Y:s,Z:a}=this;let u=r.ZERO,c=r.ZERO,l=r.ZERO,h=r.mul(i,i),d=r.mul(s,s),f=r.mul(a,a),p=r.mul(i,s);return p=r.add(p,p),l=r.mul(i,a),l=r.add(l,l),u=r.mul(e,l),c=r.mul(n,f),c=r.add(u,c),u=r.sub(d,c),c=r.add(d,c),c=r.mul(u,c),u=r.mul(p,u),l=r.mul(n,l),f=r.mul(e,f),p=r.sub(h,f),p=r.mul(e,p),p=r.add(p,l),l=r.add(h,h),h=r.add(l,h),h=r.add(h,f),h=r.mul(h,p),c=r.add(c,h),f=r.mul(s,a),f=r.add(f,f),h=r.mul(f,p),u=r.sub(u,h),l=r.mul(f,d),l=r.add(l,l),l=r.add(l,l),new E(u,c,l)}add(e){b(e);const{X:t,Y:n,Z:i}=this,{X:s,Y:a,Z:u}=e;let c=r.ZERO,l=r.ZERO,h=r.ZERO;const d=o.a,f=r.mul(o.b,_3n);let p=r.mul(t,s),y=r.mul(n,a),g=r.mul(i,u),m=r.add(t,n),w=r.add(s,a);m=r.mul(m,w),w=r.add(p,y),m=r.sub(m,w),w=r.add(t,i);let _=r.add(s,u);return w=r.mul(w,_),_=r.add(p,g),w=r.sub(w,_),_=r.add(n,i),c=r.add(a,u),_=r.mul(_,c),c=r.add(y,g),_=r.sub(_,c),h=r.mul(d,w),c=r.mul(f,g),h=r.add(c,h),c=r.sub(y,h),h=r.add(y,h),l=r.mul(c,h),y=r.add(p,p),y=r.add(y,p),g=r.mul(d,g),w=r.mul(f,w),y=r.add(y,g),g=r.sub(p,g),g=r.mul(d,g),w=r.add(w,g),p=r.mul(y,w),l=r.add(l,p),p=r.mul(_,w),c=r.mul(m,c),c=r.sub(c,p),p=r.mul(m,y),h=r.mul(_,h),h=r.add(h,p),new E(c,l,h)}subtract(e){return this.add(e.negate())}is0(){return this.equals(E.ZERO)}multiply(e){const{endo:n}=t;if(!i.isValidNot0(e))throw new Error("invalid scalar: out of range");let r,o;const s=e=>T.cached(this,e,e=>normalizeZ(E,e));if(n){const{k1neg:t,k1:i,k2neg:a,k2:u}=w(e),{p:c,f:l}=s(i),{p:h,f:d}=s(u);o=l.add(d),r=S(n.beta,c,h,t,a)}else{const{p:t,f:n}=s(e);r=t,o=n}return normalizeZ(E,[r,o])[0]}multiplyUnsafe(e){const{endo:n}=t,r=this;if(!i.isValid(e))throw new Error("invalid scalar: out of range");if(e===_0n||r.is0())return E.ZERO;if(e===_1n)return r;if(T.hasCache(this))return this.multiply(e);if(n){const{k1neg:t,k1:i,k2neg:o,k2:s}=w(e),{p1:a,p2:u}=mulEndoUnsafe(E,r,i,s);return S(n.beta,a,u,t,o)}return T.unsafe(r,e)}toAffine(e){return _(this,e)}isTorsionFree(){const{isTorsionFree:e}=t;return s===_1n||(e?e(E,this):T.unsafe(this,a).is0())}clearCofactor(){const{clearCofactor:e}=t;return s===_1n?this:e?e(E,this):this.multiplyUnsafe(s)}isSmallOrder(){return this.multiplyUnsafe(s).is0()}toBytes(e=!0){return abool(e,"isCompressed"),this.assertValidity(),h(E,this,e)}toHex(e=!0){return bytesToHex(this.toBytes(e))}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}}const k=i.BITS,T=new wNAF(E,t.endo?Math.ceil(k/2):k);return E.BASE.precompute(8),E}function pprefix(e){return Uint8Array.of(e?2:3)}function getWLengths(e,t){return{secretKey:t.BYTES,publicKey:1+e.BYTES,publicKeyUncompressed:1+2*e.BYTES,publicKeyHasPrefix:!0,signature:2*t.BYTES}}function ecdh(e,t={}){const{Fn:n}=e,r=t.randomBytes||randomBytes,i=Object.assign(getWLengths(e.Fp,n),{seed:getMinHashLength(n.ORDER)});function o(e=r(i.seed)){return mapHashToField(abytes$1(e,i.seed,"seed"),n.ORDER)}function s(t,r=!0){return e.BASE.multiply(n.fromBytes(t)).toBytes(r)}function a(e){const{secretKey:t,publicKey:r,publicKeyUncompressed:o}=i;if(!isBytes$1(e))return;if("_lengths"in n&&n._lengths||t===r)return;const s=abytes$1(e,void 0,"key").length;return s===r||s===o}const u={isValidSecretKey:function(e){try{const t=n.fromBytes(e);return n.isValidNot0(t)}catch(e){return!1}},isValidPublicKey:function(t,n){const{publicKey:r,publicKeyUncompressed:o}=i;try{const i=t.length;return(!0!==n||i===r)&&((!1!==n||i===o)&&!!e.fromBytes(t))}catch(e){return!1}},randomSecretKey:o},c=createKeygen(o,s);return Object.freeze({getPublicKey:s,getSharedSecret:function(t,r,i=!0){if(!0===a(t))throw new Error("first arg must be private key");if(!1===a(r))throw new Error("second arg must be public key");const o=n.fromBytes(t);return e.fromBytes(r).multiply(o).toBytes(i)},keygen:c,Point:e,utils:u,lengths:i})}function ecdsa(e,t,n={}){ahash$1(t),validateObject(n,{},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"});const r=(n=Object.assign({},n)).randomBytes||randomBytes,i=n.hmac||((e,n)=>hmac$2(t,e,n)),{Fp:o,Fn:s}=e,{ORDER:a,BITS:u}=s,{keygen:c,getPublicKey:l,getSharedSecret:h,utils:d,lengths:f}=ecdh(e,n),p={prehash:!0,lowS:"boolean"!=typeof n.lowS||n.lowS,format:"compact",extraEntropy:!1},y=a*_2n$1<o.ORDER;function g(e){return e>a>>_1n}function m(e,t){if(!s.isValidNot0(t))throw new Error(`invalid signature ${e}: out of range 1..Point.Fn.ORDER`);return t}function b(){if(y)throw new Error('"recovered" sig type is not supported for cofactor >2 curves')}function w(e,t){validateSigFormat(t);const n=f.signature;return abytes$1(e,"compact"===t?n:"recovered"===t?n+1:void 0)}class _{r;s;recovery;constructor(e,t,n){if(this.r=m("r",e),this.s=m("s",t),null!=n){if(b(),![0,1,2,3].includes(n))throw new Error("invalid recovery id");this.recovery=n}Object.freeze(this)}static fromBytes(e,t=p.format){let n;if(w(e,t),"der"===t){const{r:t,s:n}=DER.toSig(abytes$1(e));return new _(t,n)}"recovered"===t&&(n=e[0],t="compact",e=e.subarray(1));const r=f.signature/2,i=e.subarray(0,r),o=e.subarray(r,2*r);return new _(s.fromBytes(i),s.fromBytes(o),n)}static fromHex(e,t){return this.fromBytes(hexToBytes(e),t)}assertRecovery(){const{recovery:e}=this;if(null==e)throw new Error("invalid recovery id: must be present");return e}addRecoveryBit(e){return new _(this.r,this.s,e)}recoverPublicKey(t){const{r:n,s:r}=this,i=this.assertRecovery(),u=2===i||3===i?n+a:n;if(!o.isValid(u))throw new Error("invalid recovery id: sig.r+curve.n != R.x");const c=o.toBytes(u),l=e.fromBytes(concatBytes$1(pprefix(!(1&i)),c)),h=s.inv(u),d=S(abytes$1(t,void 0,"msgHash")),f=s.create(-d*h),p=s.create(r*h),y=e.BASE.multiplyUnsafe(f).add(l.multiplyUnsafe(p));if(y.is0())throw new Error("invalid recovery: point at infinify");return y.assertValidity(),y}hasHighS(){return g(this.s)}toBytes(e=p.format){if(validateSigFormat(e),"der"===e)return hexToBytes(DER.hexFromSig(this));const{r:t,s:n}=this,r=s.toBytes(t),i=s.toBytes(n);return"recovered"===e?(b(),concatBytes$1(Uint8Array.of(this.assertRecovery()),r,i)):concatBytes$1(r,i)}toHex(e){return bytesToHex(this.toBytes(e))}}const x=n.bits2int||function(e){if(e.length>8192)throw new Error("input is too large");const t=bytesToNumberBE(e),n=8*e.length-u;return n>0?t>>BigInt(n):t},S=n.bits2int_modN||function(e){return s.create(x(e))},E=bitMask(u);function k(e){return aInRange("num < 2^"+u,e,_0n,E),s.toBytes(e)}function T(e,n){return abytes$1(e,void 0,"message"),n?abytes$1(t(e),void 0,"prehashed message"):e}return Object.freeze({keygen:c,getPublicKey:l,getSharedSecret:h,utils:d,lengths:f,Point:e,sign:function(n,o,a={}){const{seed:u,k2sig:c}=function(t,n,i){const{lowS:o,prehash:a,extraEntropy:u}=validateSigOpts(i,p);t=T(t,a);const c=S(t),l=s.fromBytes(n);if(!s.isValidNot0(l))throw new Error("invalid private key");const h=[k(l),k(c)];if(null!=u&&!1!==u){const e=!0===u?r(f.secretKey):u;h.push(abytes$1(e,void 0,"extraEntropy"))}const d=concatBytes$1(...h),m=c;return{seed:d,k2sig:function(t){const n=x(t);if(!s.isValidNot0(n))return;const r=s.inv(n),i=e.BASE.multiply(n).toAffine(),a=s.create(i.x);if(a===_0n)return;const u=s.create(r*s.create(m+a*l));if(u===_0n)return;let c=(i.x===a?0:2)|Number(i.y&_1n),h=u;return o&&g(u)&&(h=s.neg(u),c^=1),new _(a,h,y?void 0:c)}}}(n,o,a);return createHmacDrbg(t.outputLen,s.BYTES,i)(u,c).toBytes(a.format)},verify:function(t,n,r,i={}){const{lowS:o,prehash:a,format:u}=validateSigOpts(i,p);if(r=abytes$1(r,void 0,"publicKey"),n=T(n,a),!isBytes$1(t)){throw new Error("verify expects Uint8Array signature"+(t instanceof _?", use sig.toBytes()":""))}w(t,u);try{const i=_.fromBytes(t,u),a=e.fromBytes(r);if(o&&i.hasHighS())return!1;const{r:c,s:l}=i,h=S(n),d=s.inv(l),f=s.create(h*d),p=s.create(c*d),y=e.BASE.multiplyUnsafe(f).add(a.multiplyUnsafe(p));if(y.is0())return!1;return s.create(y.x)===c}catch(e){return!1}},recoverPublicKey:function(e,t,n={}){const{prehash:r}=validateSigOpts(n,p);return t=T(t,r),_.fromBytes(e,"recovered").recoverPublicKey(t).toBytes()},Signature:_,hash:t})}
53
53
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const secp256k1_CURVE={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:BigInt(1),a:BigInt(0),b:BigInt(7),Gx:BigInt("0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),Gy:BigInt("0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8")},secp256k1_ENDO={beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),basises:[[BigInt("0x3086d221a7d46bcde86c90e49284eb15"),-BigInt("0xe4437ed6010e88286f547fa90abfe4c3")],[BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),BigInt("0x3086d221a7d46bcde86c90e49284eb15")]]},_2n=BigInt(2);function sqrtMod(e){const t=secp256k1_CURVE.p,n=BigInt(3),r=BigInt(6),i=BigInt(11),o=BigInt(22),s=BigInt(23),a=BigInt(44),u=BigInt(88),c=e*e*e%t,l=c*c*e%t,h=pow2(l,n,t)*l%t,d=pow2(h,n,t)*l%t,f=pow2(d,_2n,t)*c%t,p=pow2(f,i,t)*f%t,y=pow2(p,o,t)*p%t,g=pow2(y,a,t)*y%t,m=pow2(g,u,t)*g%t,b=pow2(m,a,t)*y%t,w=pow2(b,n,t)*l%t,_=pow2(w,s,t)*p%t,x=pow2(_,r,t)*c%t,S=pow2(x,_2n,t);if(!Fpk1.eql(Fpk1.sqr(S),e))throw new Error("Cannot find square root");return S}const Fpk1=Field(secp256k1_CURVE.p,{sqrt:sqrtMod}),Pointk1=weierstrass(secp256k1_CURVE,{Fp:Fpk1,endo:secp256k1_ENDO}),secp256k1=ecdsa(Pointk1,sha256$3);
54
54
  /*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
55
- function isBytes(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&"Uint8Array"===e.constructor.name}function anumber(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function abytes(e,...t){if(!isBytes(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error("Uint8Array expected of length "+t+", got length="+e.length)}function ahash(e){if("function"!=typeof e||"function"!=typeof e.create)throw new Error("Hash should be wrapped by utils.createHasher");anumber(e.outputLen),anumber(e.blockLen)}function aexists(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function aoutput(e,t){abytes(e);const n=t.outputLen;if(e.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}function clean(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function createView(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function rotr(e,t){return e<<32-t|e>>>t}function rotl(e,t){return e<<t|e>>>32-t>>>0}function utf8ToBytes$1(e){if("string"!=typeof e)throw new Error("string expected");return new Uint8Array((new TextEncoder).encode(e))}function toBytes(e){return"string"==typeof e&&(e=utf8ToBytes$1(e)),abytes(e),e}function concatBytes(...e){let t=0;for(let n=0;n<e.length;n++){const r=e[n];abytes(r),t+=r.length}const n=new Uint8Array(t);for(let t=0,r=0;t<e.length;t++){const i=e[t];n.set(i,r),r+=i.length}return n}class Hash{}function createHasher(e){const t=t=>e().update(toBytes(t)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function setBigUint64(e,t,n,r){if("function"==typeof e.setBigUint64)return e.setBigUint64(t,n,r);const i=BigInt(32),o=BigInt(4294967295),s=Number(n>>i&o),a=Number(n&o),u=r?4:0,c=r?0:4;e.setUint32(t+u,s,r),e.setUint32(t+c,a,r)}function Chi(e,t,n){return e&t^~e&n}function Maj(e,t,n){return e&t^e&n^t&n}class HashMD extends Hash{constructor(e,t,n,r){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=e,this.outputLen=t,this.padOffset=n,this.isLE=r,this.buffer=new Uint8Array(e),this.view=createView(this.buffer)}update(e){aexists(this),abytes(e=toBytes(e));const{view:t,buffer:n,blockLen:r}=this,i=e.length;for(let o=0;o<i;){const s=Math.min(r-this.pos,i-o);if(s===r){const t=createView(e);for(;r<=i-o;o+=r)this.process(t,o);continue}n.set(e.subarray(o,o+s),this.pos),this.pos+=s,o+=s,this.pos===r&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){aexists(this),aoutput(e,this),this.finished=!0;const{buffer:t,view:n,blockLen:r,isLE:i}=this;let{pos:o}=this;t[o++]=128,clean(this.buffer.subarray(o)),this.padOffset>r-o&&(this.process(n,0),o=0);for(let e=o;e<r;e++)t[e]=0;setBigUint64(n,r-8,BigInt(8*this.length),i),this.process(n,0);const s=createView(e),a=this.outputLen;if(a%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const u=a/4,c=this.get();if(u>c.length)throw new Error("_sha2: outputLen bigger than state");for(let e=0;e<u;e++)s.setUint32(4*e,c[e],i)}digest(){const{buffer:e,outputLen:t}=this;this.digestInto(e);const n=e.slice(0,t);return this.destroy(),n}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:t,buffer:n,length:r,finished:i,destroyed:o,pos:s}=this;return e.destroyed=o,e.finished=i,e.length=r,e.pos=s,r%t&&e.buffer.set(n),e}clone(){return this._cloneInto()}}const SHA256_IV=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),SHA512_IV=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209]),U32_MASK64=BigInt(2**32-1),_32n=BigInt(32);function fromBig(e,t=!1){return t?{h:Number(e&U32_MASK64),l:Number(e>>_32n&U32_MASK64)}:{h:0|Number(e>>_32n&U32_MASK64),l:0|Number(e&U32_MASK64)}}function split(e,t=!1){const n=e.length;let r=new Uint32Array(n),i=new Uint32Array(n);for(let o=0;o<n;o++){const{h:n,l:s}=fromBig(e[o],t);[r[o],i[o]]=[n,s]}return[r,i]}const shrSH=(e,t,n)=>e>>>n,shrSL=(e,t,n)=>e<<32-n|t>>>n,rotrSH=(e,t,n)=>e>>>n|t<<32-n,rotrSL=(e,t,n)=>e<<32-n|t>>>n,rotrBH=(e,t,n)=>e<<64-n|t>>>n-32,rotrBL=(e,t,n)=>e>>>n-32|t<<64-n;function add(e,t,n,r){const i=(t>>>0)+(r>>>0);return{h:e+n+(i/2**32|0)|0,l:0|i}}const add3L=(e,t,n)=>(e>>>0)+(t>>>0)+(n>>>0),add3H=(e,t,n,r)=>t+n+r+(e/2**32|0)|0,add4L=(e,t,n,r)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0),add4H=(e,t,n,r,i)=>t+n+r+i+(e/2**32|0)|0,add5L=(e,t,n,r,i)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0)+(i>>>0),add5H=(e,t,n,r,i,o)=>t+n+r+i+o+(e/2**32|0)|0,SHA256_K=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),SHA256_W=new Uint32Array(64);class SHA256 extends HashMD{constructor(e=32){super(64,e,8,!1),this.A=0|SHA256_IV[0],this.B=0|SHA256_IV[1],this.C=0|SHA256_IV[2],this.D=0|SHA256_IV[3],this.E=0|SHA256_IV[4],this.F=0|SHA256_IV[5],this.G=0|SHA256_IV[6],this.H=0|SHA256_IV[7]}get(){const{A:e,B:t,C:n,D:r,E:i,F:o,G:s,H:a}=this;return[e,t,n,r,i,o,s,a]}set(e,t,n,r,i,o,s,a){this.A=0|e,this.B=0|t,this.C=0|n,this.D=0|r,this.E=0|i,this.F=0|o,this.G=0|s,this.H=0|a}process(e,t){for(let n=0;n<16;n++,t+=4)SHA256_W[n]=e.getUint32(t,!1);for(let e=16;e<64;e++){const t=SHA256_W[e-15],n=SHA256_W[e-2],r=rotr(t,7)^rotr(t,18)^t>>>3,i=rotr(n,17)^rotr(n,19)^n>>>10;SHA256_W[e]=i+SHA256_W[e-7]+r+SHA256_W[e-16]|0}let{A:n,B:r,C:i,D:o,E:s,F:a,G:u,H:c}=this;for(let e=0;e<64;e++){const t=c+(rotr(s,6)^rotr(s,11)^rotr(s,25))+Chi(s,a,u)+SHA256_K[e]+SHA256_W[e]|0,l=(rotr(n,2)^rotr(n,13)^rotr(n,22))+Maj(n,r,i)|0;c=u,u=a,a=s,s=o+t|0,o=i,i=r,r=n,n=t+l|0}n=n+this.A|0,r=r+this.B|0,i=i+this.C|0,o=o+this.D|0,s=s+this.E|0,a=a+this.F|0,u=u+this.G|0,c=c+this.H|0,this.set(n,r,i,o,s,a,u,c)}roundClean(){clean(SHA256_W)}destroy(){this.set(0,0,0,0,0,0,0,0),clean(this.buffer)}}const K512=(()=>split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(e=>BigInt(e))))(),SHA512_Kh=(()=>K512[0])(),SHA512_Kl=(()=>K512[1])(),SHA512_W_H=new Uint32Array(80),SHA512_W_L=new Uint32Array(80);class SHA512 extends HashMD{constructor(e=64){super(128,e,16,!1),this.Ah=0|SHA512_IV[0],this.Al=0|SHA512_IV[1],this.Bh=0|SHA512_IV[2],this.Bl=0|SHA512_IV[3],this.Ch=0|SHA512_IV[4],this.Cl=0|SHA512_IV[5],this.Dh=0|SHA512_IV[6],this.Dl=0|SHA512_IV[7],this.Eh=0|SHA512_IV[8],this.El=0|SHA512_IV[9],this.Fh=0|SHA512_IV[10],this.Fl=0|SHA512_IV[11],this.Gh=0|SHA512_IV[12],this.Gl=0|SHA512_IV[13],this.Hh=0|SHA512_IV[14],this.Hl=0|SHA512_IV[15]}get(){const{Ah:e,Al:t,Bh:n,Bl:r,Ch:i,Cl:o,Dh:s,Dl:a,Eh:u,El:c,Fh:l,Fl:h,Gh:d,Gl:f,Hh:p,Hl:y}=this;return[e,t,n,r,i,o,s,a,u,c,l,h,d,f,p,y]}set(e,t,n,r,i,o,s,a,u,c,l,h,d,f,p,y){this.Ah=0|e,this.Al=0|t,this.Bh=0|n,this.Bl=0|r,this.Ch=0|i,this.Cl=0|o,this.Dh=0|s,this.Dl=0|a,this.Eh=0|u,this.El=0|c,this.Fh=0|l,this.Fl=0|h,this.Gh=0|d,this.Gl=0|f,this.Hh=0|p,this.Hl=0|y}process(e,t){for(let n=0;n<16;n++,t+=4)SHA512_W_H[n]=e.getUint32(t),SHA512_W_L[n]=e.getUint32(t+=4);for(let e=16;e<80;e++){const t=0|SHA512_W_H[e-15],n=0|SHA512_W_L[e-15],r=rotrSH(t,n,1)^rotrSH(t,n,8)^shrSH(t,n,7),i=rotrSL(t,n,1)^rotrSL(t,n,8)^shrSL(t,n,7),o=0|SHA512_W_H[e-2],s=0|SHA512_W_L[e-2],a=rotrSH(o,s,19)^rotrBH(o,s,61)^shrSH(o,s,6),u=rotrSL(o,s,19)^rotrBL(o,s,61)^shrSL(o,s,6),c=add4L(i,u,SHA512_W_L[e-7],SHA512_W_L[e-16]),l=add4H(c,r,a,SHA512_W_H[e-7],SHA512_W_H[e-16]);SHA512_W_H[e]=0|l,SHA512_W_L[e]=0|c}let{Ah:n,Al:r,Bh:i,Bl:o,Ch:s,Cl:a,Dh:u,Dl:c,Eh:l,El:h,Fh:d,Fl:f,Gh:p,Gl:y,Hh:g,Hl:m}=this;for(let e=0;e<80;e++){const t=rotrSH(l,h,14)^rotrSH(l,h,18)^rotrBH(l,h,41),b=rotrSL(l,h,14)^rotrSL(l,h,18)^rotrBL(l,h,41),w=l&d^~l&p,_=add5L(m,b,h&f^~h&y,SHA512_Kl[e],SHA512_W_L[e]),x=add5H(_,g,t,w,SHA512_Kh[e],SHA512_W_H[e]),S=0|_,E=rotrSH(n,r,28)^rotrBH(n,r,34)^rotrBH(n,r,39),k=rotrSL(n,r,28)^rotrBL(n,r,34)^rotrBL(n,r,39),T=n&i^n&s^i&s,v=r&o^r&a^o&a;g=0|p,m=0|y,p=0|d,y=0|f,d=0|l,f=0|h,({h:l,l:h}=add(0|u,0|c,0|x,0|S)),u=0|s,c=0|a,s=0|i,a=0|o,i=0|n,o=0|r;const A=add3L(S,k,v);n=add3H(A,x,E,T),r=0|A}({h:n,l:r}=add(0|this.Ah,0|this.Al,0|n,0|r)),({h:i,l:o}=add(0|this.Bh,0|this.Bl,0|i,0|o)),({h:s,l:a}=add(0|this.Ch,0|this.Cl,0|s,0|a)),({h:u,l:c}=add(0|this.Dh,0|this.Dl,0|u,0|c)),({h:l,l:h}=add(0|this.Eh,0|this.El,0|l,0|h)),({h:d,l:f}=add(0|this.Fh,0|this.Fl,0|d,0|f)),({h:p,l:y}=add(0|this.Gh,0|this.Gl,0|p,0|y)),({h:g,l:m}=add(0|this.Hh,0|this.Hl,0|g,0|m)),this.set(n,r,i,o,s,a,u,c,l,h,d,f,p,y,g,m)}roundClean(){clean(SHA512_W_H,SHA512_W_L)}destroy(){clean(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}const sha256$2=createHasher(()=>new SHA256),sha512$2=createHasher(()=>new SHA512),Rho160=Uint8Array.from([7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8]),Id160=(()=>Uint8Array.from(new Array(16).fill(0).map((e,t)=>t)))(),Pi160=(()=>Id160.map(e=>(9*e+5)%16))(),idxLR=(()=>{const e=[[Id160],[Pi160]];for(let t=0;t<4;t++)for(let n of e)n.push(n[t].map(e=>Rho160[e]));return e})(),idxL=(()=>idxLR[0])(),idxR=(()=>idxLR[1])(),shifts160=[[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8],[12,13,11,15,6,9,9,7,12,15,11,13,7,8,7,7],[13,15,14,11,7,7,6,8,13,14,13,12,5,5,6,9],[14,11,12,14,8,6,5,5,15,12,15,14,9,9,8,6],[15,12,13,13,9,5,8,6,14,11,12,11,8,6,5,5]].map(e=>Uint8Array.from(e)),shiftsL160=idxL.map((e,t)=>e.map(e=>shifts160[t][e])),shiftsR160=idxR.map((e,t)=>e.map(e=>shifts160[t][e])),Kl160=Uint32Array.from([0,1518500249,1859775393,2400959708,2840853838]),Kr160=Uint32Array.from([1352829926,1548603684,1836072691,2053994217,0]);function ripemd_f(e,t,n,r){return 0===e?t^n^r:1===e?t&n|~t&r:2===e?(t|~n)^r:3===e?t&r|n&~r:t^(n|~r)}const BUF_160=new Uint32Array(16);class RIPEMD160 extends HashMD{constructor(){super(64,20,8,!0),this.h0=1732584193,this.h1=-271733879,this.h2=-1732584194,this.h3=271733878,this.h4=-1009589776}get(){const{h0:e,h1:t,h2:n,h3:r,h4:i}=this;return[e,t,n,r,i]}set(e,t,n,r,i){this.h0=0|e,this.h1=0|t,this.h2=0|n,this.h3=0|r,this.h4=0|i}process(e,t){for(let n=0;n<16;n++,t+=4)BUF_160[n]=e.getUint32(t,!0);let n=0|this.h0,r=n,i=0|this.h1,o=i,s=0|this.h2,a=s,u=0|this.h3,c=u,l=0|this.h4,h=l;for(let e=0;e<5;e++){const t=4-e,d=Kl160[e],f=Kr160[e],p=idxL[e],y=idxR[e],g=shiftsL160[e],m=shiftsR160[e];for(let t=0;t<16;t++){const r=rotl(n+ripemd_f(e,i,s,u)+BUF_160[p[t]]+d,g[t])+l|0;n=l,l=u,u=0|rotl(s,10),s=i,i=r}for(let e=0;e<16;e++){const n=rotl(r+ripemd_f(t,o,a,c)+BUF_160[y[e]]+f,m[e])+h|0;r=h,h=c,c=0|rotl(a,10),a=o,o=n}}this.set(this.h1+s+c|0,this.h2+u+h|0,this.h3+l+r|0,this.h4+n+o|0,this.h0+i+a|0)}roundClean(){clean(BUF_160)}destroy(){this.destroyed=!0,clean(this.buffer),this.set(0,0,0,0,0)}}const ripemd160$2=createHasher(()=>new RIPEMD160),ripemd160$1=ripemd160$2;class HMAC extends Hash{constructor(e,t){super(),this.finished=!1,this.destroyed=!1,ahash(e);const n=toBytes(t);if(this.iHash=e.create(),"function"!=typeof this.iHash.update)throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const r=this.blockLen,i=new Uint8Array(r);i.set(n.length>r?e.create().update(n).digest():n);for(let e=0;e<i.length;e++)i[e]^=54;this.iHash.update(i),this.oHash=e.create();for(let e=0;e<i.length;e++)i[e]^=106;this.oHash.update(i),clean(i)}update(e){return aexists(this),this.iHash.update(e),this}digestInto(e){aexists(this),abytes(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){const e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||(e=Object.create(Object.getPrototypeOf(this),{}));const{oHash:t,iHash:n,finished:r,destroyed:i,blockLen:o,outputLen:s}=this;return e.finished=r,e.destroyed=i,e.blockLen=o,e.outputLen=s,e.oHash=t._cloneInto(e.oHash),e.iHash=n._cloneInto(e.iHash),e}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const hmac$1=(e,t,n)=>new HMAC(e,t).update(n).digest();hmac$1.create=(e,t)=>new HMAC(e,t);var eccExports=requireEcc(),hashExports=requireHash(),publicKeyCrypto={},hasRequiredPublicKeyCrypto;function requirePublicKeyCrypto(){if(hasRequiredPublicKeyCrypto)return publicKeyCrypto;hasRequiredPublicKeyCrypto=1,Object.defineProperty(publicKeyCrypto,"__esModule",{value:!0}),publicKeyCrypto.PkcAlgo=void 0,publicKeyCrypto.__setPkc=function(e){t.verify=e.verify,t.algoSupported=e.algoSupported};class e{constructor(e){this.algoOid=e.algoOid,this.params=e.params}static fromOid(n,r){try{t.algoSupported(n,r)}catch(e){throw new Error(e)}return new e({algoOid:n,params:r})}verify(e,n,r){try{t.verify(this.algoOid,this.params,e,n,r)}catch(e){throw new Error(e)}}}publicKeyCrypto.PkcAlgo=e;const t={};return publicKeyCrypto}var publicKeyCryptoExports=requirePublicKeyCrypto();const N=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141");function bytesToBigInt(e){let t=BigInt(0);for(let n=0;n<e.length;n++)t=t<<BigInt(8)|BigInt(e[n]);return t}function bigIntToBytes(e,t){const n=new Uint8Array(t);for(let r=t-1;r>=0;r--)n[r]=Number(e&BigInt(255)),e>>=BigInt(8);return n}function mod(e,t){const n=e%t;return n>=BigInt(0)?n:n+t}const P=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f");function modPow(e,t,n){e%=n;let r=1n;for(;t>0n;)1n&t&&(r=r*e%n),e=e*e%n,t>>=1n;return r}function isQuadResidue(e){return 1n===modPow(e,(P-1n)/2n,P)}function rfc6979k(e,t,n){const r=concatBytes(e,t,n);let i=new Uint8Array(32).fill(1),o=new Uint8Array(32).fill(0);const s=(e,t)=>hmac$1(sha256$2,e,t);for(o=s(o,concatBytes(i,new Uint8Array([0]),r)),i=s(o,i),o=s(o,concatBytes(i,new Uint8Array([1]),r)),i=s(o,i);;){i=s(o,i);const e=bytesToBigInt(i);if(e>0n&&e<N)return e;o=s(o,concatBytes(i,new Uint8Array([0]))),i=s(o,i)}}class NobleEcc{derivePubkey(e){return secp256k1.getPublicKey(e,!0)}ecdsaSign(e,t){return secp256k1.sign(t,e,{lowS:!0,prehash:!1}).toDERRawBytes()}ecdsaVerify(e,t,n){if(!secp256k1.verify(e,t,n,{lowS:!0,prehash:!1}))throw new Error("ECDSA signature verification failed")}schnorrSign(e,t){const n=rfc6979k(e,t,new Uint8Array([83,99,104,110,111,114,114,43,83,72,65,50,53,54,32,32])),r=secp256k1.Point.BASE.multiply(n).toAffine(),i=isQuadResidue(r.y)?n:N-n,o=bigIntToBytes(r.x,32),s=secp256k1.getPublicKey(e,!0),a=mod(bytesToBigInt(sha256$2(concatBytes(o,s,t))),N),u=mod(i+a*bytesToBigInt(e),N),c=new Uint8Array(64);return c.set(o,0),c.set(bigIntToBytes(u,32),32),c}schnorrVerify(e,t,n){const r=bytesToBigInt(e.slice(0,32)),i=bytesToBigInt(e.slice(32,64));if(r>=P||i>=N)throw new Error("Schnorr signature verification failed");const o=33===n.length?n:secp256k1.Point.fromHex(n).toRawBytes(!0),s=mod(bytesToBigInt(sha256$2(concatBytes(e.slice(0,32),o,t))),N),a=secp256k1.Point.fromHex(n),u=secp256k1.Point.BASE.multiply(i).add(a.negate().multiply(s));if(u.equals(secp256k1.Point.ZERO))throw new Error("Schnorr signature verification failed");const c=u.toAffine();if(c.x!==r)throw new Error("Schnorr signature verification failed");if(!isQuadResidue(c.y))throw new Error("Schnorr signature verification failed")}isValidSeckey(e){try{if(32!==e.length)return!1;const t=bytesToBigInt(e);return t>BigInt(0)&&t<N}catch(e){return!1}}seckeyAdd(e,t){return bigIntToBytes(mod(bytesToBigInt(e)+bytesToBigInt(t),N),32)}pubkeyAdd(e,t){const n=secp256k1.Point.fromHex(e),r=secp256k1.Point.fromHex(t);return n.add(r).toRawBytes(!0)}signRecoverable(e,t){const n=secp256k1.sign(t,e,{lowS:!0,prehash:!1}),r=n.r,i=n.s,o=n.recovery,s=new Uint8Array(65);return s[0]=o,s.set(bigIntToBytes(r,32),1),s.set(bigIntToBytes(i,32),33),s}recoverSig(e,t){const n=e[0],r=bytesToBigInt(e.slice(1,33)),i=bytesToBigInt(e.slice(33,65));return new(0,secp256k1.Signature)(r,i,n).recoverPublicKey(t).toRawBytes(!0)}}function sha256$1(e){return sha256$2(e)}function sha256d(e){return sha256$2(sha256$2(e))}function shaRmd160(e){return ripemd160$1(sha256$2(e))}function sha512$1(e){return sha512$2(e)}class Sha256H{constructor(){this._hasher=sha256$2.create()}update(e){this._hasher.update(e)}finalize(){return this._hasher.clone().digest()}clone(){const e=new Sha256H;return e._hasher=this._hasher.clone(),e}free(){}}class Sha512H{constructor(){this._hasher=sha512$2.create()}update(e){this._hasher.update(e)}finalize(){return this._hasher.clone().digest()}clone(){const e=new Sha512H;return e._hasher=this._hasher.clone(),e}free(){}}function pkcAlgoSupported(e,t){throw new Error("Public key crypto not available in browser shim")}function pkcVerify(e,t,n,r,i){throw new Error("Public key crypto not available in browser shim")}eccExports.__setEcc(new NobleEcc),hashExports.__setHashes({sha256:sha256$1,sha256d:sha256d,shaRmd160:shaRmd160,sha512:sha512$1,Sha256H:Sha256H,Sha512H:Sha512H}),publicKeyCryptoExports.__setPkc({algoSupported:pkcAlgoSupported,verify:pkcVerify});var initBrowserShim=Object.freeze({__proto__:null}),hasRequiredIndexBrowser;function requireIndexBrowser(){return hasRequiredIndexBrowser||(hasRequiredIndexBrowser=1,e=indexBrowser,t=indexBrowser&&indexBrowser.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),n=indexBrowser&&indexBrowser.__exportStar||function(e,n){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(n,r)||t(n,e,r)},Object.defineProperty(e,"__esModule",{value:!0}),n(requireDist(),e),n(initBrowserShim,e)),indexBrowser;var e,t,n}var lookup=[],revLookup=[],Arr="undefined"!=typeof Uint8Array?Uint8Array:Array,inited=!1;function init(){inited=!0;for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0;t<64;++t)lookup[t]=e[t],revLookup[e.charCodeAt(t)]=t;revLookup["-".charCodeAt(0)]=62,revLookup["_".charCodeAt(0)]=63}function toByteArray(e){var t,n,r,i,o,s;inited||init();var a=e.length;if(a%4>0)throw new Error("Invalid string. Length must be a multiple of 4");o="="===e[a-2]?2:"="===e[a-1]?1:0,s=new Arr(3*a/4-o),r=o>0?a-4:a;var u=0;for(t=0,n=0;t<r;t+=4,n+=3)i=revLookup[e.charCodeAt(t)]<<18|revLookup[e.charCodeAt(t+1)]<<12|revLookup[e.charCodeAt(t+2)]<<6|revLookup[e.charCodeAt(t+3)],s[u++]=i>>16&255,s[u++]=i>>8&255,s[u++]=255&i;return 2===o?(i=revLookup[e.charCodeAt(t)]<<2|revLookup[e.charCodeAt(t+1)]>>4,s[u++]=255&i):1===o&&(i=revLookup[e.charCodeAt(t)]<<10|revLookup[e.charCodeAt(t+1)]<<4|revLookup[e.charCodeAt(t+2)]>>2,s[u++]=i>>8&255,s[u++]=255&i),s}function tripletToBase64(e){return lookup[e>>18&63]+lookup[e>>12&63]+lookup[e>>6&63]+lookup[63&e]}function encodeChunk(e,t,n){for(var r,i=[],o=t;o<n;o+=3)r=(e[o]<<16)+(e[o+1]<<8)+e[o+2],i.push(tripletToBase64(r));return i.join("")}function fromByteArray(e){var t;inited||init();for(var n=e.length,r=n%3,i="",o=[],s=16383,a=0,u=n-r;a<u;a+=s)o.push(encodeChunk(e,a,a+s>u?u:a+s));return 1===r?(t=e[n-1],i+=lookup[t>>2],i+=lookup[t<<4&63],i+="=="):2===r&&(t=(e[n-2]<<8)+e[n-1],i+=lookup[t>>10],i+=lookup[t>>4&63],i+=lookup[t<<2&63],i+="="),o.push(i),o.join("")}function read(e,t,n,r,i){var o,s,a=8*i-r-1,u=(1<<a)-1,c=u>>1,l=-7,h=n?i-1:0,d=n?-1:1,f=e[t+h];for(h+=d,o=f&(1<<-l)-1,f>>=-l,l+=a;l>0;o=256*o+e[t+h],h+=d,l-=8);for(s=o&(1<<-l)-1,o>>=-l,l+=r;l>0;s=256*s+e[t+h],h+=d,l-=8);if(0===o)o=1-c;else{if(o===u)return s?NaN:1/0*(f?-1:1);s+=Math.pow(2,r),o-=c}return(f?-1:1)*s*Math.pow(2,o-r)}function write(e,t,n,r,i,o){var s,a,u,c=8*o-i-1,l=(1<<c)-1,h=l>>1,d=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=r?0:o-1,p=r?1:-1,y=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=l):(s=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-s))<1&&(s--,u*=2),(t+=s+h>=1?d/u:d*Math.pow(2,1-h))*u>=2&&(s++,u/=2),s+h>=l?(a=0,s=l):s+h>=1?(a=(t*u-1)*Math.pow(2,i),s+=h):(a=t*Math.pow(2,h-1)*Math.pow(2,i),s=0));i>=8;e[n+f]=255&a,f+=p,a/=256,i-=8);for(s=s<<i|a,c+=i;c>0;e[n+f]=255&s,f+=p,s/=256,c-=8);e[n+f-p]|=128*y}var toString={}.toString,isArray=Array.isArray||function(e){return"[object Array]"==toString.call(e)},INSPECT_MAX_BYTES=50;Buffer$1.TYPED_ARRAY_SUPPORT=void 0===global.TYPED_ARRAY_SUPPORT||global.TYPED_ARRAY_SUPPORT;var _kMaxLength=kMaxLength();function kMaxLength(){return Buffer$1.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function createBuffer(e,t){if(kMaxLength()<t)throw new RangeError("Invalid typed array length");return Buffer$1.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=Buffer$1.prototype:(null===e&&(e=new Buffer$1(t)),e.length=t),e}function Buffer$1(e,t,n){if(!(Buffer$1.TYPED_ARRAY_SUPPORT||this instanceof Buffer$1))return new Buffer$1(e,t,n);if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return allocUnsafe(this,e)}return from(this,e,t,n)}function from(e,t,n,r){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?fromArrayBuffer(e,t,n,r):"string"==typeof t?fromString(e,t,n):fromObject(e,t)}function assertSize(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function alloc(e,t,n,r){return assertSize(t),t<=0?createBuffer(e,t):void 0!==n?"string"==typeof r?createBuffer(e,t).fill(n,r):createBuffer(e,t).fill(n):createBuffer(e,t)}function allocUnsafe(e,t){if(assertSize(t),e=createBuffer(e,t<0?0:0|checked(t)),!Buffer$1.TYPED_ARRAY_SUPPORT)for(var n=0;n<t;++n)e[n]=0;return e}function fromString(e,t,n){if("string"==typeof n&&""!==n||(n="utf8"),!Buffer$1.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var r=0|byteLength(t,n),i=(e=createBuffer(e,r)).write(t,n);return i!==r&&(e=e.slice(0,i)),e}function fromArrayLike(e,t){var n=t.length<0?0:0|checked(t.length);e=createBuffer(e,n);for(var r=0;r<n;r+=1)e[r]=255&t[r];return e}function fromArrayBuffer(e,t,n,r){if(t.byteLength,n<0||t.byteLength<n)throw new RangeError("'offset' is out of bounds");if(t.byteLength<n+(r||0))throw new RangeError("'length' is out of bounds");return t=void 0===n&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,n):new Uint8Array(t,n,r),Buffer$1.TYPED_ARRAY_SUPPORT?(e=t).__proto__=Buffer$1.prototype:e=fromArrayLike(e,t),e}function fromObject(e,t){if(internalIsBuffer(t)){var n=0|checked(t.length);return 0===(e=createBuffer(e,n)).length||t.copy(e,0,0,n),e}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||isnan(t.length)?createBuffer(e,0):fromArrayLike(e,t);if("Buffer"===t.type&&isArray(t.data))return fromArrayLike(e,t.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function checked(e){if(e>=kMaxLength())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+kMaxLength().toString(16)+" bytes");return 0|e}function SlowBuffer(e){return+e!=e&&(e=0),Buffer$1.alloc(+e)}function internalIsBuffer(e){return!(null==e||!e._isBuffer)}function byteLength(e,t){if(internalIsBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return utf8ToBytes(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return base64ToBytes(e).length;default:if(r)return utf8ToBytes(e).length;t=(""+t).toLowerCase(),r=!0}}function slowToString(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return hexSlice(this,t,n);case"utf8":case"utf-8":return utf8Slice(this,t,n);case"ascii":return asciiSlice(this,t,n);case"latin1":case"binary":return latin1Slice(this,t,n);case"base64":return base64Slice(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return utf16leSlice(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function swap(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function bidirectionalIndexOf(e,t,n,r,i){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof t&&(t=Buffer$1.from(t,r)),internalIsBuffer(t))return 0===t.length?-1:arrayIndexOf(e,t,n,r,i);if("number"==typeof t)return t&=255,Buffer$1.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):arrayIndexOf(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function arrayIndexOf(e,t,n,r,i){var o,s=1,a=e.length,u=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;s=2,a/=2,u/=2,n/=2}function c(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(i){var l=-1;for(o=n;o<a;o++)if(c(e,o)===c(t,-1===l?0:o-l)){if(-1===l&&(l=o),o-l+1===u)return l*s}else-1!==l&&(o-=o-l),l=-1}else for(n+u>a&&(n=a-u),o=n;o>=0;o--){for(var h=!0,d=0;d<u;d++)if(c(e,o+d)!==c(t,d)){h=!1;break}if(h)return o}return-1}function hexWrite(e,t,n,r){n=Number(n)||0;var i=e.length-n;r?(r=Number(r))>i&&(r=i):r=i;var o=t.length;if(o%2!=0)throw new TypeError("Invalid hex string");r>o/2&&(r=o/2);for(var s=0;s<r;++s){var a=parseInt(t.substr(2*s,2),16);if(isNaN(a))return s;e[n+s]=a}return s}function utf8Write(e,t,n,r){return blitBuffer(utf8ToBytes(t,e.length-n),e,n,r)}function asciiWrite(e,t,n,r){return blitBuffer(asciiToBytes(t),e,n,r)}function latin1Write(e,t,n,r){return asciiWrite(e,t,n,r)}function base64Write(e,t,n,r){return blitBuffer(base64ToBytes(t),e,n,r)}function ucs2Write(e,t,n,r){return blitBuffer(utf16leToBytes(t,e.length-n),e,n,r)}function base64Slice(e,t,n){return 0===t&&n===e.length?fromByteArray(e):fromByteArray(e.slice(t,n))}function utf8Slice(e,t,n){n=Math.min(e.length,n);for(var r=[],i=t;i<n;){var o,s,a,u,c=e[i],l=null,h=c>239?4:c>223?3:c>191?2:1;if(i+h<=n)switch(h){case 1:c<128&&(l=c);break;case 2:128==(192&(o=e[i+1]))&&(u=(31&c)<<6|63&o)>127&&(l=u);break;case 3:o=e[i+1],s=e[i+2],128==(192&o)&&128==(192&s)&&(u=(15&c)<<12|(63&o)<<6|63&s)>2047&&(u<55296||u>57343)&&(l=u);break;case 4:o=e[i+1],s=e[i+2],a=e[i+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(u=(15&c)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&u<1114112&&(l=u)}null===l?(l=65533,h=1):l>65535&&(l-=65536,r.push(l>>>10&1023|55296),l=56320|1023&l),r.push(l),i+=h}return decodeCodePointsArray(r)}Buffer$1.poolSize=8192,Buffer$1._augment=function(e){return e.__proto__=Buffer$1.prototype,e},Buffer$1.from=function(e,t,n){return from(null,e,t,n)},Buffer$1.TYPED_ARRAY_SUPPORT&&(Buffer$1.prototype.__proto__=Uint8Array.prototype,Buffer$1.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&Buffer$1[Symbol.species]),Buffer$1.alloc=function(e,t,n){return alloc(null,e,t,n)},Buffer$1.allocUnsafe=function(e){return allocUnsafe(null,e)},Buffer$1.allocUnsafeSlow=function(e){return allocUnsafe(null,e)},Buffer$1.isBuffer=isBuffer,Buffer$1.compare=function(e,t){if(!internalIsBuffer(e)||!internalIsBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var n=e.length,r=t.length,i=0,o=Math.min(n,r);i<o;++i)if(e[i]!==t[i]){n=e[i],r=t[i];break}return n<r?-1:r<n?1:0},Buffer$1.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},Buffer$1.concat=function(e,t){if(!isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return Buffer$1.alloc(0);var n;if(void 0===t)for(t=0,n=0;n<e.length;++n)t+=e[n].length;var r=Buffer$1.allocUnsafe(t),i=0;for(n=0;n<e.length;++n){var o=e[n];if(!internalIsBuffer(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(r,i),i+=o.length}return r},Buffer$1.byteLength=byteLength,Buffer$1.prototype._isBuffer=!0,Buffer$1.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)swap(this,t,t+1);return this},Buffer$1.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)swap(this,t,t+3),swap(this,t+1,t+2);return this},Buffer$1.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)swap(this,t,t+7),swap(this,t+1,t+6),swap(this,t+2,t+5),swap(this,t+3,t+4);return this},Buffer$1.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?utf8Slice(this,0,e):slowToString.apply(this,arguments)},Buffer$1.prototype.equals=function(e){if(!internalIsBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===Buffer$1.compare(this,e)},Buffer$1.prototype.inspect=function(){var e="",t=INSPECT_MAX_BYTES;return this.length>0&&(e=this.toString("hex",0,t).match(/.{2}/g).join(" "),this.length>t&&(e+=" ... ")),"<Buffer "+e+">"},Buffer$1.prototype.compare=function(e,t,n,r,i){if(!internalIsBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(r>>>=0),s=(n>>>=0)-(t>>>=0),a=Math.min(o,s),u=this.slice(r,i),c=e.slice(t,n),l=0;l<a;++l)if(u[l]!==c[l]){o=u[l],s=c[l];break}return o<s?-1:s<o?1:0},Buffer$1.prototype.includes=function(e,t,n){return-1!==this.indexOf(e,t,n)},Buffer$1.prototype.indexOf=function(e,t,n){return bidirectionalIndexOf(this,e,t,n,!0)},Buffer$1.prototype.lastIndexOf=function(e,t,n){return bidirectionalIndexOf(this,e,t,n,!1)},Buffer$1.prototype.write=function(e,t,n,r){if(void 0===t)r="utf8",n=this.length,t=0;else if(void 0===n&&"string"==typeof t)r=t,n=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t|=0,isFinite(n)?(n|=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}var i=this.length-t;if((void 0===n||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var o=!1;;)switch(r){case"hex":return hexWrite(this,e,t,n);case"utf8":case"utf-8":return utf8Write(this,e,t,n);case"ascii":return asciiWrite(this,e,t,n);case"latin1":case"binary":return latin1Write(this,e,t,n);case"base64":return base64Write(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ucs2Write(this,e,t,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},Buffer$1.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var MAX_ARGUMENTS_LENGTH=4096;function decodeCodePointsArray(e){var t=e.length;if(t<=MAX_ARGUMENTS_LENGTH)return String.fromCharCode.apply(String,e);for(var n="",r=0;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=MAX_ARGUMENTS_LENGTH));return n}function asciiSlice(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;i<n;++i)r+=String.fromCharCode(127&e[i]);return r}function latin1Slice(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;i<n;++i)r+=String.fromCharCode(e[i]);return r}function hexSlice(e,t,n){var r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);for(var i="",o=t;o<n;++o)i+=toHex(e[o]);return i}function utf16leSlice(e,t,n){for(var r=e.slice(t,n),i="",o=0;o<r.length;o+=2)i+=String.fromCharCode(r[o]+256*r[o+1]);return i}function checkOffset(e,t,n){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}function checkInt(e,t,n,r,i,o){if(!internalIsBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<o)throw new RangeError('"value" argument is out of bounds');if(n+r>e.length)throw new RangeError("Index out of range")}function objectWriteUInt16(e,t,n,r){t<0&&(t=65535+t+1);for(var i=0,o=Math.min(e.length-n,2);i<o;++i)e[n+i]=(t&255<<8*(r?i:1-i))>>>8*(r?i:1-i)}function objectWriteUInt32(e,t,n,r){t<0&&(t=4294967295+t+1);for(var i=0,o=Math.min(e.length-n,4);i<o;++i)e[n+i]=t>>>8*(r?i:3-i)&255}function checkIEEE754(e,t,n,r,i,o){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function writeFloat(e,t,n,r,i){return i||checkIEEE754(e,t,n,4),write(e,t,n,r,23,4),n+4}function writeDouble(e,t,n,r,i){return i||checkIEEE754(e,t,n,8),write(e,t,n,r,52,8),n+8}Buffer$1.prototype.slice=function(e,t){var n,r=this.length;if((e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e),Buffer$1.TYPED_ARRAY_SUPPORT)(n=this.subarray(e,t)).__proto__=Buffer$1.prototype;else{var i=t-e;n=new Buffer$1(i,void 0);for(var o=0;o<i;++o)n[o]=this[o+e]}return n},Buffer$1.prototype.readUIntLE=function(e,t,n){e|=0,t|=0,n||checkOffset(e,t,this.length);for(var r=this[e],i=1,o=0;++o<t&&(i*=256);)r+=this[e+o]*i;return r},Buffer$1.prototype.readUIntBE=function(e,t,n){e|=0,t|=0,n||checkOffset(e,t,this.length);for(var r=this[e+--t],i=1;t>0&&(i*=256);)r+=this[e+--t]*i;return r},Buffer$1.prototype.readUInt8=function(e,t){return t||checkOffset(e,1,this.length),this[e]},Buffer$1.prototype.readUInt16LE=function(e,t){return t||checkOffset(e,2,this.length),this[e]|this[e+1]<<8},Buffer$1.prototype.readUInt16BE=function(e,t){return t||checkOffset(e,2,this.length),this[e]<<8|this[e+1]},Buffer$1.prototype.readUInt32LE=function(e,t){return t||checkOffset(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},Buffer$1.prototype.readUInt32BE=function(e,t){return t||checkOffset(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},Buffer$1.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||checkOffset(e,t,this.length);for(var r=this[e],i=1,o=0;++o<t&&(i*=256);)r+=this[e+o]*i;return r>=(i*=128)&&(r-=Math.pow(2,8*t)),r},Buffer$1.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||checkOffset(e,t,this.length);for(var r=t,i=1,o=this[e+--r];r>0&&(i*=256);)o+=this[e+--r]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*t)),o},Buffer$1.prototype.readInt8=function(e,t){return t||checkOffset(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},Buffer$1.prototype.readInt16LE=function(e,t){t||checkOffset(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},Buffer$1.prototype.readInt16BE=function(e,t){t||checkOffset(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},Buffer$1.prototype.readInt32LE=function(e,t){return t||checkOffset(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},Buffer$1.prototype.readInt32BE=function(e,t){return t||checkOffset(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},Buffer$1.prototype.readFloatLE=function(e,t){return t||checkOffset(e,4,this.length),read(this,e,!0,23,4)},Buffer$1.prototype.readFloatBE=function(e,t){return t||checkOffset(e,4,this.length),read(this,e,!1,23,4)},Buffer$1.prototype.readDoubleLE=function(e,t){return t||checkOffset(e,8,this.length),read(this,e,!0,52,8)},Buffer$1.prototype.readDoubleBE=function(e,t){return t||checkOffset(e,8,this.length),read(this,e,!1,52,8)},Buffer$1.prototype.writeUIntLE=function(e,t,n,r){(e=+e,t|=0,n|=0,r)||checkInt(this,e,t,n,Math.pow(2,8*n)-1,0);var i=1,o=0;for(this[t]=255&e;++o<n&&(i*=256);)this[t+o]=e/i&255;return t+n},Buffer$1.prototype.writeUIntBE=function(e,t,n,r){(e=+e,t|=0,n|=0,r)||checkInt(this,e,t,n,Math.pow(2,8*n)-1,0);var i=n-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+n},Buffer$1.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||checkInt(this,e,t,1,255,0),Buffer$1.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},Buffer$1.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||checkInt(this,e,t,2,65535,0),Buffer$1.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):objectWriteUInt16(this,e,t,!0),t+2},Buffer$1.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||checkInt(this,e,t,2,65535,0),Buffer$1.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):objectWriteUInt16(this,e,t,!1),t+2},Buffer$1.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||checkInt(this,e,t,4,4294967295,0),Buffer$1.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):objectWriteUInt32(this,e,t,!0),t+4},Buffer$1.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||checkInt(this,e,t,4,4294967295,0),Buffer$1.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):objectWriteUInt32(this,e,t,!1),t+4},Buffer$1.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);checkInt(this,e,t,n,i-1,-i)}var o=0,s=1,a=0;for(this[t]=255&e;++o<n&&(s*=256);)e<0&&0===a&&0!==this[t+o-1]&&(a=1),this[t+o]=(e/s|0)-a&255;return t+n},Buffer$1.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);checkInt(this,e,t,n,i-1,-i)}var o=n-1,s=1,a=0;for(this[t+o]=255&e;--o>=0&&(s*=256);)e<0&&0===a&&0!==this[t+o+1]&&(a=1),this[t+o]=(e/s|0)-a&255;return t+n},Buffer$1.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||checkInt(this,e,t,1,127,-128),Buffer$1.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},Buffer$1.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||checkInt(this,e,t,2,32767,-32768),Buffer$1.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):objectWriteUInt16(this,e,t,!0),t+2},Buffer$1.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||checkInt(this,e,t,2,32767,-32768),Buffer$1.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):objectWriteUInt16(this,e,t,!1),t+2},Buffer$1.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||checkInt(this,e,t,4,2147483647,-2147483648),Buffer$1.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):objectWriteUInt32(this,e,t,!0),t+4},Buffer$1.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||checkInt(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),Buffer$1.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):objectWriteUInt32(this,e,t,!1),t+4},Buffer$1.prototype.writeFloatLE=function(e,t,n){return writeFloat(this,e,t,!0,n)},Buffer$1.prototype.writeFloatBE=function(e,t,n){return writeFloat(this,e,t,!1,n)},Buffer$1.prototype.writeDoubleLE=function(e,t,n){return writeDouble(this,e,t,!0,n)},Buffer$1.prototype.writeDoubleBE=function(e,t,n){return writeDouble(this,e,t,!1,n)},Buffer$1.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);var i,o=r-n;if(this===e&&n<t&&t<r)for(i=o-1;i>=0;--i)e[i+t]=this[i+n];else if(o<1e3||!Buffer$1.TYPED_ARRAY_SUPPORT)for(i=0;i<o;++i)e[i+t]=this[i+n];else Uint8Array.prototype.set.call(e,this.subarray(n,n+o),t);return o},Buffer$1.prototype.fill=function(e,t,n,r){if("string"==typeof e){if("string"==typeof t?(r=t,t=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),1===e.length){var i=e.charCodeAt(0);i<256&&(e=i)}if(void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!Buffer$1.isEncoding(r))throw new TypeError("Unknown encoding: "+r)}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;var o;if(t>>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(o=t;o<n;++o)this[o]=e;else{var s=internalIsBuffer(e)?e:utf8ToBytes(new Buffer$1(e,r).toString()),a=s.length;for(o=0;o<n-t;++o)this[o+t]=s[o%a]}return this};var INVALID_BASE64_RE=/[^+\/0-9A-Za-z-_]/g;function base64clean(e){if((e=stringtrim(e).replace(INVALID_BASE64_RE,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}function stringtrim(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function toHex(e){return e<16?"0"+e.toString(16):e.toString(16)}function utf8ToBytes(e,t){var n;t=t||1/0;for(var r=e.length,i=null,o=[],s=0;s<r;++s){if((n=e.charCodeAt(s))>55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===r){(t-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;o.push(n)}else if(n<2048){if((t-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function asciiToBytes(e){for(var t=[],n=0;n<e.length;++n)t.push(255&e.charCodeAt(n));return t}function utf16leToBytes(e,t){for(var n,r,i,o=[],s=0;s<e.length&&!((t-=2)<0);++s)r=(n=e.charCodeAt(s))>>8,i=n%256,o.push(i),o.push(r);return o}function base64ToBytes(e){return toByteArray(base64clean(e))}function blitBuffer(e,t,n,r){for(var i=0;i<r&&!(i+n>=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function isnan(e){return e!=e}function isBuffer(e){return null!=e&&(!!e._isBuffer||isFastBuffer(e)||isSlowBuffer(e))}function isFastBuffer(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}function isSlowBuffer(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&isFastBuffer(e.slice(0,0))}var _polyfillNode_buffer=Object.freeze({__proto__:null,Buffer:Buffer$1,INSPECT_MAX_BYTES:INSPECT_MAX_BYTES,SlowBuffer:SlowBuffer,isBuffer:isBuffer,kMaxLength:_kMaxLength}),require$$0=getDefaultExportFromNamespaceIfNotNamed(_polyfillNode_buffer),sha256={},sha2={},_md={},utils={},crypto={},hasRequiredCrypto,hasRequiredUtils,hasRequired_md;function requireCrypto(){return hasRequiredCrypto||(hasRequiredCrypto=1,Object.defineProperty(crypto,"__esModule",{value:!0}),crypto.crypto=void 0,crypto.crypto="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0),crypto}function requireUtils(){return hasRequiredUtils||(hasRequiredUtils=1,function(e){
55
+ function isBytes(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&"Uint8Array"===e.constructor.name}function anumber(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function abytes(e,...t){if(!isBytes(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error("Uint8Array expected of length "+t+", got length="+e.length)}function ahash(e){if("function"!=typeof e||"function"!=typeof e.create)throw new Error("Hash should be wrapped by utils.createHasher");anumber(e.outputLen),anumber(e.blockLen)}function aexists(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function aoutput(e,t){abytes(e);const n=t.outputLen;if(e.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}function clean(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function createView(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function rotr(e,t){return e<<32-t|e>>>t}function rotl(e,t){return e<<t|e>>>32-t>>>0}function utf8ToBytes$1(e){if("string"!=typeof e)throw new Error("string expected");return new Uint8Array((new TextEncoder).encode(e))}function toBytes(e){return"string"==typeof e&&(e=utf8ToBytes$1(e)),abytes(e),e}function concatBytes(...e){let t=0;for(let n=0;n<e.length;n++){const r=e[n];abytes(r),t+=r.length}const n=new Uint8Array(t);for(let t=0,r=0;t<e.length;t++){const i=e[t];n.set(i,r),r+=i.length}return n}class Hash{}function createHasher(e){const t=t=>e().update(toBytes(t)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function setBigUint64(e,t,n,r){if("function"==typeof e.setBigUint64)return e.setBigUint64(t,n,r);const i=BigInt(32),o=BigInt(4294967295),s=Number(n>>i&o),a=Number(n&o),u=r?4:0,c=r?0:4;e.setUint32(t+u,s,r),e.setUint32(t+c,a,r)}function Chi(e,t,n){return e&t^~e&n}function Maj(e,t,n){return e&t^e&n^t&n}class HashMD extends Hash{constructor(e,t,n,r){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=e,this.outputLen=t,this.padOffset=n,this.isLE=r,this.buffer=new Uint8Array(e),this.view=createView(this.buffer)}update(e){aexists(this),abytes(e=toBytes(e));const{view:t,buffer:n,blockLen:r}=this,i=e.length;for(let o=0;o<i;){const s=Math.min(r-this.pos,i-o);if(s===r){const t=createView(e);for(;r<=i-o;o+=r)this.process(t,o);continue}n.set(e.subarray(o,o+s),this.pos),this.pos+=s,o+=s,this.pos===r&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){aexists(this),aoutput(e,this),this.finished=!0;const{buffer:t,view:n,blockLen:r,isLE:i}=this;let{pos:o}=this;t[o++]=128,clean(this.buffer.subarray(o)),this.padOffset>r-o&&(this.process(n,0),o=0);for(let e=o;e<r;e++)t[e]=0;setBigUint64(n,r-8,BigInt(8*this.length),i),this.process(n,0);const s=createView(e),a=this.outputLen;if(a%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const u=a/4,c=this.get();if(u>c.length)throw new Error("_sha2: outputLen bigger than state");for(let e=0;e<u;e++)s.setUint32(4*e,c[e],i)}digest(){const{buffer:e,outputLen:t}=this;this.digestInto(e);const n=e.slice(0,t);return this.destroy(),n}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:t,buffer:n,length:r,finished:i,destroyed:o,pos:s}=this;return e.destroyed=o,e.finished=i,e.length=r,e.pos=s,r%t&&e.buffer.set(n),e}clone(){return this._cloneInto()}}const SHA256_IV=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),SHA512_IV=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209]),U32_MASK64=BigInt(2**32-1),_32n=BigInt(32);function fromBig(e,t=!1){return t?{h:Number(e&U32_MASK64),l:Number(e>>_32n&U32_MASK64)}:{h:0|Number(e>>_32n&U32_MASK64),l:0|Number(e&U32_MASK64)}}function split(e,t=!1){const n=e.length;let r=new Uint32Array(n),i=new Uint32Array(n);for(let o=0;o<n;o++){const{h:n,l:s}=fromBig(e[o],t);[r[o],i[o]]=[n,s]}return[r,i]}const shrSH=(e,t,n)=>e>>>n,shrSL=(e,t,n)=>e<<32-n|t>>>n,rotrSH=(e,t,n)=>e>>>n|t<<32-n,rotrSL=(e,t,n)=>e<<32-n|t>>>n,rotrBH=(e,t,n)=>e<<64-n|t>>>n-32,rotrBL=(e,t,n)=>e>>>n-32|t<<64-n;function add(e,t,n,r){const i=(t>>>0)+(r>>>0);return{h:e+n+(i/2**32|0)|0,l:0|i}}const add3L=(e,t,n)=>(e>>>0)+(t>>>0)+(n>>>0),add3H=(e,t,n,r)=>t+n+r+(e/2**32|0)|0,add4L=(e,t,n,r)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0),add4H=(e,t,n,r,i)=>t+n+r+i+(e/2**32|0)|0,add5L=(e,t,n,r,i)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0)+(i>>>0),add5H=(e,t,n,r,i,o)=>t+n+r+i+o+(e/2**32|0)|0,SHA256_K=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),SHA256_W=new Uint32Array(64);class SHA256 extends HashMD{constructor(e=32){super(64,e,8,!1),this.A=0|SHA256_IV[0],this.B=0|SHA256_IV[1],this.C=0|SHA256_IV[2],this.D=0|SHA256_IV[3],this.E=0|SHA256_IV[4],this.F=0|SHA256_IV[5],this.G=0|SHA256_IV[6],this.H=0|SHA256_IV[7]}get(){const{A:e,B:t,C:n,D:r,E:i,F:o,G:s,H:a}=this;return[e,t,n,r,i,o,s,a]}set(e,t,n,r,i,o,s,a){this.A=0|e,this.B=0|t,this.C=0|n,this.D=0|r,this.E=0|i,this.F=0|o,this.G=0|s,this.H=0|a}process(e,t){for(let n=0;n<16;n++,t+=4)SHA256_W[n]=e.getUint32(t,!1);for(let e=16;e<64;e++){const t=SHA256_W[e-15],n=SHA256_W[e-2],r=rotr(t,7)^rotr(t,18)^t>>>3,i=rotr(n,17)^rotr(n,19)^n>>>10;SHA256_W[e]=i+SHA256_W[e-7]+r+SHA256_W[e-16]|0}let{A:n,B:r,C:i,D:o,E:s,F:a,G:u,H:c}=this;for(let e=0;e<64;e++){const t=c+(rotr(s,6)^rotr(s,11)^rotr(s,25))+Chi(s,a,u)+SHA256_K[e]+SHA256_W[e]|0,l=(rotr(n,2)^rotr(n,13)^rotr(n,22))+Maj(n,r,i)|0;c=u,u=a,a=s,s=o+t|0,o=i,i=r,r=n,n=t+l|0}n=n+this.A|0,r=r+this.B|0,i=i+this.C|0,o=o+this.D|0,s=s+this.E|0,a=a+this.F|0,u=u+this.G|0,c=c+this.H|0,this.set(n,r,i,o,s,a,u,c)}roundClean(){clean(SHA256_W)}destroy(){this.set(0,0,0,0,0,0,0,0),clean(this.buffer)}}const K512=(()=>split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(e=>BigInt(e))))(),SHA512_Kh=(()=>K512[0])(),SHA512_Kl=(()=>K512[1])(),SHA512_W_H=new Uint32Array(80),SHA512_W_L=new Uint32Array(80);class SHA512 extends HashMD{constructor(e=64){super(128,e,16,!1),this.Ah=0|SHA512_IV[0],this.Al=0|SHA512_IV[1],this.Bh=0|SHA512_IV[2],this.Bl=0|SHA512_IV[3],this.Ch=0|SHA512_IV[4],this.Cl=0|SHA512_IV[5],this.Dh=0|SHA512_IV[6],this.Dl=0|SHA512_IV[7],this.Eh=0|SHA512_IV[8],this.El=0|SHA512_IV[9],this.Fh=0|SHA512_IV[10],this.Fl=0|SHA512_IV[11],this.Gh=0|SHA512_IV[12],this.Gl=0|SHA512_IV[13],this.Hh=0|SHA512_IV[14],this.Hl=0|SHA512_IV[15]}get(){const{Ah:e,Al:t,Bh:n,Bl:r,Ch:i,Cl:o,Dh:s,Dl:a,Eh:u,El:c,Fh:l,Fl:h,Gh:d,Gl:f,Hh:p,Hl:y}=this;return[e,t,n,r,i,o,s,a,u,c,l,h,d,f,p,y]}set(e,t,n,r,i,o,s,a,u,c,l,h,d,f,p,y){this.Ah=0|e,this.Al=0|t,this.Bh=0|n,this.Bl=0|r,this.Ch=0|i,this.Cl=0|o,this.Dh=0|s,this.Dl=0|a,this.Eh=0|u,this.El=0|c,this.Fh=0|l,this.Fl=0|h,this.Gh=0|d,this.Gl=0|f,this.Hh=0|p,this.Hl=0|y}process(e,t){for(let n=0;n<16;n++,t+=4)SHA512_W_H[n]=e.getUint32(t),SHA512_W_L[n]=e.getUint32(t+=4);for(let e=16;e<80;e++){const t=0|SHA512_W_H[e-15],n=0|SHA512_W_L[e-15],r=rotrSH(t,n,1)^rotrSH(t,n,8)^shrSH(t,n,7),i=rotrSL(t,n,1)^rotrSL(t,n,8)^shrSL(t,n,7),o=0|SHA512_W_H[e-2],s=0|SHA512_W_L[e-2],a=rotrSH(o,s,19)^rotrBH(o,s,61)^shrSH(o,s,6),u=rotrSL(o,s,19)^rotrBL(o,s,61)^shrSL(o,s,6),c=add4L(i,u,SHA512_W_L[e-7],SHA512_W_L[e-16]),l=add4H(c,r,a,SHA512_W_H[e-7],SHA512_W_H[e-16]);SHA512_W_H[e]=0|l,SHA512_W_L[e]=0|c}let{Ah:n,Al:r,Bh:i,Bl:o,Ch:s,Cl:a,Dh:u,Dl:c,Eh:l,El:h,Fh:d,Fl:f,Gh:p,Gl:y,Hh:g,Hl:m}=this;for(let e=0;e<80;e++){const t=rotrSH(l,h,14)^rotrSH(l,h,18)^rotrBH(l,h,41),b=rotrSL(l,h,14)^rotrSL(l,h,18)^rotrBL(l,h,41),w=l&d^~l&p,_=add5L(m,b,h&f^~h&y,SHA512_Kl[e],SHA512_W_L[e]),x=add5H(_,g,t,w,SHA512_Kh[e],SHA512_W_H[e]),S=0|_,E=rotrSH(n,r,28)^rotrBH(n,r,34)^rotrBH(n,r,39),k=rotrSL(n,r,28)^rotrBL(n,r,34)^rotrBL(n,r,39),T=n&i^n&s^i&s,v=r&o^r&a^o&a;g=0|p,m=0|y,p=0|d,y=0|f,d=0|l,f=0|h,({h:l,l:h}=add(0|u,0|c,0|x,0|S)),u=0|s,c=0|a,s=0|i,a=0|o,i=0|n,o=0|r;const A=add3L(S,k,v);n=add3H(A,x,E,T),r=0|A}({h:n,l:r}=add(0|this.Ah,0|this.Al,0|n,0|r)),({h:i,l:o}=add(0|this.Bh,0|this.Bl,0|i,0|o)),({h:s,l:a}=add(0|this.Ch,0|this.Cl,0|s,0|a)),({h:u,l:c}=add(0|this.Dh,0|this.Dl,0|u,0|c)),({h:l,l:h}=add(0|this.Eh,0|this.El,0|l,0|h)),({h:d,l:f}=add(0|this.Fh,0|this.Fl,0|d,0|f)),({h:p,l:y}=add(0|this.Gh,0|this.Gl,0|p,0|y)),({h:g,l:m}=add(0|this.Hh,0|this.Hl,0|g,0|m)),this.set(n,r,i,o,s,a,u,c,l,h,d,f,p,y,g,m)}roundClean(){clean(SHA512_W_H,SHA512_W_L)}destroy(){clean(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}const sha256$2=createHasher(()=>new SHA256),sha512$2=createHasher(()=>new SHA512),Rho160=Uint8Array.from([7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8]),Id160=(()=>Uint8Array.from(new Array(16).fill(0).map((e,t)=>t)))(),Pi160=(()=>Id160.map(e=>(9*e+5)%16))(),idxLR=(()=>{const e=[[Id160],[Pi160]];for(let t=0;t<4;t++)for(let n of e)n.push(n[t].map(e=>Rho160[e]));return e})(),idxL=(()=>idxLR[0])(),idxR=(()=>idxLR[1])(),shifts160=[[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8],[12,13,11,15,6,9,9,7,12,15,11,13,7,8,7,7],[13,15,14,11,7,7,6,8,13,14,13,12,5,5,6,9],[14,11,12,14,8,6,5,5,15,12,15,14,9,9,8,6],[15,12,13,13,9,5,8,6,14,11,12,11,8,6,5,5]].map(e=>Uint8Array.from(e)),shiftsL160=idxL.map((e,t)=>e.map(e=>shifts160[t][e])),shiftsR160=idxR.map((e,t)=>e.map(e=>shifts160[t][e])),Kl160=Uint32Array.from([0,1518500249,1859775393,2400959708,2840853838]),Kr160=Uint32Array.from([1352829926,1548603684,1836072691,2053994217,0]);function ripemd_f(e,t,n,r){return 0===e?t^n^r:1===e?t&n|~t&r:2===e?(t|~n)^r:3===e?t&r|n&~r:t^(n|~r)}const BUF_160=new Uint32Array(16);class RIPEMD160 extends HashMD{constructor(){super(64,20,8,!0),this.h0=1732584193,this.h1=-271733879,this.h2=-1732584194,this.h3=271733878,this.h4=-1009589776}get(){const{h0:e,h1:t,h2:n,h3:r,h4:i}=this;return[e,t,n,r,i]}set(e,t,n,r,i){this.h0=0|e,this.h1=0|t,this.h2=0|n,this.h3=0|r,this.h4=0|i}process(e,t){for(let n=0;n<16;n++,t+=4)BUF_160[n]=e.getUint32(t,!0);let n=0|this.h0,r=n,i=0|this.h1,o=i,s=0|this.h2,a=s,u=0|this.h3,c=u,l=0|this.h4,h=l;for(let e=0;e<5;e++){const t=4-e,d=Kl160[e],f=Kr160[e],p=idxL[e],y=idxR[e],g=shiftsL160[e],m=shiftsR160[e];for(let t=0;t<16;t++){const r=rotl(n+ripemd_f(e,i,s,u)+BUF_160[p[t]]+d,g[t])+l|0;n=l,l=u,u=0|rotl(s,10),s=i,i=r}for(let e=0;e<16;e++){const n=rotl(r+ripemd_f(t,o,a,c)+BUF_160[y[e]]+f,m[e])+h|0;r=h,h=c,c=0|rotl(a,10),a=o,o=n}}this.set(this.h1+s+c|0,this.h2+u+h|0,this.h3+l+r|0,this.h4+n+o|0,this.h0+i+a|0)}roundClean(){clean(BUF_160)}destroy(){this.destroyed=!0,clean(this.buffer),this.set(0,0,0,0,0)}}const ripemd160$2=createHasher(()=>new RIPEMD160),ripemd160$1=ripemd160$2;class HMAC extends Hash{constructor(e,t){super(),this.finished=!1,this.destroyed=!1,ahash(e);const n=toBytes(t);if(this.iHash=e.create(),"function"!=typeof this.iHash.update)throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const r=this.blockLen,i=new Uint8Array(r);i.set(n.length>r?e.create().update(n).digest():n);for(let e=0;e<i.length;e++)i[e]^=54;this.iHash.update(i),this.oHash=e.create();for(let e=0;e<i.length;e++)i[e]^=106;this.oHash.update(i),clean(i)}update(e){return aexists(this),this.iHash.update(e),this}digestInto(e){aexists(this),abytes(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){const e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||(e=Object.create(Object.getPrototypeOf(this),{}));const{oHash:t,iHash:n,finished:r,destroyed:i,blockLen:o,outputLen:s}=this;return e.finished=r,e.destroyed=i,e.blockLen=o,e.outputLen=s,e.oHash=t._cloneInto(e.oHash),e.iHash=n._cloneInto(e.iHash),e}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const hmac$1=(e,t,n)=>new HMAC(e,t).update(n).digest();hmac$1.create=(e,t)=>new HMAC(e,t);var eccExports=requireEcc(),hashExports=requireHash(),publicKeyCrypto={},hasRequiredPublicKeyCrypto;function requirePublicKeyCrypto(){if(hasRequiredPublicKeyCrypto)return publicKeyCrypto;hasRequiredPublicKeyCrypto=1,Object.defineProperty(publicKeyCrypto,"__esModule",{value:!0}),publicKeyCrypto.PkcAlgo=void 0,publicKeyCrypto.__setPkc=function(e){t.verify=e.verify,t.algoSupported=e.algoSupported};class e{constructor(e){this.algoOid=e.algoOid,this.params=e.params}static fromOid(n,r){try{t.algoSupported(n,r)}catch(e){throw new Error(e)}return new e({algoOid:n,params:r})}verify(e,n,r){try{t.verify(this.algoOid,this.params,e,n,r)}catch(e){throw new Error(e)}}}publicKeyCrypto.PkcAlgo=e;const t={};return publicKeyCrypto}var publicKeyCryptoExports=requirePublicKeyCrypto();const N=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141");function bytesToBigInt(e){let t=BigInt(0);for(let n=0;n<e.length;n++)t=t<<BigInt(8)|BigInt(e[n]);return t}function bigIntToBytes(e,t){const n=new Uint8Array(t);for(let r=t-1;r>=0;r--)n[r]=Number(e&BigInt(255)),e>>=BigInt(8);return n}function mod(e,t){const n=e%t;return n>=BigInt(0)?n:n+t}const P=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f");function modPow(e,t,n){e%=n;let r=1n;for(;t>0n;)1n&t&&(r=r*e%n),e=e*e%n,t>>=1n;return r}function isQuadResidue(e){return 1n===modPow(e,(P-1n)/2n,P)}function rfc6979k(e,t,n){const r=concatBytes(e,t,n);let i=new Uint8Array(32).fill(1),o=new Uint8Array(32).fill(0);const s=(e,t)=>hmac$1(sha256$2,e,t);for(o=s(o,concatBytes(i,new Uint8Array([0]),r)),i=s(o,i),o=s(o,concatBytes(i,new Uint8Array([1]),r)),i=s(o,i);;){i=s(o,i);const e=bytesToBigInt(i);if(e>0n&&e<N)return e;o=s(o,concatBytes(i,new Uint8Array([0]))),i=s(o,i)}}class NobleEcc{derivePubkey(e){return secp256k1.getPublicKey(e,!0)}ecdsaSign(e,t){return secp256k1.sign(t,e,{lowS:!0,prehash:!1}).toDERRawBytes()}ecdsaVerify(e,t,n){if(!secp256k1.verify(e,t,n,{lowS:!0,prehash:!1}))throw new Error("ECDSA signature verification failed")}schnorrSign(e,t){const n=rfc6979k(e,t,new Uint8Array([83,99,104,110,111,114,114,43,83,72,65,50,53,54,32,32])),r=secp256k1.Point.BASE.multiply(n).toAffine(),i=isQuadResidue(r.y)?n:N-n,o=bigIntToBytes(r.x,32),s=secp256k1.getPublicKey(e,!0),a=mod(bytesToBigInt(sha256$2(concatBytes(o,s,t))),N),u=mod(i+a*bytesToBigInt(e),N),c=new Uint8Array(64);return c.set(o,0),c.set(bigIntToBytes(u,32),32),c}schnorrVerify(e,t,n){const r=bytesToBigInt(e.slice(0,32)),i=bytesToBigInt(e.slice(32,64));if(r>=P||i>=N)throw new Error("Schnorr signature verification failed");const o=33===n.length?n:secp256k1.Point.fromHex(n).toRawBytes(!0),s=mod(bytesToBigInt(sha256$2(concatBytes(e.slice(0,32),o,t))),N),a=secp256k1.Point.fromHex(n),u=secp256k1.Point.BASE.multiply(i).add(a.negate().multiply(s));if(u.equals(secp256k1.Point.ZERO))throw new Error("Schnorr signature verification failed");const c=u.toAffine();if(c.x!==r)throw new Error("Schnorr signature verification failed");if(!isQuadResidue(c.y))throw new Error("Schnorr signature verification failed")}isValidSeckey(e){try{if(32!==e.length)return!1;const t=bytesToBigInt(e);return t>BigInt(0)&&t<N}catch(e){return!1}}seckeyAdd(e,t){return bigIntToBytes(mod(bytesToBigInt(e)+bytesToBigInt(t),N),32)}pubkeyAdd(e,t){const n=secp256k1.Point.fromHex(e),r=secp256k1.Point.fromHex(t);return n.add(r).toRawBytes(!0)}signRecoverable(e,t){return secp256k1.sign(t,e,{lowS:!0,prehash:!1,format:"recovered"})}recoverSig(e,t){return secp256k1.recoverPublicKey(e,t,{prehash:!1})}}function sha256$1(e){return sha256$2(e)}function sha256d(e){return sha256$2(sha256$2(e))}function shaRmd160(e){return ripemd160$1(sha256$2(e))}function sha512$1(e){return sha512$2(e)}class Sha256H{constructor(){this._hasher=sha256$2.create()}update(e){this._hasher.update(e)}finalize(){return this._hasher.clone().digest()}clone(){const e=new Sha256H;return e._hasher=this._hasher.clone(),e}free(){}}class Sha512H{constructor(){this._hasher=sha512$2.create()}update(e){this._hasher.update(e)}finalize(){return this._hasher.clone().digest()}clone(){const e=new Sha512H;return e._hasher=this._hasher.clone(),e}free(){}}function pkcAlgoSupported(e,t){throw new Error("Public key crypto not available in browser shim")}function pkcVerify(e,t,n,r,i){throw new Error("Public key crypto not available in browser shim")}eccExports.__setEcc(new NobleEcc),hashExports.__setHashes({sha256:sha256$1,sha256d:sha256d,shaRmd160:shaRmd160,sha512:sha512$1,Sha256H:Sha256H,Sha512H:Sha512H}),publicKeyCryptoExports.__setPkc({algoSupported:pkcAlgoSupported,verify:pkcVerify});var initBrowserShim=Object.freeze({__proto__:null}),hasRequiredIndexBrowser;function requireIndexBrowser(){return hasRequiredIndexBrowser||(hasRequiredIndexBrowser=1,e=indexBrowser,t=indexBrowser&&indexBrowser.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),n=indexBrowser&&indexBrowser.__exportStar||function(e,n){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(n,r)||t(n,e,r)},Object.defineProperty(e,"__esModule",{value:!0}),n(requireDist(),e),n(initBrowserShim,e)),indexBrowser;var e,t,n}var lookup=[],revLookup=[],Arr="undefined"!=typeof Uint8Array?Uint8Array:Array,inited=!1;function init(){inited=!0;for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0;t<64;++t)lookup[t]=e[t],revLookup[e.charCodeAt(t)]=t;revLookup["-".charCodeAt(0)]=62,revLookup["_".charCodeAt(0)]=63}function toByteArray(e){var t,n,r,i,o,s;inited||init();var a=e.length;if(a%4>0)throw new Error("Invalid string. Length must be a multiple of 4");o="="===e[a-2]?2:"="===e[a-1]?1:0,s=new Arr(3*a/4-o),r=o>0?a-4:a;var u=0;for(t=0,n=0;t<r;t+=4,n+=3)i=revLookup[e.charCodeAt(t)]<<18|revLookup[e.charCodeAt(t+1)]<<12|revLookup[e.charCodeAt(t+2)]<<6|revLookup[e.charCodeAt(t+3)],s[u++]=i>>16&255,s[u++]=i>>8&255,s[u++]=255&i;return 2===o?(i=revLookup[e.charCodeAt(t)]<<2|revLookup[e.charCodeAt(t+1)]>>4,s[u++]=255&i):1===o&&(i=revLookup[e.charCodeAt(t)]<<10|revLookup[e.charCodeAt(t+1)]<<4|revLookup[e.charCodeAt(t+2)]>>2,s[u++]=i>>8&255,s[u++]=255&i),s}function tripletToBase64(e){return lookup[e>>18&63]+lookup[e>>12&63]+lookup[e>>6&63]+lookup[63&e]}function encodeChunk(e,t,n){for(var r,i=[],o=t;o<n;o+=3)r=(e[o]<<16)+(e[o+1]<<8)+e[o+2],i.push(tripletToBase64(r));return i.join("")}function fromByteArray(e){var t;inited||init();for(var n=e.length,r=n%3,i="",o=[],s=16383,a=0,u=n-r;a<u;a+=s)o.push(encodeChunk(e,a,a+s>u?u:a+s));return 1===r?(t=e[n-1],i+=lookup[t>>2],i+=lookup[t<<4&63],i+="=="):2===r&&(t=(e[n-2]<<8)+e[n-1],i+=lookup[t>>10],i+=lookup[t>>4&63],i+=lookup[t<<2&63],i+="="),o.push(i),o.join("")}function read(e,t,n,r,i){var o,s,a=8*i-r-1,u=(1<<a)-1,c=u>>1,l=-7,h=n?i-1:0,d=n?-1:1,f=e[t+h];for(h+=d,o=f&(1<<-l)-1,f>>=-l,l+=a;l>0;o=256*o+e[t+h],h+=d,l-=8);for(s=o&(1<<-l)-1,o>>=-l,l+=r;l>0;s=256*s+e[t+h],h+=d,l-=8);if(0===o)o=1-c;else{if(o===u)return s?NaN:1/0*(f?-1:1);s+=Math.pow(2,r),o-=c}return(f?-1:1)*s*Math.pow(2,o-r)}function write(e,t,n,r,i,o){var s,a,u,c=8*o-i-1,l=(1<<c)-1,h=l>>1,d=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=r?0:o-1,p=r?1:-1,y=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=l):(s=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-s))<1&&(s--,u*=2),(t+=s+h>=1?d/u:d*Math.pow(2,1-h))*u>=2&&(s++,u/=2),s+h>=l?(a=0,s=l):s+h>=1?(a=(t*u-1)*Math.pow(2,i),s+=h):(a=t*Math.pow(2,h-1)*Math.pow(2,i),s=0));i>=8;e[n+f]=255&a,f+=p,a/=256,i-=8);for(s=s<<i|a,c+=i;c>0;e[n+f]=255&s,f+=p,s/=256,c-=8);e[n+f-p]|=128*y}var toString={}.toString,isArray=Array.isArray||function(e){return"[object Array]"==toString.call(e)},INSPECT_MAX_BYTES=50;Buffer$1.TYPED_ARRAY_SUPPORT=void 0===global.TYPED_ARRAY_SUPPORT||global.TYPED_ARRAY_SUPPORT;var _kMaxLength=kMaxLength();function kMaxLength(){return Buffer$1.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function createBuffer(e,t){if(kMaxLength()<t)throw new RangeError("Invalid typed array length");return Buffer$1.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=Buffer$1.prototype:(null===e&&(e=new Buffer$1(t)),e.length=t),e}function Buffer$1(e,t,n){if(!(Buffer$1.TYPED_ARRAY_SUPPORT||this instanceof Buffer$1))return new Buffer$1(e,t,n);if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return allocUnsafe(this,e)}return from(this,e,t,n)}function from(e,t,n,r){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?fromArrayBuffer(e,t,n,r):"string"==typeof t?fromString(e,t,n):fromObject(e,t)}function assertSize(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function alloc(e,t,n,r){return assertSize(t),t<=0?createBuffer(e,t):void 0!==n?"string"==typeof r?createBuffer(e,t).fill(n,r):createBuffer(e,t).fill(n):createBuffer(e,t)}function allocUnsafe(e,t){if(assertSize(t),e=createBuffer(e,t<0?0:0|checked(t)),!Buffer$1.TYPED_ARRAY_SUPPORT)for(var n=0;n<t;++n)e[n]=0;return e}function fromString(e,t,n){if("string"==typeof n&&""!==n||(n="utf8"),!Buffer$1.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var r=0|byteLength(t,n),i=(e=createBuffer(e,r)).write(t,n);return i!==r&&(e=e.slice(0,i)),e}function fromArrayLike(e,t){var n=t.length<0?0:0|checked(t.length);e=createBuffer(e,n);for(var r=0;r<n;r+=1)e[r]=255&t[r];return e}function fromArrayBuffer(e,t,n,r){if(t.byteLength,n<0||t.byteLength<n)throw new RangeError("'offset' is out of bounds");if(t.byteLength<n+(r||0))throw new RangeError("'length' is out of bounds");return t=void 0===n&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,n):new Uint8Array(t,n,r),Buffer$1.TYPED_ARRAY_SUPPORT?(e=t).__proto__=Buffer$1.prototype:e=fromArrayLike(e,t),e}function fromObject(e,t){if(internalIsBuffer(t)){var n=0|checked(t.length);return 0===(e=createBuffer(e,n)).length||t.copy(e,0,0,n),e}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||isnan(t.length)?createBuffer(e,0):fromArrayLike(e,t);if("Buffer"===t.type&&isArray(t.data))return fromArrayLike(e,t.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function checked(e){if(e>=kMaxLength())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+kMaxLength().toString(16)+" bytes");return 0|e}function SlowBuffer(e){return+e!=e&&(e=0),Buffer$1.alloc(+e)}function internalIsBuffer(e){return!(null==e||!e._isBuffer)}function byteLength(e,t){if(internalIsBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return utf8ToBytes(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return base64ToBytes(e).length;default:if(r)return utf8ToBytes(e).length;t=(""+t).toLowerCase(),r=!0}}function slowToString(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return hexSlice(this,t,n);case"utf8":case"utf-8":return utf8Slice(this,t,n);case"ascii":return asciiSlice(this,t,n);case"latin1":case"binary":return latin1Slice(this,t,n);case"base64":return base64Slice(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return utf16leSlice(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function swap(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function bidirectionalIndexOf(e,t,n,r,i){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof t&&(t=Buffer$1.from(t,r)),internalIsBuffer(t))return 0===t.length?-1:arrayIndexOf(e,t,n,r,i);if("number"==typeof t)return t&=255,Buffer$1.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):arrayIndexOf(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function arrayIndexOf(e,t,n,r,i){var o,s=1,a=e.length,u=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;s=2,a/=2,u/=2,n/=2}function c(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(i){var l=-1;for(o=n;o<a;o++)if(c(e,o)===c(t,-1===l?0:o-l)){if(-1===l&&(l=o),o-l+1===u)return l*s}else-1!==l&&(o-=o-l),l=-1}else for(n+u>a&&(n=a-u),o=n;o>=0;o--){for(var h=!0,d=0;d<u;d++)if(c(e,o+d)!==c(t,d)){h=!1;break}if(h)return o}return-1}function hexWrite(e,t,n,r){n=Number(n)||0;var i=e.length-n;r?(r=Number(r))>i&&(r=i):r=i;var o=t.length;if(o%2!=0)throw new TypeError("Invalid hex string");r>o/2&&(r=o/2);for(var s=0;s<r;++s){var a=parseInt(t.substr(2*s,2),16);if(isNaN(a))return s;e[n+s]=a}return s}function utf8Write(e,t,n,r){return blitBuffer(utf8ToBytes(t,e.length-n),e,n,r)}function asciiWrite(e,t,n,r){return blitBuffer(asciiToBytes(t),e,n,r)}function latin1Write(e,t,n,r){return asciiWrite(e,t,n,r)}function base64Write(e,t,n,r){return blitBuffer(base64ToBytes(t),e,n,r)}function ucs2Write(e,t,n,r){return blitBuffer(utf16leToBytes(t,e.length-n),e,n,r)}function base64Slice(e,t,n){return 0===t&&n===e.length?fromByteArray(e):fromByteArray(e.slice(t,n))}function utf8Slice(e,t,n){n=Math.min(e.length,n);for(var r=[],i=t;i<n;){var o,s,a,u,c=e[i],l=null,h=c>239?4:c>223?3:c>191?2:1;if(i+h<=n)switch(h){case 1:c<128&&(l=c);break;case 2:128==(192&(o=e[i+1]))&&(u=(31&c)<<6|63&o)>127&&(l=u);break;case 3:o=e[i+1],s=e[i+2],128==(192&o)&&128==(192&s)&&(u=(15&c)<<12|(63&o)<<6|63&s)>2047&&(u<55296||u>57343)&&(l=u);break;case 4:o=e[i+1],s=e[i+2],a=e[i+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(u=(15&c)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&u<1114112&&(l=u)}null===l?(l=65533,h=1):l>65535&&(l-=65536,r.push(l>>>10&1023|55296),l=56320|1023&l),r.push(l),i+=h}return decodeCodePointsArray(r)}Buffer$1.poolSize=8192,Buffer$1._augment=function(e){return e.__proto__=Buffer$1.prototype,e},Buffer$1.from=function(e,t,n){return from(null,e,t,n)},Buffer$1.TYPED_ARRAY_SUPPORT&&(Buffer$1.prototype.__proto__=Uint8Array.prototype,Buffer$1.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&Buffer$1[Symbol.species]),Buffer$1.alloc=function(e,t,n){return alloc(null,e,t,n)},Buffer$1.allocUnsafe=function(e){return allocUnsafe(null,e)},Buffer$1.allocUnsafeSlow=function(e){return allocUnsafe(null,e)},Buffer$1.isBuffer=isBuffer,Buffer$1.compare=function(e,t){if(!internalIsBuffer(e)||!internalIsBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var n=e.length,r=t.length,i=0,o=Math.min(n,r);i<o;++i)if(e[i]!==t[i]){n=e[i],r=t[i];break}return n<r?-1:r<n?1:0},Buffer$1.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},Buffer$1.concat=function(e,t){if(!isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return Buffer$1.alloc(0);var n;if(void 0===t)for(t=0,n=0;n<e.length;++n)t+=e[n].length;var r=Buffer$1.allocUnsafe(t),i=0;for(n=0;n<e.length;++n){var o=e[n];if(!internalIsBuffer(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(r,i),i+=o.length}return r},Buffer$1.byteLength=byteLength,Buffer$1.prototype._isBuffer=!0,Buffer$1.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)swap(this,t,t+1);return this},Buffer$1.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)swap(this,t,t+3),swap(this,t+1,t+2);return this},Buffer$1.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)swap(this,t,t+7),swap(this,t+1,t+6),swap(this,t+2,t+5),swap(this,t+3,t+4);return this},Buffer$1.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?utf8Slice(this,0,e):slowToString.apply(this,arguments)},Buffer$1.prototype.equals=function(e){if(!internalIsBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===Buffer$1.compare(this,e)},Buffer$1.prototype.inspect=function(){var e="",t=INSPECT_MAX_BYTES;return this.length>0&&(e=this.toString("hex",0,t).match(/.{2}/g).join(" "),this.length>t&&(e+=" ... ")),"<Buffer "+e+">"},Buffer$1.prototype.compare=function(e,t,n,r,i){if(!internalIsBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(r>>>=0),s=(n>>>=0)-(t>>>=0),a=Math.min(o,s),u=this.slice(r,i),c=e.slice(t,n),l=0;l<a;++l)if(u[l]!==c[l]){o=u[l],s=c[l];break}return o<s?-1:s<o?1:0},Buffer$1.prototype.includes=function(e,t,n){return-1!==this.indexOf(e,t,n)},Buffer$1.prototype.indexOf=function(e,t,n){return bidirectionalIndexOf(this,e,t,n,!0)},Buffer$1.prototype.lastIndexOf=function(e,t,n){return bidirectionalIndexOf(this,e,t,n,!1)},Buffer$1.prototype.write=function(e,t,n,r){if(void 0===t)r="utf8",n=this.length,t=0;else if(void 0===n&&"string"==typeof t)r=t,n=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t|=0,isFinite(n)?(n|=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}var i=this.length-t;if((void 0===n||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var o=!1;;)switch(r){case"hex":return hexWrite(this,e,t,n);case"utf8":case"utf-8":return utf8Write(this,e,t,n);case"ascii":return asciiWrite(this,e,t,n);case"latin1":case"binary":return latin1Write(this,e,t,n);case"base64":return base64Write(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ucs2Write(this,e,t,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},Buffer$1.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var MAX_ARGUMENTS_LENGTH=4096;function decodeCodePointsArray(e){var t=e.length;if(t<=MAX_ARGUMENTS_LENGTH)return String.fromCharCode.apply(String,e);for(var n="",r=0;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=MAX_ARGUMENTS_LENGTH));return n}function asciiSlice(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;i<n;++i)r+=String.fromCharCode(127&e[i]);return r}function latin1Slice(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;i<n;++i)r+=String.fromCharCode(e[i]);return r}function hexSlice(e,t,n){var r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);for(var i="",o=t;o<n;++o)i+=toHex(e[o]);return i}function utf16leSlice(e,t,n){for(var r=e.slice(t,n),i="",o=0;o<r.length;o+=2)i+=String.fromCharCode(r[o]+256*r[o+1]);return i}function checkOffset(e,t,n){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}function checkInt(e,t,n,r,i,o){if(!internalIsBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<o)throw new RangeError('"value" argument is out of bounds');if(n+r>e.length)throw new RangeError("Index out of range")}function objectWriteUInt16(e,t,n,r){t<0&&(t=65535+t+1);for(var i=0,o=Math.min(e.length-n,2);i<o;++i)e[n+i]=(t&255<<8*(r?i:1-i))>>>8*(r?i:1-i)}function objectWriteUInt32(e,t,n,r){t<0&&(t=4294967295+t+1);for(var i=0,o=Math.min(e.length-n,4);i<o;++i)e[n+i]=t>>>8*(r?i:3-i)&255}function checkIEEE754(e,t,n,r,i,o){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function writeFloat(e,t,n,r,i){return i||checkIEEE754(e,t,n,4),write(e,t,n,r,23,4),n+4}function writeDouble(e,t,n,r,i){return i||checkIEEE754(e,t,n,8),write(e,t,n,r,52,8),n+8}Buffer$1.prototype.slice=function(e,t){var n,r=this.length;if((e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e),Buffer$1.TYPED_ARRAY_SUPPORT)(n=this.subarray(e,t)).__proto__=Buffer$1.prototype;else{var i=t-e;n=new Buffer$1(i,void 0);for(var o=0;o<i;++o)n[o]=this[o+e]}return n},Buffer$1.prototype.readUIntLE=function(e,t,n){e|=0,t|=0,n||checkOffset(e,t,this.length);for(var r=this[e],i=1,o=0;++o<t&&(i*=256);)r+=this[e+o]*i;return r},Buffer$1.prototype.readUIntBE=function(e,t,n){e|=0,t|=0,n||checkOffset(e,t,this.length);for(var r=this[e+--t],i=1;t>0&&(i*=256);)r+=this[e+--t]*i;return r},Buffer$1.prototype.readUInt8=function(e,t){return t||checkOffset(e,1,this.length),this[e]},Buffer$1.prototype.readUInt16LE=function(e,t){return t||checkOffset(e,2,this.length),this[e]|this[e+1]<<8},Buffer$1.prototype.readUInt16BE=function(e,t){return t||checkOffset(e,2,this.length),this[e]<<8|this[e+1]},Buffer$1.prototype.readUInt32LE=function(e,t){return t||checkOffset(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},Buffer$1.prototype.readUInt32BE=function(e,t){return t||checkOffset(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},Buffer$1.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||checkOffset(e,t,this.length);for(var r=this[e],i=1,o=0;++o<t&&(i*=256);)r+=this[e+o]*i;return r>=(i*=128)&&(r-=Math.pow(2,8*t)),r},Buffer$1.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||checkOffset(e,t,this.length);for(var r=t,i=1,o=this[e+--r];r>0&&(i*=256);)o+=this[e+--r]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*t)),o},Buffer$1.prototype.readInt8=function(e,t){return t||checkOffset(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},Buffer$1.prototype.readInt16LE=function(e,t){t||checkOffset(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},Buffer$1.prototype.readInt16BE=function(e,t){t||checkOffset(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},Buffer$1.prototype.readInt32LE=function(e,t){return t||checkOffset(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},Buffer$1.prototype.readInt32BE=function(e,t){return t||checkOffset(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},Buffer$1.prototype.readFloatLE=function(e,t){return t||checkOffset(e,4,this.length),read(this,e,!0,23,4)},Buffer$1.prototype.readFloatBE=function(e,t){return t||checkOffset(e,4,this.length),read(this,e,!1,23,4)},Buffer$1.prototype.readDoubleLE=function(e,t){return t||checkOffset(e,8,this.length),read(this,e,!0,52,8)},Buffer$1.prototype.readDoubleBE=function(e,t){return t||checkOffset(e,8,this.length),read(this,e,!1,52,8)},Buffer$1.prototype.writeUIntLE=function(e,t,n,r){(e=+e,t|=0,n|=0,r)||checkInt(this,e,t,n,Math.pow(2,8*n)-1,0);var i=1,o=0;for(this[t]=255&e;++o<n&&(i*=256);)this[t+o]=e/i&255;return t+n},Buffer$1.prototype.writeUIntBE=function(e,t,n,r){(e=+e,t|=0,n|=0,r)||checkInt(this,e,t,n,Math.pow(2,8*n)-1,0);var i=n-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+n},Buffer$1.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||checkInt(this,e,t,1,255,0),Buffer$1.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},Buffer$1.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||checkInt(this,e,t,2,65535,0),Buffer$1.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):objectWriteUInt16(this,e,t,!0),t+2},Buffer$1.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||checkInt(this,e,t,2,65535,0),Buffer$1.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):objectWriteUInt16(this,e,t,!1),t+2},Buffer$1.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||checkInt(this,e,t,4,4294967295,0),Buffer$1.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):objectWriteUInt32(this,e,t,!0),t+4},Buffer$1.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||checkInt(this,e,t,4,4294967295,0),Buffer$1.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):objectWriteUInt32(this,e,t,!1),t+4},Buffer$1.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);checkInt(this,e,t,n,i-1,-i)}var o=0,s=1,a=0;for(this[t]=255&e;++o<n&&(s*=256);)e<0&&0===a&&0!==this[t+o-1]&&(a=1),this[t+o]=(e/s|0)-a&255;return t+n},Buffer$1.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);checkInt(this,e,t,n,i-1,-i)}var o=n-1,s=1,a=0;for(this[t+o]=255&e;--o>=0&&(s*=256);)e<0&&0===a&&0!==this[t+o+1]&&(a=1),this[t+o]=(e/s|0)-a&255;return t+n},Buffer$1.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||checkInt(this,e,t,1,127,-128),Buffer$1.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},Buffer$1.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||checkInt(this,e,t,2,32767,-32768),Buffer$1.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):objectWriteUInt16(this,e,t,!0),t+2},Buffer$1.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||checkInt(this,e,t,2,32767,-32768),Buffer$1.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):objectWriteUInt16(this,e,t,!1),t+2},Buffer$1.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||checkInt(this,e,t,4,2147483647,-2147483648),Buffer$1.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):objectWriteUInt32(this,e,t,!0),t+4},Buffer$1.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||checkInt(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),Buffer$1.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):objectWriteUInt32(this,e,t,!1),t+4},Buffer$1.prototype.writeFloatLE=function(e,t,n){return writeFloat(this,e,t,!0,n)},Buffer$1.prototype.writeFloatBE=function(e,t,n){return writeFloat(this,e,t,!1,n)},Buffer$1.prototype.writeDoubleLE=function(e,t,n){return writeDouble(this,e,t,!0,n)},Buffer$1.prototype.writeDoubleBE=function(e,t,n){return writeDouble(this,e,t,!1,n)},Buffer$1.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);var i,o=r-n;if(this===e&&n<t&&t<r)for(i=o-1;i>=0;--i)e[i+t]=this[i+n];else if(o<1e3||!Buffer$1.TYPED_ARRAY_SUPPORT)for(i=0;i<o;++i)e[i+t]=this[i+n];else Uint8Array.prototype.set.call(e,this.subarray(n,n+o),t);return o},Buffer$1.prototype.fill=function(e,t,n,r){if("string"==typeof e){if("string"==typeof t?(r=t,t=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),1===e.length){var i=e.charCodeAt(0);i<256&&(e=i)}if(void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!Buffer$1.isEncoding(r))throw new TypeError("Unknown encoding: "+r)}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;var o;if(t>>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(o=t;o<n;++o)this[o]=e;else{var s=internalIsBuffer(e)?e:utf8ToBytes(new Buffer$1(e,r).toString()),a=s.length;for(o=0;o<n-t;++o)this[o+t]=s[o%a]}return this};var INVALID_BASE64_RE=/[^+\/0-9A-Za-z-_]/g;function base64clean(e){if((e=stringtrim(e).replace(INVALID_BASE64_RE,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}function stringtrim(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function toHex(e){return e<16?"0"+e.toString(16):e.toString(16)}function utf8ToBytes(e,t){var n;t=t||1/0;for(var r=e.length,i=null,o=[],s=0;s<r;++s){if((n=e.charCodeAt(s))>55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===r){(t-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;o.push(n)}else if(n<2048){if((t-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function asciiToBytes(e){for(var t=[],n=0;n<e.length;++n)t.push(255&e.charCodeAt(n));return t}function utf16leToBytes(e,t){for(var n,r,i,o=[],s=0;s<e.length&&!((t-=2)<0);++s)r=(n=e.charCodeAt(s))>>8,i=n%256,o.push(i),o.push(r);return o}function base64ToBytes(e){return toByteArray(base64clean(e))}function blitBuffer(e,t,n,r){for(var i=0;i<r&&!(i+n>=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function isnan(e){return e!=e}function isBuffer(e){return null!=e&&(!!e._isBuffer||isFastBuffer(e)||isSlowBuffer(e))}function isFastBuffer(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}function isSlowBuffer(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&isFastBuffer(e.slice(0,0))}var _polyfillNode_buffer=Object.freeze({__proto__:null,Buffer:Buffer$1,INSPECT_MAX_BYTES:INSPECT_MAX_BYTES,SlowBuffer:SlowBuffer,isBuffer:isBuffer,kMaxLength:_kMaxLength}),require$$0=getDefaultExportFromNamespaceIfNotNamed(_polyfillNode_buffer),sha256={},sha2={},_md={},utils={},crypto={},hasRequiredCrypto,hasRequiredUtils,hasRequired_md;function requireCrypto(){return hasRequiredCrypto||(hasRequiredCrypto=1,Object.defineProperty(crypto,"__esModule",{value:!0}),crypto.crypto=void 0,crypto.crypto="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0),crypto}function requireUtils(){return hasRequiredUtils||(hasRequiredUtils=1,function(e){
56
56
  /*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
57
57
  Object.defineProperty(e,"__esModule",{value:!0}),e.wrapXOFConstructorWithOpts=e.wrapConstructorWithOpts=e.wrapConstructor=e.Hash=e.nextTick=e.swap32IfBE=e.byteSwapIfBE=e.swap8IfBE=e.isLE=void 0,e.isBytes=n,e.anumber=r,e.abytes=i,e.ahash=function(e){if("function"!=typeof e||"function"!=typeof e.create)throw new Error("Hash should be wrapped by utils.createHasher");r(e.outputLen),r(e.blockLen)},e.aexists=function(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")},e.aoutput=function(e,t){i(e);const n=t.outputLen;if(e.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)},e.u8=function(e){return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)},e.u32=function(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))},e.clean=function(...e){for(let t=0;t<e.length;t++)e[t].fill(0)},e.createView=function(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)},e.rotr=function(e,t){return e<<32-t|e>>>t},e.rotl=function(e,t){return e<<t|e>>>32-t>>>0},e.byteSwap=o,e.byteSwap32=s,e.bytesToHex=function(e){if(i(e),a)return e.toHex();let t="";for(let n=0;n<e.length;n++)t+=u[e[n]];return t},e.hexToBytes=function(e){if("string"!=typeof e)throw new Error("hex string expected, got "+typeof e);if(a)return Uint8Array.fromHex(e);const t=e.length,n=t/2;if(t%2)throw new Error("hex string expected, got unpadded hex of length "+t);const r=new Uint8Array(n);for(let t=0,i=0;t<n;t++,i+=2){const n=l(e.charCodeAt(i)),o=l(e.charCodeAt(i+1));if(void 0===n||void 0===o){const t=e[i]+e[i+1];throw new Error('hex string expected, got non-hex character "'+t+'" at index '+i)}r[t]=16*n+o}return r},e.asyncLoop=async function(t,n,r){let i=Date.now();for(let o=0;o<t;o++){r(o);const t=Date.now()-i;t>=0&&t<n||(await(0,e.nextTick)(),i+=t)}},e.utf8ToBytes=h,e.bytesToUtf8=function(e){return(new TextDecoder).decode(e)},e.toBytes=d,e.kdfInputToBytes=function(e){"string"==typeof e&&(e=h(e));return i(e),e},e.concatBytes=function(...e){let t=0;for(let n=0;n<e.length;n++){const r=e[n];i(r),t+=r.length}const n=new Uint8Array(t);for(let t=0,r=0;t<e.length;t++){const i=e[t];n.set(i,r),r+=i.length}return n},e.checkOpts=function(e,t){if(void 0!==t&&"[object Object]"!=={}.toString.call(t))throw new Error("options should be object or undefined");return Object.assign(e,t)},e.createHasher=f,e.createOptHasher=p,e.createXOFer=y,e.randomBytes=function(e=32){if(t.crypto&&"function"==typeof t.crypto.getRandomValues)return t.crypto.getRandomValues(new Uint8Array(e));if(t.crypto&&"function"==typeof t.crypto.randomBytes)return Uint8Array.from(t.crypto.randomBytes(e));throw new Error("crypto.getRandomValues must be defined")};const t=requireCrypto();function n(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&"Uint8Array"===e.constructor.name}function r(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function i(e,...t){if(!n(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error("Uint8Array expected of length "+t+", got length="+e.length)}function o(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function s(e){for(let t=0;t<e.length;t++)e[t]=o(e[t]);return e}e.isLE=68===new Uint8Array(new Uint32Array([287454020]).buffer)[0],e.swap8IfBE=e.isLE?e=>e:e=>o(e),e.byteSwapIfBE=e.swap8IfBE,e.swap32IfBE=e.isLE?e=>e:s;const a=(()=>"function"==typeof Uint8Array.from([]).toHex&&"function"==typeof Uint8Array.fromHex)(),u=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));const c={_0:48,_9:57,A:65,F:70,a:97,f:102};function l(e){return e>=c._0&&e<=c._9?e-c._0:e>=c.A&&e<=c.F?e-(c.A-10):e>=c.a&&e<=c.f?e-(c.a-10):void 0}function h(e){if("string"!=typeof e)throw new Error("string expected");return new Uint8Array((new TextEncoder).encode(e))}function d(e){return"string"==typeof e&&(e=h(e)),i(e),e}e.nextTick=async()=>{};function f(e){const t=t=>e().update(d(t)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function p(e){const t=(t,n)=>e(n).update(d(t)).digest(),n=e({});return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=t=>e(t),t}function y(e){const t=(t,n)=>e(n).update(d(t)).digest(),n=e({});return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=t=>e(t),t}e.Hash=class{},e.wrapConstructor=f,e.wrapConstructorWithOpts=p,e.wrapXOFConstructorWithOpts=y}(utils)),utils}function require_md(){if(hasRequired_md)return _md;hasRequired_md=1,Object.defineProperty(_md,"__esModule",{value:!0}),_md.SHA512_IV=_md.SHA384_IV=_md.SHA224_IV=_md.SHA256_IV=_md.HashMD=void 0,_md.setBigUint64=t,_md.Chi=function(e,t,n){return e&t^~e&n},_md.Maj=function(e,t,n){return e&t^e&n^t&n};const e=requireUtils();function t(e,t,n,r){if("function"==typeof e.setBigUint64)return e.setBigUint64(t,n,r);const i=BigInt(32),o=BigInt(4294967295),s=Number(n>>i&o),a=Number(n&o),u=r?4:0,c=r?0:4;e.setUint32(t+u,s,r),e.setUint32(t+c,a,r)}class n extends e.Hash{constructor(t,n,r,i){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=t,this.outputLen=n,this.padOffset=r,this.isLE=i,this.buffer=new Uint8Array(t),this.view=(0,e.createView)(this.buffer)}update(t){(0,e.aexists)(this),t=(0,e.toBytes)(t),(0,e.abytes)(t);const{view:n,buffer:r,blockLen:i}=this,o=t.length;for(let s=0;s<o;){const a=Math.min(i-this.pos,o-s);if(a===i){const n=(0,e.createView)(t);for(;i<=o-s;s+=i)this.process(n,s);continue}r.set(t.subarray(s,s+a),this.pos),this.pos+=a,s+=a,this.pos===i&&(this.process(n,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(n){(0,e.aexists)(this),(0,e.aoutput)(n,this),this.finished=!0;const{buffer:r,view:i,blockLen:o,isLE:s}=this;let{pos:a}=this;r[a++]=128,(0,e.clean)(this.buffer.subarray(a)),this.padOffset>o-a&&(this.process(i,0),a=0);for(let e=a;e<o;e++)r[e]=0;t(i,o-8,BigInt(8*this.length),s),this.process(i,0);const u=(0,e.createView)(n),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const l=c/4,h=this.get();if(l>h.length)throw new Error("_sha2: outputLen bigger than state");for(let e=0;e<l;e++)u.setUint32(4*e,h[e],s)}digest(){const{buffer:e,outputLen:t}=this;this.digestInto(e);const n=e.slice(0,t);return this.destroy(),n}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:t,buffer:n,length:r,finished:i,destroyed:o,pos:s}=this;return e.destroyed=o,e.finished=i,e.length=r,e.pos=s,r%t&&e.buffer.set(n),e}clone(){return this._cloneInto()}}return _md.HashMD=n,_md.SHA256_IV=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),_md.SHA224_IV=Uint32Array.from([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]),_md.SHA384_IV=Uint32Array.from([3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]),_md.SHA512_IV=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209]),_md}var _u64={},hasRequired_u64,hasRequiredSha2,hasRequiredSha256;function require_u64(){if(hasRequired_u64)return _u64;hasRequired_u64=1,Object.defineProperty(_u64,"__esModule",{value:!0}),_u64.toBig=_u64.shrSL=_u64.shrSH=_u64.rotrSL=_u64.rotrSH=_u64.rotrBL=_u64.rotrBH=_u64.rotr32L=_u64.rotr32H=_u64.rotlSL=_u64.rotlSH=_u64.rotlBL=_u64.rotlBH=_u64.add5L=_u64.add5H=_u64.add4L=_u64.add4H=_u64.add3L=_u64.add3H=void 0,_u64.add=m,_u64.fromBig=n,_u64.split=r;const e=BigInt(2**32-1),t=BigInt(32);function n(n,r=!1){return r?{h:Number(n&e),l:Number(n>>t&e)}:{h:0|Number(n>>t&e),l:0|Number(n&e)}}function r(e,t=!1){const r=e.length;let i=new Uint32Array(r),o=new Uint32Array(r);for(let s=0;s<r;s++){const{h:r,l:a}=n(e[s],t);[i[s],o[s]]=[r,a]}return[i,o]}const i=(e,n)=>BigInt(e>>>0)<<t|BigInt(n>>>0);_u64.toBig=i;const o=(e,t,n)=>e>>>n;_u64.shrSH=o;const s=(e,t,n)=>e<<32-n|t>>>n;_u64.shrSL=s;const a=(e,t,n)=>e>>>n|t<<32-n;_u64.rotrSH=a;const u=(e,t,n)=>e<<32-n|t>>>n;_u64.rotrSL=u;const c=(e,t,n)=>e<<64-n|t>>>n-32;_u64.rotrBH=c;const l=(e,t,n)=>e>>>n-32|t<<64-n;_u64.rotrBL=l;const h=(e,t)=>t;_u64.rotr32H=h;const d=(e,t)=>e;_u64.rotr32L=d;const f=(e,t,n)=>e<<n|t>>>32-n;_u64.rotlSH=f;const p=(e,t,n)=>t<<n|e>>>32-n;_u64.rotlSL=p;const y=(e,t,n)=>t<<n-32|e>>>64-n;_u64.rotlBH=y;const g=(e,t,n)=>e<<n-32|t>>>64-n;function m(e,t,n,r){const i=(t>>>0)+(r>>>0);return{h:e+n+(i/2**32|0)|0,l:0|i}}_u64.rotlBL=g;const b=(e,t,n)=>(e>>>0)+(t>>>0)+(n>>>0);_u64.add3L=b;const w=(e,t,n,r)=>t+n+r+(e/2**32|0)|0;_u64.add3H=w;const _=(e,t,n,r)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0);_u64.add4L=_;const x=(e,t,n,r,i)=>t+n+r+i+(e/2**32|0)|0;_u64.add4H=x;const S=(e,t,n,r,i)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0)+(i>>>0);_u64.add5L=S;const E=(e,t,n,r,i,o)=>t+n+r+i+o+(e/2**32|0)|0;_u64.add5H=E;const k={fromBig:n,split:r,toBig:i,shrSH:o,shrSL:s,rotrSH:a,rotrSL:u,rotrBH:c,rotrBL:l,rotr32H:h,rotr32L:d,rotlSH:f,rotlSL:p,rotlBH:y,rotlBL:g,add:m,add3L:b,add3H:w,add4L:_,add4H:x,add5H:E,add5L:S};return _u64.default=k,_u64}function requireSha2(){if(hasRequiredSha2)return sha2;hasRequiredSha2=1,Object.defineProperty(sha2,"__esModule",{value:!0}),sha2.sha512_224=sha2.sha512_256=sha2.sha384=sha2.sha512=sha2.sha224=sha2.sha256=sha2.SHA512_256=sha2.SHA512_224=sha2.SHA384=sha2.SHA512=sha2.SHA224=sha2.SHA256=void 0;const e=require_md(),t=require_u64(),n=requireUtils(),r=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),i=new Uint32Array(64);class o extends e.HashMD{constructor(t=32){super(64,t,8,!1),this.A=0|e.SHA256_IV[0],this.B=0|e.SHA256_IV[1],this.C=0|e.SHA256_IV[2],this.D=0|e.SHA256_IV[3],this.E=0|e.SHA256_IV[4],this.F=0|e.SHA256_IV[5],this.G=0|e.SHA256_IV[6],this.H=0|e.SHA256_IV[7]}get(){const{A:e,B:t,C:n,D:r,E:i,F:o,G:s,H:a}=this;return[e,t,n,r,i,o,s,a]}set(e,t,n,r,i,o,s,a){this.A=0|e,this.B=0|t,this.C=0|n,this.D=0|r,this.E=0|i,this.F=0|o,this.G=0|s,this.H=0|a}process(t,o){for(let e=0;e<16;e++,o+=4)i[e]=t.getUint32(o,!1);for(let e=16;e<64;e++){const t=i[e-15],r=i[e-2],o=(0,n.rotr)(t,7)^(0,n.rotr)(t,18)^t>>>3,s=(0,n.rotr)(r,17)^(0,n.rotr)(r,19)^r>>>10;i[e]=s+i[e-7]+o+i[e-16]|0}let{A:s,B:a,C:u,D:c,E:l,F:h,G:d,H:f}=this;for(let t=0;t<64;t++){const o=f+((0,n.rotr)(l,6)^(0,n.rotr)(l,11)^(0,n.rotr)(l,25))+(0,e.Chi)(l,h,d)+r[t]+i[t]|0,p=((0,n.rotr)(s,2)^(0,n.rotr)(s,13)^(0,n.rotr)(s,22))+(0,e.Maj)(s,a,u)|0;f=d,d=h,h=l,l=c+o|0,c=u,u=a,a=s,s=o+p|0}s=s+this.A|0,a=a+this.B|0,u=u+this.C|0,c=c+this.D|0,l=l+this.E|0,h=h+this.F|0,d=d+this.G|0,f=f+this.H|0,this.set(s,a,u,c,l,h,d,f)}roundClean(){(0,n.clean)(i)}destroy(){this.set(0,0,0,0,0,0,0,0),(0,n.clean)(this.buffer)}}sha2.SHA256=o;class s extends o{constructor(){super(28),this.A=0|e.SHA224_IV[0],this.B=0|e.SHA224_IV[1],this.C=0|e.SHA224_IV[2],this.D=0|e.SHA224_IV[3],this.E=0|e.SHA224_IV[4],this.F=0|e.SHA224_IV[5],this.G=0|e.SHA224_IV[6],this.H=0|e.SHA224_IV[7]}}sha2.SHA224=s;const a=(()=>t.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(e=>BigInt(e))))(),u=(()=>a[0])(),c=(()=>a[1])(),l=new Uint32Array(80),h=new Uint32Array(80);class d extends e.HashMD{constructor(t=64){super(128,t,16,!1),this.Ah=0|e.SHA512_IV[0],this.Al=0|e.SHA512_IV[1],this.Bh=0|e.SHA512_IV[2],this.Bl=0|e.SHA512_IV[3],this.Ch=0|e.SHA512_IV[4],this.Cl=0|e.SHA512_IV[5],this.Dh=0|e.SHA512_IV[6],this.Dl=0|e.SHA512_IV[7],this.Eh=0|e.SHA512_IV[8],this.El=0|e.SHA512_IV[9],this.Fh=0|e.SHA512_IV[10],this.Fl=0|e.SHA512_IV[11],this.Gh=0|e.SHA512_IV[12],this.Gl=0|e.SHA512_IV[13],this.Hh=0|e.SHA512_IV[14],this.Hl=0|e.SHA512_IV[15]}get(){const{Ah:e,Al:t,Bh:n,Bl:r,Ch:i,Cl:o,Dh:s,Dl:a,Eh:u,El:c,Fh:l,Fl:h,Gh:d,Gl:f,Hh:p,Hl:y}=this;return[e,t,n,r,i,o,s,a,u,c,l,h,d,f,p,y]}set(e,t,n,r,i,o,s,a,u,c,l,h,d,f,p,y){this.Ah=0|e,this.Al=0|t,this.Bh=0|n,this.Bl=0|r,this.Ch=0|i,this.Cl=0|o,this.Dh=0|s,this.Dl=0|a,this.Eh=0|u,this.El=0|c,this.Fh=0|l,this.Fl=0|h,this.Gh=0|d,this.Gl=0|f,this.Hh=0|p,this.Hl=0|y}process(e,n){for(let t=0;t<16;t++,n+=4)l[t]=e.getUint32(n),h[t]=e.getUint32(n+=4);for(let e=16;e<80;e++){const n=0|l[e-15],r=0|h[e-15],i=t.rotrSH(n,r,1)^t.rotrSH(n,r,8)^t.shrSH(n,r,7),o=t.rotrSL(n,r,1)^t.rotrSL(n,r,8)^t.shrSL(n,r,7),s=0|l[e-2],a=0|h[e-2],u=t.rotrSH(s,a,19)^t.rotrBH(s,a,61)^t.shrSH(s,a,6),c=t.rotrSL(s,a,19)^t.rotrBL(s,a,61)^t.shrSL(s,a,6),d=t.add4L(o,c,h[e-7],h[e-16]),f=t.add4H(d,i,u,l[e-7],l[e-16]);l[e]=0|f,h[e]=0|d}let{Ah:r,Al:i,Bh:o,Bl:s,Ch:a,Cl:d,Dh:f,Dl:p,Eh:y,El:g,Fh:m,Fl:b,Gh:w,Gl:_,Hh:x,Hl:S}=this;for(let e=0;e<80;e++){const n=t.rotrSH(y,g,14)^t.rotrSH(y,g,18)^t.rotrBH(y,g,41),E=t.rotrSL(y,g,14)^t.rotrSL(y,g,18)^t.rotrBL(y,g,41),k=y&m^~y&w,T=g&b^~g&_,v=t.add5L(S,E,T,c[e],h[e]),A=t.add5H(v,x,n,k,u[e],l[e]),I=0|v,O=t.rotrSH(r,i,28)^t.rotrBH(r,i,34)^t.rotrBH(r,i,39),P=t.rotrSL(r,i,28)^t.rotrBL(r,i,34)^t.rotrBL(r,i,39),R=r&o^r&a^o&a,B=i&s^i&d^s&d;x=0|w,S=0|_,w=0|m,_=0|b,m=0|y,b=0|g,({h:y,l:g}=t.add(0|f,0|p,0|A,0|I)),f=0|a,p=0|d,a=0|o,d=0|s,o=0|r,s=0|i;const N=t.add3L(I,P,B);r=t.add3H(N,A,O,R),i=0|N}({h:r,l:i}=t.add(0|this.Ah,0|this.Al,0|r,0|i)),({h:o,l:s}=t.add(0|this.Bh,0|this.Bl,0|o,0|s)),({h:a,l:d}=t.add(0|this.Ch,0|this.Cl,0|a,0|d)),({h:f,l:p}=t.add(0|this.Dh,0|this.Dl,0|f,0|p)),({h:y,l:g}=t.add(0|this.Eh,0|this.El,0|y,0|g)),({h:m,l:b}=t.add(0|this.Fh,0|this.Fl,0|m,0|b)),({h:w,l:_}=t.add(0|this.Gh,0|this.Gl,0|w,0|_)),({h:x,l:S}=t.add(0|this.Hh,0|this.Hl,0|x,0|S)),this.set(r,i,o,s,a,d,f,p,y,g,m,b,w,_,x,S)}roundClean(){(0,n.clean)(l,h)}destroy(){(0,n.clean)(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}sha2.SHA512=d;class f extends d{constructor(){super(48),this.Ah=0|e.SHA384_IV[0],this.Al=0|e.SHA384_IV[1],this.Bh=0|e.SHA384_IV[2],this.Bl=0|e.SHA384_IV[3],this.Ch=0|e.SHA384_IV[4],this.Cl=0|e.SHA384_IV[5],this.Dh=0|e.SHA384_IV[6],this.Dl=0|e.SHA384_IV[7],this.Eh=0|e.SHA384_IV[8],this.El=0|e.SHA384_IV[9],this.Fh=0|e.SHA384_IV[10],this.Fl=0|e.SHA384_IV[11],this.Gh=0|e.SHA384_IV[12],this.Gl=0|e.SHA384_IV[13],this.Hh=0|e.SHA384_IV[14],this.Hl=0|e.SHA384_IV[15]}}sha2.SHA384=f;const p=Uint32Array.from([2352822216,424955298,1944164710,2312950998,502970286,855612546,1738396948,1479516111,258812777,2077511080,2011393907,79989058,1067287976,1780299464,286451373,2446758561]),y=Uint32Array.from([573645204,4230739756,2673172387,3360449730,596883563,1867755857,2520282905,1497426621,2519219938,2827943907,3193839141,1401305490,721525244,746961066,246885852,2177182882]);class g extends d{constructor(){super(28),this.Ah=0|p[0],this.Al=0|p[1],this.Bh=0|p[2],this.Bl=0|p[3],this.Ch=0|p[4],this.Cl=0|p[5],this.Dh=0|p[6],this.Dl=0|p[7],this.Eh=0|p[8],this.El=0|p[9],this.Fh=0|p[10],this.Fl=0|p[11],this.Gh=0|p[12],this.Gl=0|p[13],this.Hh=0|p[14],this.Hl=0|p[15]}}sha2.SHA512_224=g;class m extends d{constructor(){super(32),this.Ah=0|y[0],this.Al=0|y[1],this.Bh=0|y[2],this.Bl=0|y[3],this.Ch=0|y[4],this.Cl=0|y[5],this.Dh=0|y[6],this.Dl=0|y[7],this.Eh=0|y[8],this.El=0|y[9],this.Fh=0|y[10],this.Fl=0|y[11],this.Gh=0|y[12],this.Gl=0|y[13],this.Hh=0|y[14],this.Hl=0|y[15]}}return sha2.SHA512_256=m,sha2.sha256=(0,n.createHasher)(()=>new o),sha2.sha224=(0,n.createHasher)(()=>new s),sha2.sha512=(0,n.createHasher)(()=>new d),sha2.sha384=(0,n.createHasher)(()=>new f),sha2.sha512_256=(0,n.createHasher)(()=>new m),sha2.sha512_224=(0,n.createHasher)(()=>new g),sha2}function requireSha256(){if(hasRequiredSha256)return sha256;hasRequiredSha256=1,Object.defineProperty(sha256,"__esModule",{value:!0}),sha256.sha224=sha256.SHA224=sha256.sha256=sha256.SHA256=void 0;const e=requireSha2();return sha256.SHA256=e.SHA256,sha256.sha256=e.sha256,sha256.SHA224=e.SHA224,sha256.sha224=e.sha224,sha256}var sha512={},hasRequiredSha512;function requireSha512(){if(hasRequiredSha512)return sha512;hasRequiredSha512=1,Object.defineProperty(sha512,"__esModule",{value:!0}),sha512.sha512_256=sha512.SHA512_256=sha512.sha512_224=sha512.SHA512_224=sha512.sha384=sha512.SHA384=sha512.sha512=sha512.SHA512=void 0;const e=requireSha2();return sha512.SHA512=e.SHA512,sha512.sha512=e.sha512,sha512.SHA384=e.SHA384,sha512.sha384=e.sha384,sha512.SHA512_224=e.SHA512_224,sha512.sha512_224=e.sha512_224,sha512.SHA512_256=e.SHA512_256,sha512.sha512_256=e.sha512_256,sha512}var ripemd160={},legacy={},hasRequiredLegacy,hasRequiredRipemd160,createHashShim,hasRequiredCreateHashShim;function requireLegacy(){if(hasRequiredLegacy)return legacy;hasRequiredLegacy=1,Object.defineProperty(legacy,"__esModule",{value:!0}),legacy.ripemd160=legacy.RIPEMD160=legacy.md5=legacy.MD5=legacy.sha1=legacy.SHA1=void 0;const e=require_md(),t=requireUtils(),n=Uint32Array.from([1732584193,4023233417,2562383102,271733878,3285377520]),r=new Uint32Array(80);class i extends e.HashMD{constructor(){super(64,20,8,!1),this.A=0|n[0],this.B=0|n[1],this.C=0|n[2],this.D=0|n[3],this.E=0|n[4]}get(){const{A:e,B:t,C:n,D:r,E:i}=this;return[e,t,n,r,i]}set(e,t,n,r,i){this.A=0|e,this.B=0|t,this.C=0|n,this.D=0|r,this.E=0|i}process(n,i){for(let e=0;e<16;e++,i+=4)r[e]=n.getUint32(i,!1);for(let e=16;e<80;e++)r[e]=(0,t.rotl)(r[e-3]^r[e-8]^r[e-14]^r[e-16],1);let{A:o,B:s,C:a,D:u,E:c}=this;for(let n=0;n<80;n++){let i,l;n<20?(i=(0,e.Chi)(s,a,u),l=1518500249):n<40?(i=s^a^u,l=1859775393):n<60?(i=(0,e.Maj)(s,a,u),l=2400959708):(i=s^a^u,l=3395469782);const h=(0,t.rotl)(o,5)+i+c+l+r[n]|0;c=u,u=a,a=(0,t.rotl)(s,30),s=o,o=h}o=o+this.A|0,s=s+this.B|0,a=a+this.C|0,u=u+this.D|0,c=c+this.E|0,this.set(o,s,a,u,c)}roundClean(){(0,t.clean)(r)}destroy(){this.set(0,0,0,0,0),(0,t.clean)(this.buffer)}}legacy.SHA1=i,legacy.sha1=(0,t.createHasher)(()=>new i);const o=Math.pow(2,32),s=Array.from({length:64},(e,t)=>Math.floor(o*Math.abs(Math.sin(t+1)))),a=n.slice(0,4),u=new Uint32Array(16);class c extends e.HashMD{constructor(){super(64,16,8,!0),this.A=0|a[0],this.B=0|a[1],this.C=0|a[2],this.D=0|a[3]}get(){const{A:e,B:t,C:n,D:r}=this;return[e,t,n,r]}set(e,t,n,r){this.A=0|e,this.B=0|t,this.C=0|n,this.D=0|r}process(n,r){for(let e=0;e<16;e++,r+=4)u[e]=n.getUint32(r,!0);let{A:i,B:o,C:a,D:c}=this;for(let n=0;n<64;n++){let r,l,h;n<16?(r=(0,e.Chi)(o,a,c),l=n,h=[7,12,17,22]):n<32?(r=(0,e.Chi)(c,o,a),l=(5*n+1)%16,h=[5,9,14,20]):n<48?(r=o^a^c,l=(3*n+5)%16,h=[4,11,16,23]):(r=a^(o|~c),l=7*n%16,h=[6,10,15,21]),r=r+i+s[n]+u[l],i=c,c=a,a=o,o+=(0,t.rotl)(r,h[n%4])}i=i+this.A|0,o=o+this.B|0,a=a+this.C|0,c=c+this.D|0,this.set(i,o,a,c)}roundClean(){(0,t.clean)(u)}destroy(){this.set(0,0,0,0),(0,t.clean)(this.buffer)}}legacy.MD5=c,legacy.md5=(0,t.createHasher)(()=>new c);const l=Uint8Array.from([7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8]),h=(()=>Uint8Array.from(new Array(16).fill(0).map((e,t)=>t)))(),d=(()=>h.map(e=>(9*e+5)%16))(),f=(()=>{const e=[[h],[d]];for(let t=0;t<4;t++)for(let n of e)n.push(n[t].map(e=>l[e]));return e})(),p=(()=>f[0])(),y=(()=>f[1])(),g=[[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8],[12,13,11,15,6,9,9,7,12,15,11,13,7,8,7,7],[13,15,14,11,7,7,6,8,13,14,13,12,5,5,6,9],[14,11,12,14,8,6,5,5,15,12,15,14,9,9,8,6],[15,12,13,13,9,5,8,6,14,11,12,11,8,6,5,5]].map(e=>Uint8Array.from(e)),m=p.map((e,t)=>e.map(e=>g[t][e])),b=y.map((e,t)=>e.map(e=>g[t][e])),w=Uint32Array.from([0,1518500249,1859775393,2400959708,2840853838]),_=Uint32Array.from([1352829926,1548603684,1836072691,2053994217,0]);function x(e,t,n,r){return 0===e?t^n^r:1===e?t&n|~t&r:2===e?(t|~n)^r:3===e?t&r|n&~r:t^(n|~r)}const S=new Uint32Array(16);class E extends e.HashMD{constructor(){super(64,20,8,!0),this.h0=1732584193,this.h1=-271733879,this.h2=-1732584194,this.h3=271733878,this.h4=-1009589776}get(){const{h0:e,h1:t,h2:n,h3:r,h4:i}=this;return[e,t,n,r,i]}set(e,t,n,r,i){this.h0=0|e,this.h1=0|t,this.h2=0|n,this.h3=0|r,this.h4=0|i}process(e,n){for(let t=0;t<16;t++,n+=4)S[t]=e.getUint32(n,!0);let r=0|this.h0,i=r,o=0|this.h1,s=o,a=0|this.h2,u=a,c=0|this.h3,l=c,h=0|this.h4,d=h;for(let e=0;e<5;e++){const n=4-e,f=w[e],g=_[e],E=p[e],k=y[e],T=m[e],v=b[e];for(let n=0;n<16;n++){const i=(0,t.rotl)(r+x(e,o,a,c)+S[E[n]]+f,T[n])+h|0;r=h,h=c,c=0|(0,t.rotl)(a,10),a=o,o=i}for(let e=0;e<16;e++){const r=(0,t.rotl)(i+x(n,s,u,l)+S[k[e]]+g,v[e])+d|0;i=d,d=l,l=0|(0,t.rotl)(u,10),u=s,s=r}}this.set(this.h1+a+l|0,this.h2+c+d|0,this.h3+h+i|0,this.h4+r+s|0,this.h0+o+u|0)}roundClean(){(0,t.clean)(S)}destroy(){this.destroyed=!0,(0,t.clean)(this.buffer),this.set(0,0,0,0,0)}}return legacy.RIPEMD160=E,legacy.ripemd160=(0,t.createHasher)(()=>new E),legacy}function requireRipemd160(){if(hasRequiredRipemd160)return ripemd160;hasRequiredRipemd160=1,Object.defineProperty(ripemd160,"__esModule",{value:!0}),ripemd160.ripemd160=ripemd160.RIPEMD160=void 0;const e=requireLegacy();return ripemd160.RIPEMD160=e.RIPEMD160,ripemd160.ripemd160=e.ripemd160,ripemd160}function requireCreateHashShim(){if(hasRequiredCreateHashShim)return createHashShim;hasRequiredCreateHashShim=1;const{sha256:e}=requireSha256(),{sha512:t}=requireSha512(),{ripemd160:n}=requireRipemd160(),{Buffer:r}=require$$0,i={sha256:e,sha512:t,ripemd160:n};class o{constructor(e){this._hasher=e}update(e){return"string"==typeof e&&(e=r.from(e,"utf8")),this._hasher.update(e),this}digest(e){const t=this._hasher.digest(),n=r.from(t);return"hex"===e?n.toString("hex"):"base64"===e?n.toString("base64"):n}}return createHashShim=function(e){const t=e.toLowerCase(),n=i[t];if(!n)throw new Error("Unsupported hash algorithm: "+e);return new o(n.create())}}var hmac={},hasRequiredHmac,createHmacShim,hasRequiredCreateHmacShim;function requireHmac(){return hasRequiredHmac||(hasRequiredHmac=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.hmac=e.HMAC=void 0;const t=requireUtils();class n extends t.Hash{constructor(e,n){super(),this.finished=!1,this.destroyed=!1,(0,t.ahash)(e);const r=(0,t.toBytes)(n);if(this.iHash=e.create(),"function"!=typeof this.iHash.update)throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const i=this.blockLen,o=new Uint8Array(i);o.set(r.length>i?e.create().update(r).digest():r);for(let e=0;e<o.length;e++)o[e]^=54;this.iHash.update(o),this.oHash=e.create();for(let e=0;e<o.length;e++)o[e]^=106;this.oHash.update(o),(0,t.clean)(o)}update(e){return(0,t.aexists)(this),this.iHash.update(e),this}digestInto(e){(0,t.aexists)(this),(0,t.abytes)(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){const e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||(e=Object.create(Object.getPrototypeOf(this),{}));const{oHash:t,iHash:n,finished:r,destroyed:i,blockLen:o,outputLen:s}=this;return e.finished=r,e.destroyed=i,e.blockLen=o,e.outputLen=s,e.oHash=t._cloneInto(e.oHash),e.iHash=n._cloneInto(e.iHash),e}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}e.HMAC=n;e.hmac=(e,t,r)=>new n(e,t).update(r).digest(),e.hmac.create=(e,t)=>new n(e,t)}(hmac)),hmac}function requireCreateHmacShim(){if(hasRequiredCreateHmacShim)return createHmacShim;hasRequiredCreateHmacShim=1;const{hmac:e}=requireHmac(),{sha256:t}=requireSha256(),{sha512:n}=requireSha512(),{Buffer:r}=require$$0,i={sha256:t,sha512:n};class o{constructor(e,t){this._hashFn=e,this._key=t,this._data=[]}update(e){return"string"==typeof e&&(e=r.from(e,"utf8")),this._data.push(e),this}digest(t){const n=r.concat(this._data),i=e(this._hashFn,this._key,n),o=r.from(i);return"hex"===t?o.toString("hex"):"base64"===t?o.toString("base64"):o}}return createHmacShim=function(e,t){const n=e.toLowerCase(),s=i[n];if(!s)throw new Error("Unsupported HMAC algorithm: "+e);return"string"==typeof t&&(t=r.from(t,"utf8")),new o(s,t)}}var bip39={},pbkdf2={},hasRequiredPbkdf2;function requirePbkdf2(){if(hasRequiredPbkdf2)return pbkdf2;hasRequiredPbkdf2=1,Object.defineProperty(pbkdf2,"__esModule",{value:!0}),pbkdf2.pbkdf2=function(e,i,o,s){const{c:a,dkLen:u,DK:c,PRF:l,PRFSalt:h}=n(e,i,o,s);let d;const f=new Uint8Array(4),p=(0,t.createView)(f),y=new Uint8Array(l.outputLen);for(let e=1,t=0;t<u;e++,t+=l.outputLen){const n=c.subarray(t,t+l.outputLen);p.setInt32(0,e,!1),(d=h._cloneInto(d)).update(f).digestInto(y),n.set(y.subarray(0,n.length));for(let e=1;e<a;e++){l._cloneInto(d).update(y).digestInto(y);for(let e=0;e<n.length;e++)n[e]^=y[e]}}return r(l,h,c,d,y)},pbkdf2.pbkdf2Async=async function(e,i,o,s){const{c:a,dkLen:u,asyncTick:c,DK:l,PRF:h,PRFSalt:d}=n(e,i,o,s);let f;const p=new Uint8Array(4),y=(0,t.createView)(p),g=new Uint8Array(h.outputLen);for(let e=1,n=0;n<u;e++,n+=h.outputLen){const r=l.subarray(n,n+h.outputLen);y.setInt32(0,e,!1),(f=d._cloneInto(f)).update(p).digestInto(g),r.set(g.subarray(0,r.length)),await(0,t.asyncLoop)(a-1,c,()=>{h._cloneInto(f).update(g).digestInto(g);for(let e=0;e<r.length;e++)r[e]^=g[e]})}return r(h,d,l,f,g)};const e=requireHmac(),t=requireUtils();function n(n,r,i,o){(0,t.ahash)(n);const s=(0,t.checkOpts)({dkLen:32,asyncTick:10},o),{c:a,dkLen:u,asyncTick:c}=s;if((0,t.anumber)(a),(0,t.anumber)(u),(0,t.anumber)(c),a<1)throw new Error("iterations (c) should be >= 1");const l=(0,t.kdfInputToBytes)(r),h=(0,t.kdfInputToBytes)(i),d=new Uint8Array(u),f=e.hmac.create(n,l),p=f._cloneInto().update(h);return{c:a,dkLen:u,asyncTick:c,DK:d,PRF:f,PRFSalt:p}}function r(e,n,r,i,o){return e.destroy(),n.destroy(),i&&i.destroy(),(0,t.clean)(o),r}return pbkdf2}var lib={},hasRequiredLib,hasRequiredBip39;function requireLib(){return hasRequiredLib||(hasRequiredLib=1,function(e){function t(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&"Uint8Array"===e.constructor.name}function n(e,...n){if(!t(e))throw new Error("Uint8Array expected");if(n.length>0&&!n.includes(e.length))throw new Error("Uint8Array expected of length "+n+", got length="+e.length)}function r(e,t){return!!Array.isArray(t)&&(0===t.length||(e?t.every(e=>"string"==typeof e):t.every(e=>Number.isSafeInteger(e))))}function i(e){if("function"!=typeof e)throw new Error("function expected");return!0}function o(e,t){if("string"!=typeof t)throw new Error(`${e}: string expected`);return!0}function s(e){if(!Number.isSafeInteger(e))throw new Error(`invalid integer: ${e}`)}function a(e){if(!Array.isArray(e))throw new Error("array expected")}function u(e,t){if(!r(!0,t))throw new Error(`${e}: array of strings expected`)}function c(e,t){if(!r(!1,t))throw new Error(`${e}: array of numbers expected`)}function l(...e){const t=e=>e,n=(e,t)=>n=>e(t(n));return{encode:e.map(e=>e.encode).reduceRight(n,t),decode:e.map(e=>e.decode).reduce(n,t)}}function h(e){const t="string"==typeof e?e.split(""):e,n=t.length;u("alphabet",t);const r=new Map(t.map((e,t)=>[e,t]));return{encode:r=>(a(r),r.map(r=>{if(!Number.isSafeInteger(r)||r<0||r>=n)throw new Error(`alphabet.encode: digit index outside alphabet "${r}". Allowed: ${e}`);return t[r]})),decode:t=>(a(t),t.map(t=>{o("alphabet.decode",t);const n=r.get(t);if(void 0===n)throw new Error(`Unknown letter: "${t}". Allowed: ${e}`);return n}))}}function d(e=""){return o("join",e),{encode:t=>(u("join.decode",t),t.join(e)),decode:t=>(o("join.decode",t),t.split(e))}}function f(e,t="="){return s(e),o("padding",t),{encode(n){for(u("padding.encode",n);n.length*e%8;)n.push(t);return n},decode(n){u("padding.decode",n);let r=n.length;if(r*e%8)throw new Error("padding: invalid, string should have whole number of bytes");for(;r>0&&n[r-1]===t;r--){if((r-1)*e%8==0)throw new Error("padding: invalid, string has too much padding")}return n.slice(0,r)}}}function p(e){return i(e),{encode:e=>e,decode:t=>e(t)}}function y(e,t,n){if(t<2)throw new Error(`convertRadix: invalid from=${t}, base cannot be less than 2`);if(n<2)throw new Error(`convertRadix: invalid to=${n}, base cannot be less than 2`);if(a(e),!e.length)return[];let r=0;const i=[],o=Array.from(e,e=>{if(s(e),e<0||e>=t)throw new Error(`invalid integer: ${e}`);return e}),u=o.length;for(;;){let e=0,s=!0;for(let i=r;i<u;i++){const a=o[i],u=t*e,c=u+a;if(!Number.isSafeInteger(c)||u/t!==e||c-a!==u)throw new Error("convertRadix: carry overflow");const l=c/n;e=c%n;const h=Math.floor(l);if(o[i]=h,!Number.isSafeInteger(h)||h*n+e!==c)throw new Error("convertRadix: carry overflow");s&&(h?s=!1:r=i)}if(i.push(e),s)break}for(let t=0;t<e.length-1&&0===e[t];t++)i.push(0);return i.reverse()}
58
58
  /*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "minimal-xec-wallet",
3
- "version": "2.2.2",
3
+ "version": "2.2.3",
4
4
  "description": "A minimalist eCash (XEC) wallet npm library, for use in web apps. Supports eTokens.",
5
5
  "main": "./index.js",
6
6
  "module": "./dist/minimal-xec-wallet.esm.js",