blockcore-notes/472.6699de8963831a80.js
2023-02-22 16:05:01 +00:00

1 line
124 KiB
JavaScript

(()=>{var a,se,er={5521:(se,a)=>{"use strict";function H(l){if(!Number.isSafeInteger(l))throw new Error(`Wrong integer: ${l}`)}function q(...l){const u=(j,k)=>V=>j(k(V));return{encode:Array.from(l).reverse().reduce((j,k)=>j?u(j,k.encode):k.encode,void 0),decode:l.reduce((j,k)=>j?u(j,k.decode):k.decode,void 0)}}function d(l){return{encode:u=>{if(!Array.isArray(u)||u.length&&"number"!=typeof u[0])throw new Error("alphabet.encode input should be an array of numbers");return u.map(y=>{if(H(y),y<0||y>=l.length)throw new Error(`Digit index outside alphabet: ${y} (alphabet: ${l.length})`);return l[y]})},decode:u=>{if(!Array.isArray(u)||u.length&&"string"!=typeof u[0])throw new Error("alphabet.decode input should be array of strings");return u.map(y=>{if("string"!=typeof y)throw new Error(`alphabet.decode: not string element=${y}`);const I=l.indexOf(y);if(-1===I)throw new Error(`Unknown letter: "${y}". Allowed: ${l}`);return I})}}}function C(l=""){if("string"!=typeof l)throw new Error("join separator should be string");return{encode:u=>{if(!Array.isArray(u)||u.length&&"string"!=typeof u[0])throw new Error("join.encode input should be array of strings");for(let y of u)if("string"!=typeof y)throw new Error(`join.encode: non-string input=${y}`);return u.join(l)},decode:u=>{if("string"!=typeof u)throw new Error("join.decode input should be string");return u.split(l)}}}function Z(l,u="="){if(H(l),"string"!=typeof u)throw new Error("padding chr should be string");return{encode(y){if(!Array.isArray(y)||y.length&&"string"!=typeof y[0])throw new Error("padding.encode input should be array of strings");for(let I of y)if("string"!=typeof I)throw new Error(`padding.encode: non-string input=${I}`);for(;y.length*l%8;)y.push(u);return y},decode(y){if(!Array.isArray(y)||y.length&&"string"!=typeof y[0])throw new Error("padding.encode input should be array of strings");for(let j of y)if("string"!=typeof j)throw new Error(`padding.decode: non-string input=${j}`);let I=y.length;if(I*l%8)throw new Error("Invalid padding: string should have whole number of bytes");for(;I>0&&y[I-1]===u;I--)if(!((I-1)*l%8))throw new Error("Invalid padding: string has too much padding");return y.slice(0,I)}}}function Q(l){if("function"!=typeof l)throw new Error("normalize fn should be function");return{encode:u=>u,decode:u=>l(u)}}function m(l,u,y){if(u<2)throw new Error(`convertRadix: wrong from=${u}, base cannot be less than 2`);if(y<2)throw new Error(`convertRadix: wrong to=${y}, base cannot be less than 2`);if(!Array.isArray(l))throw new Error("convertRadix: data should be array");if(!l.length)return[];let I=0;const j=[],k=Array.from(l);for(k.forEach(V=>{if(H(V),V<0||V>=u)throw new Error(`Wrong integer: ${V}`)});;){let V=0,ce=!0;for(let le=I;le<k.length;le++){const fe=k[le],M=u*V+fe;if(!Number.isSafeInteger(M)||u*V/u!==V||M-fe!=u*V)throw new Error("convertRadix: carry overflow");if(V=M%y,k[le]=Math.floor(M/y),!Number.isSafeInteger(k[le])||k[le]*y+V!==M)throw new Error("convertRadix: carry overflow");ce&&(k[le]?ce=!1:I=le)}if(j.push(V),ce)break}for(let V=0;V<l.length-1&&0===l[V];V++)j.push(0);return j.reverse()}Object.defineProperty(a,"__esModule",{value:!0}),a.bytes=a.stringToBytes=a.str=a.bytesToString=a.hex=a.utf8=a.bech32m=a.bech32=a.base58check=a.base58xmr=a.base58xrp=a.base58flickr=a.base58=a.base64url=a.base64=a.base32crockford=a.base32hex=a.base32=a.base16=a.utils=a.assertNumber=void 0,a.assertNumber=H;const w=(l,u)=>u?w(u,l%u):l,$=(l,u)=>l+(u-w(l,u));function D(l,u,y,I){if(!Array.isArray(l))throw new Error("convertRadix2: data should be array");if(u<=0||u>32)throw new Error(`convertRadix2: wrong from=${u}`);if(y<=0||y>32)throw new Error(`convertRadix2: wrong to=${y}`);if($(u,y)>32)throw new Error(`convertRadix2: carry overflow from=${u} to=${y} carryBits=${$(u,y)}`);let j=0,k=0;const V=2**y-1,ce=[];for(const le of l){if(H(le),le>=2**u)throw new Error(`convertRadix2: invalid data word=${le} from=${u}`);if(j=j<<u|le,k+u>32)throw new Error(`convertRadix2: carry overflow pos=${k} from=${u}`);for(k+=u;k>=y;k-=y)ce.push((j>>k-y&V)>>>0);j&=2**k-1}if(j=j<<y-k&V,!I&&k>=u)throw new Error("Excess padding");if(!I&&j)throw new Error(`Non-zero padding: ${j}`);return I&&k>0&&ce.push(j>>>0),ce}function O(l){return H(l),{encode:u=>{if(!(u instanceof Uint8Array))throw new Error("radix.encode input should be Uint8Array");return m(Array.from(u),256,l)},decode:u=>{if(!Array.isArray(u)||u.length&&"number"!=typeof u[0])throw new Error("radix.decode input should be array of strings");return Uint8Array.from(m(u,l,256))}}}function B(l,u=!1){if(H(l),l<=0||l>32)throw new Error("radix2: bits should be in (0..32]");if($(8,l)>32||$(l,8)>32)throw new Error("radix2: carry overflow");return{encode:y=>{if(!(y instanceof Uint8Array))throw new Error("radix2.encode input should be Uint8Array");return D(Array.from(y),8,l,!u)},decode:y=>{if(!Array.isArray(y)||y.length&&"number"!=typeof y[0])throw new Error("radix2.decode input should be array of strings");return Uint8Array.from(D(y,l,8,u))}}}function F(l){if("function"!=typeof l)throw new Error("unsafeWrapper fn should be function");return function(...u){try{return l.apply(null,u)}catch{}}}function G(l,u){if(H(l),"function"!=typeof u)throw new Error("checksum fn should be function");return{encode(y){if(!(y instanceof Uint8Array))throw new Error("checksum.encode: input should be Uint8Array");const I=u(y).slice(0,l),j=new Uint8Array(y.length+l);return j.set(y),j.set(I,y.length),j},decode(y){if(!(y instanceof Uint8Array))throw new Error("checksum.decode: input should be Uint8Array");const I=y.slice(0,-l),j=u(I).slice(0,l),k=y.slice(-l);for(let V=0;V<l;V++)if(j[V]!==k[V])throw new Error("Invalid checksum");return I}}}a.utils={alphabet:d,chain:q,checksum:G,radix:O,radix2:B,join:C,padding:Z},a.base16=q(B(4),d("0123456789ABCDEF"),C("")),a.base32=q(B(5),d("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"),Z(5),C("")),a.base32hex=q(B(5),d("0123456789ABCDEFGHIJKLMNOPQRSTUV"),Z(5),C("")),a.base32crockford=q(B(5),d("0123456789ABCDEFGHJKMNPQRSTVWXYZ"),C(""),Q(l=>l.toUpperCase().replace(/O/g,"0").replace(/[IL]/g,"1"))),a.base64=q(B(6),d("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),Z(6),C("")),a.base64url=q(B(6),d("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),Z(6),C(""));const X=l=>q(O(58),d(l),C(""));a.base58=X("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"),a.base58flickr=X("123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"),a.base58xrp=X("rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz");const W=[0,2,3,5,6,7,9,10,11];a.base58xmr={encode(l){let u="";for(let y=0;y<l.length;y+=8){const I=l.subarray(y,y+8);u+=a.base58.encode(I).padStart(W[I.length],"1")}return u},decode(l){let u=[];for(let y=0;y<l.length;y+=11){const I=l.slice(y,y+11),j=W.indexOf(I.length),k=a.base58.decode(I);for(let V=0;V<k.length-j;V++)if(0!==k[V])throw new Error("base58xmr: wrong padding");u=u.concat(Array.from(k.slice(k.length-j)))}return Uint8Array.from(u)}},a.base58check=l=>q(G(4,u=>l(l(u))),a.base58);const K=q(d("qpzry9x8gf2tvdw0s3jn54khce6mua7l"),C("")),Y=[996825010,642813549,513874426,1027748829,705979059];function L(l){const u=l>>25;let y=(33554431&l)<<5;for(let I=0;I<Y.length;I++)1==(u>>I&1)&&(y^=Y[I]);return y}function ee(l,u,y=1){const I=l.length;let j=1;for(let k=0;k<I;k++){const V=l.charCodeAt(k);if(V<33||V>126)throw new Error(`Invalid prefix (${l})`);j=L(j)^V>>5}j=L(j);for(let k=0;k<I;k++)j=L(j)^31&l.charCodeAt(k);for(let k of u)j=L(j)^k;for(let k=0;k<6;k++)j=L(j);return j^=y,K.encode(D([j%1073741824],30,5,!1))}function _(l){const u="bech32"===l?1:734539939,y=B(5),I=y.decode,j=y.encode,k=F(I);function ce(M,ie=90){if("string"!=typeof M)throw new Error("bech32.decode input should be string, not "+typeof M);if(M.length<8||!1!==ie&&M.length>ie)throw new TypeError(`Wrong string length: ${M.length} (${M}). Expected (8..${ie})`);const de=M.toLowerCase();if(M!==de&&M!==M.toUpperCase())throw new Error("String must be lowercase or uppercase");const E=(M=de).lastIndexOf("1");if(0===E||-1===E)throw new Error('Letter "1" must be present between prefix and data only');const he=M.slice(0,E),_e=M.slice(E+1);if(_e.length<6)throw new Error("Data must be at least 6 characters long");const me=K.decode(_e).slice(0,-6),qe=ee(he,me,u);if(!_e.endsWith(qe))throw new Error(`Invalid checksum in ${M}: expected "${qe}"`);return{prefix:he,words:me}}return{encode:function V(M,ie,de=90){if("string"!=typeof M)throw new Error("bech32.encode prefix should be string, not "+typeof M);if(!Array.isArray(ie)||ie.length&&"number"!=typeof ie[0])throw new Error("bech32.encode words should be array of numbers, not "+typeof ie);const E=M.length+7+ie.length;if(!1!==de&&E>de)throw new TypeError(`Length ${E} exceeds limit ${de}`);return`${M=M.toLowerCase()}1${K.encode(ie)}${ee(M,ie,u)}`},decode:ce,decodeToBytes:function fe(M){const{prefix:ie,words:de}=ce(M,!1);return{prefix:ie,words:de,bytes:I(de)}},decodeUnsafe:F(ce),fromWords:I,fromWordsUnsafe:k,toWords:j}}a.bech32=_("bech32"),a.bech32m=_("bech32m"),a.utf8={encode:l=>(new TextDecoder).decode(l),decode:l=>(new TextEncoder).encode(l)},a.hex=q(B(4),d("0123456789abcdef"),C(""),Q(l=>{if("string"!=typeof l||l.length%2)throw new TypeError(`hex.decode: expected string, got ${typeof l} with length ${l.length}`);return l.toLowerCase()}));const h={utf8:a.utf8,hex:a.hex,base16:a.base16,base32:a.base32,base64:a.base64,base64url:a.base64url,base58:a.base58,base58xmr:a.base58xmr},S=`Invalid encoding type. Available types: ${Object.keys(h).join(", ")}`;a.bytesToString=(l,u)=>{if("string"!=typeof l||!h.hasOwnProperty(l))throw new TypeError(S);if(!(u instanceof Uint8Array))throw new TypeError("bytesToString() expects Uint8Array");return h[l].encode(u)},a.str=a.bytesToString,a.stringToBytes=(l,u)=>{if(!h.hasOwnProperty(l))throw new TypeError(S);if("string"!=typeof u)throw new TypeError("stringToBytes() expects string");return h[l].decode(u)},a.bytes=a.stringToBytes},6837:(se,a,H)=>{"use strict";a.Z1=a._I=a.OF=void 0;const d=H(5729),C=H(9522),Z=H(8519),Q=H(27),m=H(7507),w=H(5521);function D(_){if("string"!=typeof _)throw new TypeError("Invalid mnemonic type: "+typeof _);return _.normalize("NFKD")}function O(_){const h=D(_),S=h.split(" ");if(![12,15,18,21,24].includes(S.length))throw new Error("Invalid mnemonic");return{nfkd:h,words:S}}function B(_){d.default.bytes(_,16,20,24,28,32)}a.OF=function F(_,h=128){if(d.default.number(h),h%32!=0||h>256)throw new TypeError("Invalid entropy");return function P(_,h){return B(_),X(h).encode(_).join((_=>"\u3042\u3044\u3053\u304f\u3057\u3093"===_[0])(h)?"\u3000":" ")}((0,m.randomBytes)(h/8),_)};const G=_=>{const h=8-_.length/4;return new Uint8Array([(0,Z.sha256)(_)[0]>>h<<h])};function X(_){if(!Array.isArray(_)||2048!==_.length||"string"!=typeof _[0])throw new Error("Worlist: expected array of 2048 strings");return _.forEach(h=>{if("string"!=typeof h)throw new Error(`Wordlist: non-string element: ${h}`)}),w.utils.chain(w.utils.checksum(1,G),w.utils.radix2(11,!0),w.utils.alphabet(_))}a._I=function K(_,h){try{!function W(_,h){const{words:S}=O(_),R=X(h).decode(S);return B(R),R}(_,h)}catch{return!1}return!0};a.Z1=function ee(_,h=""){return(0,C.pbkdf2)(Q.sha512,O(_).nfkd,(_=>D(`mnemonic${_}`))(h),{c:2048,dkLen:64})}},5729:(se,a)=>{"use strict";function H(w){if(!Number.isSafeInteger(w)||w<0)throw new Error(`Wrong positive integer: ${w}`)}function q(w){if("boolean"!=typeof w)throw new Error(`Expected boolean, not ${w}`)}function d(w,...$){if(!(w instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if($.length>0&&!$.includes(w.length))throw new TypeError(`Expected Uint8Array of length ${$}, not of length=${w.length}`)}function C(w){if("function"!=typeof w||"function"!=typeof w.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");H(w.outputLen),H(w.blockLen)}function Z(w,$=!0){if(w.destroyed)throw new Error("Hash instance has been destroyed");if($&&w.finished)throw new Error("Hash#digest() has already been called")}function Q(w,$){d(w);const D=$.outputLen;if(w.length<D)throw new Error(`digestInto() expects output buffer of length at least ${D}`)}Object.defineProperty(a,"__esModule",{value:!0}),a.output=a.exists=a.hash=a.bytes=a.bool=a.number=void 0,a.number=H,a.bool=q,a.bytes=d,a.hash=C,a.exists=Z,a.output=Q,a.default={number:H,bool:q,bytes:d,hash:C,exists:Z,output:Q}},4206:(se,a,H)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.SHA2=void 0;const q=H(5729),d=H(7507);a.SHA2=class Z extends d.Hash{constructor(m,w,$,D){super(),this.blockLen=m,this.outputLen=w,this.padOffset=$,this.isLE=D,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(m),this.view=(0,d.createView)(this.buffer)}update(m){q.default.exists(this);const{view:w,buffer:$,blockLen:D}=this,O=(m=(0,d.toBytes)(m)).length;for(let B=0;B<O;){const F=Math.min(D-this.pos,O-B);if(F!==D)$.set(m.subarray(B,B+F),this.pos),this.pos+=F,B+=F,this.pos===D&&(this.process(w,0),this.pos=0);else{const G=(0,d.createView)(m);for(;D<=O-B;B+=D)this.process(G,B)}}return this.length+=m.length,this.roundClean(),this}digestInto(m){q.default.exists(this),q.default.output(m,this),this.finished=!0;const{buffer:w,view:$,blockLen:D,isLE:O}=this;let{pos:B}=this;w[B++]=128,this.buffer.subarray(B).fill(0),this.padOffset>D-B&&(this.process($,0),B=0);for(let P=B;P<D;P++)w[P]=0;(function C(Q,m,w,$){if("function"==typeof Q.setBigUint64)return Q.setBigUint64(m,w,$);const D=BigInt(32),O=BigInt(4294967295),B=Number(w>>D&O),F=Number(w&O),X=$?0:4;Q.setUint32(m+($?4:0),B,$),Q.setUint32(m+X,F,$)})($,D-8,BigInt(8*this.length),O),this.process($,0);const F=(0,d.createView)(m),G=this.outputLen;if(G%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const X=G/4,W=this.get();if(X>W.length)throw new Error("_sha2: outputLen bigger than state");for(let P=0;P<X;P++)F.setUint32(4*P,W[P],O)}digest(){const{buffer:m,outputLen:w}=this;this.digestInto(m);const $=m.slice(0,w);return this.destroy(),$}_cloneInto(m){m||(m=new this.constructor),m.set(...this.get());const{blockLen:w,buffer:$,length:D,finished:O,destroyed:B,pos:F}=this;return m.length=D,m.pos=F,m.finished=O,m.destroyed=B,D%w&&m.buffer.set($),m}}},9027:(se,a)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.add=a.toBig=a.split=a.fromBig=void 0;const H=BigInt(2**32-1),q=BigInt(32);function d(x,l=!1){return l?{h:Number(x&H),l:Number(x>>q&H)}:{h:0|Number(x>>q&H),l:0|Number(x&H)}}function C(x,l=!1){let u=new Uint32Array(x.length),y=new Uint32Array(x.length);for(let I=0;I<x.length;I++){const{h:j,l:k}=d(x[I],l);[u[I],y[I]]=[j,k]}return[u,y]}function K(x,l,u,y){const I=(l>>>0)+(y>>>0);return{h:x+u+(I/4294967296|0)|0,l:0|I}}a.fromBig=d,a.split=C,a.toBig=(x,l)=>BigInt(x>>>0)<<q|BigInt(l>>>0),a.add=K,a.default={fromBig:d,split:C,toBig:a.toBig,shrSH:(x,l,u)=>x>>>u,shrSL:(x,l,u)=>x<<32-u|l>>>u,rotrSH:(x,l,u)=>x>>>u|l<<32-u,rotrSL:(x,l,u)=>x<<32-u|l>>>u,rotrBH:(x,l,u)=>x<<64-u|l>>>u-32,rotrBL:(x,l,u)=>x>>>u-32|l<<64-u,rotr32H:(x,l)=>l,rotr32L:(x,l)=>x,rotlSH:(x,l,u)=>x<<u|l>>>32-u,rotlSL:(x,l,u)=>l<<u|x>>>32-u,rotlBH:(x,l,u)=>l<<u-32|x>>>64-u,rotlBL:(x,l,u)=>x<<u-32|l>>>64-u,add:K,add3L:(x,l,u)=>(x>>>0)+(l>>>0)+(u>>>0),add3H:(x,l,u,y)=>l+u+y+(x/2**32|0)|0,add4L:(x,l,u,y)=>(x>>>0)+(l>>>0)+(u>>>0)+(y>>>0),add4H:(x,l,u,y,I)=>l+u+y+I+(x/2**32|0)|0,add5H:(x,l,u,y,I,j)=>l+u+y+I+j+(x/2**32|0)|0,add5L:(x,l,u,y,I)=>(x>>>0)+(l>>>0)+(u>>>0)+(y>>>0)+(I>>>0)}},7882:(se,a)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.crypto=void 0,a.crypto={node:void 0,web:"object"==typeof self&&"crypto"in self?self.crypto:void 0}},602:(se,a,H)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.hmac=void 0;const q=H(5729),d=H(7507);class C extends d.Hash{constructor(m,w){super(),this.finished=!1,this.destroyed=!1,q.default.hash(m);const $=(0,d.toBytes)(w);if(this.iHash=m.create(),"function"!=typeof this.iHash.update)throw new TypeError("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const D=this.blockLen,O=new Uint8Array(D);O.set($.length>D?m.create().update($).digest():$);for(let B=0;B<O.length;B++)O[B]^=54;this.iHash.update(O),this.oHash=m.create();for(let B=0;B<O.length;B++)O[B]^=106;this.oHash.update(O),O.fill(0)}update(m){return q.default.exists(this),this.iHash.update(m),this}digestInto(m){q.default.exists(this),q.default.bytes(m,this.outputLen),this.finished=!0,this.iHash.digestInto(m),this.oHash.update(m),this.oHash.digestInto(m),this.destroy()}digest(){const m=new Uint8Array(this.oHash.outputLen);return this.digestInto(m),m}_cloneInto(m){m||(m=Object.create(Object.getPrototypeOf(this),{}));const{oHash:w,iHash:$,finished:D,destroyed:O,blockLen:B,outputLen:F}=this;return m.finished=D,m.destroyed=O,m.blockLen=B,m.outputLen=F,m.oHash=w._cloneInto(m.oHash),m.iHash=$._cloneInto(m.iHash),m}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}a.hmac=(Q,m,w)=>new C(Q,m).update(w).digest(),a.hmac.create=(Q,m)=>new C(Q,m)},9522:(se,a,H)=>{"use strict";var q=H(9598).default;Object.defineProperty(a,"__esModule",{value:!0}),a.pbkdf2Async=a.pbkdf2=void 0;const d=H(5729),C=H(602),Z=H(7507);function Q(O,B,F,G){d.default.hash(O);const X=(0,Z.checkOpts)({dkLen:32,asyncTick:10},G),{c:W,dkLen:P,asyncTick:K}=X;if(d.default.number(W),d.default.number(P),d.default.number(K),W<1)throw new Error("PBKDF2: iterations (c) should be >= 1");const Y=(0,Z.toBytes)(B),L=(0,Z.toBytes)(F),ee=new Uint8Array(P),_=C.hmac.create(O,Y),h=_._cloneInto().update(L);return{c:W,dkLen:P,asyncTick:K,DK:ee,PRF:_,PRFSalt:h}}function m(O,B,F,G,X){return O.destroy(),B.destroy(),G&&G.destroy(),X.fill(0),F}function D(){return(D=q(function*(O,B,F,G){const{c:X,dkLen:W,asyncTick:P,DK:K,PRF:Y,PRFSalt:L}=Q(O,B,F,G);let ee;const _=new Uint8Array(4),h=(0,Z.createView)(_),S=new Uint8Array(Y.outputLen);for(let R=1,x=0;x<W;R++,x+=Y.outputLen){const l=K.subarray(x,x+Y.outputLen);h.setInt32(0,R,!1),(ee=L._cloneInto(ee)).update(_).digestInto(S),l.set(S.subarray(0,l.length)),yield(0,Z.asyncLoop)(X-1,P,u=>{Y._cloneInto(ee).update(S).digestInto(S);for(let y=0;y<l.length;y++)l[y]^=S[y]})}return m(Y,L,K,ee,S)})).apply(this,arguments)}a.pbkdf2=function w(O,B,F,G){const{c:X,dkLen:W,DK:P,PRF:K,PRFSalt:Y}=Q(O,B,F,G);let L;const ee=new Uint8Array(4),_=(0,Z.createView)(ee),h=new Uint8Array(K.outputLen);for(let S=1,R=0;R<W;S++,R+=K.outputLen){const x=P.subarray(R,R+K.outputLen);_.setInt32(0,S,!1),(L=Y._cloneInto(L)).update(ee).digestInto(h),x.set(h.subarray(0,x.length));for(let l=1;l<X;l++){K._cloneInto(L).update(h).digestInto(h);for(let u=0;u<x.length;u++)x[u]^=h[u]}}return m(K,Y,P,L,h)},a.pbkdf2Async=function $(O,B,F,G){return D.apply(this,arguments)}},8519:(se,a,H)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.sha224=a.sha256=void 0;const q=H(4206),d=H(7507),C=(O,B,F)=>O&B^~O&F,Z=(O,B,F)=>O&B^O&F^B&F,Q=new Uint32Array([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]),m=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),w=new Uint32Array(64);class $ extends q.SHA2{constructor(){super(64,32,8,!1),this.A=0|m[0],this.B=0|m[1],this.C=0|m[2],this.D=0|m[3],this.E=0|m[4],this.F=0|m[5],this.G=0|m[6],this.H=0|m[7]}get(){const{A:B,B:F,C:G,D:X,E:W,F:P,G:K,H:Y}=this;return[B,F,G,X,W,P,K,Y]}set(B,F,G,X,W,P,K,Y){this.A=0|B,this.B=0|F,this.C=0|G,this.D=0|X,this.E=0|W,this.F=0|P,this.G=0|K,this.H=0|Y}process(B,F){for(let _=0;_<16;_++,F+=4)w[_]=B.getUint32(F,!1);for(let _=16;_<64;_++){const h=w[_-15],S=w[_-2],R=(0,d.rotr)(h,7)^(0,d.rotr)(h,18)^h>>>3,x=(0,d.rotr)(S,17)^(0,d.rotr)(S,19)^S>>>10;w[_]=x+w[_-7]+R+w[_-16]|0}let{A:G,B:X,C:W,D:P,E:K,F:Y,G:L,H:ee}=this;for(let _=0;_<64;_++){const S=ee+((0,d.rotr)(K,6)^(0,d.rotr)(K,11)^(0,d.rotr)(K,25))+C(K,Y,L)+Q[_]+w[_]|0,x=((0,d.rotr)(G,2)^(0,d.rotr)(G,13)^(0,d.rotr)(G,22))+Z(G,X,W)|0;ee=L,L=Y,Y=K,K=P+S|0,P=W,W=X,X=G,G=S+x|0}G=G+this.A|0,X=X+this.B|0,W=W+this.C|0,P=P+this.D|0,K=K+this.E|0,Y=Y+this.F|0,L=L+this.G|0,ee=ee+this.H|0,this.set(G,X,W,P,K,Y,L,ee)}roundClean(){w.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}class D extends ${constructor(){super(),this.A=-1056596264,this.B=914150663,this.C=812702999,this.D=-150054599,this.E=-4191439,this.F=1750603025,this.G=1694076839,this.H=-1090891868,this.outputLen=28}}a.sha256=(0,d.wrapConstructor)(()=>new $),a.sha224=(0,d.wrapConstructor)(()=>new D)},27:(se,a,H)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.sha384=a.sha512_256=a.sha512_224=a.sha512=a.SHA512=void 0;const q=H(4206),d=H(9027),C=H(7507),[Z,Q]=d.default.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(F=>BigInt(F))),m=new Uint32Array(80),w=new Uint32Array(80);class $ extends q.SHA2{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){const{Ah:G,Al:X,Bh:W,Bl:P,Ch:K,Cl:Y,Dh:L,Dl:ee,Eh:_,El:h,Fh:S,Fl:R,Gh:x,Gl:l,Hh:u,Hl:y}=this;return[G,X,W,P,K,Y,L,ee,_,h,S,R,x,l,u,y]}set(G,X,W,P,K,Y,L,ee,_,h,S,R,x,l,u,y){this.Ah=0|G,this.Al=0|X,this.Bh=0|W,this.Bl=0|P,this.Ch=0|K,this.Cl=0|Y,this.Dh=0|L,this.Dl=0|ee,this.Eh=0|_,this.El=0|h,this.Fh=0|S,this.Fl=0|R,this.Gh=0|x,this.Gl=0|l,this.Hh=0|u,this.Hl=0|y}process(G,X){for(let k=0;k<16;k++,X+=4)m[k]=G.getUint32(X),w[k]=G.getUint32(X+=4);for(let k=16;k<80;k++){const V=0|m[k-15],ce=0|w[k-15],le=d.default.rotrSH(V,ce,1)^d.default.rotrSH(V,ce,8)^d.default.shrSH(V,ce,7),fe=d.default.rotrSL(V,ce,1)^d.default.rotrSL(V,ce,8)^d.default.shrSL(V,ce,7),M=0|m[k-2],ie=0|w[k-2],de=d.default.rotrSH(M,ie,19)^d.default.rotrBH(M,ie,61)^d.default.shrSH(M,ie,6),E=d.default.rotrSL(M,ie,19)^d.default.rotrBL(M,ie,61)^d.default.shrSL(M,ie,6),he=d.default.add4L(fe,E,w[k-7],w[k-16]),_e=d.default.add4H(he,le,de,m[k-7],m[k-16]);m[k]=0|_e,w[k]=0|he}let{Ah:W,Al:P,Bh:K,Bl:Y,Ch:L,Cl:ee,Dh:_,Dl:h,Eh:S,El:R,Fh:x,Fl:l,Gh:u,Gl:y,Hh:I,Hl:j}=this;for(let k=0;k<80;k++){const V=d.default.rotrSH(S,R,14)^d.default.rotrSH(S,R,18)^d.default.rotrBH(S,R,41),ce=d.default.rotrSL(S,R,14)^d.default.rotrSL(S,R,18)^d.default.rotrBL(S,R,41),le=S&x^~S&u,M=d.default.add5L(j,ce,R&l^~R&y,Q[k],w[k]),ie=d.default.add5H(M,I,V,le,Z[k],m[k]),de=0|M,E=d.default.rotrSH(W,P,28)^d.default.rotrBH(W,P,34)^d.default.rotrBH(W,P,39),he=d.default.rotrSL(W,P,28)^d.default.rotrBL(W,P,34)^d.default.rotrBL(W,P,39),_e=W&K^W&L^K&L,me=P&Y^P&ee^Y&ee;I=0|u,j=0|y,u=0|x,y=0|l,x=0|S,l=0|R,({h:S,l:R}=d.default.add(0|_,0|h,0|ie,0|de)),_=0|L,h=0|ee,L=0|K,ee=0|Y,K=0|W,Y=0|P;const qe=d.default.add3L(de,he,me);W=d.default.add3H(qe,ie,E,_e),P=0|qe}({h:W,l:P}=d.default.add(0|this.Ah,0|this.Al,0|W,0|P)),({h:K,l:Y}=d.default.add(0|this.Bh,0|this.Bl,0|K,0|Y)),({h:L,l:ee}=d.default.add(0|this.Ch,0|this.Cl,0|L,0|ee)),({h:_,l:h}=d.default.add(0|this.Dh,0|this.Dl,0|_,0|h)),({h:S,l:R}=d.default.add(0|this.Eh,0|this.El,0|S,0|R)),({h:x,l}=d.default.add(0|this.Fh,0|this.Fl,0|x,0|l)),({h:u,l:y}=d.default.add(0|this.Gh,0|this.Gl,0|u,0|y)),({h:I,l:j}=d.default.add(0|this.Hh,0|this.Hl,0|I,0|j)),this.set(W,P,K,Y,L,ee,_,h,S,R,x,l,u,y,I,j)}roundClean(){m.fill(0),w.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}a.SHA512=$;class D extends ${constructor(){super(),this.Ah=-1942145080,this.Al=424955298,this.Bh=1944164710,this.Bl=-1982016298,this.Ch=502970286,this.Cl=855612546,this.Dh=1738396948,this.Dl=1479516111,this.Eh=258812777,this.El=2077511080,this.Fh=2011393907,this.Fl=79989058,this.Gh=1067287976,this.Gl=1780299464,this.Hh=286451373,this.Hl=-1848208735,this.outputLen=28}}class O extends ${constructor(){super(),this.Ah=573645204,this.Al=-64227540,this.Bh=-1621794909,this.Bl=-934517566,this.Ch=596883563,this.Cl=1867755857,this.Dh=-1774684391,this.Dl=1497426621,this.Eh=-1775747358,this.El=-1467023389,this.Fh=-1101128155,this.Fl=1401305490,this.Gh=721525244,this.Gl=746961066,this.Hh=246885852,this.Hl=-2117784414,this.outputLen=32}}class B extends ${constructor(){super(),this.Ah=-876896931,this.Al=-1056596264,this.Bh=1654270250,this.Bl=914150663,this.Ch=-1856437926,this.Cl=812702999,this.Dh=355462360,this.Dl=-150054599,this.Eh=1731405415,this.El=-4191439,this.Fh=-1900787065,this.Fl=1750603025,this.Gh=-619958771,this.Gl=1694076839,this.Hh=1203062813,this.Hl=-1090891868,this.outputLen=48}}a.sha512=(0,C.wrapConstructor)(()=>new $),a.sha512_224=(0,C.wrapConstructor)(()=>new D),a.sha512_256=(0,C.wrapConstructor)(()=>new O),a.sha384=(0,C.wrapConstructor)(()=>new B)},7507:(se,a,H)=>{"use strict";var q=H(9598).default;Object.defineProperty(a,"__esModule",{value:!0}),a.randomBytes=a.wrapConstructorWithOpts=a.wrapConstructor=a.checkOpts=a.Hash=a.concatBytes=a.toBytes=a.utf8ToBytes=a.asyncLoop=a.nextTick=a.hexToBytes=a.bytesToHex=a.isLE=a.rotr=a.createView=a.u32=a.u8=void 0;const d=H(7882);if(a.u8=h=>new Uint8Array(h.buffer,h.byteOffset,h.byteLength),a.u32=h=>new Uint32Array(h.buffer,h.byteOffset,Math.floor(h.byteLength/4)),a.createView=h=>new DataView(h.buffer,h.byteOffset,h.byteLength),a.rotr=(h,S)=>h<<32-S|h>>>S,a.isLE=68===new Uint8Array(new Uint32Array([287454020]).buffer)[0],!a.isLE)throw new Error("Non little-endian hardware is not supported");const w=Array.from({length:256},(h,S)=>S.toString(16).padStart(2,"0"));function F(){return(F=q(function*(h,S,R){let x=Date.now();for(let l=0;l<h;l++){R(l);const u=Date.now()-x;u>=0&&u<S||(yield(0,a.nextTick)(),x+=u)}})).apply(this,arguments)}function G(h){if("string"!=typeof h)throw new TypeError("utf8ToBytes expected string, got "+typeof h);return(new TextEncoder).encode(h)}function X(h){if("string"==typeof h&&(h=G(h)),!(h instanceof Uint8Array))throw new TypeError(`Expected input type is Uint8Array (got ${typeof h})`);return h}a.bytesToHex=function $(h){if(!(h instanceof Uint8Array))throw new Error("Uint8Array expected");let S="";for(let R=0;R<h.length;R++)S+=w[h[R]];return S},a.hexToBytes=function D(h){if("string"!=typeof h)throw new TypeError("hexToBytes: expected string, got "+typeof h);if(h.length%2)throw new Error("hexToBytes: received invalid unpadded hex");const S=new Uint8Array(h.length/2);for(let R=0;R<S.length;R++){const x=2*R,l=h.slice(x,x+2),u=Number.parseInt(l,16);if(Number.isNaN(u)||u<0)throw new Error("Invalid byte sequence");S[R]=u}return S},a.nextTick=function(){var h=q(function*(){});return function(){return h.apply(this,arguments)}}(),a.asyncLoop=function B(h,S,R){return F.apply(this,arguments)},a.utf8ToBytes=G,a.toBytes=X,a.concatBytes=function W(...h){if(!h.every(x=>x instanceof Uint8Array))throw new Error("Uint8Array list expected");if(1===h.length)return h[0];const S=h.reduce((x,l)=>x+l.length,0),R=new Uint8Array(S);for(let x=0,l=0;x<h.length;x++){const u=h[x];R.set(u,l),l+=u.length}return R},a.Hash=class P{clone(){return this._cloneInto()}},a.checkOpts=function Y(h,S){if(void 0!==S&&("object"!=typeof S||!(h=>"[object Object]"===Object.prototype.toString.call(h)&&h.constructor===Object)(S)))throw new TypeError("Options should be object or undefined");return Object.assign(h,S)},a.wrapConstructor=function L(h){const S=x=>h().update(X(x)).digest(),R=h();return S.outputLen=R.outputLen,S.blockLen=R.blockLen,S.create=()=>h(),S},a.wrapConstructorWithOpts=function ee(h){const S=(x,l)=>h(l).update(X(x)).digest(),R=h({});return S.outputLen=R.outputLen,S.blockLen=R.blockLen,S.create=x=>h(x),S},a.randomBytes=function _(h=32){if(d.crypto.web)return d.crypto.web.getRandomValues(new Uint8Array(h));if(d.crypto.node)return new Uint8Array(d.crypto.node.randomBytes(h).buffer);throw new Error("The environment doesn't have randomBytes function")}},3439:(se,a)=>{"use strict";a.U=void 0,a.U="abandon\nability\nable\nabout\nabove\nabsent\nabsorb\nabstract\nabsurd\nabuse\naccess\naccident\naccount\naccuse\nachieve\nacid\nacoustic\nacquire\nacross\nact\naction\nactor\nactress\nactual\nadapt\nadd\naddict\naddress\nadjust\nadmit\nadult\nadvance\nadvice\naerobic\naffair\nafford\nafraid\nagain\nage\nagent\nagree\nahead\naim\nair\nairport\naisle\nalarm\nalbum\nalcohol\nalert\nalien\nall\nalley\nallow\nalmost\nalone\nalpha\nalready\nalso\nalter\nalways\namateur\namazing\namong\namount\namused\nanalyst\nanchor\nancient\nanger\nangle\nangry\nanimal\nankle\nannounce\nannual\nanother\nanswer\nantenna\nantique\nanxiety\nany\napart\napology\nappear\napple\napprove\napril\narch\narctic\narea\narena\nargue\narm\narmed\narmor\narmy\naround\narrange\narrest\narrive\narrow\nart\nartefact\nartist\nartwork\nask\naspect\nassault\nasset\nassist\nassume\nasthma\nathlete\natom\nattack\nattend\nattitude\nattract\nauction\naudit\naugust\naunt\nauthor\nauto\nautumn\naverage\navocado\navoid\nawake\naware\naway\nawesome\nawful\nawkward\naxis\nbaby\nbachelor\nbacon\nbadge\nbag\nbalance\nbalcony\nball\nbamboo\nbanana\nbanner\nbar\nbarely\nbargain\nbarrel\nbase\nbasic\nbasket\nbattle\nbeach\nbean\nbeauty\nbecause\nbecome\nbeef\nbefore\nbegin\nbehave\nbehind\nbelieve\nbelow\nbelt\nbench\nbenefit\nbest\nbetray\nbetter\nbetween\nbeyond\nbicycle\nbid\nbike\nbind\nbiology\nbird\nbirth\nbitter\nblack\nblade\nblame\nblanket\nblast\nbleak\nbless\nblind\nblood\nblossom\nblouse\nblue\nblur\nblush\nboard\nboat\nbody\nboil\nbomb\nbone\nbonus\nbook\nboost\nborder\nboring\nborrow\nboss\nbottom\nbounce\nbox\nboy\nbracket\nbrain\nbrand\nbrass\nbrave\nbread\nbreeze\nbrick\nbridge\nbrief\nbright\nbring\nbrisk\nbroccoli\nbroken\nbronze\nbroom\nbrother\nbrown\nbrush\nbubble\nbuddy\nbudget\nbuffalo\nbuild\nbulb\nbulk\nbullet\nbundle\nbunker\nburden\nburger\nburst\nbus\nbusiness\nbusy\nbutter\nbuyer\nbuzz\ncabbage\ncabin\ncable\ncactus\ncage\ncake\ncall\ncalm\ncamera\ncamp\ncan\ncanal\ncancel\ncandy\ncannon\ncanoe\ncanvas\ncanyon\ncapable\ncapital\ncaptain\ncar\ncarbon\ncard\ncargo\ncarpet\ncarry\ncart\ncase\ncash\ncasino\ncastle\ncasual\ncat\ncatalog\ncatch\ncategory\ncattle\ncaught\ncause\ncaution\ncave\nceiling\ncelery\ncement\ncensus\ncentury\ncereal\ncertain\nchair\nchalk\nchampion\nchange\nchaos\nchapter\ncharge\nchase\nchat\ncheap\ncheck\ncheese\nchef\ncherry\nchest\nchicken\nchief\nchild\nchimney\nchoice\nchoose\nchronic\nchuckle\nchunk\nchurn\ncigar\ncinnamon\ncircle\ncitizen\ncity\ncivil\nclaim\nclap\nclarify\nclaw\nclay\nclean\nclerk\nclever\nclick\nclient\ncliff\nclimb\nclinic\nclip\nclock\nclog\nclose\ncloth\ncloud\nclown\nclub\nclump\ncluster\nclutch\ncoach\ncoast\ncoconut\ncode\ncoffee\ncoil\ncoin\ncollect\ncolor\ncolumn\ncombine\ncome\ncomfort\ncomic\ncommon\ncompany\nconcert\nconduct\nconfirm\ncongress\nconnect\nconsider\ncontrol\nconvince\ncook\ncool\ncopper\ncopy\ncoral\ncore\ncorn\ncorrect\ncost\ncotton\ncouch\ncountry\ncouple\ncourse\ncousin\ncover\ncoyote\ncrack\ncradle\ncraft\ncram\ncrane\ncrash\ncrater\ncrawl\ncrazy\ncream\ncredit\ncreek\ncrew\ncricket\ncrime\ncrisp\ncritic\ncrop\ncross\ncrouch\ncrowd\ncrucial\ncruel\ncruise\ncrumble\ncrunch\ncrush\ncry\ncrystal\ncube\nculture\ncup\ncupboard\ncurious\ncurrent\ncurtain\ncurve\ncushion\ncustom\ncute\ncycle\ndad\ndamage\ndamp\ndance\ndanger\ndaring\ndash\ndaughter\ndawn\nday\ndeal\ndebate\ndebris\ndecade\ndecember\ndecide\ndecline\ndecorate\ndecrease\ndeer\ndefense\ndefine\ndefy\ndegree\ndelay\ndeliver\ndemand\ndemise\ndenial\ndentist\ndeny\ndepart\ndepend\ndeposit\ndepth\ndeputy\nderive\ndescribe\ndesert\ndesign\ndesk\ndespair\ndestroy\ndetail\ndetect\ndevelop\ndevice\ndevote\ndiagram\ndial\ndiamond\ndiary\ndice\ndiesel\ndiet\ndiffer\ndigital\ndignity\ndilemma\ndinner\ndinosaur\ndirect\ndirt\ndisagree\ndiscover\ndisease\ndish\ndismiss\ndisorder\ndisplay\ndistance\ndivert\ndivide\ndivorce\ndizzy\ndoctor\ndocument\ndog\ndoll\ndolphin\ndomain\ndonate\ndonkey\ndonor\ndoor\ndose\ndouble\ndove\ndraft\ndragon\ndrama\ndrastic\ndraw\ndream\ndress\ndrift\ndrill\ndrink\ndrip\ndrive\ndrop\ndrum\ndry\nduck\ndumb\ndune\nduring\ndust\ndutch\nduty\ndwarf\ndynamic\neager\neagle\nearly\nearn\nearth\neasily\neast\neasy\necho\necology\neconomy\nedge\nedit\neducate\neffort\negg\neight\neither\nelbow\nelder\nelectric\nelegant\nelement\nelephant\nelevator\nelite\nelse\nembark\nembody\nembrace\nemerge\nemotion\nemploy\nempower\nempty\nenable\nenact\nend\nendless\nendorse\nenemy\nenergy\nenforce\nengage\nengine\nenhance\nenjoy\nenlist\nenough\nenrich\nenroll\nensure\nenter\nentire\nentry\nenvelope\nepisode\nequal\nequip\nera\nerase\nerode\nerosion\nerror\nerupt\nescape\nessay\nessence\nestate\neternal\nethics\nevidence\nevil\nevoke\nevolve\nexact\nexample\nexcess\nexchange\nexcite\nexclude\nexcuse\nexecute\nexercise\nexhaust\nexhibit\nexile\nexist\nexit\nexotic\nexpand\nexpect\nexpire\nexplain\nexpose\nexpress\nextend\nextra\neye\neyebrow\nfabric\nface\nfaculty\nfade\nfaint\nfaith\nfall\nfalse\nfame\nfamily\nfamous\nfan\nfancy\nfantasy\nfarm\nfashion\nfat\nfatal\nfather\nfatigue\nfault\nfavorite\nfeature\nfebruary\nfederal\nfee\nfeed\nfeel\nfemale\nfence\nfestival\nfetch\nfever\nfew\nfiber\nfiction\nfield\nfigure\nfile\nfilm\nfilter\nfinal\nfind\nfine\nfinger\nfinish\nfire\nfirm\nfirst\nfiscal\nfish\nfit\nfitness\nfix\nflag\nflame\nflash\nflat\nflavor\nflee\nflight\nflip\nfloat\nflock\nfloor\nflower\nfluid\nflush\nfly\nfoam\nfocus\nfog\nfoil\nfold\nfollow\nfood\nfoot\nforce\nforest\nforget\nfork\nfortune\nforum\nforward\nfossil\nfoster\nfound\nfox\nfragile\nframe\nfrequent\nfresh\nfriend\nfringe\nfrog\nfront\nfrost\nfrown\nfrozen\nfruit\nfuel\nfun\nfunny\nfurnace\nfury\nfuture\ngadget\ngain\ngalaxy\ngallery\ngame\ngap\ngarage\ngarbage\ngarden\ngarlic\ngarment\ngas\ngasp\ngate\ngather\ngauge\ngaze\ngeneral\ngenius\ngenre\ngentle\ngenuine\ngesture\nghost\ngiant\ngift\ngiggle\nginger\ngiraffe\ngirl\ngive\nglad\nglance\nglare\nglass\nglide\nglimpse\nglobe\ngloom\nglory\nglove\nglow\nglue\ngoat\ngoddess\ngold\ngood\ngoose\ngorilla\ngospel\ngossip\ngovern\ngown\ngrab\ngrace\ngrain\ngrant\ngrape\ngrass\ngravity\ngreat\ngreen\ngrid\ngrief\ngrit\ngrocery\ngroup\ngrow\ngrunt\nguard\nguess\nguide\nguilt\nguitar\ngun\ngym\nhabit\nhair\nhalf\nhammer\nhamster\nhand\nhappy\nharbor\nhard\nharsh\nharvest\nhat\nhave\nhawk\nhazard\nhead\nhealth\nheart\nheavy\nhedgehog\nheight\nhello\nhelmet\nhelp\nhen\nhero\nhidden\nhigh\nhill\nhint\nhip\nhire\nhistory\nhobby\nhockey\nhold\nhole\nholiday\nhollow\nhome\nhoney\nhood\nhope\nhorn\nhorror\nhorse\nhospital\nhost\nhotel\nhour\nhover\nhub\nhuge\nhuman\nhumble\nhumor\nhundred\nhungry\nhunt\nhurdle\nhurry\nhurt\nhusband\nhybrid\nice\nicon\nidea\nidentify\nidle\nignore\nill\nillegal\nillness\nimage\nimitate\nimmense\nimmune\nimpact\nimpose\nimprove\nimpulse\ninch\ninclude\nincome\nincrease\nindex\nindicate\nindoor\nindustry\ninfant\ninflict\ninform\ninhale\ninherit\ninitial\ninject\ninjury\ninmate\ninner\ninnocent\ninput\ninquiry\ninsane\ninsect\ninside\ninspire\ninstall\nintact\ninterest\ninto\ninvest\ninvite\ninvolve\niron\nisland\nisolate\nissue\nitem\nivory\njacket\njaguar\njar\njazz\njealous\njeans\njelly\njewel\njob\njoin\njoke\njourney\njoy\njudge\njuice\njump\njungle\njunior\njunk\njust\nkangaroo\nkeen\nkeep\nketchup\nkey\nkick\nkid\nkidney\nkind\nkingdom\nkiss\nkit\nkitchen\nkite\nkitten\nkiwi\nknee\nknife\nknock\nknow\nlab\nlabel\nlabor\nladder\nlady\nlake\nlamp\nlanguage\nlaptop\nlarge\nlater\nlatin\nlaugh\nlaundry\nlava\nlaw\nlawn\nlawsuit\nlayer\nlazy\nleader\nleaf\nlearn\nleave\nlecture\nleft\nleg\nlegal\nlegend\nleisure\nlemon\nlend\nlength\nlens\nleopard\nlesson\nletter\nlevel\nliar\nliberty\nlibrary\nlicense\nlife\nlift\nlight\nlike\nlimb\nlimit\nlink\nlion\nliquid\nlist\nlittle\nlive\nlizard\nload\nloan\nlobster\nlocal\nlock\nlogic\nlonely\nlong\nloop\nlottery\nloud\nlounge\nlove\nloyal\nlucky\nluggage\nlumber\nlunar\nlunch\nluxury\nlyrics\nmachine\nmad\nmagic\nmagnet\nmaid\nmail\nmain\nmajor\nmake\nmammal\nman\nmanage\nmandate\nmango\nmansion\nmanual\nmaple\nmarble\nmarch\nmargin\nmarine\nmarket\nmarriage\nmask\nmass\nmaster\nmatch\nmaterial\nmath\nmatrix\nmatter\nmaximum\nmaze\nmeadow\nmean\nmeasure\nmeat\nmechanic\nmedal\nmedia\nmelody\nmelt\nmember\nmemory\nmention\nmenu\nmercy\nmerge\nmerit\nmerry\nmesh\nmessage\nmetal\nmethod\nmiddle\nmidnight\nmilk\nmillion\nmimic\nmind\nminimum\nminor\nminute\nmiracle\nmirror\nmisery\nmiss\nmistake\nmix\nmixed\nmixture\nmobile\nmodel\nmodify\nmom\nmoment\nmonitor\nmonkey\nmonster\nmonth\nmoon\nmoral\nmore\nmorning\nmosquito\nmother\nmotion\nmotor\nmountain\nmouse\nmove\nmovie\nmuch\nmuffin\nmule\nmultiply\nmuscle\nmuseum\nmushroom\nmusic\nmust\nmutual\nmyself\nmystery\nmyth\nnaive\nname\nnapkin\nnarrow\nnasty\nnation\nnature\nnear\nneck\nneed\nnegative\nneglect\nneither\nnephew\nnerve\nnest\nnet\nnetwork\nneutral\nnever\nnews\nnext\nnice\nnight\nnoble\nnoise\nnominee\nnoodle\nnormal\nnorth\nnose\nnotable\nnote\nnothing\nnotice\nnovel\nnow\nnuclear\nnumber\nnurse\nnut\noak\nobey\nobject\noblige\nobscure\nobserve\nobtain\nobvious\noccur\nocean\noctober\nodor\noff\noffer\noffice\noften\noil\nokay\nold\nolive\nolympic\nomit\nonce\none\nonion\nonline\nonly\nopen\nopera\nopinion\noppose\noption\norange\norbit\norchard\norder\nordinary\norgan\norient\noriginal\norphan\nostrich\nother\noutdoor\nouter\noutput\noutside\noval\noven\nover\nown\nowner\noxygen\noyster\nozone\npact\npaddle\npage\npair\npalace\npalm\npanda\npanel\npanic\npanther\npaper\nparade\nparent\npark\nparrot\nparty\npass\npatch\npath\npatient\npatrol\npattern\npause\npave\npayment\npeace\npeanut\npear\npeasant\npelican\npen\npenalty\npencil\npeople\npepper\nperfect\npermit\nperson\npet\nphone\nphoto\nphrase\nphysical\npiano\npicnic\npicture\npiece\npig\npigeon\npill\npilot\npink\npioneer\npipe\npistol\npitch\npizza\nplace\nplanet\nplastic\nplate\nplay\nplease\npledge\npluck\nplug\nplunge\npoem\npoet\npoint\npolar\npole\npolice\npond\npony\npool\npopular\nportion\nposition\npossible\npost\npotato\npottery\npoverty\npowder\npower\npractice\npraise\npredict\nprefer\nprepare\npresent\npretty\nprevent\nprice\npride\nprimary\nprint\npriority\nprison\nprivate\nprize\nproblem\nprocess\nproduce\nprofit\nprogram\nproject\npromote\nproof\nproperty\nprosper\nprotect\nproud\nprovide\npublic\npudding\npull\npulp\npulse\npumpkin\npunch\npupil\npuppy\npurchase\npurity\npurpose\npurse\npush\nput\npuzzle\npyramid\nquality\nquantum\nquarter\nquestion\nquick\nquit\nquiz\nquote\nrabbit\nraccoon\nrace\nrack\nradar\nradio\nrail\nrain\nraise\nrally\nramp\nranch\nrandom\nrange\nrapid\nrare\nrate\nrather\nraven\nraw\nrazor\nready\nreal\nreason\nrebel\nrebuild\nrecall\nreceive\nrecipe\nrecord\nrecycle\nreduce\nreflect\nreform\nrefuse\nregion\nregret\nregular\nreject\nrelax\nrelease\nrelief\nrely\nremain\nremember\nremind\nremove\nrender\nrenew\nrent\nreopen\nrepair\nrepeat\nreplace\nreport\nrequire\nrescue\nresemble\nresist\nresource\nresponse\nresult\nretire\nretreat\nreturn\nreunion\nreveal\nreview\nreward\nrhythm\nrib\nribbon\nrice\nrich\nride\nridge\nrifle\nright\nrigid\nring\nriot\nripple\nrisk\nritual\nrival\nriver\nroad\nroast\nrobot\nrobust\nrocket\nromance\nroof\nrookie\nroom\nrose\nrotate\nrough\nround\nroute\nroyal\nrubber\nrude\nrug\nrule\nrun\nrunway\nrural\nsad\nsaddle\nsadness\nsafe\nsail\nsalad\nsalmon\nsalon\nsalt\nsalute\nsame\nsample\nsand\nsatisfy\nsatoshi\nsauce\nsausage\nsave\nsay\nscale\nscan\nscare\nscatter\nscene\nscheme\nschool\nscience\nscissors\nscorpion\nscout\nscrap\nscreen\nscript\nscrub\nsea\nsearch\nseason\nseat\nsecond\nsecret\nsection\nsecurity\nseed\nseek\nsegment\nselect\nsell\nseminar\nsenior\nsense\nsentence\nseries\nservice\nsession\nsettle\nsetup\nseven\nshadow\nshaft\nshallow\nshare\nshed\nshell\nsheriff\nshield\nshift\nshine\nship\nshiver\nshock\nshoe\nshoot\nshop\nshort\nshoulder\nshove\nshrimp\nshrug\nshuffle\nshy\nsibling\nsick\nside\nsiege\nsight\nsign\nsilent\nsilk\nsilly\nsilver\nsimilar\nsimple\nsince\nsing\nsiren\nsister\nsituate\nsix\nsize\nskate\nsketch\nski\nskill\nskin\nskirt\nskull\nslab\nslam\nsleep\nslender\nslice\nslide\nslight\nslim\nslogan\nslot\nslow\nslush\nsmall\nsmart\nsmile\nsmoke\nsmooth\nsnack\nsnake\nsnap\nsniff\nsnow\nsoap\nsoccer\nsocial\nsock\nsoda\nsoft\nsolar\nsoldier\nsolid\nsolution\nsolve\nsomeone\nsong\nsoon\nsorry\nsort\nsoul\nsound\nsoup\nsource\nsouth\nspace\nspare\nspatial\nspawn\nspeak\nspecial\nspeed\nspell\nspend\nsphere\nspice\nspider\nspike\nspin\nspirit\nsplit\nspoil\nsponsor\nspoon\nsport\nspot\nspray\nspread\nspring\nspy\nsquare\nsqueeze\nsquirrel\nstable\nstadium\nstaff\nstage\nstairs\nstamp\nstand\nstart\nstate\nstay\nsteak\nsteel\nstem\nstep\nstereo\nstick\nstill\nsting\nstock\nstomach\nstone\nstool\nstory\nstove\nstrategy\nstreet\nstrike\nstrong\nstruggle\nstudent\nstuff\nstumble\nstyle\nsubject\nsubmit\nsubway\nsuccess\nsuch\nsudden\nsuffer\nsugar\nsuggest\nsuit\nsummer\nsun\nsunny\nsunset\nsuper\nsupply\nsupreme\nsure\nsurface\nsurge\nsurprise\nsurround\nsurvey\nsuspect\nsustain\nswallow\nswamp\nswap\nswarm\nswear\nsweet\nswift\nswim\nswing\nswitch\nsword\nsymbol\nsymptom\nsyrup\nsystem\ntable\ntackle\ntag\ntail\ntalent\ntalk\ntank\ntape\ntarget\ntask\ntaste\ntattoo\ntaxi\nteach\nteam\ntell\nten\ntenant\ntennis\ntent\nterm\ntest\ntext\nthank\nthat\ntheme\nthen\ntheory\nthere\nthey\nthing\nthis\nthought\nthree\nthrive\nthrow\nthumb\nthunder\nticket\ntide\ntiger\ntilt\ntimber\ntime\ntiny\ntip\ntired\ntissue\ntitle\ntoast\ntobacco\ntoday\ntoddler\ntoe\ntogether\ntoilet\ntoken\ntomato\ntomorrow\ntone\ntongue\ntonight\ntool\ntooth\ntop\ntopic\ntopple\ntorch\ntornado\ntortoise\ntoss\ntotal\ntourist\ntoward\ntower\ntown\ntoy\ntrack\ntrade\ntraffic\ntragic\ntrain\ntransfer\ntrap\ntrash\ntravel\ntray\ntreat\ntree\ntrend\ntrial\ntribe\ntrick\ntrigger\ntrim\ntrip\ntrophy\ntrouble\ntruck\ntrue\ntruly\ntrumpet\ntrust\ntruth\ntry\ntube\ntuition\ntumble\ntuna\ntunnel\nturkey\nturn\nturtle\ntwelve\ntwenty\ntwice\ntwin\ntwist\ntwo\ntype\ntypical\nugly\numbrella\nunable\nunaware\nuncle\nuncover\nunder\nundo\nunfair\nunfold\nunhappy\nuniform\nunique\nunit\nuniverse\nunknown\nunlock\nuntil\nunusual\nunveil\nupdate\nupgrade\nuphold\nupon\nupper\nupset\nurban\nurge\nusage\nuse\nused\nuseful\nuseless\nusual\nutility\nvacant\nvacuum\nvague\nvalid\nvalley\nvalve\nvan\nvanish\nvapor\nvarious\nvast\nvault\nvehicle\nvelvet\nvendor\nventure\nvenue\nverb\nverify\nversion\nvery\nvessel\nveteran\nviable\nvibrant\nvicious\nvictory\nvideo\nview\nvillage\nvintage\nviolin\nvirtual\nvirus\nvisa\nvisit\nvisual\nvital\nvivid\nvocal\nvoice\nvoid\nvolcano\nvolume\nvote\nvoyage\nwage\nwagon\nwait\nwalk\nwall\nwalnut\nwant\nwarfare\nwarm\nwarrior\nwash\nwasp\nwaste\nwater\nwave\nway\nwealth\nweapon\nwear\nweasel\nweather\nweb\nwedding\nweekend\nweird\nwelcome\nwest\nwet\nwhale\nwhat\nwheat\nwheel\nwhen\nwhere\nwhip\nwhisper\nwide\nwidth\nwife\nwild\nwill\nwin\nwindow\nwine\nwing\nwink\nwinner\nwinter\nwire\nwisdom\nwise\nwish\nwitness\nwolf\nwoman\nwonder\nwood\nwool\nword\nwork\nworld\nworry\nworth\nwrap\nwreck\nwrestle\nwrist\nwrite\nwrong\nyard\nyear\nyellow\nyou\nyoung\nyouth\nzebra\nzero\nzone\nzoo".split("\n")},5856:()=>{},9598:se=>{function a(q,d,C,Z,Q,m,w){try{var $=q[m](w),D=$.value}catch(O){return void C(O)}$.done?d(D):Promise.resolve(D).then(Z,Q)}se.exports=function H(q){return function(){var d=this,C=arguments;return new Promise(function(Z,Q){var m=q.apply(d,C);function w(D){a(m,Z,Q,w,$,"next",D)}function $(D){a(m,Z,Q,w,$,"throw",D)}w(void 0)})}},se.exports.__esModule=!0,se.exports.default=se.exports}},cn={};function ye(se){var a=cn[se];if(void 0!==a)return a.exports;var H=cn[se]={exports:{}};return er[se](H,H.exports,ye),H.exports}se=Object.getPrototypeOf?H=>Object.getPrototypeOf(H):H=>H.__proto__,ye.t=function(H,q){if(1&q&&(H=this(H)),8&q||"object"==typeof H&&H&&(4&q&&H.__esModule||16&q&&"function"==typeof H.then))return H;var d=Object.create(null);ye.r(d);var C={};a=a||[null,se({}),se([]),se(se)];for(var Z=2&q&&H;"object"==typeof Z&&!~a.indexOf(Z);Z=se(Z))Object.getOwnPropertyNames(Z).forEach(Q=>C[Q]=()=>H[Q]);return C.default=()=>H,ye.d(d,C),d},ye.d=(se,a)=>{for(var H in a)ye.o(a,H)&&!ye.o(se,H)&&Object.defineProperty(se,H,{enumerable:!0,get:a[H]})},ye.o=(se,a)=>Object.prototype.hasOwnProperty.call(se,a),ye.r=se=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(se,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(se,"__esModule",{value:!0})},(()=>{"use strict";function se(t,e,n,r,s,o,i){try{var c=t[o](i),f=c.value}catch(g){return void n(g)}c.done?e(f):Promise.resolve(f).then(r,s)}function a(t){return function(){var e=this,n=arguments;return new Promise(function(r,s){var o=t.apply(e,n);function i(f){se(o,r,s,i,c,"next",f)}function c(f){se(o,r,s,i,c,"throw",f)}i(void 0)})}}var H=ye(5856),q=ye.t(H,2);const d=BigInt(0),C=BigInt(1),Z=BigInt(2),Q=BigInt(3),m=BigInt(8),w=Object.freeze({a:d,b:BigInt(7),P:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:C,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee")}),$=(t,e)=>(t+e/Z)/e,D={beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar(t){const{n:e}=w,n=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-C*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),s=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),o=n,i=BigInt("0x100000000000000000000000000000000"),c=$(o*t,e),f=$(-r*t,e);let g=E(t-c*n-f*s,e),b=E(-c*r-f*o,e);const p=g>i,v=b>i;if(p&&(g=e-g),v&&(b=e-b),g>i||b>i)throw new Error("splitScalarEndo: Endomorphism failed, k="+t);return{k1neg:p,k1:g,k2neg:v,k2:b}}};function W(t){const{a:e,b:n}=w,r=E(t*t),s=E(r*t);return E(s+e*t+n)}const P=w.a===d;class K extends Error{constructor(e){super(e)}}function Y(t){if(!(t instanceof L))throw new TypeError("JacobianPoint expected")}class L{constructor(e,n,r){this.x=e,this.y=n,this.z=r}static fromAffine(e){if(!(e instanceof h))throw new TypeError("JacobianPoint#fromAffine: expected Point");return e.equals(h.ZERO)?L.ZERO:new L(e.x,e.y,C)}static toAffineBatch(e){const n=function qe(t,e=w.P){const n=new Array(t.length),s=me(t.reduce((o,i,c)=>i===d?o:(n[c]=o,E(o*i,e)),C),e);return t.reduceRight((o,i,c)=>i===d?o:(n[c]=E(o*n[c],e),E(o*i,e)),s),n}(e.map(r=>r.z));return e.map((r,s)=>r.toAffine(n[s]))}static normalizeZ(e){return L.toAffineBatch(e).map(L.fromAffine)}equals(e){Y(e);const{x:n,y:r,z:s}=this,{x:o,y:i,z:c}=e,f=E(s*s),g=E(c*c),b=E(n*g),p=E(o*f),v=E(E(r*c)*g),T=E(E(i*s)*f);return b===p&&v===T}negate(){return new L(this.x,E(-this.y),this.z)}double(){const{x:e,y:n,z:r}=this,s=E(e*e),o=E(n*n),i=E(o*o),c=e+o,f=E(Z*(E(c*c)-s-i)),g=E(Q*s),b=E(g*g),p=E(b-Z*f),v=E(g*(f-p)-m*i),T=E(Z*n*r);return new L(p,v,T)}add(e){Y(e);const{x:n,y:r,z:s}=this,{x:o,y:i,z:c}=e;if(o===d||i===d)return this;if(n===d||r===d)return e;const f=E(s*s),g=E(c*c),b=E(n*g),p=E(o*f),v=E(E(r*c)*g),T=E(E(i*s)*f),A=E(p-b),U=E(T-v);if(A===d)return U===d?this.double():L.ZERO;const z=E(A*A),te=E(A*z),J=E(b*z),N=E(U*U-te-Z*J),ae=E(U*(J-N)-v*te),ne=E(s*c*A);return new L(N,ae,ne)}subtract(e){return this.add(e.negate())}multiplyUnsafe(e){const n=L.ZERO;if("bigint"==typeof e&&e===d)return n;let r=de(e);if(r===C)return this;if(!P){let p=n,v=this;for(;r>d;)r&C&&(p=p.add(v)),v=v.double(),r>>=C;return p}let{k1neg:s,k1:o,k2neg:i,k2:c}=D.splitScalar(r),f=n,g=n,b=this;for(;o>d||c>d;)o&C&&(f=f.add(b)),c&C&&(g=g.add(b)),b=b.double(),o>>=C,c>>=C;return s&&(f=f.negate()),i&&(g=g.negate()),g=new L(E(g.x*D.beta),g.y,g.z),f.add(g)}precomputeWindow(e){const n=P?128/e+1:256/e+1,r=[];let s=this,o=s;for(let i=0;i<n;i++){o=s,r.push(o);for(let c=1;c<2**(e-1);c++)o=o.add(s),r.push(o);s=o.double()}return r}wNAF(e,n){!n&&this.equals(L.BASE)&&(n=h.BASE);const r=n&&n._WINDOW_SIZE||1;if(256%r)throw new Error("Point#wNAF: Invalid precomputation window, must be power of 2");let s=n&&_.get(n);s||(s=this.precomputeWindow(r),n&&1!==r&&(s=L.normalizeZ(s),_.set(n,s)));let o=L.ZERO,i=L.BASE;const c=1+(P?128/r:256/r),f=2**(r-1),g=BigInt(2**r-1),b=2**r,p=BigInt(r);for(let v=0;v<c;v++){const T=v*f;let A=Number(e&g);e>>=p,A>f&&(A-=b,e+=C);const U=T,z=T+Math.abs(A)-1,J=A<0;0===A?i=i.add(ee(v%2!=0,s[U])):o=o.add(ee(J,s[z]))}return{p:o,f:i}}multiply(e,n){let s,o,r=de(e);if(P){const{k1neg:i,k1:c,k2neg:f,k2:g}=D.splitScalar(r);let{p:b,f:p}=this.wNAF(c,n),{p:v,f:T}=this.wNAF(g,n);b=ee(i,b),v=ee(f,v),v=new L(E(v.x*D.beta),v.y,v.z),s=b.add(v),o=p.add(T)}else{const{p:i,f:c}=this.wNAF(r,n);s=i,o=c}return L.normalizeZ([s,o])[0]}toAffine(e){const{x:n,y:r,z:s}=this,o=this.equals(L.ZERO);null==e&&(e=o?m:me(s));const i=e,c=E(i*i),f=E(c*i),g=E(n*c),b=E(r*f),p=E(s*i);if(o)return h.ZERO;if(p!==C)throw new Error("invZ was invalid");return new h(g,b)}}function ee(t,e){const n=e.negate();return t?n:e}L.BASE=new L(w.Gx,w.Gy,C),L.ZERO=new L(d,C,d);const _=new WeakMap;class h{constructor(e,n){this.x=e,this.y=n}_setWindowSize(e){this._WINDOW_SIZE=e,_.delete(this)}hasEvenY(){return this.y%Z===d}static fromCompressedHex(e){const n=32===e.length,r=M(n?e:e.subarray(1));if(!it(r))throw new Error("Point is not on curve");let o=function _e(t){const{P:e}=w,n=BigInt(6),r=BigInt(11),s=BigInt(22),o=BigInt(23),i=BigInt(44),c=BigInt(88),f=t*t*t%e,g=f*f*t%e,b=he(g,Q)*g%e,p=he(b,Q)*g%e,v=he(p,Z)*f%e,T=he(v,r)*v%e,A=he(T,s)*T%e,U=he(A,i)*A%e,z=he(U,c)*U%e,te=he(z,i)*A%e,J=he(te,Q)*g%e,N=he(J,o)*T%e,ae=he(N,n)*f%e,ne=he(ae,Z);if(ne*ne%e!==t)throw new Error("Cannot find square root");return ne}(W(r));const i=(o&C)===C;n?i&&(o=E(-o)):1==(1&e[0])!==i&&(o=E(-o));const c=new h(r,o);return c.assertValidity(),c}static fromUncompressedHex(e){const n=M(e.subarray(1,33)),r=M(e.subarray(33,65)),s=new h(n,r);return s.assertValidity(),s}static fromHex(e){const n=ie(e),r=n.length,s=n[0];if(32===r)return this.fromCompressedHex(n);if(33===r&&(2===s||3===s))return this.fromCompressedHex(n);if(65===r&&4===s)return this.fromUncompressedHex(n);throw new Error(`Point.fromHex: received invalid point. Expected 32-33 compressed bytes or 65 uncompressed bytes, not ${r}`)}static fromPrivateKey(e){return h.BASE.multiply(De(e))}static fromSignature(e,n,r){const{r:s,s:o}=un(n);if(![0,1,2,3].includes(r))throw new Error("Cannot recover: invalid recovery bit");const i=St(ie(e)),{n:c}=w,f=2===r||3===r?s+c:s,g=me(f,c),b=E(-i*g,c),p=E(o*g,c),T=h.fromHex((1&r?"03":"02")+k(f)),A=h.BASE.multiplyAndAddUnsafe(T,b,p);if(!A)throw new Error("Cannot recover signature: point at infinify");return A.assertValidity(),A}toRawBytes(e=!1){return fe(this.toHex(e))}toHex(e=!1){const n=k(this.x);return e?`${this.hasEvenY()?"02":"03"}${n}`:`04${n}${k(this.y)}`}toHexX(){return this.toHex(!0).slice(2)}toRawX(){return this.toRawBytes(!0).slice(1)}assertValidity(){const e="Point is not on elliptic curve",{x:n,y:r}=this;if(!it(n)||!it(r))throw new Error(e);const s=E(r*r);if(E(s-W(n))!==d)throw new Error(e)}equals(e){return this.x===e.x&&this.y===e.y}negate(){return new h(this.x,E(-this.y))}double(){return L.fromAffine(this).double().toAffine()}add(e){return L.fromAffine(this).add(L.fromAffine(e)).toAffine()}subtract(e){return this.add(e.negate())}multiply(e){return L.fromAffine(this).multiply(e,this).toAffine()}multiplyAndAddUnsafe(e,n,r){const s=L.fromAffine(this),o=n===d||n===C||this!==h.BASE?s.multiplyUnsafe(n):s.multiply(n),i=L.fromAffine(e).multiplyUnsafe(r),c=o.add(i);return c.equals(L.ZERO)?void 0:c.toAffine()}}function S(t){return Number.parseInt(t[0],16)>=8?"00"+t:t}function R(t){if(t.length<2||2!==t[0])throw new Error(`Invalid signature integer tag: ${I(t)}`);const e=t[1],n=t.subarray(2,e+2);if(!e||n.length!==e)throw new Error("Invalid signature integer: wrong length");if(0===n[0]&&n[1]<=127)throw new Error("Invalid signature integer: trailing length");return{data:M(n),left:t.subarray(e+2)}}h.BASE=new h(w.Gx,w.Gy),h.ZERO=new h(d,d);class l{constructor(e,n){this.r=e,this.s=n,this.assertValidity()}static fromCompact(e){const n=e instanceof Uint8Array,r="Signature.fromCompact";if("string"!=typeof e&&!n)throw new TypeError(`${r}: Expected string or Uint8Array`);const s=n?I(e):e;if(128!==s.length)throw new Error(`${r}: Expected 64-byte hex`);return new l(le(s.slice(0,64)),le(s.slice(64,128)))}static fromDER(e){const n=e instanceof Uint8Array;if("string"!=typeof e&&!n)throw new TypeError("Signature.fromDER: Expected string or Uint8Array");const{r,s}=function x(t){if(t.length<2||48!=t[0])throw new Error(`Invalid signature tag: ${I(t)}`);if(t[1]!==t.length-2)throw new Error("Invalid signature: incorrect length");const{data:e,left:n}=R(t.subarray(2)),{data:r,left:s}=R(n);if(s.length)throw new Error(`Invalid signature: left bytes after parsing: ${I(s)}`);return{r:e,s:r}}(n?e:fe(e));return new l(r,s)}static fromHex(e){return this.fromDER(e)}assertValidity(){const{r:e,s:n}=this;if(!Ze(e))throw new Error("Invalid Signature: r must be 0 < r < n");if(!Ze(n))throw new Error("Invalid Signature: s must be 0 < s < n")}hasHighS(){return this.s>w.n>>C}normalizeS(){return this.hasHighS()?new l(this.r,E(-this.s,w.n)):this}toDERRawBytes(){return fe(this.toDERHex())}toDERHex(){const e=S(ce(this.s)),n=S(ce(this.r)),r=e.length/2,s=n.length/2,o=ce(r),i=ce(s);return`30${ce(s+r+4)}02${i}${n}02${o}${e}`}toRawBytes(){return this.toDERRawBytes()}toHex(){return this.toDERHex()}toCompactRawBytes(){return fe(this.toCompactHex())}toCompactHex(){return k(this.r)+k(this.s)}}function u(...t){if(!t.every(r=>r instanceof Uint8Array))throw new Error("Uint8Array list expected");if(1===t.length)return t[0];const e=t.reduce((r,s)=>r+s.length,0),n=new Uint8Array(e);for(let r=0,s=0;r<t.length;r++){const o=t[r];n.set(o,s),s+=o.length}return n}const y=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function I(t){if(!(t instanceof Uint8Array))throw new Error("Expected Uint8Array");let e="";for(let n=0;n<t.length;n++)e+=y[t[n]];return e}const j=BigInt("0x10000000000000000000000000000000000000000000000000000000000000000");function k(t){if("bigint"!=typeof t)throw new Error("Expected bigint");if(!(d<=t&&t<j))throw new Error("Expected number 0 <= n < 2^256");return t.toString(16).padStart(64,"0")}function V(t){const e=fe(k(t));if(32!==e.length)throw new Error("Error: expected 32 bytes");return e}function ce(t){const e=t.toString(16);return 1&e.length?`0${e}`:e}function le(t){if("string"!=typeof t)throw new TypeError("hexToNumber: expected string, got "+typeof t);return BigInt(`0x${t}`)}function fe(t){if("string"!=typeof t)throw new TypeError("hexToBytes: expected string, got "+typeof t);if(t.length%2)throw new Error("hexToBytes: received invalid unpadded hex"+t.length);const e=new Uint8Array(t.length/2);for(let n=0;n<e.length;n++){const r=2*n,s=t.slice(r,r+2),o=Number.parseInt(s,16);if(Number.isNaN(o)||o<0)throw new Error("Invalid byte sequence");e[n]=o}return e}function M(t){return le(I(t))}function ie(t){return t instanceof Uint8Array?Uint8Array.from(t):fe(t)}function de(t){if("number"==typeof t&&Number.isSafeInteger(t)&&t>0)return BigInt(t);if("bigint"==typeof t&&Ze(t))return t;throw new TypeError("Expected valid private scalar: 0 < scalar < curve.n")}function E(t,e=w.P){const n=t%e;return n>=d?n:e+n}function he(t,e){const{P:n}=w;let r=t;for(;e-- >d;)r*=r,r%=n;return r}function me(t,e=w.P){if(t===d||e<=d)throw new Error(`invert: expected positive integers, got n=${t} mod=${e}`);let n=E(t,e),r=e,s=d,o=C,i=C,c=d;for(;n!==d;){const g=r/n,b=r%n,p=s-i*g,v=o-c*g;r=n,n=b,s=i,o=c,i=p,c=v}if(r!==C)throw new Error("invert: does not exist");return E(s,e)}function St(t,e=!1){const n=function tr(t){const e=8*t.length-256,n=M(t);return e>0?n>>BigInt(e):n}(t);if(e)return n;const{n:r}=w;return n>=r?n-r:n}let Ve,Qe;class an{constructor(e,n){if(this.hashLen=e,this.qByteLen=n,"number"!=typeof e||e<2)throw new Error("hashLen must be a number");if("number"!=typeof n||n<2)throw new Error("qByteLen must be a number");this.v=new Uint8Array(e).fill(1),this.k=new Uint8Array(e).fill(0),this.counter=0}hmac(...e){return oe.hmacSha256(this.k,...e)}hmacSync(...e){return Qe(this.k,...e)}checkSync(){if("function"!=typeof Qe)throw new K("hmacSha256Sync needs to be set")}incr(){if(this.counter>=1e3)throw new Error("Tried 1,000 k values for sign(), all were invalid");this.counter+=1}reseed(e=new Uint8Array){var n=this;return a(function*(){n.k=yield n.hmac(n.v,Uint8Array.from([0]),e),n.v=yield n.hmac(n.v),0!==e.length&&(n.k=yield n.hmac(n.v,Uint8Array.from([1]),e),n.v=yield n.hmac(n.v))})()}reseedSync(e=new Uint8Array){this.checkSync(),this.k=this.hmacSync(this.v,Uint8Array.from([0]),e),this.v=this.hmacSync(this.v),0!==e.length&&(this.k=this.hmacSync(this.v,Uint8Array.from([1]),e),this.v=this.hmacSync(this.v))}generate(){var e=this;return a(function*(){e.incr();let n=0;const r=[];for(;n<e.qByteLen;){e.v=yield e.hmac(e.v);const s=e.v.slice();r.push(s),n+=e.v.length}return u(...r)})()}generateSync(){this.checkSync(),this.incr();let e=0;const n=[];for(;e<this.qByteLen;){this.v=this.hmacSync(this.v);const r=this.v.slice();n.push(r),e+=this.v.length}return u(...n)}}function Ze(t){return d<t&&t<w.n}function it(t){return d<t&&t<w.P}function ln(t,e,n,r=!0){const{n:s}=w,o=St(t,!0);if(!Ze(o))return;const i=me(o,s),c=h.BASE.multiply(o),f=E(c.x,s);if(f===d)return;const g=E(i*E(e+n*f,s),s);if(g===d)return;let b=new l(f,g),p=(c.x===b.r?0:2)|Number(c.y&C);return r&&b.hasHighS()&&(b=b.normalizeS(),p^=1),{sig:b,recovery:p}}function De(t){let e;if("bigint"==typeof t)e=t;else if("number"==typeof t&&Number.isSafeInteger(t)&&t>0)e=BigInt(t);else if("string"==typeof t){if(64!==t.length)throw new Error("Expected 32 bytes of private key");e=le(t)}else{if(!(t instanceof Uint8Array))throw new TypeError("Expected valid private key");if(32!==t.length)throw new Error("Expected 32 bytes of private key");e=M(t)}if(!Ze(e))throw new Error("Expected private key: 0 < key < n");return e}function _t(t){return t instanceof h?(t.assertValidity(),t):h.fromHex(t)}function un(t){if(t instanceof l)return t.assertValidity(),t;try{return l.fromDER(t)}catch{return l.fromCompact(t)}}function hn(t){const e=t instanceof Uint8Array,n="string"==typeof t,r=(e||n)&&t.length;return e?33===r||65===r:n?66===r||130===r:t instanceof h}function fn(t,e,n=!1){if(hn(t))throw new TypeError("getSharedSecret: first arg must be private key");if(!hn(e))throw new TypeError("getSharedSecret: second arg must be public key");const r=_t(e);return r.assertValidity(),r.multiply(De(t)).toRawBytes(n)}function dn(t){return M(t.length>32?t.slice(0,32):t)}function rr(t){const e=dn(t),n=E(e,w.n);return pn(n<d?e:n)}function pn(t){return V(t)}const or={strict:!0};function ct(t){return E(M(t),w.n)}class Xe{constructor(e,n){this.r=e,this.s=n,this.assertValidity()}static fromHex(e){const n=ie(e);if(64!==n.length)throw new TypeError(`SchnorrSignature.fromHex: expected 64 bytes, not ${n.length}`);const r=M(n.subarray(0,32)),s=M(n.subarray(32,64));return new Xe(r,s)}assertValidity(){const{r:e,s:n}=this;if(!it(e)||!Ze(n))throw new Error("Invalid signature")}toHex(){return k(this.r)+k(this.s)}toRawBytes(){return fe(this.toHex())}}class gn{constructor(e,n,r=oe.randomBytes()){if(null==e)throw new TypeError(`sign: Expected valid message, not "${e}"`);this.m=ie(e);const{x:s,scalar:o}=this.getScalar(De(n));if(this.px=s,this.d=o,this.rand=ie(r),32!==this.rand.length)throw new TypeError("sign: Expected 32 bytes of aux randomness")}getScalar(e){const n=h.fromPrivateKey(e),r=n.hasEvenY()?e:w.n-e;return{point:n,scalar:r,x:n.toRawX()}}initNonce(e,n){return V(e^M(n))}finalizeNonce(e){const n=E(M(e),w.n);if(n===d)throw new Error("sign: Creation of signature failed. k is zero");const{point:r,x:s,scalar:o}=this.getScalar(n);return{R:r,rx:s,k:o}}finalizeSig(e,n,r,s){return new Xe(e.x,E(n+r*s,w.n)).toRawBytes()}error(){throw new Error("sign: Invalid signature produced")}calc(){var e=this;return a(function*(){const{m:n,d:r,px:s,rand:o}=e,i=oe.taggedHash,c=e.initNonce(r,yield i(Te.aux,o)),{R:f,rx:g,k:b}=e.finalizeNonce(yield i(Te.nonce,c,s,n)),p=ct(yield i(Te.challenge,g,s,n)),v=e.finalizeSig(f,b,p,r);return(yield xn(v,n,s))||e.error(),v})()}calcSync(){const{m:e,d:n,px:r,rand:s}=this,o=oe.taggedHashSync,i=this.initNonce(n,o(Te.aux,s)),{R:c,rx:f,k:g}=this.finalizeNonce(o(Te.nonce,i,r,e)),b=ct(o(Te.challenge,f,r,e)),p=this.finalizeSig(c,g,b,n);return vn(p,e,r)||this.error(),p}}function Bt(){return(Bt=a(function*(t,e,n){return new gn(t,e,n).calc()})).apply(this,arguments)}function wn(t,e,n){const r=t instanceof Xe,s=r?t:Xe.fromHex(t);return r&&s.assertValidity(),{...s,m:ie(e),P:_t(n)}}function mn(t,e,n,r){const s=h.BASE.multiplyAndAddUnsafe(e,De(n),E(-r,w.n));return!(!s||!s.hasEvenY()||s.x!==t)}function xn(t,e,n){return Tt.apply(this,arguments)}function Tt(){return(Tt=a(function*(t,e,n){try{const{r,s,m:o,P:i}=wn(t,e,n),c=ct(yield oe.taggedHash(Te.challenge,V(r),i.toRawX(),o));return mn(r,i,s,c)}catch{return!1}})).apply(this,arguments)}function vn(t,e,n){try{const{r,s,m:o,P:i}=wn(t,e,n),c=ct(oe.taggedHashSync(Te.challenge,V(r),i.toRawX(),o));return mn(r,i,s,c)}catch(r){if(r instanceof K)throw r;return!1}}const at={Signature:Xe,getPublicKey:function cr(t){return h.fromPrivateKey(t).toRawX()},sign:function ar(t,e,n){return Bt.apply(this,arguments)},verify:xn,signSync:function lr(t,e,n){return new gn(t,e,n).calcSync()},verifySync:vn};h.BASE._setWindowSize(8);const ge={node:q,web:"object"==typeof self&&"crypto"in self?self.crypto:void 0},Te={challenge:"BIP0340/challenge",aux:"BIP0340/aux",nonce:"BIP0340/nonce"},lt={},oe={bytesToHex:I,hexToBytes:fe,concatBytes:u,mod:E,invert:me,isValidPrivateKey(t){try{return De(t),!0}catch{return!1}},_bigintTo32Bytes:V,_normalizePrivateKey:De,hashToPrivateKey:t=>{if((t=ie(t)).length<40||t.length>1024)throw new Error("Expected valid bytes of private key as per FIPS 186");return V(E(M(t),w.n-C)+C)},randomBytes:(t=32)=>{if(ge.web)return ge.web.getRandomValues(new Uint8Array(t));if(ge.node){const{randomBytes:e}=ge.node;return Uint8Array.from(e(t))}throw new Error("The environment doesn't have randomBytes function")},randomPrivateKey:()=>oe.hashToPrivateKey(oe.randomBytes(40)),precompute(t=8,e=h.BASE){const n=e===h.BASE?e:new h(e.x,e.y);return n._setWindowSize(t),n.multiply(Q),n},sha256:(t=a(function*(...e){if(ge.web){const n=yield ge.web.subtle.digest("SHA-256",u(...e));return new Uint8Array(n)}if(ge.node){const{createHash:n}=ge.node,r=n("sha256");return e.forEach(s=>r.update(s)),Uint8Array.from(r.digest())}throw new Error("The environment doesn't have sha256 function")}),function(){return t.apply(this,arguments)}),hmacSha256:function(){var t=a(function*(e,...n){if(ge.web){const r=yield ge.web.subtle.importKey("raw",e,{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]),s=u(...n),o=yield ge.web.subtle.sign("HMAC",r,s);return new Uint8Array(o)}if(ge.node){const{createHmac:r}=ge.node,s=r("sha256",e);return n.forEach(o=>s.update(o)),Uint8Array.from(s.digest())}throw new Error("The environment doesn't have hmac-sha256 function")});return function(n){return t.apply(this,arguments)}}(),sha256Sync:void 0,hmacSha256Sync:void 0,taggedHash:function(){var t=a(function*(e,...n){let r=lt[e];if(void 0===r){const s=yield oe.sha256(Uint8Array.from(e,o=>o.charCodeAt(0)));r=u(s,s),lt[e]=r}return oe.sha256(r,...n)});return function(n){return t.apply(this,arguments)}}(),taggedHashSync:(t,...e)=>{if("function"!=typeof Ve)throw new K("sha256Sync is undefined, you need to set it");let n=lt[t];if(void 0===n){const r=Ve(Uint8Array.from(t,s=>s.charCodeAt(0)));n=u(r,r),lt[t]=n}return Ve(n,...e)},_JacobianPoint:L};var t;Object.defineProperties(oe,{sha256Sync:{configurable:!1,get:()=>Ve,set(t){Ve||(Ve=t)}},hmacSha256Sync:{configurable:!1,get:()=>Qe,set(t){Qe||(Qe=t)}}});const ut={node:void 0,web:"object"==typeof self&&"crypto"in self?self.crypto:void 0},Lt=t=>new DataView(t.buffer,t.byteOffset,t.byteLength),Ee=(t,e)=>t<<32-e|t>>>e;if(68!==new Uint8Array(new Uint32Array([287454020]).buffer)[0])throw new Error("Non little-endian hardware is not supported");function ht(t){if("string"==typeof t&&(t=function fr(t){if("string"!=typeof t)throw new TypeError("utf8ToBytes expected string, got "+typeof t);return(new TextEncoder).encode(t)}(t)),!(t instanceof Uint8Array))throw new TypeError(`Expected input type is Uint8Array (got ${typeof t})`);return t}function En(t){if(!Number.isSafeInteger(t)||t<0)throw new Error(`Wrong positive integer: ${t}`)}Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0")),(()=>{const t=typeof module<"u"&&"function"==typeof module.require&&module.require.bind(module);try{if(t){const{setImmediate:e}=t("timers")}}catch{}})();class Ut{clone(){return this._cloneInto()}}function yr(t=32){if(ut.web)return ut.web.getRandomValues(new Uint8Array(t));if(ut.node)return new Uint8Array(ut.node.randomBytes(t).buffer);throw new Error("The environment doesn't have randomBytes function")}class wr extends Ut{constructor(e,n,r,s){super(),this.blockLen=e,this.outputLen=n,this.padOffset=r,this.isLE=s,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=Lt(this.buffer)}update(e){if(this.destroyed)throw new Error("instance is destroyed");const{view:n,buffer:r,blockLen:s,finished:o}=this;if(o)throw new Error("digest() was already called");const i=(e=ht(e)).length;for(let c=0;c<i;){const f=Math.min(s-this.pos,i-c);if(f!==s)r.set(e.subarray(c,c+f),this.pos),this.pos+=f,c+=f,this.pos===s&&(this.process(n,0),this.pos=0);else{const g=Lt(e);for(;s<=i-c;c+=s)this.process(g,c)}}return this.length+=e.length,this.roundClean(),this}digestInto(e){if(this.destroyed)throw new Error("instance is destroyed");if(!(e instanceof Uint8Array)||e.length<this.outputLen)throw new Error("_Sha2: Invalid output buffer");if(this.finished)throw new Error("digest() was already called");this.finished=!0;const{buffer:n,view:r,blockLen:s,isLE:o}=this;let{pos:i}=this;n[i++]=128,this.buffer.subarray(i).fill(0),this.padOffset>s-i&&(this.process(r,0),i=0);for(let f=i;f<s;f++)n[f]=0;(function gr(t,e,n,r){if("function"==typeof t.setBigUint64)return t.setBigUint64(e,n,r);const s=BigInt(32),o=BigInt(4294967295),i=Number(n>>s&o),c=Number(n&o),g=r?0:4;t.setUint32(e+(r?4:0),i,r),t.setUint32(e+g,c,r)})(r,s-8,BigInt(8*this.length),o),this.process(r,0);const c=Lt(e);this.get().forEach((f,g)=>c.setUint32(4*g,f,o))}digest(){const{buffer:e,outputLen:n}=this;this.digestInto(e);const r=e.slice(0,n);return this.destroy(),r}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:n,buffer:r,length:s,finished:o,destroyed:i,pos:c}=this;return e.length=s,e.pos=c,e.finished=o,e.destroyed=i,s%n&&e.buffer.set(r),e}}const mr=(t,e,n)=>t&e^~t&n,xr=(t,e,n)=>t&e^t&n^e&n,vr=new Uint32Array([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]),Le=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Ie=new Uint32Array(64);class Er extends wr{constructor(){super(64,32,8,!1),this.A=0|Le[0],this.B=0|Le[1],this.C=0|Le[2],this.D=0|Le[3],this.E=0|Le[4],this.F=0|Le[5],this.G=0|Le[6],this.H=0|Le[7]}get(){const{A:e,B:n,C:r,D:s,E:o,F:i,G:c,H:f}=this;return[e,n,r,s,o,i,c,f]}set(e,n,r,s,o,i,c,f){this.A=0|e,this.B=0|n,this.C=0|r,this.D=0|s,this.E=0|o,this.F=0|i,this.G=0|c,this.H=0|f}process(e,n){for(let p=0;p<16;p++,n+=4)Ie[p]=e.getUint32(n,!1);for(let p=16;p<64;p++){const v=Ie[p-15],T=Ie[p-2],A=Ee(v,7)^Ee(v,18)^v>>>3,U=Ee(T,17)^Ee(T,19)^T>>>10;Ie[p]=U+Ie[p-7]+A+Ie[p-16]|0}let{A:r,B:s,C:o,D:i,E:c,F:f,G:g,H:b}=this;for(let p=0;p<64;p++){const T=b+(Ee(c,6)^Ee(c,11)^Ee(c,25))+mr(c,f,g)+vr[p]+Ie[p]|0,U=(Ee(r,2)^Ee(r,13)^Ee(r,22))+xr(r,s,o)|0;b=g,g=f,f=c,c=i+T|0,i=o,o=s,s=r,r=T+U|0}r=r+this.A|0,s=s+this.B|0,o=o+this.C|0,i=i+this.D|0,c=c+this.E|0,f=f+this.F|0,g=g+this.G|0,b=b+this.H|0,this.set(r,s,o,i,c,f,g,b)}roundClean(){Ie.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const Je=function br(t){const e=r=>t().update(ht(r)).digest(),n=t();return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=()=>t(),e}(()=>new Er);function Me(t){if(!Number.isSafeInteger(t))throw new Error(`Wrong integer: ${t}`)}function xe(...t){const e=(s,o)=>i=>s(o(i));return{encode:Array.from(t).reverse().reduce((s,o)=>s?e(s,o.encode):o.encode,void 0),decode:t.reduce((s,o)=>s?e(s,o.decode):o.decode,void 0)}}function Ae(t){return{encode:e=>{if(!Array.isArray(e)||e.length&&"number"!=typeof e[0])throw new Error("alphabet.encode input should be an array of numbers");return e.map(n=>{if(Me(n),n<0||n>=t.length)throw new Error(`Digit index outside alphabet: ${n} (alphabet: ${t.length})`);return t[n]})},decode:e=>{if(!Array.isArray(e)||e.length&&"string"!=typeof e[0])throw new Error("alphabet.decode input should be array of strings");return e.map(n=>{if("string"!=typeof n)throw new Error(`alphabet.decode: not string element=${n}`);const r=t.indexOf(n);if(-1===r)throw new Error(`Unknown letter: "${n}". Allowed: ${t}`);return r})}}}function ke(t=""){if("string"!=typeof t)throw new Error("join separator should be string");return{encode:e=>{if(!Array.isArray(e)||e.length&&"string"!=typeof e[0])throw new Error("join.encode input should be array of strings");for(let n of e)if("string"!=typeof n)throw new Error(`join.encode: non-string input=${n}`);return e.join(t)},decode:e=>{if("string"!=typeof e)throw new Error("join.decode input should be string");return e.split(t)}}}function et(t,e="="){if(Me(t),"string"!=typeof e)throw new Error("padding chr should be string");return{encode(n){if(!Array.isArray(n)||n.length&&"string"!=typeof n[0])throw new Error("padding.encode input should be array of strings");for(let r of n)if("string"!=typeof r)throw new Error(`padding.encode: non-string input=${r}`);for(;n.length*t%8;)n.push(e);return n},decode(n){if(!Array.isArray(n)||n.length&&"string"!=typeof n[0])throw new Error("padding.encode input should be array of strings");for(let s of n)if("string"!=typeof s)throw new Error(`padding.decode: non-string input=${s}`);let r=n.length;if(r*t%8)throw new Error("Invalid padding: string should have whole number of bytes");for(;r>0&&n[r-1]===e;r--)if(!((r-1)*t%8))throw new Error("Invalid padding: string has too much padding");return n.slice(0,r)}}}function An(t){if("function"!=typeof t)throw new Error("normalize fn should be function");return{encode:e=>e,decode:e=>t(e)}}function kn(t,e,n){if(e<2)throw new Error(`convertRadix: wrong from=${e}, base cannot be less than 2`);if(n<2)throw new Error(`convertRadix: wrong to=${n}, base cannot be less than 2`);if(!Array.isArray(t))throw new Error("convertRadix: data should be array");if(!t.length)return[];let r=0;const s=[],o=Array.from(t);for(o.forEach(i=>{if(Me(i),i<0||i>=e)throw new Error(`Wrong integer: ${i}`)});;){let i=0,c=!0;for(let f=r;f<o.length;f++){const g=o[f],b=e*i+g;if(!Number.isSafeInteger(b)||e*i/e!==i||b-g!=e*i)throw new Error("convertRadix: carry overflow");if(i=b%n,o[f]=Math.floor(b/n),!Number.isSafeInteger(o[f])||o[f]*n+i!==b)throw new Error("convertRadix: carry overflow");c&&(o[f]?c=!1:r=f)}if(s.push(i),c)break}for(let i=0;i<t.length-1&&0===t[i];i++)s.push(0);return s.reverse()}const Sn=(t,e)=>e?Sn(e,t%e):t,ft=(t,e)=>t+(e-Sn(t,e));function Ct(t,e,n,r){if(!Array.isArray(t))throw new Error("convertRadix2: data should be array");if(e<=0||e>32)throw new Error(`convertRadix2: wrong from=${e}`);if(n<=0||n>32)throw new Error(`convertRadix2: wrong to=${n}`);if(ft(e,n)>32)throw new Error(`convertRadix2: carry overflow from=${e} to=${n} carryBits=${ft(e,n)}`);let s=0,o=0;const i=2**n-1,c=[];for(const f of t){if(Me(f),f>=2**e)throw new Error(`convertRadix2: invalid data word=${f} from=${e}`);if(s=s<<e|f,o+e>32)throw new Error(`convertRadix2: carry overflow pos=${o} from=${e}`);for(o+=e;o>=n;o-=n)c.push((s>>o-n&i)>>>0);s&=2**o-1}if(s=s<<n-o&i,!r&&o>=e)throw new Error("Excess padding");if(!r&&s)throw new Error(`Non-zero padding: ${s}`);return r&&o>0&&c.push(s>>>0),c}function He(t,e=!1){if(Me(t),t<=0||t>32)throw new Error("radix2: bits should be in (0..32]");if(ft(8,t)>32||ft(t,8)>32)throw new Error("radix2: carry overflow");return{encode:n=>{if(!(n instanceof Uint8Array))throw new Error("radix2.encode input should be Uint8Array");return Ct(Array.from(n),8,t,!e)},decode:n=>{if(!Array.isArray(n)||n.length&&"number"!=typeof n[0])throw new Error("radix2.decode input should be array of strings");return Uint8Array.from(Ct(n,t,8,e))}}}function Hn(t){if("function"!=typeof t)throw new Error("unsafeWrapper fn should be function");return function(...e){try{return t.apply(null,e)}catch{}}}const Ar=xe(He(4),Ae("0123456789ABCDEF"),ke("")),kr=xe(He(5),Ae("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"),et(5),ke("")),tt=(xe(He(5),Ae("0123456789ABCDEFGHIJKLMNOPQRSTUV"),et(5),ke("")),xe(He(5),Ae("0123456789ABCDEFGHJKMNPQRSTVWXYZ"),ke(""),An(t=>t.toUpperCase().replace(/O/g,"0").replace(/[IL]/g,"1"))),xe(He(6),Ae("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),et(6),ke(""))),Sr=xe(He(6),Ae("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),et(6),ke("")),Ot=t=>xe(function _n(t){return Me(t),{encode:e=>{if(!(e instanceof Uint8Array))throw new Error("radix.encode input should be Uint8Array");return kn(Array.from(e),256,t)},decode:e=>{if(!Array.isArray(e)||e.length&&"number"!=typeof e[0])throw new Error("radix.decode input should be array of strings");return Uint8Array.from(kn(e,t,256))}}}(58),Ae(t),ke("")),dt=Ot("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"),Tn=(Ot("123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"),Ot("rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz"),[0,2,3,5,6,7,9,10,11]),_r={encode(t){let e="";for(let n=0;n<t.length;n+=8){const r=t.subarray(n,n+8);e+=dt.encode(r).padStart(Tn[r.length],"1")}return e},decode(t){let e=[];for(let n=0;n<t.length;n+=11){const r=t.slice(n,n+11),s=Tn.indexOf(r.length),o=dt.decode(r);for(let i=0;i<o.length-s;i++)if(0!==o[i])throw new Error("base58xmr: wrong padding");e=e.concat(Array.from(o.slice(o.length-s)))}return Uint8Array.from(e)}},$t=xe(Ae("qpzry9x8gf2tvdw0s3jn54khce6mua7l"),ke("")),Ln=[996825010,642813549,513874426,1027748829,705979059];function nt(t){const e=t>>25;let n=(33554431&t)<<5;for(let r=0;r<Ln.length;r++)1==(e>>r&1)&&(n^=Ln[r]);return n}function In(t,e,n=1){const r=t.length;let s=1;for(let o=0;o<r;o++){const i=t.charCodeAt(o);if(i<33||i>126)throw new Error(`Invalid prefix (${t})`);s=nt(s)^i>>5}s=nt(s);for(let o=0;o<r;o++)s=nt(s)^31&t.charCodeAt(o);for(let o of e)s=nt(s)^o;for(let o=0;o<6;o++)s=nt(s);return s^=n,$t.encode(Ct([s%2**30],30,5,!1))}function Un(t){const e="bech32"===t?1:734539939,n=He(5),r=n.decode,s=n.encode,o=Hn(r);function c(b,p=90){if("string"!=typeof b)throw new Error("bech32.decode input should be string, not "+typeof b);if(b.length<8||!1!==p&&b.length>p)throw new TypeError(`Wrong string length: ${b.length} (${b}). Expected (8..${p})`);const v=b.toLowerCase();if(b!==v&&b!==b.toUpperCase())throw new Error("String must be lowercase or uppercase");const T=(b=v).lastIndexOf("1");if(0===T||-1===T)throw new Error('Letter "1" must be present between prefix and data only');const A=b.slice(0,T),U=b.slice(T+1);if(U.length<6)throw new Error("Data must be at least 6 characters long");const z=$t.decode(U).slice(0,-6),te=In(A,z,e);if(!U.endsWith(te))throw new Error(`Invalid checksum in ${b}: expected "${te}"`);return{prefix:A,words:z}}return{encode:function i(b,p,v=90){if("string"!=typeof b)throw new Error("bech32.encode prefix should be string, not "+typeof b);if(!Array.isArray(p)||p.length&&"number"!=typeof p[0])throw new Error("bech32.encode words should be array of numbers, not "+typeof p);const T=b.length+7+p.length;if(!1!==v&&T>v)throw new TypeError(`Length ${T} exceeds limit ${v}`);return`${b=b.toLowerCase()}1${$t.encode(p)}${In(b,p,e)}`},decode:c,decodeToBytes:function g(b){const{prefix:p,words:v}=c(b,!1);return{prefix:p,words:v,bytes:r(v)}},decodeUnsafe:Hn(c),fromWords:r,fromWordsUnsafe:o,toWords:s}}const we=Un("bech32"),Br=(Un("bech32m"),{encode:t=>(new TextDecoder).decode(t),decode:t=>(new TextEncoder).encode(t)}),Tr=xe(He(4),Ae("0123456789abcdef"),ke(""),An(t=>{if("string"!=typeof t||t.length%2)throw new TypeError(`hex.decode: expected string, got ${typeof t} with length ${t.length}`);return t.toLowerCase()}));Object.keys({utf8:Br,hex:Tr,base16:Ar,base32:kr,base64:tt,base64url:Sr,base58:dt,base58xmr:_r}).join(", ");var On=ye(3439),Rt=ye(6837);function jt(t){if(!Number.isSafeInteger(t)||t<0)throw new Error(`Wrong positive integer: ${t}`)}function Fe(t,...e){if(!(t instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(e.length>0&&!e.includes(t.length))throw new TypeError(`Expected Uint8Array of length ${e}, not of length=${t.length}`)}const ze={number:jt,bool:function Lr(t){if("boolean"!=typeof t)throw new Error(`Expected boolean, not ${t}`)},bytes:Fe,hash:function Ir(t){if("function"!=typeof t||"function"!=typeof t.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");jt(t.outputLen),jt(t.blockLen)},exists:function Ur(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")},output:function Cr(t,e){Fe(t);const n=e.outputLen;if(t.length<n)throw new Error(`digestInto() expects output buffer of length at least ${n}`)}},Ye=("object"==typeof self&&"crypto"in self&&self,t=>new DataView(t.buffer,t.byteOffset,t.byteLength)),Se=(t,e)=>t<<32-e|t>>>e;if(68!==new Uint8Array(new Uint32Array([287454020]).buffer)[0])throw new Error("Non little-endian hardware is not supported");const Or=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function $n(t){if("string"!=typeof t)throw new TypeError("utf8ToBytes expected string, got "+typeof t);return(new TextEncoder).encode(t)}function pt(t){if("string"==typeof t&&(t=$n(t)),!(t instanceof Uint8Array))throw new TypeError(`Expected input type is Uint8Array (got ${typeof t})`);return t}function bt(...t){if(!t.every(r=>r instanceof Uint8Array))throw new Error("Uint8Array list expected");if(1===t.length)return t[0];const e=t.reduce((r,s)=>r+s.length,0),n=new Uint8Array(e);for(let r=0,s=0;r<t.length;r++){const o=t[r];n.set(o,s),s+=o.length}return n}class Rn{clone(){return this._cloneInto()}}function Ge(t){const e=r=>t().update(pt(r)).digest(),n=t();return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=()=>t(),e}class jn extends Rn{constructor(e,n){super(),this.finished=!1,this.destroyed=!1,ze.hash(e);const r=pt(n);if(this.iHash=e.create(),"function"!=typeof this.iHash.update)throw new TypeError("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const s=this.blockLen,o=new Uint8Array(s);o.set(r.length>s?e.create().update(r).digest():r);for(let i=0;i<o.length;i++)o[i]^=54;this.iHash.update(o),this.oHash=e.create();for(let i=0;i<o.length;i++)o[i]^=106;this.oHash.update(o),o.fill(0)}update(e){return ze.exists(this),this.iHash.update(e),this}digestInto(e){ze.exists(this),ze.bytes(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:n,iHash:r,finished:s,destroyed:o,blockLen:i,outputLen:c}=this;return e.finished=s,e.destroyed=o,e.blockLen=i,e.outputLen=c,e.oHash=n._cloneInto(e.oHash),e.iHash=r._cloneInto(e.iHash),e}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const yt=(t,e,n)=>new jn(t,e).update(n).digest();yt.create=(t,e)=>new jn(t,e);class Pt extends Rn{constructor(e,n,r,s){super(),this.blockLen=e,this.outputLen=n,this.padOffset=r,this.isLE=s,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=Ye(this.buffer)}update(e){ze.exists(this);const{view:n,buffer:r,blockLen:s}=this,o=(e=pt(e)).length;for(let i=0;i<o;){const c=Math.min(s-this.pos,o-i);if(c!==s)r.set(e.subarray(i,i+c),this.pos),this.pos+=c,i+=c,this.pos===s&&(this.process(n,0),this.pos=0);else{const f=Ye(e);for(;s<=o-i;i+=s)this.process(f,i)}}return this.length+=e.length,this.roundClean(),this}digestInto(e){ze.exists(this),ze.output(e,this),this.finished=!0;const{buffer:n,view:r,blockLen:s,isLE:o}=this;let{pos:i}=this;n[i++]=128,this.buffer.subarray(i).fill(0),this.padOffset>s-i&&(this.process(r,0),i=0);for(let p=i;p<s;p++)n[p]=0;(function Pr(t,e,n,r){if("function"==typeof t.setBigUint64)return t.setBigUint64(e,n,r);const s=BigInt(32),o=BigInt(4294967295),i=Number(n>>s&o),c=Number(n&o),g=r?0:4;t.setUint32(e+(r?4:0),i,r),t.setUint32(e+g,c,r)})(r,s-8,BigInt(8*this.length),o),this.process(r,0);const c=Ye(e),f=this.outputLen;if(f%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const g=f/4,b=this.get();if(g>b.length)throw new Error("_sha2: outputLen bigger than state");for(let p=0;p<g;p++)c.setUint32(4*p,b[p],o)}digest(){const{buffer:e,outputLen:n}=this;this.digestInto(e);const r=e.slice(0,n);return this.destroy(),r}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:n,buffer:r,length:s,finished:o,destroyed:i,pos:c}=this;return e.length=s,e.pos=c,e.finished=o,e.destroyed=i,s%n&&e.buffer.set(r),e}}const qr=new Uint8Array([7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8]),Nn=Uint8Array.from({length:16},(t,e)=>e),Dr=Nn.map(t=>(9*t+5)%16);let qt=[Nn],Dt=[Dr];for(let t=0;t<4;t++)for(let e of[qt,Dt])e.push(e[t].map(n=>qr[n]));const Pn=[[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(t=>new Uint8Array(t)),Mr=qt.map((t,e)=>t.map(n=>Pn[e][n])),Fr=Dt.map((t,e)=>t.map(n=>Pn[e][n])),zr=new Uint32Array([0,1518500249,1859775393,2400959708,2840853838]),Gr=new Uint32Array([1352829926,1548603684,1836072691,2053994217,0]),gt=(t,e)=>t<<e|t>>>32-e;function qn(t,e,n,r){return 0===t?e^n^r:1===t?e&n|~e&r:2===t?(e|~n)^r:3===t?e&r|n&~r:e^(n|~r)}const wt=new Uint32Array(16);class Wr extends Pt{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:n,h2:r,h3:s,h4:o}=this;return[e,n,r,s,o]}set(e,n,r,s,o){this.h0=0|e,this.h1=0|n,this.h2=0|r,this.h3=0|s,this.h4=0|o}process(e,n){for(let T=0;T<16;T++,n+=4)wt[T]=e.getUint32(n,!0);let r=0|this.h0,s=r,o=0|this.h1,i=o,c=0|this.h2,f=c,g=0|this.h3,b=g,p=0|this.h4,v=p;for(let T=0;T<5;T++){const A=4-T,U=zr[T],z=Gr[T],te=qt[T],J=Dt[T],N=Mr[T],ae=Fr[T];for(let ne=0;ne<16;ne++){const pe=gt(r+qn(T,o,c,g)+wt[te[ne]]+U,N[ne])+p|0;r=p,p=g,g=0|gt(c,10),c=o,o=pe}for(let ne=0;ne<16;ne++){const pe=gt(s+qn(A,i,f,b)+wt[J[ne]]+z,ae[ne])+v|0;s=v,v=b,b=0|gt(f,10),f=i,i=pe}}this.set(this.h1+c+b|0,this.h2+g+v|0,this.h3+p+s|0,this.h4+r+i|0,this.h0+o+f|0)}roundClean(){wt.fill(0)}destroy(){this.destroyed=!0,this.buffer.fill(0),this.set(0,0,0,0,0)}}const Kr=Ge(()=>new Wr),Vr=(t,e,n)=>t&e^~t&n,Zr=(t,e,n)=>t&e^t&n^e&n,Xr=new Uint32Array([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]),Ue=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Ce=new Uint32Array(64);class Dn extends Pt{constructor(){super(64,32,8,!1),this.A=0|Ue[0],this.B=0|Ue[1],this.C=0|Ue[2],this.D=0|Ue[3],this.E=0|Ue[4],this.F=0|Ue[5],this.G=0|Ue[6],this.H=0|Ue[7]}get(){const{A:e,B:n,C:r,D:s,E:o,F:i,G:c,H:f}=this;return[e,n,r,s,o,i,c,f]}set(e,n,r,s,o,i,c,f){this.A=0|e,this.B=0|n,this.C=0|r,this.D=0|s,this.E=0|o,this.F=0|i,this.G=0|c,this.H=0|f}process(e,n){for(let p=0;p<16;p++,n+=4)Ce[p]=e.getUint32(n,!1);for(let p=16;p<64;p++){const v=Ce[p-15],T=Ce[p-2],A=Se(v,7)^Se(v,18)^v>>>3,U=Se(T,17)^Se(T,19)^T>>>10;Ce[p]=U+Ce[p-7]+A+Ce[p-16]|0}let{A:r,B:s,C:o,D:i,E:c,F:f,G:g,H:b}=this;for(let p=0;p<64;p++){const T=b+(Se(c,6)^Se(c,11)^Se(c,25))+Vr(c,f,g)+Xr[p]+Ce[p]|0,U=(Se(r,2)^Se(r,13)^Se(r,22))+Zr(r,s,o)|0;b=g,g=f,f=c,c=i+T|0,i=o,o=s,s=r,r=T+U|0}r=r+this.A|0,s=s+this.B|0,o=o+this.C|0,i=i+this.D|0,c=c+this.E|0,f=f+this.F|0,g=g+this.G|0,b=b+this.H|0,this.set(r,s,o,i,c,f,g,b)}roundClean(){Ce.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}class Yr extends Dn{constructor(){super(),this.A=-1056596264,this.B=914150663,this.C=812702999,this.D=-150054599,this.E=-4191439,this.F=1750603025,this.G=1694076839,this.H=-1090891868,this.outputLen=28}}const Mt=Ge(()=>new Dn),mt=(Ge(()=>new Yr),BigInt(2**32-1)),Ft=BigInt(32);function Mn(t,e=!1){return e?{h:Number(t&mt),l:Number(t>>Ft&mt)}:{h:0|Number(t>>Ft&mt),l:0|Number(t&mt)}}const re_split=function Qr(t,e=!1){let n=new Uint32Array(t.length),r=new Uint32Array(t.length);for(let s=0;s<t.length;s++){const{h:o,l:i}=Mn(t[s],e);[n[s],r[s]]=[o,i]}return[n,r]},re_shrSH=(t,e,n)=>t>>>n,re_shrSL=(t,e,n)=>t<<32-n|e>>>n,re_rotrSH=(t,e,n)=>t>>>n|e<<32-n,re_rotrSL=(t,e,n)=>t<<32-n|e>>>n,re_rotrBH=(t,e,n)=>t<<64-n|e>>>n-32,re_rotrBL=(t,e,n)=>t>>>n-32|e<<64-n,re_add=function fs(t,e,n,r){const s=(e>>>0)+(r>>>0);return{h:t+n+(s/2**32|0)|0,l:0|s}},re_add3L=(t,e,n)=>(t>>>0)+(e>>>0)+(n>>>0),re_add3H=(t,e,n,r)=>e+n+r+(t/2**32|0)|0,re_add4L=(t,e,n,r)=>(t>>>0)+(e>>>0)+(n>>>0)+(r>>>0),re_add4H=(t,e,n,r,s)=>e+n+r+s+(t/2**32|0)|0,re_add5H=(t,e,n,r,s,o)=>e+n+r+s+o+(t/2**32|0)|0,re_add5L=(t,e,n,r,s)=>(t>>>0)+(e>>>0)+(n>>>0)+(r>>>0)+(s>>>0),[ds,ps]=re_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(t=>BigInt(t))),Oe=new Uint32Array(80),$e=new Uint32Array(80);class xt extends Pt{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){const{Ah:e,Al:n,Bh:r,Bl:s,Ch:o,Cl:i,Dh:c,Dl:f,Eh:g,El:b,Fh:p,Fl:v,Gh:T,Gl:A,Hh:U,Hl:z}=this;return[e,n,r,s,o,i,c,f,g,b,p,v,T,A,U,z]}set(e,n,r,s,o,i,c,f,g,b,p,v,T,A,U,z){this.Ah=0|e,this.Al=0|n,this.Bh=0|r,this.Bl=0|s,this.Ch=0|o,this.Cl=0|i,this.Dh=0|c,this.Dl=0|f,this.Eh=0|g,this.El=0|b,this.Fh=0|p,this.Fl=0|v,this.Gh=0|T,this.Gl=0|A,this.Hh=0|U,this.Hl=0|z}process(e,n){for(let N=0;N<16;N++,n+=4)Oe[N]=e.getUint32(n),$e[N]=e.getUint32(n+=4);for(let N=16;N<80;N++){const ae=0|Oe[N-15],ne=0|$e[N-15],pe=re_rotrSH(ae,ne,1)^re_rotrSH(ae,ne,8)^re_shrSH(ae,ne,7),je=re_rotrSL(ae,ne,1)^re_rotrSL(ae,ne,8)^re_shrSL(ae,ne,7),ve=0|Oe[N-2],ue=0|$e[N-2],Ne=re_rotrSH(ve,ue,19)^re_rotrBH(ve,ue,61)^re_shrSH(ve,ue,6),ot=re_rotrSL(ve,ue,19)^re_rotrBL(ve,ue,61)^re_shrSL(ve,ue,6),Pe=re_add4L(je,ot,$e[N-7],$e[N-16]),on=re_add4H(Pe,pe,Ne,Oe[N-7],Oe[N-16]);Oe[N]=0|on,$e[N]=0|Pe}let{Ah:r,Al:s,Bh:o,Bl:i,Ch:c,Cl:f,Dh:g,Dl:b,Eh:p,El:v,Fh:T,Fl:A,Gh:U,Gl:z,Hh:te,Hl:J}=this;for(let N=0;N<80;N++){const ae=re_rotrSH(p,v,14)^re_rotrSH(p,v,18)^re_rotrBH(p,v,41),ne=re_rotrSL(p,v,14)^re_rotrSL(p,v,18)^re_rotrBL(p,v,41),pe=p&T^~p&U,ve=re_add5L(J,ne,v&A^~v&z,ps[N],$e[N]),ue=re_add5H(ve,te,ae,pe,ds[N],Oe[N]),Ne=0|ve,ot=re_rotrSH(r,s,28)^re_rotrBH(r,s,34)^re_rotrBH(r,s,39),Pe=re_rotrSL(r,s,28)^re_rotrBL(r,s,34)^re_rotrBL(r,s,39),on=r&o^r&c^o&c,ho=s&i^s&f^i&f;te=0|U,J=0|z,U=0|T,z=0|A,T=0|p,A=0|v,({h:p,l:v}=re_add(0|g,0|b,0|ue,0|Ne)),g=0|c,b=0|f,c=0|o,f=0|i,o=0|r,i=0|s;const Jn=re_add3L(Ne,Pe,ho);r=re_add3H(Jn,ue,ot,on),s=0|Jn}({h:r,l:s}=re_add(0|this.Ah,0|this.Al,0|r,0|s)),({h:o,l:i}=re_add(0|this.Bh,0|this.Bl,0|o,0|i)),({h:c,l:f}=re_add(0|this.Ch,0|this.Cl,0|c,0|f)),({h:g,l:b}=re_add(0|this.Dh,0|this.Dl,0|g,0|b)),({h:p,l:v}=re_add(0|this.Eh,0|this.El,0|p,0|v)),({h:T,l:A}=re_add(0|this.Fh,0|this.Fl,0|T,0|A)),({h:U,l:z}=re_add(0|this.Gh,0|this.Gl,0|U,0|z)),({h:te,l:J}=re_add(0|this.Hh,0|this.Hl,0|te,0|J)),this.set(r,s,o,i,c,f,g,b,p,v,T,A,U,z,te,J)}roundClean(){Oe.fill(0),$e.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}class bs extends xt{constructor(){super(),this.Ah=-1942145080,this.Al=424955298,this.Bh=1944164710,this.Bl=-1982016298,this.Ch=502970286,this.Cl=855612546,this.Dh=1738396948,this.Dl=1479516111,this.Eh=258812777,this.El=2077511080,this.Fh=2011393907,this.Fl=79989058,this.Gh=1067287976,this.Gl=1780299464,this.Hh=286451373,this.Hl=-1848208735,this.outputLen=28}}class ys extends xt{constructor(){super(),this.Ah=573645204,this.Al=-64227540,this.Bh=-1621794909,this.Bl=-934517566,this.Ch=596883563,this.Cl=1867755857,this.Dh=-1774684391,this.Dl=1497426621,this.Eh=-1775747358,this.El=-1467023389,this.Fh=-1101128155,this.Fl=1401305490,this.Gh=721525244,this.Gl=746961066,this.Hh=246885852,this.Hl=-2117784414,this.outputLen=32}}class gs extends xt{constructor(){super(),this.Ah=-876896931,this.Al=-1056596264,this.Bh=1654270250,this.Bl=914150663,this.Ch=-1856437926,this.Cl=812702999,this.Dh=355462360,this.Dl=-150054599,this.Eh=1731405415,this.El=-4191439,this.Fh=-1900787065,this.Fl=1750603025,this.Gh=-619958771,this.Gl=1694076839,this.Hh=1203062813,this.Hl=-1090891868,this.outputLen=48}}const Fn=Ge(()=>new xt);Ge(()=>new bs),Ge(()=>new ys),Ge(()=>new gs),oe.hmacSha256Sync=(t,...e)=>yt(Mt,t,oe.concatBytes(...e));const zt=(t=>xe(function Bn(t,e){if(Me(t),"function"!=typeof e)throw new Error("checksum fn should be function");return{encode(n){if(!(n instanceof Uint8Array))throw new Error("checksum.encode: input should be Uint8Array");const r=e(n).slice(0,t),s=new Uint8Array(n.length+t);return s.set(n),s.set(r,n.length),s},decode(n){if(!(n instanceof Uint8Array))throw new Error("checksum.decode: input should be Uint8Array");const r=n.slice(0,-t),s=e(r).slice(0,t),o=n.slice(-t);for(let i=0;i<t;i++)if(s[i]!==o[i])throw new Error("Invalid checksum");return r}}}(4,e=>t(t(e))),dt))(Mt);function zn(t){return BigInt(`0x${function $r(t){if(!(t instanceof Uint8Array))throw new Error("Uint8Array expected");let e="";for(let n=0;n<t.length;n++)e+=Or[t[n]];return e}(t)}`)}const ms=$n("Bitcoin seed"),Gt={private:76066276,public:76067358},Wt=2147483648,vt=t=>{if(!Number.isSafeInteger(t)||t<0||t>2**32-1)throw new Error(`Invalid number=${t}. Should be from 0 to 2 ** 32 - 1`);const e=new Uint8Array(4);return Ye(e).setUint32(0,t,!1),e};class We{constructor(e){if(this.depth=0,this.index=0,this.chainCode=null,this.parentFingerprint=0,!e||"object"!=typeof e)throw new Error("HDKey.constructor must not be called directly");if(this.versions=e.versions||Gt,this.depth=e.depth||0,this.chainCode=e.chainCode,this.index=e.index||0,this.parentFingerprint=e.parentFingerprint||0,!this.depth&&(this.parentFingerprint||this.index))throw new Error("HDKey: zero depth with non-zero index/parent fingerprint");if(e.publicKey&&e.privateKey)throw new Error("HDKey: publicKey and privateKey at same time.");if(e.privateKey){if(!oe.isValidPrivateKey(e.privateKey))throw new Error("Invalid private key");this.privKey="bigint"==typeof e.privateKey?e.privateKey:zn(e.privateKey),this.privKeyBytes=function ws(t){return function Rr(t){if("string"!=typeof t)throw new TypeError("hexToBytes: expected string, got "+typeof t);if(t.length%2)throw new Error("hexToBytes: received invalid unpadded hex");const e=new Uint8Array(t.length/2);for(let n=0;n<e.length;n++){const r=2*n,s=t.slice(r,r+2),o=Number.parseInt(s,16);if(Number.isNaN(o)||o<0)throw new Error("Invalid byte sequence");e[n]=o}return e}(t.toString(16).padStart(64,"0"))}(this.privKey),this.pubKey=function nr(t,e=!1){return h.fromPrivateKey(t).toRawBytes(e)}(e.privateKey,!0)}else{if(!e.publicKey)throw new Error("HDKey: no public or private key provided");this.pubKey=h.fromHex(e.publicKey).toRawBytes(!0)}this.pubHash=(t=>Kr(Mt(this.pubKey)))()}get fingerprint(){if(!this.pubHash)throw new Error("No publicKey set!");return(t=>Ye(this.pubHash).getUint32(0,!1))()}get identifier(){return this.pubHash}get pubKeyHash(){return this.pubHash}get privateKey(){return this.privKeyBytes||null}get publicKey(){return this.pubKey||null}get privateExtendedKey(){const e=this.privateKey;if(!e)throw new Error("No private key");return zt.encode(this.serialize(this.versions.private,bt(new Uint8Array([0]),e)))}get publicExtendedKey(){if(!this.pubKey)throw new Error("No public key");return zt.encode(this.serialize(this.versions.public,this.pubKey))}static fromMasterSeed(e,n=Gt){if(Fe(e),8*e.length<128||8*e.length>512)throw new Error(`HDKey: wrong seed length=${e.length}. Should be between 128 and 512 bits; 256 bits is advised)`);const r=yt(Fn,ms,e);return new We({versions:n,chainCode:r.slice(32),privateKey:r.slice(0,32)})}static fromExtendedKey(e,n=Gt){const r=zt.decode(e),s=Ye(r),o=s.getUint32(0,!1),i={versions:n,depth:r[4],parentFingerprint:s.getUint32(5,!1),index:s.getUint32(9,!1),chainCode:r.slice(13,45)},c=r.slice(45),f=0===c[0];if(o!==n[f?"private":"public"])throw new Error("Version mismatch");return new We(f?{...i,privateKey:c.slice(1)}:{...i,publicKey:c})}static fromJSON(e){return We.fromExtendedKey(e.xpriv)}derive(e){if(!/^[mM]'?/.test(e))throw new Error('Path must start with "m" or "M"');if(/^[mM]'?$/.test(e))return this;const n=e.replace(/^[mM]'?\//,"").split("/");let r=this;for(const s of n){const o=/^(\d+)('?)$/.exec(s);if(!o||3!==o.length)throw new Error(`Invalid child index: ${s}`);let i=+o[1];if(!Number.isSafeInteger(i)||i>=Wt)throw new Error("Invalid index");"'"===o[2]&&(i+=Wt),r=r.deriveChild(i)}return r}deriveChild(e){if(!this.pubKey||!this.chainCode)throw new Error("No publicKey or chainCode set");let n=vt(e);if(e>=Wt){const c=this.privateKey;if(!c)throw new Error("Could not derive hardened child key");n=bt(new Uint8Array([0]),c,n)}else n=bt(this.pubKey,n);const r=yt(Fn,this.chainCode,n),s=zn(r.slice(0,32)),o=r.slice(32);if(!oe.isValidPrivateKey(s))throw new Error("Tweak bigger than curve order");const i={versions:this.versions,chainCode:o,depth:this.depth+1,parentFingerprint:this.fingerprint,index:e};try{if(this.privateKey){const c=oe.mod(this.privKey+s,w.n);if(!oe.isValidPrivateKey(c))throw new Error("The tweak was out of range or the resulted private key is invalid");i.privateKey=c}else{const c=h.fromHex(this.pubKey).add(h.fromPrivateKey(s));if(c.equals(h.ZERO))throw new Error("The tweak was equal to negative P, which made the result key invalid");i.publicKey=c.toRawBytes(!0)}return new We(i)}catch{return this.deriveChild(e+1)}}sign(e){if(!this.privateKey)throw new Error("No privateKey set!");return Fe(e,32),function sr(t,e,n={}){const{seed:r,m:s,d:o}=function bn(t,e,n){if(null==t)throw new Error(`sign: expected valid message hash, not "${t}"`);const r=ie(t),s=De(e),o=[pn(s),rr(r)];if(null!=n){!0===n&&(n=oe.randomBytes(32));const f=ie(n);if(32!==f.length)throw new Error("sign: Expected 32 bytes of extra data");o.push(f)}return{seed:u(...o),m:dn(r),d:s}}(t,e,n.extraEntropy),i=new an(32,32);let c;for(i.reseedSync(r);!(c=ln(i.generateSync(),s,o,n.canonical));)i.reseedSync();return function yn(t,e){const{sig:n,recovery:r}=t,{der:s,recovered:o}=Object.assign({canonical:!0,der:!0},e),i=s?n.toDERRawBytes():n.toCompactRawBytes();return o?[i,r]:i}(c,n)}(e,this.privKey,{canonical:!0,der:!1})}verify(e,n){if(Fe(e,32),Fe(n,64),!this.publicKey)throw new Error("No publicKey set!");let r;try{r=l.fromCompact(n)}catch{return!1}return function ir(t,e,n,r=or){let s;try{s=un(t),e=ie(e)}catch{return!1}const{r:o,s:i}=s;if(r.strict&&s.hasHighS())return!1;const c=St(e);let f;try{f=_t(n)}catch{return!1}const{n:g}=w,b=me(i,g),p=E(c*b,g),v=E(o*b,g),T=h.BASE.multiplyAndAddUnsafe(f,p,v);return!!T&&E(T.x,g)===o}(r,e,this.publicKey)}wipePrivateData(){return this.privKey=void 0,this.privKeyBytes&&(this.privKeyBytes.fill(0),this.privKeyBytes=void 0),this}toJSON(){return{xpriv:this.privateExtendedKey,xpub:this.publicExtendedKey}}serialize(e,n){if(!this.chainCode)throw new Error("No chainCode set");return Fe(n,33),bt(vt(e),new Uint8Array([this.depth]),vt(this.parentFingerprint),vt(this.index),this.chainCode,n)}}class Gn extends Ut{constructor(e,n){super(),this.finished=!1,this.destroyed=!1,function dr(t){if("function"!=typeof t||"function"!=typeof t.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");En(t.outputLen),En(t.blockLen)}(e);const r=ht(n);if(this.iHash=e.create(),!(this.iHash instanceof Ut))throw new TypeError("Expected instance of class which extends utils.Hash");const s=this.blockLen=this.iHash.blockLen;this.outputLen=this.iHash.outputLen;const o=new Uint8Array(s);o.set(r.length>this.iHash.blockLen?e.create().update(r).digest():r);for(let i=0;i<o.length;i++)o[i]^=54;this.iHash.update(o),this.oHash=e.create();for(let i=0;i<o.length;i++)o[i]^=106;this.oHash.update(o),o.fill(0)}update(e){if(this.destroyed)throw new Error("instance is destroyed");return this.iHash.update(e),this}digestInto(e){if(this.destroyed)throw new Error("instance is destroyed");if(!(e instanceof Uint8Array)||e.length!==this.outputLen)throw new Error("HMAC: Invalid output buffer");if(this.finished)throw new Error("digest() was already called");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:n,iHash:r,finished:s,destroyed:o,blockLen:i,outputLen:c}=this;return e.finished=s,e.destroyed=o,e.blockLen=i,e.outputLen=c,e.oHash=n._cloneInto(e.oHash),e.iHash=r._cloneInto(e.iHash),e}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const Wn=(t,e,n)=>new Gn(t,e).update(n).digest();Wn.create=(t,e)=>new Gn(t,e);var Es=Object.defineProperty,Re=(t,e)=>{for(var n in e)Es(t,n,{get:e[n],enumerable:!0})};function Kn(t){return oe.bytesToHex(at.getPublicKey(t))}Re({},{insertEventIntoAscendingList:()=>Ss,insertEventIntoDescendingList:()=>ks,normalizeURL:()=>Et,utf8Decoder:()=>Ke,utf8Encoder:()=>Be});var Ke=new TextDecoder("utf-8"),Be=new TextEncoder;function Et(t){let e=new URL(t);return e.pathname=e.pathname.replace(/\/+/g,"/"),e.pathname.endsWith("/")&&(e.pathname=e.pathname.slice(0,-1)),("80"===e.port&&"ws:"===e.protocol||"443"===e.port&&"wss:"===e.protocol)&&(e.port=""),e.searchParams.sort(),e.hash="",e.toString()}function ks(t,e){let s,n=0,r=t.length-1,o=n;if(r<0)o=0;else if(e.created_at<t[r].created_at)o=r+1;else if(e.created_at>=t[n].created_at)o=n;else for(;;){if(r<=n+1){o=r;break}if(s=Math.floor(n+(r-n)/2),t[s].created_at>e.created_at)n=s;else{if(!(t[s].created_at<e.created_at)){o=s;break}r=s}}return t[o]?.id!==e.id?[...t.slice(0,o),e,...t.slice(o)]:t}function Ss(t,e){let s,n=0,r=t.length-1,o=n;if(r<0)o=0;else if(e.created_at>t[r].created_at)o=r+1;else if(e.created_at<=t[n].created_at)o=n;else for(;;){if(r<=n+1){o=r;break}if(s=Math.floor(n+(r-n)/2),t[s].created_at<e.created_at)n=s;else{if(!(t[s].created_at>e.created_at)){o=s;break}r=s}}return t[o]?.id!==e.id?[...t.slice(0,o),e,...t.slice(o)]:t}var kt,Kt=(t=>(t[t.Metadata=0]="Metadata",t[t.Text=1]="Text",t[t.RecommendRelay=2]="RecommendRelay",t[t.Contacts=3]="Contacts",t[t.EncryptedDirectMessage=4]="EncryptedDirectMessage",t[t.EventDeletion=5]="EventDeletion",t[t.Reaction=7]="Reaction",t[t.ChannelCreation=40]="ChannelCreation",t[t.ChannelMetadata=41]="ChannelMetadata",t[t.ChannelMessage=42]="ChannelMessage",t[t.ChannelHideMessage=43]="ChannelHideMessage",t[t.ChannelMuteUser=44]="ChannelMuteUser",t[t.Report=1984]="Report",t[t.ZapRequest=9734]="ZapRequest",t[t.Zap=9735]="Zap",t[t.RelayList=10002]="RelayList",t[t.ClientAuth=22242]="ClientAuth",t[t.Article=30023]="Article",t))(Kt||{});function Zt(t){if("object"!=typeof t||"string"!=typeof t.content||"number"!=typeof t.created_at||"string"!=typeof t.pubkey||!t.pubkey.match(/^[a-f0-9]{64}$/)||!Array.isArray(t.tags))return!1;for(let e=0;e<t.tags.length;e++){let n=t.tags[e];if(!Array.isArray(n))return!1;for(let r=0;r<n.length;r++)if("object"==typeof n[r])return!1}return!0}function Vn(t){return at.verifySync(t.sig,function Vt(t){let e=Je(Be.encode(function _s(t){if(!Zt(t))throw new Error("can't serialize event with wrong or missing properties");return JSON.stringify([0,t.pubkey,t.created_at,t.kind,t.tags,t.content])}(t)));return oe.bytesToHex(e)}(t),t.pubkey)}function Bs(t,e){if(t.ids&&-1===t.ids.indexOf(e.id)||t.kinds&&-1===t.kinds.indexOf(e.kind)||t.authors&&-1===t.authors.indexOf(e.pubkey))return!1;for(let n in t)if("#"===n[0]){let s=t[`#${n.slice(1)}`];if(s&&!e.tags.find(([o,i])=>o===n.slice(1)&&-1!==s.indexOf(i)))return!1}return!(t.since&&e.created_at<t.since||t.until&&e.created_at>=t.until)}function Ts(t,e){for(let n=0;n<t.length;n++)if(Bs(t[n],e))return!0;return!1}function At(t,e){let n=e.length+3,r=t.indexOf(`"${e}":`)+n,s=t.slice(r).indexOf('"')+r+1;return t.slice(s,s+64)}function Zn(t,e){let n=e.length,r=t.indexOf(`"${e}":`)+n+3,s=t.slice(r),o=Math.min(s.indexOf(","),s.indexOf("}"));return parseInt(s.slice(0,o),10)}function Xn(t){let e=t.slice(0,22).indexOf('"EVENT"');if(-1===e)return null;let n=t.slice(e+7+1).indexOf('"');if(-1===n)return null;let r=e+7+1+n,s=t.slice(r+1,80).indexOf('"');return-1===s?null:t.slice(r+1,r+1+s)}function Is(t,e){return e===At(t,"id")}function Us(t,e){return e===At(t,"pubkey")}function Cs(t,e){return e===Zn(t,"kind")}function Rs(t,e,n){return Xt.apply(this,arguments)}function Xt(){return Xt=a(function*(t,e,n){const s=Qn(fn(t,"02"+e));let o=Uint8Array.from(yr(16)),i=Be.encode(n),c=yield crypto.subtle.importKey("raw",s,{name:"AES-CBC"},!1,["encrypt"]),f=yield crypto.subtle.encrypt({name:"AES-CBC",iv:o},c,i);return`${tt.encode(new Uint8Array(f))}?iv=${tt.encode(new Uint8Array(o.buffer))}`}),Xt.apply(this,arguments)}function js(t,e,n){return Yt.apply(this,arguments)}function Yt(){return Yt=a(function*(t,e,n){let[r,s]=n.split("?iv="),i=Qn(fn(t,"02"+e)),c=yield crypto.subtle.importKey("raw",i,{name:"AES-CBC"},!1,["decrypt"]),f=tt.decode(r),g=tt.decode(s),b=yield crypto.subtle.decrypt({name:"AES-CBC",iv:g},c,f);return Ke.decode(b)}),Yt.apply(this,arguments)}function Qn(t){return t.slice(1,33)}Re({},{getHex64:()=>At,getInt:()=>Zn,getSubscriptionId:()=>Xn,matchEventId:()=>Is,matchEventKind:()=>Cs,matchEventPubkey:()=>Us}),Re({},{decrypt:()=>js,encrypt:()=>Rs}),Re({},{queryProfile:()=>Ds,searchDomain:()=>qs,useFetchImplementation:()=>Ps});try{kt=fetch}catch{}function Ps(t){kt=t}function qs(t){return Qt.apply(this,arguments)}function Qt(){return Qt=a(function*(t,e=""){try{return(yield(yield kt(`https://${t}/.well-known/nostr.json?name=${e}`)).json()).names}catch{return{}}}),Qt.apply(this,arguments)}function Ds(t){return Jt.apply(this,arguments)}function Jt(){return Jt=a(function*(t){let[e,n]=t.split("@");if(n||(n=e,e="_"),!e.match(/^[A-Za-z0-9-_]+$/))return null;let r=yield(yield kt(`https://${n}/.well-known/nostr.json?name=${e}`)).json();if(!r?.names?.[e])return null;let s=r.names[e];return{pubkey:s,relays:r.relays?.[s]||[]}}),Jt.apply(this,arguments)}function Fs(t,e){let r=We.fromMasterSeed((0,Rt.Z1)(t,e)).derive("m/44'/1237'/0'/0/0").privateKey;if(!r)throw new Error("could not derive private key");return oe.bytesToHex(r)}function zs(){return(0,Rt.OF)(On.U)}function Gs(t){return(0,Rt._I)(t,On.U)}Re({},{generateSeedWords:()=>zs,privateKeyFromSeedWords:()=>Fs,validateWords:()=>Gs}),Re({},{decode:()=>Ks,naddrEncode:()=>Js,neventEncode:()=>Qs,noteEncode:()=>Xs,nprofileEncode:()=>Ys,npubEncode:()=>Zs,nsecEncode:()=>Vs});var rn,st=5e3;function Ks(t){let{prefix:e,words:n}=we.decode(t,st),r=new Uint8Array(we.fromWords(n));switch(e){case"nprofile":{let s=en(r);if(!s[0]?.[0])throw new Error("missing TLV 0 for nprofile");if(32!==s[0][0].length)throw new Error("TLV 0 should be 32 bytes");return{type:"nprofile",data:{pubkey:oe.bytesToHex(s[0][0]),relays:s[1].map(o=>Ke.decode(o))}}}case"nevent":{let s=en(r);if(!s[0]?.[0])throw new Error("missing TLV 0 for nevent");if(32!==s[0][0].length)throw new Error("TLV 0 should be 32 bytes");return{type:"nevent",data:{id:oe.bytesToHex(s[0][0]),relays:s[1].map(o=>Ke.decode(o))}}}case"naddr":{let s=en(r);if(!s[0]?.[0])throw new Error("missing TLV 0 for naddr");if(!s[2]?.[0])throw new Error("missing TLV 2 for naddr");if(32!==s[2][0].length)throw new Error("TLV 2 should be 32 bytes");if(!s[3]?.[0])throw new Error("missing TLV 3 for naddr");if(4!==s[3][0].length)throw new Error("TLV 3 should be 4 bytes");return{type:"naddr",data:{identifier:Ke.decode(s[0][0]),pubkey:oe.bytesToHex(s[2][0]),kind:parseInt(oe.bytesToHex(s[3][0]),16),relays:s[1].map(o=>Ke.decode(o))}}}case"nsec":case"npub":case"note":return{type:e,data:oe.bytesToHex(r)};default:throw new Error(`unknown prefix ${e}`)}}function en(t){let e={},n=t;for(;n.length>0;){let r=n[0],s=n[1],o=n.slice(2,2+s);n=n.slice(2+s),!(o.length<s)&&(e[r]=e[r]||[],e[r].push(o))}return e}function Vs(t){return tn("nsec",t)}function Zs(t){return tn("npub",t)}function Xs(t){return tn("note",t)}function tn(t,e){let n=oe.hexToBytes(e),r=we.toWords(n);return we.encode(t,r,st)}function Ys(t){let e=nn({0:[oe.hexToBytes(t.pubkey)],1:(t.relays||[]).map(r=>Be.encode(r))}),n=we.toWords(e);return we.encode("nprofile",n,st)}function Qs(t){let e=nn({0:[oe.hexToBytes(t.id)],1:(t.relays||[]).map(r=>Be.encode(r))}),n=we.toWords(e);return we.encode("nevent",n,st)}function Js(t){let e=new ArrayBuffer(4);new DataView(e).setUint32(0,t.kind,!1);let n=nn({0:[Be.encode(t.identifier)],1:(t.relays||[]).map(s=>Be.encode(s)),2:[oe.hexToBytes(t.pubkey)],3:[new Uint8Array(e)]}),r=we.toWords(n);return we.encode("naddr",r,st)}function nn(t){let e=[];return Object.entries(t).forEach(([n,r])=>{r.forEach(s=>{let o=new Uint8Array(s.length+2);o.set([parseInt(n)],0),o.set([s.length],1),o.set(s,2),e.push(o)})}),oe.concatBytes(...e)}function to(t,e){let n=[];(e.kind||-1)>=0&&n.push(`kind=${e.kind}`),e.until&&n.push(`created_at<${e.until}`),e.since&&n.push(`created_at>${e.since}`);let r=n.join("&");if(""===r)throw new Error("refusing to create a delegation without any conditions");let s=Je(Be.encode(`nostr:delegation:${e.pubkey}:${r}`)),o=oe.bytesToHex(at.signSync(s,t));return{from:Kn(t),to:e.pubkey,cond:r,sig:o}}function no(t){let e=t.tags.find(c=>"delegation"===c[0]&&c.length>=4);if(!e)return null;let n=e[1],r=e[2],s=e[3],o=r.split("&");for(let c=0;c<o.length;c++){let[f,g,b]=o[c].split(/\b/);if("kind"!==f||"="!==g||t.kind!==parseInt(b)){if("created_at"===f&&"<"===g&&t.created_at<parseInt(b))continue;if("created_at"===f&&">"===g&&t.created_at>parseInt(b))continue;return null}}let i=Je(Be.encode(`nostr:delegation:${t.pubkey}:${r}`));return at.verifySync(s,i,n)?n:null}Re({},{createDelegation:()=>to,getDelegator:()=>no}),Re({},{getZapEndpoint:()=>oo,makeZapReceipt:()=>ao,makeZapRequest:()=>io,useFetchImplementation:()=>so,validateZapRequest:()=>co});try{rn=fetch}catch{}function so(t){rn=t}function oo(t){return sn.apply(this,arguments)}function sn(){return sn=a(function*(t){try{let e="",{lud06:n,lud16:r}=JSON.parse(t.content);if(n){let{words:i}=we.decode(n,1e3),c=we.fromWords(i);e=Ke.decode(c)}else{if(!r)return null;{let[i,c]=r.split("@");e=`https://${c}/.well-known/lnurlp/${i}`}}let o=yield(yield rn(e)).json();if(o.allowsNostr&&o.nostrPubkey)return o.callback}catch{}return null}),sn.apply(this,arguments)}function io({profile:t,event:e,amount:n,relays:r,comment:s=""}){if(!n)throw new Error("amount not given");if(!t)throw new Error("profile not given");let o={kind:9734,created_at:Math.round(Date.now()/1e3),content:s,tags:[["p",t],["amount",n.toString()],["relays",...r]]};return e&&o.tags.push(["e",e]),o}function co(t){let e;try{e=JSON.parse(t)}catch{return"Invalid zap request JSON."}if(!Zt(e))return"Zap request is not a valid Nostr event.";if(!Vn(e))return"Invalid signature on zap request.";let n=e.tags.find(([o,i])=>"p"===o&&i);if(!n)return"Zap request doesn't have a 'p' tag.";if(!n[1].match(/^[a-f0-9]{64}$/))return"Zap request 'p' tag is not valid hex.";let r=e.tags.find(([o,i])=>"e"===o&&i);return r&&!r[1].match(/^[a-f0-9]{64}$/)?"Zap request 'e' tag is not valid hex.":e.tags.find(([o,i])=>"relays"===o&&i)?null:"Zap request doesn't have a 'relays' tag."}function ao({zapRequest:t,preimage:e,bolt11:n,paidAt:r}){let o=JSON.parse(t).tags.filter(([c])=>"e"===c||"p"===c||"a"===c),i={kind:9735,created_at:Math.round(r.getTime()/1e3),content:"",tags:[...o,["bolt11",n],["description",t]]};return e&&i.tags.push(["preimage",e]),i}oe.hmacSha256Sync=(t,...e)=>Wn(Je,t,oe.concatBytes(...e)),oe.sha256Sync=(...t)=>Je(oe.concatBytes(...t));class lo{constructor(){this.queues={profile:{active:!1,jobs:[]},event:{active:!1,jobs:[]},article:{active:!1,jobs:[]},contacts:{active:!1,jobs:[]},subscriptions:{active:!1,jobs:[]}}}enqueProfile(e){this.queues.profile.jobs.push({identifier:e,type:"Profile"})}enqueEvent(e){this.queues.event.jobs.push({identifier:e,type:"Event"})}enqueContacts(e){this.queues.contacts.jobs.push({identifier:e,type:"Contacts"})}enque(e,n){"Profile"===n?this.enqueProfile(e):"Event"===n?this.enqueEvent(e):"Contacts"===n&&this.enqueContacts(e)}}class uo{constructor(e){this.url=e,this.subscriptions=[],this.queue=new lo}publish(e){var n=this;return a(function*(){if(e.kind==Kt.Article){if(!n.relay.nip11)return void console.log(`${n.relay.url}: This relay does not return NIP-11 metadata. Article will not be published here.`);if(!n.relay.nip11.supported_nips.includes(33))return void console.log(`${n.relay.url}: This relay does not NIP-23. Article will not be published here.`);console.log(`${n.relay.url}: This relay supports NIP-23. Publishing article on this relay.`)}let r=n.relay.publish(e);r.on("ok",()=>{console.log(`${n.relay.url} has accepted our event`)}),r.on("failed",s=>{console.log(`failed to publish to ${n.relay.url}: ${s}`)})})()}enque(e){if("Profile"==e.type)this.queue.queues.profile.jobs.push(e);else if("Contacts"==e.type)this.queue.queues.contacts.jobs.push(e);else if("Event"==e.type)this.queue.queues.event.jobs.push(e);else{if("Article"!=e.type)throw Error(`This type of job (${e.type}) is currently not supported.`);this.queue.queues.article.jobs.push(e)}console.log(`${this.url}: Job enqued...processing...`),setTimeout(()=>{this.process()},500)}process(){this.processArticle(),this.processProfiles(),this.processContacts(),this.processEvents(),this.processSubscriptions()}processSubscriptions(){if(this.relay&&1==this.relay.status&&0!=this.queue.queues.subscriptions.jobs.length)for(;this.queue.queues.subscriptions.jobs.length;){const e=this.queue.queues.subscriptions.jobs.shift();e&&this.subscribe(e.filters,e.id)}}processProfiles(){if(!this.relay||1!=this.relay.status||this.queue.queues.profile.active)return void console.log(`${this.url}: processProfiles: Relay not ready or currently active: ${this.queue.queues.profile.active}.`,this.relay);if(0==this.queue.queues.profile.jobs.length)return void(this.queue.queues.profile.active=!1);this.queue.queues.profile.active=!0;const e=this.queue.queues.profile.jobs.splice(0,500).map(n=>n.identifier).filter((n,r,s)=>s.indexOf(n)===r);this.downloadProfile(e,3*e.length)}processContacts(){if(!this.relay||1!=this.relay.status||this.queue.queues.contacts.active)return;if(0==this.queue.queues.contacts.jobs.length)return void(this.queue.queues.contacts.active=!1);this.queue.queues.contacts.active=!0;const e=this.queue.queues.contacts.jobs.shift();this.downloadContacts(e.identifier,()=>{this.queue.queues.contacts.active=!1,this.processContacts()})}processEvents(){if(!this.relay||1!=this.relay.status||this.queue.queues.event.active)return void console.log(`${this.url}: processEvents: Relay not ready or currently active: ${this.queue.queues.event.active}.`,this.relay);if(console.log(`${this.url}: processEvents: Processing with downloading... Count: `+this.queue.queues.event.jobs.length),0==this.queue.queues.event.jobs.length)return void(this.queue.queues.event.active=!1);this.queue.queues.event.active=!0,console.log(this.relay);const e=this.queue.queues.event.jobs.splice(0,500).map(n=>n.identifier).filter((n,r,s)=>s.indexOf(n)===r);console.log("eventsToDownload:",e),this.downloadEvent(e,3*e.length)}processArticle(){if(!this.relay||1!=this.relay.status||this.queue.queues.article.active)return void console.log(`${this.url}: processArticle: Relay not ready or currently active: ${this.queue.queues.article.active}.`,this.relay);if(console.log(`${this.url}: processArticle: Processing with downloading... Count: `+this.queue.queues.article.jobs.length),0==this.queue.queues.article.jobs.length)return void(this.queue.queues.article.active=!1);this.queue.queues.article.active=!0,console.log(this.relay);const e=this.queue.queues.article.jobs.splice(0,500).map(n=>n.identifier).filter((n,r,s)=>s.indexOf(n)===r);console.log("articleToDownload:",e),this.downloadArticle(e,3*e.length)}connect(e){var n=this;return a(function*(){const r=function Yn(t){var e,n,r={},s={connect:[],disconnect:[],error:[],notice:[]},o={},i={};function c(){return f.apply(this,arguments)}function f(){return(f=a(function*(){return new Promise((A,U)=>{(e=new WebSocket(t)).onopen=()=>{s.connect.forEach(N=>N()),A()},e.onerror=()=>{s.error.forEach(N=>N()),U()},e.onclose=a(function*(){s.disconnect.forEach(N=>N()),n&&n()});let te,z=[];function J(){if(0===z.length)return clearInterval(te),void(te=null);var N=z.shift();if(!N)return;let ae=Xn(N);if(ae){let ne=r[ae];if(ne&&ne.alreadyHaveEvent&&ne.alreadyHaveEvent(At(N,"id"),t))return}try{let ne=JSON.parse(N);switch(ne[0]){case"EVENT":let pe=ne[1],je=ne[2];return void(Zt(je)&&r[pe]&&(r[pe].skipVerification||Vn(je))&&Ts(r[pe].filters,je)&&(o[pe]?.event||[]).forEach(ue=>ue(je)));case"EOSE":{let ue=ne[1];return void(ue in o&&(o[ue].eose.forEach(Ne=>Ne()),o[ue].eose=[]))}case"OK":{let ue=ne[1],ot=ne[3]||"";return void(ue in i&&(ne[2]?i[ue].ok.forEach(Pe=>Pe()):i[ue].failed.forEach(Pe=>Pe(ot)),i[ue].ok=[],i[ue].failed=[]))}case"NOTICE":let ve=ne[1];return void s.notice.forEach(ue=>ue(ve))}}catch{return}}e.onmessage=N=>{z.push(N.data),te||(te=setInterval(J,0))}})})).apply(this,arguments)}function b(){return(b=a(function*(){e?.readyState&&1===e.readyState||(yield c())})).apply(this,arguments)}function p(A){return v.apply(this,arguments)}function v(){return(v=a(function*(A){let U=JSON.stringify(A);try{e.send(U)}catch(z){console.log(z)}})).apply(this,arguments)}const T=(A,{skipVerification:U=!1,alreadyHaveEvent:z=null,id:te=Math.random().toString().slice(2)}={})=>{let J=te;return r[J]={id:J,filters:A,skipVerification:U,alreadyHaveEvent:z},p(["REQ",J,...A]),{sub:(N,ae={})=>T(N||A,{skipVerification:ae.skipVerification||U,alreadyHaveEvent:ae.alreadyHaveEvent||z,id:J}),unsub:()=>{delete r[J],delete o[J],p(["CLOSE",J])},on:(N,ae)=>{o[J]=o[J]||{event:[],eose:[]},o[J][N].push(ae)},off:(N,ae)=>{let ne=o[J],pe=ne[N].indexOf(ae);pe>=0&&ne[N].splice(pe,1)}}};return{url:t,sub:T,on:(A,U)=>{s[A].push(U),"connect"===A&&1===e?.readyState&&U()},off:(A,U)=>{let z=s[A].indexOf(U);-1!==z&&s[A].splice(z,1)},list:(A,U)=>new Promise(z=>{let te=T(A,U),J=[],N=setTimeout(()=>{te.unsub(),z(J)},1500);te.on("eose",()=>{te.unsub(),clearTimeout(N),z(J)}),te.on("event",ae=>{J.push(ae)})}),get:(A,U)=>new Promise(z=>{let te=T([A],U),J=setTimeout(()=>{te.unsub(),z(null)},1500);te.on("event",N=>{te.unsub(),clearTimeout(J),z(N)})}),publish(A){if(!A.id)throw new Error(`event ${A} has no id`);let U=A.id;return p(["EVENT",A]),{on:(z,te)=>{i[U]=i[U]||{ok:[],failed:[]},i[U][z].push(te)},off:(z,te)=>{let J=i[U];if(!J)return;let N=J[z].indexOf(te);N>=0&&J[z].splice(N,1)}}},connect:function g(){return b.apply(this,arguments)},close:()=>(s={connect:[],disconnect:[],error:[],notice:[]},o={},i={},e.readyState>1?Promise.resolve():(e.close(),new Promise(A=>{n=A}))),get status(){return e?.readyState??3}}}(n.url);n.relay=r,r.on("connect",a(function*(){console.log(`${n.url}: Connected.`),postMessage({type:"status",data:1,url:r.url}),e?(yield n.publish(e),n.disconnect(),postMessage({type:"terminated",url:n.url})):n.process()})),r.on("disconnect",()=>{console.log(`${n.url}: DISCONNECTED!`),n.subscriptions=[],postMessage({type:"status",data:0,url:r.url})}),r.on("notice",s=>{console.log(`${n.url}: NOTICE: ${s}`),postMessage({type:"notice",data:s,url:r.url})});try{yield r.connect()}catch{postMessage({type:"error",relay:n.url,error:"Unable to connect."}),console.error("Unable to connect.")}})()}disconnect(){1==this.relay.status&&(console.log(`${this.url}: relay.status: ${this.relay.status}, calling close!`),this.relay.close())}unsubscribe(e){const n=this.subscriptions.findIndex(s=>s.id===e);if(-1==n)return;const r=this.subscriptions[n];this.subscriptions.splice(n,1),r.sub?.unsub(),console.log("Unsubscribed: ",e)}clearProfileSub(){this.profileSub?.unsub(),this.profileSub=void 0}clearContactsSub(){this.contactsSub?.unsub(),this.contactsSub=void 0}clearEventSub(){this.eventSub?.unsub(),this.eventSub=void 0}clearArticleSub(){this.articleSub?.unsub(),this.articleTimer=void 0}downloadProfile(e,n=12){if(console.log("DOWNLOAD PROFILE...."),!this.relay)return void console.warn("This relay does not have active connection and download cannot be executed at this time.");this.profileSub&&(console.log("Profile sub already existed, unsub before continue."),this.clearProfileSub());const s=this.relay.sub([{kinds:[0],authors:e}]);this.profileSub=s,s.on("event",o=>{console.log("POST MESSAGE BACK TO MAIN"),postMessage({url:this.url,type:"event",data:o}),console.log("FINISHED POST MESSAGE BACK TO MAIN")}),s.on("eose",()=>{console.log("eose on profile, profile likely not found."),clearTimeout(this.profileTimer),this.clearProfileSub(),this.queue.queues.profile.active=!1,this.processProfiles()}),console.log("REGISTER TIMEOUT!!",1e3*n),this.profileTimer=setTimeout(()=>{console.warn(`${this.url}: Profile download timeout reached.`),this.clearProfileSub(),this.queue.queues.profile.active=!1,this.processProfiles(),postMessage({url:this.url,type:"timeout",data:{type:"Profile",identifier:e}})},1e3*n)}downloadContacts(e,n,r=3e3){console.log("DOWNLOAD CONTACTS....");let s=!1;if(!this.relay)return void console.warn("This relay does not have active connection and download cannot be executed at this time.");this.contactsSub&&this.clearContactsSub();const o=this.relay.sub([{kinds:[3],authors:[e]}]);this.contactsSub=o,o.on("event",i=>{postMessage({url:this.url,type:"event",data:i}),this.clearContactsSub(),clearTimeout(this.contactsTimer),s||(s=!0,n())}),this.contactsTimer=setTimeout(()=>{this.clearContactsSub(),s||(s=!0,n())},1e3*r)}downloadArticle(e,n=12){if(console.log("DOWNLOAD ARTICLE...."),!this.relay)return void console.warn("This relay does not have active connection and download cannot be executed at this time.");this.articleSub&&(console.log("Article sub already existed, unsub before continue."),this.clearArticleSub());const o=this.relay.sub([{kinds:[Kt.Article],authors:e}]);this.articleSub=o,o.on("event",i=>{console.log("POST MESSAGE BACK TO MAIN"),postMessage({url:this.url,type:"event",data:i}),console.log("FINISHED POST MESSAGE BACK TO MAIN")}),o.on("eose",()=>{console.log("eose on event."),clearTimeout(this.articleTimer),this.clearArticleSub(),this.queue.queues.article.active=!1,this.processArticle()}),console.log("REGISTER TIMEOUT!!",1e3*n),this.articleTimer=setTimeout(()=>{console.warn(`${this.url}: Event download timeout reached.`),this.clearArticleSub(),this.queue.queues.article.active=!1,this.processArticle(),postMessage({url:this.url,type:"timeout",data:{type:"Event",identifier:e}})},1e3*n)}downloadEvent(e,n=12){if(console.log("DOWNLOAD EVENT...."),!this.relay)return void console.warn("This relay does not have active connection and download cannot be executed at this time.");this.eventSub&&(console.log("Event sub already existed, unsub before continue."),this.clearEventSub());const s=this.relay.sub([{kinds:[1],ids:e}]);this.eventSub=s,s.on("event",o=>{console.log("POST MESSAGE BACK TO MAIN"),postMessage({url:this.url,type:"event",data:o}),console.log("FINISHED POST MESSAGE BACK TO MAIN")}),s.on("eose",()=>{console.log("eose on event."),clearTimeout(this.eventTimer),this.clearEventSub(),this.queue.queues.event.active=!1,this.processEvents()}),console.log("REGISTER TIMEOUT!!",1e3*n),this.eventTimer=setTimeout(()=>{console.warn(`${this.url}: Event download timeout reached.`),this.clearEventSub(),this.queue.queues.event.active=!1,this.processEvents(),postMessage({url:this.url,type:"timeout",data:{type:"Event",identifier:e}})},1e3*n)}subscribe(e,n){if(console.log("SUBSCRIBE...."),!this.relay||1!=this.relay.status)return this.queue.queues.subscriptions.jobs.push({id:n,filters:e}),void console.warn("This relay does not have active connection and subscription cannot be created at this time. Subscription has been scheduled for adding later.");if(this.subscriptions.findIndex(s=>s.id==n)>-1)return void console.log("This subscription is already added!");const r=this.relay.sub(e);console.log("SUBSCRIPTION:",r),this.subscriptions.push({id:n,filters:e,sub:r}),r.on("event",s=>{postMessage({url:this.url,subscription:n,type:"event",data:s})}),r.on("eose",()=>{console.log("eose on:",this.url)})}info(){var e=this;return a(function*(){try{const r=`https://${new URL(e.url).hostname}`,s=yield fetch(r,{method:"GET",mode:"cors",headers:{Accept:"application/nostr+json"}});if(200===s.status){const o=yield s.json();e.relay.nip11=o,postMessage({type:"nip11",data:o,url:e.url})}else postMessage({type:"nip11",data:{error:`Unable to get NIP-11 data. Status: ${s.statusText}`},url:e.url})}catch(n){console.warn(n),postMessage({type:"nip11",data:{error:`Unable to get NIP-11 data. Status: ${n}`},url:e.url})}})()}}let be;addEventListener("message",function(){var t=a(function*(e){console.log(`${be?.url}: MESSAGE RECEIVED IN RELAY WORKER!!`,JSON.stringify(e.data));const n=e.data;switch(n.type){case"connect":if(be&&be.relay&&1==be.relay.status){console.log("Already connected...");break}be=new uo(n.data.url),yield be.connect(n.data.event),yield be.info();break;case"disconnect":be.disconnect();break;case"publish":yield be.publish(n.data);break;case"enque":yield be.enque(n.data);break;case"subscribe":yield be.subscribe(n.data.filters,n.data.id);break;case"unsubscribe":yield be.unsubscribe(n.data);break;case"terminate":try{be.disconnect()}catch(r){console.error("Error during disconnect.",r)}console.log(`${be.url}: Sending 'terminated' event.`),postMessage({type:"terminated",url:be.url})}});return function(e){return t.apply(this,arguments)}}())})()})();