ncc-client-poc 0.1.1 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,41 @@
1
+ var Et=Object.defineProperty;var St=(e,t,a)=>t in e?Et(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a;var $e=(e,t,a)=>St(e,typeof t!="symbol"?t+"":t,a);import{g as getDefaultExportFromCjs$1,c as commonjsGlobal}from"./vendor-react-KfUPlHYY.js";function _mergeNamespaces(e,t){for(var a=0;a<t.length;a++){const u=t[a];if(typeof u!="string"&&!Array.isArray(u)){for(const d in u)if(d!=="default"&&!(d in e)){const h=Object.getOwnPropertyDescriptor(u,d);h&&Object.defineProperty(e,d,h.get?h:{enumerable:!0,get:()=>u[d]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}function number$3(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`Wrong positive integer: ${e}`)}function bytes$3(e,...t){if(!(e instanceof Uint8Array))throw new Error("Expected Uint8Array");if(t.length>0&&!t.includes(e.length))throw new Error(`Expected Uint8Array of length ${t}, not of length=${e.length}`)}function hash$6(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");number$3(e.outputLen),number$3(e.blockLen)}function exists$2(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function output$2(e,t){bytes$3(e);const a=t.outputLen;if(e.length<a)throw new Error(`digestInto() expects output buffer of length at least ${a}`)}const crypto$4=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */const u8a$3=e=>e instanceof Uint8Array,createView$2=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),rotr$2=(e,t)=>e<<32-t|e>>>t,isLE$3=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!isLE$3)throw new Error("Non little-endian hardware is not supported");function utf8ToBytes$3(e){if(typeof e!="string")throw new Error(`utf8ToBytes expected string, got ${typeof e}`);return new Uint8Array(new TextEncoder().encode(e))}function toBytes$2(e){if(typeof e=="string"&&(e=utf8ToBytes$3(e)),!u8a$3(e))throw new Error(`expected Uint8Array, got ${typeof e}`);return e}function concatBytes$3(...e){const t=new Uint8Array(e.reduce((u,d)=>u+d.length,0));let a=0;return e.forEach(u=>{if(!u8a$3(u))throw new Error("Uint8Array expected");t.set(u,a),a+=u.length}),t}let Hash$a=class{clone(){return this._cloneInto()}};function wrapConstructor$2(e){const t=u=>e().update(toBytes$2(u)).digest(),a=e();return t.outputLen=a.outputLen,t.blockLen=a.blockLen,t.create=()=>e(),t}function randomBytes$5(e=32){if(crypto$4&&typeof crypto$4.getRandomValues=="function")return crypto$4.getRandomValues(new Uint8Array(e));throw new Error("crypto.getRandomValues must be defined")}function setBigUint64$2(e,t,a,u){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,a,u);const d=BigInt(32),h=BigInt(4294967295),w=Number(a>>d&h),x=Number(a&h),M=u?4:0,B=u?0:4;e.setUint32(t+M,w,u),e.setUint32(t+B,x,u)}let SHA2$2=class extends Hash$a{constructor(t,a,u,d){super(),this.blockLen=t,this.outputLen=a,this.padOffset=u,this.isLE=d,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=createView$2(this.buffer)}update(t){exists$2(this);const{view:a,buffer:u,blockLen:d}=this;t=toBytes$2(t);const h=t.length;for(let w=0;w<h;){const x=Math.min(d-this.pos,h-w);if(x===d){const M=createView$2(t);for(;d<=h-w;w+=d)this.process(M,w);continue}u.set(t.subarray(w,w+x),this.pos),this.pos+=x,w+=x,this.pos===d&&(this.process(a,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){exists$2(this),output$2(t,this),this.finished=!0;const{buffer:a,view:u,blockLen:d,isLE:h}=this;let{pos:w}=this;a[w++]=128,this.buffer.subarray(w).fill(0),this.padOffset>d-w&&(this.process(u,0),w=0);for(let S=w;S<d;S++)a[S]=0;setBigUint64$2(u,d-8,BigInt(this.length*8),h),this.process(u,0);const x=createView$2(t),M=this.outputLen;if(M%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const B=M/4,E=this.get();if(B>E.length)throw new Error("_sha2: outputLen bigger than state");for(let S=0;S<B;S++)x.setUint32(4*S,E[S],h)}digest(){const{buffer:t,outputLen:a}=this;this.digestInto(t);const u=t.slice(0,a);return this.destroy(),u}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:a,buffer:u,length:d,finished:h,destroyed:w,pos:x}=this;return t.length=d,t.pos=x,t.finished=h,t.destroyed=w,d%a&&t.buffer.set(u),t}};const Chi$2=(e,t,a)=>e&t^~e&a,Maj$2=(e,t,a)=>e&t^e&a^t&a,SHA256_K$2=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]),IV$2=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),SHA256_W$2=new Uint32Array(64);let SHA256$4=class extends SHA2$2{constructor(){super(64,32,8,!1),this.A=IV$2[0]|0,this.B=IV$2[1]|0,this.C=IV$2[2]|0,this.D=IV$2[3]|0,this.E=IV$2[4]|0,this.F=IV$2[5]|0,this.G=IV$2[6]|0,this.H=IV$2[7]|0}get(){const{A:t,B:a,C:u,D:d,E:h,F:w,G:x,H:M}=this;return[t,a,u,d,h,w,x,M]}set(t,a,u,d,h,w,x,M){this.A=t|0,this.B=a|0,this.C=u|0,this.D=d|0,this.E=h|0,this.F=w|0,this.G=x|0,this.H=M|0}process(t,a){for(let S=0;S<16;S++,a+=4)SHA256_W$2[S]=t.getUint32(a,!1);for(let S=16;S<64;S++){const k=SHA256_W$2[S-15],C=SHA256_W$2[S-2],q=rotr$2(k,7)^rotr$2(k,18)^k>>>3,O=rotr$2(C,17)^rotr$2(C,19)^C>>>10;SHA256_W$2[S]=O+SHA256_W$2[S-7]+q+SHA256_W$2[S-16]|0}let{A:u,B:d,C:h,D:w,E:x,F:M,G:B,H:E}=this;for(let S=0;S<64;S++){const k=rotr$2(x,6)^rotr$2(x,11)^rotr$2(x,25),C=E+k+Chi$2(x,M,B)+SHA256_K$2[S]+SHA256_W$2[S]|0,O=(rotr$2(u,2)^rotr$2(u,13)^rotr$2(u,22))+Maj$2(u,d,h)|0;E=B,B=M,M=x,x=w+C|0,w=h,h=d,d=u,u=C+O|0}u=u+this.A|0,d=d+this.B|0,h=h+this.C|0,w=w+this.D|0,x=x+this.E|0,M=M+this.F|0,B=B+this.G|0,E=E+this.H|0,this.set(u,d,h,w,x,M,B,E)}roundClean(){SHA256_W$2.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};const sha256$4=wrapConstructor$2(()=>new SHA256$4);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const _0n$5=BigInt(0),_1n$5=BigInt(1),_2n$3=BigInt(2),u8a$2=e=>e instanceof Uint8Array,hexes$3=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function bytesToHex$3(e){if(!u8a$2(e))throw new Error("Uint8Array expected");let t="";for(let a=0;a<e.length;a++)t+=hexes$3[e[a]];return t}function numberToHexUnpadded$1(e){const t=e.toString(16);return t.length&1?`0${t}`:t}function hexToNumber$1(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);return BigInt(e===""?"0":`0x${e}`)}function hexToBytes$3(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);const t=e.length;if(t%2)throw new Error("padded hex string expected, got unpadded hex of length "+t);const a=new Uint8Array(t/2);for(let u=0;u<a.length;u++){const d=u*2,h=e.slice(d,d+2),w=Number.parseInt(h,16);if(Number.isNaN(w)||w<0)throw new Error("Invalid byte sequence");a[u]=w}return a}function bytesToNumberBE$1(e){return hexToNumber$1(bytesToHex$3(e))}function bytesToNumberLE$1(e){if(!u8a$2(e))throw new Error("Uint8Array expected");return hexToNumber$1(bytesToHex$3(Uint8Array.from(e).reverse()))}function numberToBytesBE$1(e,t){return hexToBytes$3(e.toString(16).padStart(t*2,"0"))}function numberToBytesLE$1(e,t){return numberToBytesBE$1(e,t).reverse()}function numberToVarBytesBE$1(e){return hexToBytes$3(numberToHexUnpadded$1(e))}function ensureBytes$1(e,t,a){let u;if(typeof t=="string")try{u=hexToBytes$3(t)}catch(h){throw new Error(`${e} must be valid hex string, got "${t}". Cause: ${h}`)}else if(u8a$2(t))u=Uint8Array.from(t);else throw new Error(`${e} must be hex string or Uint8Array`);const d=u.length;if(typeof a=="number"&&d!==a)throw new Error(`${e} expected ${a} bytes, got ${d}`);return u}function concatBytes$2(...e){const t=new Uint8Array(e.reduce((u,d)=>u+d.length,0));let a=0;return e.forEach(u=>{if(!u8a$2(u))throw new Error("Uint8Array expected");t.set(u,a),a+=u.length}),t}function equalBytes$2(e,t){if(e.length!==t.length)return!1;for(let a=0;a<e.length;a++)if(e[a]!==t[a])return!1;return!0}function utf8ToBytes$2(e){if(typeof e!="string")throw new Error(`utf8ToBytes expected string, got ${typeof e}`);return new Uint8Array(new TextEncoder().encode(e))}function bitLen$1(e){let t;for(t=0;e>_0n$5;e>>=_1n$5,t+=1);return t}function bitGet$1(e,t){return e>>BigInt(t)&_1n$5}const bitSet$1=(e,t,a)=>e|(a?_1n$5:_0n$5)<<BigInt(t),bitMask$1=e=>(_2n$3<<BigInt(e-1))-_1n$5,u8n$1=e=>new Uint8Array(e),u8fr$1=e=>Uint8Array.from(e);function createHmacDrbg$1(e,t,a){if(typeof e!="number"||e<2)throw new Error("hashLen must be a number");if(typeof t!="number"||t<2)throw new Error("qByteLen must be a number");if(typeof a!="function")throw new Error("hmacFn must be a function");let u=u8n$1(e),d=u8n$1(e),h=0;const w=()=>{u.fill(1),d.fill(0),h=0},x=(...S)=>a(d,u,...S),M=(S=u8n$1())=>{d=x(u8fr$1([0]),S),u=x(),S.length!==0&&(d=x(u8fr$1([1]),S),u=x())},B=()=>{if(h++>=1e3)throw new Error("drbg: tried 1000 values");let S=0;const k=[];for(;S<t;){u=x();const C=u.slice();k.push(C),S+=u.length}return concatBytes$2(...k)};return(S,k)=>{w(),M(S);let C;for(;!(C=k(B()));)M();return w(),C}}const validatorFns$1={bigint:e=>typeof e=="bigint",function:e=>typeof e=="function",boolean:e=>typeof e=="boolean",string:e=>typeof e=="string",stringOrUint8Array:e=>typeof e=="string"||e instanceof Uint8Array,isSafeInteger:e=>Number.isSafeInteger(e),array:e=>Array.isArray(e),field:(e,t)=>t.Fp.isValid(e),hash:e=>typeof e=="function"&&Number.isSafeInteger(e.outputLen)};function validateObject$1(e,t,a={}){const u=(d,h,w)=>{const x=validatorFns$1[h];if(typeof x!="function")throw new Error(`Invalid validator "${h}", expected function`);const M=e[d];if(!(w&&M===void 0)&&!x(M,e))throw new Error(`Invalid param ${String(d)}=${M} (${typeof M}), expected ${h}`)};for(const[d,h]of Object.entries(t))u(d,h,!1);for(const[d,h]of Object.entries(a))u(d,h,!0);return e}const ut=Object.freeze(Object.defineProperty({__proto__:null,bitGet:bitGet$1,bitLen:bitLen$1,bitMask:bitMask$1,bitSet:bitSet$1,bytesToHex:bytesToHex$3,bytesToNumberBE:bytesToNumberBE$1,bytesToNumberLE:bytesToNumberLE$1,concatBytes:concatBytes$2,createHmacDrbg:createHmacDrbg$1,ensureBytes:ensureBytes$1,equalBytes:equalBytes$2,hexToBytes:hexToBytes$3,hexToNumber:hexToNumber$1,numberToBytesBE:numberToBytesBE$1,numberToBytesLE:numberToBytesLE$1,numberToHexUnpadded:numberToHexUnpadded$1,numberToVarBytesBE:numberToVarBytesBE$1,utf8ToBytes:utf8ToBytes$2,validateObject:validateObject$1},Symbol.toStringTag,{value:"Module"}));/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const _0n$4=BigInt(0),_1n$4=BigInt(1),_2n$2=BigInt(2),_3n$2=BigInt(3),_4n$1=BigInt(4),_5n$1=BigInt(5),_8n$1=BigInt(8);BigInt(9);BigInt(16);function mod$1(e,t){const a=e%t;return a>=_0n$4?a:t+a}function pow$3(e,t,a){if(a<=_0n$4||t<_0n$4)throw new Error("Expected power/modulo > 0");if(a===_1n$4)return _0n$4;let u=_1n$4;for(;t>_0n$4;)t&_1n$4&&(u=u*e%a),e=e*e%a,t>>=_1n$4;return u}function pow2$1(e,t,a){let u=e;for(;t-- >_0n$4;)u*=u,u%=a;return u}function invert$1(e,t){if(e===_0n$4||t<=_0n$4)throw new Error(`invert: expected positive integers, got n=${e} mod=${t}`);let a=mod$1(e,t),u=t,d=_0n$4,h=_1n$4;for(;a!==_0n$4;){const x=u/a,M=u%a,B=d-h*x;u=a,a=M,d=h,h=B}if(u!==_1n$4)throw new Error("invert: does not exist");return mod$1(d,t)}function tonelliShanks$1(e){const t=(e-_1n$4)/_2n$2;let a,u,d;for(a=e-_1n$4,u=0;a%_2n$2===_0n$4;a/=_2n$2,u++);for(d=_2n$2;d<e&&pow$3(d,t,e)!==e-_1n$4;d++);if(u===1){const w=(e+_1n$4)/_4n$1;return function(M,B){const E=M.pow(B,w);if(!M.eql(M.sqr(E),B))throw new Error("Cannot find square root");return E}}const h=(a+_1n$4)/_2n$2;return function(x,M){if(x.pow(M,t)===x.neg(x.ONE))throw new Error("Cannot find square root");let B=u,E=x.pow(x.mul(x.ONE,d),a),S=x.pow(M,h),k=x.pow(M,a);for(;!x.eql(k,x.ONE);){if(x.eql(k,x.ZERO))return x.ZERO;let C=1;for(let O=x.sqr(k);C<B&&!x.eql(O,x.ONE);C++)O=x.sqr(O);const q=x.pow(E,_1n$4<<BigInt(B-C-1));E=x.sqr(q),S=x.mul(S,q),k=x.mul(k,E),B=C}return S}}function FpSqrt$1(e){if(e%_4n$1===_3n$2){const t=(e+_1n$4)/_4n$1;return function(u,d){const h=u.pow(d,t);if(!u.eql(u.sqr(h),d))throw new Error("Cannot find square root");return h}}if(e%_8n$1===_5n$1){const t=(e-_5n$1)/_8n$1;return function(u,d){const h=u.mul(d,_2n$2),w=u.pow(h,t),x=u.mul(d,w),M=u.mul(u.mul(x,_2n$2),w),B=u.mul(x,u.sub(M,u.ONE));if(!u.eql(u.sqr(B),d))throw new Error("Cannot find square root");return B}}return tonelliShanks$1(e)}const FIELD_FIELDS$1=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function validateField$1(e){const t={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},a=FIELD_FIELDS$1.reduce((u,d)=>(u[d]="function",u),t);return validateObject$1(e,a)}function FpPow$1(e,t,a){if(a<_0n$4)throw new Error("Expected power > 0");if(a===_0n$4)return e.ONE;if(a===_1n$4)return t;let u=e.ONE,d=t;for(;a>_0n$4;)a&_1n$4&&(u=e.mul(u,d)),d=e.sqr(d),a>>=_1n$4;return u}function FpInvertBatch$1(e,t){const a=new Array(t.length),u=t.reduce((h,w,x)=>e.is0(w)?h:(a[x]=h,e.mul(h,w)),e.ONE),d=e.inv(u);return t.reduceRight((h,w,x)=>e.is0(w)?h:(a[x]=e.mul(h,a[x]),e.mul(h,w)),d),a}function nLength$1(e,t){const a=t!==void 0?t:e.toString(2).length,u=Math.ceil(a/8);return{nBitLength:a,nByteLength:u}}function Field$1(e,t,a=!1,u={}){if(e<=_0n$4)throw new Error(`Expected Field ORDER > 0, got ${e}`);const{nBitLength:d,nByteLength:h}=nLength$1(e,t);if(h>2048)throw new Error("Field lengths over 2048 bytes are not supported");const w=FpSqrt$1(e),x=Object.freeze({ORDER:e,BITS:d,BYTES:h,MASK:bitMask$1(d),ZERO:_0n$4,ONE:_1n$4,create:M=>mod$1(M,e),isValid:M=>{if(typeof M!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof M}`);return _0n$4<=M&&M<e},is0:M=>M===_0n$4,isOdd:M=>(M&_1n$4)===_1n$4,neg:M=>mod$1(-M,e),eql:(M,B)=>M===B,sqr:M=>mod$1(M*M,e),add:(M,B)=>mod$1(M+B,e),sub:(M,B)=>mod$1(M-B,e),mul:(M,B)=>mod$1(M*B,e),pow:(M,B)=>FpPow$1(x,M,B),div:(M,B)=>mod$1(M*invert$1(B,e),e),sqrN:M=>M*M,addN:(M,B)=>M+B,subN:(M,B)=>M-B,mulN:(M,B)=>M*B,inv:M=>invert$1(M,e),sqrt:u.sqrt||(M=>w(x,M)),invertBatch:M=>FpInvertBatch$1(x,M),cmov:(M,B,E)=>E?B:M,toBytes:M=>a?numberToBytesLE$1(M,h):numberToBytesBE$1(M,h),fromBytes:M=>{if(M.length!==h)throw new Error(`Fp.fromBytes: expected ${h}, got ${M.length}`);return a?bytesToNumberLE$1(M):bytesToNumberBE$1(M)}});return Object.freeze(x)}function getFieldBytesLength$1(e){if(typeof e!="bigint")throw new Error("field order must be bigint");const t=e.toString(2).length;return Math.ceil(t/8)}function getMinHashLength$1(e){const t=getFieldBytesLength$1(e);return t+Math.ceil(t/2)}function mapHashToField$1(e,t,a=!1){const u=e.length,d=getFieldBytesLength$1(t),h=getMinHashLength$1(t);if(u<16||u<h||u>1024)throw new Error(`expected ${h}-1024 bytes of input, got ${u}`);const w=a?bytesToNumberBE$1(e):bytesToNumberLE$1(e),x=mod$1(w,t-_1n$4)+_1n$4;return a?numberToBytesLE$1(x,d):numberToBytesBE$1(x,d)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const _0n$3=BigInt(0),_1n$3=BigInt(1);function wNAF$1(e,t){const a=(d,h)=>{const w=h.negate();return d?w:h},u=d=>{const h=Math.ceil(t/d)+1,w=2**(d-1);return{windows:h,windowSize:w}};return{constTimeNegate:a,unsafeLadder(d,h){let w=e.ZERO,x=d;for(;h>_0n$3;)h&_1n$3&&(w=w.add(x)),x=x.double(),h>>=_1n$3;return w},precomputeWindow(d,h){const{windows:w,windowSize:x}=u(h),M=[];let B=d,E=B;for(let S=0;S<w;S++){E=B,M.push(E);for(let k=1;k<x;k++)E=E.add(B),M.push(E);B=E.double()}return M},wNAF(d,h,w){const{windows:x,windowSize:M}=u(d);let B=e.ZERO,E=e.BASE;const S=BigInt(2**d-1),k=2**d,C=BigInt(d);for(let q=0;q<x;q++){const O=q*M;let U=Number(w&S);w>>=C,U>M&&(U-=k,w+=_1n$3);const P=O,L=O+Math.abs(U)-1,J=q%2!==0,Y=U<0;U===0?E=E.add(a(J,h[P])):B=B.add(a(Y,h[L]))}return{p:B,f:E}},wNAFCached(d,h,w,x){const M=d._WINDOW_SIZE||1;let B=h.get(d);return B||(B=this.precomputeWindow(d,M),M!==1&&h.set(d,x(B))),this.wNAF(M,B,w)}}}function validateBasic$1(e){return validateField$1(e.Fp),validateObject$1(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...nLength$1(e.n,e.nBitLength),...e,p:e.Fp.ORDER})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function validatePointOpts$1(e){const t=validateBasic$1(e);validateObject$1(t,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:a,Fp:u,a:d}=t;if(a){if(!u.eql(d,u.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if(typeof a!="object"||typeof a.beta!="bigint"||typeof a.splitScalar!="function")throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...t})}const{bytesToNumberBE:b2n$1,hexToBytes:h2b$1}=ut,DER$1={Err:class extends Error{constructor(t=""){super(t)}},_parseInt(e){const{Err:t}=DER$1;if(e.length<2||e[0]!==2)throw new t("Invalid signature integer tag");const a=e[1],u=e.subarray(2,a+2);if(!a||u.length!==a)throw new t("Invalid signature integer: wrong length");if(u[0]&128)throw new t("Invalid signature integer: negative");if(u[0]===0&&!(u[1]&128))throw new t("Invalid signature integer: unnecessary leading zero");return{d:b2n$1(u),l:e.subarray(a+2)}},toSig(e){const{Err:t}=DER$1,a=typeof e=="string"?h2b$1(e):e;if(!(a instanceof Uint8Array))throw new Error("ui8a expected");let u=a.length;if(u<2||a[0]!=48)throw new t("Invalid signature tag");if(a[1]!==u-2)throw new t("Invalid signature: incorrect length");const{d,l:h}=DER$1._parseInt(a.subarray(2)),{d:w,l:x}=DER$1._parseInt(h);if(x.length)throw new t("Invalid signature: left bytes after parsing");return{r:d,s:w}},hexFromSig(e){const t=B=>Number.parseInt(B[0],16)&8?"00"+B:B,a=B=>{const E=B.toString(16);return E.length&1?`0${E}`:E},u=t(a(e.s)),d=t(a(e.r)),h=u.length/2,w=d.length/2,x=a(h),M=a(w);return`30${a(w+h+4)}02${M}${d}02${x}${u}`}},_0n$2=BigInt(0),_1n$2=BigInt(1);BigInt(2);const _3n$1=BigInt(3);BigInt(4);function weierstrassPoints$1(e){const t=validatePointOpts$1(e),{Fp:a}=t,u=t.toBytes||((q,O,U)=>{const P=O.toAffine();return concatBytes$2(Uint8Array.from([4]),a.toBytes(P.x),a.toBytes(P.y))}),d=t.fromBytes||(q=>{const O=q.subarray(1),U=a.fromBytes(O.subarray(0,a.BYTES)),P=a.fromBytes(O.subarray(a.BYTES,2*a.BYTES));return{x:U,y:P}});function h(q){const{a:O,b:U}=t,P=a.sqr(q),L=a.mul(P,q);return a.add(a.add(L,a.mul(q,O)),U)}if(!a.eql(a.sqr(t.Gy),h(t.Gx)))throw new Error("bad generator point: equation left != right");function w(q){return typeof q=="bigint"&&_0n$2<q&&q<t.n}function x(q){if(!w(q))throw new Error("Expected valid bigint: 0 < bigint < curve.n")}function M(q){const{allowedPrivateKeyLengths:O,nByteLength:U,wrapPrivateKey:P,n:L}=t;if(O&&typeof q!="bigint"){if(q instanceof Uint8Array&&(q=bytesToHex$3(q)),typeof q!="string"||!O.includes(q.length))throw new Error("Invalid key");q=q.padStart(U*2,"0")}let J;try{J=typeof q=="bigint"?q:bytesToNumberBE$1(ensureBytes$1("private key",q,U))}catch{throw new Error(`private key must be ${U} bytes, hex or bigint, not ${typeof q}`)}return P&&(J=mod$1(J,L)),x(J),J}const B=new Map;function E(q){if(!(q instanceof S))throw new Error("ProjectivePoint expected")}class S{constructor(O,U,P){if(this.px=O,this.py=U,this.pz=P,O==null||!a.isValid(O))throw new Error("x required");if(U==null||!a.isValid(U))throw new Error("y required");if(P==null||!a.isValid(P))throw new Error("z required")}static fromAffine(O){const{x:U,y:P}=O||{};if(!O||!a.isValid(U)||!a.isValid(P))throw new Error("invalid affine point");if(O instanceof S)throw new Error("projective point not allowed");const L=J=>a.eql(J,a.ZERO);return L(U)&&L(P)?S.ZERO:new S(U,P,a.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(O){const U=a.invertBatch(O.map(P=>P.pz));return O.map((P,L)=>P.toAffine(U[L])).map(S.fromAffine)}static fromHex(O){const U=S.fromAffine(d(ensureBytes$1("pointHex",O)));return U.assertValidity(),U}static fromPrivateKey(O){return S.BASE.multiply(M(O))}_setWindowSize(O){this._WINDOW_SIZE=O,B.delete(this)}assertValidity(){if(this.is0()){if(t.allowInfinityPoint&&!a.is0(this.py))return;throw new Error("bad point: ZERO")}const{x:O,y:U}=this.toAffine();if(!a.isValid(O)||!a.isValid(U))throw new Error("bad point: x or y not FE");const P=a.sqr(U),L=h(O);if(!a.eql(P,L))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:O}=this.toAffine();if(a.isOdd)return!a.isOdd(O);throw new Error("Field doesn't support isOdd")}equals(O){E(O);const{px:U,py:P,pz:L}=this,{px:J,py:Y,pz:ae}=O,oe=a.eql(a.mul(U,ae),a.mul(J,L)),ue=a.eql(a.mul(P,ae),a.mul(Y,L));return oe&&ue}negate(){return new S(this.px,a.neg(this.py),this.pz)}double(){const{a:O,b:U}=t,P=a.mul(U,_3n$1),{px:L,py:J,pz:Y}=this;let ae=a.ZERO,oe=a.ZERO,ue=a.ZERO,se=a.mul(L,L),ie=a.mul(J,J),ce=a.mul(Y,Y),$=a.mul(L,J);return $=a.add($,$),ue=a.mul(L,Y),ue=a.add(ue,ue),ae=a.mul(O,ue),oe=a.mul(P,ce),oe=a.add(ae,oe),ae=a.sub(ie,oe),oe=a.add(ie,oe),oe=a.mul(ae,oe),ae=a.mul($,ae),ue=a.mul(P,ue),ce=a.mul(O,ce),$=a.sub(se,ce),$=a.mul(O,$),$=a.add($,ue),ue=a.add(se,se),se=a.add(ue,se),se=a.add(se,ce),se=a.mul(se,$),oe=a.add(oe,se),ce=a.mul(J,Y),ce=a.add(ce,ce),se=a.mul(ce,$),ae=a.sub(ae,se),ue=a.mul(ce,ie),ue=a.add(ue,ue),ue=a.add(ue,ue),new S(ae,oe,ue)}add(O){E(O);const{px:U,py:P,pz:L}=this,{px:J,py:Y,pz:ae}=O;let oe=a.ZERO,ue=a.ZERO,se=a.ZERO;const ie=t.a,ce=a.mul(t.b,_3n$1);let $=a.mul(U,J),n=a.mul(P,Y),l=a.mul(L,ae),c=a.add(U,P),p=a.add(J,Y);c=a.mul(c,p),p=a.add($,n),c=a.sub(c,p),p=a.add(U,L);let y=a.add(J,ae);return p=a.mul(p,y),y=a.add($,l),p=a.sub(p,y),y=a.add(P,L),oe=a.add(Y,ae),y=a.mul(y,oe),oe=a.add(n,l),y=a.sub(y,oe),se=a.mul(ie,p),oe=a.mul(ce,l),se=a.add(oe,se),oe=a.sub(n,se),se=a.add(n,se),ue=a.mul(oe,se),n=a.add($,$),n=a.add(n,$),l=a.mul(ie,l),p=a.mul(ce,p),n=a.add(n,l),l=a.sub($,l),l=a.mul(ie,l),p=a.add(p,l),$=a.mul(n,p),ue=a.add(ue,$),$=a.mul(y,p),oe=a.mul(c,oe),oe=a.sub(oe,$),$=a.mul(c,n),se=a.mul(y,se),se=a.add(se,$),new S(oe,ue,se)}subtract(O){return this.add(O.negate())}is0(){return this.equals(S.ZERO)}wNAF(O){return C.wNAFCached(this,B,O,U=>{const P=a.invertBatch(U.map(L=>L.pz));return U.map((L,J)=>L.toAffine(P[J])).map(S.fromAffine)})}multiplyUnsafe(O){const U=S.ZERO;if(O===_0n$2)return U;if(x(O),O===_1n$2)return this;const{endo:P}=t;if(!P)return C.unsafeLadder(this,O);let{k1neg:L,k1:J,k2neg:Y,k2:ae}=P.splitScalar(O),oe=U,ue=U,se=this;for(;J>_0n$2||ae>_0n$2;)J&_1n$2&&(oe=oe.add(se)),ae&_1n$2&&(ue=ue.add(se)),se=se.double(),J>>=_1n$2,ae>>=_1n$2;return L&&(oe=oe.negate()),Y&&(ue=ue.negate()),ue=new S(a.mul(ue.px,P.beta),ue.py,ue.pz),oe.add(ue)}multiply(O){x(O);let U=O,P,L;const{endo:J}=t;if(J){const{k1neg:Y,k1:ae,k2neg:oe,k2:ue}=J.splitScalar(U);let{p:se,f:ie}=this.wNAF(ae),{p:ce,f:$}=this.wNAF(ue);se=C.constTimeNegate(Y,se),ce=C.constTimeNegate(oe,ce),ce=new S(a.mul(ce.px,J.beta),ce.py,ce.pz),P=se.add(ce),L=ie.add($)}else{const{p:Y,f:ae}=this.wNAF(U);P=Y,L=ae}return S.normalizeZ([P,L])[0]}multiplyAndAddUnsafe(O,U,P){const L=S.BASE,J=(ae,oe)=>oe===_0n$2||oe===_1n$2||!ae.equals(L)?ae.multiplyUnsafe(oe):ae.multiply(oe),Y=J(this,U).add(J(O,P));return Y.is0()?void 0:Y}toAffine(O){const{px:U,py:P,pz:L}=this,J=this.is0();O==null&&(O=J?a.ONE:a.inv(L));const Y=a.mul(U,O),ae=a.mul(P,O),oe=a.mul(L,O);if(J)return{x:a.ZERO,y:a.ZERO};if(!a.eql(oe,a.ONE))throw new Error("invZ was invalid");return{x:Y,y:ae}}isTorsionFree(){const{h:O,isTorsionFree:U}=t;if(O===_1n$2)return!0;if(U)return U(S,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:O,clearCofactor:U}=t;return O===_1n$2?this:U?U(S,this):this.multiplyUnsafe(t.h)}toRawBytes(O=!0){return this.assertValidity(),u(S,this,O)}toHex(O=!0){return bytesToHex$3(this.toRawBytes(O))}}S.BASE=new S(t.Gx,t.Gy,a.ONE),S.ZERO=new S(a.ZERO,a.ONE,a.ZERO);const k=t.nBitLength,C=wNAF$1(S,t.endo?Math.ceil(k/2):k);return{CURVE:t,ProjectivePoint:S,normPrivateKeyToScalar:M,weierstrassEquation:h,isWithinCurveOrder:w}}function validateOpts$1(e){const t=validateBasic$1(e);return validateObject$1(t,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...t})}function weierstrass$1(e){const t=validateOpts$1(e),{Fp:a,n:u}=t,d=a.BYTES+1,h=2*a.BYTES+1;function w(p){return _0n$2<p&&p<a.ORDER}function x(p){return mod$1(p,u)}function M(p){return invert$1(p,u)}const{ProjectivePoint:B,normPrivateKeyToScalar:E,weierstrassEquation:S,isWithinCurveOrder:k}=weierstrassPoints$1({...t,toBytes(p,y,b){const _=y.toAffine(),v=a.toBytes(_.x),o=concatBytes$2;return b?o(Uint8Array.from([y.hasEvenY()?2:3]),v):o(Uint8Array.from([4]),v,a.toBytes(_.y))},fromBytes(p){const y=p.length,b=p[0],_=p.subarray(1);if(y===d&&(b===2||b===3)){const v=bytesToNumberBE$1(_);if(!w(v))throw new Error("Point is not on curve");const o=S(v);let m=a.sqrt(o);const A=(m&_1n$2)===_1n$2;return(b&1)===1!==A&&(m=a.neg(m)),{x:v,y:m}}else if(y===h&&b===4){const v=a.fromBytes(_.subarray(0,a.BYTES)),o=a.fromBytes(_.subarray(a.BYTES,2*a.BYTES));return{x:v,y:o}}else throw new Error(`Point of length ${y} was invalid. Expected ${d} compressed bytes or ${h} uncompressed bytes`)}}),C=p=>bytesToHex$3(numberToBytesBE$1(p,t.nByteLength));function q(p){const y=u>>_1n$2;return p>y}function O(p){return q(p)?x(-p):p}const U=(p,y,b)=>bytesToNumberBE$1(p.slice(y,b));class P{constructor(y,b,_){this.r=y,this.s=b,this.recovery=_,this.assertValidity()}static fromCompact(y){const b=t.nByteLength;return y=ensureBytes$1("compactSignature",y,b*2),new P(U(y,0,b),U(y,b,2*b))}static fromDER(y){const{r:b,s:_}=DER$1.toSig(ensureBytes$1("DER",y));return new P(b,_)}assertValidity(){if(!k(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!k(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(y){return new P(this.r,this.s,y)}recoverPublicKey(y){const{r:b,s:_,recovery:v}=this,o=ue(ensureBytes$1("msgHash",y));if(v==null||![0,1,2,3].includes(v))throw new Error("recovery id invalid");const m=v===2||v===3?b+t.n:b;if(m>=a.ORDER)throw new Error("recovery id 2 or 3 invalid");const A=v&1?"03":"02",I=B.fromHex(A+C(m)),F=M(m),X=x(-o*F),V=x(_*F),T=B.BASE.multiplyAndAddUnsafe(I,X,V);if(!T)throw new Error("point at infinify");return T.assertValidity(),T}hasHighS(){return q(this.s)}normalizeS(){return this.hasHighS()?new P(this.r,x(-this.s),this.recovery):this}toDERRawBytes(){return hexToBytes$3(this.toDERHex())}toDERHex(){return DER$1.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return hexToBytes$3(this.toCompactHex())}toCompactHex(){return C(this.r)+C(this.s)}}const L={isValidPrivateKey(p){try{return E(p),!0}catch{return!1}},normPrivateKeyToScalar:E,randomPrivateKey:()=>{const p=getMinHashLength$1(t.n);return mapHashToField$1(t.randomBytes(p),t.n)},precompute(p=8,y=B.BASE){return y._setWindowSize(p),y.multiply(BigInt(3)),y}};function J(p,y=!0){return B.fromPrivateKey(p).toRawBytes(y)}function Y(p){const y=p instanceof Uint8Array,b=typeof p=="string",_=(y||b)&&p.length;return y?_===d||_===h:b?_===2*d||_===2*h:p instanceof B}function ae(p,y,b=!0){if(Y(p))throw new Error("first arg must be private key");if(!Y(y))throw new Error("second arg must be public key");return B.fromHex(y).multiply(E(p)).toRawBytes(b)}const oe=t.bits2int||function(p){const y=bytesToNumberBE$1(p),b=p.length*8-t.nBitLength;return b>0?y>>BigInt(b):y},ue=t.bits2int_modN||function(p){return x(oe(p))},se=bitMask$1(t.nBitLength);function ie(p){if(typeof p!="bigint")throw new Error("bigint expected");if(!(_0n$2<=p&&p<se))throw new Error(`bigint expected < 2^${t.nBitLength}`);return numberToBytesBE$1(p,t.nByteLength)}function ce(p,y,b=$){if(["recovered","canonical"].some(Z=>Z in b))throw new Error("sign() legacy options not supported");const{hash:_,randomBytes:v}=t;let{lowS:o,prehash:m,extraEntropy:A}=b;o==null&&(o=!0),p=ensureBytes$1("msgHash",p),m&&(p=ensureBytes$1("prehashed msgHash",_(p)));const I=ue(p),F=E(y),X=[ie(F),ie(I)];if(A!=null){const Z=A===!0?v(a.BYTES):A;X.push(ensureBytes$1("extraEntropy",Z))}const V=concatBytes$2(...X),T=I;function D(Z){const te=oe(Z);if(!k(te))return;const ee=M(te),j=B.BASE.multiply(te).toAffine(),re=x(j.x);if(re===_0n$2)return;const qe=x(ee*x(T+re*F));if(qe===_0n$2)return;let de=(j.x===re?0:2)|Number(j.y&_1n$2),pe=qe;return o&&q(qe)&&(pe=O(qe),de^=1),new P(re,pe,de)}return{seed:V,k2sig:D}}const $={lowS:t.lowS,prehash:!1},n={lowS:t.lowS,prehash:!1};function l(p,y,b=$){const{seed:_,k2sig:v}=ce(p,y,b),o=t;return createHmacDrbg$1(o.hash.outputLen,o.nByteLength,o.hmac)(_,v)}B.BASE._setWindowSize(8);function c(p,y,b,_=n){var j;const v=p;if(y=ensureBytes$1("msgHash",y),b=ensureBytes$1("publicKey",b),"strict"in _)throw new Error("options.strict was renamed to lowS");const{lowS:o,prehash:m}=_;let A,I;try{if(typeof v=="string"||v instanceof Uint8Array)try{A=P.fromDER(v)}catch(re){if(!(re instanceof DER$1.Err))throw re;A=P.fromCompact(v)}else if(typeof v=="object"&&typeof v.r=="bigint"&&typeof v.s=="bigint"){const{r:re,s:qe}=v;A=new P(re,qe)}else throw new Error("PARSE");I=B.fromHex(b)}catch(re){if(re.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(o&&A.hasHighS())return!1;m&&(y=t.hash(y));const{r:F,s:X}=A,V=ue(y),T=M(X),D=x(V*T),Z=x(F*T),te=(j=B.BASE.multiplyAndAddUnsafe(I,D,Z))==null?void 0:j.toAffine();return te?x(te.x)===F:!1}return{CURVE:t,getPublicKey:J,getSharedSecret:ae,sign:l,verify:c,ProjectivePoint:B,Signature:P,utils:L}}let HMAC$2=class extends Hash$a{constructor(t,a){super(),this.finished=!1,this.destroyed=!1,hash$6(t);const u=toBytes$2(a);if(this.iHash=t.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const d=this.blockLen,h=new Uint8Array(d);h.set(u.length>d?t.create().update(u).digest():u);for(let w=0;w<h.length;w++)h[w]^=54;this.iHash.update(h),this.oHash=t.create();for(let w=0;w<h.length;w++)h[w]^=106;this.oHash.update(h),h.fill(0)}update(t){return exists$2(this),this.iHash.update(t),this}digestInto(t){exists$2(this),bytes$3(t,this.outputLen),this.finished=!0,this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){const t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||(t=Object.create(Object.getPrototypeOf(this),{}));const{oHash:a,iHash:u,finished:d,destroyed:h,blockLen:w,outputLen:x}=this;return t=t,t.finished=d,t.destroyed=h,t.blockLen=w,t.outputLen=x,t.oHash=a._cloneInto(t.oHash),t.iHash=u._cloneInto(t.iHash),t}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}};const hmac$3=(e,t,a)=>new HMAC$2(e,t).update(a).digest();hmac$3.create=(e,t)=>new HMAC$2(e,t);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function getHash$1(e){return{hash:e,hmac:(t,...a)=>hmac$3(e,t,concatBytes$3(...a)),randomBytes:randomBytes$5}}function createCurve$1(e,t){const a=u=>weierstrass$1({...e,...getHash$1(u)});return Object.freeze({...a(t),create:a})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const secp256k1P$1=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),secp256k1N$1=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),_1n$1=BigInt(1),_2n$1=BigInt(2),divNearest$1=(e,t)=>(e+t/_2n$1)/t;function sqrtMod$1(e){const t=secp256k1P$1,a=BigInt(3),u=BigInt(6),d=BigInt(11),h=BigInt(22),w=BigInt(23),x=BigInt(44),M=BigInt(88),B=e*e*e%t,E=B*B*e%t,S=pow2$1(E,a,t)*E%t,k=pow2$1(S,a,t)*E%t,C=pow2$1(k,_2n$1,t)*B%t,q=pow2$1(C,d,t)*C%t,O=pow2$1(q,h,t)*q%t,U=pow2$1(O,x,t)*O%t,P=pow2$1(U,M,t)*U%t,L=pow2$1(P,x,t)*O%t,J=pow2$1(L,a,t)*E%t,Y=pow2$1(J,w,t)*q%t,ae=pow2$1(Y,u,t)*B%t,oe=pow2$1(ae,_2n$1,t);if(!Fp$1.eql(Fp$1.sqr(oe),e))throw new Error("Cannot find square root");return oe}const Fp$1=Field$1(secp256k1P$1,void 0,void 0,{sqrt:sqrtMod$1}),secp256k1$2=createCurve$1({a:BigInt(0),b:BigInt(7),Fp:Fp$1,n:secp256k1N$1,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:e=>{const t=secp256k1N$1,a=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),u=-_1n$1*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),d=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),h=a,w=BigInt("0x100000000000000000000000000000000"),x=divNearest$1(h*e,t),M=divNearest$1(-u*e,t);let B=mod$1(e-x*a-M*d,t),E=mod$1(-x*u-M*h,t);const S=B>w,k=E>w;if(S&&(B=t-B),k&&(E=t-E),B>w||E>w)throw new Error("splitScalar: Endomorphism failed, k="+e);return{k1neg:S,k1:B,k2neg:k,k2:E}}}},sha256$4),_0n$1=BigInt(0),fe$1=e=>typeof e=="bigint"&&_0n$1<e&&e<secp256k1P$1,ge$1=e=>typeof e=="bigint"&&_0n$1<e&&e<secp256k1N$1,TAGGED_HASH_PREFIXES$1={};function taggedHash$1(e,...t){let a=TAGGED_HASH_PREFIXES$1[e];if(a===void 0){const u=sha256$4(Uint8Array.from(e,d=>d.charCodeAt(0)));a=concatBytes$2(u,u),TAGGED_HASH_PREFIXES$1[e]=a}return sha256$4(concatBytes$2(a,...t))}const pointToBytes$1=e=>e.toRawBytes(!0).slice(1),numTo32b$1=e=>numberToBytesBE$1(e,32),modP$1=e=>mod$1(e,secp256k1P$1),modN$1=e=>mod$1(e,secp256k1N$1),Point$4=secp256k1$2.ProjectivePoint,GmulAdd$1=(e,t,a)=>Point$4.BASE.multiplyAndAddUnsafe(e,t,a);function schnorrGetExtPubKey$1(e){let t=secp256k1$2.utils.normPrivateKeyToScalar(e),a=Point$4.fromPrivateKey(t);return{scalar:a.hasEvenY()?t:modN$1(-t),bytes:pointToBytes$1(a)}}function lift_x$1(e){if(!fe$1(e))throw new Error("bad x: need 0 < x < p");const t=modP$1(e*e),a=modP$1(t*e+BigInt(7));let u=sqrtMod$1(a);u%_2n$1!==_0n$1&&(u=modP$1(-u));const d=new Point$4(e,u,_1n$1);return d.assertValidity(),d}function challenge$1(...e){return modN$1(bytesToNumberBE$1(taggedHash$1("BIP0340/challenge",...e)))}function schnorrGetPublicKey$1(e){return schnorrGetExtPubKey$1(e).bytes}function schnorrSign$1(e,t,a=randomBytes$5(32)){const u=ensureBytes$1("message",e),{bytes:d,scalar:h}=schnorrGetExtPubKey$1(t),w=ensureBytes$1("auxRand",a,32),x=numTo32b$1(h^bytesToNumberBE$1(taggedHash$1("BIP0340/aux",w))),M=taggedHash$1("BIP0340/nonce",x,d,u),B=modN$1(bytesToNumberBE$1(M));if(B===_0n$1)throw new Error("sign failed: k is zero");const{bytes:E,scalar:S}=schnorrGetExtPubKey$1(B),k=challenge$1(E,d,u),C=new Uint8Array(64);if(C.set(E,0),C.set(numTo32b$1(modN$1(S+k*h)),32),!schnorrVerify$1(C,u,d))throw new Error("sign: Invalid signature produced");return C}function schnorrVerify$1(e,t,a){const u=ensureBytes$1("signature",e,64),d=ensureBytes$1("message",t),h=ensureBytes$1("publicKey",a,32);try{const w=lift_x$1(bytesToNumberBE$1(h)),x=bytesToNumberBE$1(u.subarray(0,32));if(!fe$1(x))return!1;const M=bytesToNumberBE$1(u.subarray(32,64));if(!ge$1(M))return!1;const B=challenge$1(numTo32b$1(x),pointToBytes$1(w),d),E=GmulAdd$1(w,M,modN$1(-B));return!(!E||!E.hasEvenY()||E.toAffine().x!==x)}catch{return!1}}const schnorr$1={getPublicKey:schnorrGetPublicKey$1,sign:schnorrSign$1,verify:schnorrVerify$1,utils:{randomPrivateKey:secp256k1$2.utils.randomPrivateKey,lift_x:lift_x$1,pointToBytes:pointToBytes$1,numberToBytesBE:numberToBytesBE$1,bytesToNumberBE:bytesToNumberBE$1,taggedHash:taggedHash$1,mod:mod$1}},crypto$3=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */const u8a$1=e=>e instanceof Uint8Array,createView$1=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),rotr$1=(e,t)=>e<<32-t|e>>>t,isLE$2=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!isLE$2)throw new Error("Non little-endian hardware is not supported");const hexes$2=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function bytesToHex$2(e){if(!u8a$1(e))throw new Error("Uint8Array expected");let t="";for(let a=0;a<e.length;a++)t+=hexes$2[e[a]];return t}function hexToBytes$2(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);const t=e.length;if(t%2)throw new Error("padded hex string expected, got unpadded hex of length "+t);const a=new Uint8Array(t/2);for(let u=0;u<a.length;u++){const d=u*2,h=e.slice(d,d+2),w=Number.parseInt(h,16);if(Number.isNaN(w)||w<0)throw new Error("Invalid byte sequence");a[u]=w}return a}function utf8ToBytes$1(e){if(typeof e!="string")throw new Error(`utf8ToBytes expected string, got ${typeof e}`);return new Uint8Array(new TextEncoder().encode(e))}function toBytes$1(e){if(typeof e=="string"&&(e=utf8ToBytes$1(e)),!u8a$1(e))throw new Error(`expected Uint8Array, got ${typeof e}`);return e}function concatBytes$1(...e){const t=new Uint8Array(e.reduce((u,d)=>u+d.length,0));let a=0;return e.forEach(u=>{if(!u8a$1(u))throw new Error("Uint8Array expected");t.set(u,a),a+=u.length}),t}let Hash$9=class{clone(){return this._cloneInto()}};function wrapConstructor$1(e){const t=u=>e().update(toBytes$1(u)).digest(),a=e();return t.outputLen=a.outputLen,t.blockLen=a.blockLen,t.create=()=>e(),t}function randomBytes$4(e=32){if(crypto$3&&typeof crypto$3.getRandomValues=="function")return crypto$3.getRandomValues(new Uint8Array(e));throw new Error("crypto.getRandomValues must be defined")}function number$2(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`Wrong positive integer: ${e}`)}function bool$2(e){if(typeof e!="boolean")throw new Error(`Expected boolean, not ${e}`)}function bytes$2(e,...t){if(!(e instanceof Uint8Array))throw new Error("Expected Uint8Array");if(t.length>0&&!t.includes(e.length))throw new Error(`Expected Uint8Array of length ${t}, not of length=${e.length}`)}function hash$5(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");number$2(e.outputLen),number$2(e.blockLen)}function exists$1(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function output$1(e,t){bytes$2(e);const a=t.outputLen;if(e.length<a)throw new Error(`digestInto() expects output buffer of length at least ${a}`)}const assert$k={number:number$2,bool:bool$2,bytes:bytes$2,hash:hash$5,exists:exists$1,output:output$1};function setBigUint64$1(e,t,a,u){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,a,u);const d=BigInt(32),h=BigInt(4294967295),w=Number(a>>d&h),x=Number(a&h),M=u?4:0,B=u?0:4;e.setUint32(t+M,w,u),e.setUint32(t+B,x,u)}let SHA2$1=class extends Hash$9{constructor(t,a,u,d){super(),this.blockLen=t,this.outputLen=a,this.padOffset=u,this.isLE=d,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=createView$1(this.buffer)}update(t){assert$k.exists(this);const{view:a,buffer:u,blockLen:d}=this;t=toBytes$1(t);const h=t.length;for(let w=0;w<h;){const x=Math.min(d-this.pos,h-w);if(x===d){const M=createView$1(t);for(;d<=h-w;w+=d)this.process(M,w);continue}u.set(t.subarray(w,w+x),this.pos),this.pos+=x,w+=x,this.pos===d&&(this.process(a,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){assert$k.exists(this),assert$k.output(t,this),this.finished=!0;const{buffer:a,view:u,blockLen:d,isLE:h}=this;let{pos:w}=this;a[w++]=128,this.buffer.subarray(w).fill(0),this.padOffset>d-w&&(this.process(u,0),w=0);for(let S=w;S<d;S++)a[S]=0;setBigUint64$1(u,d-8,BigInt(this.length*8),h),this.process(u,0);const x=createView$1(t),M=this.outputLen;if(M%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const B=M/4,E=this.get();if(B>E.length)throw new Error("_sha2: outputLen bigger than state");for(let S=0;S<B;S++)x.setUint32(4*S,E[S],h)}digest(){const{buffer:t,outputLen:a}=this;this.digestInto(t);const u=t.slice(0,a);return this.destroy(),u}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:a,buffer:u,length:d,finished:h,destroyed:w,pos:x}=this;return t.length=d,t.pos=x,t.finished=h,t.destroyed=w,d%a&&t.buffer.set(u),t}};const Chi$1=(e,t,a)=>e&t^~e&a,Maj$1=(e,t,a)=>e&t^e&a^t&a,SHA256_K$1=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]),IV$1=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),SHA256_W$1=new Uint32Array(64);let SHA256$3=class extends SHA2$1{constructor(){super(64,32,8,!1),this.A=IV$1[0]|0,this.B=IV$1[1]|0,this.C=IV$1[2]|0,this.D=IV$1[3]|0,this.E=IV$1[4]|0,this.F=IV$1[5]|0,this.G=IV$1[6]|0,this.H=IV$1[7]|0}get(){const{A:t,B:a,C:u,D:d,E:h,F:w,G:x,H:M}=this;return[t,a,u,d,h,w,x,M]}set(t,a,u,d,h,w,x,M){this.A=t|0,this.B=a|0,this.C=u|0,this.D=d|0,this.E=h|0,this.F=w|0,this.G=x|0,this.H=M|0}process(t,a){for(let S=0;S<16;S++,a+=4)SHA256_W$1[S]=t.getUint32(a,!1);for(let S=16;S<64;S++){const k=SHA256_W$1[S-15],C=SHA256_W$1[S-2],q=rotr$1(k,7)^rotr$1(k,18)^k>>>3,O=rotr$1(C,17)^rotr$1(C,19)^C>>>10;SHA256_W$1[S]=O+SHA256_W$1[S-7]+q+SHA256_W$1[S-16]|0}let{A:u,B:d,C:h,D:w,E:x,F:M,G:B,H:E}=this;for(let S=0;S<64;S++){const k=rotr$1(x,6)^rotr$1(x,11)^rotr$1(x,25),C=E+k+Chi$1(x,M,B)+SHA256_K$1[S]+SHA256_W$1[S]|0,O=(rotr$1(u,2)^rotr$1(u,13)^rotr$1(u,22))+Maj$1(u,d,h)|0;E=B,B=M,M=x,x=w+C|0,w=h,h=d,d=u,u=C+O|0}u=u+this.A|0,d=d+this.B|0,h=h+this.C|0,w=w+this.D|0,x=x+this.E|0,M=M+this.F|0,B=B+this.G|0,E=E+this.H|0,this.set(u,d,h,w,x,M,B,E)}roundClean(){SHA256_W$1.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}},SHA224$2=class extends SHA256$3{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 sha256$3=wrapConstructor$1(()=>new SHA256$3);wrapConstructor$1(()=>new SHA224$2);/*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) */function assertNumber$1(e){if(!Number.isSafeInteger(e))throw new Error(`Wrong integer: ${e}`)}function chain$1(...e){const t=(d,h)=>w=>d(h(w)),a=Array.from(e).reverse().reduce((d,h)=>d?t(d,h.encode):h.encode,void 0),u=e.reduce((d,h)=>d?t(d,h.decode):h.decode,void 0);return{encode:a,decode:u}}function alphabet$1(e){return{encode:t=>{if(!Array.isArray(t)||t.length&&typeof t[0]!="number")throw new Error("alphabet.encode input should be an array of numbers");return t.map(a=>{if(assertNumber$1(a),a<0||a>=e.length)throw new Error(`Digit index outside alphabet: ${a} (alphabet: ${e.length})`);return e[a]})},decode:t=>{if(!Array.isArray(t)||t.length&&typeof t[0]!="string")throw new Error("alphabet.decode input should be array of strings");return t.map(a=>{if(typeof a!="string")throw new Error(`alphabet.decode: not string element=${a}`);const u=e.indexOf(a);if(u===-1)throw new Error(`Unknown letter: "${a}". Allowed: ${e}`);return u})}}}function join$1(e=""){if(typeof e!="string")throw new Error("join separator should be string");return{encode:t=>{if(!Array.isArray(t)||t.length&&typeof t[0]!="string")throw new Error("join.encode input should be array of strings");for(let a of t)if(typeof a!="string")throw new Error(`join.encode: non-string input=${a}`);return t.join(e)},decode:t=>{if(typeof t!="string")throw new Error("join.decode input should be string");return t.split(e)}}}function padding$1(e,t="="){if(assertNumber$1(e),typeof t!="string")throw new Error("padding chr should be string");return{encode(a){if(!Array.isArray(a)||a.length&&typeof a[0]!="string")throw new Error("padding.encode input should be array of strings");for(let u of a)if(typeof u!="string")throw new Error(`padding.encode: non-string input=${u}`);for(;a.length*e%8;)a.push(t);return a},decode(a){if(!Array.isArray(a)||a.length&&typeof a[0]!="string")throw new Error("padding.encode input should be array of strings");for(let d of a)if(typeof d!="string")throw new Error(`padding.decode: non-string input=${d}`);let u=a.length;if(u*e%8)throw new Error("Invalid padding: string should have whole number of bytes");for(;u>0&&a[u-1]===t;u--)if(!((u-1)*e%8))throw new Error("Invalid padding: string has too much padding");return a.slice(0,u)}}}function normalize$1(e){if(typeof e!="function")throw new Error("normalize fn should be function");return{encode:t=>t,decode:t=>e(t)}}function convertRadix$1(e,t,a){if(t<2)throw new Error(`convertRadix: wrong from=${t}, base cannot be less than 2`);if(a<2)throw new Error(`convertRadix: wrong to=${a}, base cannot be less than 2`);if(!Array.isArray(e))throw new Error("convertRadix: data should be array");if(!e.length)return[];let u=0;const d=[],h=Array.from(e);for(h.forEach(w=>{if(assertNumber$1(w),w<0||w>=t)throw new Error(`Wrong integer: ${w}`)});;){let w=0,x=!0;for(let M=u;M<h.length;M++){const B=h[M],E=t*w+B;if(!Number.isSafeInteger(E)||t*w/t!==w||E-B!==t*w)throw new Error("convertRadix: carry overflow");if(w=E%a,h[M]=Math.floor(E/a),!Number.isSafeInteger(h[M])||h[M]*a+w!==E)throw new Error("convertRadix: carry overflow");if(x)h[M]?x=!1:u=M;else continue}if(d.push(w),x)break}for(let w=0;w<e.length-1&&e[w]===0;w++)d.push(0);return d.reverse()}const gcd$1=(e,t)=>t?gcd$1(t,e%t):e,radix2carry$1=(e,t)=>e+(t-gcd$1(e,t));function convertRadix2$1(e,t,a,u){if(!Array.isArray(e))throw new Error("convertRadix2: data should be array");if(t<=0||t>32)throw new Error(`convertRadix2: wrong from=${t}`);if(a<=0||a>32)throw new Error(`convertRadix2: wrong to=${a}`);if(radix2carry$1(t,a)>32)throw new Error(`convertRadix2: carry overflow from=${t} to=${a} carryBits=${radix2carry$1(t,a)}`);let d=0,h=0;const w=2**a-1,x=[];for(const M of e){if(assertNumber$1(M),M>=2**t)throw new Error(`convertRadix2: invalid data word=${M} from=${t}`);if(d=d<<t|M,h+t>32)throw new Error(`convertRadix2: carry overflow pos=${h} from=${t}`);for(h+=t;h>=a;h-=a)x.push((d>>h-a&w)>>>0);d&=2**h-1}if(d=d<<a-h&w,!u&&h>=t)throw new Error("Excess padding");if(!u&&d)throw new Error(`Non-zero padding: ${d}`);return u&&h>0&&x.push(d>>>0),x}function radix$1(e){return assertNumber$1(e),{encode:t=>{if(!(t instanceof Uint8Array))throw new Error("radix.encode input should be Uint8Array");return convertRadix$1(Array.from(t),2**8,e)},decode:t=>{if(!Array.isArray(t)||t.length&&typeof t[0]!="number")throw new Error("radix.decode input should be array of strings");return Uint8Array.from(convertRadix$1(t,e,2**8))}}}function radix2$1(e,t=!1){if(assertNumber$1(e),e<=0||e>32)throw new Error("radix2: bits should be in (0..32]");if(radix2carry$1(8,e)>32||radix2carry$1(e,8)>32)throw new Error("radix2: carry overflow");return{encode:a=>{if(!(a instanceof Uint8Array))throw new Error("radix2.encode input should be Uint8Array");return convertRadix2$1(Array.from(a),8,e,!t)},decode:a=>{if(!Array.isArray(a)||a.length&&typeof a[0]!="number")throw new Error("radix2.decode input should be array of strings");return Uint8Array.from(convertRadix2$1(a,e,8,t))}}}function unsafeWrapper$1(e){if(typeof e!="function")throw new Error("unsafeWrapper fn should be function");return function(...t){try{return e.apply(null,t)}catch{}}}const base16$1=chain$1(radix2$1(4),alphabet$1("0123456789ABCDEF"),join$1("")),base32$1=chain$1(radix2$1(5),alphabet$1("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"),padding$1(5),join$1(""));chain$1(radix2$1(5),alphabet$1("0123456789ABCDEFGHIJKLMNOPQRSTUV"),padding$1(5),join$1(""));chain$1(radix2$1(5),alphabet$1("0123456789ABCDEFGHJKMNPQRSTVWXYZ"),join$1(""),normalize$1(e=>e.toUpperCase().replace(/O/g,"0").replace(/[IL]/g,"1")));const base64$1=chain$1(radix2$1(6),alphabet$1("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),padding$1(6),join$1("")),base64url$1=chain$1(radix2$1(6),alphabet$1("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),padding$1(6),join$1("")),genBase58$1=e=>chain$1(radix$1(58),alphabet$1(e),join$1("")),base58$1=genBase58$1("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");genBase58$1("123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ");genBase58$1("rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz");const XMR_BLOCK_LEN$1=[0,2,3,5,6,7,9,10,11],base58xmr$1={encode(e){let t="";for(let a=0;a<e.length;a+=8){const u=e.subarray(a,a+8);t+=base58$1.encode(u).padStart(XMR_BLOCK_LEN$1[u.length],"1")}return t},decode(e){let t=[];for(let a=0;a<e.length;a+=11){const u=e.slice(a,a+11),d=XMR_BLOCK_LEN$1.indexOf(u.length),h=base58$1.decode(u);for(let w=0;w<h.length-d;w++)if(h[w]!==0)throw new Error("base58xmr: wrong padding");t=t.concat(Array.from(h.slice(h.length-d)))}return Uint8Array.from(t)}},BECH_ALPHABET$1=chain$1(alphabet$1("qpzry9x8gf2tvdw0s3jn54khce6mua7l"),join$1("")),POLYMOD_GENERATORS$1=[996825010,642813549,513874426,1027748829,705979059];function bech32Polymod$1(e){const t=e>>25;let a=(e&33554431)<<5;for(let u=0;u<POLYMOD_GENERATORS$1.length;u++)(t>>u&1)===1&&(a^=POLYMOD_GENERATORS$1[u]);return a}function bechChecksum$1(e,t,a=1){const u=e.length;let d=1;for(let h=0;h<u;h++){const w=e.charCodeAt(h);if(w<33||w>126)throw new Error(`Invalid prefix (${e})`);d=bech32Polymod$1(d)^w>>5}d=bech32Polymod$1(d);for(let h=0;h<u;h++)d=bech32Polymod$1(d)^e.charCodeAt(h)&31;for(let h of t)d=bech32Polymod$1(d)^h;for(let h=0;h<6;h++)d=bech32Polymod$1(d);return d^=a,BECH_ALPHABET$1.encode(convertRadix2$1([d%2**30],30,5,!1))}function genBech32$1(e){const t=e==="bech32"?1:734539939,a=radix2$1(5),u=a.decode,d=a.encode,h=unsafeWrapper$1(u);function w(E,S,k=90){if(typeof E!="string")throw new Error(`bech32.encode prefix should be string, not ${typeof E}`);if(!Array.isArray(S)||S.length&&typeof S[0]!="number")throw new Error(`bech32.encode words should be array of numbers, not ${typeof S}`);const C=E.length+7+S.length;if(k!==!1&&C>k)throw new TypeError(`Length ${C} exceeds limit ${k}`);return E=E.toLowerCase(),`${E}1${BECH_ALPHABET$1.encode(S)}${bechChecksum$1(E,S,t)}`}function x(E,S=90){if(typeof E!="string")throw new Error(`bech32.decode input should be string, not ${typeof E}`);if(E.length<8||S!==!1&&E.length>S)throw new TypeError(`Wrong string length: ${E.length} (${E}). Expected (8..${S})`);const k=E.toLowerCase();if(E!==k&&E!==E.toUpperCase())throw new Error("String must be lowercase or uppercase");E=k;const C=E.lastIndexOf("1");if(C===0||C===-1)throw new Error('Letter "1" must be present between prefix and data only');const q=E.slice(0,C),O=E.slice(C+1);if(O.length<6)throw new Error("Data must be at least 6 characters long");const U=BECH_ALPHABET$1.decode(O).slice(0,-6),P=bechChecksum$1(q,U,t);if(!O.endsWith(P))throw new Error(`Invalid checksum in ${E}: expected "${P}"`);return{prefix:q,words:U}}const M=unsafeWrapper$1(x);function B(E){const{prefix:S,words:k}=x(E,!1);return{prefix:S,words:k,bytes:u(k)}}return{encode:w,decode:x,decodeToBytes:B,decodeUnsafe:M,fromWords:u,fromWordsUnsafe:h,toWords:d}}const bech32$1=genBech32$1("bech32");genBech32$1("bech32m");const utf8$1={encode:e=>new TextDecoder().decode(e),decode:e=>new TextEncoder().encode(e)},hex$1=chain$1(radix2$1(4),alphabet$1("0123456789abcdef"),join$1(""),normalize$1(e=>{if(typeof e!="string"||e.length%2)throw new TypeError(`hex.decode: expected string, got ${typeof e} with length ${e.length}`);return e.toLowerCase()})),CODERS$1={utf8:utf8$1,hex:hex$1,base16:base16$1,base32:base32$1,base64:base64$1,base64url:base64url$1,base58:base58$1,base58xmr:base58xmr$1};`${Object.keys(CODERS$1).join(", ")}`;function number$1(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`positive integer expected, not ${e}`)}function bool$1(e){if(typeof e!="boolean")throw new Error(`boolean expected, not ${e}`)}function isBytes$1(e){return e instanceof Uint8Array||e!=null&&typeof e=="object"&&e.constructor.name==="Uint8Array"}function bytes$1(e,...t){if(!isBytes$1(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error(`Uint8Array expected of length ${t}, not of length=${e.length}`)}/*! noble-ciphers - MIT License (c) 2023 Paul Miller (paulmillr.com) */const u32$1=e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4)),isLE$1=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!isLE$1)throw new Error("Non little-endian hardware is not supported");const hexes$1=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function bytesToHex$1(e){bytes$1(e);let t="";for(let a=0;a<e.length;a++)t+=hexes$1[e[a]];return t}const asciis$1={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};function asciiToBase16$1(e){if(e>=asciis$1._0&&e<=asciis$1._9)return e-asciis$1._0;if(e>=asciis$1._A&&e<=asciis$1._F)return e-(asciis$1._A-10);if(e>=asciis$1._a&&e<=asciis$1._f)return e-(asciis$1._a-10)}function hexToBytes$1(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);const t=e.length,a=t/2;if(t%2)throw new Error("padded hex string expected, got unpadded hex of length "+t);const u=new Uint8Array(a);for(let d=0,h=0;d<a;d++,h+=2){const w=asciiToBase16$1(e.charCodeAt(h)),x=asciiToBase16$1(e.charCodeAt(h+1));if(w===void 0||x===void 0){const M=e[h]+e[h+1];throw new Error('hex string expected, got non-hex character "'+M+'" at index '+h)}u[d]=w*16+x}return u}function checkOpts$1(e,t){if(t==null||typeof t!="object")throw new Error("options must be defined");return Object.assign(e,t)}function equalBytes$1(e,t){if(e.length!==t.length)return!1;let a=0;for(let u=0;u<e.length;u++)a|=e[u]^t[u];return a===0}const wrapCipher$1=(e,t)=>(Object.assign(t,e),t),BLOCK_SIZE$1=16,POLY$1=283;function mul2$1(e){return e<<1^POLY$1&-(e>>7)}function mul$1(e,t){let a=0;for(;t>0;t>>=1)a^=e&-(t&1),e=mul2$1(e);return a}const sbox$1=(()=>{let e=new Uint8Array(256);for(let a=0,u=1;a<256;a++,u^=mul2$1(u))e[a]=u;const t=new Uint8Array(256);t[0]=99;for(let a=0;a<255;a++){let u=e[255-a];u|=u<<8,t[e[a]]=(u^u>>4^u>>5^u>>6^u>>7^99)&255}return t})(),invSbox$1=sbox$1.map((e,t)=>sbox$1.indexOf(t)),rotr32_8$1=e=>e<<24|e>>>8,rotl32_8$1=e=>e<<8|e>>>24;function genTtable$1(e,t){if(e.length!==256)throw new Error("Wrong sbox length");const a=new Uint32Array(256).map((B,E)=>t(e[E])),u=a.map(rotl32_8$1),d=u.map(rotl32_8$1),h=d.map(rotl32_8$1),w=new Uint32Array(256*256),x=new Uint32Array(256*256),M=new Uint16Array(256*256);for(let B=0;B<256;B++)for(let E=0;E<256;E++){const S=B*256+E;w[S]=a[B]^u[E],x[S]=d[B]^h[E],M[S]=e[B]<<8|e[E]}return{sbox:e,sbox2:M,T0:a,T1:u,T2:d,T3:h,T01:w,T23:x}}const tableEncoding$1=genTtable$1(sbox$1,e=>mul$1(e,3)<<24|e<<16|e<<8|mul$1(e,2)),tableDecoding$1=genTtable$1(invSbox$1,e=>mul$1(e,11)<<24|mul$1(e,13)<<16|mul$1(e,9)<<8|mul$1(e,14)),xPowers$1=(()=>{const e=new Uint8Array(16);for(let t=0,a=1;t<16;t++,a=mul2$1(a))e[t]=a;return e})();function expandKeyLE$1(e){bytes$1(e);const t=e.length;if(![16,24,32].includes(t))throw new Error(`aes: wrong key size: should be 16, 24 or 32, got: ${t}`);const{sbox2:a}=tableEncoding$1,u=u32$1(e),d=u.length,h=x=>applySbox$1(a,x,x,x,x),w=new Uint32Array(t+28);w.set(u);for(let x=d;x<w.length;x++){let M=w[x-1];x%d===0?M=h(rotr32_8$1(M))^xPowers$1[x/d-1]:d>6&&x%d===4&&(M=h(M)),w[x]=w[x-d]^M}return w}function expandKeyDecLE$1(e){const t=expandKeyLE$1(e),a=t.slice(),u=t.length,{sbox2:d}=tableEncoding$1,{T0:h,T1:w,T2:x,T3:M}=tableDecoding$1;for(let B=0;B<u;B+=4)for(let E=0;E<4;E++)a[B+E]=t[u-B-4+E];t.fill(0);for(let B=4;B<u-4;B++){const E=a[B],S=applySbox$1(d,E,E,E,E);a[B]=h[S&255]^w[S>>>8&255]^x[S>>>16&255]^M[S>>>24]}return a}function apply0123$1(e,t,a,u,d,h){return e[a<<8&65280|u>>>8&255]^t[d>>>8&65280|h>>>24&255]}function applySbox$1(e,t,a,u,d){return e[t&255|a&65280]|e[u>>>16&255|d>>>16&65280]<<16}function encrypt$2(e,t,a,u,d){const{sbox2:h,T01:w,T23:x}=tableEncoding$1;let M=0;t^=e[M++],a^=e[M++],u^=e[M++],d^=e[M++];const B=e.length/4-2;for(let q=0;q<B;q++){const O=e[M++]^apply0123$1(w,x,t,a,u,d),U=e[M++]^apply0123$1(w,x,a,u,d,t),P=e[M++]^apply0123$1(w,x,u,d,t,a),L=e[M++]^apply0123$1(w,x,d,t,a,u);t=O,a=U,u=P,d=L}const E=e[M++]^applySbox$1(h,t,a,u,d),S=e[M++]^applySbox$1(h,a,u,d,t),k=e[M++]^applySbox$1(h,u,d,t,a),C=e[M++]^applySbox$1(h,d,t,a,u);return{s0:E,s1:S,s2:k,s3:C}}function decrypt$3(e,t,a,u,d){const{sbox2:h,T01:w,T23:x}=tableDecoding$1;let M=0;t^=e[M++],a^=e[M++],u^=e[M++],d^=e[M++];const B=e.length/4-2;for(let q=0;q<B;q++){const O=e[M++]^apply0123$1(w,x,t,d,u,a),U=e[M++]^apply0123$1(w,x,a,t,d,u),P=e[M++]^apply0123$1(w,x,u,a,t,d),L=e[M++]^apply0123$1(w,x,d,u,a,t);t=O,a=U,u=P,d=L}const E=e[M++]^applySbox$1(h,t,d,u,a),S=e[M++]^applySbox$1(h,a,t,d,u),k=e[M++]^applySbox$1(h,u,a,t,d),C=e[M++]^applySbox$1(h,d,u,a,t);return{s0:E,s1:S,s2:k,s3:C}}function getDst$1(e,t){if(!t)return new Uint8Array(e);if(bytes$1(t),t.length<e)throw new Error(`aes: wrong destination length, expected at least ${e}, got: ${t.length}`);return t}function validateBlockDecrypt$1(e){if(bytes$1(e),e.length%BLOCK_SIZE$1!==0)throw new Error(`aes/(cbc-ecb).decrypt ciphertext should consist of blocks with size ${BLOCK_SIZE$1}`)}function validateBlockEncrypt$1(e,t,a){let u=e.length;const d=u%BLOCK_SIZE$1;if(!t&&d!==0)throw new Error("aec/(cbc-ecb): unpadded plaintext with disabled padding");const h=u32$1(e);if(t){let M=BLOCK_SIZE$1-d;M||(M=BLOCK_SIZE$1),u=u+M}const w=getDst$1(u,a),x=u32$1(w);return{b:h,o:x,out:w}}function validatePCKS$1(e,t){if(!t)return e;const a=e.length;if(!a)throw new Error("aes/pcks5: empty ciphertext not allowed");const u=e[a-1];if(u<=0||u>16)throw new Error(`aes/pcks5: wrong padding byte: ${u}`);const d=e.subarray(0,-u);for(let h=0;h<u;h++)if(e[a-h-1]!==u)throw new Error("aes/pcks5: wrong padding");return d}function padPCKS$1(e){const t=new Uint8Array(16),a=u32$1(t);t.set(e);const u=BLOCK_SIZE$1-e.length;for(let d=BLOCK_SIZE$1-u;d<BLOCK_SIZE$1;d++)t[d]=u;return a}const cbc$3=wrapCipher$1({blockSize:16,nonceLength:16},function(t,a,u={}){bytes$1(t),bytes$1(a,16);const d=!u.disablePadding;return{encrypt:(h,w)=>{const x=expandKeyLE$1(t),{b:M,o:B,out:E}=validateBlockEncrypt$1(h,d,w),S=u32$1(a);let k=S[0],C=S[1],q=S[2],O=S[3],U=0;for(;U+4<=M.length;)k^=M[U+0],C^=M[U+1],q^=M[U+2],O^=M[U+3],{s0:k,s1:C,s2:q,s3:O}=encrypt$2(x,k,C,q,O),B[U++]=k,B[U++]=C,B[U++]=q,B[U++]=O;if(d){const P=padPCKS$1(h.subarray(U*4));k^=P[0],C^=P[1],q^=P[2],O^=P[3],{s0:k,s1:C,s2:q,s3:O}=encrypt$2(x,k,C,q,O),B[U++]=k,B[U++]=C,B[U++]=q,B[U++]=O}return x.fill(0),E},decrypt:(h,w)=>{validateBlockDecrypt$1(h);const x=expandKeyDecLE$1(t),M=u32$1(a),B=getDst$1(h.length,w),E=u32$1(h),S=u32$1(B);let k=M[0],C=M[1],q=M[2],O=M[3];for(let U=0;U+4<=E.length;){const P=k,L=C,J=q,Y=O;k=E[U+0],C=E[U+1],q=E[U+2],O=E[U+3];const{s0:ae,s1:oe,s2:ue,s3:se}=decrypt$3(x,k,C,q,O);S[U++]=ae^P,S[U++]=oe^L,S[U++]=ue^J,S[U++]=se^Y}return x.fill(0),validatePCKS$1(B,d)}}}),_utf8ToBytes$1=e=>Uint8Array.from(e.split("").map(t=>t.charCodeAt(0))),sigma16$1=_utf8ToBytes$1("expand 16-byte k"),sigma32$1=_utf8ToBytes$1("expand 32-byte k"),sigma16_32$1=u32$1(sigma16$1),sigma32_32$1=u32$1(sigma32$1);sigma32_32$1.slice();function rotl$3(e,t){return e<<t|e>>>32-t}function isAligned32$1(e){return e.byteOffset%4===0}const BLOCK_LEN$1=64,BLOCK_LEN32$1=16,MAX_COUNTER$1=2**32-1,U32_EMPTY$1=new Uint32Array;function runCipher$1(e,t,a,u,d,h,w,x){const M=d.length,B=new Uint8Array(BLOCK_LEN$1),E=u32$1(B),S=isAligned32$1(d)&&isAligned32$1(h),k=S?u32$1(d):U32_EMPTY$1,C=S?u32$1(h):U32_EMPTY$1;for(let q=0;q<M;w++){if(e(t,a,u,E,w,x),w>=MAX_COUNTER$1)throw new Error("arx: counter overflow");const O=Math.min(BLOCK_LEN$1,M-q);if(S&&O===BLOCK_LEN$1){const U=q/4;if(q%4!==0)throw new Error("arx: invalid block position");for(let P=0,L;P<BLOCK_LEN32$1;P++)L=U+P,C[L]=k[L]^E[P];q+=BLOCK_LEN$1;continue}for(let U=0,P;U<O;U++)P=q+U,h[P]=d[P]^B[U];q+=O}}function createCipher$3(e,t){const{allowShortKeys:a,extendNonceFn:u,counterLength:d,counterRight:h,rounds:w}=checkOpts$1({allowShortKeys:!1,counterLength:8,counterRight:!1,rounds:20},t);if(typeof e!="function")throw new Error("core must be a function");return number$1(d),number$1(w),bool$1(h),bool$1(a),(x,M,B,E,S=0)=>{bytes$1(x),bytes$1(M),bytes$1(B);const k=B.length;if(E||(E=new Uint8Array(k)),bytes$1(E),number$1(S),S<0||S>=MAX_COUNTER$1)throw new Error("arx: counter overflow");if(E.length<k)throw new Error(`arx: output (${E.length}) is shorter than data (${k})`);const C=[];let q=x.length,O,U;if(q===32)O=x.slice(),C.push(O),U=sigma32_32$1;else if(q===16&&a)O=new Uint8Array(32),O.set(x),O.set(x,16),U=sigma16_32$1,C.push(O);else throw new Error(`arx: invalid 32-byte key, got length=${q}`);isAligned32$1(M)||(M=M.slice(),C.push(M));const P=u32$1(O);if(u){if(M.length!==24)throw new Error("arx: extended nonce must be 24 bytes");u(U,P,u32$1(M.subarray(0,16)),P),M=M.subarray(16)}const L=16-d;if(L!==M.length)throw new Error(`arx: nonce must be ${L} or 16 bytes`);if(L!==12){const Y=new Uint8Array(12);Y.set(M,h?0:12-M.length),M=Y,C.push(M)}const J=u32$1(M);for(runCipher$1(e,U,P,J,B,E,S,w);C.length>0;)C.pop().fill(0);return E}}function chachaCore$1(e,t,a,u,d,h=20){let w=e[0],x=e[1],M=e[2],B=e[3],E=t[0],S=t[1],k=t[2],C=t[3],q=t[4],O=t[5],U=t[6],P=t[7],L=d,J=a[0],Y=a[1],ae=a[2],oe=w,ue=x,se=M,ie=B,ce=E,$=S,n=k,l=C,c=q,p=O,y=U,b=P,_=L,v=J,o=Y,m=ae;for(let I=0;I<h;I+=2)oe=oe+ce|0,_=rotl$3(_^oe,16),c=c+_|0,ce=rotl$3(ce^c,12),oe=oe+ce|0,_=rotl$3(_^oe,8),c=c+_|0,ce=rotl$3(ce^c,7),ue=ue+$|0,v=rotl$3(v^ue,16),p=p+v|0,$=rotl$3($^p,12),ue=ue+$|0,v=rotl$3(v^ue,8),p=p+v|0,$=rotl$3($^p,7),se=se+n|0,o=rotl$3(o^se,16),y=y+o|0,n=rotl$3(n^y,12),se=se+n|0,o=rotl$3(o^se,8),y=y+o|0,n=rotl$3(n^y,7),ie=ie+l|0,m=rotl$3(m^ie,16),b=b+m|0,l=rotl$3(l^b,12),ie=ie+l|0,m=rotl$3(m^ie,8),b=b+m|0,l=rotl$3(l^b,7),oe=oe+$|0,m=rotl$3(m^oe,16),y=y+m|0,$=rotl$3($^y,12),oe=oe+$|0,m=rotl$3(m^oe,8),y=y+m|0,$=rotl$3($^y,7),ue=ue+n|0,_=rotl$3(_^ue,16),b=b+_|0,n=rotl$3(n^b,12),ue=ue+n|0,_=rotl$3(_^ue,8),b=b+_|0,n=rotl$3(n^b,7),se=se+l|0,v=rotl$3(v^se,16),c=c+v|0,l=rotl$3(l^c,12),se=se+l|0,v=rotl$3(v^se,8),c=c+v|0,l=rotl$3(l^c,7),ie=ie+ce|0,o=rotl$3(o^ie,16),p=p+o|0,ce=rotl$3(ce^p,12),ie=ie+ce|0,o=rotl$3(o^ie,8),p=p+o|0,ce=rotl$3(ce^p,7);let A=0;u[A++]=w+oe|0,u[A++]=x+ue|0,u[A++]=M+se|0,u[A++]=B+ie|0,u[A++]=E+ce|0,u[A++]=S+$|0,u[A++]=k+n|0,u[A++]=C+l|0,u[A++]=q+c|0,u[A++]=O+p|0,u[A++]=U+y|0,u[A++]=P+b|0,u[A++]=L+_|0,u[A++]=J+v|0,u[A++]=Y+o|0,u[A++]=ae+m|0}const chacha20$1=createCipher$3(chachaCore$1,{counterRight:!1,counterLength:4,allowShortKeys:!1});let HMAC$1=class extends Hash$9{constructor(t,a){super(),this.finished=!1,this.destroyed=!1,assert$k.hash(t);const u=toBytes$1(a);if(this.iHash=t.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const d=this.blockLen,h=new Uint8Array(d);h.set(u.length>d?t.create().update(u).digest():u);for(let w=0;w<h.length;w++)h[w]^=54;this.iHash.update(h),this.oHash=t.create();for(let w=0;w<h.length;w++)h[w]^=106;this.oHash.update(h),h.fill(0)}update(t){return assert$k.exists(this),this.iHash.update(t),this}digestInto(t){assert$k.exists(this),assert$k.bytes(t,this.outputLen),this.finished=!0,this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){const t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||(t=Object.create(Object.getPrototypeOf(this),{}));const{oHash:a,iHash:u,finished:d,destroyed:h,blockLen:w,outputLen:x}=this;return t=t,t.finished=d,t.destroyed=h,t.blockLen=w,t.outputLen=x,t.oHash=a._cloneInto(t.oHash),t.iHash=u._cloneInto(t.iHash),t}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}};const hmac$2=(e,t,a)=>new HMAC$1(e,t).update(a).digest();hmac$2.create=(e,t)=>new HMAC$1(e,t);function extract$1(e,t,a){return assert$k.hash(e),hmac$2(e,toBytes$1(a),toBytes$1(t))}const HKDF_COUNTER$1=new Uint8Array([0]),EMPTY_BUFFER$1=new Uint8Array;function expand$1(e,t,a,u=32){if(assert$k.hash(e),assert$k.number(u),u>255*e.outputLen)throw new Error("Length should be <= 255*HashLen");const d=Math.ceil(u/e.outputLen);a===void 0&&(a=EMPTY_BUFFER$1);const h=new Uint8Array(d*e.outputLen),w=hmac$2.create(e,t),x=w._cloneInto(),M=new Uint8Array(w.outputLen);for(let B=0;B<d;B++)HKDF_COUNTER$1[0]=B+1,x.update(B===0?EMPTY_BUFFER$1:M).update(a).update(HKDF_COUNTER$1).digestInto(M),h.set(M,e.outputLen*B),w._cloneInto(x);return w.destroy(),x.destroy(),M.fill(0),HKDF_COUNTER$1.fill(0),h.slice(0,u)}var __defProp$1=Object.defineProperty,__export$1=(e,t)=>{for(var a in t)__defProp$1(e,a,{get:t[a],enumerable:!0})},verifiedSymbol$1=Symbol("verified"),isRecord$1=e=>e instanceof Object;function validateEvent$1(e){if(!isRecord$1(e)||typeof e.kind!="number"||typeof e.content!="string"||typeof e.created_at!="number"||typeof e.pubkey!="string"||!e.pubkey.match(/^[a-f0-9]{64}$/)||!Array.isArray(e.tags))return!1;for(let t=0;t<e.tags.length;t++){let a=e.tags[t];if(!Array.isArray(a))return!1;for(let u=0;u<a.length;u++)if(typeof a[u]!="string")return!1}return!0}var utils_exports$1={};__export$1(utils_exports$1,{Queue:()=>Queue$1,QueueNode:()=>QueueNode$1,binarySearch:()=>binarySearch$1,bytesToHex:()=>bytesToHex$2,hexToBytes:()=>hexToBytes$2,insertEventIntoAscendingList:()=>insertEventIntoAscendingList$1,insertEventIntoDescendingList:()=>insertEventIntoDescendingList$1,normalizeURL:()=>normalizeURL$1,utf8Decoder:()=>utf8Decoder,utf8Encoder:()=>utf8Encoder$1});var utf8Decoder=new TextDecoder("utf-8"),utf8Encoder$1=new TextEncoder;function normalizeURL$1(e){try{e.indexOf("://")===-1&&(e="wss://"+e);let t=new URL(e);return t.protocol==="http:"?t.protocol="ws:":t.protocol==="https:"&&(t.protocol="wss:"),t.pathname=t.pathname.replace(/\/+/g,"/"),t.pathname.endsWith("/")&&(t.pathname=t.pathname.slice(0,-1)),(t.port==="80"&&t.protocol==="ws:"||t.port==="443"&&t.protocol==="wss:")&&(t.port=""),t.searchParams.sort(),t.hash="",t.toString()}catch{throw new Error(`Invalid URL: ${e}`)}}function insertEventIntoDescendingList$1(e,t){const[a,u]=binarySearch$1(e,d=>t.id===d.id?0:t.created_at===d.created_at?-1:d.created_at-t.created_at);return u||e.splice(a,0,t),e}function insertEventIntoAscendingList$1(e,t){const[a,u]=binarySearch$1(e,d=>t.id===d.id?0:t.created_at===d.created_at?-1:t.created_at-d.created_at);return u||e.splice(a,0,t),e}function binarySearch$1(e,t){let a=0,u=e.length-1;for(;a<=u;){const d=Math.floor((a+u)/2),h=t(e[d]);if(h===0)return[d,!0];h<0?u=d-1:a=d+1}return[a,!1]}var QueueNode$1=class{constructor(t){$e(this,"value");$e(this,"next",null);$e(this,"prev",null);this.value=t}},Queue$1=class{constructor(){$e(this,"first");$e(this,"last");this.first=null,this.last=null}enqueue(t){const a=new QueueNode$1(t);return this.last?this.last===this.first?(this.last=a,this.last.prev=this.first,this.first.next=a):(a.prev=this.last,this.last.next=a,this.last=a):(this.first=a,this.last=a),!0}dequeue(){if(!this.first)return null;if(this.first===this.last){const a=this.first;return this.first=null,this.last=null,a.value}const t=this.first;return this.first=t.next,this.first&&(this.first.prev=null),t.value}},JS$1=class{generateSecretKey(){return schnorr$1.utils.randomPrivateKey()}getPublicKey(t){return bytesToHex$2(schnorr$1.getPublicKey(t))}finalizeEvent(t,a){const u=t;return u.pubkey=bytesToHex$2(schnorr$1.getPublicKey(a)),u.id=getEventHash$1(u),u.sig=bytesToHex$2(schnorr$1.sign(getEventHash$1(u),a)),u[verifiedSymbol$1]=!0,u}verifyEvent(t){if(typeof t[verifiedSymbol$1]=="boolean")return t[verifiedSymbol$1];const a=getEventHash$1(t);if(a!==t.id)return t[verifiedSymbol$1]=!1,!1;try{const u=schnorr$1.verify(t.sig,a,t.pubkey);return t[verifiedSymbol$1]=u,u}catch{return t[verifiedSymbol$1]=!1,!1}}};function serializeEvent$1(e){if(!validateEvent$1(e))throw new Error("can't serialize event with wrong or missing properties");return JSON.stringify([0,e.pubkey,e.created_at,e.kind,e.tags,e.content])}function getEventHash$1(e){let t=sha256$3(utf8Encoder$1.encode(serializeEvent$1(e)));return bytesToHex$2(t)}var i$1=new JS$1,generateSecretKey=i$1.generateSecretKey,getPublicKey=i$1.getPublicKey,finalizeEvent=i$1.finalizeEvent,verifyEvent=i$1.verifyEvent,kinds_exports$1={};__export$1(kinds_exports$1,{Application:()=>Application$1,BadgeAward:()=>BadgeAward$1,BadgeDefinition:()=>BadgeDefinition$1,BlockedRelaysList:()=>BlockedRelaysList$1,BlossomServerList:()=>BlossomServerList$1,BookmarkList:()=>BookmarkList$1,Bookmarksets:()=>Bookmarksets$1,Calendar:()=>Calendar$1,CalendarEventRSVP:()=>CalendarEventRSVP$1,ChannelCreation:()=>ChannelCreation$1,ChannelHideMessage:()=>ChannelHideMessage$1,ChannelMessage:()=>ChannelMessage$1,ChannelMetadata:()=>ChannelMetadata$1,ChannelMuteUser:()=>ChannelMuteUser$1,ChatMessage:()=>ChatMessage$1,ClassifiedListing:()=>ClassifiedListing$1,ClientAuth:()=>ClientAuth$1,Comment:()=>Comment$1,CommunitiesList:()=>CommunitiesList$1,CommunityDefinition:()=>CommunityDefinition$1,CommunityPostApproval:()=>CommunityPostApproval$1,Contacts:()=>Contacts$1,CreateOrUpdateProduct:()=>CreateOrUpdateProduct$1,CreateOrUpdateStall:()=>CreateOrUpdateStall$1,Curationsets:()=>Curationsets$1,Date:()=>Date2$1,DirectMessageRelaysList:()=>DirectMessageRelaysList$1,DraftClassifiedListing:()=>DraftClassifiedListing$1,DraftLong:()=>DraftLong$1,Emojisets:()=>Emojisets$1,EncryptedDirectMessage:()=>EncryptedDirectMessage$1,EventDeletion:()=>EventDeletion$1,FavoriteRelays:()=>FavoriteRelays$1,FileMessage:()=>FileMessage$1,FileMetadata:()=>FileMetadata$1,FileServerPreference:()=>FileServerPreference$1,Followsets:()=>Followsets$1,ForumThread:()=>ForumThread$1,GenericRepost:()=>GenericRepost$1,Genericlists:()=>Genericlists$1,GiftWrap:()=>GiftWrap$1,GroupMetadata:()=>GroupMetadata$1,HTTPAuth:()=>HTTPAuth$1,Handlerinformation:()=>Handlerinformation$1,Handlerrecommendation:()=>Handlerrecommendation$1,Highlights:()=>Highlights$1,InterestsList:()=>InterestsList$1,Interestsets:()=>Interestsets$1,JobFeedback:()=>JobFeedback$1,JobRequest:()=>JobRequest$1,JobResult:()=>JobResult$1,Label:()=>Label$1,LightningPubRPC:()=>LightningPubRPC$1,LiveChatMessage:()=>LiveChatMessage$1,LiveEvent:()=>LiveEvent$1,LongFormArticle:()=>LongFormArticle$1,Metadata:()=>Metadata$1,Mutelist:()=>Mutelist$1,NWCWalletInfo:()=>NWCWalletInfo$1,NWCWalletRequest:()=>NWCWalletRequest$1,NWCWalletResponse:()=>NWCWalletResponse$1,NormalVideo:()=>NormalVideo$1,NostrConnect:()=>NostrConnect$1,OpenTimestamps:()=>OpenTimestamps$1,Photo:()=>Photo$1,Pinlist:()=>Pinlist$1,Poll:()=>Poll$1,PollResponse:()=>PollResponse$1,PrivateDirectMessage:()=>PrivateDirectMessage$1,ProblemTracker:()=>ProblemTracker$1,ProfileBadges:()=>ProfileBadges$1,PublicChatsList:()=>PublicChatsList$1,Reaction:()=>Reaction$1,RecommendRelay:()=>RecommendRelay$1,RelayList:()=>RelayList$1,RelayReview:()=>RelayReview$1,Relaysets:()=>Relaysets$1,Report:()=>Report$1,Reporting:()=>Reporting$1,Repost:()=>Repost$1,Seal:()=>Seal$1,SearchRelaysList:()=>SearchRelaysList$1,ShortTextNote:()=>ShortTextNote$1,ShortVideo:()=>ShortVideo$1,Time:()=>Time$2,UserEmojiList:()=>UserEmojiList$1,UserStatuses:()=>UserStatuses$1,Voice:()=>Voice$1,VoiceComment:()=>VoiceComment$1,Zap:()=>Zap$1,ZapGoal:()=>ZapGoal$1,ZapRequest:()=>ZapRequest$1,classifyKind:()=>classifyKind$1,isAddressableKind:()=>isAddressableKind$1,isEphemeralKind:()=>isEphemeralKind$1,isKind:()=>isKind$1,isRegularKind:()=>isRegularKind$1,isReplaceableKind:()=>isReplaceableKind$1});function isRegularKind$1(e){return e<1e4&&e!==0&&e!==3}function isReplaceableKind$1(e){return e===0||e===3||1e4<=e&&e<2e4}function isEphemeralKind$1(e){return 2e4<=e&&e<3e4}function isAddressableKind$1(e){return 3e4<=e&&e<4e4}function classifyKind$1(e){return isRegularKind$1(e)?"regular":isReplaceableKind$1(e)?"replaceable":isEphemeralKind$1(e)?"ephemeral":isAddressableKind$1(e)?"parameterized":"unknown"}function isKind$1(e,t){const a=t instanceof Array?t:[t];return validateEvent$1(e)&&a.includes(e.kind)||!1}var Metadata$1=0,ShortTextNote$1=1,RecommendRelay$1=2,Contacts$1=3,EncryptedDirectMessage$1=4,EventDeletion$1=5,Repost$1=6,Reaction$1=7,BadgeAward$1=8,ChatMessage$1=9,ForumThread$1=11,Seal$1=13,PrivateDirectMessage$1=14,FileMessage$1=15,GenericRepost$1=16,Photo$1=20,NormalVideo$1=21,ShortVideo$1=22,ChannelCreation$1=40,ChannelMetadata$1=41,ChannelMessage$1=42,ChannelHideMessage$1=43,ChannelMuteUser$1=44,OpenTimestamps$1=1040,GiftWrap$1=1059,Poll$1=1068,FileMetadata$1=1063,Comment$1=1111,LiveChatMessage$1=1311,Voice$1=1222,VoiceComment$1=1244,ProblemTracker$1=1971,Report$1=1984,Reporting$1=1984,Label$1=1985,CommunityPostApproval$1=4550,JobRequest$1=5999,JobResult$1=6999,JobFeedback$1=7e3,ZapGoal$1=9041,ZapRequest$1=9734,Zap$1=9735,Highlights$1=9802,PollResponse$1=1018,Mutelist$1=1e4,Pinlist$1=10001,RelayList$1=10002,BookmarkList$1=10003,CommunitiesList$1=10004,PublicChatsList$1=10005,BlockedRelaysList$1=10006,SearchRelaysList$1=10007,FavoriteRelays$1=10012,InterestsList$1=10015,UserEmojiList$1=10030,DirectMessageRelaysList$1=10050,FileServerPreference$1=10096,BlossomServerList$1=10063,NWCWalletInfo$1=13194,LightningPubRPC$1=21e3,ClientAuth$1=22242,NWCWalletRequest$1=23194,NWCWalletResponse$1=23195,NostrConnect$1=24133,HTTPAuth$1=27235,Followsets$1=3e4,Genericlists$1=30001,Relaysets$1=30002,Bookmarksets$1=30003,Curationsets$1=30004,ProfileBadges$1=30008,BadgeDefinition$1=30009,Interestsets$1=30015,CreateOrUpdateStall$1=30017,CreateOrUpdateProduct$1=30018,LongFormArticle$1=30023,DraftLong$1=30024,Emojisets$1=30030,Application$1=30078,LiveEvent$1=30311,UserStatuses$1=30315,ClassifiedListing$1=30402,DraftClassifiedListing$1=30403,Date2$1=31922,Time$2=31923,Calendar$1=31924,CalendarEventRSVP$1=31925,RelayReview$1=31987,Handlerrecommendation$1=31989,Handlerinformation$1=31990,CommunityDefinition$1=34550,GroupMetadata$1=39e3;function matchFilter$1(e,t){if(e.ids&&e.ids.indexOf(t.id)===-1||e.kinds&&e.kinds.indexOf(t.kind)===-1||e.authors&&e.authors.indexOf(t.pubkey)===-1)return!1;for(let a in e)if(a[0]==="#"){let u=a.slice(1),d=e[`#${u}`];if(d&&!t.tags.find(([h,w])=>h===a.slice(1)&&d.indexOf(w)!==-1))return!1}return!(e.since&&t.created_at<e.since||e.until&&t.created_at>e.until)}function matchFilters$1(e,t){for(let a=0;a<e.length;a++)if(matchFilter$1(e[a],t))return!0;return!1}var fakejson_exports$1={};__export$1(fakejson_exports$1,{getHex64:()=>getHex64$1,getInt:()=>getInt$1,getSubscriptionId:()=>getSubscriptionId$1,matchEventId:()=>matchEventId$1,matchEventKind:()=>matchEventKind$1,matchEventPubkey:()=>matchEventPubkey$1});function getHex64$1(e,t){let a=t.length+3,u=e.indexOf(`"${t}":`)+a,d=e.slice(u).indexOf('"')+u+1;return e.slice(d,d+64)}function getInt$1(e,t){let a=t.length,u=e.indexOf(`"${t}":`)+a+3,d=e.slice(u),h=Math.min(d.indexOf(","),d.indexOf("}"));return parseInt(d.slice(0,h),10)}function getSubscriptionId$1(e){let t=e.slice(0,22).indexOf('"EVENT"');if(t===-1)return null;let a=e.slice(t+7+1).indexOf('"');if(a===-1)return null;let u=t+7+1+a,d=e.slice(u+1,80).indexOf('"');if(d===-1)return null;let h=u+1+d;return e.slice(u+1,h)}function matchEventId$1(e,t){return t===getHex64$1(e,"id")}function matchEventPubkey$1(e,t){return t===getHex64$1(e,"pubkey")}function matchEventKind$1(e,t){return t===getInt$1(e,"kind")}var nip42_exports$1={};__export$1(nip42_exports$1,{makeAuthEvent:()=>makeAuthEvent$1});function makeAuthEvent$1(e,t){return{kind:ClientAuth$1,created_at:Math.floor(Date.now()/1e3),tags:[["relay",e],["challenge",t]],content:""}}async function yieldThread$1(){return new Promise((e,t)=>{try{if(typeof MessageChannel<"u"){const a=new MessageChannel,u=()=>{a.port1.removeEventListener("message",u),e()};a.port1.addEventListener("message",u),a.port2.postMessage(0),a.port1.start()}else typeof setImmediate<"u"?setImmediate(e):typeof setTimeout<"u"?setTimeout(e,0):e()}catch(a){console.error("during yield: ",a),t(a)}})}var alwaysTrue$1=e=>(e[verifiedSymbol$1]=!0,!0),SendingOnClosedConnection$1=class extends Error{constructor(t,a){super(`Tried to send message '${t} on a closed connection to ${a}.`),this.name="SendingOnClosedConnection"}},AbstractRelay$1=class{constructor(t,a){$e(this,"url");$e(this,"_connected",!1);$e(this,"onclose",null);$e(this,"onnotice",t=>console.debug(`NOTICE from ${this.url}: ${t}`));$e(this,"onauth");$e(this,"baseEoseTimeout",4400);$e(this,"connectionTimeout",4400);$e(this,"publishTimeout",4400);$e(this,"pingFrequency",29e3);$e(this,"pingTimeout",2e4);$e(this,"resubscribeBackoff",[1e4,1e4,1e4,2e4,2e4,3e4,6e4]);$e(this,"openSubs",new Map);$e(this,"enablePing");$e(this,"enableReconnect");$e(this,"connectionTimeoutHandle");$e(this,"reconnectTimeoutHandle");$e(this,"pingIntervalHandle");$e(this,"reconnectAttempts",0);$e(this,"closedIntentionally",!1);$e(this,"connectionPromise");$e(this,"openCountRequests",new Map);$e(this,"openEventPublishes",new Map);$e(this,"ws");$e(this,"incomingMessageQueue",new Queue$1);$e(this,"queueRunning",!1);$e(this,"challenge");$e(this,"authPromise");$e(this,"serial",0);$e(this,"verifyEvent");$e(this,"_WebSocket");this.url=normalizeURL$1(t),this.verifyEvent=a.verifyEvent,this._WebSocket=a.websocketImplementation||WebSocket,this.enablePing=a.enablePing,this.enableReconnect=a.enableReconnect||!1}static async connect(t,a){const u=new AbstractRelay$1(t,a);return await u.connect(),u}closeAllSubscriptions(t){for(let[a,u]of this.openSubs)u.close(t);this.openSubs.clear();for(let[a,u]of this.openEventPublishes)u.reject(new Error(t));this.openEventPublishes.clear();for(let[a,u]of this.openCountRequests)u.reject(new Error(t));this.openCountRequests.clear()}get connected(){return this._connected}async reconnect(){const t=this.resubscribeBackoff[Math.min(this.reconnectAttempts,this.resubscribeBackoff.length-1)];this.reconnectAttempts++,this.reconnectTimeoutHandle=setTimeout(async()=>{try{await this.connect()}catch{}},t)}handleHardClose(t){var u;this.pingIntervalHandle&&(clearInterval(this.pingIntervalHandle),this.pingIntervalHandle=void 0),this._connected=!1,this.connectionPromise=void 0;const a=this.closedIntentionally;this.closedIntentionally=!1,(u=this.onclose)==null||u.call(this),this.enableReconnect&&!a?this.reconnect():this.closeAllSubscriptions(t)}async connect(){return this.connectionPromise?this.connectionPromise:(this.challenge=void 0,this.authPromise=void 0,this.connectionPromise=new Promise((t,a)=>{this.connectionTimeoutHandle=setTimeout(()=>{var u;a("connection timed out"),this.connectionPromise=void 0,(u=this.onclose)==null||u.call(this),this.closeAllSubscriptions("relay connection timed out")},this.connectionTimeout);try{this.ws=new this._WebSocket(this.url)}catch(u){clearTimeout(this.connectionTimeoutHandle),a(u);return}this.ws.onopen=()=>{this.reconnectTimeoutHandle&&(clearTimeout(this.reconnectTimeoutHandle),this.reconnectTimeoutHandle=void 0),clearTimeout(this.connectionTimeoutHandle),this._connected=!0;const u=this.reconnectAttempts>0;this.reconnectAttempts=0;for(const d of this.openSubs.values()){if(d.eosed=!1,u)for(let h=0;h<d.filters.length;h++)d.lastEmitted&&(d.filters[h].since=d.lastEmitted+1);d.fire()}this.enablePing&&(this.pingIntervalHandle=setInterval(()=>this.pingpong(),this.pingFrequency)),t()},this.ws.onerror=u=>{clearTimeout(this.connectionTimeoutHandle),a(u.message||"websocket error"),this.handleHardClose("relay connection errored")},this.ws.onclose=u=>{clearTimeout(this.connectionTimeoutHandle),a(u.message||"websocket closed"),this.handleHardClose("relay connection closed")},this.ws.onmessage=this._onmessage.bind(this)}),this.connectionPromise)}waitForPingPong(){return new Promise(t=>{this.ws.once("pong",()=>t(!0)),this.ws.ping()})}waitForDummyReq(){return new Promise((t,a)=>{if(!this.connectionPromise)return a(new Error(`no connection to ${this.url}, can't ping`));try{const u=this.subscribe([{ids:["aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"],limit:0}],{label:"forced-ping",oneose:()=>{t(!0),u.close()},onclose(){t(!0)},eoseTimeout:this.pingTimeout+1e3})}catch(u){a(u)}})}async pingpong(){var t,a,u;((t=this.ws)==null?void 0:t.readyState)===1&&(await Promise.any([this.ws&&this.ws.ping&&this.ws.once?this.waitForPingPong():this.waitForDummyReq(),new Promise(h=>setTimeout(()=>h(!1),this.pingTimeout))])||((a=this.ws)==null?void 0:a.readyState)===this._WebSocket.OPEN&&((u=this.ws)==null||u.close()))}async runQueue(){for(this.queueRunning=!0;this.handleNext()!==!1;)await yieldThread$1();this.queueRunning=!1}handleNext(){var u,d,h;const t=this.incomingMessageQueue.dequeue();if(!t)return!1;const a=getSubscriptionId$1(t);if(a){const w=this.openSubs.get(a);if(!w)return;const x=getHex64$1(t,"id"),M=(u=w.alreadyHaveEvent)==null?void 0:u.call(w,x);if((d=w.receivedEvent)==null||d.call(w,this,x),M)return}try{let w=JSON.parse(t);switch(w[0]){case"EVENT":{const x=this.openSubs.get(w[1]),M=w[2];this.verifyEvent(M)&&matchFilters$1(x.filters,M)&&x.onevent(M),(!x.lastEmitted||x.lastEmitted<M.created_at)&&(x.lastEmitted=M.created_at);return}case"COUNT":{const x=w[1],M=w[2],B=this.openCountRequests.get(x);B&&(B.resolve(M.count),this.openCountRequests.delete(x));return}case"EOSE":{const x=this.openSubs.get(w[1]);if(!x)return;x.receivedEose();return}case"OK":{const x=w[1],M=w[2],B=w[3],E=this.openEventPublishes.get(x);E&&(clearTimeout(E.timeout),M?E.resolve(B):E.reject(new Error(B)),this.openEventPublishes.delete(x));return}case"CLOSED":{const x=w[1],M=this.openSubs.get(x);if(!M)return;M.closed=!0,M.close(w[2]);return}case"NOTICE":{this.onnotice(w[1]);return}case"AUTH":{this.challenge=w[1],this.onauth&&this.auth(this.onauth);return}default:{const x=this.openSubs.get(w[1]);(h=x==null?void 0:x.oncustom)==null||h.call(x,w);return}}}catch{return}}async send(t){if(!this.connectionPromise)throw new SendingOnClosedConnection$1(t,this.url);this.connectionPromise.then(()=>{var a;(a=this.ws)==null||a.send(t)})}async auth(t){const a=this.challenge;if(!a)throw new Error("can't perform auth, no challenge was received");return this.authPromise?this.authPromise:(this.authPromise=new Promise(async(u,d)=>{try{let h=await t(makeAuthEvent$1(this.url,a)),w=setTimeout(()=>{let x=this.openEventPublishes.get(h.id);x&&(x.reject(new Error("auth timed out")),this.openEventPublishes.delete(h.id))},this.publishTimeout);this.openEventPublishes.set(h.id,{resolve:u,reject:d,timeout:w}),this.send('["AUTH",'+JSON.stringify(h)+"]")}catch(h){console.warn("subscribe auth function failed:",h)}}),this.authPromise)}async publish(t){const a=new Promise((u,d)=>{const h=setTimeout(()=>{const w=this.openEventPublishes.get(t.id);w&&(w.reject(new Error("publish timed out")),this.openEventPublishes.delete(t.id))},this.publishTimeout);this.openEventPublishes.set(t.id,{resolve:u,reject:d,timeout:h})});return this.send('["EVENT",'+JSON.stringify(t)+"]"),a}async count(t,a){this.serial++;const u=(a==null?void 0:a.id)||"count:"+this.serial,d=new Promise((h,w)=>{this.openCountRequests.set(u,{resolve:h,reject:w})});return this.send('["COUNT","'+u+'",'+JSON.stringify(t).substring(1)),d}subscribe(t,a){const u=this.prepareSubscription(t,a);return u.fire(),u}prepareSubscription(t,a){this.serial++;const u=a.id||(a.label?a.label+":":"sub:")+this.serial,d=new Subscription$1(this,u,t,a);return this.openSubs.set(u,d),d}close(){var t,a,u;this.closedIntentionally=!0,this.reconnectTimeoutHandle&&(clearTimeout(this.reconnectTimeoutHandle),this.reconnectTimeoutHandle=void 0),this.pingIntervalHandle&&(clearInterval(this.pingIntervalHandle),this.pingIntervalHandle=void 0),this.closeAllSubscriptions("relay connection closed by us"),this._connected=!1,(t=this.onclose)==null||t.call(this),((a=this.ws)==null?void 0:a.readyState)===this._WebSocket.OPEN&&((u=this.ws)==null||u.close())}_onmessage(t){this.incomingMessageQueue.enqueue(t.data),this.queueRunning||this.runQueue()}},Subscription$1=class{constructor(t,a,u,d){$e(this,"relay");$e(this,"id");$e(this,"lastEmitted");$e(this,"closed",!1);$e(this,"eosed",!1);$e(this,"filters");$e(this,"alreadyHaveEvent");$e(this,"receivedEvent");$e(this,"onevent");$e(this,"oneose");$e(this,"onclose");$e(this,"oncustom");$e(this,"eoseTimeout");$e(this,"eoseTimeoutHandle");if(u.length===0)throw new Error("subscription can't be created with zero filters");this.relay=t,this.filters=u,this.id=a,this.alreadyHaveEvent=d.alreadyHaveEvent,this.receivedEvent=d.receivedEvent,this.eoseTimeout=d.eoseTimeout||t.baseEoseTimeout,this.oneose=d.oneose,this.onclose=d.onclose,this.onevent=d.onevent||(h=>{console.warn(`onevent() callback not defined for subscription '${this.id}' in relay ${this.relay.url}. event received:`,h)})}fire(){this.relay.send('["REQ","'+this.id+'",'+JSON.stringify(this.filters).substring(1)),this.eoseTimeoutHandle=setTimeout(this.receivedEose.bind(this),this.eoseTimeout)}receivedEose(){var t;this.eosed||(clearTimeout(this.eoseTimeoutHandle),this.eosed=!0,(t=this.oneose)==null||t.call(this))}close(t="closed by caller"){var a;if(!this.closed&&this.relay.connected){try{this.relay.send('["CLOSE",'+JSON.stringify(this.id)+"]")}catch(u){if(!(u instanceof SendingOnClosedConnection$1))throw u}this.closed=!0}this.relay.openSubs.delete(this.id),(a=this.onclose)==null||a.call(this,t)}},_WebSocket$1;try{_WebSocket$1=WebSocket}catch{}var AbstractSimplePool$1=class{constructor(t){$e(this,"relays",new Map);$e(this,"seenOn",new Map);$e(this,"trackRelays",!1);$e(this,"verifyEvent");$e(this,"enablePing");$e(this,"enableReconnect");$e(this,"automaticallyAuth");$e(this,"trustedRelayURLs",new Set);$e(this,"_WebSocket");this.verifyEvent=t.verifyEvent,this._WebSocket=t.websocketImplementation,this.enablePing=t.enablePing,this.enableReconnect=t.enableReconnect||!1,this.automaticallyAuth=t.automaticallyAuth}async ensureRelay(t,a){t=normalizeURL$1(t);let u=this.relays.get(t);if(u||(u=new AbstractRelay$1(t,{verifyEvent:this.trustedRelayURLs.has(t)?alwaysTrue$1:this.verifyEvent,websocketImplementation:this._WebSocket,enablePing:this.enablePing,enableReconnect:this.enableReconnect}),u.onclose=()=>{u&&!u.enableReconnect&&this.relays.delete(t)},a!=null&&a.connectionTimeout&&(u.connectionTimeout=a.connectionTimeout),this.relays.set(t,u)),this.automaticallyAuth){const d=this.automaticallyAuth(t);d&&(u.onauth=d)}return await u.connect(),u}close(t){t.map(normalizeURL$1).forEach(a=>{var u;(u=this.relays.get(a))==null||u.close(),this.relays.delete(a)})}subscribe(t,a,u){const d=[];for(let h=0;h<t.length;h++){const w=normalizeURL$1(t[h]);d.find(x=>x.url===w)||d.push({url:w,filter:a})}return this.subscribeMap(d,u)}subscribeMany(t,a,u){const d=[],h=[];for(let w=0;w<t.length;w++){const x=normalizeURL$1(t[w]);h.indexOf(x)===-1&&(h.push(x),d.push({url:x,filter:a}))}return this.subscribeMap(d,u)}subscribeMap(t,a){const u=new Map;for(const C of t){const{url:q,filter:O}=C;u.has(q)||u.set(q,[]),u.get(q).push(O)}const d=Array.from(u.entries()).map(([C,q])=>({url:C,filters:q}));this.trackRelays&&(a.receivedEvent=(C,q)=>{let O=this.seenOn.get(q);O||(O=new Set,this.seenOn.set(q,O)),O.add(C)});const h=new Set,w=[],x=[];let M=C=>{var q;x[C]||(x[C]=!0,x.filter(O=>O).length===d.length&&((q=a.oneose)==null||q.call(a),M=()=>{}))};const B=[];let E=(C,q)=>{var O;B[C]||(M(C),B[C]=q,B.filter(U=>U).length===d.length&&((O=a.onclose)==null||O.call(a,B),E=()=>{}))};const S=C=>{var O;if((O=a.alreadyHaveEvent)!=null&&O.call(a,C))return!0;const q=h.has(C);return h.add(C),q},k=Promise.all(d.map(async({url:C,filters:q},O)=>{let U;try{U=await this.ensureRelay(C,{connectionTimeout:a.maxWait?Math.max(a.maxWait*.8,a.maxWait-1e3):void 0})}catch(L){E(O,(L==null?void 0:L.message)||String(L));return}let P=U.subscribe(q,{...a,oneose:()=>M(O),onclose:L=>{L.startsWith("auth-required: ")&&a.onauth?U.auth(a.onauth).then(()=>{U.subscribe(q,{...a,oneose:()=>M(O),onclose:J=>{E(O,J)},alreadyHaveEvent:S,eoseTimeout:a.maxWait})}).catch(J=>{E(O,`auth was required and attempted, but failed with: ${J}`)}):E(O,L)},alreadyHaveEvent:S,eoseTimeout:a.maxWait});w.push(P)}));return{async close(C){await k,w.forEach(q=>{q.close(C)})}}}subscribeEose(t,a,u){const d=this.subscribe(t,a,{...u,oneose(){d.close("closed automatically on eose")}});return d}subscribeManyEose(t,a,u){const d=this.subscribeMany(t,a,{...u,oneose(){d.close("closed automatically on eose")}});return d}async querySync(t,a,u){return new Promise(async d=>{const h=[];this.subscribeEose(t,a,{...u,onevent(w){h.push(w)},onclose(w){d(h)}})})}async get(t,a,u){a.limit=1;const d=await this.querySync(t,a,u);return d.sort((h,w)=>w.created_at-h.created_at),d[0]||null}publish(t,a,u){return t.map(normalizeURL$1).map(async(d,h,w)=>{if(w.indexOf(d)!==h)return Promise.reject("duplicate url");let x=await this.ensureRelay(d);return x.publish(a).catch(async M=>{if(M instanceof Error&&M.message.startsWith("auth-required: ")&&(u!=null&&u.onauth))return await x.auth(u.onauth),x.publish(a);throw M}).then(M=>{if(this.trackRelays){let B=this.seenOn.get(a.id);B||(B=new Set,this.seenOn.set(a.id,B)),B.add(x)}return M})})}listConnectionStatus(){const t=new Map;return this.relays.forEach((a,u)=>t.set(u,a.connected)),t}destroy(){this.relays.forEach(t=>t.close()),this.relays=new Map}},_WebSocket2$1;try{_WebSocket2$1=WebSocket}catch{}var SimplePool$1=class extends AbstractSimplePool$1{constructor(t){super({verifyEvent,websocketImplementation:_WebSocket2$1,...t})}},nip19_exports$1={};__export$1(nip19_exports$1,{BECH32_REGEX:()=>BECH32_REGEX$1,Bech32MaxSize:()=>Bech32MaxSize$1,NostrTypeGuard:()=>NostrTypeGuard$1,decode:()=>decode$1,decodeNostrURI:()=>decodeNostrURI$1,encodeBytes:()=>encodeBytes$1,naddrEncode:()=>naddrEncode$1,neventEncode:()=>neventEncode$1,noteEncode:()=>noteEncode$1,nprofileEncode:()=>nprofileEncode$1,npubEncode:()=>npubEncode$1,nsecEncode:()=>nsecEncode$1});var NostrTypeGuard$1={isNProfile:e=>/^nprofile1[a-z\d]+$/.test(e||""),isNEvent:e=>/^nevent1[a-z\d]+$/.test(e||""),isNAddr:e=>/^naddr1[a-z\d]+$/.test(e||""),isNSec:e=>/^nsec1[a-z\d]{58}$/.test(e||""),isNPub:e=>/^npub1[a-z\d]{58}$/.test(e||""),isNote:e=>/^note1[a-z\d]+$/.test(e||""),isNcryptsec:e=>/^ncryptsec1[a-z\d]+$/.test(e||"")},Bech32MaxSize$1=5e3,BECH32_REGEX$1=/[\x21-\x7E]{1,83}1[023456789acdefghjklmnpqrstuvwxyz]{6,}/;function integerToUint8Array$1(e){const t=new Uint8Array(4);return t[0]=e>>24&255,t[1]=e>>16&255,t[2]=e>>8&255,t[3]=e&255,t}function decodeNostrURI$1(e){try{return e.startsWith("nostr:")&&(e=e.substring(6)),decode$1(e)}catch{return{type:"invalid",data:null}}}function decode$1(e){var d,h,w,x,M,B,E;let{prefix:t,words:a}=bech32$1.decode(e,Bech32MaxSize$1),u=new Uint8Array(bech32$1.fromWords(a));switch(t){case"nprofile":{let S=parseTLV$1(u);if(!((d=S[0])!=null&&d[0]))throw new Error("missing TLV 0 for nprofile");if(S[0][0].length!==32)throw new Error("TLV 0 should be 32 bytes");return{type:"nprofile",data:{pubkey:bytesToHex$2(S[0][0]),relays:S[1]?S[1].map(k=>utf8Decoder.decode(k)):[]}}}case"nevent":{let S=parseTLV$1(u);if(!((h=S[0])!=null&&h[0]))throw new Error("missing TLV 0 for nevent");if(S[0][0].length!==32)throw new Error("TLV 0 should be 32 bytes");if(S[2]&&S[2][0].length!==32)throw new Error("TLV 2 should be 32 bytes");if(S[3]&&S[3][0].length!==4)throw new Error("TLV 3 should be 4 bytes");return{type:"nevent",data:{id:bytesToHex$2(S[0][0]),relays:S[1]?S[1].map(k=>utf8Decoder.decode(k)):[],author:(w=S[2])!=null&&w[0]?bytesToHex$2(S[2][0]):void 0,kind:(x=S[3])!=null&&x[0]?parseInt(bytesToHex$2(S[3][0]),16):void 0}}}case"naddr":{let S=parseTLV$1(u);if(!((M=S[0])!=null&&M[0]))throw new Error("missing TLV 0 for naddr");if(!((B=S[2])!=null&&B[0]))throw new Error("missing TLV 2 for naddr");if(S[2][0].length!==32)throw new Error("TLV 2 should be 32 bytes");if(!((E=S[3])!=null&&E[0]))throw new Error("missing TLV 3 for naddr");if(S[3][0].length!==4)throw new Error("TLV 3 should be 4 bytes");return{type:"naddr",data:{identifier:utf8Decoder.decode(S[0][0]),pubkey:bytesToHex$2(S[2][0]),kind:parseInt(bytesToHex$2(S[3][0]),16),relays:S[1]?S[1].map(k=>utf8Decoder.decode(k)):[]}}}case"nsec":return{type:t,data:u};case"npub":case"note":return{type:t,data:bytesToHex$2(u)};default:throw new Error(`unknown prefix ${t}`)}}function parseTLV$1(e){let t={},a=e;for(;a.length>0;){let u=a[0],d=a[1],h=a.slice(2,2+d);if(a=a.slice(2+d),h.length<d)throw new Error(`not enough data to read on TLV ${u}`);t[u]=t[u]||[],t[u].push(h)}return t}function nsecEncode$1(e){return encodeBytes$1("nsec",e)}function npubEncode$1(e){return encodeBytes$1("npub",hexToBytes$2(e))}function noteEncode$1(e){return encodeBytes$1("note",hexToBytes$2(e))}function encodeBech32$1(e,t){let a=bech32$1.toWords(t);return bech32$1.encode(e,a,Bech32MaxSize$1)}function encodeBytes$1(e,t){return encodeBech32$1(e,t)}function nprofileEncode$1(e){let t=encodeTLV$1({0:[hexToBytes$2(e.pubkey)],1:(e.relays||[]).map(a=>utf8Encoder$1.encode(a))});return encodeBech32$1("nprofile",t)}function neventEncode$1(e){let t;e.kind!==void 0&&(t=integerToUint8Array$1(e.kind));let a=encodeTLV$1({0:[hexToBytes$2(e.id)],1:(e.relays||[]).map(u=>utf8Encoder$1.encode(u)),2:e.author?[hexToBytes$2(e.author)]:[],3:t?[new Uint8Array(t)]:[]});return encodeBech32$1("nevent",a)}function naddrEncode$1(e){let t=new ArrayBuffer(4);new DataView(t).setUint32(0,e.kind,!1);let a=encodeTLV$1({0:[utf8Encoder$1.encode(e.identifier)],1:(e.relays||[]).map(u=>utf8Encoder$1.encode(u)),2:[hexToBytes$2(e.pubkey)],3:[new Uint8Array(t)]});return encodeBech32$1("naddr",a)}function encodeTLV$1(e){let t=[];return Object.entries(e).reverse().forEach(([a,u])=>{u.forEach(d=>{let h=new Uint8Array(d.length+2);h.set([parseInt(a)],0),h.set([d.length],1),h.set(d,2),t.push(h)})}),concatBytes$1(...t)}var nip04_exports$1={};__export$1(nip04_exports$1,{decrypt:()=>decrypt$2,encrypt:()=>encrypt$1});function encrypt$1(e,t,a){const u=e instanceof Uint8Array?bytesToHex$2(e):e,d=secp256k1$2.getSharedSecret(u,"02"+t),h=getNormalizedX$1(d);let w=Uint8Array.from(randomBytes$4(16)),x=utf8Encoder$1.encode(a),M=cbc$3(h,w).encrypt(x),B=base64$1.encode(new Uint8Array(M)),E=base64$1.encode(new Uint8Array(w.buffer));return`${B}?iv=${E}`}function decrypt$2(e,t,a){const u=e instanceof Uint8Array?bytesToHex$2(e):e;let[d,h]=a.split("?iv="),w=secp256k1$2.getSharedSecret(u,"02"+t),x=getNormalizedX$1(w),M=base64$1.decode(h),B=base64$1.decode(d),E=cbc$3(x,M).decrypt(B);return utf8Decoder.decode(E)}function getNormalizedX$1(e){return e.slice(1,33)}var nip05_exports$1={};__export$1(nip05_exports$1,{NIP05_REGEX:()=>NIP05_REGEX$1,isNip05:()=>isNip05$1,isValid:()=>isValid$1,queryProfile:()=>queryProfile$1,searchDomain:()=>searchDomain$1,useFetchImplementation:()=>useFetchImplementation$1});var NIP05_REGEX$1=/^(?:([\w.+-]+)@)?([\w_-]+(\.[\w_-]+)+)$/,isNip05$1=e=>NIP05_REGEX$1.test(e||""),_fetch$1;try{_fetch$1=fetch}catch{}function useFetchImplementation$1(e){_fetch$1=e}async function searchDomain$1(e,t=""){try{const a=`https://${e}/.well-known/nostr.json?name=${t}`,u=await _fetch$1(a,{redirect:"manual"});if(u.status!==200)throw Error("Wrong response code");return(await u.json()).names}catch{return{}}}async function queryProfile$1(e){var d;const t=e.match(NIP05_REGEX$1);if(!t)return null;const[,a="_",u]=t;try{const h=`https://${u}/.well-known/nostr.json?name=${a}`,w=await _fetch$1(h,{redirect:"manual"});if(w.status!==200)throw Error("Wrong response code");const x=await w.json(),M=x.names[a];return M?{pubkey:M,relays:(d=x.relays)==null?void 0:d[M]}:null}catch{return null}}async function isValid$1(e,t){const a=await queryProfile$1(t);return a?a.pubkey===e:!1}var nip10_exports$1={};__export$1(nip10_exports$1,{parse:()=>parse$1});function parse$1(e){const t={reply:void 0,root:void 0,mentions:[],profiles:[],quotes:[]};let a,u;for(let d=e.tags.length-1;d>=0;d--){const h=e.tags[d];if(h[0]==="e"&&h[1]){const[w,x,M,B,E]=h,S={id:x,relays:M?[M]:[],author:E};if(B==="root"){t.root=S;continue}if(B==="reply"){t.reply=S;continue}if(B==="mention"){t.mentions.push(S);continue}a?u=S:a=S,t.mentions.push(S);continue}if(h[0]==="q"&&h[1]){const[w,x,M]=h;t.quotes.push({id:x,relays:M?[M]:[]})}if(h[0]==="p"&&h[1]){t.profiles.push({pubkey:h[1],relays:h[2]?[h[2]]:[]});continue}}return t.root||(t.root=u||a||t.reply),t.reply||(t.reply=a||t.root),[t.reply,t.root].forEach(d=>{if(!d)return;let h=t.mentions.indexOf(d);if(h!==-1&&t.mentions.splice(h,1),d.author){let w=t.profiles.find(x=>x.pubkey===d.author);w&&w.relays&&(d.relays||(d.relays=[]),w.relays.forEach(x=>{var M;((M=d.relays)==null?void 0:M.indexOf(x))===-1&&d.relays.push(x)}),w.relays=d.relays)}}),t.mentions.forEach(d=>{if(d.author){let h=t.profiles.find(w=>w.pubkey===d.author);h&&h.relays&&(d.relays||(d.relays=[]),h.relays.forEach(w=>{d.relays.indexOf(w)===-1&&d.relays.push(w)}),h.relays=d.relays)}}),t}var nip11_exports$1={};__export$1(nip11_exports$1,{fetchRelayInformation:()=>fetchRelayInformation$1,useFetchImplementation:()=>useFetchImplementation2$1});var _fetch2$1;try{_fetch2$1=fetch}catch{}function useFetchImplementation2$1(e){_fetch2$1=e}async function fetchRelayInformation$1(e){return await(await fetch(e.replace("ws://","http://").replace("wss://","https://"),{headers:{Accept:"application/nostr+json"}})).json()}var nip13_exports$1={};__export$1(nip13_exports$1,{fastEventHash:()=>fastEventHash$1,getPow:()=>getPow$1,minePow:()=>minePow$1});function getPow$1(e){let t=0;for(let a=0;a<64;a+=8){const u=parseInt(e.substring(a,a+8),16);if(u===0)t+=32;else{t+=Math.clz32(u);break}}return t}function minePow$1(e,t){let a=0;const u=e,d=["nonce",a.toString(),t.toString()];for(u.tags.push(d);;){const h=Math.floor(new Date().getTime()/1e3);if(h!==u.created_at&&(a=0,u.created_at=h),d[1]=(++a).toString(),u.id=fastEventHash$1(u),getPow$1(u.id)>=t)break}return u}function fastEventHash$1(e){return bytesToHex$2(sha256$3(utf8Encoder$1.encode(JSON.stringify([0,e.pubkey,e.created_at,e.kind,e.tags,e.content]))))}var nip17_exports$1={};__export$1(nip17_exports$1,{unwrapEvent:()=>unwrapEvent2$1,unwrapManyEvents:()=>unwrapManyEvents2$1,wrapEvent:()=>wrapEvent2$1,wrapManyEvents:()=>wrapManyEvents2$1});var nip59_exports$1={};__export$1(nip59_exports$1,{createRumor:()=>createRumor$1,createSeal:()=>createSeal$1,createWrap:()=>createWrap$1,unwrapEvent:()=>unwrapEvent$1,unwrapManyEvents:()=>unwrapManyEvents$1,wrapEvent:()=>wrapEvent$1,wrapManyEvents:()=>wrapManyEvents$1});var nip44_exports$1={};__export$1(nip44_exports$1,{decrypt:()=>decrypt2$1,encrypt:()=>encrypt2$1,getConversationKey:()=>getConversationKey$1,v2:()=>v2$1});var minPlaintextSize$1=1,maxPlaintextSize$1=65535;function getConversationKey$1(e,t){const a=secp256k1$2.getSharedSecret(e,"02"+t).subarray(1,33);return extract$1(sha256$3,a,"nip44-v2")}function getMessageKeys$1(e,t){const a=expand$1(sha256$3,e,t,76);return{chacha_key:a.subarray(0,32),chacha_nonce:a.subarray(32,44),hmac_key:a.subarray(44,76)}}function calcPaddedLen$1(e){if(!Number.isSafeInteger(e)||e<1)throw new Error("expected positive integer");if(e<=32)return 32;const t=1<<Math.floor(Math.log2(e-1))+1,a=t<=256?32:t/8;return a*(Math.floor((e-1)/a)+1)}function writeU16BE$1(e){if(!Number.isSafeInteger(e)||e<minPlaintextSize$1||e>maxPlaintextSize$1)throw new Error("invalid plaintext size: must be between 1 and 65535 bytes");const t=new Uint8Array(2);return new DataView(t.buffer).setUint16(0,e,!1),t}function pad$1(e){const t=utf8Encoder$1.encode(e),a=t.length,u=writeU16BE$1(a),d=new Uint8Array(calcPaddedLen$1(a)-a);return concatBytes$1(u,t,d)}function unpad$2(e){const t=new DataView(e.buffer).getUint16(0),a=e.subarray(2,2+t);if(t<minPlaintextSize$1||t>maxPlaintextSize$1||a.length!==t||e.length!==2+calcPaddedLen$1(t))throw new Error("invalid padding");return utf8Decoder.decode(a)}function hmacAad$1(e,t,a){if(a.length!==32)throw new Error("AAD associated data must be 32 bytes");const u=concatBytes$1(a,t);return hmac$2(sha256$3,e,u)}function decodePayload$1(e){if(typeof e!="string")throw new Error("payload must be a valid string");const t=e.length;if(t<132||t>87472)throw new Error("invalid payload length: "+t);if(e[0]==="#")throw new Error("unknown encryption version");let a;try{a=base64$1.decode(e)}catch(h){throw new Error("invalid base64: "+h.message)}const u=a.length;if(u<99||u>65603)throw new Error("invalid data length: "+u);const d=a[0];if(d!==2)throw new Error("unknown encryption version "+d);return{nonce:a.subarray(1,33),ciphertext:a.subarray(33,-32),mac:a.subarray(-32)}}function encrypt2$1(e,t,a=randomBytes$4(32)){const{chacha_key:u,chacha_nonce:d,hmac_key:h}=getMessageKeys$1(t,a),w=pad$1(e),x=chacha20$1(u,d,w),M=hmacAad$1(h,x,a);return base64$1.encode(concatBytes$1(new Uint8Array([2]),a,x,M))}function decrypt2$1(e,t){const{nonce:a,ciphertext:u,mac:d}=decodePayload$1(e),{chacha_key:h,chacha_nonce:w,hmac_key:x}=getMessageKeys$1(t,a),M=hmacAad$1(x,u,a);if(!equalBytes$1(M,d))throw new Error("invalid MAC");const B=chacha20$1(h,w,u);return unpad$2(B)}var v2$1={utils:{getConversationKey:getConversationKey$1,calcPaddedLen:calcPaddedLen$1},encrypt:encrypt2$1,decrypt:decrypt2$1},TWO_DAYS$1=2*24*60*60,now$1=()=>Math.round(Date.now()/1e3),randomNow$1=()=>Math.round(now$1()-Math.random()*TWO_DAYS$1),nip44ConversationKey$1=(e,t)=>getConversationKey$1(e,t),nip44Encrypt$1=(e,t,a)=>encrypt2$1(JSON.stringify(e),nip44ConversationKey$1(t,a)),nip44Decrypt$1=(e,t)=>JSON.parse(decrypt2$1(e.content,nip44ConversationKey$1(t,e.pubkey)));function createRumor$1(e,t){const a={created_at:now$1(),content:"",tags:[],...e,pubkey:getPublicKey(t)};return a.id=getEventHash$1(a),a}function createSeal$1(e,t,a){return finalizeEvent({kind:Seal$1,content:nip44Encrypt$1(e,t,a),created_at:randomNow$1(),tags:[]},t)}function createWrap$1(e,t){const a=generateSecretKey();return finalizeEvent({kind:GiftWrap$1,content:nip44Encrypt$1(e,a,t),created_at:randomNow$1(),tags:[["p",t]]},a)}function wrapEvent$1(e,t,a){const u=createRumor$1(e,t),d=createSeal$1(u,t,a);return createWrap$1(d,a)}function wrapManyEvents$1(e,t,a){if(!a||a.length===0)throw new Error("At least one recipient is required.");const u=getPublicKey(t),d=[wrapEvent$1(e,t,u)];return a.forEach(h=>{d.push(wrapEvent$1(e,t,h))}),d}function unwrapEvent$1(e,t){const a=nip44Decrypt$1(e,t);return nip44Decrypt$1(a,t)}function unwrapManyEvents$1(e,t){let a=[];return e.forEach(u=>{a.push(unwrapEvent$1(u,t))}),a.sort((u,d)=>u.created_at-d.created_at),a}function createEvent$1(e,t,a,u){const d={created_at:Math.ceil(Date.now()/1e3),kind:PrivateDirectMessage$1,tags:[],content:t};return(Array.isArray(e)?e:[e]).forEach(({publicKey:w,relayUrl:x})=>{d.tags.push(x?["p",w,x]:["p",w])}),u&&d.tags.push(["e",u.eventId,u.relayUrl||"","reply"]),a&&d.tags.push(["subject",a]),d}function wrapEvent2$1(e,t,a,u,d){const h=createEvent$1(t,a,u,d);return wrapEvent$1(h,e,t.publicKey)}function wrapManyEvents2$1(e,t,a,u,d){if(!t||t.length===0)throw new Error("At least one recipient is required.");return[{publicKey:getPublicKey(e)},...t].map(w=>wrapEvent2$1(e,w,a,u,d))}var unwrapEvent2$1=unwrapEvent$1,unwrapManyEvents2$1=unwrapManyEvents$1,nip18_exports$1={};__export$1(nip18_exports$1,{finishRepostEvent:()=>finishRepostEvent$1,getRepostedEvent:()=>getRepostedEvent$1,getRepostedEventPointer:()=>getRepostedEventPointer$1});function finishRepostEvent$1(e,t,a,u){var w;let d;const h=[...e.tags??[],["e",t.id,a],["p",t.pubkey]];return t.kind===ShortTextNote$1?d=Repost$1:(d=GenericRepost$1,h.push(["k",String(t.kind)])),finalizeEvent({kind:d,tags:h,content:e.content===""||(w=t.tags)!=null&&w.find(x=>x[0]==="-")?"":JSON.stringify(t),created_at:e.created_at},u)}function getRepostedEventPointer$1(e){if(![Repost$1,GenericRepost$1].includes(e.kind))return;let t,a;for(let u=e.tags.length-1;u>=0&&(t===void 0||a===void 0);u--){const d=e.tags[u];d.length>=2&&(d[0]==="e"&&t===void 0?t=d:d[0]==="p"&&a===void 0&&(a=d))}if(t!==void 0)return{id:t[1],relays:[t[2],a==null?void 0:a[2]].filter(u=>typeof u=="string"),author:a==null?void 0:a[1]}}function getRepostedEvent$1(e,{skipVerification:t}={}){const a=getRepostedEventPointer$1(e);if(a===void 0||e.content==="")return;let u;try{u=JSON.parse(e.content)}catch{return}if(u.id===a.id&&!(!t&&!verifyEvent(u)))return u}var nip21_exports$1={};__export$1(nip21_exports$1,{NOSTR_URI_REGEX:()=>NOSTR_URI_REGEX$1,parse:()=>parse2$1,test:()=>test$1});var NOSTR_URI_REGEX$1=new RegExp(`nostr:(${BECH32_REGEX$1.source})`);function test$1(e){return typeof e=="string"&&new RegExp(`^${NOSTR_URI_REGEX$1.source}$`).test(e)}function parse2$1(e){const t=e.match(new RegExp(`^${NOSTR_URI_REGEX$1.source}$`));if(!t)throw new Error(`Invalid Nostr URI: ${e}`);return{uri:t[0],value:t[1],decoded:decode$1(t[1])}}var nip25_exports$1={};__export$1(nip25_exports$1,{finishReactionEvent:()=>finishReactionEvent$1,getReactedEventPointer:()=>getReactedEventPointer$1});function finishReactionEvent$1(e,t,a){const u=t.tags.filter(d=>d.length>=2&&(d[0]==="e"||d[0]==="p"));return finalizeEvent({...e,kind:Reaction$1,tags:[...e.tags??[],...u,["e",t.id],["p",t.pubkey]],content:e.content??"+"},a)}function getReactedEventPointer$1(e){if(e.kind!==Reaction$1)return;let t,a;for(let u=e.tags.length-1;u>=0&&(t===void 0||a===void 0);u--){const d=e.tags[u];d.length>=2&&(d[0]==="e"&&t===void 0?t=d:d[0]==="p"&&a===void 0&&(a=d))}if(!(t===void 0||a===void 0))return{id:t[1],relays:[t[2],a[2]].filter(u=>u!==void 0),author:a[1]}}var nip27_exports$1={};__export$1(nip27_exports$1,{parse:()=>parse3$1});var noCharacter$1=/\W/m,noURLCharacter$1=/[^\w\/] |[^\w\/]$|$|,| /m,MAX_HASHTAG_LENGTH$1=42;function*parse3$1(e){let t=[];if(typeof e!="string"){for(let h=0;h<e.tags.length;h++){const w=e.tags[h];w[0]==="emoji"&&w.length>=3&&t.push({type:"emoji",shortcode:w[1],url:w[2]})}e=e.content}const a=e.length;let u=0,d=0;e:for(;d<a;){const h=e.indexOf(":",d),w=e.indexOf("#",d);if(h===-1&&w===-1)break e;if(h===-1||w>=0&&w<h){if(w===0||e[w-1]===" "){const x=e.slice(w+1,w+MAX_HASHTAG_LENGTH$1).match(noCharacter$1),M=x?w+1+x.index:a;yield{type:"text",text:e.slice(u,w)},yield{type:"hashtag",value:e.slice(w+1,M)},d=M,u=d;continue e}d=w+1;continue e}if(e.slice(h-5,h)==="nostr"){const x=e.slice(h+60).match(noCharacter$1),M=x?h+60+x.index:a;try{let B,{data:E,type:S}=decode$1(e.slice(h+1,M));switch(S){case"npub":B={pubkey:E};break;case"note":B={id:E};break;case"nsec":d=M+1;continue;default:B=E}u!==h-5&&(yield{type:"text",text:e.slice(u,h-5)}),yield{type:"reference",pointer:B},d=M,u=d;continue e}catch{d=h+1;continue e}}else if(e.slice(h-5,h)==="https"||e.slice(h-4,h)==="http"){const x=e.slice(h+4).match(noURLCharacter$1),M=x?h+4+x.index:a,B=e[h-1]==="s"?5:4;try{let E=new URL(e.slice(h-B,M));if(E.hostname.indexOf(".")===-1)throw new Error("invalid url");if(u!==h-B&&(yield{type:"text",text:e.slice(u,h-B)}),/\.(png|jpe?g|gif|webp|heic|svg)$/i.test(E.pathname)){yield{type:"image",url:E.toString()},d=M,u=d;continue e}if(/\.(mp4|avi|webm|mkv|mov)$/i.test(E.pathname)){yield{type:"video",url:E.toString()},d=M,u=d;continue e}if(/\.(mp3|aac|ogg|opus|wav|flac)$/i.test(E.pathname)){yield{type:"audio",url:E.toString()},d=M,u=d;continue e}yield{type:"url",url:E.toString()},d=M,u=d;continue e}catch{d=M+1;continue e}}else if(e.slice(h-3,h)==="wss"||e.slice(h-2,h)==="ws"){const x=e.slice(h+4).match(noURLCharacter$1),M=x?h+4+x.index:a,B=e[h-1]==="s"?3:2;try{let E=new URL(e.slice(h-B,M));if(E.hostname.indexOf(".")===-1)throw new Error("invalid ws url");u!==h-B&&(yield{type:"text",text:e.slice(u,h-B)}),yield{type:"relay",url:E.toString()},d=M,u=d;continue e}catch{d=M+1;continue e}}else{for(let x=0;x<t.length;x++){const M=t[x];if(e[h+M.shortcode.length+1]===":"&&e.slice(h+1,h+M.shortcode.length+1)===M.shortcode){u!==h&&(yield{type:"text",text:e.slice(u,h)}),yield M,d=h+M.shortcode.length+2,u=d;continue e}}d=h+1;continue e}}u!==a&&(yield{type:"text",text:e.slice(u)})}var nip28_exports$1={};__export$1(nip28_exports$1,{channelCreateEvent:()=>channelCreateEvent$1,channelHideMessageEvent:()=>channelHideMessageEvent$1,channelMessageEvent:()=>channelMessageEvent$1,channelMetadataEvent:()=>channelMetadataEvent$1,channelMuteUserEvent:()=>channelMuteUserEvent$1});var channelCreateEvent$1=(e,t)=>{let a;if(typeof e.content=="object")a=JSON.stringify(e.content);else if(typeof e.content=="string")a=e.content;else return;return finalizeEvent({kind:ChannelCreation$1,tags:[...e.tags??[]],content:a,created_at:e.created_at},t)},channelMetadataEvent$1=(e,t)=>{let a;if(typeof e.content=="object")a=JSON.stringify(e.content);else if(typeof e.content=="string")a=e.content;else return;return finalizeEvent({kind:ChannelMetadata$1,tags:[["e",e.channel_create_event_id],...e.tags??[]],content:a,created_at:e.created_at},t)},channelMessageEvent$1=(e,t)=>{const a=[["e",e.channel_create_event_id,e.relay_url,"root"]];return e.reply_to_channel_message_event_id&&a.push(["e",e.reply_to_channel_message_event_id,e.relay_url,"reply"]),finalizeEvent({kind:ChannelMessage$1,tags:[...a,...e.tags??[]],content:e.content,created_at:e.created_at},t)},channelHideMessageEvent$1=(e,t)=>{let a;if(typeof e.content=="object")a=JSON.stringify(e.content);else if(typeof e.content=="string")a=e.content;else return;return finalizeEvent({kind:ChannelHideMessage$1,tags:[["e",e.channel_message_event_id],...e.tags??[]],content:a,created_at:e.created_at},t)},channelMuteUserEvent$1=(e,t)=>{let a;if(typeof e.content=="object")a=JSON.stringify(e.content);else if(typeof e.content=="string")a=e.content;else return;return finalizeEvent({kind:ChannelMuteUser$1,tags:[["p",e.pubkey_to_mute],...e.tags??[]],content:a,created_at:e.created_at},t)},nip30_exports$1={};__export$1(nip30_exports$1,{EMOJI_SHORTCODE_REGEX:()=>EMOJI_SHORTCODE_REGEX$1,matchAll:()=>matchAll$1,regex:()=>regex$1,replaceAll:()=>replaceAll$1});var EMOJI_SHORTCODE_REGEX$1=/:(\w+):/,regex$1=()=>new RegExp(`\\B${EMOJI_SHORTCODE_REGEX$1.source}\\B`,"g");function*matchAll$1(e){const t=e.matchAll(regex$1());for(const a of t)try{const[u,d]=a;yield{shortcode:u,name:d,start:a.index,end:a.index+u.length}}catch{}}function replaceAll$1(e,t){return e.replaceAll(regex$1(),(a,u)=>t({shortcode:a,name:u}))}var nip39_exports$1={};__export$1(nip39_exports$1,{useFetchImplementation:()=>useFetchImplementation3$1,validateGithub:()=>validateGithub$1});var _fetch3$1;try{_fetch3$1=fetch}catch{}function useFetchImplementation3$1(e){_fetch3$1=e}async function validateGithub$1(e,t,a){try{return await(await _fetch3$1(`https://gist.github.com/${t}/${a}/raw`)).text()===`Verifying that I control the following Nostr public key: ${e}`}catch{return!1}}var nip47_exports$1={};__export$1(nip47_exports$1,{makeNwcRequestEvent:()=>makeNwcRequestEvent$1,parseConnectionString:()=>parseConnectionString$1});function parseConnectionString$1(e){const{host:t,pathname:a,searchParams:u}=new URL(e),d=a||t,h=u.get("relay"),w=u.get("secret");if(!d||!h||!w)throw new Error("invalid connection string");return{pubkey:d,relay:h,secret:w}}async function makeNwcRequestEvent$1(e,t,a){const d=encrypt$1(t,e,JSON.stringify({method:"pay_invoice",params:{invoice:a}})),h={kind:NWCWalletRequest$1,created_at:Math.round(Date.now()/1e3),content:d,tags:[["p",e]]};return finalizeEvent(h,t)}var nip54_exports$1={};__export$1(nip54_exports$1,{normalizeIdentifier:()=>normalizeIdentifier$1});function normalizeIdentifier$1(e){return e=e.trim().toLowerCase(),e=e.normalize("NFKC"),Array.from(e).map(t=>new RegExp("\\p{Letter}","u").test(t)||new RegExp("\\p{Number}","u").test(t)?t:"-").join("")}var nip57_exports$1={};__export$1(nip57_exports$1,{getSatoshisAmountFromBolt11:()=>getSatoshisAmountFromBolt11$1,getZapEndpoint:()=>getZapEndpoint$1,makeZapReceipt:()=>makeZapReceipt$1,makeZapRequest:()=>makeZapRequest$1,useFetchImplementation:()=>useFetchImplementation4$1,validateZapRequest:()=>validateZapRequest$1});var _fetch4$1;try{_fetch4$1=fetch}catch{}function useFetchImplementation4$1(e){_fetch4$1=e}async function getZapEndpoint$1(e){try{let t="",{lud06:a,lud16:u}=JSON.parse(e.content);if(u){let[w,x]=u.split("@");t=new URL(`/.well-known/lnurlp/${w}`,`https://${x}`).toString()}else if(a){let{words:w}=bech32$1.decode(a,1e3),x=bech32$1.fromWords(w);t=utf8Decoder.decode(x)}else return null;let h=await(await _fetch4$1(t)).json();if(h.allowsNostr&&h.nostrPubkey)return h.callback}catch{}return null}function makeZapRequest$1(e){let t={kind:9734,created_at:Math.round(Date.now()/1e3),content:e.comment||"",tags:[["p","pubkey"in e?e.pubkey:e.event.pubkey],["amount",e.amount.toString()],["relays",...e.relays]]};if("event"in e){if(t.tags.push(["e",e.event.id]),isReplaceableKind$1(e.event.kind)){const a=["a",`${e.event.kind}:${e.event.pubkey}:`];t.tags.push(a)}else if(isAddressableKind$1(e.event.kind)){let a=e.event.tags.find(([d,h])=>d==="d"&&h);if(!a)throw new Error("d tag not found or is empty");const u=["a",`${e.event.kind}:${e.event.pubkey}:${a[1]}`];t.tags.push(u)}t.tags.push(["k",e.event.kind.toString()])}return t}function validateZapRequest$1(e){let t;try{t=JSON.parse(e)}catch{return"Invalid zap request JSON."}if(!validateEvent$1(t))return"Zap request is not a valid Nostr event.";if(!verifyEvent(t))return"Invalid signature on zap request.";let a=t.tags.find(([h,w])=>h==="p"&&w);if(!a)return"Zap request doesn't have a 'p' tag.";if(!a[1].match(/^[a-f0-9]{64}$/))return"Zap request 'p' tag is not valid hex.";let u=t.tags.find(([h,w])=>h==="e"&&w);return u&&!u[1].match(/^[a-f0-9]{64}$/)?"Zap request 'e' tag is not valid hex.":t.tags.find(([h,w])=>h==="relays"&&w)?null:"Zap request doesn't have a 'relays' tag."}function makeZapReceipt$1({zapRequest:e,preimage:t,bolt11:a,paidAt:u}){let d=JSON.parse(e),h=d.tags.filter(([x])=>x==="e"||x==="p"||x==="a"),w={kind:9735,created_at:Math.round(u.getTime()/1e3),content:"",tags:[...h,["P",d.pubkey],["bolt11",a],["description",e]]};return t&&w.tags.push(["preimage",t]),w}function getSatoshisAmountFromBolt11$1(e){if(e.length<50)return 0;e=e.substring(0,50);const t=e.lastIndexOf("1");if(t===-1)return 0;const a=e.substring(0,t);if(!a.startsWith("lnbc"))return 0;const u=a.substring(4);if(u.length<1)return 0;const d=u[u.length-1],h=d.charCodeAt(0)-48,w=h>=0&&h<=9;let x=u.length-1;if(w&&x++,x<1)return 0;const M=parseInt(u.substring(0,x));switch(d){case"m":return M*1e5;case"u":return M*100;case"n":return M/10;case"p":return M/1e4;default:return M*1e8}}var nip77_exports$1={};__export$1(nip77_exports$1,{Negentropy:()=>Negentropy$1,NegentropyStorageVector:()=>NegentropyStorageVector$1,NegentropySync:()=>NegentropySync$1});var PROTOCOL_VERSION$1=97,ID_SIZE$1=32,FINGERPRINT_SIZE$1=16,Mode$1={Skip:0,Fingerprint:1,IdList:2},WrappedBuffer$1=class{constructor(t){$e(this,"_raw");$e(this,"length");typeof t=="number"?(this._raw=new Uint8Array(t),this.length=0):t instanceof Uint8Array?(this._raw=new Uint8Array(t),this.length=t.length):(this._raw=new Uint8Array(512),this.length=0)}unwrap(){return this._raw.subarray(0,this.length)}get capacity(){return this._raw.byteLength}extend(t){if(t instanceof WrappedBuffer$1&&(t=t.unwrap()),typeof t.length!="number")throw Error("bad length");const a=t.length+this.length;if(this.capacity<a){const u=this._raw,d=Math.max(this.capacity*2,a);this._raw=new Uint8Array(d),this._raw.set(u)}this._raw.set(t,this.length),this.length+=t.length}shift(){const t=this._raw[0];return this._raw=this._raw.subarray(1),this.length--,t}shiftN(t=1){const a=this._raw.subarray(0,t);return this._raw=this._raw.subarray(t),this.length-=t,a}};function decodeVarInt$1(e){let t=0;for(;;){if(e.length===0)throw Error("parse ends prematurely");let a=e.shift();if(t=t<<7|a&127,!(a&128))break}return t}function encodeVarInt$1(e){if(e===0)return new WrappedBuffer$1(new Uint8Array([0]));let t=[];for(;e!==0;)t.push(e&127),e>>>=7;t.reverse();for(let a=0;a<t.length-1;a++)t[a]|=128;return new WrappedBuffer$1(new Uint8Array(t))}function getByte$1(e){return getBytes$1(e,1)[0]}function getBytes$1(e,t){if(e.length<t)throw Error("parse ends prematurely");return e.shiftN(t)}var Accumulator$1=class{constructor(){$e(this,"buf");this.setToZero()}setToZero(){this.buf=new Uint8Array(ID_SIZE$1)}add(t){let a=0,u=0,d=new DataView(this.buf.buffer),h=new DataView(t.buffer);for(let w=0;w<8;w++){let x=w*4,M=d.getUint32(x,!0),B=h.getUint32(x,!0),E=M;E+=a,E+=B,E>4294967295&&(u=1),d.setUint32(x,E&4294967295,!0),a=u,u=0}}negate(){let t=new DataView(this.buf.buffer);for(let u=0;u<8;u++){let d=u*4;t.setUint32(d,~t.getUint32(d,!0))}let a=new Uint8Array(ID_SIZE$1);a[0]=1,this.add(a)}getFingerprint(t){let a=new WrappedBuffer$1;return a.extend(this.buf),a.extend(encodeVarInt$1(t)),sha256$3(a.unwrap()).subarray(0,FINGERPRINT_SIZE$1)}},NegentropyStorageVector$1=class{constructor(){$e(this,"items");$e(this,"sealed");this.items=[],this.sealed=!1}insert(t,a){if(this.sealed)throw Error("already sealed");const u=hexToBytes$1(a);if(u.byteLength!==ID_SIZE$1)throw Error("bad id size for added item");this.items.push({timestamp:t,id:u})}seal(){if(this.sealed)throw Error("already sealed");this.sealed=!0,this.items.sort(itemCompare$1);for(let t=1;t<this.items.length;t++)if(itemCompare$1(this.items[t-1],this.items[t])===0)throw Error("duplicate item inserted")}unseal(){this.sealed=!1}size(){return this._checkSealed(),this.items.length}getItem(t){if(this._checkSealed(),t>=this.items.length)throw Error("out of range");return this.items[t]}iterate(t,a,u){this._checkSealed(),this._checkBounds(t,a);for(let d=t;d<a&&u(this.items[d],d);++d);}findLowerBound(t,a,u){return this._checkSealed(),this._checkBounds(t,a),this._binarySearch(this.items,t,a,d=>itemCompare$1(d,u)<0)}fingerprint(t,a){let u=new Accumulator$1;return u.setToZero(),this.iterate(t,a,d=>(u.add(d.id),!0)),u.getFingerprint(a-t)}_checkSealed(){if(!this.sealed)throw Error("not sealed")}_checkBounds(t,a){if(t>a||a>this.items.length)throw Error("bad range")}_binarySearch(t,a,u,d){let h=u-a;for(;h>0;){let w=a,x=Math.floor(h/2);w+=x,d(t[w])?(a=++w,h-=x+1):h=x}return a}},Negentropy$1=class{constructor(t,a=6e4){$e(this,"storage");$e(this,"frameSizeLimit");$e(this,"lastTimestampIn");$e(this,"lastTimestampOut");if(a<4096)throw Error("frameSizeLimit too small");this.storage=t,this.frameSizeLimit=a,this.lastTimestampIn=0,this.lastTimestampOut=0}_bound(t,a){return{timestamp:t,id:a||new Uint8Array(0)}}initiate(){let t=new WrappedBuffer$1;return t.extend(new Uint8Array([PROTOCOL_VERSION$1])),this.splitRange(0,this.storage.size(),this._bound(Number.MAX_VALUE),t),bytesToHex$1(t.unwrap())}reconcile(t,a,u){const d=new WrappedBuffer$1(hexToBytes$1(t));this.lastTimestampIn=this.lastTimestampOut=0;let h=new WrappedBuffer$1;h.extend(new Uint8Array([PROTOCOL_VERSION$1]));let w=getByte$1(d);if(w<96||w>111)throw Error("invalid negentropy protocol version byte");if(w!==PROTOCOL_VERSION$1)throw Error("unsupported negentropy protocol version requested: "+(w-96));let x=this.storage.size(),M=this._bound(0),B=0,E=!1;for(;d.length!==0;){let S=new WrappedBuffer$1,k=()=>{E&&(E=!1,S.extend(this.encodeBound(M)),S.extend(encodeVarInt$1(Mode$1.Skip)))},C=this.decodeBound(d),q=decodeVarInt$1(d),O=B,U=this.storage.findLowerBound(B,x,C);if(q===Mode$1.Skip)E=!0;else if(q===Mode$1.Fingerprint){let P=getBytes$1(d,FINGERPRINT_SIZE$1),L=this.storage.fingerprint(O,U);compareUint8Array$1(P,L)!==0?(k(),this.splitRange(O,U,C,S)):E=!0}else if(q===Mode$1.IdList){let P=decodeVarInt$1(d),L={};for(let J=0;J<P;J++){let Y=getBytes$1(d,ID_SIZE$1);L[bytesToHex$1(Y)]=Y}if(E=!0,this.storage.iterate(O,U,J=>{let Y=J.id;const ae=bytesToHex$1(Y);return L[ae]?delete L[bytesToHex$1(Y)]:a==null||a(ae),!0}),u)for(let J of Object.values(L))u(bytesToHex$1(J))}else throw Error("unexpected mode");if(this.exceededFrameSizeLimit(h.length+S.length)){let P=this.storage.fingerprint(U,x);h.extend(this.encodeBound(this._bound(Number.MAX_VALUE))),h.extend(encodeVarInt$1(Mode$1.Fingerprint)),h.extend(P);break}else h.extend(S);B=U,M=C}return h.length===1?null:bytesToHex$1(h.unwrap())}splitRange(t,a,u,d){let h=a-t,w=16;if(h<w*2)d.extend(this.encodeBound(u)),d.extend(encodeVarInt$1(Mode$1.IdList)),d.extend(encodeVarInt$1(h)),this.storage.iterate(t,a,x=>(d.extend(x.id),!0));else{let x=Math.floor(h/w),M=h%w,B=t;for(let E=0;E<w;E++){let S=x+(E<M?1:0),k=this.storage.fingerprint(B,B+S);B+=S;let C;if(B===a)C=u;else{let q,O;this.storage.iterate(B-1,B+1,(U,P)=>(P===B-1?q=U:O=U,!0)),C=this.getMinimalBound(q,O)}d.extend(this.encodeBound(C)),d.extend(encodeVarInt$1(Mode$1.Fingerprint)),d.extend(k)}}}exceededFrameSizeLimit(t){return t>this.frameSizeLimit-200}decodeTimestampIn(t){let a=decodeVarInt$1(t);return a=a===0?Number.MAX_VALUE:a-1,this.lastTimestampIn===Number.MAX_VALUE||a===Number.MAX_VALUE?(this.lastTimestampIn=Number.MAX_VALUE,Number.MAX_VALUE):(a+=this.lastTimestampIn,this.lastTimestampIn=a,a)}decodeBound(t){let a=this.decodeTimestampIn(t),u=decodeVarInt$1(t);if(u>ID_SIZE$1)throw Error("bound key too long");let d=getBytes$1(t,u);return{timestamp:a,id:d}}encodeTimestampOut(t){if(t===Number.MAX_VALUE)return this.lastTimestampOut=Number.MAX_VALUE,encodeVarInt$1(0);let a=t;return t-=this.lastTimestampOut,this.lastTimestampOut=a,encodeVarInt$1(t+1)}encodeBound(t){let a=new WrappedBuffer$1;return a.extend(this.encodeTimestampOut(t.timestamp)),a.extend(encodeVarInt$1(t.id.length)),a.extend(t.id),a}getMinimalBound(t,a){if(a.timestamp!==t.timestamp)return this._bound(a.timestamp);{let u=0,d=a.id,h=t.id;for(let w=0;w<ID_SIZE$1&&d[w]===h[w];w++)u++;return this._bound(a.timestamp,a.id.subarray(0,u+1))}}};function compareUint8Array$1(e,t){for(let a=0;a<e.byteLength;a++){if(e[a]<t[a])return-1;if(e[a]>t[a])return 1}return e.byteLength>t.byteLength?1:e.byteLength<t.byteLength?-1:0}function itemCompare$1(e,t){return e.timestamp===t.timestamp?compareUint8Array$1(e.id,t.id):e.timestamp-t.timestamp}var NegentropySync$1=class{constructor(t,a,u,d={}){$e(this,"relay");$e(this,"storage");$e(this,"neg");$e(this,"filter");$e(this,"subscription");$e(this,"onhave");$e(this,"onneed");this.relay=t,this.storage=a,this.neg=new Negentropy$1(a),this.onhave=d.onhave,this.onneed=d.onneed,this.filter=u,this.subscription=this.relay.prepareSubscription([{}],{label:d.label||"negentropy"}),this.subscription.oncustom=h=>{var w,x,M,B;switch(h[0]){case"NEG-MSG":{h.length<3&&console.warn(`got invalid NEG-MSG from ${this.relay.url}: ${h}`);try{const E=this.neg.reconcile(h[2],this.onhave,this.onneed);E?this.relay.send(`["NEG-MSG", "${this.subscription.id}", "${E}"]`):(this.close(),(w=d.onclose)==null||w.call(d))}catch(E){console.error("negentropy reconcile error:",E),(x=d==null?void 0:d.onclose)==null||x.call(d,`reconcile error: ${E}`)}break}case"NEG-CLOSE":{const E=h[2];console.warn("negentropy error:",E),(M=d.onclose)==null||M.call(d,E);break}case"NEG-ERR":(B=d.onclose)==null||B.call(d)}}}async start(){const t=this.neg.initiate();this.relay.send(`["NEG-OPEN","${this.subscription.id}",${JSON.stringify(this.filter)},"${t}"]`)}close(){this.relay.send(`["NEG-CLOSE","${this.subscription.id}"]`),this.subscription.close()}},nip98_exports$1={};__export$1(nip98_exports$1,{getToken:()=>getToken$1,hashPayload:()=>hashPayload$1,unpackEventFromToken:()=>unpackEventFromToken$1,validateEvent:()=>validateEvent2$1,validateEventKind:()=>validateEventKind$1,validateEventMethodTag:()=>validateEventMethodTag$1,validateEventPayloadTag:()=>validateEventPayloadTag$1,validateEventTimestamp:()=>validateEventTimestamp$1,validateEventUrlTag:()=>validateEventUrlTag$1,validateToken:()=>validateToken$1});var _authorizationScheme$1="Nostr ";async function getToken$1(e,t,a,u=!1,d){const h={kind:HTTPAuth$1,tags:[["u",e],["method",t]],created_at:Math.round(new Date().getTime()/1e3),content:""};d&&h.tags.push(["payload",hashPayload$1(d)]);const w=await a(h);return(u?_authorizationScheme$1:"")+base64$1.encode(utf8Encoder$1.encode(JSON.stringify(w)))}async function validateToken$1(e,t,a){const u=await unpackEventFromToken$1(e).catch(h=>{throw h});return await validateEvent2$1(u,t,a).catch(h=>{throw h})}async function unpackEventFromToken$1(e){if(!e)throw new Error("Missing token");e=e.replace(_authorizationScheme$1,"");const t=utf8Decoder.decode(base64$1.decode(e));if(!t||t.length===0||!t.startsWith("{"))throw new Error("Invalid token");return JSON.parse(t)}function validateEventTimestamp$1(e){return e.created_at?Math.round(new Date().getTime()/1e3)-e.created_at<60:!1}function validateEventKind$1(e){return e.kind===HTTPAuth$1}function validateEventUrlTag$1(e,t){const a=e.tags.find(u=>u[0]==="u");return a?a.length>0&&a[1]===t:!1}function validateEventMethodTag$1(e,t){const a=e.tags.find(u=>u[0]==="method");return a?a.length>0&&a[1].toLowerCase()===t.toLowerCase():!1}function hashPayload$1(e){const t=sha256$3(utf8Encoder$1.encode(JSON.stringify(e)));return bytesToHex$2(t)}function validateEventPayloadTag$1(e,t){const a=e.tags.find(d=>d[0]==="payload");if(!a)return!1;const u=hashPayload$1(t);return a.length>0&&a[1]===u}async function validateEvent2$1(e,t,a,u){if(!verifyEvent(e))throw new Error("Invalid nostr event, signature invalid");if(!validateEventKind$1(e))throw new Error("Invalid nostr event, kind invalid");if(!validateEventTimestamp$1(e))throw new Error("Invalid nostr event, created_at timestamp invalid");if(!validateEventUrlTag$1(e,t))throw new Error("Invalid nostr event, url tag invalid");if(!validateEventMethodTag$1(e,a))throw new Error("Invalid nostr event, method tag invalid");if(u&&typeof u=="object"&&Object.keys(u).length>0&&!validateEventPayloadTag$1(e,u))throw new Error("Invalid nostr event, payload tag does not match request body hash");return!0}const TAG_PRIVATE="private";class NCC05Error extends Error{constructor(t){super(t),this.name="NCC05Error"}}class NCC05RelayError extends NCC05Error{constructor(t){super(t),this.name="NCC05RelayError"}}class NCC05TimeoutError extends NCC05Error{constructor(t){super(t),this.name="NCC05TimeoutError"}}class NCC05DecryptionError extends NCC05Error{constructor(t){super(t),this.name="NCC05DecryptionError"}}class NCC05ArgumentError extends NCC05Error{constructor(t){super(t),this.name="NCC05ArgumentError"}}function ensureUint8Array(e){if(e instanceof Uint8Array)return e;if(typeof e=="string"){if(e.match(/^[0-9a-fA-F]+$/))return new Uint8Array(e.match(/.{1,2}/g).map(t=>parseInt(t,16)));throw new NCC05ArgumentError("Invalid hex key provided")}throw new NCC05ArgumentError("Key must be a hex string or Uint8Array")}class NCC05Resolver{constructor(t={}){$e(this,"pool");$e(this,"_ownPool");$e(this,"bootstrapRelays");$e(this,"timeout");$e(this,"cache",new Map);this._ownPool=!t.pool,this.pool=t.pool||new SimplePool$1,this.bootstrapRelays=t.bootstrapRelays||["wss://relay.damus.io","wss://npub1..."],this.timeout=t.timeout||1e4}async resolve(t,a,u="addr",d={}){let h=t;t.startsWith("npub1")&&(h=nip19_exports$1.decode(t).data);const w=Math.floor(Date.now()/1e3),x=`${h}:${u}`,M=this.cache.get(x);if(M){if(M.expires>w)return M.payload;this.cache.delete(x)}let B=[...this.bootstrapRelays];if(d.gossip)try{const k=await this.pool.get(this.bootstrapRelays,{authors:[h],kinds:[10002]});if(k&&verifyEvent(k)&&k.pubkey===h){const C=k.tags.filter(q=>q[0]==="r").map(q=>q[1]);C.length>0&&(B=[...new Set([...B,...C])])}}catch(k){console.warn(`[NCC-05] Gossip discovery failed: ${k.message}`)}const E={authors:[h],kinds:[30058],"#d":[u],limit:10},S=a?ensureUint8Array(a):void 0;try{const k=this.pool.querySync(B,E),C=new Promise((se,ie)=>setTimeout(()=>ie(new NCC05TimeoutError("Resolution timed out")),this.timeout)),q=await Promise.race([k,C]);if(!q||Array.isArray(q)&&q.length===0)return null;const O=q.filter(se=>se.pubkey===h&&verifyEvent(se)).sort((se,ie)=>ie.created_at!==se.created_at?ie.created_at-se.created_at:se.id.localeCompare(ie.id));if(O.length===0)return null;const U=O[0];let P=U.content;if(P.includes('"wraps"')&&P.includes('"ciphertext"')&&P.startsWith("{")&&S)try{const se=JSON.parse(P),ie=getPublicKey(S),ce=se.wraps[ie];if(ce){const $=nip44_exports$1.getConversationKey(S,h),n=nip44_exports$1.decrypt(ce,$),l=new Uint8Array(n.match(/.{1,2}/g).map(p=>parseInt(p,16))),c=nip44_exports$1.getConversationKey(l,getPublicKey(l));P=nip44_exports$1.decrypt(se.ciphertext,c)}else return null}catch{throw new NCC05DecryptionError("Failed to decrypt wrapped content")}else if(S&&!P.startsWith("{"))try{const se=nip44_exports$1.getConversationKey(S,h);P=nip44_exports$1.decrypt(U.content,se)}catch{throw new NCC05DecryptionError("Failed to decrypt content")}let J;try{J=JSON.parse(P)}catch{return null}if(!J||!J.endpoints||!Array.isArray(J.endpoints))return null;const Y=U.tags.find(se=>se[0]==="expiration"),ae=Y?parseInt(Y[1],10):1/0,oe=J.updated_at+J.ttl,ue=Math.min(ae,oe);if(w>ue){if(d.strict)return null;console.warn("NCC-05 record expired")}else this.cache.set(x,{payload:J,expires:ue});return J}catch(k){throw k instanceof NCC05Error?k:new NCC05RelayError(`Relay query failed: ${k.message}`)}}close(){this._ownPool&&this.pool.close(this.bootstrapRelays)}}class NCC05Publisher{constructor(t={}){$e(this,"pool");$e(this,"_ownPool");$e(this,"timeout");this._ownPool=!t.pool,this.pool=t.pool||new SimplePool$1,this.timeout=t.timeout||5e3}async _publishToRelays(t,a){const d=this.pool.publish(t,a).map(x=>new Promise((M,B)=>{const E=setTimeout(()=>B(new NCC05TimeoutError("Publish timed out")),this.timeout);x.then(()=>{clearTimeout(E),M()}).catch(S=>{clearTimeout(E),B(S)})})),h=await Promise.allSettled(d);if(h.filter(x=>x.status==="fulfilled").length===0){const x=h.filter(M=>M.status==="rejected").map(M=>M.reason.message).join(", ");throw new NCC05RelayError(`Failed to publish to any relay. Errors: ${x}`)}}async publishWrapped(t,a,u,d,h="addr"){let w="addr",x=!1;typeof h=="string"?w=h:(w=h.identifier||"addr",x=!!h.privateLocator);const M=ensureUint8Array(a),B=generateSecretKey(),E=Array.from(B).map(L=>L.toString(16).padStart(2,"0")).join(""),S=nip44_exports$1.getConversationKey(B,getPublicKey(B)),k=nip44_exports$1.encrypt(JSON.stringify(d),S),C={};for(const L of u){const J=nip44_exports$1.getConversationKey(M,L);C[L]=nip44_exports$1.encrypt(E,J)}const q={ciphertext:k,wraps:C},O=[["d",w]];x&&O.push([TAG_PRIVATE,"true"]);const U={kind:30058,created_at:Math.floor(Date.now()/1e3),tags:O,content:JSON.stringify(q)},P=finalizeEvent(U,M);return await this._publishToRelays(t,P),P}async publish(t,a,u,d={}){const h=ensureUint8Array(a),w=getPublicKey(h),x=d.identifier||"addr";let M=JSON.stringify(u);if(!d.public){const k=d.recipientPubkey||w,C=nip44_exports$1.getConversationKey(h,k);M=nip44_exports$1.encrypt(M,C)}const B=[["d",x]];d.privateLocator&&B.push([TAG_PRIVATE,"true"]);const E={kind:30058,created_at:Math.floor(Date.now()/1e3),pubkey:w,tags:B,content:M},S=finalizeEvent(E,h);return await this._publishToRelays(t,S),S}close(t){this._ownPool&&this.pool.close(t)}}var cryptoBrowserify={};function getDefaultExportFromCjs(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var browser$c={exports:{}},process=browser$c.exports={},cachedSetTimeout,cachedClearTimeout;function defaultSetTimout(){throw new Error("setTimeout has not been defined")}function defaultClearTimeout(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?cachedSetTimeout=setTimeout:cachedSetTimeout=defaultSetTimout}catch{cachedSetTimeout=defaultSetTimout}try{typeof clearTimeout=="function"?cachedClearTimeout=clearTimeout:cachedClearTimeout=defaultClearTimeout}catch{cachedClearTimeout=defaultClearTimeout}})();function runTimeout(e){if(cachedSetTimeout===setTimeout)return setTimeout(e,0);if((cachedSetTimeout===defaultSetTimout||!cachedSetTimeout)&&setTimeout)return cachedSetTimeout=setTimeout,setTimeout(e,0);try{return cachedSetTimeout(e,0)}catch{try{return cachedSetTimeout.call(null,e,0)}catch{return cachedSetTimeout.call(this,e,0)}}}function runClearTimeout(e){if(cachedClearTimeout===clearTimeout)return clearTimeout(e);if((cachedClearTimeout===defaultClearTimeout||!cachedClearTimeout)&&clearTimeout)return cachedClearTimeout=clearTimeout,clearTimeout(e);try{return cachedClearTimeout(e)}catch{try{return cachedClearTimeout.call(null,e)}catch{return cachedClearTimeout.call(this,e)}}}var queue=[],draining=!1,currentQueue,queueIndex=-1;function cleanUpNextTick(){!draining||!currentQueue||(draining=!1,currentQueue.length?queue=currentQueue.concat(queue):queueIndex=-1,queue.length&&drainQueue())}function drainQueue(){if(!draining){var e=runTimeout(cleanUpNextTick);draining=!0;for(var t=queue.length;t;){for(currentQueue=queue,queue=[];++queueIndex<t;)currentQueue&&currentQueue[queueIndex].run();queueIndex=-1,t=queue.length}currentQueue=null,draining=!1,runClearTimeout(e)}}process.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var a=1;a<arguments.length;a++)t[a-1]=arguments[a];queue.push(new Item(e,t)),queue.length===1&&!draining&&runTimeout(drainQueue)};function Item(e,t){this.fun=e,this.array=t}Item.prototype.run=function(){this.fun.apply(null,this.array)};process.title="browser";process.browser=!0;process.env={};process.argv=[];process.version="";process.versions={};function noop(){}process.on=noop;process.addListener=noop;process.once=noop;process.off=noop;process.removeListener=noop;process.removeAllListeners=noop;process.emit=noop;process.prependListener=noop;process.prependOnceListener=noop;process.listeners=function(e){return[]};process.binding=function(e){throw new Error("process.binding is not supported")};process.cwd=function(){return"/"};process.chdir=function(e){throw new Error("process.chdir is not supported")};process.umask=function(){return 0};var browserExports$1=browser$c.exports;const process$1=getDefaultExportFromCjs(browserExports$1);var browser$b={exports:{}},safeBuffer$5={exports:{}},dist={};(function(e){Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var t={},a={};a.byteLength=E,a.toByteArray=k,a.fromByteArray=O;for(var u=[],d=[],h=typeof Uint8Array<"u"?Uint8Array:Array,w="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",x=0,M=w.length;x<M;++x)u[x]=w[x],d[w.charCodeAt(x)]=x;d[45]=62,d[95]=63;function B(L){var J=L.length;if(J%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var Y=L.indexOf("=");Y===-1&&(Y=J);var ae=Y===J?0:4-Y%4;return[Y,ae]}function E(L){var J=B(L),Y=J[0],ae=J[1];return(Y+ae)*3/4-ae}function S(L,J,Y){return(J+Y)*3/4-Y}function k(L){var J,Y=B(L),ae=Y[0],oe=Y[1],ue=new h(S(L,ae,oe)),se=0,ie=oe>0?ae-4:ae,ce;for(ce=0;ce<ie;ce+=4)J=d[L.charCodeAt(ce)]<<18|d[L.charCodeAt(ce+1)]<<12|d[L.charCodeAt(ce+2)]<<6|d[L.charCodeAt(ce+3)],ue[se++]=J>>16&255,ue[se++]=J>>8&255,ue[se++]=J&255;return oe===2&&(J=d[L.charCodeAt(ce)]<<2|d[L.charCodeAt(ce+1)]>>4,ue[se++]=J&255),oe===1&&(J=d[L.charCodeAt(ce)]<<10|d[L.charCodeAt(ce+1)]<<4|d[L.charCodeAt(ce+2)]>>2,ue[se++]=J>>8&255,ue[se++]=J&255),ue}function C(L){return u[L>>18&63]+u[L>>12&63]+u[L>>6&63]+u[L&63]}function q(L,J,Y){for(var ae,oe=[],ue=J;ue<Y;ue+=3)ae=(L[ue]<<16&16711680)+(L[ue+1]<<8&65280)+(L[ue+2]&255),oe.push(C(ae));return oe.join("")}function O(L){for(var J,Y=L.length,ae=Y%3,oe=[],ue=16383,se=0,ie=Y-ae;se<ie;se+=ue)oe.push(q(L,se,se+ue>ie?ie:se+ue));return ae===1?(J=L[Y-1],oe.push(u[J>>2]+u[J<<4&63]+"==")):ae===2&&(J=(L[Y-2]<<8)+L[Y-1],oe.push(u[J>>10]+u[J>>4&63]+u[J<<2&63]+"=")),oe.join("")}var U={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */U.read=function(L,J,Y,ae,oe){var ue,se,ie=oe*8-ae-1,ce=(1<<ie)-1,$=ce>>1,n=-7,l=Y?oe-1:0,c=Y?-1:1,p=L[J+l];for(l+=c,ue=p&(1<<-n)-1,p>>=-n,n+=ie;n>0;ue=ue*256+L[J+l],l+=c,n-=8);for(se=ue&(1<<-n)-1,ue>>=-n,n+=ae;n>0;se=se*256+L[J+l],l+=c,n-=8);if(ue===0)ue=1-$;else{if(ue===ce)return se?NaN:(p?-1:1)*(1/0);se=se+Math.pow(2,ae),ue=ue-$}return(p?-1:1)*se*Math.pow(2,ue-ae)},U.write=function(L,J,Y,ae,oe,ue){var se,ie,ce,$=ue*8-oe-1,n=(1<<$)-1,l=n>>1,c=oe===23?Math.pow(2,-24)-Math.pow(2,-77):0,p=ae?0:ue-1,y=ae?1:-1,b=J<0||J===0&&1/J<0?1:0;for(J=Math.abs(J),isNaN(J)||J===1/0?(ie=isNaN(J)?1:0,se=n):(se=Math.floor(Math.log(J)/Math.LN2),J*(ce=Math.pow(2,-se))<1&&(se--,ce*=2),se+l>=1?J+=c/ce:J+=c*Math.pow(2,1-l),J*ce>=2&&(se++,ce/=2),se+l>=n?(ie=0,se=n):se+l>=1?(ie=(J*ce-1)*Math.pow(2,oe),se=se+l):(ie=J*Math.pow(2,l-1)*Math.pow(2,oe),se=0));oe>=8;L[Y+p]=ie&255,p+=y,ie/=256,oe-=8);for(se=se<<oe|ie,$+=oe;$>0;L[Y+p]=se&255,p+=y,se/=256,$-=8);L[Y+p-y]|=b*128};/*!
2
+ * The buffer module from node.js, for the browser.
3
+ *
4
+ * @author Feross Aboukhadijeh <https://feross.org>
5
+ * @license MIT
6
+ */(function(L){const J=a,Y=U,ae=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;L.Buffer=n,L.SlowBuffer=I,L.INSPECT_MAX_BYTES=50;const oe=2147483647;L.kMaxLength=oe;const{Uint8Array:ue,ArrayBuffer:se,SharedArrayBuffer:ie}=globalThis;n.TYPED_ARRAY_SUPPORT=ce(),!n.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function ce(){try{const z=new ue(1),N={foo:function(){return 42}};return Object.setPrototypeOf(N,ue.prototype),Object.setPrototypeOf(z,N),z.foo()===42}catch{return!1}}Object.defineProperty(n.prototype,"parent",{enumerable:!0,get:function(){if(n.isBuffer(this))return this.buffer}}),Object.defineProperty(n.prototype,"offset",{enumerable:!0,get:function(){if(n.isBuffer(this))return this.byteOffset}});function $(z){if(z>oe)throw new RangeError('The value "'+z+'" is invalid for option "size"');const N=new ue(z);return Object.setPrototypeOf(N,n.prototype),N}function n(z,N,H){if(typeof z=="number"){if(typeof N=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return y(z)}return l(z,N,H)}n.poolSize=8192;function l(z,N,H){if(typeof z=="string")return b(z,N);if(se.isView(z))return v(z);if(z==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof z);if(Pe(z,se)||z&&Pe(z.buffer,se)||typeof ie<"u"&&(Pe(z,ie)||z&&Pe(z.buffer,ie)))return o(z,N,H);if(typeof z=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const Q=z.valueOf&&z.valueOf();if(Q!=null&&Q!==z)return n.from(Q,N,H);const ne=m(z);if(ne)return ne;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof z[Symbol.toPrimitive]=="function")return n.from(z[Symbol.toPrimitive]("string"),N,H);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof z)}n.from=function(z,N,H){return l(z,N,H)},Object.setPrototypeOf(n.prototype,ue.prototype),Object.setPrototypeOf(n,ue);function c(z){if(typeof z!="number")throw new TypeError('"size" argument must be of type number');if(z<0)throw new RangeError('The value "'+z+'" is invalid for option "size"')}function p(z,N,H){return c(z),z<=0?$(z):N!==void 0?typeof H=="string"?$(z).fill(N,H):$(z).fill(N):$(z)}n.alloc=function(z,N,H){return p(z,N,H)};function y(z){return c(z),$(z<0?0:A(z)|0)}n.allocUnsafe=function(z){return y(z)},n.allocUnsafeSlow=function(z){return y(z)};function b(z,N){if((typeof N!="string"||N==="")&&(N="utf8"),!n.isEncoding(N))throw new TypeError("Unknown encoding: "+N);const H=F(z,N)|0;let Q=$(H);const ne=Q.write(z,N);return ne!==H&&(Q=Q.slice(0,ne)),Q}function _(z){const N=z.length<0?0:A(z.length)|0,H=$(N);for(let Q=0;Q<N;Q+=1)H[Q]=z[Q]&255;return H}function v(z){if(Pe(z,ue)){const N=new ue(z);return o(N.buffer,N.byteOffset,N.byteLength)}return _(z)}function o(z,N,H){if(N<0||z.byteLength<N)throw new RangeError('"offset" is outside of buffer bounds');if(z.byteLength<N+(H||0))throw new RangeError('"length" is outside of buffer bounds');let Q;return N===void 0&&H===void 0?Q=new ue(z):H===void 0?Q=new ue(z,N):Q=new ue(z,N,H),Object.setPrototypeOf(Q,n.prototype),Q}function m(z){if(n.isBuffer(z)){const N=A(z.length)|0,H=$(N);return H.length===0||z.copy(H,0,0,N),H}if(z.length!==void 0)return typeof z.length!="number"||et(z.length)?$(0):_(z);if(z.type==="Buffer"&&Array.isArray(z.data))return _(z.data)}function A(z){if(z>=oe)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+oe.toString(16)+" bytes");return z|0}function I(z){return+z!=z&&(z=0),n.alloc(+z)}n.isBuffer=function(N){return N!=null&&N._isBuffer===!0&&N!==n.prototype},n.compare=function(N,H){if(Pe(N,ue)&&(N=n.from(N,N.offset,N.byteLength)),Pe(H,ue)&&(H=n.from(H,H.offset,H.byteLength)),!n.isBuffer(N)||!n.isBuffer(H))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(N===H)return 0;let Q=N.length,ne=H.length;for(let ve=0,he=Math.min(Q,ne);ve<he;++ve)if(N[ve]!==H[ve]){Q=N[ve],ne=H[ve];break}return Q<ne?-1:ne<Q?1:0},n.isEncoding=function(N){switch(String(N).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},n.concat=function(N,H){if(!Array.isArray(N))throw new TypeError('"list" argument must be an Array of Buffers');if(N.length===0)return n.alloc(0);let Q;if(H===void 0)for(H=0,Q=0;Q<N.length;++Q)H+=N[Q].length;const ne=n.allocUnsafe(H);let ve=0;for(Q=0;Q<N.length;++Q){let he=N[Q];if(Pe(he,ue))ve+he.length>ne.length?(n.isBuffer(he)||(he=n.from(he)),he.copy(ne,ve)):ue.prototype.set.call(ne,he,ve);else if(n.isBuffer(he))he.copy(ne,ve);else throw new TypeError('"list" argument must be an Array of Buffers');ve+=he.length}return ne};function F(z,N){if(n.isBuffer(z))return z.length;if(se.isView(z)||Pe(z,se))return z.byteLength;if(typeof z!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof z);const H=z.length,Q=arguments.length>2&&arguments[2]===!0;if(!Q&&H===0)return 0;let ne=!1;for(;;)switch(N){case"ascii":case"latin1":case"binary":return H;case"utf8":case"utf-8":return Qe(z).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return H*2;case"hex":return H>>>1;case"base64":return tt(z).length;default:if(ne)return Q?-1:Qe(z).length;N=(""+N).toLowerCase(),ne=!0}}n.byteLength=F;function X(z,N,H){let Q=!1;if((N===void 0||N<0)&&(N=0),N>this.length||((H===void 0||H>this.length)&&(H=this.length),H<=0)||(H>>>=0,N>>>=0,H<=N))return"";for(z||(z="utf8");;)switch(z){case"hex":return Ve(this,N,H);case"utf8":case"utf-8":return de(this,N,H);case"ascii":return we(this,N,H);case"latin1":case"binary":return le(this,N,H);case"base64":return qe(this,N,H);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return _e(this,N,H);default:if(Q)throw new TypeError("Unknown encoding: "+z);z=(z+"").toLowerCase(),Q=!0}}n.prototype._isBuffer=!0;function V(z,N,H){const Q=z[N];z[N]=z[H],z[H]=Q}n.prototype.swap16=function(){const N=this.length;if(N%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let H=0;H<N;H+=2)V(this,H,H+1);return this},n.prototype.swap32=function(){const N=this.length;if(N%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let H=0;H<N;H+=4)V(this,H,H+3),V(this,H+1,H+2);return this},n.prototype.swap64=function(){const N=this.length;if(N%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let H=0;H<N;H+=8)V(this,H,H+7),V(this,H+1,H+6),V(this,H+2,H+5),V(this,H+3,H+4);return this},n.prototype.toString=function(){const N=this.length;return N===0?"":arguments.length===0?de(this,0,N):X.apply(this,arguments)},n.prototype.toLocaleString=n.prototype.toString,n.prototype.equals=function(N){if(!n.isBuffer(N))throw new TypeError("Argument must be a Buffer");return this===N?!0:n.compare(this,N)===0},n.prototype.inspect=function(){let N="";const H=L.INSPECT_MAX_BYTES;return N=this.toString("hex",0,H).replace(/(.{2})/g,"$1 ").trim(),this.length>H&&(N+=" ... "),"<Buffer "+N+">"},ae&&(n.prototype[ae]=n.prototype.inspect),n.prototype.compare=function(N,H,Q,ne,ve){if(Pe(N,ue)&&(N=n.from(N,N.offset,N.byteLength)),!n.isBuffer(N))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof N);if(H===void 0&&(H=0),Q===void 0&&(Q=N?N.length:0),ne===void 0&&(ne=0),ve===void 0&&(ve=this.length),H<0||Q>N.length||ne<0||ve>this.length)throw new RangeError("out of range index");if(ne>=ve&&H>=Q)return 0;if(ne>=ve)return-1;if(H>=Q)return 1;if(H>>>=0,Q>>>=0,ne>>>=0,ve>>>=0,this===N)return 0;let he=ve-ne,be=Q-H;const We=Math.min(he,be),ye=this.slice(ne,ve),Se=N.slice(H,Q);for(let Ke=0;Ke<We;++Ke)if(ye[Ke]!==Se[Ke]){he=ye[Ke],be=Se[Ke];break}return he<be?-1:be<he?1:0};function T(z,N,H,Q,ne){if(z.length===0)return-1;if(typeof H=="string"?(Q=H,H=0):H>2147483647?H=2147483647:H<-2147483648&&(H=-2147483648),H=+H,et(H)&&(H=ne?0:z.length-1),H<0&&(H=z.length+H),H>=z.length){if(ne)return-1;H=z.length-1}else if(H<0)if(ne)H=0;else return-1;if(typeof N=="string"&&(N=n.from(N,Q)),n.isBuffer(N))return N.length===0?-1:D(z,N,H,Q,ne);if(typeof N=="number")return N=N&255,typeof ue.prototype.indexOf=="function"?ne?ue.prototype.indexOf.call(z,N,H):ue.prototype.lastIndexOf.call(z,N,H):D(z,[N],H,Q,ne);throw new TypeError("val must be string, number or Buffer")}function D(z,N,H,Q,ne){let ve=1,he=z.length,be=N.length;if(Q!==void 0&&(Q=String(Q).toLowerCase(),Q==="ucs2"||Q==="ucs-2"||Q==="utf16le"||Q==="utf-16le")){if(z.length<2||N.length<2)return-1;ve=2,he/=2,be/=2,H/=2}function We(Se,Ke){return ve===1?Se[Ke]:Se.readUInt16BE(Ke*ve)}let ye;if(ne){let Se=-1;for(ye=H;ye<he;ye++)if(We(z,ye)===We(N,Se===-1?0:ye-Se)){if(Se===-1&&(Se=ye),ye-Se+1===be)return Se*ve}else Se!==-1&&(ye-=ye-Se),Se=-1}else for(H+be>he&&(H=he-be),ye=H;ye>=0;ye--){let Se=!0;for(let Ke=0;Ke<be;Ke++)if(We(z,ye+Ke)!==We(N,Ke)){Se=!1;break}if(Se)return ye}return-1}n.prototype.includes=function(N,H,Q){return this.indexOf(N,H,Q)!==-1},n.prototype.indexOf=function(N,H,Q){return T(this,N,H,Q,!0)},n.prototype.lastIndexOf=function(N,H,Q){return T(this,N,H,Q,!1)};function Z(z,N,H,Q){H=Number(H)||0;const ne=z.length-H;Q?(Q=Number(Q),Q>ne&&(Q=ne)):Q=ne;const ve=N.length;Q>ve/2&&(Q=ve/2);let he;for(he=0;he<Q;++he){const be=parseInt(N.substr(he*2,2),16);if(et(be))return he;z[H+he]=be}return he}function te(z,N,H,Q){return Ee(Qe(N,z.length-H),z,H,Q)}function ee(z,N,H,Q){return Ee(Te(N),z,H,Q)}function j(z,N,H,Q){return Ee(tt(N),z,H,Q)}function re(z,N,H,Q){return Ee(Ue(N,z.length-H),z,H,Q)}n.prototype.write=function(N,H,Q,ne){if(H===void 0)ne="utf8",Q=this.length,H=0;else if(Q===void 0&&typeof H=="string")ne=H,Q=this.length,H=0;else if(isFinite(H))H=H>>>0,isFinite(Q)?(Q=Q>>>0,ne===void 0&&(ne="utf8")):(ne=Q,Q=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const ve=this.length-H;if((Q===void 0||Q>ve)&&(Q=ve),N.length>0&&(Q<0||H<0)||H>this.length)throw new RangeError("Attempt to write outside buffer bounds");ne||(ne="utf8");let he=!1;for(;;)switch(ne){case"hex":return Z(this,N,H,Q);case"utf8":case"utf-8":return te(this,N,H,Q);case"ascii":case"latin1":case"binary":return ee(this,N,H,Q);case"base64":return j(this,N,H,Q);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return re(this,N,H,Q);default:if(he)throw new TypeError("Unknown encoding: "+ne);ne=(""+ne).toLowerCase(),he=!0}},n.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function qe(z,N,H){return N===0&&H===z.length?J.fromByteArray(z):J.fromByteArray(z.slice(N,H))}function de(z,N,H){H=Math.min(z.length,H);const Q=[];let ne=N;for(;ne<H;){const ve=z[ne];let he=null,be=ve>239?4:ve>223?3:ve>191?2:1;if(ne+be<=H){let We,ye,Se,Ke;switch(be){case 1:ve<128&&(he=ve);break;case 2:We=z[ne+1],(We&192)===128&&(Ke=(ve&31)<<6|We&63,Ke>127&&(he=Ke));break;case 3:We=z[ne+1],ye=z[ne+2],(We&192)===128&&(ye&192)===128&&(Ke=(ve&15)<<12|(We&63)<<6|ye&63,Ke>2047&&(Ke<55296||Ke>57343)&&(he=Ke));break;case 4:We=z[ne+1],ye=z[ne+2],Se=z[ne+3],(We&192)===128&&(ye&192)===128&&(Se&192)===128&&(Ke=(ve&15)<<18|(We&63)<<12|(ye&63)<<6|Se&63,Ke>65535&&Ke<1114112&&(he=Ke))}}he===null?(he=65533,be=1):he>65535&&(he-=65536,Q.push(he>>>10&1023|55296),he=56320|he&1023),Q.push(he),ne+=be}return je(Q)}const pe=4096;function je(z){const N=z.length;if(N<=pe)return String.fromCharCode.apply(String,z);let H="",Q=0;for(;Q<N;)H+=String.fromCharCode.apply(String,z.slice(Q,Q+=pe));return H}function we(z,N,H){let Q="";H=Math.min(z.length,H);for(let ne=N;ne<H;++ne)Q+=String.fromCharCode(z[ne]&127);return Q}function le(z,N,H){let Q="";H=Math.min(z.length,H);for(let ne=N;ne<H;++ne)Q+=String.fromCharCode(z[ne]);return Q}function Ve(z,N,H){const Q=z.length;(!N||N<0)&&(N=0),(!H||H<0||H>Q)&&(H=Q);let ne="";for(let ve=N;ve<H;++ve)ne+=Ie[z[ve]];return ne}function _e(z,N,H){const Q=z.slice(N,H);let ne="";for(let ve=0;ve<Q.length-1;ve+=2)ne+=String.fromCharCode(Q[ve]+Q[ve+1]*256);return ne}n.prototype.slice=function(N,H){const Q=this.length;N=~~N,H=H===void 0?Q:~~H,N<0?(N+=Q,N<0&&(N=0)):N>Q&&(N=Q),H<0?(H+=Q,H<0&&(H=0)):H>Q&&(H=Q),H<N&&(H=N);const ne=this.subarray(N,H);return Object.setPrototypeOf(ne,n.prototype),ne};function xe(z,N,H){if(z%1!==0||z<0)throw new RangeError("offset is not uint");if(z+N>H)throw new RangeError("Trying to access beyond buffer length")}n.prototype.readUintLE=n.prototype.readUIntLE=function(N,H,Q){N=N>>>0,H=H>>>0,Q||xe(N,H,this.length);let ne=this[N],ve=1,he=0;for(;++he<H&&(ve*=256);)ne+=this[N+he]*ve;return ne},n.prototype.readUintBE=n.prototype.readUIntBE=function(N,H,Q){N=N>>>0,H=H>>>0,Q||xe(N,H,this.length);let ne=this[N+--H],ve=1;for(;H>0&&(ve*=256);)ne+=this[N+--H]*ve;return ne},n.prototype.readUint8=n.prototype.readUInt8=function(N,H){return N=N>>>0,H||xe(N,1,this.length),this[N]},n.prototype.readUint16LE=n.prototype.readUInt16LE=function(N,H){return N=N>>>0,H||xe(N,2,this.length),this[N]|this[N+1]<<8},n.prototype.readUint16BE=n.prototype.readUInt16BE=function(N,H){return N=N>>>0,H||xe(N,2,this.length),this[N]<<8|this[N+1]},n.prototype.readUint32LE=n.prototype.readUInt32LE=function(N,H){return N=N>>>0,H||xe(N,4,this.length),(this[N]|this[N+1]<<8|this[N+2]<<16)+this[N+3]*16777216},n.prototype.readUint32BE=n.prototype.readUInt32BE=function(N,H){return N=N>>>0,H||xe(N,4,this.length),this[N]*16777216+(this[N+1]<<16|this[N+2]<<8|this[N+3])},n.prototype.readBigUInt64LE=Le(function(N){N=N>>>0,Oe(N,"offset");const H=this[N],Q=this[N+7];(H===void 0||Q===void 0)&&Je(N,this.length-8);const ne=H+this[++N]*2**8+this[++N]*2**16+this[++N]*2**24,ve=this[++N]+this[++N]*2**8+this[++N]*2**16+Q*2**24;return BigInt(ne)+(BigInt(ve)<<BigInt(32))}),n.prototype.readBigUInt64BE=Le(function(N){N=N>>>0,Oe(N,"offset");const H=this[N],Q=this[N+7];(H===void 0||Q===void 0)&&Je(N,this.length-8);const ne=H*2**24+this[++N]*2**16+this[++N]*2**8+this[++N],ve=this[++N]*2**24+this[++N]*2**16+this[++N]*2**8+Q;return(BigInt(ne)<<BigInt(32))+BigInt(ve)}),n.prototype.readIntLE=function(N,H,Q){N=N>>>0,H=H>>>0,Q||xe(N,H,this.length);let ne=this[N],ve=1,he=0;for(;++he<H&&(ve*=256);)ne+=this[N+he]*ve;return ve*=128,ne>=ve&&(ne-=Math.pow(2,8*H)),ne},n.prototype.readIntBE=function(N,H,Q){N=N>>>0,H=H>>>0,Q||xe(N,H,this.length);let ne=H,ve=1,he=this[N+--ne];for(;ne>0&&(ve*=256);)he+=this[N+--ne]*ve;return ve*=128,he>=ve&&(he-=Math.pow(2,8*H)),he},n.prototype.readInt8=function(N,H){return N=N>>>0,H||xe(N,1,this.length),this[N]&128?(255-this[N]+1)*-1:this[N]},n.prototype.readInt16LE=function(N,H){N=N>>>0,H||xe(N,2,this.length);const Q=this[N]|this[N+1]<<8;return Q&32768?Q|4294901760:Q},n.prototype.readInt16BE=function(N,H){N=N>>>0,H||xe(N,2,this.length);const Q=this[N+1]|this[N]<<8;return Q&32768?Q|4294901760:Q},n.prototype.readInt32LE=function(N,H){return N=N>>>0,H||xe(N,4,this.length),this[N]|this[N+1]<<8|this[N+2]<<16|this[N+3]<<24},n.prototype.readInt32BE=function(N,H){return N=N>>>0,H||xe(N,4,this.length),this[N]<<24|this[N+1]<<16|this[N+2]<<8|this[N+3]},n.prototype.readBigInt64LE=Le(function(N){N=N>>>0,Oe(N,"offset");const H=this[N],Q=this[N+7];(H===void 0||Q===void 0)&&Je(N,this.length-8);const ne=this[N+4]+this[N+5]*2**8+this[N+6]*2**16+(Q<<24);return(BigInt(ne)<<BigInt(32))+BigInt(H+this[++N]*2**8+this[++N]*2**16+this[++N]*2**24)}),n.prototype.readBigInt64BE=Le(function(N){N=N>>>0,Oe(N,"offset");const H=this[N],Q=this[N+7];(H===void 0||Q===void 0)&&Je(N,this.length-8);const ne=(H<<24)+this[++N]*2**16+this[++N]*2**8+this[++N];return(BigInt(ne)<<BigInt(32))+BigInt(this[++N]*2**24+this[++N]*2**16+this[++N]*2**8+Q)}),n.prototype.readFloatLE=function(N,H){return N=N>>>0,H||xe(N,4,this.length),Y.read(this,N,!0,23,4)},n.prototype.readFloatBE=function(N,H){return N=N>>>0,H||xe(N,4,this.length),Y.read(this,N,!1,23,4)},n.prototype.readDoubleLE=function(N,H){return N=N>>>0,H||xe(N,8,this.length),Y.read(this,N,!0,52,8)},n.prototype.readDoubleBE=function(N,H){return N=N>>>0,H||xe(N,8,this.length),Y.read(this,N,!1,52,8)};function ze(z,N,H,Q,ne,ve){if(!n.isBuffer(z))throw new TypeError('"buffer" argument must be a Buffer instance');if(N>ne||N<ve)throw new RangeError('"value" argument is out of bounds');if(H+Q>z.length)throw new RangeError("Index out of range")}n.prototype.writeUintLE=n.prototype.writeUIntLE=function(N,H,Q,ne){if(N=+N,H=H>>>0,Q=Q>>>0,!ne){const be=Math.pow(2,8*Q)-1;ze(this,N,H,Q,be,0)}let ve=1,he=0;for(this[H]=N&255;++he<Q&&(ve*=256);)this[H+he]=N/ve&255;return H+Q},n.prototype.writeUintBE=n.prototype.writeUIntBE=function(N,H,Q,ne){if(N=+N,H=H>>>0,Q=Q>>>0,!ne){const be=Math.pow(2,8*Q)-1;ze(this,N,H,Q,be,0)}let ve=Q-1,he=1;for(this[H+ve]=N&255;--ve>=0&&(he*=256);)this[H+ve]=N/he&255;return H+Q},n.prototype.writeUint8=n.prototype.writeUInt8=function(N,H,Q){return N=+N,H=H>>>0,Q||ze(this,N,H,1,255,0),this[H]=N&255,H+1},n.prototype.writeUint16LE=n.prototype.writeUInt16LE=function(N,H,Q){return N=+N,H=H>>>0,Q||ze(this,N,H,2,65535,0),this[H]=N&255,this[H+1]=N>>>8,H+2},n.prototype.writeUint16BE=n.prototype.writeUInt16BE=function(N,H,Q){return N=+N,H=H>>>0,Q||ze(this,N,H,2,65535,0),this[H]=N>>>8,this[H+1]=N&255,H+2},n.prototype.writeUint32LE=n.prototype.writeUInt32LE=function(N,H,Q){return N=+N,H=H>>>0,Q||ze(this,N,H,4,4294967295,0),this[H+3]=N>>>24,this[H+2]=N>>>16,this[H+1]=N>>>8,this[H]=N&255,H+4},n.prototype.writeUint32BE=n.prototype.writeUInt32BE=function(N,H,Q){return N=+N,H=H>>>0,Q||ze(this,N,H,4,4294967295,0),this[H]=N>>>24,this[H+1]=N>>>16,this[H+2]=N>>>8,this[H+3]=N&255,H+4};function me(z,N,H,Q,ne){Ae(N,Q,ne,z,H,7);let ve=Number(N&BigInt(4294967295));z[H++]=ve,ve=ve>>8,z[H++]=ve,ve=ve>>8,z[H++]=ve,ve=ve>>8,z[H++]=ve;let he=Number(N>>BigInt(32)&BigInt(4294967295));return z[H++]=he,he=he>>8,z[H++]=he,he=he>>8,z[H++]=he,he=he>>8,z[H++]=he,H}function ke(z,N,H,Q,ne){Ae(N,Q,ne,z,H,7);let ve=Number(N&BigInt(4294967295));z[H+7]=ve,ve=ve>>8,z[H+6]=ve,ve=ve>>8,z[H+5]=ve,ve=ve>>8,z[H+4]=ve;let he=Number(N>>BigInt(32)&BigInt(4294967295));return z[H+3]=he,he=he>>8,z[H+2]=he,he=he>>8,z[H+1]=he,he=he>>8,z[H]=he,H+8}n.prototype.writeBigUInt64LE=Le(function(N,H=0){return me(this,N,H,BigInt(0),BigInt("0xffffffffffffffff"))}),n.prototype.writeBigUInt64BE=Le(function(N,H=0){return ke(this,N,H,BigInt(0),BigInt("0xffffffffffffffff"))}),n.prototype.writeIntLE=function(N,H,Q,ne){if(N=+N,H=H>>>0,!ne){const We=Math.pow(2,8*Q-1);ze(this,N,H,Q,We-1,-We)}let ve=0,he=1,be=0;for(this[H]=N&255;++ve<Q&&(he*=256);)N<0&&be===0&&this[H+ve-1]!==0&&(be=1),this[H+ve]=(N/he>>0)-be&255;return H+Q},n.prototype.writeIntBE=function(N,H,Q,ne){if(N=+N,H=H>>>0,!ne){const We=Math.pow(2,8*Q-1);ze(this,N,H,Q,We-1,-We)}let ve=Q-1,he=1,be=0;for(this[H+ve]=N&255;--ve>=0&&(he*=256);)N<0&&be===0&&this[H+ve+1]!==0&&(be=1),this[H+ve]=(N/he>>0)-be&255;return H+Q},n.prototype.writeInt8=function(N,H,Q){return N=+N,H=H>>>0,Q||ze(this,N,H,1,127,-128),N<0&&(N=255+N+1),this[H]=N&255,H+1},n.prototype.writeInt16LE=function(N,H,Q){return N=+N,H=H>>>0,Q||ze(this,N,H,2,32767,-32768),this[H]=N&255,this[H+1]=N>>>8,H+2},n.prototype.writeInt16BE=function(N,H,Q){return N=+N,H=H>>>0,Q||ze(this,N,H,2,32767,-32768),this[H]=N>>>8,this[H+1]=N&255,H+2},n.prototype.writeInt32LE=function(N,H,Q){return N=+N,H=H>>>0,Q||ze(this,N,H,4,2147483647,-2147483648),this[H]=N&255,this[H+1]=N>>>8,this[H+2]=N>>>16,this[H+3]=N>>>24,H+4},n.prototype.writeInt32BE=function(N,H,Q){return N=+N,H=H>>>0,Q||ze(this,N,H,4,2147483647,-2147483648),N<0&&(N=4294967295+N+1),this[H]=N>>>24,this[H+1]=N>>>16,this[H+2]=N>>>8,this[H+3]=N&255,H+4},n.prototype.writeBigInt64LE=Le(function(N,H=0){return me(this,N,H,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),n.prototype.writeBigInt64BE=Le(function(N,H=0){return ke(this,N,H,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function Ge(z,N,H,Q,ne,ve){if(H+Q>z.length)throw new RangeError("Index out of range");if(H<0)throw new RangeError("Index out of range")}function Me(z,N,H,Q,ne){return N=+N,H=H>>>0,ne||Ge(z,N,H,4),Y.write(z,N,H,Q,23,4),H+4}n.prototype.writeFloatLE=function(N,H,Q){return Me(this,N,H,!0,Q)},n.prototype.writeFloatBE=function(N,H,Q){return Me(this,N,H,!1,Q)};function Ne(z,N,H,Q,ne){return N=+N,H=H>>>0,ne||Ge(z,N,H,8),Y.write(z,N,H,Q,52,8),H+8}n.prototype.writeDoubleLE=function(N,H,Q){return Ne(this,N,H,!0,Q)},n.prototype.writeDoubleBE=function(N,H,Q){return Ne(this,N,H,!1,Q)},n.prototype.copy=function(N,H,Q,ne){if(!n.isBuffer(N))throw new TypeError("argument should be a Buffer");if(Q||(Q=0),!ne&&ne!==0&&(ne=this.length),H>=N.length&&(H=N.length),H||(H=0),ne>0&&ne<Q&&(ne=Q),ne===Q||N.length===0||this.length===0)return 0;if(H<0)throw new RangeError("targetStart out of bounds");if(Q<0||Q>=this.length)throw new RangeError("Index out of range");if(ne<0)throw new RangeError("sourceEnd out of bounds");ne>this.length&&(ne=this.length),N.length-H<ne-Q&&(ne=N.length-H+Q);const ve=ne-Q;return this===N&&typeof ue.prototype.copyWithin=="function"?this.copyWithin(H,Q,ne):ue.prototype.set.call(N,this.subarray(Q,ne),H),ve},n.prototype.fill=function(N,H,Q,ne){if(typeof N=="string"){if(typeof H=="string"?(ne=H,H=0,Q=this.length):typeof Q=="string"&&(ne=Q,Q=this.length),ne!==void 0&&typeof ne!="string")throw new TypeError("encoding must be a string");if(typeof ne=="string"&&!n.isEncoding(ne))throw new TypeError("Unknown encoding: "+ne);if(N.length===1){const he=N.charCodeAt(0);(ne==="utf8"&&he<128||ne==="latin1")&&(N=he)}}else typeof N=="number"?N=N&255:typeof N=="boolean"&&(N=Number(N));if(H<0||this.length<H||this.length<Q)throw new RangeError("Out of range index");if(Q<=H)return this;H=H>>>0,Q=Q===void 0?this.length:Q>>>0,N||(N=0);let ve;if(typeof N=="number")for(ve=H;ve<Q;++ve)this[ve]=N;else{const he=n.isBuffer(N)?N:n.from(N,ne),be=he.length;if(be===0)throw new TypeError('The value "'+N+'" is invalid for argument "value"');for(ve=0;ve<Q-H;++ve)this[ve+H]=he[ve%be]}return this};const Ze={};function Be(z,N,H){Ze[z]=class extends H{constructor(){super(),Object.defineProperty(this,"message",{value:N.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${z}]`,this.stack,delete this.name}get code(){return z}set code(ne){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:ne,writable:!0})}toString(){return`${this.name} [${z}]: ${this.message}`}}}Be("ERR_BUFFER_OUT_OF_BOUNDS",function(z){return z?`${z} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),Be("ERR_INVALID_ARG_TYPE",function(z,N){return`The "${z}" argument must be of type number. Received type ${typeof N}`},TypeError),Be("ERR_OUT_OF_RANGE",function(z,N,H){let Q=`The value of "${z}" is out of range.`,ne=H;return Number.isInteger(H)&&Math.abs(H)>2**32?ne=De(String(H)):typeof H=="bigint"&&(ne=String(H),(H>BigInt(2)**BigInt(32)||H<-(BigInt(2)**BigInt(32)))&&(ne=De(ne)),ne+="n"),Q+=` It must be ${N}. Received ${ne}`,Q},RangeError);function De(z){let N="",H=z.length;const Q=z[0]==="-"?1:0;for(;H>=Q+4;H-=3)N=`_${z.slice(H-3,H)}${N}`;return`${z.slice(0,H)}${N}`}function rt(z,N,H){Oe(N,"offset"),(z[N]===void 0||z[N+H]===void 0)&&Je(N,z.length-(H+1))}function Ae(z,N,H,Q,ne,ve){if(z>H||z<N){const he=typeof N=="bigint"?"n":"";let be;throw N===0||N===BigInt(0)?be=`>= 0${he} and < 2${he} ** ${(ve+1)*8}${he}`:be=`>= -(2${he} ** ${(ve+1)*8-1}${he}) and < 2 ** ${(ve+1)*8-1}${he}`,new Ze.ERR_OUT_OF_RANGE("value",be,z)}rt(Q,ne,ve)}function Oe(z,N){if(typeof z!="number")throw new Ze.ERR_INVALID_ARG_TYPE(N,"number",z)}function Je(z,N,H){throw Math.floor(z)!==z?(Oe(z,H),new Ze.ERR_OUT_OF_RANGE("offset","an integer",z)):N<0?new Ze.ERR_BUFFER_OUT_OF_BOUNDS:new Ze.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${N}`,z)}const Re=/[^+/0-9A-Za-z-_]/g;function He(z){if(z=z.split("=")[0],z=z.trim().replace(Re,""),z.length<2)return"";for(;z.length%4!==0;)z=z+"=";return z}function Qe(z,N){N=N||1/0;let H;const Q=z.length;let ne=null;const ve=[];for(let he=0;he<Q;++he){if(H=z.charCodeAt(he),H>55295&&H<57344){if(!ne){if(H>56319){(N-=3)>-1&&ve.push(239,191,189);continue}else if(he+1===Q){(N-=3)>-1&&ve.push(239,191,189);continue}ne=H;continue}if(H<56320){(N-=3)>-1&&ve.push(239,191,189),ne=H;continue}H=(ne-55296<<10|H-56320)+65536}else ne&&(N-=3)>-1&&ve.push(239,191,189);if(ne=null,H<128){if((N-=1)<0)break;ve.push(H)}else if(H<2048){if((N-=2)<0)break;ve.push(H>>6|192,H&63|128)}else if(H<65536){if((N-=3)<0)break;ve.push(H>>12|224,H>>6&63|128,H&63|128)}else if(H<1114112){if((N-=4)<0)break;ve.push(H>>18|240,H>>12&63|128,H>>6&63|128,H&63|128)}else throw new Error("Invalid code point")}return ve}function Te(z){const N=[];for(let H=0;H<z.length;++H)N.push(z.charCodeAt(H)&255);return N}function Ue(z,N){let H,Q,ne;const ve=[];for(let he=0;he<z.length&&!((N-=2)<0);++he)H=z.charCodeAt(he),Q=H>>8,ne=H%256,ve.push(ne),ve.push(Q);return ve}function tt(z){return J.toByteArray(He(z))}function Ee(z,N,H,Q){let ne;for(ne=0;ne<Q&&!(ne+H>=N.length||ne>=z.length);++ne)N[ne+H]=z[ne];return ne}function Pe(z,N){return z instanceof N||z!=null&&z.constructor!=null&&z.constructor.name!=null&&z.constructor.name===N.name}function et(z){return z!==z}const Ie=function(){const z="0123456789abcdef",N=new Array(256);for(let H=0;H<16;++H){const Q=H*16;for(let ne=0;ne<16;++ne)N[Q+ne]=z[H]+z[ne]}return N}();function Le(z){return typeof BigInt>"u"?it:z}function it(){throw new Error("BigInt not supported")}})(t);const P=t.Buffer;e.Blob=t.Blob,e.BlobOptions=t.BlobOptions,e.Buffer=t.Buffer,e.File=t.File,e.FileOptions=t.FileOptions,e.INSPECT_MAX_BYTES=t.INSPECT_MAX_BYTES,e.SlowBuffer=t.SlowBuffer,e.TranscodeEncoding=t.TranscodeEncoding,e.atob=t.atob,e.btoa=t.btoa,e.constants=t.constants,e.default=P,e.isAscii=t.isAscii,e.isUtf8=t.isUtf8,e.kMaxLength=t.kMaxLength,e.kStringMaxLength=t.kStringMaxLength,e.resolveObjectURL=t.resolveObjectURL,e.transcode=t.transcode})(dist);const Buffer$F=getDefaultExportFromCjs$1(dist);/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */(function(e,t){var a=dist,u=a.Buffer;function d(w,x){for(var M in w)x[M]=w[M]}u.from&&u.alloc&&u.allocUnsafe&&u.allocUnsafeSlow?e.exports=a:(d(a,t),t.Buffer=h);function h(w,x,M){return u(w,x,M)}h.prototype=Object.create(u.prototype),d(u,h),h.from=function(w,x,M){if(typeof w=="number")throw new TypeError("Argument must not be a number");return u(w,x,M)},h.alloc=function(w,x,M){if(typeof w!="number")throw new TypeError("Argument must be a number");var B=u(w);return x!==void 0?typeof M=="string"?B.fill(x,M):B.fill(x):B.fill(0),B},h.allocUnsafe=function(w){if(typeof w!="number")throw new TypeError("Argument must be a number");return u(w)},h.allocUnsafeSlow=function(w){if(typeof w!="number")throw new TypeError("Argument must be a number");return a.SlowBuffer(w)}})(safeBuffer$5,safeBuffer$5.exports);var safeBufferExports$2=safeBuffer$5.exports,MAX_BYTES=65536,MAX_UINT32=4294967295;function oldBrowser$1(){throw new Error(`Secure random number generation is not supported by this browser.
7
+ Use Chrome, Firefox or Internet Explorer 11`)}var Buffer$E=safeBufferExports$2.Buffer,crypto$2=commonjsGlobal.crypto||commonjsGlobal.msCrypto;crypto$2&&crypto$2.getRandomValues?browser$b.exports=randomBytes$3:browser$b.exports=oldBrowser$1;function randomBytes$3(e,t){if(e>MAX_UINT32)throw new RangeError("requested too many random bytes");var a=Buffer$E.allocUnsafe(e);if(e>0)if(e>MAX_BYTES)for(var u=0;u<e;u+=MAX_BYTES)crypto$2.getRandomValues(a.slice(u,u+MAX_BYTES));else crypto$2.getRandomValues(a);return typeof t=="function"?process$1.nextTick(function(){t(null,a)}):a}var browserExports=browser$b.exports,inherits_browser={exports:{}};typeof Object.create=="function"?inherits_browser.exports=function(t,a){a&&(t.super_=a,t.prototype=Object.create(a.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:inherits_browser.exports=function(t,a){if(a){t.super_=a;var u=function(){};u.prototype=a.prototype,t.prototype=new u,t.prototype.constructor=t}};var inherits_browserExports=inherits_browser.exports,events={exports:{}},R=typeof Reflect=="object"?Reflect:null,ReflectApply=R&&typeof R.apply=="function"?R.apply:function(t,a,u){return Function.prototype.apply.call(t,a,u)},ReflectOwnKeys;R&&typeof R.ownKeys=="function"?ReflectOwnKeys=R.ownKeys:Object.getOwnPropertySymbols?ReflectOwnKeys=function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:ReflectOwnKeys=function(t){return Object.getOwnPropertyNames(t)};function ProcessEmitWarning(e){console&&console.warn&&console.warn(e)}var NumberIsNaN=Number.isNaN||function(t){return t!==t};function EventEmitter(){EventEmitter.init.call(this)}events.exports=EventEmitter;events.exports.once=once;EventEmitter.EventEmitter=EventEmitter;EventEmitter.prototype._events=void 0;EventEmitter.prototype._eventsCount=0;EventEmitter.prototype._maxListeners=void 0;var defaultMaxListeners=10;function checkListener(e){if(typeof e!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}Object.defineProperty(EventEmitter,"defaultMaxListeners",{enumerable:!0,get:function(){return defaultMaxListeners},set:function(e){if(typeof e!="number"||e<0||NumberIsNaN(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");defaultMaxListeners=e}});EventEmitter.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0};EventEmitter.prototype.setMaxListeners=function(t){if(typeof t!="number"||t<0||NumberIsNaN(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this};function _getMaxListeners(e){return e._maxListeners===void 0?EventEmitter.defaultMaxListeners:e._maxListeners}EventEmitter.prototype.getMaxListeners=function(){return _getMaxListeners(this)};EventEmitter.prototype.emit=function(t){for(var a=[],u=1;u<arguments.length;u++)a.push(arguments[u]);var d=t==="error",h=this._events;if(h!==void 0)d=d&&h.error===void 0;else if(!d)return!1;if(d){var w;if(a.length>0&&(w=a[0]),w instanceof Error)throw w;var x=new Error("Unhandled error."+(w?" ("+w.message+")":""));throw x.context=w,x}var M=h[t];if(M===void 0)return!1;if(typeof M=="function")ReflectApply(M,this,a);else for(var B=M.length,E=arrayClone(M,B),u=0;u<B;++u)ReflectApply(E[u],this,a);return!0};function _addListener(e,t,a,u){var d,h,w;if(checkListener(a),h=e._events,h===void 0?(h=e._events=Object.create(null),e._eventsCount=0):(h.newListener!==void 0&&(e.emit("newListener",t,a.listener?a.listener:a),h=e._events),w=h[t]),w===void 0)w=h[t]=a,++e._eventsCount;else if(typeof w=="function"?w=h[t]=u?[a,w]:[w,a]:u?w.unshift(a):w.push(a),d=_getMaxListeners(e),d>0&&w.length>d&&!w.warned){w.warned=!0;var x=new Error("Possible EventEmitter memory leak detected. "+w.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");x.name="MaxListenersExceededWarning",x.emitter=e,x.type=t,x.count=w.length,ProcessEmitWarning(x)}return e}EventEmitter.prototype.addListener=function(t,a){return _addListener(this,t,a,!1)};EventEmitter.prototype.on=EventEmitter.prototype.addListener;EventEmitter.prototype.prependListener=function(t,a){return _addListener(this,t,a,!0)};function onceWrapper(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function _onceWrap(e,t,a){var u={fired:!1,wrapFn:void 0,target:e,type:t,listener:a},d=onceWrapper.bind(u);return d.listener=a,u.wrapFn=d,d}EventEmitter.prototype.once=function(t,a){return checkListener(a),this.on(t,_onceWrap(this,t,a)),this};EventEmitter.prototype.prependOnceListener=function(t,a){return checkListener(a),this.prependListener(t,_onceWrap(this,t,a)),this};EventEmitter.prototype.removeListener=function(t,a){var u,d,h,w,x;if(checkListener(a),d=this._events,d===void 0)return this;if(u=d[t],u===void 0)return this;if(u===a||u.listener===a)--this._eventsCount===0?this._events=Object.create(null):(delete d[t],d.removeListener&&this.emit("removeListener",t,u.listener||a));else if(typeof u!="function"){for(h=-1,w=u.length-1;w>=0;w--)if(u[w]===a||u[w].listener===a){x=u[w].listener,h=w;break}if(h<0)return this;h===0?u.shift():spliceOne(u,h),u.length===1&&(d[t]=u[0]),d.removeListener!==void 0&&this.emit("removeListener",t,x||a)}return this};EventEmitter.prototype.off=EventEmitter.prototype.removeListener;EventEmitter.prototype.removeAllListeners=function(t){var a,u,d;if(u=this._events,u===void 0)return this;if(u.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):u[t]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete u[t]),this;if(arguments.length===0){var h=Object.keys(u),w;for(d=0;d<h.length;++d)w=h[d],w!=="removeListener"&&this.removeAllListeners(w);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(a=u[t],typeof a=="function")this.removeListener(t,a);else if(a!==void 0)for(d=a.length-1;d>=0;d--)this.removeListener(t,a[d]);return this};function _listeners(e,t,a){var u=e._events;if(u===void 0)return[];var d=u[t];return d===void 0?[]:typeof d=="function"?a?[d.listener||d]:[d]:a?unwrapListeners(d):arrayClone(d,d.length)}EventEmitter.prototype.listeners=function(t){return _listeners(this,t,!0)};EventEmitter.prototype.rawListeners=function(t){return _listeners(this,t,!1)};EventEmitter.listenerCount=function(e,t){return typeof e.listenerCount=="function"?e.listenerCount(t):listenerCount.call(e,t)};EventEmitter.prototype.listenerCount=listenerCount;function listenerCount(e){var t=this._events;if(t!==void 0){var a=t[e];if(typeof a=="function")return 1;if(a!==void 0)return a.length}return 0}EventEmitter.prototype.eventNames=function(){return this._eventsCount>0?ReflectOwnKeys(this._events):[]};function arrayClone(e,t){for(var a=new Array(t),u=0;u<t;++u)a[u]=e[u];return a}function spliceOne(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}function unwrapListeners(e){for(var t=new Array(e.length),a=0;a<t.length;++a)t[a]=e[a].listener||e[a];return t}function once(e,t){return new Promise(function(a,u){function d(w){e.removeListener(t,h),u(w)}function h(){typeof e.removeListener=="function"&&e.removeListener("error",d),a([].slice.call(arguments))}eventTargetAgnosticAddListener(e,t,h,{once:!0}),t!=="error"&&addErrorHandlerIfEventEmitter(e,d,{once:!0})})}function addErrorHandlerIfEventEmitter(e,t,a){typeof e.on=="function"&&eventTargetAgnosticAddListener(e,"error",t,a)}function eventTargetAgnosticAddListener(e,t,a,u){if(typeof e.on=="function")u.once?e.once(t,a):e.on(t,a);else if(typeof e.addEventListener=="function")e.addEventListener(t,function d(h){u.once&&e.removeEventListener(t,d),a(h)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e)}var eventsExports=events.exports,streamBrowser$2,hasRequiredStreamBrowser;function requireStreamBrowser(){return hasRequiredStreamBrowser||(hasRequiredStreamBrowser=1,streamBrowser$2=eventsExports.EventEmitter),streamBrowser$2}var util$5={},types={},shams$1=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var t={},a=Symbol("test"),u=Object(a);if(typeof a=="string"||Object.prototype.toString.call(a)!=="[object Symbol]"||Object.prototype.toString.call(u)!=="[object Symbol]")return!1;var d=42;t[a]=d;for(var h in t)return!1;if(typeof Object.keys=="function"&&Object.keys(t).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(t).length!==0)return!1;var w=Object.getOwnPropertySymbols(t);if(w.length!==1||w[0]!==a||!Object.prototype.propertyIsEnumerable.call(t,a))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var x=Object.getOwnPropertyDescriptor(t,a);if(x.value!==d||x.enumerable!==!0)return!1}return!0},hasSymbols$2=shams$1,shams=function(){return hasSymbols$2()&&!!Symbol.toStringTag},esObjectAtoms=Object,esErrors=Error,_eval=EvalError,range=RangeError,ref=ReferenceError,syntax=SyntaxError,type=TypeError,uri=URIError,abs$1=Math.abs,floor$1=Math.floor,max$2=Math.max,min$1=Math.min,pow$2=Math.pow,round$1=Math.round,_isNaN=Number.isNaN||function(t){return t!==t},$isNaN=_isNaN,sign$2=function(t){return $isNaN(t)||t===0?t:t<0?-1:1},gOPD$4=Object.getOwnPropertyDescriptor,$gOPD$1=gOPD$4;if($gOPD$1)try{$gOPD$1([],"length")}catch{$gOPD$1=null}var gopd$1=$gOPD$1,$defineProperty$3=Object.defineProperty||!1;if($defineProperty$3)try{$defineProperty$3({},"a",{value:1})}catch{$defineProperty$3=!1}var esDefineProperty=$defineProperty$3,hasSymbols$1,hasRequiredHasSymbols;function requireHasSymbols(){if(hasRequiredHasSymbols)return hasSymbols$1;hasRequiredHasSymbols=1;var e=typeof Symbol<"u"&&Symbol,t=shams$1;return hasSymbols$1=function(){return typeof e!="function"||typeof Symbol!="function"||typeof e("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:t()},hasSymbols$1}var Reflect_getPrototypeOf=typeof Reflect<"u"&&Reflect.getPrototypeOf||null,$Object$2=esObjectAtoms,Object_getPrototypeOf=$Object$2.getPrototypeOf||null,ERROR_MESSAGE="Function.prototype.bind called on incompatible ",toStr$3=Object.prototype.toString,max$1=Math.max,funcType="[object Function]",concatty=function(t,a){for(var u=[],d=0;d<t.length;d+=1)u[d]=t[d];for(var h=0;h<a.length;h+=1)u[h+t.length]=a[h];return u},slicy=function(t,a){for(var u=[],d=a,h=0;d<t.length;d+=1,h+=1)u[h]=t[d];return u},joiny=function(e,t){for(var a="",u=0;u<e.length;u+=1)a+=e[u],u+1<e.length&&(a+=t);return a},implementation$1=function(t){var a=this;if(typeof a!="function"||toStr$3.apply(a)!==funcType)throw new TypeError(ERROR_MESSAGE+a);for(var u=slicy(arguments,1),d,h=function(){if(this instanceof d){var E=a.apply(this,concatty(u,arguments));return Object(E)===E?E:this}return a.apply(t,concatty(u,arguments))},w=max$1(0,a.length-u.length),x=[],M=0;M<w;M++)x[M]="$"+M;if(d=Function("binder","return function ("+joiny(x,",")+"){ return binder.apply(this,arguments); }")(h),a.prototype){var B=function(){};B.prototype=a.prototype,d.prototype=new B,B.prototype=null}return d},implementation=implementation$1,functionBind=Function.prototype.bind||implementation,functionCall=Function.prototype.call,functionApply=Function.prototype.apply,reflectApply$1=typeof Reflect<"u"&&Reflect&&Reflect.apply,bind$3=functionBind,$apply$2=functionApply,$call$2=functionCall,$reflectApply=reflectApply$1,actualApply$1=$reflectApply||bind$3.call($call$2,$apply$2),bind$2=functionBind,$TypeError$5=type,$call$1=functionCall,$actualApply=actualApply$1,callBindApplyHelpers=function(t){if(t.length<1||typeof t[0]!="function")throw new $TypeError$5("a function is required");return $actualApply(bind$2,$call$1,t)},callBind$2=callBindApplyHelpers,gOPD$3=gopd$1,hasProtoAccessor;try{hasProtoAccessor=[].__proto__===Array.prototype}catch(e){if(!e||typeof e!="object"||!("code"in e)||e.code!=="ERR_PROTO_ACCESS")throw e}var desc=!!hasProtoAccessor&&gOPD$3&&gOPD$3(Object.prototype,"__proto__"),$Object$1=Object,$getPrototypeOf=$Object$1.getPrototypeOf,get=desc&&typeof desc.get=="function"?callBind$2([desc.get]):typeof $getPrototypeOf=="function"?function(t){return $getPrototypeOf(t==null?t:$Object$1(t))}:!1,reflectGetProto=Reflect_getPrototypeOf,originalGetProto=Object_getPrototypeOf,getDunderProto=get,getProto$3=reflectGetProto?function(t){return reflectGetProto(t)}:originalGetProto?function(t){if(!t||typeof t!="object"&&typeof t!="function")throw new TypeError("getProto: not an object");return originalGetProto(t)}:getDunderProto?function(t){return getDunderProto(t)}:null,hasown,hasRequiredHasown;function requireHasown(){if(hasRequiredHasown)return hasown;hasRequiredHasown=1;var e=Function.prototype.call,t=Object.prototype.hasOwnProperty,a=functionBind;return hasown=a.call(e,t),hasown}var undefined$1,$Object=esObjectAtoms,$Error=esErrors,$EvalError=_eval,$RangeError=range,$ReferenceError=ref,$SyntaxError$1=syntax,$TypeError$4=type,$URIError=uri,abs=abs$1,floor=floor$1,max=max$2,min=min$1,pow$1=pow$2,round=round$1,sign$1=sign$2,$Function=Function,getEvalledConstructor=function(e){try{return $Function('"use strict"; return ('+e+").constructor;")()}catch{}},$gOPD=gopd$1,$defineProperty$2=esDefineProperty,throwTypeError=function(){throw new $TypeError$4},ThrowTypeError=$gOPD?function(){try{return arguments.callee,throwTypeError}catch{try{return $gOPD(arguments,"callee").get}catch{return throwTypeError}}}():throwTypeError,hasSymbols=requireHasSymbols()(),getProto$2=getProto$3,$ObjectGPO=Object_getPrototypeOf,$ReflectGPO=Reflect_getPrototypeOf,$apply$1=functionApply,$call=functionCall,needsEval={},TypedArray=typeof Uint8Array>"u"||!getProto$2?undefined$1:getProto$2(Uint8Array),INTRINSICS={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?undefined$1:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?undefined$1:ArrayBuffer,"%ArrayIteratorPrototype%":hasSymbols&&getProto$2?getProto$2([][Symbol.iterator]()):undefined$1,"%AsyncFromSyncIteratorPrototype%":undefined$1,"%AsyncFunction%":needsEval,"%AsyncGenerator%":needsEval,"%AsyncGeneratorFunction%":needsEval,"%AsyncIteratorPrototype%":needsEval,"%Atomics%":typeof Atomics>"u"?undefined$1:Atomics,"%BigInt%":typeof BigInt>"u"?undefined$1:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?undefined$1:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?undefined$1:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?undefined$1:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":$Error,"%eval%":eval,"%EvalError%":$EvalError,"%Float16Array%":typeof Float16Array>"u"?undefined$1:Float16Array,"%Float32Array%":typeof Float32Array>"u"?undefined$1:Float32Array,"%Float64Array%":typeof Float64Array>"u"?undefined$1:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?undefined$1:FinalizationRegistry,"%Function%":$Function,"%GeneratorFunction%":needsEval,"%Int8Array%":typeof Int8Array>"u"?undefined$1:Int8Array,"%Int16Array%":typeof Int16Array>"u"?undefined$1:Int16Array,"%Int32Array%":typeof Int32Array>"u"?undefined$1:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":hasSymbols&&getProto$2?getProto$2(getProto$2([][Symbol.iterator]())):undefined$1,"%JSON%":typeof JSON=="object"?JSON:undefined$1,"%Map%":typeof Map>"u"?undefined$1:Map,"%MapIteratorPrototype%":typeof Map>"u"||!hasSymbols||!getProto$2?undefined$1:getProto$2(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":$Object,"%Object.getOwnPropertyDescriptor%":$gOPD,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?undefined$1:Promise,"%Proxy%":typeof Proxy>"u"?undefined$1:Proxy,"%RangeError%":$RangeError,"%ReferenceError%":$ReferenceError,"%Reflect%":typeof Reflect>"u"?undefined$1:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?undefined$1:Set,"%SetIteratorPrototype%":typeof Set>"u"||!hasSymbols||!getProto$2?undefined$1:getProto$2(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?undefined$1:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":hasSymbols&&getProto$2?getProto$2(""[Symbol.iterator]()):undefined$1,"%Symbol%":hasSymbols?Symbol:undefined$1,"%SyntaxError%":$SyntaxError$1,"%ThrowTypeError%":ThrowTypeError,"%TypedArray%":TypedArray,"%TypeError%":$TypeError$4,"%Uint8Array%":typeof Uint8Array>"u"?undefined$1:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?undefined$1:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?undefined$1:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?undefined$1:Uint32Array,"%URIError%":$URIError,"%WeakMap%":typeof WeakMap>"u"?undefined$1:WeakMap,"%WeakRef%":typeof WeakRef>"u"?undefined$1:WeakRef,"%WeakSet%":typeof WeakSet>"u"?undefined$1:WeakSet,"%Function.prototype.call%":$call,"%Function.prototype.apply%":$apply$1,"%Object.defineProperty%":$defineProperty$2,"%Object.getPrototypeOf%":$ObjectGPO,"%Math.abs%":abs,"%Math.floor%":floor,"%Math.max%":max,"%Math.min%":min,"%Math.pow%":pow$1,"%Math.round%":round,"%Math.sign%":sign$1,"%Reflect.getPrototypeOf%":$ReflectGPO};if(getProto$2)try{null.error}catch(e){var errorProto=getProto$2(getProto$2(e));INTRINSICS["%Error.prototype%"]=errorProto}var doEval=function e(t){var a;if(t==="%AsyncFunction%")a=getEvalledConstructor("async function () {}");else if(t==="%GeneratorFunction%")a=getEvalledConstructor("function* () {}");else if(t==="%AsyncGeneratorFunction%")a=getEvalledConstructor("async function* () {}");else if(t==="%AsyncGenerator%"){var u=e("%AsyncGeneratorFunction%");u&&(a=u.prototype)}else if(t==="%AsyncIteratorPrototype%"){var d=e("%AsyncGenerator%");d&&getProto$2&&(a=getProto$2(d.prototype))}return INTRINSICS[t]=a,a},LEGACY_ALIASES={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},bind$1=functionBind,hasOwn$1=requireHasown(),$concat=bind$1.call($call,Array.prototype.concat),$spliceApply=bind$1.call($apply$1,Array.prototype.splice),$replace=bind$1.call($call,String.prototype.replace),$strSlice=bind$1.call($call,String.prototype.slice),$exec$2=bind$1.call($call,RegExp.prototype.exec),rePropName=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,reEscapeChar=/\\(\\)?/g,stringToPath=function(t){var a=$strSlice(t,0,1),u=$strSlice(t,-1);if(a==="%"&&u!=="%")throw new $SyntaxError$1("invalid intrinsic syntax, expected closing `%`");if(u==="%"&&a!=="%")throw new $SyntaxError$1("invalid intrinsic syntax, expected opening `%`");var d=[];return $replace(t,rePropName,function(h,w,x,M){d[d.length]=x?$replace(M,reEscapeChar,"$1"):w||h}),d},getBaseIntrinsic=function(t,a){var u=t,d;if(hasOwn$1(LEGACY_ALIASES,u)&&(d=LEGACY_ALIASES[u],u="%"+d[0]+"%"),hasOwn$1(INTRINSICS,u)){var h=INTRINSICS[u];if(h===needsEval&&(h=doEval(u)),typeof h>"u"&&!a)throw new $TypeError$4("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:d,name:u,value:h}}throw new $SyntaxError$1("intrinsic "+t+" does not exist!")},getIntrinsic=function(t,a){if(typeof t!="string"||t.length===0)throw new $TypeError$4("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof a!="boolean")throw new $TypeError$4('"allowMissing" argument must be a boolean');if($exec$2(/^%?[^%]*%?$/,t)===null)throw new $SyntaxError$1("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var u=stringToPath(t),d=u.length>0?u[0]:"",h=getBaseIntrinsic("%"+d+"%",a),w=h.name,x=h.value,M=!1,B=h.alias;B&&(d=B[0],$spliceApply(u,$concat([0,1],B)));for(var E=1,S=!0;E<u.length;E+=1){var k=u[E],C=$strSlice(k,0,1),q=$strSlice(k,-1);if((C==='"'||C==="'"||C==="`"||q==='"'||q==="'"||q==="`")&&C!==q)throw new $SyntaxError$1("property names with quotes must have matching quotes");if((k==="constructor"||!S)&&(M=!0),d+="."+k,w="%"+d+"%",hasOwn$1(INTRINSICS,w))x=INTRINSICS[w];else if(x!=null){if(!(k in x)){if(!a)throw new $TypeError$4("base intrinsic for "+t+" exists, but the property is not available.");return}if($gOPD&&E+1>=u.length){var O=$gOPD(x,k);S=!!O,S&&"get"in O&&!("originalValue"in O.get)?x=O.get:x=x[k]}else S=hasOwn$1(x,k),x=x[k];S&&!M&&(INTRINSICS[w]=x)}}return x},GetIntrinsic$1=getIntrinsic,callBindBasic=callBindApplyHelpers,$indexOf$1=callBindBasic([GetIntrinsic$1("%String.prototype.indexOf%")]),callBound$6=function(t,a){var u=GetIntrinsic$1(t,!!a);return typeof u=="function"&&$indexOf$1(t,".prototype.")>-1?callBindBasic([u]):u},hasToStringTag$4=shams(),callBound$5=callBound$6,$toString$2=callBound$5("Object.prototype.toString"),isStandardArguments=function(t){return hasToStringTag$4&&t&&typeof t=="object"&&Symbol.toStringTag in t?!1:$toString$2(t)==="[object Arguments]"},isLegacyArguments=function(t){return isStandardArguments(t)?!0:t!==null&&typeof t=="object"&&"length"in t&&typeof t.length=="number"&&t.length>=0&&$toString$2(t)!=="[object Array]"&&"callee"in t&&$toString$2(t.callee)==="[object Function]"},supportsStandardArguments=function(){return isStandardArguments(arguments)}();isStandardArguments.isLegacyArguments=isLegacyArguments;var isArguments=supportsStandardArguments?isStandardArguments:isLegacyArguments,callBound$4=callBound$6,hasToStringTag$3=shams(),hasOwn=requireHasown(),gOPD$2=gopd$1,fn;if(hasToStringTag$3){var $exec$1=callBound$4("RegExp.prototype.exec"),isRegexMarker={},throwRegexMarker=function(){throw isRegexMarker},badStringifier={toString:throwRegexMarker,valueOf:throwRegexMarker};typeof Symbol.toPrimitive=="symbol"&&(badStringifier[Symbol.toPrimitive]=throwRegexMarker),fn=function(t){if(!t||typeof t!="object")return!1;var a=gOPD$2(t,"lastIndex"),u=a&&hasOwn(a,"value");if(!u)return!1;try{$exec$1(t,badStringifier)}catch(d){return d===isRegexMarker}}}else{var $toString$1=callBound$4("Object.prototype.toString"),regexClass="[object RegExp]";fn=function(t){return!t||typeof t!="object"&&typeof t!="function"?!1:$toString$1(t)===regexClass}}var isRegex$1=fn,callBound$3=callBound$6,isRegex=isRegex$1,$exec=callBound$3("RegExp.prototype.exec"),$TypeError$3=type,safeRegexTest$1=function(t){if(!isRegex(t))throw new $TypeError$3("`regex` must be a RegExp");return function(u){return $exec(t,u)!==null}},generatorFunction,hasRequiredGeneratorFunction;function requireGeneratorFunction(){if(hasRequiredGeneratorFunction)return generatorFunction;hasRequiredGeneratorFunction=1;const e=(function*(){}).constructor;return generatorFunction=()=>e,generatorFunction}var callBound$2=callBound$6,safeRegexTest=safeRegexTest$1,isFnRegex=safeRegexTest(/^\s*(?:function)?\*/),hasToStringTag$2=shams(),getProto$1=getProto$3,toStr$2=callBound$2("Object.prototype.toString"),fnToStr$1=callBound$2("Function.prototype.toString"),getGeneratorFunction=requireGeneratorFunction(),isGeneratorFunction=function(t){if(typeof t!="function")return!1;if(isFnRegex(fnToStr$1(t)))return!0;if(!hasToStringTag$2){var a=toStr$2(t);return a==="[object GeneratorFunction]"}if(!getProto$1)return!1;var u=getGeneratorFunction();return u&&getProto$1(t)===u.prototype},fnToStr=Function.prototype.toString,reflectApply=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,badArrayLike,isCallableMarker;if(typeof reflectApply=="function"&&typeof Object.defineProperty=="function")try{badArrayLike=Object.defineProperty({},"length",{get:function(){throw isCallableMarker}}),isCallableMarker={},reflectApply(function(){throw 42},null,badArrayLike)}catch(e){e!==isCallableMarker&&(reflectApply=null)}else reflectApply=null;var constructorRegex=/^\s*class\b/,isES6ClassFn=function(t){try{var a=fnToStr.call(t);return constructorRegex.test(a)}catch{return!1}},tryFunctionObject=function(t){try{return isES6ClassFn(t)?!1:(fnToStr.call(t),!0)}catch{return!1}},toStr$1=Object.prototype.toString,objectClass="[object Object]",fnClass="[object Function]",genClass="[object GeneratorFunction]",ddaClass="[object HTMLAllCollection]",ddaClass2="[object HTML document.all class]",ddaClass3="[object HTMLCollection]",hasToStringTag$1=typeof Symbol=="function"&&!!Symbol.toStringTag,isIE68=!(0 in[,]),isDDA=function(){return!1};if(typeof document=="object"){var all=document.all;toStr$1.call(all)===toStr$1.call(document.all)&&(isDDA=function(t){if((isIE68||!t)&&(typeof t>"u"||typeof t=="object"))try{var a=toStr$1.call(t);return(a===ddaClass||a===ddaClass2||a===ddaClass3||a===objectClass)&&t("")==null}catch{}return!1})}var isCallable$1=reflectApply?function(t){if(isDDA(t))return!0;if(!t||typeof t!="function"&&typeof t!="object")return!1;try{reflectApply(t,null,badArrayLike)}catch(a){if(a!==isCallableMarker)return!1}return!isES6ClassFn(t)&&tryFunctionObject(t)}:function(t){if(isDDA(t))return!0;if(!t||typeof t!="function"&&typeof t!="object")return!1;if(hasToStringTag$1)return tryFunctionObject(t);if(isES6ClassFn(t))return!1;var a=toStr$1.call(t);return a!==fnClass&&a!==genClass&&!/^\[object HTML/.test(a)?!1:tryFunctionObject(t)},isCallable=isCallable$1,toStr=Object.prototype.toString,hasOwnProperty=Object.prototype.hasOwnProperty,forEachArray=function(t,a,u){for(var d=0,h=t.length;d<h;d++)hasOwnProperty.call(t,d)&&(u==null?a(t[d],d,t):a.call(u,t[d],d,t))},forEachString=function(t,a,u){for(var d=0,h=t.length;d<h;d++)u==null?a(t.charAt(d),d,t):a.call(u,t.charAt(d),d,t)},forEachObject=function(t,a,u){for(var d in t)hasOwnProperty.call(t,d)&&(u==null?a(t[d],d,t):a.call(u,t[d],d,t))};function isArray$2(e){return toStr.call(e)==="[object Array]"}var forEach$1=function(t,a,u){if(!isCallable(a))throw new TypeError("iterator must be a function");var d;arguments.length>=3&&(d=u),isArray$2(t)?forEachArray(t,a,d):typeof t=="string"?forEachString(t,a,d):forEachObject(t,a,d)},possibleTypedArrayNames=["Float16Array","Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"],possibleNames=possibleTypedArrayNames,g$1=typeof globalThis>"u"?commonjsGlobal:globalThis,availableTypedArrays$1=function(){for(var t=[],a=0;a<possibleNames.length;a++)typeof g$1[possibleNames[a]]=="function"&&(t[t.length]=possibleNames[a]);return t},callBind$1={exports:{}},$defineProperty$1=esDefineProperty,$SyntaxError=syntax,$TypeError$2=type,gopd=gopd$1,defineDataProperty=function(t,a,u){if(!t||typeof t!="object"&&typeof t!="function")throw new $TypeError$2("`obj` must be an object or a function`");if(typeof a!="string"&&typeof a!="symbol")throw new $TypeError$2("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new $TypeError$2("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new $TypeError$2("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new $TypeError$2("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new $TypeError$2("`loose`, if provided, must be a boolean");var d=arguments.length>3?arguments[3]:null,h=arguments.length>4?arguments[4]:null,w=arguments.length>5?arguments[5]:null,x=arguments.length>6?arguments[6]:!1,M=!!gopd&&gopd(t,a);if($defineProperty$1)$defineProperty$1(t,a,{configurable:w===null&&M?M.configurable:!w,enumerable:d===null&&M?M.enumerable:!d,value:u,writable:h===null&&M?M.writable:!h});else if(x||!d&&!h&&!w)t[a]=u;else throw new $SyntaxError("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},$defineProperty=esDefineProperty,hasPropertyDescriptors=function(){return!!$defineProperty};hasPropertyDescriptors.hasArrayLengthDefineBug=function(){if(!$defineProperty)return null;try{return $defineProperty([],"length",{value:1}).length!==1}catch{return!0}};var hasPropertyDescriptors_1=hasPropertyDescriptors,GetIntrinsic=getIntrinsic,define=defineDataProperty,hasDescriptors=hasPropertyDescriptors_1(),gOPD$1=gopd$1,$TypeError$1=type,$floor=GetIntrinsic("%Math.floor%"),setFunctionLength=function(t,a){if(typeof t!="function")throw new $TypeError$1("`fn` is not a function");if(typeof a!="number"||a<0||a>4294967295||$floor(a)!==a)throw new $TypeError$1("`length` must be a positive 32-bit integer");var u=arguments.length>2&&!!arguments[2],d=!0,h=!0;if("length"in t&&gOPD$1){var w=gOPD$1(t,"length");w&&!w.configurable&&(d=!1),w&&!w.writable&&(h=!1)}return(d||h||!u)&&(hasDescriptors?define(t,"length",a,!0,!0):define(t,"length",a)),t},bind=functionBind,$apply=functionApply,actualApply=actualApply$1,applyBind=function(){return actualApply(bind,$apply,arguments)};(function(e){var t=setFunctionLength,a=esDefineProperty,u=callBindApplyHelpers,d=applyBind;e.exports=function(w){var x=u(arguments),M=w.length-(arguments.length-1);return t(x,1+(M>0?M:0),!0)},a?a(e.exports,"apply",{value:d}):e.exports.apply=d})(callBind$1);var callBindExports=callBind$1.exports,forEach=forEach$1,availableTypedArrays=availableTypedArrays$1,callBind=callBindExports,callBound$1=callBound$6,gOPD=gopd$1,getProto=getProto$3,$toString=callBound$1("Object.prototype.toString"),hasToStringTag=shams(),g=typeof globalThis>"u"?commonjsGlobal:globalThis,typedArrays=availableTypedArrays(),$slice=callBound$1("String.prototype.slice"),$indexOf=callBound$1("Array.prototype.indexOf",!0)||function(t,a){for(var u=0;u<t.length;u+=1)if(t[u]===a)return u;return-1},cache={__proto__:null};hasToStringTag&&gOPD&&getProto?forEach(typedArrays,function(e){var t=new g[e];if(Symbol.toStringTag in t&&getProto){var a=getProto(t),u=gOPD(a,Symbol.toStringTag);if(!u&&a){var d=getProto(a);u=gOPD(d,Symbol.toStringTag)}cache["$"+e]=callBind(u.get)}}):forEach(typedArrays,function(e){var t=new g[e],a=t.slice||t.set;a&&(cache["$"+e]=callBind(a))});var tryTypedArrays=function(t){var a=!1;return forEach(cache,function(u,d){if(!a)try{"$"+u(t)===d&&(a=$slice(d,1))}catch{}}),a},trySlices=function(t){var a=!1;return forEach(cache,function(u,d){if(!a)try{u(t),a=$slice(d,1)}catch{}}),a},whichTypedArray=function(t){if(!t||typeof t!="object")return!1;if(!hasToStringTag){var a=$slice($toString(t),8,-1);return $indexOf(typedArrays,a)>-1?a:a!=="Object"?!1:trySlices(t)}return gOPD?tryTypedArrays(t):null},isTypedArray$1,hasRequiredIsTypedArray;function requireIsTypedArray(){if(hasRequiredIsTypedArray)return isTypedArray$1;hasRequiredIsTypedArray=1;var e=whichTypedArray;return isTypedArray$1=function(a){return!!e(a)},isTypedArray$1}(function(e){var t=isArguments,a=isGeneratorFunction,u=whichTypedArray,d=requireIsTypedArray();function h(le){return le.call.bind(le)}var w=typeof BigInt<"u",x=typeof Symbol<"u",M=h(Object.prototype.toString),B=h(Number.prototype.valueOf),E=h(String.prototype.valueOf),S=h(Boolean.prototype.valueOf);if(w)var k=h(BigInt.prototype.valueOf);if(x)var C=h(Symbol.prototype.valueOf);function q(le,Ve){if(typeof le!="object")return!1;try{return Ve(le),!0}catch{return!1}}e.isArgumentsObject=t,e.isGeneratorFunction=a,e.isTypedArray=d;function O(le){return typeof Promise<"u"&&le instanceof Promise||le!==null&&typeof le=="object"&&typeof le.then=="function"&&typeof le.catch=="function"}e.isPromise=O;function U(le){return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?ArrayBuffer.isView(le):d(le)||I(le)}e.isArrayBufferView=U;function P(le){return u(le)==="Uint8Array"}e.isUint8Array=P;function L(le){return u(le)==="Uint8ClampedArray"}e.isUint8ClampedArray=L;function J(le){return u(le)==="Uint16Array"}e.isUint16Array=J;function Y(le){return u(le)==="Uint32Array"}e.isUint32Array=Y;function ae(le){return u(le)==="Int8Array"}e.isInt8Array=ae;function oe(le){return u(le)==="Int16Array"}e.isInt16Array=oe;function ue(le){return u(le)==="Int32Array"}e.isInt32Array=ue;function se(le){return u(le)==="Float32Array"}e.isFloat32Array=se;function ie(le){return u(le)==="Float64Array"}e.isFloat64Array=ie;function ce(le){return u(le)==="BigInt64Array"}e.isBigInt64Array=ce;function $(le){return u(le)==="BigUint64Array"}e.isBigUint64Array=$;function n(le){return M(le)==="[object Map]"}n.working=typeof Map<"u"&&n(new Map);function l(le){return typeof Map>"u"?!1:n.working?n(le):le instanceof Map}e.isMap=l;function c(le){return M(le)==="[object Set]"}c.working=typeof Set<"u"&&c(new Set);function p(le){return typeof Set>"u"?!1:c.working?c(le):le instanceof Set}e.isSet=p;function y(le){return M(le)==="[object WeakMap]"}y.working=typeof WeakMap<"u"&&y(new WeakMap);function b(le){return typeof WeakMap>"u"?!1:y.working?y(le):le instanceof WeakMap}e.isWeakMap=b;function _(le){return M(le)==="[object WeakSet]"}_.working=typeof WeakSet<"u"&&_(new WeakSet);function v(le){return _(le)}e.isWeakSet=v;function o(le){return M(le)==="[object ArrayBuffer]"}o.working=typeof ArrayBuffer<"u"&&o(new ArrayBuffer);function m(le){return typeof ArrayBuffer>"u"?!1:o.working?o(le):le instanceof ArrayBuffer}e.isArrayBuffer=m;function A(le){return M(le)==="[object DataView]"}A.working=typeof ArrayBuffer<"u"&&typeof DataView<"u"&&A(new DataView(new ArrayBuffer(1),0,1));function I(le){return typeof DataView>"u"?!1:A.working?A(le):le instanceof DataView}e.isDataView=I;var F=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:void 0;function X(le){return M(le)==="[object SharedArrayBuffer]"}function V(le){return typeof F>"u"?!1:(typeof X.working>"u"&&(X.working=X(new F)),X.working?X(le):le instanceof F)}e.isSharedArrayBuffer=V;function T(le){return M(le)==="[object AsyncFunction]"}e.isAsyncFunction=T;function D(le){return M(le)==="[object Map Iterator]"}e.isMapIterator=D;function Z(le){return M(le)==="[object Set Iterator]"}e.isSetIterator=Z;function te(le){return M(le)==="[object Generator]"}e.isGeneratorObject=te;function ee(le){return M(le)==="[object WebAssembly.Module]"}e.isWebAssemblyCompiledModule=ee;function j(le){return q(le,B)}e.isNumberObject=j;function re(le){return q(le,E)}e.isStringObject=re;function qe(le){return q(le,S)}e.isBooleanObject=qe;function de(le){return w&&q(le,k)}e.isBigIntObject=de;function pe(le){return x&&q(le,C)}e.isSymbolObject=pe;function je(le){return j(le)||re(le)||qe(le)||de(le)||pe(le)}e.isBoxedPrimitive=je;function we(le){return typeof Uint8Array<"u"&&(m(le)||V(le))}e.isAnyArrayBuffer=we,["isProxy","isExternal","isModuleNamespaceObject"].forEach(function(le){Object.defineProperty(e,le,{enumerable:!1,value:function(){throw new Error(le+" is not supported in userland")}})})})(types);var isBufferBrowser=function(t){return t&&typeof t=="object"&&typeof t.copy=="function"&&typeof t.fill=="function"&&typeof t.readUInt8=="function"};(function(e){var t={},a=Object.getOwnPropertyDescriptors||function(F){for(var X=Object.keys(F),V={},T=0;T<X.length;T++)V[X[T]]=Object.getOwnPropertyDescriptor(F,X[T]);return V},u=/%[sdj%]/g;e.format=function(I){if(!oe(I)){for(var F=[],X=0;X<arguments.length;X++)F.push(x(arguments[X]));return F.join(" ")}for(var X=1,V=arguments,T=V.length,D=String(I).replace(u,function(te){if(te==="%%")return"%";if(X>=T)return te;switch(te){case"%s":return String(V[X++]);case"%d":return Number(V[X++]);case"%j":try{return JSON.stringify(V[X++])}catch{return"[Circular]"}default:return te}}),Z=V[X];X<T;Z=V[++X])J(Z)||!ce(Z)?D+=" "+Z:D+=" "+x(Z);return D},e.deprecate=function(I,F){if(typeof process$1<"u"&&process$1.noDeprecation===!0)return I;if(typeof process$1>"u")return function(){return e.deprecate(I,F).apply(this,arguments)};var X=!1;function V(){if(!X){if(process$1.throwDeprecation)throw new Error(F);process$1.traceDeprecation?console.trace(F):console.error(F),X=!0}return I.apply(this,arguments)}return V};var d={},h=/^$/;if(t.NODE_DEBUG){var w=t.NODE_DEBUG;w=w.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase(),h=new RegExp("^"+w+"$","i")}e.debuglog=function(I){if(I=I.toUpperCase(),!d[I])if(h.test(I)){var F=process$1.pid;d[I]=function(){var X=e.format.apply(e,arguments);console.error("%s %d: %s",I,F,X)}}else d[I]=function(){};return d[I]};function x(I,F){var X={seen:[],stylize:B};return arguments.length>=3&&(X.depth=arguments[2]),arguments.length>=4&&(X.colors=arguments[3]),L(F)?X.showHidden=F:F&&e._extend(X,F),se(X.showHidden)&&(X.showHidden=!1),se(X.depth)&&(X.depth=2),se(X.colors)&&(X.colors=!1),se(X.customInspect)&&(X.customInspect=!0),X.colors&&(X.stylize=M),S(X,I,X.depth)}e.inspect=x,x.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},x.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};function M(I,F){var X=x.styles[F];return X?"\x1B["+x.colors[X][0]+"m"+I+"\x1B["+x.colors[X][1]+"m":I}function B(I,F){return I}function E(I){var F={};return I.forEach(function(X,V){F[X]=!0}),F}function S(I,F,X){if(I.customInspect&&F&&l(F.inspect)&&F.inspect!==e.inspect&&!(F.constructor&&F.constructor.prototype===F)){var V=F.inspect(X,I);return oe(V)||(V=S(I,V,X)),V}var T=k(I,F);if(T)return T;var D=Object.keys(F),Z=E(D);if(I.showHidden&&(D=Object.getOwnPropertyNames(F)),n(F)&&(D.indexOf("message")>=0||D.indexOf("description")>=0))return C(F);if(D.length===0){if(l(F)){var te=F.name?": "+F.name:"";return I.stylize("[Function"+te+"]","special")}if(ie(F))return I.stylize(RegExp.prototype.toString.call(F),"regexp");if($(F))return I.stylize(Date.prototype.toString.call(F),"date");if(n(F))return C(F)}var ee="",j=!1,re=["{","}"];if(P(F)&&(j=!0,re=["[","]"]),l(F)){var qe=F.name?": "+F.name:"";ee=" [Function"+qe+"]"}if(ie(F)&&(ee=" "+RegExp.prototype.toString.call(F)),$(F)&&(ee=" "+Date.prototype.toUTCString.call(F)),n(F)&&(ee=" "+C(F)),D.length===0&&(!j||F.length==0))return re[0]+ee+re[1];if(X<0)return ie(F)?I.stylize(RegExp.prototype.toString.call(F),"regexp"):I.stylize("[Object]","special");I.seen.push(F);var de;return j?de=q(I,F,X,Z,D):de=D.map(function(pe){return O(I,F,X,Z,pe,j)}),I.seen.pop(),U(de,ee,re)}function k(I,F){if(se(F))return I.stylize("undefined","undefined");if(oe(F)){var X="'"+JSON.stringify(F).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return I.stylize(X,"string")}if(ae(F))return I.stylize(""+F,"number");if(L(F))return I.stylize(""+F,"boolean");if(J(F))return I.stylize("null","null")}function C(I){return"["+Error.prototype.toString.call(I)+"]"}function q(I,F,X,V,T){for(var D=[],Z=0,te=F.length;Z<te;++Z)v(F,String(Z))?D.push(O(I,F,X,V,String(Z),!0)):D.push("");return T.forEach(function(ee){ee.match(/^\d+$/)||D.push(O(I,F,X,V,ee,!0))}),D}function O(I,F,X,V,T,D){var Z,te,ee;if(ee=Object.getOwnPropertyDescriptor(F,T)||{value:F[T]},ee.get?ee.set?te=I.stylize("[Getter/Setter]","special"):te=I.stylize("[Getter]","special"):ee.set&&(te=I.stylize("[Setter]","special")),v(V,T)||(Z="["+T+"]"),te||(I.seen.indexOf(ee.value)<0?(J(X)?te=S(I,ee.value,null):te=S(I,ee.value,X-1),te.indexOf(`
8
+ `)>-1&&(D?te=te.split(`
9
+ `).map(function(j){return" "+j}).join(`
10
+ `).slice(2):te=`
11
+ `+te.split(`
12
+ `).map(function(j){return" "+j}).join(`
13
+ `))):te=I.stylize("[Circular]","special")),se(Z)){if(D&&T.match(/^\d+$/))return te;Z=JSON.stringify(""+T),Z.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(Z=Z.slice(1,-1),Z=I.stylize(Z,"name")):(Z=Z.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),Z=I.stylize(Z,"string"))}return Z+": "+te}function U(I,F,X){var V=I.reduce(function(T,D){return D.indexOf(`
14
+ `)>=0,T+D.replace(/\u001b\[\d\d?m/g,"").length+1},0);return V>60?X[0]+(F===""?"":F+`
15
+ `)+" "+I.join(`,
16
+ `)+" "+X[1]:X[0]+F+" "+I.join(", ")+" "+X[1]}e.types=types;function P(I){return Array.isArray(I)}e.isArray=P;function L(I){return typeof I=="boolean"}e.isBoolean=L;function J(I){return I===null}e.isNull=J;function Y(I){return I==null}e.isNullOrUndefined=Y;function ae(I){return typeof I=="number"}e.isNumber=ae;function oe(I){return typeof I=="string"}e.isString=oe;function ue(I){return typeof I=="symbol"}e.isSymbol=ue;function se(I){return I===void 0}e.isUndefined=se;function ie(I){return ce(I)&&p(I)==="[object RegExp]"}e.isRegExp=ie,e.types.isRegExp=ie;function ce(I){return typeof I=="object"&&I!==null}e.isObject=ce;function $(I){return ce(I)&&p(I)==="[object Date]"}e.isDate=$,e.types.isDate=$;function n(I){return ce(I)&&(p(I)==="[object Error]"||I instanceof Error)}e.isError=n,e.types.isNativeError=n;function l(I){return typeof I=="function"}e.isFunction=l;function c(I){return I===null||typeof I=="boolean"||typeof I=="number"||typeof I=="string"||typeof I=="symbol"||typeof I>"u"}e.isPrimitive=c,e.isBuffer=isBufferBrowser;function p(I){return Object.prototype.toString.call(I)}function y(I){return I<10?"0"+I.toString(10):I.toString(10)}var b=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function _(){var I=new Date,F=[y(I.getHours()),y(I.getMinutes()),y(I.getSeconds())].join(":");return[I.getDate(),b[I.getMonth()],F].join(" ")}e.log=function(){console.log("%s - %s",_(),e.format.apply(e,arguments))},e.inherits=inherits_browserExports,e._extend=function(I,F){if(!F||!ce(F))return I;for(var X=Object.keys(F),V=X.length;V--;)I[X[V]]=F[X[V]];return I};function v(I,F){return Object.prototype.hasOwnProperty.call(I,F)}var o=typeof Symbol<"u"?Symbol("util.promisify.custom"):void 0;e.promisify=function(F){if(typeof F!="function")throw new TypeError('The "original" argument must be of type Function');if(o&&F[o]){var X=F[o];if(typeof X!="function")throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(X,o,{value:X,enumerable:!1,writable:!1,configurable:!0}),X}function X(){for(var V,T,D=new Promise(function(ee,j){V=ee,T=j}),Z=[],te=0;te<arguments.length;te++)Z.push(arguments[te]);Z.push(function(ee,j){ee?T(ee):V(j)});try{F.apply(this,Z)}catch(ee){T(ee)}return D}return Object.setPrototypeOf(X,Object.getPrototypeOf(F)),o&&Object.defineProperty(X,o,{value:X,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(X,a(F))},e.promisify.custom=o;function m(I,F){if(!I){var X=new Error("Promise was rejected with a falsy value");X.reason=I,I=X}return F(I)}function A(I){if(typeof I!="function")throw new TypeError('The "original" argument must be of type Function');function F(){for(var X=[],V=0;V<arguments.length;V++)X.push(arguments[V]);var T=X.pop();if(typeof T!="function")throw new TypeError("The last argument must be of type Function");var D=this,Z=function(){return T.apply(D,arguments)};I.apply(this,X).then(function(te){process$1.nextTick(Z.bind(null,null,te))},function(te){process$1.nextTick(m.bind(null,te,Z))})}return Object.setPrototypeOf(F,Object.getPrototypeOf(I)),Object.defineProperties(F,a(I)),F}e.callbackify=A})(util$5);var buffer_list,hasRequiredBuffer_list;function requireBuffer_list(){if(hasRequiredBuffer_list)return buffer_list;hasRequiredBuffer_list=1;function e(q,O){var U=Object.keys(q);if(Object.getOwnPropertySymbols){var P=Object.getOwnPropertySymbols(q);O&&(P=P.filter(function(L){return Object.getOwnPropertyDescriptor(q,L).enumerable})),U.push.apply(U,P)}return U}function t(q){for(var O=1;O<arguments.length;O++){var U=arguments[O]!=null?arguments[O]:{};O%2?e(Object(U),!0).forEach(function(P){a(q,P,U[P])}):Object.getOwnPropertyDescriptors?Object.defineProperties(q,Object.getOwnPropertyDescriptors(U)):e(Object(U)).forEach(function(P){Object.defineProperty(q,P,Object.getOwnPropertyDescriptor(U,P))})}return q}function a(q,O,U){return O=w(O),O in q?Object.defineProperty(q,O,{value:U,enumerable:!0,configurable:!0,writable:!0}):q[O]=U,q}function u(q,O){if(!(q instanceof O))throw new TypeError("Cannot call a class as a function")}function d(q,O){for(var U=0;U<O.length;U++){var P=O[U];P.enumerable=P.enumerable||!1,P.configurable=!0,"value"in P&&(P.writable=!0),Object.defineProperty(q,w(P.key),P)}}function h(q,O,U){return O&&d(q.prototype,O),Object.defineProperty(q,"prototype",{writable:!1}),q}function w(q){var O=x(q,"string");return typeof O=="symbol"?O:String(O)}function x(q,O){if(typeof q!="object"||q===null)return q;var U=q[Symbol.toPrimitive];if(U!==void 0){var P=U.call(q,O);if(typeof P!="object")return P;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(q)}var M=dist,B=M.Buffer,E=util$5,S=E.inspect,k=S&&S.custom||"inspect";function C(q,O,U){B.prototype.copy.call(q,O,U)}return buffer_list=function(){function q(){u(this,q),this.head=null,this.tail=null,this.length=0}return h(q,[{key:"push",value:function(U){var P={data:U,next:null};this.length>0?this.tail.next=P:this.head=P,this.tail=P,++this.length}},{key:"unshift",value:function(U){var P={data:U,next:this.head};this.length===0&&(this.tail=P),this.head=P,++this.length}},{key:"shift",value:function(){if(this.length!==0){var U=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,U}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(U){if(this.length===0)return"";for(var P=this.head,L=""+P.data;P=P.next;)L+=U+P.data;return L}},{key:"concat",value:function(U){if(this.length===0)return B.alloc(0);for(var P=B.allocUnsafe(U>>>0),L=this.head,J=0;L;)C(L.data,P,J),J+=L.data.length,L=L.next;return P}},{key:"consume",value:function(U,P){var L;return U<this.head.data.length?(L=this.head.data.slice(0,U),this.head.data=this.head.data.slice(U)):U===this.head.data.length?L=this.shift():L=P?this._getString(U):this._getBuffer(U),L}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(U){var P=this.head,L=1,J=P.data;for(U-=J.length;P=P.next;){var Y=P.data,ae=U>Y.length?Y.length:U;if(ae===Y.length?J+=Y:J+=Y.slice(0,U),U-=ae,U===0){ae===Y.length?(++L,P.next?this.head=P.next:this.head=this.tail=null):(this.head=P,P.data=Y.slice(ae));break}++L}return this.length-=L,J}},{key:"_getBuffer",value:function(U){var P=B.allocUnsafe(U),L=this.head,J=1;for(L.data.copy(P),U-=L.data.length;L=L.next;){var Y=L.data,ae=U>Y.length?Y.length:U;if(Y.copy(P,P.length-U,0,ae),U-=ae,U===0){ae===Y.length?(++J,L.next?this.head=L.next:this.head=this.tail=null):(this.head=L,L.data=Y.slice(ae));break}++J}return this.length-=J,P}},{key:k,value:function(U,P){return S(this,t(t({},P),{},{depth:0,customInspect:!1}))}}]),q}(),buffer_list}var destroy_1$2,hasRequiredDestroy;function requireDestroy(){if(hasRequiredDestroy)return destroy_1$2;hasRequiredDestroy=1;function e(w,x){var M=this,B=this._readableState&&this._readableState.destroyed,E=this._writableState&&this._writableState.destroyed;return B||E?(x?x(w):w&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,process$1.nextTick(d,this,w)):process$1.nextTick(d,this,w)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(w||null,function(S){!x&&S?M._writableState?M._writableState.errorEmitted?process$1.nextTick(a,M):(M._writableState.errorEmitted=!0,process$1.nextTick(t,M,S)):process$1.nextTick(t,M,S):x?(process$1.nextTick(a,M),x(S)):process$1.nextTick(a,M)}),this)}function t(w,x){d(w,x),a(w)}function a(w){w._writableState&&!w._writableState.emitClose||w._readableState&&!w._readableState.emitClose||w.emit("close")}function u(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function d(w,x){w.emit("error",x)}function h(w,x){var M=w._readableState,B=w._writableState;M&&M.autoDestroy||B&&B.autoDestroy?w.destroy(x):w.emit("error",x)}return destroy_1$2={destroy:e,undestroy:u,errorOrDestroy:h},destroy_1$2}var errorsBrowser={},hasRequiredErrorsBrowser;function requireErrorsBrowser(){if(hasRequiredErrorsBrowser)return errorsBrowser;hasRequiredErrorsBrowser=1;function e(x,M){x.prototype=Object.create(M.prototype),x.prototype.constructor=x,x.__proto__=M}var t={};function a(x,M,B){B||(B=Error);function E(k,C,q){return typeof M=="string"?M:M(k,C,q)}var S=function(k){e(C,k);function C(q,O,U){return k.call(this,E(q,O,U))||this}return C}(B);S.prototype.name=B.name,S.prototype.code=x,t[x]=S}function u(x,M){if(Array.isArray(x)){var B=x.length;return x=x.map(function(E){return String(E)}),B>2?"one of ".concat(M," ").concat(x.slice(0,B-1).join(", "),", or ")+x[B-1]:B===2?"one of ".concat(M," ").concat(x[0]," or ").concat(x[1]):"of ".concat(M," ").concat(x[0])}else return"of ".concat(M," ").concat(String(x))}function d(x,M,B){return x.substr(0,M.length)===M}function h(x,M,B){return(B===void 0||B>x.length)&&(B=x.length),x.substring(B-M.length,B)===M}function w(x,M,B){return typeof B!="number"&&(B=0),B+M.length>x.length?!1:x.indexOf(M,B)!==-1}return a("ERR_INVALID_OPT_VALUE",function(x,M){return'The value "'+M+'" is invalid for option "'+x+'"'},TypeError),a("ERR_INVALID_ARG_TYPE",function(x,M,B){var E;typeof M=="string"&&d(M,"not ")?(E="must not be",M=M.replace(/^not /,"")):E="must be";var S;if(h(x," argument"))S="The ".concat(x," ").concat(E," ").concat(u(M,"type"));else{var k=w(x,".")?"property":"argument";S='The "'.concat(x,'" ').concat(k," ").concat(E," ").concat(u(M,"type"))}return S+=". Received type ".concat(typeof B),S},TypeError),a("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),a("ERR_METHOD_NOT_IMPLEMENTED",function(x){return"The "+x+" method is not implemented"}),a("ERR_STREAM_PREMATURE_CLOSE","Premature close"),a("ERR_STREAM_DESTROYED",function(x){return"Cannot call "+x+" after a stream was destroyed"}),a("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),a("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),a("ERR_STREAM_WRITE_AFTER_END","write after end"),a("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),a("ERR_UNKNOWN_ENCODING",function(x){return"Unknown encoding: "+x},TypeError),a("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),errorsBrowser.codes=t,errorsBrowser}var state,hasRequiredState;function requireState(){if(hasRequiredState)return state;hasRequiredState=1;var e=requireErrorsBrowser().codes.ERR_INVALID_OPT_VALUE;function t(u,d,h){return u.highWaterMark!=null?u.highWaterMark:d?u[h]:null}function a(u,d,h,w){var x=t(d,w,h);if(x!=null){if(!(isFinite(x)&&Math.floor(x)===x)||x<0){var M=w?h:"highWaterMark";throw new e(M,x)}return Math.floor(x)}return u.objectMode?16:16*1024}return state={getHighWaterMark:a},state}var browser$a=deprecate;function deprecate(e,t){if(config("noDeprecation"))return e;var a=!1;function u(){if(!a){if(config("throwDeprecation"))throw new Error(t);config("traceDeprecation")?console.trace(t):console.warn(t),a=!0}return e.apply(this,arguments)}return u}function config(e){try{if(!commonjsGlobal.localStorage)return!1}catch{return!1}var t=commonjsGlobal.localStorage[e];return t==null?!1:String(t).toLowerCase()==="true"}var _stream_writable$2,hasRequired_stream_writable$2;function require_stream_writable$2(){if(hasRequired_stream_writable$2)return _stream_writable$2;hasRequired_stream_writable$2=1,_stream_writable$2=se;function e(V){var T=this;this.next=null,this.entry=null,this.finish=function(){X(T,V)}}var t;se.WritableState=oe;var a={deprecate:browser$a},u=requireStreamBrowser(),d=dist.Buffer,h=(typeof commonjsGlobal<"u"?commonjsGlobal:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function w(V){return d.from(V)}function x(V){return d.isBuffer(V)||V instanceof h}var M=requireDestroy(),B=requireState(),E=B.getHighWaterMark,S=requireErrorsBrowser().codes,k=S.ERR_INVALID_ARG_TYPE,C=S.ERR_METHOD_NOT_IMPLEMENTED,q=S.ERR_MULTIPLE_CALLBACK,O=S.ERR_STREAM_CANNOT_PIPE,U=S.ERR_STREAM_DESTROYED,P=S.ERR_STREAM_NULL_VALUES,L=S.ERR_STREAM_WRITE_AFTER_END,J=S.ERR_UNKNOWN_ENCODING,Y=M.errorOrDestroy;inherits_browserExports(se,u);function ae(){}function oe(V,T,D){t=t||require_stream_duplex$2(),V=V||{},typeof D!="boolean"&&(D=T instanceof t),this.objectMode=!!V.objectMode,D&&(this.objectMode=this.objectMode||!!V.writableObjectMode),this.highWaterMark=E(this,V,"writableHighWaterMark",D),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var Z=V.decodeStrings===!1;this.decodeStrings=!Z,this.defaultEncoding=V.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(te){y(T,te)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=V.emitClose!==!1,this.autoDestroy=!!V.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new e(this)}oe.prototype.getBuffer=function(){for(var T=this.bufferedRequest,D=[];T;)D.push(T),T=T.next;return D},function(){try{Object.defineProperty(oe.prototype,"buffer",{get:a.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}}();var ue;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(ue=Function.prototype[Symbol.hasInstance],Object.defineProperty(se,Symbol.hasInstance,{value:function(T){return ue.call(this,T)?!0:this!==se?!1:T&&T._writableState instanceof oe}})):ue=function(T){return T instanceof this};function se(V){t=t||require_stream_duplex$2();var T=this instanceof t;if(!T&&!ue.call(se,this))return new se(V);this._writableState=new oe(V,this,T),this.writable=!0,V&&(typeof V.write=="function"&&(this._write=V.write),typeof V.writev=="function"&&(this._writev=V.writev),typeof V.destroy=="function"&&(this._destroy=V.destroy),typeof V.final=="function"&&(this._final=V.final)),u.call(this)}se.prototype.pipe=function(){Y(this,new O)};function ie(V,T){var D=new L;Y(V,D),process$1.nextTick(T,D)}function ce(V,T,D,Z){var te;return D===null?te=new P:typeof D!="string"&&!T.objectMode&&(te=new k("chunk",["string","Buffer"],D)),te?(Y(V,te),process$1.nextTick(Z,te),!1):!0}se.prototype.write=function(V,T,D){var Z=this._writableState,te=!1,ee=!Z.objectMode&&x(V);return ee&&!d.isBuffer(V)&&(V=w(V)),typeof T=="function"&&(D=T,T=null),ee?T="buffer":T||(T=Z.defaultEncoding),typeof D!="function"&&(D=ae),Z.ending?ie(this,D):(ee||ce(this,Z,V,D))&&(Z.pendingcb++,te=n(this,Z,ee,V,T,D)),te},se.prototype.cork=function(){this._writableState.corked++},se.prototype.uncork=function(){var V=this._writableState;V.corked&&(V.corked--,!V.writing&&!V.corked&&!V.bufferProcessing&&V.bufferedRequest&&v(this,V))},se.prototype.setDefaultEncoding=function(T){if(typeof T=="string"&&(T=T.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((T+"").toLowerCase())>-1))throw new J(T);return this._writableState.defaultEncoding=T,this},Object.defineProperty(se.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function $(V,T,D){return!V.objectMode&&V.decodeStrings!==!1&&typeof T=="string"&&(T=d.from(T,D)),T}Object.defineProperty(se.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function n(V,T,D,Z,te,ee){if(!D){var j=$(T,Z,te);Z!==j&&(D=!0,te="buffer",Z=j)}var re=T.objectMode?1:Z.length;T.length+=re;var qe=T.length<T.highWaterMark;if(qe||(T.needDrain=!0),T.writing||T.corked){var de=T.lastBufferedRequest;T.lastBufferedRequest={chunk:Z,encoding:te,isBuf:D,callback:ee,next:null},de?de.next=T.lastBufferedRequest:T.bufferedRequest=T.lastBufferedRequest,T.bufferedRequestCount+=1}else l(V,T,!1,re,Z,te,ee);return qe}function l(V,T,D,Z,te,ee,j){T.writelen=Z,T.writecb=j,T.writing=!0,T.sync=!0,T.destroyed?T.onwrite(new U("write")):D?V._writev(te,T.onwrite):V._write(te,ee,T.onwrite),T.sync=!1}function c(V,T,D,Z,te){--T.pendingcb,D?(process$1.nextTick(te,Z),process$1.nextTick(I,V,T),V._writableState.errorEmitted=!0,Y(V,Z)):(te(Z),V._writableState.errorEmitted=!0,Y(V,Z),I(V,T))}function p(V){V.writing=!1,V.writecb=null,V.length-=V.writelen,V.writelen=0}function y(V,T){var D=V._writableState,Z=D.sync,te=D.writecb;if(typeof te!="function")throw new q;if(p(D),T)c(V,D,Z,T,te);else{var ee=o(D)||V.destroyed;!ee&&!D.corked&&!D.bufferProcessing&&D.bufferedRequest&&v(V,D),Z?process$1.nextTick(b,V,D,ee,te):b(V,D,ee,te)}}function b(V,T,D,Z){D||_(V,T),T.pendingcb--,Z(),I(V,T)}function _(V,T){T.length===0&&T.needDrain&&(T.needDrain=!1,V.emit("drain"))}function v(V,T){T.bufferProcessing=!0;var D=T.bufferedRequest;if(V._writev&&D&&D.next){var Z=T.bufferedRequestCount,te=new Array(Z),ee=T.corkedRequestsFree;ee.entry=D;for(var j=0,re=!0;D;)te[j]=D,D.isBuf||(re=!1),D=D.next,j+=1;te.allBuffers=re,l(V,T,!0,T.length,te,"",ee.finish),T.pendingcb++,T.lastBufferedRequest=null,ee.next?(T.corkedRequestsFree=ee.next,ee.next=null):T.corkedRequestsFree=new e(T),T.bufferedRequestCount=0}else{for(;D;){var qe=D.chunk,de=D.encoding,pe=D.callback,je=T.objectMode?1:qe.length;if(l(V,T,!1,je,qe,de,pe),D=D.next,T.bufferedRequestCount--,T.writing)break}D===null&&(T.lastBufferedRequest=null)}T.bufferedRequest=D,T.bufferProcessing=!1}se.prototype._write=function(V,T,D){D(new C("_write()"))},se.prototype._writev=null,se.prototype.end=function(V,T,D){var Z=this._writableState;return typeof V=="function"?(D=V,V=null,T=null):typeof T=="function"&&(D=T,T=null),V!=null&&this.write(V,T),Z.corked&&(Z.corked=1,this.uncork()),Z.ending||F(this,Z,D),this},Object.defineProperty(se.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function o(V){return V.ending&&V.length===0&&V.bufferedRequest===null&&!V.finished&&!V.writing}function m(V,T){V._final(function(D){T.pendingcb--,D&&Y(V,D),T.prefinished=!0,V.emit("prefinish"),I(V,T)})}function A(V,T){!T.prefinished&&!T.finalCalled&&(typeof V._final=="function"&&!T.destroyed?(T.pendingcb++,T.finalCalled=!0,process$1.nextTick(m,V,T)):(T.prefinished=!0,V.emit("prefinish")))}function I(V,T){var D=o(T);if(D&&(A(V,T),T.pendingcb===0&&(T.finished=!0,V.emit("finish"),T.autoDestroy))){var Z=V._readableState;(!Z||Z.autoDestroy&&Z.endEmitted)&&V.destroy()}return D}function F(V,T,D){T.ending=!0,I(V,T),D&&(T.finished?process$1.nextTick(D):V.once("finish",D)),T.ended=!0,V.writable=!1}function X(V,T,D){var Z=V.entry;for(V.entry=null;Z;){var te=Z.callback;T.pendingcb--,te(D),Z=Z.next}T.corkedRequestsFree.next=V}return Object.defineProperty(se.prototype,"destroyed",{enumerable:!1,get:function(){return this._writableState===void 0?!1:this._writableState.destroyed},set:function(T){this._writableState&&(this._writableState.destroyed=T)}}),se.prototype.destroy=M.destroy,se.prototype._undestroy=M.undestroy,se.prototype._destroy=function(V,T){T(V)},_stream_writable$2}var _stream_duplex$2,hasRequired_stream_duplex$2;function require_stream_duplex$2(){if(hasRequired_stream_duplex$2)return _stream_duplex$2;hasRequired_stream_duplex$2=1;var e=Object.keys||function(B){var E=[];for(var S in B)E.push(S);return E};_stream_duplex$2=w;var t=require_stream_readable$2(),a=require_stream_writable$2();inherits_browserExports(w,t);for(var u=e(a.prototype),d=0;d<u.length;d++){var h=u[d];w.prototype[h]||(w.prototype[h]=a.prototype[h])}function w(B){if(!(this instanceof w))return new w(B);t.call(this,B),a.call(this,B),this.allowHalfOpen=!0,B&&(B.readable===!1&&(this.readable=!1),B.writable===!1&&(this.writable=!1),B.allowHalfOpen===!1&&(this.allowHalfOpen=!1,this.once("end",x)))}Object.defineProperty(w.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(w.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(w.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function x(){this._writableState.ended||process$1.nextTick(M,this)}function M(B){B.end()}return Object.defineProperty(w.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set:function(E){this._readableState===void 0||this._writableState===void 0||(this._readableState.destroyed=E,this._writableState.destroyed=E)}}),_stream_duplex$2}var string_decoder$2={},Buffer$D=safeBufferExports$2.Buffer,isEncoding=Buffer$D.isEncoding||function(e){switch(e=""+e,e&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function _normalizeEncoding(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}function normalizeEncoding(e){var t=_normalizeEncoding(e);if(typeof t!="string"&&(Buffer$D.isEncoding===isEncoding||!isEncoding(e)))throw new Error("Unknown encoding: "+e);return t||e}string_decoder$2.StringDecoder=StringDecoder$1;function StringDecoder$1(e){this.encoding=normalizeEncoding(e);var t;switch(this.encoding){case"utf16le":this.text=utf16Text,this.end=utf16End,t=4;break;case"utf8":this.fillLast=utf8FillLast,t=4;break;case"base64":this.text=base64Text,this.end=base64End,t=3;break;default:this.write=simpleWrite,this.end=simpleEnd;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=Buffer$D.allocUnsafe(t)}StringDecoder$1.prototype.write=function(e){if(e.length===0)return"";var t,a;if(this.lastNeed){if(t=this.fillLast(e),t===void 0)return"";a=this.lastNeed,this.lastNeed=0}else a=0;return a<e.length?t?t+this.text(e,a):this.text(e,a):t||""};StringDecoder$1.prototype.end=utf8End;StringDecoder$1.prototype.text=utf8Text;StringDecoder$1.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length};function utf8CheckByte(e){return e<=127?0:e>>5===6?2:e>>4===14?3:e>>3===30?4:e>>6===2?-1:-2}function utf8CheckIncomplete(e,t,a){var u=t.length-1;if(u<a)return 0;var d=utf8CheckByte(t[u]);return d>=0?(d>0&&(e.lastNeed=d-1),d):--u<a||d===-2?0:(d=utf8CheckByte(t[u]),d>=0?(d>0&&(e.lastNeed=d-2),d):--u<a||d===-2?0:(d=utf8CheckByte(t[u]),d>=0?(d>0&&(d===2?d=0:e.lastNeed=d-3),d):0))}function utf8CheckExtraBytes(e,t,a){if((t[0]&192)!==128)return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if((t[1]&192)!==128)return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&(t[2]&192)!==128)return e.lastNeed=2,"�"}}function utf8FillLast(e){var t=this.lastTotal-this.lastNeed,a=utf8CheckExtraBytes(this,e);if(a!==void 0)return a;if(this.lastNeed<=e.length)return e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,t,0,e.length),this.lastNeed-=e.length}function utf8Text(e,t){var a=utf8CheckIncomplete(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=a;var u=e.length-(a-this.lastNeed);return e.copy(this.lastChar,0,u),e.toString("utf8",t,u)}function utf8End(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"�":t}function utf16Text(e,t){if((e.length-t)%2===0){var a=e.toString("utf16le",t);if(a){var u=a.charCodeAt(a.length-1);if(u>=55296&&u<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],a.slice(0,-1)}return a}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function utf16End(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var a=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,a)}return t}function base64Text(e,t){var a=(e.length-t)%3;return a===0?e.toString("base64",t):(this.lastNeed=3-a,this.lastTotal=3,a===1?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-a))}function base64End(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function simpleWrite(e){return e.toString(this.encoding)}function simpleEnd(e){return e&&e.length?this.write(e):""}var endOfStream,hasRequiredEndOfStream;function requireEndOfStream(){if(hasRequiredEndOfStream)return endOfStream;hasRequiredEndOfStream=1;var e=requireErrorsBrowser().codes.ERR_STREAM_PREMATURE_CLOSE;function t(h){var w=!1;return function(){if(!w){w=!0;for(var x=arguments.length,M=new Array(x),B=0;B<x;B++)M[B]=arguments[B];h.apply(this,M)}}}function a(){}function u(h){return h.setHeader&&typeof h.abort=="function"}function d(h,w,x){if(typeof w=="function")return d(h,null,w);w||(w={}),x=t(x||a);var M=w.readable||w.readable!==!1&&h.readable,B=w.writable||w.writable!==!1&&h.writable,E=function(){h.writable||k()},S=h._writableState&&h._writableState.finished,k=function(){B=!1,S=!0,M||x.call(h)},C=h._readableState&&h._readableState.endEmitted,q=function(){M=!1,C=!0,B||x.call(h)},O=function(J){x.call(h,J)},U=function(){var J;if(M&&!C)return(!h._readableState||!h._readableState.ended)&&(J=new e),x.call(h,J);if(B&&!S)return(!h._writableState||!h._writableState.ended)&&(J=new e),x.call(h,J)},P=function(){h.req.on("finish",k)};return u(h)?(h.on("complete",k),h.on("abort",U),h.req?P():h.on("request",P)):B&&!h._writableState&&(h.on("end",E),h.on("close",E)),h.on("end",q),h.on("finish",k),w.error!==!1&&h.on("error",O),h.on("close",U),function(){h.removeListener("complete",k),h.removeListener("abort",U),h.removeListener("request",P),h.req&&h.req.removeListener("finish",k),h.removeListener("end",E),h.removeListener("close",E),h.removeListener("finish",k),h.removeListener("end",q),h.removeListener("error",O),h.removeListener("close",U)}}return endOfStream=d,endOfStream}var async_iterator,hasRequiredAsync_iterator;function requireAsync_iterator(){if(hasRequiredAsync_iterator)return async_iterator;hasRequiredAsync_iterator=1;var e;function t(J,Y,ae){return Y=a(Y),Y in J?Object.defineProperty(J,Y,{value:ae,enumerable:!0,configurable:!0,writable:!0}):J[Y]=ae,J}function a(J){var Y=u(J,"string");return typeof Y=="symbol"?Y:String(Y)}function u(J,Y){if(typeof J!="object"||J===null)return J;var ae=J[Symbol.toPrimitive];if(ae!==void 0){var oe=ae.call(J,Y);if(typeof oe!="object")return oe;throw new TypeError("@@toPrimitive must return a primitive value.")}return(Y==="string"?String:Number)(J)}var d=requireEndOfStream(),h=Symbol("lastResolve"),w=Symbol("lastReject"),x=Symbol("error"),M=Symbol("ended"),B=Symbol("lastPromise"),E=Symbol("handlePromise"),S=Symbol("stream");function k(J,Y){return{value:J,done:Y}}function C(J){var Y=J[h];if(Y!==null){var ae=J[S].read();ae!==null&&(J[B]=null,J[h]=null,J[w]=null,Y(k(ae,!1)))}}function q(J){process$1.nextTick(C,J)}function O(J,Y){return function(ae,oe){J.then(function(){if(Y[M]){ae(k(void 0,!0));return}Y[E](ae,oe)},oe)}}var U=Object.getPrototypeOf(function(){}),P=Object.setPrototypeOf((e={get stream(){return this[S]},next:function(){var Y=this,ae=this[x];if(ae!==null)return Promise.reject(ae);if(this[M])return Promise.resolve(k(void 0,!0));if(this[S].destroyed)return new Promise(function(ie,ce){process$1.nextTick(function(){Y[x]?ce(Y[x]):ie(k(void 0,!0))})});var oe=this[B],ue;if(oe)ue=new Promise(O(oe,this));else{var se=this[S].read();if(se!==null)return Promise.resolve(k(se,!1));ue=new Promise(this[E])}return this[B]=ue,ue}},t(e,Symbol.asyncIterator,function(){return this}),t(e,"return",function(){var Y=this;return new Promise(function(ae,oe){Y[S].destroy(null,function(ue){if(ue){oe(ue);return}ae(k(void 0,!0))})})}),e),U),L=function(Y){var ae,oe=Object.create(P,(ae={},t(ae,S,{value:Y,writable:!0}),t(ae,h,{value:null,writable:!0}),t(ae,w,{value:null,writable:!0}),t(ae,x,{value:null,writable:!0}),t(ae,M,{value:Y._readableState.endEmitted,writable:!0}),t(ae,E,{value:function(se,ie){var ce=oe[S].read();ce?(oe[B]=null,oe[h]=null,oe[w]=null,se(k(ce,!1))):(oe[h]=se,oe[w]=ie)},writable:!0}),ae));return oe[B]=null,d(Y,function(ue){if(ue&&ue.code!=="ERR_STREAM_PREMATURE_CLOSE"){var se=oe[w];se!==null&&(oe[B]=null,oe[h]=null,oe[w]=null,se(ue)),oe[x]=ue;return}var ie=oe[h];ie!==null&&(oe[B]=null,oe[h]=null,oe[w]=null,ie(k(void 0,!0))),oe[M]=!0}),Y.on("readable",q.bind(null,oe)),oe};return async_iterator=L,async_iterator}var fromBrowser,hasRequiredFromBrowser;function requireFromBrowser(){return hasRequiredFromBrowser||(hasRequiredFromBrowser=1,fromBrowser=function(){throw new Error("Readable.from is not available in the browser")}),fromBrowser}var _stream_readable$2,hasRequired_stream_readable$2;function require_stream_readable$2(){if(hasRequired_stream_readable$2)return _stream_readable$2;hasRequired_stream_readable$2=1,_stream_readable$2=ie;var e;ie.ReadableState=se,eventsExports.EventEmitter;var t=function(j,re){return j.listeners(re).length},a=requireStreamBrowser(),u=dist.Buffer,d=(typeof commonjsGlobal<"u"?commonjsGlobal:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function h(ee){return u.from(ee)}function w(ee){return u.isBuffer(ee)||ee instanceof d}var x=util$5,M;x&&x.debuglog?M=x.debuglog("stream"):M=function(){};var B=requireBuffer_list(),E=requireDestroy(),S=requireState(),k=S.getHighWaterMark,C=requireErrorsBrowser().codes,q=C.ERR_INVALID_ARG_TYPE,O=C.ERR_STREAM_PUSH_AFTER_EOF,U=C.ERR_METHOD_NOT_IMPLEMENTED,P=C.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,L,J,Y;inherits_browserExports(ie,a);var ae=E.errorOrDestroy,oe=["error","close","destroy","pause","resume"];function ue(ee,j,re){if(typeof ee.prependListener=="function")return ee.prependListener(j,re);!ee._events||!ee._events[j]?ee.on(j,re):Array.isArray(ee._events[j])?ee._events[j].unshift(re):ee._events[j]=[re,ee._events[j]]}function se(ee,j,re){e=e||require_stream_duplex$2(),ee=ee||{},typeof re!="boolean"&&(re=j instanceof e),this.objectMode=!!ee.objectMode,re&&(this.objectMode=this.objectMode||!!ee.readableObjectMode),this.highWaterMark=k(this,ee,"readableHighWaterMark",re),this.buffer=new B,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=ee.emitClose!==!1,this.autoDestroy=!!ee.autoDestroy,this.destroyed=!1,this.defaultEncoding=ee.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,ee.encoding&&(L||(L=string_decoder$2.StringDecoder),this.decoder=new L(ee.encoding),this.encoding=ee.encoding)}function ie(ee){if(e=e||require_stream_duplex$2(),!(this instanceof ie))return new ie(ee);var j=this instanceof e;this._readableState=new se(ee,this,j),this.readable=!0,ee&&(typeof ee.read=="function"&&(this._read=ee.read),typeof ee.destroy=="function"&&(this._destroy=ee.destroy)),a.call(this)}Object.defineProperty(ie.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(j){this._readableState&&(this._readableState.destroyed=j)}}),ie.prototype.destroy=E.destroy,ie.prototype._undestroy=E.undestroy,ie.prototype._destroy=function(ee,j){j(ee)},ie.prototype.push=function(ee,j){var re=this._readableState,qe;return re.objectMode?qe=!0:typeof ee=="string"&&(j=j||re.defaultEncoding,j!==re.encoding&&(ee=u.from(ee,j),j=""),qe=!0),ce(this,ee,j,!1,qe)},ie.prototype.unshift=function(ee){return ce(this,ee,null,!0,!1)};function ce(ee,j,re,qe,de){M("readableAddChunk",j);var pe=ee._readableState;if(j===null)pe.reading=!1,y(ee,pe);else{var je;if(de||(je=n(pe,j)),je)ae(ee,je);else if(pe.objectMode||j&&j.length>0)if(typeof j!="string"&&!pe.objectMode&&Object.getPrototypeOf(j)!==u.prototype&&(j=h(j)),qe)pe.endEmitted?ae(ee,new P):$(ee,pe,j,!0);else if(pe.ended)ae(ee,new O);else{if(pe.destroyed)return!1;pe.reading=!1,pe.decoder&&!re?(j=pe.decoder.write(j),pe.objectMode||j.length!==0?$(ee,pe,j,!1):v(ee,pe)):$(ee,pe,j,!1)}else qe||(pe.reading=!1,v(ee,pe))}return!pe.ended&&(pe.length<pe.highWaterMark||pe.length===0)}function $(ee,j,re,qe){j.flowing&&j.length===0&&!j.sync?(j.awaitDrain=0,ee.emit("data",re)):(j.length+=j.objectMode?1:re.length,qe?j.buffer.unshift(re):j.buffer.push(re),j.needReadable&&b(ee)),v(ee,j)}function n(ee,j){var re;return!w(j)&&typeof j!="string"&&j!==void 0&&!ee.objectMode&&(re=new q("chunk",["string","Buffer","Uint8Array"],j)),re}ie.prototype.isPaused=function(){return this._readableState.flowing===!1},ie.prototype.setEncoding=function(ee){L||(L=string_decoder$2.StringDecoder);var j=new L(ee);this._readableState.decoder=j,this._readableState.encoding=this._readableState.decoder.encoding;for(var re=this._readableState.buffer.head,qe="";re!==null;)qe+=j.write(re.data),re=re.next;return this._readableState.buffer.clear(),qe!==""&&this._readableState.buffer.push(qe),this._readableState.length=qe.length,this};var l=1073741824;function c(ee){return ee>=l?ee=l:(ee--,ee|=ee>>>1,ee|=ee>>>2,ee|=ee>>>4,ee|=ee>>>8,ee|=ee>>>16,ee++),ee}function p(ee,j){return ee<=0||j.length===0&&j.ended?0:j.objectMode?1:ee!==ee?j.flowing&&j.length?j.buffer.head.data.length:j.length:(ee>j.highWaterMark&&(j.highWaterMark=c(ee)),ee<=j.length?ee:j.ended?j.length:(j.needReadable=!0,0))}ie.prototype.read=function(ee){M("read",ee),ee=parseInt(ee,10);var j=this._readableState,re=ee;if(ee!==0&&(j.emittedReadable=!1),ee===0&&j.needReadable&&((j.highWaterMark!==0?j.length>=j.highWaterMark:j.length>0)||j.ended))return M("read: emitReadable",j.length,j.ended),j.length===0&&j.ended?D(this):b(this),null;if(ee=p(ee,j),ee===0&&j.ended)return j.length===0&&D(this),null;var qe=j.needReadable;M("need readable",qe),(j.length===0||j.length-ee<j.highWaterMark)&&(qe=!0,M("length less than watermark",qe)),j.ended||j.reading?(qe=!1,M("reading or ended",qe)):qe&&(M("do read"),j.reading=!0,j.sync=!0,j.length===0&&(j.needReadable=!0),this._read(j.highWaterMark),j.sync=!1,j.reading||(ee=p(re,j)));var de;return ee>0?de=T(ee,j):de=null,de===null?(j.needReadable=j.length<=j.highWaterMark,ee=0):(j.length-=ee,j.awaitDrain=0),j.length===0&&(j.ended||(j.needReadable=!0),re!==ee&&j.ended&&D(this)),de!==null&&this.emit("data",de),de};function y(ee,j){if(M("onEofChunk"),!j.ended){if(j.decoder){var re=j.decoder.end();re&&re.length&&(j.buffer.push(re),j.length+=j.objectMode?1:re.length)}j.ended=!0,j.sync?b(ee):(j.needReadable=!1,j.emittedReadable||(j.emittedReadable=!0,_(ee)))}}function b(ee){var j=ee._readableState;M("emitReadable",j.needReadable,j.emittedReadable),j.needReadable=!1,j.emittedReadable||(M("emitReadable",j.flowing),j.emittedReadable=!0,process$1.nextTick(_,ee))}function _(ee){var j=ee._readableState;M("emitReadable_",j.destroyed,j.length,j.ended),!j.destroyed&&(j.length||j.ended)&&(ee.emit("readable"),j.emittedReadable=!1),j.needReadable=!j.flowing&&!j.ended&&j.length<=j.highWaterMark,V(ee)}function v(ee,j){j.readingMore||(j.readingMore=!0,process$1.nextTick(o,ee,j))}function o(ee,j){for(;!j.reading&&!j.ended&&(j.length<j.highWaterMark||j.flowing&&j.length===0);){var re=j.length;if(M("maybeReadMore read 0"),ee.read(0),re===j.length)break}j.readingMore=!1}ie.prototype._read=function(ee){ae(this,new U("_read()"))},ie.prototype.pipe=function(ee,j){var re=this,qe=this._readableState;switch(qe.pipesCount){case 0:qe.pipes=ee;break;case 1:qe.pipes=[qe.pipes,ee];break;default:qe.pipes.push(ee);break}qe.pipesCount+=1,M("pipe count=%d opts=%j",qe.pipesCount,j);var de=(!j||j.end!==!1)&&ee!==process$1.stdout&&ee!==process$1.stderr,pe=de?we:Ge;qe.endEmitted?process$1.nextTick(pe):re.once("end",pe),ee.on("unpipe",je);function je(Me,Ne){M("onunpipe"),Me===re&&Ne&&Ne.hasUnpiped===!1&&(Ne.hasUnpiped=!0,_e())}function we(){M("onend"),ee.end()}var le=m(re);ee.on("drain",le);var Ve=!1;function _e(){M("cleanup"),ee.removeListener("close",me),ee.removeListener("finish",ke),ee.removeListener("drain",le),ee.removeListener("error",ze),ee.removeListener("unpipe",je),re.removeListener("end",we),re.removeListener("end",Ge),re.removeListener("data",xe),Ve=!0,qe.awaitDrain&&(!ee._writableState||ee._writableState.needDrain)&&le()}re.on("data",xe);function xe(Me){M("ondata");var Ne=ee.write(Me);M("dest.write",Ne),Ne===!1&&((qe.pipesCount===1&&qe.pipes===ee||qe.pipesCount>1&&te(qe.pipes,ee)!==-1)&&!Ve&&(M("false write response, pause",qe.awaitDrain),qe.awaitDrain++),re.pause())}function ze(Me){M("onerror",Me),Ge(),ee.removeListener("error",ze),t(ee,"error")===0&&ae(ee,Me)}ue(ee,"error",ze);function me(){ee.removeListener("finish",ke),Ge()}ee.once("close",me);function ke(){M("onfinish"),ee.removeListener("close",me),Ge()}ee.once("finish",ke);function Ge(){M("unpipe"),re.unpipe(ee)}return ee.emit("pipe",re),qe.flowing||(M("pipe resume"),re.resume()),ee};function m(ee){return function(){var re=ee._readableState;M("pipeOnDrain",re.awaitDrain),re.awaitDrain&&re.awaitDrain--,re.awaitDrain===0&&t(ee,"data")&&(re.flowing=!0,V(ee))}}ie.prototype.unpipe=function(ee){var j=this._readableState,re={hasUnpiped:!1};if(j.pipesCount===0)return this;if(j.pipesCount===1)return ee&&ee!==j.pipes?this:(ee||(ee=j.pipes),j.pipes=null,j.pipesCount=0,j.flowing=!1,ee&&ee.emit("unpipe",this,re),this);if(!ee){var qe=j.pipes,de=j.pipesCount;j.pipes=null,j.pipesCount=0,j.flowing=!1;for(var pe=0;pe<de;pe++)qe[pe].emit("unpipe",this,{hasUnpiped:!1});return this}var je=te(j.pipes,ee);return je===-1?this:(j.pipes.splice(je,1),j.pipesCount-=1,j.pipesCount===1&&(j.pipes=j.pipes[0]),ee.emit("unpipe",this,re),this)},ie.prototype.on=function(ee,j){var re=a.prototype.on.call(this,ee,j),qe=this._readableState;return ee==="data"?(qe.readableListening=this.listenerCount("readable")>0,qe.flowing!==!1&&this.resume()):ee==="readable"&&!qe.endEmitted&&!qe.readableListening&&(qe.readableListening=qe.needReadable=!0,qe.flowing=!1,qe.emittedReadable=!1,M("on readable",qe.length,qe.reading),qe.length?b(this):qe.reading||process$1.nextTick(I,this)),re},ie.prototype.addListener=ie.prototype.on,ie.prototype.removeListener=function(ee,j){var re=a.prototype.removeListener.call(this,ee,j);return ee==="readable"&&process$1.nextTick(A,this),re},ie.prototype.removeAllListeners=function(ee){var j=a.prototype.removeAllListeners.apply(this,arguments);return(ee==="readable"||ee===void 0)&&process$1.nextTick(A,this),j};function A(ee){var j=ee._readableState;j.readableListening=ee.listenerCount("readable")>0,j.resumeScheduled&&!j.paused?j.flowing=!0:ee.listenerCount("data")>0&&ee.resume()}function I(ee){M("readable nexttick read 0"),ee.read(0)}ie.prototype.resume=function(){var ee=this._readableState;return ee.flowing||(M("resume"),ee.flowing=!ee.readableListening,F(this,ee)),ee.paused=!1,this};function F(ee,j){j.resumeScheduled||(j.resumeScheduled=!0,process$1.nextTick(X,ee,j))}function X(ee,j){M("resume",j.reading),j.reading||ee.read(0),j.resumeScheduled=!1,ee.emit("resume"),V(ee),j.flowing&&!j.reading&&ee.read(0)}ie.prototype.pause=function(){return M("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(M("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function V(ee){var j=ee._readableState;for(M("flow",j.flowing);j.flowing&&ee.read()!==null;);}ie.prototype.wrap=function(ee){var j=this,re=this._readableState,qe=!1;ee.on("end",function(){if(M("wrapped end"),re.decoder&&!re.ended){var je=re.decoder.end();je&&je.length&&j.push(je)}j.push(null)}),ee.on("data",function(je){if(M("wrapped data"),re.decoder&&(je=re.decoder.write(je)),!(re.objectMode&&je==null)&&!(!re.objectMode&&(!je||!je.length))){var we=j.push(je);we||(qe=!0,ee.pause())}});for(var de in ee)this[de]===void 0&&typeof ee[de]=="function"&&(this[de]=function(we){return function(){return ee[we].apply(ee,arguments)}}(de));for(var pe=0;pe<oe.length;pe++)ee.on(oe[pe],this.emit.bind(this,oe[pe]));return this._read=function(je){M("wrapped _read",je),qe&&(qe=!1,ee.resume())},this},typeof Symbol=="function"&&(ie.prototype[Symbol.asyncIterator]=function(){return J===void 0&&(J=requireAsync_iterator()),J(this)}),Object.defineProperty(ie.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(ie.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(ie.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(j){this._readableState&&(this._readableState.flowing=j)}}),ie._fromList=T,Object.defineProperty(ie.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}});function T(ee,j){if(j.length===0)return null;var re;return j.objectMode?re=j.buffer.shift():!ee||ee>=j.length?(j.decoder?re=j.buffer.join(""):j.buffer.length===1?re=j.buffer.first():re=j.buffer.concat(j.length),j.buffer.clear()):re=j.buffer.consume(ee,j.decoder),re}function D(ee){var j=ee._readableState;M("endReadable",j.endEmitted),j.endEmitted||(j.ended=!0,process$1.nextTick(Z,j,ee))}function Z(ee,j){if(M("endReadableNT",ee.endEmitted,ee.length),!ee.endEmitted&&ee.length===0&&(ee.endEmitted=!0,j.readable=!1,j.emit("end"),ee.autoDestroy)){var re=j._writableState;(!re||re.autoDestroy&&re.finished)&&j.destroy()}}typeof Symbol=="function"&&(ie.from=function(ee,j){return Y===void 0&&(Y=requireFromBrowser()),Y(ie,ee,j)});function te(ee,j){for(var re=0,qe=ee.length;re<qe;re++)if(ee[re]===j)return re;return-1}return _stream_readable$2}var _stream_transform$2,hasRequired_stream_transform;function require_stream_transform(){if(hasRequired_stream_transform)return _stream_transform$2;hasRequired_stream_transform=1,_stream_transform$2=x;var e=requireErrorsBrowser().codes,t=e.ERR_METHOD_NOT_IMPLEMENTED,a=e.ERR_MULTIPLE_CALLBACK,u=e.ERR_TRANSFORM_ALREADY_TRANSFORMING,d=e.ERR_TRANSFORM_WITH_LENGTH_0,h=require_stream_duplex$2();inherits_browserExports(x,h);function w(E,S){var k=this._transformState;k.transforming=!1;var C=k.writecb;if(C===null)return this.emit("error",new a);k.writechunk=null,k.writecb=null,S!=null&&this.push(S),C(E);var q=this._readableState;q.reading=!1,(q.needReadable||q.length<q.highWaterMark)&&this._read(q.highWaterMark)}function x(E){if(!(this instanceof x))return new x(E);h.call(this,E),this._transformState={afterTransform:w.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,E&&(typeof E.transform=="function"&&(this._transform=E.transform),typeof E.flush=="function"&&(this._flush=E.flush)),this.on("prefinish",M)}function M(){var E=this;typeof this._flush=="function"&&!this._readableState.destroyed?this._flush(function(S,k){B(E,S,k)}):B(this,null,null)}x.prototype.push=function(E,S){return this._transformState.needTransform=!1,h.prototype.push.call(this,E,S)},x.prototype._transform=function(E,S,k){k(new t("_transform()"))},x.prototype._write=function(E,S,k){var C=this._transformState;if(C.writecb=k,C.writechunk=E,C.writeencoding=S,!C.transforming){var q=this._readableState;(C.needTransform||q.needReadable||q.length<q.highWaterMark)&&this._read(q.highWaterMark)}},x.prototype._read=function(E){var S=this._transformState;S.writechunk!==null&&!S.transforming?(S.transforming=!0,this._transform(S.writechunk,S.writeencoding,S.afterTransform)):S.needTransform=!0},x.prototype._destroy=function(E,S){h.prototype._destroy.call(this,E,function(k){S(k)})};function B(E,S,k){if(S)return E.emit("error",S);if(k!=null&&E.push(k),E._writableState.length)throw new d;if(E._transformState.transforming)throw new u;return E.push(null)}return _stream_transform$2}var _stream_passthrough$2,hasRequired_stream_passthrough;function require_stream_passthrough(){if(hasRequired_stream_passthrough)return _stream_passthrough$2;hasRequired_stream_passthrough=1,_stream_passthrough$2=t;var e=require_stream_transform();inherits_browserExports(t,e);function t(a){if(!(this instanceof t))return new t(a);e.call(this,a)}return t.prototype._transform=function(a,u,d){d(null,a)},_stream_passthrough$2}var pipeline_1,hasRequiredPipeline;function requirePipeline(){if(hasRequiredPipeline)return pipeline_1;hasRequiredPipeline=1;var e;function t(k){var C=!1;return function(){C||(C=!0,k.apply(void 0,arguments))}}var a=requireErrorsBrowser().codes,u=a.ERR_MISSING_ARGS,d=a.ERR_STREAM_DESTROYED;function h(k){if(k)throw k}function w(k){return k.setHeader&&typeof k.abort=="function"}function x(k,C,q,O){O=t(O);var U=!1;k.on("close",function(){U=!0}),e===void 0&&(e=requireEndOfStream()),e(k,{readable:C,writable:q},function(L){if(L)return O(L);U=!0,O()});var P=!1;return function(L){if(!U&&!P){if(P=!0,w(k))return k.abort();if(typeof k.destroy=="function")return k.destroy();O(L||new d("pipe"))}}}function M(k){k()}function B(k,C){return k.pipe(C)}function E(k){return!k.length||typeof k[k.length-1]!="function"?h:k.pop()}function S(){for(var k=arguments.length,C=new Array(k),q=0;q<k;q++)C[q]=arguments[q];var O=E(C);if(Array.isArray(C[0])&&(C=C[0]),C.length<2)throw new u("streams");var U,P=C.map(function(L,J){var Y=J<C.length-1,ae=J>0;return x(L,Y,ae,function(oe){U||(U=oe),oe&&P.forEach(M),!Y&&(P.forEach(M),O(U))})});return C.reduce(B)}return pipeline_1=S,pipeline_1}var streamBrowserify=Stream,EE=eventsExports.EventEmitter,inherits$r=inherits_browserExports;inherits$r(Stream,EE);Stream.Readable=require_stream_readable$2();Stream.Writable=require_stream_writable$2();Stream.Duplex=require_stream_duplex$2();Stream.Transform=require_stream_transform();Stream.PassThrough=require_stream_passthrough();Stream.finished=requireEndOfStream();Stream.pipeline=requirePipeline();Stream.Stream=Stream;function Stream(){EE.call(this)}Stream.prototype.pipe=function(e,t){var a=this;function u(E){e.writable&&e.write(E)===!1&&a.pause&&a.pause()}a.on("data",u);function d(){a.readable&&a.resume&&a.resume()}e.on("drain",d),!e._isStdio&&(!t||t.end!==!1)&&(a.on("end",w),a.on("close",x));var h=!1;function w(){h||(h=!0,e.end())}function x(){h||(h=!0,typeof e.destroy=="function"&&e.destroy())}function M(E){if(B(),EE.listenerCount(this,"error")===0)throw E}a.on("error",M),e.on("error",M);function B(){a.removeListener("data",u),e.removeListener("drain",d),a.removeListener("end",w),a.removeListener("close",x),a.removeListener("error",M),e.removeListener("error",M),a.removeListener("end",B),a.removeListener("close",B),e.removeListener("close",B)}return a.on("end",B),a.on("close",B),e.on("close",B),e.emit("pipe",a),e};var Buffer$C=safeBufferExports$2.Buffer,Transform$a=streamBrowserify.Transform,inherits$q=inherits_browserExports;function HashBase$3(e){Transform$a.call(this),this._block=Buffer$C.allocUnsafe(e),this._blockSize=e,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}inherits$q(HashBase$3,Transform$a);HashBase$3.prototype._transform=function(e,t,a){var u=null;try{this.update(e,t)}catch(d){u=d}a(u)};HashBase$3.prototype._flush=function(e){var t=null;try{this.push(this.digest())}catch(a){t=a}e(t)};var useUint8Array$3=typeof Uint8Array<"u",useArrayBuffer$3=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u"&&ArrayBuffer.isView&&(Buffer$C.prototype instanceof Uint8Array||Buffer$C.TYPED_ARRAY_SUPPORT);function toBuffer$8(e,t){if(e instanceof Buffer$C)return e;if(typeof e=="string")return Buffer$C.from(e,t);if(useArrayBuffer$3&&ArrayBuffer.isView(e)){if(e.byteLength===0)return Buffer$C.alloc(0);var a=Buffer$C.from(e.buffer,e.byteOffset,e.byteLength);if(a.byteLength===e.byteLength)return a}if(useUint8Array$3&&e instanceof Uint8Array||Buffer$C.isBuffer(e)&&e.constructor&&typeof e.constructor.isBuffer=="function"&&e.constructor.isBuffer(e))return Buffer$C.from(e);throw new TypeError('The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView.')}HashBase$3.prototype.update=function(e,t){if(this._finalized)throw new Error("Digest already called");e=toBuffer$8(e,t);for(var a=this._block,u=0;this._blockOffset+e.length-u>=this._blockSize;){for(var d=this._blockOffset;d<this._blockSize;)a[d++]=e[u++];this._update(),this._blockOffset=0}for(;u<e.length;)a[this._blockOffset++]=e[u++];for(var h=0,w=e.length*8;w>0;++h)this._length[h]+=w,w=this._length[h]/4294967296|0,w>0&&(this._length[h]-=4294967296*w);return this};HashBase$3.prototype._update=function(){throw new Error("_update is not implemented")};HashBase$3.prototype.digest=function(e){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var t=this._digest();e!==void 0&&(t=t.toString(e)),this._block.fill(0),this._blockOffset=0;for(var a=0;a<4;++a)this._length[a]=0;return t};HashBase$3.prototype._digest=function(){throw new Error("_digest is not implemented")};var hashBase$1=HashBase$3,inherits$p=inherits_browserExports,HashBase$2=hashBase$1,Buffer$B=safeBufferExports$2.Buffer,ARRAY16$1=new Array(16);function MD5$3(){HashBase$2.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}inherits$p(MD5$3,HashBase$2);MD5$3.prototype._update=function(){for(var e=ARRAY16$1,t=0;t<16;++t)e[t]=this._block.readInt32LE(t*4);var a=this._a,u=this._b,d=this._c,h=this._d;a=fnF(a,u,d,h,e[0],3614090360,7),h=fnF(h,a,u,d,e[1],3905402710,12),d=fnF(d,h,a,u,e[2],606105819,17),u=fnF(u,d,h,a,e[3],3250441966,22),a=fnF(a,u,d,h,e[4],4118548399,7),h=fnF(h,a,u,d,e[5],1200080426,12),d=fnF(d,h,a,u,e[6],2821735955,17),u=fnF(u,d,h,a,e[7],4249261313,22),a=fnF(a,u,d,h,e[8],1770035416,7),h=fnF(h,a,u,d,e[9],2336552879,12),d=fnF(d,h,a,u,e[10],4294925233,17),u=fnF(u,d,h,a,e[11],2304563134,22),a=fnF(a,u,d,h,e[12],1804603682,7),h=fnF(h,a,u,d,e[13],4254626195,12),d=fnF(d,h,a,u,e[14],2792965006,17),u=fnF(u,d,h,a,e[15],1236535329,22),a=fnG(a,u,d,h,e[1],4129170786,5),h=fnG(h,a,u,d,e[6],3225465664,9),d=fnG(d,h,a,u,e[11],643717713,14),u=fnG(u,d,h,a,e[0],3921069994,20),a=fnG(a,u,d,h,e[5],3593408605,5),h=fnG(h,a,u,d,e[10],38016083,9),d=fnG(d,h,a,u,e[15],3634488961,14),u=fnG(u,d,h,a,e[4],3889429448,20),a=fnG(a,u,d,h,e[9],568446438,5),h=fnG(h,a,u,d,e[14],3275163606,9),d=fnG(d,h,a,u,e[3],4107603335,14),u=fnG(u,d,h,a,e[8],1163531501,20),a=fnG(a,u,d,h,e[13],2850285829,5),h=fnG(h,a,u,d,e[2],4243563512,9),d=fnG(d,h,a,u,e[7],1735328473,14),u=fnG(u,d,h,a,e[12],2368359562,20),a=fnH(a,u,d,h,e[5],4294588738,4),h=fnH(h,a,u,d,e[8],2272392833,11),d=fnH(d,h,a,u,e[11],1839030562,16),u=fnH(u,d,h,a,e[14],4259657740,23),a=fnH(a,u,d,h,e[1],2763975236,4),h=fnH(h,a,u,d,e[4],1272893353,11),d=fnH(d,h,a,u,e[7],4139469664,16),u=fnH(u,d,h,a,e[10],3200236656,23),a=fnH(a,u,d,h,e[13],681279174,4),h=fnH(h,a,u,d,e[0],3936430074,11),d=fnH(d,h,a,u,e[3],3572445317,16),u=fnH(u,d,h,a,e[6],76029189,23),a=fnH(a,u,d,h,e[9],3654602809,4),h=fnH(h,a,u,d,e[12],3873151461,11),d=fnH(d,h,a,u,e[15],530742520,16),u=fnH(u,d,h,a,e[2],3299628645,23),a=fnI(a,u,d,h,e[0],4096336452,6),h=fnI(h,a,u,d,e[7],1126891415,10),d=fnI(d,h,a,u,e[14],2878612391,15),u=fnI(u,d,h,a,e[5],4237533241,21),a=fnI(a,u,d,h,e[12],1700485571,6),h=fnI(h,a,u,d,e[3],2399980690,10),d=fnI(d,h,a,u,e[10],4293915773,15),u=fnI(u,d,h,a,e[1],2240044497,21),a=fnI(a,u,d,h,e[8],1873313359,6),h=fnI(h,a,u,d,e[15],4264355552,10),d=fnI(d,h,a,u,e[6],2734768916,15),u=fnI(u,d,h,a,e[13],1309151649,21),a=fnI(a,u,d,h,e[4],4149444226,6),h=fnI(h,a,u,d,e[11],3174756917,10),d=fnI(d,h,a,u,e[2],718787259,15),u=fnI(u,d,h,a,e[9],3951481745,21),this._a=this._a+a|0,this._b=this._b+u|0,this._c=this._c+d|0,this._d=this._d+h|0};MD5$3.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var e=Buffer$B.allocUnsafe(16);return e.writeInt32LE(this._a,0),e.writeInt32LE(this._b,4),e.writeInt32LE(this._c,8),e.writeInt32LE(this._d,12),e};function rotl$2(e,t){return e<<t|e>>>32-t}function fnF(e,t,a,u,d,h,w){return rotl$2(e+(t&a|~t&u)+d+h|0,w)+t|0}function fnG(e,t,a,u,d,h,w){return rotl$2(e+(t&u|a&~u)+d+h|0,w)+t|0}function fnH(e,t,a,u,d,h,w){return rotl$2(e+(t^a^u)+d+h|0,w)+t|0}function fnI(e,t,a,u,d,h,w){return rotl$2(e+(a^(t|~u))+d+h|0,w)+t|0}var md5_js=MD5$3,toString$2={}.toString,isarray$2=Array.isArray||function(e){return toString$2.call(e)=="[object Array]"},$TypeError=type,callBound=callBound$6,$typedArrayBuffer=callBound("TypedArray.prototype.buffer",!0),isTypedArray=requireIsTypedArray(),typedArrayBuffer$1=$typedArrayBuffer||function(t){if(!isTypedArray(t))throw new $TypeError("Not a Typed Array");return t.buffer},Buffer$A=safeBufferExports$2.Buffer,isArray$1=isarray$2,typedArrayBuffer=typedArrayBuffer$1,isView$2=ArrayBuffer.isView||function(t){try{return typedArrayBuffer(t),!0}catch{return!1}},useUint8Array$2=typeof Uint8Array<"u",useArrayBuffer$2=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",useFromArrayBuffer=useArrayBuffer$2&&(Buffer$A.prototype instanceof Uint8Array||Buffer$A.TYPED_ARRAY_SUPPORT),toBuffer$7=function(t,a){if(Buffer$A.isBuffer(t))return t.constructor&&!("isBuffer"in t)?Buffer$A.from(t):t;if(typeof t=="string")return Buffer$A.from(t,a);if(useArrayBuffer$2&&isView$2(t)){if(t.byteLength===0)return Buffer$A.alloc(0);if(useFromArrayBuffer){var u=Buffer$A.from(t.buffer,t.byteOffset,t.byteLength);if(u.byteLength===t.byteLength)return u}var d=t instanceof Uint8Array?t:new Uint8Array(t.buffer,t.byteOffset,t.byteLength),h=Buffer$A.from(d);if(h.length===t.byteLength)return h}if(useUint8Array$2&&t instanceof Uint8Array)return Buffer$A.from(t);var w=isArray$1(t);if(w)for(var x=0;x<t.length;x+=1){var M=t[x];if(typeof M!="number"||M<0||M>255||~~M!==M)throw new RangeError("Array items must be numbers in the range 0-255.")}if(w||Buffer$A.isBuffer(t)&&t.constructor&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t))return Buffer$A.from(t);throw new TypeError('The "data" argument must be a string, an Array, a Buffer, a Uint8Array, or a DataView.')},Buffer$z=safeBufferExports$2.Buffer,toBuffer$6=toBuffer$7,useUint8Array$1=typeof Uint8Array<"u",useArrayBuffer$1=useUint8Array$1&&typeof ArrayBuffer<"u",isView$1=useArrayBuffer$1&&ArrayBuffer.isView,toBuffer_1$1=function(e,t){if(typeof e=="string"||Buffer$z.isBuffer(e)||useUint8Array$1&&e instanceof Uint8Array||isView$1&&isView$1(e))return toBuffer$6(e,t);throw new TypeError('The "data" argument must be a string, a Buffer, a Uint8Array, or a DataView')},readableBrowser$1={exports:{}},processNextickArgs={exports:{}};typeof process$1>"u"||!process$1.version||process$1.version.indexOf("v0.")===0||process$1.version.indexOf("v1.")===0&&process$1.version.indexOf("v1.8.")!==0?processNextickArgs.exports={nextTick:nextTick$1}:processNextickArgs.exports=process$1;function nextTick$1(e,t,a,u){if(typeof e!="function")throw new TypeError('"callback" argument must be a function');var d=arguments.length,h,w;switch(d){case 0:case 1:return process$1.nextTick(e);case 2:return process$1.nextTick(function(){e.call(null,t)});case 3:return process$1.nextTick(function(){e.call(null,t,a)});case 4:return process$1.nextTick(function(){e.call(null,t,a,u)});default:for(h=new Array(d-1),w=0;w<h.length;)h[w++]=arguments[w];return process$1.nextTick(function(){e.apply(null,h)})}}var processNextickArgsExports=processNextickArgs.exports,toString$1={}.toString,isarray$1=Array.isArray||function(e){return toString$1.call(e)=="[object Array]"},streamBrowser$1=eventsExports.EventEmitter,safeBuffer$4={exports:{}};(function(e,t){var a=dist,u=a.Buffer;function d(w,x){for(var M in w)x[M]=w[M]}u.from&&u.alloc&&u.allocUnsafe&&u.allocUnsafeSlow?e.exports=a:(d(a,t),t.Buffer=h);function h(w,x,M){return u(w,x,M)}d(u,h),h.from=function(w,x,M){if(typeof w=="number")throw new TypeError("Argument must not be a number");return u(w,x,M)},h.alloc=function(w,x,M){if(typeof w!="number")throw new TypeError("Argument must be a number");var B=u(w);return x!==void 0?typeof M=="string"?B.fill(x,M):B.fill(x):B.fill(0),B},h.allocUnsafe=function(w){if(typeof w!="number")throw new TypeError("Argument must be a number");return u(w)},h.allocUnsafeSlow=function(w){if(typeof w!="number")throw new TypeError("Argument must be a number");return a.SlowBuffer(w)}})(safeBuffer$4,safeBuffer$4.exports);var safeBufferExports$1=safeBuffer$4.exports,util$4={};function isArray(e){return Array.isArray?Array.isArray(e):objectToString(e)==="[object Array]"}util$4.isArray=isArray;function isBoolean(e){return typeof e=="boolean"}util$4.isBoolean=isBoolean;function isNull(e){return e===null}util$4.isNull=isNull;function isNullOrUndefined(e){return e==null}util$4.isNullOrUndefined=isNullOrUndefined;function isNumber(e){return typeof e=="number"}util$4.isNumber=isNumber;function isString(e){return typeof e=="string"}util$4.isString=isString;function isSymbol(e){return typeof e=="symbol"}util$4.isSymbol=isSymbol;function isUndefined(e){return e===void 0}util$4.isUndefined=isUndefined;function isRegExp(e){return objectToString(e)==="[object RegExp]"}util$4.isRegExp=isRegExp;function isObject(e){return typeof e=="object"&&e!==null}util$4.isObject=isObject;function isDate(e){return objectToString(e)==="[object Date]"}util$4.isDate=isDate;function isError(e){return objectToString(e)==="[object Error]"||e instanceof Error}util$4.isError=isError;function isFunction(e){return typeof e=="function"}util$4.isFunction=isFunction;function isPrimitive(e){return e===null||typeof e=="boolean"||typeof e=="number"||typeof e=="string"||typeof e=="symbol"||typeof e>"u"}util$4.isPrimitive=isPrimitive;util$4.isBuffer=dist.Buffer.isBuffer;function objectToString(e){return Object.prototype.toString.call(e)}var BufferList$1={exports:{}},hasRequiredBufferList$1;function requireBufferList$1(){return hasRequiredBufferList$1||(hasRequiredBufferList$1=1,function(e){function t(h,w){if(!(h instanceof w))throw new TypeError("Cannot call a class as a function")}var a=safeBufferExports$1.Buffer,u=util$5;function d(h,w,x){h.copy(w,x)}e.exports=function(){function h(){t(this,h),this.head=null,this.tail=null,this.length=0}return h.prototype.push=function(x){var M={data:x,next:null};this.length>0?this.tail.next=M:this.head=M,this.tail=M,++this.length},h.prototype.unshift=function(x){var M={data:x,next:this.head};this.length===0&&(this.tail=M),this.head=M,++this.length},h.prototype.shift=function(){if(this.length!==0){var x=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,x}},h.prototype.clear=function(){this.head=this.tail=null,this.length=0},h.prototype.join=function(x){if(this.length===0)return"";for(var M=this.head,B=""+M.data;M=M.next;)B+=x+M.data;return B},h.prototype.concat=function(x){if(this.length===0)return a.alloc(0);for(var M=a.allocUnsafe(x>>>0),B=this.head,E=0;B;)d(B.data,M,E),E+=B.data.length,B=B.next;return M},h}(),u&&u.inspect&&u.inspect.custom&&(e.exports.prototype[u.inspect.custom]=function(){var h=u.inspect({length:this.length});return this.constructor.name+" "+h})}(BufferList$1)),BufferList$1.exports}var pna$1=processNextickArgsExports;function destroy$1(e,t){var a=this,u=this._readableState&&this._readableState.destroyed,d=this._writableState&&this._writableState.destroyed;return u||d?(t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,pna$1.nextTick(emitErrorNT$1,this,e)):pna$1.nextTick(emitErrorNT$1,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(h){!t&&h?a._writableState?a._writableState.errorEmitted||(a._writableState.errorEmitted=!0,pna$1.nextTick(emitErrorNT$1,a,h)):pna$1.nextTick(emitErrorNT$1,a,h):t&&t(h)}),this)}function undestroy$1(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function emitErrorNT$1(e,t){e.emit("error",t)}var destroy_1$1={destroy:destroy$1,undestroy:undestroy$1},_stream_writable$1,hasRequired_stream_writable$1;function require_stream_writable$1(){if(hasRequired_stream_writable$1)return _stream_writable$1;hasRequired_stream_writable$1=1;var e=processNextickArgsExports;_stream_writable$1=O;function t(b){var _=this;this.next=null,this.entry=null,this.finish=function(){y(_,b)}}var a=!process$1.browser&&["v0.10","v0.9."].indexOf(process$1.version.slice(0,5))>-1?setImmediate:e.nextTick,u;O.WritableState=C;var d=Object.create(util$4);d.inherits=inherits_browserExports;var h={deprecate:browser$a},w=streamBrowser$1,x=safeBufferExports$1.Buffer,M=(typeof commonjsGlobal<"u"?commonjsGlobal:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function B(b){return x.from(b)}function E(b){return x.isBuffer(b)||b instanceof M}var S=destroy_1$1;d.inherits(O,w);function k(){}function C(b,_){u=u||require_stream_duplex$1(),b=b||{};var v=_ instanceof u;this.objectMode=!!b.objectMode,v&&(this.objectMode=this.objectMode||!!b.writableObjectMode);var o=b.highWaterMark,m=b.writableHighWaterMark,A=this.objectMode?16:16*1024;o||o===0?this.highWaterMark=o:v&&(m||m===0)?this.highWaterMark=m:this.highWaterMark=A,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var I=b.decodeStrings===!1;this.decodeStrings=!I,this.defaultEncoding=b.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(F){ue(_,F)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new t(this)}C.prototype.getBuffer=function(){for(var _=this.bufferedRequest,v=[];_;)v.push(_),_=_.next;return v},function(){try{Object.defineProperty(C.prototype,"buffer",{get:h.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}}();var q;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(q=Function.prototype[Symbol.hasInstance],Object.defineProperty(O,Symbol.hasInstance,{value:function(b){return q.call(this,b)?!0:this!==O?!1:b&&b._writableState instanceof C}})):q=function(b){return b instanceof this};function O(b){if(u=u||require_stream_duplex$1(),!q.call(O,this)&&!(this instanceof u))return new O(b);this._writableState=new C(b,this),this.writable=!0,b&&(typeof b.write=="function"&&(this._write=b.write),typeof b.writev=="function"&&(this._writev=b.writev),typeof b.destroy=="function"&&(this._destroy=b.destroy),typeof b.final=="function"&&(this._final=b.final)),w.call(this)}O.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))};function U(b,_){var v=new Error("write after end");b.emit("error",v),e.nextTick(_,v)}function P(b,_,v,o){var m=!0,A=!1;return v===null?A=new TypeError("May not write null values to stream"):typeof v!="string"&&v!==void 0&&!_.objectMode&&(A=new TypeError("Invalid non-string/buffer chunk")),A&&(b.emit("error",A),e.nextTick(o,A),m=!1),m}O.prototype.write=function(b,_,v){var o=this._writableState,m=!1,A=!o.objectMode&&E(b);return A&&!x.isBuffer(b)&&(b=B(b)),typeof _=="function"&&(v=_,_=null),A?_="buffer":_||(_=o.defaultEncoding),typeof v!="function"&&(v=k),o.ended?U(this,v):(A||P(this,o,b,v))&&(o.pendingcb++,m=J(this,o,A,b,_,v)),m},O.prototype.cork=function(){var b=this._writableState;b.corked++},O.prototype.uncork=function(){var b=this._writableState;b.corked&&(b.corked--,!b.writing&&!b.corked&&!b.bufferProcessing&&b.bufferedRequest&&ce(this,b))},O.prototype.setDefaultEncoding=function(_){if(typeof _=="string"&&(_=_.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((_+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+_);return this._writableState.defaultEncoding=_,this};function L(b,_,v){return!b.objectMode&&b.decodeStrings!==!1&&typeof _=="string"&&(_=x.from(_,v)),_}Object.defineProperty(O.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function J(b,_,v,o,m,A){if(!v){var I=L(_,o,m);o!==I&&(v=!0,m="buffer",o=I)}var F=_.objectMode?1:o.length;_.length+=F;var X=_.length<_.highWaterMark;if(X||(_.needDrain=!0),_.writing||_.corked){var V=_.lastBufferedRequest;_.lastBufferedRequest={chunk:o,encoding:m,isBuf:v,callback:A,next:null},V?V.next=_.lastBufferedRequest:_.bufferedRequest=_.lastBufferedRequest,_.bufferedRequestCount+=1}else Y(b,_,!1,F,o,m,A);return X}function Y(b,_,v,o,m,A,I){_.writelen=o,_.writecb=I,_.writing=!0,_.sync=!0,v?b._writev(m,_.onwrite):b._write(m,A,_.onwrite),_.sync=!1}function ae(b,_,v,o,m){--_.pendingcb,v?(e.nextTick(m,o),e.nextTick(c,b,_),b._writableState.errorEmitted=!0,b.emit("error",o)):(m(o),b._writableState.errorEmitted=!0,b.emit("error",o),c(b,_))}function oe(b){b.writing=!1,b.writecb=null,b.length-=b.writelen,b.writelen=0}function ue(b,_){var v=b._writableState,o=v.sync,m=v.writecb;if(oe(v),_)ae(b,v,o,_,m);else{var A=$(v);!A&&!v.corked&&!v.bufferProcessing&&v.bufferedRequest&&ce(b,v),o?a(se,b,v,A,m):se(b,v,A,m)}}function se(b,_,v,o){v||ie(b,_),_.pendingcb--,o(),c(b,_)}function ie(b,_){_.length===0&&_.needDrain&&(_.needDrain=!1,b.emit("drain"))}function ce(b,_){_.bufferProcessing=!0;var v=_.bufferedRequest;if(b._writev&&v&&v.next){var o=_.bufferedRequestCount,m=new Array(o),A=_.corkedRequestsFree;A.entry=v;for(var I=0,F=!0;v;)m[I]=v,v.isBuf||(F=!1),v=v.next,I+=1;m.allBuffers=F,Y(b,_,!0,_.length,m,"",A.finish),_.pendingcb++,_.lastBufferedRequest=null,A.next?(_.corkedRequestsFree=A.next,A.next=null):_.corkedRequestsFree=new t(_),_.bufferedRequestCount=0}else{for(;v;){var X=v.chunk,V=v.encoding,T=v.callback,D=_.objectMode?1:X.length;if(Y(b,_,!1,D,X,V,T),v=v.next,_.bufferedRequestCount--,_.writing)break}v===null&&(_.lastBufferedRequest=null)}_.bufferedRequest=v,_.bufferProcessing=!1}O.prototype._write=function(b,_,v){v(new Error("_write() is not implemented"))},O.prototype._writev=null,O.prototype.end=function(b,_,v){var o=this._writableState;typeof b=="function"?(v=b,b=null,_=null):typeof _=="function"&&(v=_,_=null),b!=null&&this.write(b,_),o.corked&&(o.corked=1,this.uncork()),o.ending||p(this,o,v)};function $(b){return b.ending&&b.length===0&&b.bufferedRequest===null&&!b.finished&&!b.writing}function n(b,_){b._final(function(v){_.pendingcb--,v&&b.emit("error",v),_.prefinished=!0,b.emit("prefinish"),c(b,_)})}function l(b,_){!_.prefinished&&!_.finalCalled&&(typeof b._final=="function"?(_.pendingcb++,_.finalCalled=!0,e.nextTick(n,b,_)):(_.prefinished=!0,b.emit("prefinish")))}function c(b,_){var v=$(_);return v&&(l(b,_),_.pendingcb===0&&(_.finished=!0,b.emit("finish"))),v}function p(b,_,v){_.ending=!0,c(b,_),v&&(_.finished?e.nextTick(v):b.once("finish",v)),_.ended=!0,b.writable=!1}function y(b,_,v){var o=b.entry;for(b.entry=null;o;){var m=o.callback;_.pendingcb--,m(v),o=o.next}_.corkedRequestsFree.next=b}return Object.defineProperty(O.prototype,"destroyed",{get:function(){return this._writableState===void 0?!1:this._writableState.destroyed},set:function(b){this._writableState&&(this._writableState.destroyed=b)}}),O.prototype.destroy=S.destroy,O.prototype._undestroy=S.undestroy,O.prototype._destroy=function(b,_){this.end(),_(b)},_stream_writable$1}var _stream_duplex$1,hasRequired_stream_duplex$1;function require_stream_duplex$1(){if(hasRequired_stream_duplex$1)return _stream_duplex$1;hasRequired_stream_duplex$1=1;var e=processNextickArgsExports,t=Object.keys||function(S){var k=[];for(var C in S)k.push(C);return k};_stream_duplex$1=M;var a=Object.create(util$4);a.inherits=inherits_browserExports;var u=require_stream_readable$1(),d=require_stream_writable$1();a.inherits(M,u);for(var h=t(d.prototype),w=0;w<h.length;w++){var x=h[w];M.prototype[x]||(M.prototype[x]=d.prototype[x])}function M(S){if(!(this instanceof M))return new M(S);u.call(this,S),d.call(this,S),S&&S.readable===!1&&(this.readable=!1),S&&S.writable===!1&&(this.writable=!1),this.allowHalfOpen=!0,S&&S.allowHalfOpen===!1&&(this.allowHalfOpen=!1),this.once("end",B)}Object.defineProperty(M.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function B(){this.allowHalfOpen||this._writableState.ended||e.nextTick(E,this)}function E(S){S.end()}return Object.defineProperty(M.prototype,"destroyed",{get:function(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set:function(S){this._readableState===void 0||this._writableState===void 0||(this._readableState.destroyed=S,this._writableState.destroyed=S)}}),M.prototype._destroy=function(S,k){this.push(null),this.end(),e.nextTick(k,S)},_stream_duplex$1}var string_decoder$1={},safeBuffer$3={exports:{}},hasRequiredSafeBuffer$1;function requireSafeBuffer$1(){return hasRequiredSafeBuffer$1||(hasRequiredSafeBuffer$1=1,function(e,t){var a=dist,u=a.Buffer;function d(w,x){for(var M in w)x[M]=w[M]}u.from&&u.alloc&&u.allocUnsafe&&u.allocUnsafeSlow?e.exports=a:(d(a,t),t.Buffer=h);function h(w,x,M){return u(w,x,M)}d(u,h),h.from=function(w,x,M){if(typeof w=="number")throw new TypeError("Argument must not be a number");return u(w,x,M)},h.alloc=function(w,x,M){if(typeof w!="number")throw new TypeError("Argument must be a number");var B=u(w);return x!==void 0?typeof M=="string"?B.fill(x,M):B.fill(x):B.fill(0),B},h.allocUnsafe=function(w){if(typeof w!="number")throw new TypeError("Argument must be a number");return u(w)},h.allocUnsafeSlow=function(w){if(typeof w!="number")throw new TypeError("Argument must be a number");return a.SlowBuffer(w)}}(safeBuffer$3,safeBuffer$3.exports)),safeBuffer$3.exports}var hasRequiredString_decoder$1;function requireString_decoder$1(){if(hasRequiredString_decoder$1)return string_decoder$1;hasRequiredString_decoder$1=1;var e=requireSafeBuffer$1().Buffer,t=e.isEncoding||function(P){switch(P=""+P,P&&P.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function a(P){if(!P)return"utf8";for(var L;;)switch(P){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return P;default:if(L)return;P=(""+P).toLowerCase(),L=!0}}function u(P){var L=a(P);if(typeof L!="string"&&(e.isEncoding===t||!t(P)))throw new Error("Unknown encoding: "+P);return L||P}string_decoder$1.StringDecoder=d;function d(P){this.encoding=u(P);var L;switch(this.encoding){case"utf16le":this.text=S,this.end=k,L=4;break;case"utf8":this.fillLast=M,L=4;break;case"base64":this.text=C,this.end=q,L=3;break;default:this.write=O,this.end=U;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=e.allocUnsafe(L)}d.prototype.write=function(P){if(P.length===0)return"";var L,J;if(this.lastNeed){if(L=this.fillLast(P),L===void 0)return"";J=this.lastNeed,this.lastNeed=0}else J=0;return J<P.length?L?L+this.text(P,J):this.text(P,J):L||""},d.prototype.end=E,d.prototype.text=B,d.prototype.fillLast=function(P){if(this.lastNeed<=P.length)return P.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);P.copy(this.lastChar,this.lastTotal-this.lastNeed,0,P.length),this.lastNeed-=P.length};function h(P){return P<=127?0:P>>5===6?2:P>>4===14?3:P>>3===30?4:P>>6===2?-1:-2}function w(P,L,J){var Y=L.length-1;if(Y<J)return 0;var ae=h(L[Y]);return ae>=0?(ae>0&&(P.lastNeed=ae-1),ae):--Y<J||ae===-2?0:(ae=h(L[Y]),ae>=0?(ae>0&&(P.lastNeed=ae-2),ae):--Y<J||ae===-2?0:(ae=h(L[Y]),ae>=0?(ae>0&&(ae===2?ae=0:P.lastNeed=ae-3),ae):0))}function x(P,L,J){if((L[0]&192)!==128)return P.lastNeed=0,"�";if(P.lastNeed>1&&L.length>1){if((L[1]&192)!==128)return P.lastNeed=1,"�";if(P.lastNeed>2&&L.length>2&&(L[2]&192)!==128)return P.lastNeed=2,"�"}}function M(P){var L=this.lastTotal-this.lastNeed,J=x(this,P);if(J!==void 0)return J;if(this.lastNeed<=P.length)return P.copy(this.lastChar,L,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);P.copy(this.lastChar,L,0,P.length),this.lastNeed-=P.length}function B(P,L){var J=w(this,P,L);if(!this.lastNeed)return P.toString("utf8",L);this.lastTotal=J;var Y=P.length-(J-this.lastNeed);return P.copy(this.lastChar,0,Y),P.toString("utf8",L,Y)}function E(P){var L=P&&P.length?this.write(P):"";return this.lastNeed?L+"�":L}function S(P,L){if((P.length-L)%2===0){var J=P.toString("utf16le",L);if(J){var Y=J.charCodeAt(J.length-1);if(Y>=55296&&Y<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=P[P.length-2],this.lastChar[1]=P[P.length-1],J.slice(0,-1)}return J}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=P[P.length-1],P.toString("utf16le",L,P.length-1)}function k(P){var L=P&&P.length?this.write(P):"";if(this.lastNeed){var J=this.lastTotal-this.lastNeed;return L+this.lastChar.toString("utf16le",0,J)}return L}function C(P,L){var J=(P.length-L)%3;return J===0?P.toString("base64",L):(this.lastNeed=3-J,this.lastTotal=3,J===1?this.lastChar[0]=P[P.length-1]:(this.lastChar[0]=P[P.length-2],this.lastChar[1]=P[P.length-1]),P.toString("base64",L,P.length-J))}function q(P){var L=P&&P.length?this.write(P):"";return this.lastNeed?L+this.lastChar.toString("base64",0,3-this.lastNeed):L}function O(P){return P.toString(this.encoding)}function U(P){return P&&P.length?this.write(P):""}return string_decoder$1}var _stream_readable$1,hasRequired_stream_readable$1;function require_stream_readable$1(){if(hasRequired_stream_readable$1)return _stream_readable$1;hasRequired_stream_readable$1=1;var e=processNextickArgsExports;_stream_readable$1=L;var t=isarray$1,a;L.ReadableState=P,eventsExports.EventEmitter;var u=function(T,D){return T.listeners(D).length},d=streamBrowser$1,h=safeBufferExports$1.Buffer,w=(typeof commonjsGlobal<"u"?commonjsGlobal:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function x(T){return h.from(T)}function M(T){return h.isBuffer(T)||T instanceof w}var B=Object.create(util$4);B.inherits=inherits_browserExports;var E=util$5,S=void 0;E&&E.debuglog?S=E.debuglog("stream"):S=function(){};var k=requireBufferList$1(),C=destroy_1$1,q;B.inherits(L,d);var O=["error","close","destroy","pause","resume"];function U(T,D,Z){if(typeof T.prependListener=="function")return T.prependListener(D,Z);!T._events||!T._events[D]?T.on(D,Z):t(T._events[D])?T._events[D].unshift(Z):T._events[D]=[Z,T._events[D]]}function P(T,D){a=a||require_stream_duplex$1(),T=T||{};var Z=D instanceof a;this.objectMode=!!T.objectMode,Z&&(this.objectMode=this.objectMode||!!T.readableObjectMode);var te=T.highWaterMark,ee=T.readableHighWaterMark,j=this.objectMode?16:16*1024;te||te===0?this.highWaterMark=te:Z&&(ee||ee===0)?this.highWaterMark=ee:this.highWaterMark=j,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new k,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=T.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,T.encoding&&(q||(q=requireString_decoder$1().StringDecoder),this.decoder=new q(T.encoding),this.encoding=T.encoding)}function L(T){if(a=a||require_stream_duplex$1(),!(this instanceof L))return new L(T);this._readableState=new P(T,this),this.readable=!0,T&&(typeof T.read=="function"&&(this._read=T.read),typeof T.destroy=="function"&&(this._destroy=T.destroy)),d.call(this)}Object.defineProperty(L.prototype,"destroyed",{get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(T){this._readableState&&(this._readableState.destroyed=T)}}),L.prototype.destroy=C.destroy,L.prototype._undestroy=C.undestroy,L.prototype._destroy=function(T,D){this.push(null),D(T)},L.prototype.push=function(T,D){var Z=this._readableState,te;return Z.objectMode?te=!0:typeof T=="string"&&(D=D||Z.defaultEncoding,D!==Z.encoding&&(T=h.from(T,D),D=""),te=!0),J(this,T,D,!1,te)},L.prototype.unshift=function(T){return J(this,T,null,!0,!1)};function J(T,D,Z,te,ee){var j=T._readableState;if(D===null)j.reading=!1,ce(T,j);else{var re;ee||(re=ae(j,D)),re?T.emit("error",re):j.objectMode||D&&D.length>0?(typeof D!="string"&&!j.objectMode&&Object.getPrototypeOf(D)!==h.prototype&&(D=x(D)),te?j.endEmitted?T.emit("error",new Error("stream.unshift() after end event")):Y(T,j,D,!0):j.ended?T.emit("error",new Error("stream.push() after EOF")):(j.reading=!1,j.decoder&&!Z?(D=j.decoder.write(D),j.objectMode||D.length!==0?Y(T,j,D,!1):l(T,j)):Y(T,j,D,!1))):te||(j.reading=!1)}return oe(j)}function Y(T,D,Z,te){D.flowing&&D.length===0&&!D.sync?(T.emit("data",Z),T.read(0)):(D.length+=D.objectMode?1:Z.length,te?D.buffer.unshift(Z):D.buffer.push(Z),D.needReadable&&$(T)),l(T,D)}function ae(T,D){var Z;return!M(D)&&typeof D!="string"&&D!==void 0&&!T.objectMode&&(Z=new TypeError("Invalid non-string/buffer chunk")),Z}function oe(T){return!T.ended&&(T.needReadable||T.length<T.highWaterMark||T.length===0)}L.prototype.isPaused=function(){return this._readableState.flowing===!1},L.prototype.setEncoding=function(T){return q||(q=requireString_decoder$1().StringDecoder),this._readableState.decoder=new q(T),this._readableState.encoding=T,this};var ue=8388608;function se(T){return T>=ue?T=ue:(T--,T|=T>>>1,T|=T>>>2,T|=T>>>4,T|=T>>>8,T|=T>>>16,T++),T}function ie(T,D){return T<=0||D.length===0&&D.ended?0:D.objectMode?1:T!==T?D.flowing&&D.length?D.buffer.head.data.length:D.length:(T>D.highWaterMark&&(D.highWaterMark=se(T)),T<=D.length?T:D.ended?D.length:(D.needReadable=!0,0))}L.prototype.read=function(T){S("read",T),T=parseInt(T,10);var D=this._readableState,Z=T;if(T!==0&&(D.emittedReadable=!1),T===0&&D.needReadable&&(D.length>=D.highWaterMark||D.ended))return S("read: emitReadable",D.length,D.ended),D.length===0&&D.ended?F(this):$(this),null;if(T=ie(T,D),T===0&&D.ended)return D.length===0&&F(this),null;var te=D.needReadable;S("need readable",te),(D.length===0||D.length-T<D.highWaterMark)&&(te=!0,S("length less than watermark",te)),D.ended||D.reading?(te=!1,S("reading or ended",te)):te&&(S("do read"),D.reading=!0,D.sync=!0,D.length===0&&(D.needReadable=!0),this._read(D.highWaterMark),D.sync=!1,D.reading||(T=ie(Z,D)));var ee;return T>0?ee=o(T,D):ee=null,ee===null?(D.needReadable=!0,T=0):D.length-=T,D.length===0&&(D.ended||(D.needReadable=!0),Z!==T&&D.ended&&F(this)),ee!==null&&this.emit("data",ee),ee};function ce(T,D){if(!D.ended){if(D.decoder){var Z=D.decoder.end();Z&&Z.length&&(D.buffer.push(Z),D.length+=D.objectMode?1:Z.length)}D.ended=!0,$(T)}}function $(T){var D=T._readableState;D.needReadable=!1,D.emittedReadable||(S("emitReadable",D.flowing),D.emittedReadable=!0,D.sync?e.nextTick(n,T):n(T))}function n(T){S("emit readable"),T.emit("readable"),v(T)}function l(T,D){D.readingMore||(D.readingMore=!0,e.nextTick(c,T,D))}function c(T,D){for(var Z=D.length;!D.reading&&!D.flowing&&!D.ended&&D.length<D.highWaterMark&&(S("maybeReadMore read 0"),T.read(0),Z!==D.length);)Z=D.length;D.readingMore=!1}L.prototype._read=function(T){this.emit("error",new Error("_read() is not implemented"))},L.prototype.pipe=function(T,D){var Z=this,te=this._readableState;switch(te.pipesCount){case 0:te.pipes=T;break;case 1:te.pipes=[te.pipes,T];break;default:te.pipes.push(T);break}te.pipesCount+=1,S("pipe count=%d opts=%j",te.pipesCount,D);var ee=(!D||D.end!==!1)&&T!==process$1.stdout&&T!==process$1.stderr,j=ee?qe:ze;te.endEmitted?e.nextTick(j):Z.once("end",j),T.on("unpipe",re);function re(me,ke){S("onunpipe"),me===Z&&ke&&ke.hasUnpiped===!1&&(ke.hasUnpiped=!0,je())}function qe(){S("onend"),T.end()}var de=p(Z);T.on("drain",de);var pe=!1;function je(){S("cleanup"),T.removeListener("close",_e),T.removeListener("finish",xe),T.removeListener("drain",de),T.removeListener("error",Ve),T.removeListener("unpipe",re),Z.removeListener("end",qe),Z.removeListener("end",ze),Z.removeListener("data",le),pe=!0,te.awaitDrain&&(!T._writableState||T._writableState.needDrain)&&de()}var we=!1;Z.on("data",le);function le(me){S("ondata"),we=!1;var ke=T.write(me);ke===!1&&!we&&((te.pipesCount===1&&te.pipes===T||te.pipesCount>1&&V(te.pipes,T)!==-1)&&!pe&&(S("false write response, pause",te.awaitDrain),te.awaitDrain++,we=!0),Z.pause())}function Ve(me){S("onerror",me),ze(),T.removeListener("error",Ve),u(T,"error")===0&&T.emit("error",me)}U(T,"error",Ve);function _e(){T.removeListener("finish",xe),ze()}T.once("close",_e);function xe(){S("onfinish"),T.removeListener("close",_e),ze()}T.once("finish",xe);function ze(){S("unpipe"),Z.unpipe(T)}return T.emit("pipe",Z),te.flowing||(S("pipe resume"),Z.resume()),T};function p(T){return function(){var D=T._readableState;S("pipeOnDrain",D.awaitDrain),D.awaitDrain&&D.awaitDrain--,D.awaitDrain===0&&u(T,"data")&&(D.flowing=!0,v(T))}}L.prototype.unpipe=function(T){var D=this._readableState,Z={hasUnpiped:!1};if(D.pipesCount===0)return this;if(D.pipesCount===1)return T&&T!==D.pipes?this:(T||(T=D.pipes),D.pipes=null,D.pipesCount=0,D.flowing=!1,T&&T.emit("unpipe",this,Z),this);if(!T){var te=D.pipes,ee=D.pipesCount;D.pipes=null,D.pipesCount=0,D.flowing=!1;for(var j=0;j<ee;j++)te[j].emit("unpipe",this,{hasUnpiped:!1});return this}var re=V(D.pipes,T);return re===-1?this:(D.pipes.splice(re,1),D.pipesCount-=1,D.pipesCount===1&&(D.pipes=D.pipes[0]),T.emit("unpipe",this,Z),this)},L.prototype.on=function(T,D){var Z=d.prototype.on.call(this,T,D);if(T==="data")this._readableState.flowing!==!1&&this.resume();else if(T==="readable"){var te=this._readableState;!te.endEmitted&&!te.readableListening&&(te.readableListening=te.needReadable=!0,te.emittedReadable=!1,te.reading?te.length&&$(this):e.nextTick(y,this))}return Z},L.prototype.addListener=L.prototype.on;function y(T){S("readable nexttick read 0"),T.read(0)}L.prototype.resume=function(){var T=this._readableState;return T.flowing||(S("resume"),T.flowing=!0,b(this,T)),this};function b(T,D){D.resumeScheduled||(D.resumeScheduled=!0,e.nextTick(_,T,D))}function _(T,D){D.reading||(S("resume read 0"),T.read(0)),D.resumeScheduled=!1,D.awaitDrain=0,T.emit("resume"),v(T),D.flowing&&!D.reading&&T.read(0)}L.prototype.pause=function(){return S("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(S("pause"),this._readableState.flowing=!1,this.emit("pause")),this};function v(T){var D=T._readableState;for(S("flow",D.flowing);D.flowing&&T.read()!==null;);}L.prototype.wrap=function(T){var D=this,Z=this._readableState,te=!1;T.on("end",function(){if(S("wrapped end"),Z.decoder&&!Z.ended){var re=Z.decoder.end();re&&re.length&&D.push(re)}D.push(null)}),T.on("data",function(re){if(S("wrapped data"),Z.decoder&&(re=Z.decoder.write(re)),!(Z.objectMode&&re==null)&&!(!Z.objectMode&&(!re||!re.length))){var qe=D.push(re);qe||(te=!0,T.pause())}});for(var ee in T)this[ee]===void 0&&typeof T[ee]=="function"&&(this[ee]=function(re){return function(){return T[re].apply(T,arguments)}}(ee));for(var j=0;j<O.length;j++)T.on(O[j],this.emit.bind(this,O[j]));return this._read=function(re){S("wrapped _read",re),te&&(te=!1,T.resume())},this},Object.defineProperty(L.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),L._fromList=o;function o(T,D){if(D.length===0)return null;var Z;return D.objectMode?Z=D.buffer.shift():!T||T>=D.length?(D.decoder?Z=D.buffer.join(""):D.buffer.length===1?Z=D.buffer.head.data:Z=D.buffer.concat(D.length),D.buffer.clear()):Z=m(T,D.buffer,D.decoder),Z}function m(T,D,Z){var te;return T<D.head.data.length?(te=D.head.data.slice(0,T),D.head.data=D.head.data.slice(T)):T===D.head.data.length?te=D.shift():te=Z?A(T,D):I(T,D),te}function A(T,D){var Z=D.head,te=1,ee=Z.data;for(T-=ee.length;Z=Z.next;){var j=Z.data,re=T>j.length?j.length:T;if(re===j.length?ee+=j:ee+=j.slice(0,T),T-=re,T===0){re===j.length?(++te,Z.next?D.head=Z.next:D.head=D.tail=null):(D.head=Z,Z.data=j.slice(re));break}++te}return D.length-=te,ee}function I(T,D){var Z=h.allocUnsafe(T),te=D.head,ee=1;for(te.data.copy(Z),T-=te.data.length;te=te.next;){var j=te.data,re=T>j.length?j.length:T;if(j.copy(Z,Z.length-T,0,re),T-=re,T===0){re===j.length?(++ee,te.next?D.head=te.next:D.head=D.tail=null):(D.head=te,te.data=j.slice(re));break}++ee}return D.length-=ee,Z}function F(T){var D=T._readableState;if(D.length>0)throw new Error('"endReadable()" called on non-empty stream');D.endEmitted||(D.ended=!0,e.nextTick(X,D,T))}function X(T,D){!T.endEmitted&&T.length===0&&(T.endEmitted=!0,D.readable=!1,D.emit("end"))}function V(T,D){for(var Z=0,te=T.length;Z<te;Z++)if(T[Z]===D)return Z;return-1}return _stream_readable$1}var _stream_transform$1=Transform$9,Duplex$1=require_stream_duplex$1(),util$3=Object.create(util$4);util$3.inherits=inherits_browserExports;util$3.inherits(Transform$9,Duplex$1);function afterTransform$1(e,t){var a=this._transformState;a.transforming=!1;var u=a.writecb;if(!u)return this.emit("error",new Error("write callback called multiple times"));a.writechunk=null,a.writecb=null,t!=null&&this.push(t),u(e);var d=this._readableState;d.reading=!1,(d.needReadable||d.length<d.highWaterMark)&&this._read(d.highWaterMark)}function Transform$9(e){if(!(this instanceof Transform$9))return new Transform$9(e);Duplex$1.call(this,e),this._transformState={afterTransform:afterTransform$1.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&(typeof e.transform=="function"&&(this._transform=e.transform),typeof e.flush=="function"&&(this._flush=e.flush)),this.on("prefinish",prefinish$1)}function prefinish$1(){var e=this;typeof this._flush=="function"?this._flush(function(t,a){done$1(e,t,a)}):done$1(this,null,null)}Transform$9.prototype.push=function(e,t){return this._transformState.needTransform=!1,Duplex$1.prototype.push.call(this,e,t)};Transform$9.prototype._transform=function(e,t,a){throw new Error("_transform() is not implemented")};Transform$9.prototype._write=function(e,t,a){var u=this._transformState;if(u.writecb=a,u.writechunk=e,u.writeencoding=t,!u.transforming){var d=this._readableState;(u.needTransform||d.needReadable||d.length<d.highWaterMark)&&this._read(d.highWaterMark)}};Transform$9.prototype._read=function(e){var t=this._transformState;t.writechunk!==null&&t.writecb&&!t.transforming?(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform)):t.needTransform=!0};Transform$9.prototype._destroy=function(e,t){var a=this;Duplex$1.prototype._destroy.call(this,e,function(u){t(u),a.emit("close")})};function done$1(e,t,a){if(t)return e.emit("error",t);if(a!=null&&e.push(a),e._writableState.length)throw new Error("Calling transform done when ws.length != 0");if(e._transformState.transforming)throw new Error("Calling transform done when still transforming");return e.push(null)}var _stream_passthrough$1=PassThrough$1,Transform$8=_stream_transform$1,util$2=Object.create(util$4);util$2.inherits=inherits_browserExports;util$2.inherits(PassThrough$1,Transform$8);function PassThrough$1(e){if(!(this instanceof PassThrough$1))return new PassThrough$1(e);Transform$8.call(this,e)}PassThrough$1.prototype._transform=function(e,t,a){a(null,e)};(function(e,t){t=e.exports=require_stream_readable$1(),t.Stream=t,t.Readable=t,t.Writable=require_stream_writable$1(),t.Duplex=require_stream_duplex$1(),t.Transform=_stream_transform$1,t.PassThrough=_stream_passthrough$1})(readableBrowser$1,readableBrowser$1.exports);var readableBrowserExports$1=readableBrowser$1.exports,Buffer$y=safeBufferExports$2.Buffer,toBuffer$5=toBuffer_1$1,Transform$7=readableBrowserExports$1.Transform,inherits$o=inherits_browserExports;function HashBase$1(e){Transform$7.call(this),this._block=Buffer$y.allocUnsafe(e),this._blockSize=e,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}inherits$o(HashBase$1,Transform$7);HashBase$1.prototype._transform=function(e,t,a){var u=null;try{this.update(e,t)}catch(d){u=d}a(u)};HashBase$1.prototype._flush=function(e){var t=null;try{this.push(this.digest())}catch(a){t=a}e(t)};HashBase$1.prototype.update=function(e,t){if(this._finalized)throw new Error("Digest already called");for(var a=toBuffer$5(e,t),u=this._block,d=0;this._blockOffset+a.length-d>=this._blockSize;){for(var h=this._blockOffset;h<this._blockSize;)u[h]=a[d],h+=1,d+=1;this._update(),this._blockOffset=0}for(;d<a.length;)u[this._blockOffset]=a[d],this._blockOffset+=1,d+=1;for(var w=0,x=a.length*8;x>0;++w)this._length[w]+=x,x=this._length[w]/4294967296|0,x>0&&(this._length[w]-=4294967296*x);return this};HashBase$1.prototype._update=function(){throw new Error("_update is not implemented")};HashBase$1.prototype.digest=function(e){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var t=this._digest();e!==void 0&&(t=t.toString(e)),this._block.fill(0),this._blockOffset=0;for(var a=0;a<4;++a)this._length[a]=0;return t};HashBase$1.prototype._digest=function(){throw new Error("_digest is not implemented")};var hashBase=HashBase$1,Buffer$x=dist.Buffer,inherits$n=inherits_browserExports,HashBase=hashBase,ARRAY16=new Array(16),zl=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],zr=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],sl=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],sr=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],hl=[0,1518500249,1859775393,2400959708,2840853838],hr=[1352829926,1548603684,1836072691,2053994217,0];function rotl$1(e,t){return e<<t|e>>>32-t}function fn1(e,t,a,u,d,h,w,x){return rotl$1(e+(t^a^u)+h+w|0,x)+d|0}function fn2(e,t,a,u,d,h,w,x){return rotl$1(e+(t&a|~t&u)+h+w|0,x)+d|0}function fn3(e,t,a,u,d,h,w,x){return rotl$1(e+((t|~a)^u)+h+w|0,x)+d|0}function fn4(e,t,a,u,d,h,w,x){return rotl$1(e+(t&u|a&~u)+h+w|0,x)+d|0}function fn5(e,t,a,u,d,h,w,x){return rotl$1(e+(t^(a|~u))+h+w|0,x)+d|0}function RIPEMD160$4(){HashBase.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}inherits$n(RIPEMD160$4,HashBase);RIPEMD160$4.prototype._update=function(){for(var e=ARRAY16,t=0;t<16;++t)e[t]=this._block.readInt32LE(t*4);for(var a=this._a|0,u=this._b|0,d=this._c|0,h=this._d|0,w=this._e|0,x=this._a|0,M=this._b|0,B=this._c|0,E=this._d|0,S=this._e|0,k=0;k<80;k+=1){var C,q;k<16?(C=fn1(a,u,d,h,w,e[zl[k]],hl[0],sl[k]),q=fn5(x,M,B,E,S,e[zr[k]],hr[0],sr[k])):k<32?(C=fn2(a,u,d,h,w,e[zl[k]],hl[1],sl[k]),q=fn4(x,M,B,E,S,e[zr[k]],hr[1],sr[k])):k<48?(C=fn3(a,u,d,h,w,e[zl[k]],hl[2],sl[k]),q=fn3(x,M,B,E,S,e[zr[k]],hr[2],sr[k])):k<64?(C=fn4(a,u,d,h,w,e[zl[k]],hl[3],sl[k]),q=fn2(x,M,B,E,S,e[zr[k]],hr[3],sr[k])):(C=fn5(a,u,d,h,w,e[zl[k]],hl[4],sl[k]),q=fn1(x,M,B,E,S,e[zr[k]],hr[4],sr[k])),a=w,w=h,h=rotl$1(d,10),d=u,u=C,x=S,S=E,E=rotl$1(B,10),B=M,M=q}var O=this._b+d+E|0;this._b=this._c+h+S|0,this._c=this._d+w+x|0,this._d=this._e+a+M|0,this._e=this._a+u+B|0,this._a=O};RIPEMD160$4.prototype._digest=function(){this._block[this._blockOffset]=128,this._blockOffset+=1,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var e=Buffer$x.alloc?Buffer$x.alloc(20):new Buffer$x(20);return e.writeInt32LE(this._a,0),e.writeInt32LE(this._b,4),e.writeInt32LE(this._c,8),e.writeInt32LE(this._d,12),e.writeInt32LE(this._e,16),e};var ripemd160=RIPEMD160$4,sha_js={exports:{}},Buffer$w=safeBufferExports$2.Buffer,toBuffer$4=toBuffer$7;function Hash$8(e,t){this._block=Buffer$w.alloc(e),this._finalSize=t,this._blockSize=e,this._len=0}Hash$8.prototype.update=function(e,t){e=toBuffer$4(e,t||"utf8");for(var a=this._block,u=this._blockSize,d=e.length,h=this._len,w=0;w<d;){for(var x=h%u,M=Math.min(d-w,u-x),B=0;B<M;B++)a[x+B]=e[w+B];h+=M,w+=M,h%u===0&&this._update(a)}return this._len+=d,this};Hash$8.prototype.digest=function(e){var t=this._len%this._blockSize;this._block[t]=128,this._block.fill(0,t+1),t>=this._finalSize&&(this._update(this._block),this._block.fill(0));var a=this._len*8;if(a<=4294967295)this._block.writeUInt32BE(a,this._blockSize-4);else{var u=(a&4294967295)>>>0,d=(a-u)/4294967296;this._block.writeUInt32BE(d,this._blockSize-8),this._block.writeUInt32BE(u,this._blockSize-4)}this._update(this._block);var h=this._hash();return e?h.toString(e):h};Hash$8.prototype._update=function(){throw new Error("_update must be implemented by subclass")};var hash$4=Hash$8,inherits$m=inherits_browserExports,Hash$7=hash$4,Buffer$v=safeBufferExports$2.Buffer,K$4=[1518500249,1859775393,-1894007588,-899497514],W$5=new Array(80);function Sha(){this.init(),this._w=W$5,Hash$7.call(this,64,56)}inherits$m(Sha,Hash$7);Sha.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function rotl5$1(e){return e<<5|e>>>27}function rotl30$1(e){return e<<30|e>>>2}function ft$1(e,t,a,u){return e===0?t&a|~t&u:e===2?t&a|t&u|a&u:t^a^u}Sha.prototype._update=function(e){for(var t=this._w,a=this._a|0,u=this._b|0,d=this._c|0,h=this._d|0,w=this._e|0,x=0;x<16;++x)t[x]=e.readInt32BE(x*4);for(;x<80;++x)t[x]=t[x-3]^t[x-8]^t[x-14]^t[x-16];for(var M=0;M<80;++M){var B=~~(M/20),E=rotl5$1(a)+ft$1(B,u,d,h)+w+t[M]+K$4[B]|0;w=h,h=d,d=rotl30$1(u),u=a,a=E}this._a=a+this._a|0,this._b=u+this._b|0,this._c=d+this._c|0,this._d=h+this._d|0,this._e=w+this._e|0};Sha.prototype._hash=function(){var e=Buffer$v.allocUnsafe(20);return e.writeInt32BE(this._a|0,0),e.writeInt32BE(this._b|0,4),e.writeInt32BE(this._c|0,8),e.writeInt32BE(this._d|0,12),e.writeInt32BE(this._e|0,16),e};var sha$4=Sha,inherits$l=inherits_browserExports,Hash$6=hash$4,Buffer$u=safeBufferExports$2.Buffer,K$3=[1518500249,1859775393,-1894007588,-899497514],W$4=new Array(80);function Sha1(){this.init(),this._w=W$4,Hash$6.call(this,64,56)}inherits$l(Sha1,Hash$6);Sha1.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function rotl1(e){return e<<1|e>>>31}function rotl5(e){return e<<5|e>>>27}function rotl30(e){return e<<30|e>>>2}function ft(e,t,a,u){return e===0?t&a|~t&u:e===2?t&a|t&u|a&u:t^a^u}Sha1.prototype._update=function(e){for(var t=this._w,a=this._a|0,u=this._b|0,d=this._c|0,h=this._d|0,w=this._e|0,x=0;x<16;++x)t[x]=e.readInt32BE(x*4);for(;x<80;++x)t[x]=rotl1(t[x-3]^t[x-8]^t[x-14]^t[x-16]);for(var M=0;M<80;++M){var B=~~(M/20),E=rotl5(a)+ft(B,u,d,h)+w+t[M]+K$3[B]|0;w=h,h=d,d=rotl30(u),u=a,a=E}this._a=a+this._a|0,this._b=u+this._b|0,this._c=d+this._c|0,this._d=h+this._d|0,this._e=w+this._e|0};Sha1.prototype._hash=function(){var e=Buffer$u.allocUnsafe(20);return e.writeInt32BE(this._a|0,0),e.writeInt32BE(this._b|0,4),e.writeInt32BE(this._c|0,8),e.writeInt32BE(this._d|0,12),e.writeInt32BE(this._e|0,16),e};var sha1=Sha1,inherits$k=inherits_browserExports,Hash$5=hash$4,Buffer$t=safeBufferExports$2.Buffer,K$2=[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],W$3=new Array(64);function Sha256$1(){this.init(),this._w=W$3,Hash$5.call(this,64,56)}inherits$k(Sha256$1,Hash$5);Sha256$1.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this};function ch(e,t,a){return a^e&(t^a)}function maj$1(e,t,a){return e&t|a&(e|t)}function sigma0$1(e){return(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10)}function sigma1$1(e){return(e>>>6|e<<26)^(e>>>11|e<<21)^(e>>>25|e<<7)}function gamma0(e){return(e>>>7|e<<25)^(e>>>18|e<<14)^e>>>3}function gamma1(e){return(e>>>17|e<<15)^(e>>>19|e<<13)^e>>>10}Sha256$1.prototype._update=function(e){for(var t=this._w,a=this._a|0,u=this._b|0,d=this._c|0,h=this._d|0,w=this._e|0,x=this._f|0,M=this._g|0,B=this._h|0,E=0;E<16;++E)t[E]=e.readInt32BE(E*4);for(;E<64;++E)t[E]=gamma1(t[E-2])+t[E-7]+gamma0(t[E-15])+t[E-16]|0;for(var S=0;S<64;++S){var k=B+sigma1$1(w)+ch(w,x,M)+K$2[S]+t[S]|0,C=sigma0$1(a)+maj$1(a,u,d)|0;B=M,M=x,x=w,w=h+k|0,h=d,d=u,u=a,a=k+C|0}this._a=a+this._a|0,this._b=u+this._b|0,this._c=d+this._c|0,this._d=h+this._d|0,this._e=w+this._e|0,this._f=x+this._f|0,this._g=M+this._g|0,this._h=B+this._h|0};Sha256$1.prototype._hash=function(){var e=Buffer$t.allocUnsafe(32);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e.writeInt32BE(this._h,28),e};var sha256$2=Sha256$1,inherits$j=inherits_browserExports,Sha256=sha256$2,Hash$4=hash$4,Buffer$s=safeBufferExports$2.Buffer,W$2=new Array(64);function Sha224(){this.init(),this._w=W$2,Hash$4.call(this,64,56)}inherits$j(Sha224,Sha256);Sha224.prototype.init=function(){return this._a=3238371032,this._b=914150663,this._c=812702999,this._d=4144912697,this._e=4290775857,this._f=1750603025,this._g=1694076839,this._h=3204075428,this};Sha224.prototype._hash=function(){var e=Buffer$s.allocUnsafe(28);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e};var sha224$1=Sha224,inherits$i=inherits_browserExports,Hash$3=hash$4,Buffer$r=safeBufferExports$2.Buffer,K$1=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],W$1=new Array(160);function Sha512(){this.init(),this._w=W$1,Hash$3.call(this,128,112)}inherits$i(Sha512,Hash$3);Sha512.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this};function Ch(e,t,a){return a^e&(t^a)}function maj(e,t,a){return e&t|a&(e|t)}function sigma0(e,t){return(e>>>28|t<<4)^(t>>>2|e<<30)^(t>>>7|e<<25)}function sigma1(e,t){return(e>>>14|t<<18)^(e>>>18|t<<14)^(t>>>9|e<<23)}function Gamma0(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^e>>>7}function Gamma0l(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^(e>>>7|t<<25)}function Gamma1(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^e>>>6}function Gamma1l(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^(e>>>6|t<<26)}function getCarry(e,t){return e>>>0<t>>>0?1:0}Sha512.prototype._update=function(e){for(var t=this._w,a=this._ah|0,u=this._bh|0,d=this._ch|0,h=this._dh|0,w=this._eh|0,x=this._fh|0,M=this._gh|0,B=this._hh|0,E=this._al|0,S=this._bl|0,k=this._cl|0,C=this._dl|0,q=this._el|0,O=this._fl|0,U=this._gl|0,P=this._hl|0,L=0;L<32;L+=2)t[L]=e.readInt32BE(L*4),t[L+1]=e.readInt32BE(L*4+4);for(;L<160;L+=2){var J=t[L-30],Y=t[L-15*2+1],ae=Gamma0(J,Y),oe=Gamma0l(Y,J);J=t[L-2*2],Y=t[L-2*2+1];var ue=Gamma1(J,Y),se=Gamma1l(Y,J),ie=t[L-7*2],ce=t[L-7*2+1],$=t[L-16*2],n=t[L-16*2+1],l=oe+ce|0,c=ae+ie+getCarry(l,oe)|0;l=l+se|0,c=c+ue+getCarry(l,se)|0,l=l+n|0,c=c+$+getCarry(l,n)|0,t[L]=c,t[L+1]=l}for(var p=0;p<160;p+=2){c=t[p],l=t[p+1];var y=maj(a,u,d),b=maj(E,S,k),_=sigma0(a,E),v=sigma0(E,a),o=sigma1(w,q),m=sigma1(q,w),A=K$1[p],I=K$1[p+1],F=Ch(w,x,M),X=Ch(q,O,U),V=P+m|0,T=B+o+getCarry(V,P)|0;V=V+X|0,T=T+F+getCarry(V,X)|0,V=V+I|0,T=T+A+getCarry(V,I)|0,V=V+l|0,T=T+c+getCarry(V,l)|0;var D=v+b|0,Z=_+y+getCarry(D,v)|0;B=M,P=U,M=x,U=O,x=w,O=q,q=C+V|0,w=h+T+getCarry(q,C)|0,h=d,C=k,d=u,k=S,u=a,S=E,E=V+D|0,a=T+Z+getCarry(E,V)|0}this._al=this._al+E|0,this._bl=this._bl+S|0,this._cl=this._cl+k|0,this._dl=this._dl+C|0,this._el=this._el+q|0,this._fl=this._fl+O|0,this._gl=this._gl+U|0,this._hl=this._hl+P|0,this._ah=this._ah+a+getCarry(this._al,E)|0,this._bh=this._bh+u+getCarry(this._bl,S)|0,this._ch=this._ch+d+getCarry(this._cl,k)|0,this._dh=this._dh+h+getCarry(this._dl,C)|0,this._eh=this._eh+w+getCarry(this._el,q)|0,this._fh=this._fh+x+getCarry(this._fl,O)|0,this._gh=this._gh+M+getCarry(this._gl,U)|0,this._hh=this._hh+B+getCarry(this._hl,P)|0};Sha512.prototype._hash=function(){var e=Buffer$r.allocUnsafe(64);function t(a,u,d){e.writeInt32BE(a,d),e.writeInt32BE(u,d+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),t(this._gh,this._gl,48),t(this._hh,this._hl,56),e};var sha512$1=Sha512,inherits$h=inherits_browserExports,SHA512$2=sha512$1,Hash$2=hash$4,Buffer$q=safeBufferExports$2.Buffer,W=new Array(160);function Sha384(){this.init(),this._w=W,Hash$2.call(this,128,112)}inherits$h(Sha384,SHA512$2);Sha384.prototype.init=function(){return this._ah=3418070365,this._bh=1654270250,this._ch=2438529370,this._dh=355462360,this._eh=1731405415,this._fh=2394180231,this._gh=3675008525,this._hh=1203062813,this._al=3238371032,this._bl=914150663,this._cl=812702999,this._dl=4144912697,this._el=4290775857,this._fl=1750603025,this._gl=1694076839,this._hl=3204075428,this};Sha384.prototype._hash=function(){var e=Buffer$q.allocUnsafe(48);function t(a,u,d){e.writeInt32BE(a,d),e.writeInt32BE(u,d+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),e};var sha384$1=Sha384;(function(e){e.exports=function(a){var u=a.toLowerCase(),d=e.exports[u];if(!d)throw new Error(u+" is not supported (we accept pull requests)");return new d},e.exports.sha=sha$4,e.exports.sha1=sha1,e.exports.sha224=sha224$1,e.exports.sha256=sha256$2,e.exports.sha384=sha384$1,e.exports.sha512=sha512$1})(sha_js);var sha_jsExports=sha_js.exports,Buffer$p=safeBufferExports$2.Buffer,Transform$6=streamBrowserify.Transform,StringDecoder=string_decoder$2.StringDecoder,inherits$g=inherits_browserExports,toBuffer$3=toBuffer$7;function CipherBase$1(e){Transform$6.call(this),this.hashMode=typeof e=="string",this.hashMode?this[e]=this._finalOrDigest:this.final=this._finalOrDigest,this._final&&(this.__final=this._final,this._final=null),this._decoder=null,this._encoding=null}inherits$g(CipherBase$1,Transform$6);CipherBase$1.prototype.update=function(e,t,a){var u=toBuffer$3(e,t),d=this._update(u);return this.hashMode?this:(a&&(d=this._toString(d,a)),d)};CipherBase$1.prototype.setAutoPadding=function(){};CipherBase$1.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")};CipherBase$1.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")};CipherBase$1.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")};CipherBase$1.prototype._transform=function(e,t,a){var u;try{this.hashMode?this._update(e):this.push(this._update(e))}catch(d){u=d}finally{a(u)}};CipherBase$1.prototype._flush=function(e){var t;try{this.push(this.__final())}catch(a){t=a}e(t)};CipherBase$1.prototype._finalOrDigest=function(e){var t=this.__final()||Buffer$p.alloc(0);return e&&(t=this._toString(t,e,!0)),t};CipherBase$1.prototype._toString=function(e,t,a){if(this._decoder||(this._decoder=new StringDecoder(t),this._encoding=t),this._encoding!==t)throw new Error("can’t switch encodings");var u=this._decoder.write(e);return a&&(u+=this._decoder.end()),u};var cipherBase=CipherBase$1,inherits$f=inherits_browserExports,MD5$2=md5_js,RIPEMD160$3=ripemd160,sha$3=sha_jsExports,Base$5=cipherBase;function Hash$1(e){Base$5.call(this,"digest"),this._hash=e}inherits$f(Hash$1,Base$5);Hash$1.prototype._update=function(e){this._hash.update(e)};Hash$1.prototype._final=function(){return this._hash.digest()};var browser$9=function(t){return t=t.toLowerCase(),t==="md5"?new MD5$2:t==="rmd160"||t==="ripemd160"?new RIPEMD160$3:new Hash$1(sha$3(t))},inherits$e=inherits_browserExports,Buffer$o=safeBufferExports$2.Buffer,Base$4=cipherBase,ZEROS$2=Buffer$o.alloc(128),blocksize=64;function Hmac$3(e,t){Base$4.call(this,"digest"),typeof t=="string"&&(t=Buffer$o.from(t)),this._alg=e,this._key=t,t.length>blocksize?t=e(t):t.length<blocksize&&(t=Buffer$o.concat([t,ZEROS$2],blocksize));for(var a=this._ipad=Buffer$o.allocUnsafe(blocksize),u=this._opad=Buffer$o.allocUnsafe(blocksize),d=0;d<blocksize;d++)a[d]=t[d]^54,u[d]=t[d]^92;this._hash=[a]}inherits$e(Hmac$3,Base$4);Hmac$3.prototype._update=function(e){this._hash.push(e)};Hmac$3.prototype._final=function(){var e=this._alg(Buffer$o.concat(this._hash));return this._alg(Buffer$o.concat([this._opad,e]))};var legacy=Hmac$3,MD5$1=md5_js,md5$2=function(e){return new MD5$1().update(e).digest()},inherits$d=inherits_browserExports,Legacy=legacy,Base$3=cipherBase,Buffer$n=safeBufferExports$2.Buffer,md5$1=md5$2,RIPEMD160$2=ripemd160,sha$2=sha_jsExports,ZEROS$1=Buffer$n.alloc(128);function Hmac$2(e,t){Base$3.call(this,"digest"),typeof t=="string"&&(t=Buffer$n.from(t));var a=e==="sha512"||e==="sha384"?128:64;if(this._alg=e,this._key=t,t.length>a){var u=e==="rmd160"?new RIPEMD160$2:sha$2(e);t=u.update(t).digest()}else t.length<a&&(t=Buffer$n.concat([t,ZEROS$1],a));for(var d=this._ipad=Buffer$n.allocUnsafe(a),h=this._opad=Buffer$n.allocUnsafe(a),w=0;w<a;w++)d[w]=t[w]^54,h[w]=t[w]^92;this._hash=e==="rmd160"?new RIPEMD160$2:sha$2(e),this._hash.update(d)}inherits$d(Hmac$2,Base$3);Hmac$2.prototype._update=function(e){this._hash.update(e)};Hmac$2.prototype._final=function(){var e=this._hash.digest(),t=this._alg==="rmd160"?new RIPEMD160$2:sha$2(this._alg);return t.update(this._opad).update(e).digest()};var browser$8=function(t,a){return t=t.toLowerCase(),t==="rmd160"||t==="ripemd160"?new Hmac$2("rmd160",a):t==="md5"?new Legacy(md5$1,a):new Hmac$2(t,a)};const sha224WithRSAEncryption={sign:"rsa",hash:"sha224",id:"302d300d06096086480165030402040500041c"},sha256WithRSAEncryption={sign:"rsa",hash:"sha256",id:"3031300d060960864801650304020105000420"},sha384WithRSAEncryption={sign:"rsa",hash:"sha384",id:"3041300d060960864801650304020205000430"},sha512WithRSAEncryption={sign:"rsa",hash:"sha512",id:"3051300d060960864801650304020305000440"},sha256$1={sign:"ecdsa",hash:"sha256",id:""},sha224={sign:"ecdsa",hash:"sha224",id:""},sha384={sign:"ecdsa",hash:"sha384",id:""},sha512={sign:"ecdsa",hash:"sha512",id:""},DSA={sign:"dsa",hash:"sha1",id:""},ripemd160WithRSA={sign:"rsa",hash:"rmd160",id:"3021300906052b2403020105000414"},md5WithRSAEncryption={sign:"rsa",hash:"md5",id:"3020300c06082a864886f70d020505000410"},require$$6={sha224WithRSAEncryption,"RSA-SHA224":{sign:"ecdsa/rsa",hash:"sha224",id:"302d300d06096086480165030402040500041c"},sha256WithRSAEncryption,"RSA-SHA256":{sign:"ecdsa/rsa",hash:"sha256",id:"3031300d060960864801650304020105000420"},sha384WithRSAEncryption,"RSA-SHA384":{sign:"ecdsa/rsa",hash:"sha384",id:"3041300d060960864801650304020205000430"},sha512WithRSAEncryption,"RSA-SHA512":{sign:"ecdsa/rsa",hash:"sha512",id:"3051300d060960864801650304020305000440"},"RSA-SHA1":{sign:"rsa",hash:"sha1",id:"3021300906052b0e03021a05000414"},"ecdsa-with-SHA1":{sign:"ecdsa",hash:"sha1",id:""},sha256:sha256$1,sha224,sha384,sha512,"DSA-SHA":{sign:"dsa",hash:"sha1",id:""},"DSA-SHA1":{sign:"dsa",hash:"sha1",id:""},DSA,"DSA-WITH-SHA224":{sign:"dsa",hash:"sha224",id:""},"DSA-SHA224":{sign:"dsa",hash:"sha224",id:""},"DSA-WITH-SHA256":{sign:"dsa",hash:"sha256",id:""},"DSA-SHA256":{sign:"dsa",hash:"sha256",id:""},"DSA-WITH-SHA384":{sign:"dsa",hash:"sha384",id:""},"DSA-SHA384":{sign:"dsa",hash:"sha384",id:""},"DSA-WITH-SHA512":{sign:"dsa",hash:"sha512",id:""},"DSA-SHA512":{sign:"dsa",hash:"sha512",id:""},"DSA-RIPEMD160":{sign:"dsa",hash:"rmd160",id:""},ripemd160WithRSA,"RSA-RIPEMD160":{sign:"rsa",hash:"rmd160",id:"3021300906052b2403020105000414"},md5WithRSAEncryption,"RSA-MD5":{sign:"rsa",hash:"md5",id:"3020300c06082a864886f70d020505000410"}};var algos=require$$6,browser$7={},$isFinite=isFinite,MAX_ALLOC=Math.pow(2,30)-1,precondition=function(e,t){if(typeof e!="number")throw new TypeError("Iterations not a number");if(e<0||!$isFinite(e))throw new TypeError("Bad iterations");if(typeof t!="number")throw new TypeError("Key length not a number");if(t<0||t>MAX_ALLOC||t!==t)throw new TypeError("Bad key length")},defaultEncoding$2;if(commonjsGlobal.process&&commonjsGlobal.process.browser)defaultEncoding$2="utf-8";else if(commonjsGlobal.process&&commonjsGlobal.process.version){var pVersionMajor=parseInt(process$1.version.split(".")[0].slice(1),10);defaultEncoding$2=pVersionMajor>=6?"utf-8":"binary"}else defaultEncoding$2="utf-8";var defaultEncoding_1=defaultEncoding$2,Buffer$m=safeBufferExports$2.Buffer,toBuffer$2=toBuffer$7,useUint8Array=typeof Uint8Array<"u",useArrayBuffer=useUint8Array&&typeof ArrayBuffer<"u",isView=useArrayBuffer&&ArrayBuffer.isView,toBuffer_1=function(e,t,a){if(typeof e=="string"||Buffer$m.isBuffer(e)||useUint8Array&&e instanceof Uint8Array||isView&&isView(e))return toBuffer$2(e,t);throw new TypeError(a+" must be a string, a Buffer, a Uint8Array, or a DataView")},md5=md5$2,RIPEMD160$1=ripemd160,sha$1=sha_jsExports,Buffer$l=safeBufferExports$2.Buffer,checkParameters$1=precondition,defaultEncoding$1=defaultEncoding_1,toBuffer$1=toBuffer_1,ZEROS=Buffer$l.alloc(128),sizes={__proto__:null,md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,"sha512-256":32,ripemd160:20,rmd160:20},mapping={__proto__:null,"sha-1":"sha1","sha-224":"sha224","sha-256":"sha256","sha-384":"sha384","sha-512":"sha512","ripemd-160":"ripemd160"};function rmd160Func(e){return new RIPEMD160$1().update(e).digest()}function getDigest(e){function t(a){return sha$1(e).update(a).digest()}return e==="rmd160"||e==="ripemd160"?rmd160Func:e==="md5"?md5:t}function Hmac$1(e,t,a){var u=getDigest(e),d=e==="sha512"||e==="sha384"?128:64;t.length>d?t=u(t):t.length<d&&(t=Buffer$l.concat([t,ZEROS],d));for(var h=Buffer$l.allocUnsafe(d+sizes[e]),w=Buffer$l.allocUnsafe(d+sizes[e]),x=0;x<d;x++)h[x]=t[x]^54,w[x]=t[x]^92;var M=Buffer$l.allocUnsafe(d+a+4);h.copy(M,0,0,d),this.ipad1=M,this.ipad2=h,this.opad=w,this.alg=e,this.blocksize=d,this.hash=u,this.size=sizes[e]}Hmac$1.prototype.run=function(e,t){e.copy(t,this.blocksize);var a=this.hash(t);return a.copy(this.opad,this.blocksize),this.hash(this.opad)};function pbkdf2(e,t,a,u,d){checkParameters$1(a,u),e=toBuffer$1(e,defaultEncoding$1,"Password"),t=toBuffer$1(t,defaultEncoding$1,"Salt");var h=(d||"sha1").toLowerCase(),w=mapping[h]||h,x=sizes[w];if(typeof x!="number"||!x)throw new TypeError("Digest algorithm not supported: "+d);var M=new Hmac$1(w,e,t.length),B=Buffer$l.allocUnsafe(u),E=Buffer$l.allocUnsafe(t.length+4);t.copy(E,0,0,t.length);for(var S=0,k=x,C=Math.ceil(u/k),q=1;q<=C;q++){E.writeUInt32BE(q,t.length);for(var O=M.run(E,M.ipad1),U=O,P=1;P<a;P++){U=M.run(U,M.ipad2);for(var L=0;L<k;L++)O[L]^=U[L]}O.copy(B,S),S+=k}return B}var syncBrowser=pbkdf2,Buffer$k=safeBufferExports$2.Buffer,checkParameters=precondition,defaultEncoding=defaultEncoding_1,sync=syncBrowser,toBuffer=toBuffer_1,ZERO_BUF,subtle=commonjsGlobal.crypto&&commonjsGlobal.crypto.subtle,toBrowser={sha:"SHA-1","sha-1":"SHA-1",sha1:"SHA-1",sha256:"SHA-256","sha-256":"SHA-256",sha384:"SHA-384","sha-384":"SHA-384","sha-512":"SHA-512",sha512:"SHA-512"},checks=[],nextTick;function getNextTick(){return nextTick||(commonjsGlobal.process&&commonjsGlobal.process.nextTick?nextTick=commonjsGlobal.process.nextTick:commonjsGlobal.queueMicrotask?nextTick=commonjsGlobal.queueMicrotask:commonjsGlobal.setImmediate?nextTick=commonjsGlobal.setImmediate:nextTick=commonjsGlobal.setTimeout,nextTick)}function browserPbkdf2(e,t,a,u,d){return subtle.importKey("raw",e,{name:"PBKDF2"},!1,["deriveBits"]).then(function(h){return subtle.deriveBits({name:"PBKDF2",salt:t,iterations:a,hash:{name:d}},h,u<<3)}).then(function(h){return Buffer$k.from(h)})}function checkNative(e){if(commonjsGlobal.process&&!commonjsGlobal.process.browser||!subtle||!subtle.importKey||!subtle.deriveBits)return Promise.resolve(!1);if(checks[e]!==void 0)return checks[e];ZERO_BUF=ZERO_BUF||Buffer$k.alloc(8);var t=browserPbkdf2(ZERO_BUF,ZERO_BUF,10,128,e).then(function(){return!0},function(){return!1});return checks[e]=t,t}function resolvePromise(e,t){e.then(function(a){getNextTick()(function(){t(null,a)})},function(a){getNextTick()(function(){t(a)})})}var async=function(e,t,a,u,d,h){if(typeof d=="function"&&(h=d,d=void 0),checkParameters(a,u),e=toBuffer(e,defaultEncoding,"Password"),t=toBuffer(t,defaultEncoding,"Salt"),typeof h!="function")throw new Error("No callback provided to pbkdf2");d=d||"sha1";var w=toBrowser[d.toLowerCase()];if(!w||typeof commonjsGlobal.Promise!="function"){getNextTick()(function(){var x;try{x=sync(e,t,a,u,d)}catch(M){h(M);return}h(null,x)});return}resolvePromise(checkNative(w).then(function(x){return x?browserPbkdf2(e,t,a,u,w):sync(e,t,a,u,d)}),h)};browser$7.pbkdf2=async;browser$7.pbkdf2Sync=syncBrowser;var browser$6={},des$2={},utils$n={};utils$n.readUInt32BE=function(t,a){var u=t[0+a]<<24|t[1+a]<<16|t[2+a]<<8|t[3+a];return u>>>0};utils$n.writeUInt32BE=function(t,a,u){t[0+u]=a>>>24,t[1+u]=a>>>16&255,t[2+u]=a>>>8&255,t[3+u]=a&255};utils$n.ip=function(t,a,u,d){for(var h=0,w=0,x=6;x>=0;x-=2){for(var M=0;M<=24;M+=8)h<<=1,h|=a>>>M+x&1;for(var M=0;M<=24;M+=8)h<<=1,h|=t>>>M+x&1}for(var x=6;x>=0;x-=2){for(var M=1;M<=25;M+=8)w<<=1,w|=a>>>M+x&1;for(var M=1;M<=25;M+=8)w<<=1,w|=t>>>M+x&1}u[d+0]=h>>>0,u[d+1]=w>>>0};utils$n.rip=function(t,a,u,d){for(var h=0,w=0,x=0;x<4;x++)for(var M=24;M>=0;M-=8)h<<=1,h|=a>>>M+x&1,h<<=1,h|=t>>>M+x&1;for(var x=4;x<8;x++)for(var M=24;M>=0;M-=8)w<<=1,w|=a>>>M+x&1,w<<=1,w|=t>>>M+x&1;u[d+0]=h>>>0,u[d+1]=w>>>0};utils$n.pc1=function(t,a,u,d){for(var h=0,w=0,x=7;x>=5;x--){for(var M=0;M<=24;M+=8)h<<=1,h|=a>>M+x&1;for(var M=0;M<=24;M+=8)h<<=1,h|=t>>M+x&1}for(var M=0;M<=24;M+=8)h<<=1,h|=a>>M+x&1;for(var x=1;x<=3;x++){for(var M=0;M<=24;M+=8)w<<=1,w|=a>>M+x&1;for(var M=0;M<=24;M+=8)w<<=1,w|=t>>M+x&1}for(var M=0;M<=24;M+=8)w<<=1,w|=t>>M+x&1;u[d+0]=h>>>0,u[d+1]=w>>>0};utils$n.r28shl=function(t,a){return t<<a&268435455|t>>>28-a};var pc2table=[14,11,17,4,27,23,25,0,13,22,7,18,5,9,16,24,2,20,12,21,1,8,15,26,15,4,25,19,9,1,26,16,5,11,23,8,12,7,17,0,22,3,10,14,6,20,27,24];utils$n.pc2=function(t,a,u,d){for(var h=0,w=0,x=pc2table.length>>>1,M=0;M<x;M++)h<<=1,h|=t>>>pc2table[M]&1;for(var M=x;M<pc2table.length;M++)w<<=1,w|=a>>>pc2table[M]&1;u[d+0]=h>>>0,u[d+1]=w>>>0};utils$n.expand=function(t,a,u){var d=0,h=0;d=(t&1)<<5|t>>>27;for(var w=23;w>=15;w-=4)d<<=6,d|=t>>>w&63;for(var w=11;w>=3;w-=4)h|=t>>>w&63,h<<=6;h|=(t&31)<<1|t>>>31,a[u+0]=d>>>0,a[u+1]=h>>>0};var sTable=[14,0,4,15,13,7,1,4,2,14,15,2,11,13,8,1,3,10,10,6,6,12,12,11,5,9,9,5,0,3,7,8,4,15,1,12,14,8,8,2,13,4,6,9,2,1,11,7,15,5,12,11,9,3,7,14,3,10,10,0,5,6,0,13,15,3,1,13,8,4,14,7,6,15,11,2,3,8,4,14,9,12,7,0,2,1,13,10,12,6,0,9,5,11,10,5,0,13,14,8,7,10,11,1,10,3,4,15,13,4,1,2,5,11,8,6,12,7,6,12,9,0,3,5,2,14,15,9,10,13,0,7,9,0,14,9,6,3,3,4,15,6,5,10,1,2,13,8,12,5,7,14,11,12,4,11,2,15,8,1,13,1,6,10,4,13,9,0,8,6,15,9,3,8,0,7,11,4,1,15,2,14,12,3,5,11,10,5,14,2,7,12,7,13,13,8,14,11,3,5,0,6,6,15,9,0,10,3,1,4,2,7,8,2,5,12,11,1,12,10,4,14,15,9,10,3,6,15,9,0,0,6,12,10,11,1,7,13,13,8,15,9,1,4,3,5,14,11,5,12,2,7,8,2,4,14,2,14,12,11,4,2,1,12,7,4,10,7,11,13,6,1,8,5,5,0,3,15,15,10,13,3,0,9,14,8,9,6,4,11,2,8,1,12,11,7,10,1,13,14,7,2,8,13,15,6,9,15,12,0,5,9,6,10,3,4,0,5,14,3,12,10,1,15,10,4,15,2,9,7,2,12,6,9,8,5,0,6,13,1,3,13,4,14,14,0,7,11,5,3,11,8,9,4,14,3,15,2,5,12,2,9,8,5,12,15,3,10,7,11,0,14,4,1,10,7,1,6,13,0,11,8,6,13,4,13,11,0,2,11,14,7,15,4,0,9,8,1,13,10,3,14,12,3,9,5,7,12,5,2,10,15,6,8,1,6,1,6,4,11,11,13,13,8,12,1,3,4,7,10,14,7,10,9,15,5,6,0,8,15,0,14,5,2,9,3,2,12,13,1,2,15,8,13,4,8,6,10,15,3,11,7,1,4,10,12,9,5,3,6,14,11,5,0,0,14,12,9,7,2,7,2,11,1,4,14,1,7,9,4,12,10,14,8,2,13,0,15,6,12,10,9,13,0,15,3,3,5,5,6,8,11];utils$n.substitute=function(t,a){for(var u=0,d=0;d<4;d++){var h=t>>>18-d*6&63,w=sTable[d*64+h];u<<=4,u|=w}for(var d=0;d<4;d++){var h=a>>>18-d*6&63,w=sTable[4*64+d*64+h];u<<=4,u|=w}return u>>>0};var permuteTable=[16,25,12,11,3,20,4,15,31,17,9,6,27,14,1,22,30,24,8,18,0,5,29,23,13,19,2,26,10,21,28,7];utils$n.permute=function(t){for(var a=0,u=0;u<permuteTable.length;u++)a<<=1,a|=t>>>permuteTable[u]&1;return a>>>0};utils$n.padSplit=function(t,a,u){for(var d=t.toString(2);d.length<a;)d="0"+d;for(var h=[],w=0;w<a;w+=u)h.push(d.slice(w,w+u));return h.join(" ")};var minimalisticAssert=assert$j;function assert$j(e,t){if(!e)throw new Error(t||"Assertion failed")}assert$j.equal=function(t,a,u){if(t!=a)throw new Error(u||"Assertion failed: "+t+" != "+a)};var assert$i=minimalisticAssert;function Cipher$3(e){this.options=e,this.type=this.options.type,this.blockSize=8,this._init(),this.buffer=new Array(this.blockSize),this.bufferOff=0,this.padding=e.padding!==!1}var cipher=Cipher$3;Cipher$3.prototype._init=function(){};Cipher$3.prototype.update=function(t){return t.length===0?[]:this.type==="decrypt"?this._updateDecrypt(t):this._updateEncrypt(t)};Cipher$3.prototype._buffer=function(t,a){for(var u=Math.min(this.buffer.length-this.bufferOff,t.length-a),d=0;d<u;d++)this.buffer[this.bufferOff+d]=t[a+d];return this.bufferOff+=u,u};Cipher$3.prototype._flushBuffer=function(t,a){return this._update(this.buffer,0,t,a),this.bufferOff=0,this.blockSize};Cipher$3.prototype._updateEncrypt=function(t){var a=0,u=0,d=(this.bufferOff+t.length)/this.blockSize|0,h=new Array(d*this.blockSize);this.bufferOff!==0&&(a+=this._buffer(t,a),this.bufferOff===this.buffer.length&&(u+=this._flushBuffer(h,u)));for(var w=t.length-(t.length-a)%this.blockSize;a<w;a+=this.blockSize)this._update(t,a,h,u),u+=this.blockSize;for(;a<t.length;a++,this.bufferOff++)this.buffer[this.bufferOff]=t[a];return h};Cipher$3.prototype._updateDecrypt=function(t){for(var a=0,u=0,d=Math.ceil((this.bufferOff+t.length)/this.blockSize)-1,h=new Array(d*this.blockSize);d>0;d--)a+=this._buffer(t,a),u+=this._flushBuffer(h,u);return a+=this._buffer(t,a),h};Cipher$3.prototype.final=function(t){var a;t&&(a=this.update(t));var u;return this.type==="encrypt"?u=this._finalEncrypt():u=this._finalDecrypt(),a?a.concat(u):u};Cipher$3.prototype._pad=function(t,a){if(a===0)return!1;for(;a<t.length;)t[a++]=0;return!0};Cipher$3.prototype._finalEncrypt=function(){if(!this._pad(this.buffer,this.bufferOff))return[];var t=new Array(this.blockSize);return this._update(this.buffer,0,t,0),t};Cipher$3.prototype._unpad=function(t){return t};Cipher$3.prototype._finalDecrypt=function(){assert$i.equal(this.bufferOff,this.blockSize,"Not enough data to decrypt");var t=new Array(this.blockSize);return this._flushBuffer(t,0),this._unpad(t)};var assert$h=minimalisticAssert,inherits$c=inherits_browserExports,utils$m=utils$n,Cipher$2=cipher;function DESState(){this.tmp=new Array(2),this.keys=null}function DES$3(e){Cipher$2.call(this,e);var t=new DESState;this._desState=t,this.deriveKeys(t,e.key)}inherits$c(DES$3,Cipher$2);var des$1=DES$3;DES$3.create=function(t){return new DES$3(t)};var shiftTable=[1,1,2,2,2,2,2,2,1,2,2,2,2,2,2,1];DES$3.prototype.deriveKeys=function(t,a){t.keys=new Array(16*2),assert$h.equal(a.length,this.blockSize,"Invalid key length");var u=utils$m.readUInt32BE(a,0),d=utils$m.readUInt32BE(a,4);utils$m.pc1(u,d,t.tmp,0),u=t.tmp[0],d=t.tmp[1];for(var h=0;h<t.keys.length;h+=2){var w=shiftTable[h>>>1];u=utils$m.r28shl(u,w),d=utils$m.r28shl(d,w),utils$m.pc2(u,d,t.keys,h)}};DES$3.prototype._update=function(t,a,u,d){var h=this._desState,w=utils$m.readUInt32BE(t,a),x=utils$m.readUInt32BE(t,a+4);utils$m.ip(w,x,h.tmp,0),w=h.tmp[0],x=h.tmp[1],this.type==="encrypt"?this._encrypt(h,w,x,h.tmp,0):this._decrypt(h,w,x,h.tmp,0),w=h.tmp[0],x=h.tmp[1],utils$m.writeUInt32BE(u,w,d),utils$m.writeUInt32BE(u,x,d+4)};DES$3.prototype._pad=function(t,a){if(this.padding===!1)return!1;for(var u=t.length-a,d=a;d<t.length;d++)t[d]=u;return!0};DES$3.prototype._unpad=function(t){if(this.padding===!1)return t;for(var a=t[t.length-1],u=t.length-a;u<t.length;u++)assert$h.equal(t[u],a);return t.slice(0,t.length-a)};DES$3.prototype._encrypt=function(t,a,u,d,h){for(var w=a,x=u,M=0;M<t.keys.length;M+=2){var B=t.keys[M],E=t.keys[M+1];utils$m.expand(x,t.tmp,0),B^=t.tmp[0],E^=t.tmp[1];var S=utils$m.substitute(B,E),k=utils$m.permute(S),C=x;x=(w^k)>>>0,w=C}utils$m.rip(x,w,d,h)};DES$3.prototype._decrypt=function(t,a,u,d,h){for(var w=u,x=a,M=t.keys.length-2;M>=0;M-=2){var B=t.keys[M],E=t.keys[M+1];utils$m.expand(w,t.tmp,0),B^=t.tmp[0],E^=t.tmp[1];var S=utils$m.substitute(B,E),k=utils$m.permute(S),C=w;w=(x^k)>>>0,x=C}utils$m.rip(w,x,d,h)};var cbc$2={},assert$g=minimalisticAssert,inherits$b=inherits_browserExports,proto={};function CBCState(e){assert$g.equal(e.length,8,"Invalid IV length"),this.iv=new Array(8);for(var t=0;t<this.iv.length;t++)this.iv[t]=e[t]}function instantiate(e){function t(h){e.call(this,h),this._cbcInit()}inherits$b(t,e);for(var a=Object.keys(proto),u=0;u<a.length;u++){var d=a[u];t.prototype[d]=proto[d]}return t.create=function(w){return new t(w)},t}cbc$2.instantiate=instantiate;proto._cbcInit=function(){var t=new CBCState(this.options.iv);this._cbcState=t};proto._update=function(t,a,u,d){var h=this._cbcState,w=this.constructor.super_.prototype,x=h.iv;if(this.type==="encrypt"){for(var M=0;M<this.blockSize;M++)x[M]^=t[a+M];w._update.call(this,x,0,u,d);for(var M=0;M<this.blockSize;M++)x[M]=u[d+M]}else{w._update.call(this,t,a,u,d);for(var M=0;M<this.blockSize;M++)u[d+M]^=x[M];for(var M=0;M<this.blockSize;M++)x[M]=t[a+M]}};var assert$f=minimalisticAssert,inherits$a=inherits_browserExports,Cipher$1=cipher,DES$2=des$1;function EDEState(e,t){assert$f.equal(t.length,24,"Invalid key length");var a=t.slice(0,8),u=t.slice(8,16),d=t.slice(16,24);e==="encrypt"?this.ciphers=[DES$2.create({type:"encrypt",key:a}),DES$2.create({type:"decrypt",key:u}),DES$2.create({type:"encrypt",key:d})]:this.ciphers=[DES$2.create({type:"decrypt",key:d}),DES$2.create({type:"encrypt",key:u}),DES$2.create({type:"decrypt",key:a})]}function EDE(e){Cipher$1.call(this,e);var t=new EDEState(this.type,this.options.key);this._edeState=t}inherits$a(EDE,Cipher$1);var ede=EDE;EDE.create=function(t){return new EDE(t)};EDE.prototype._update=function(t,a,u,d){var h=this._edeState;h.ciphers[0]._update(t,a,u,d),h.ciphers[1]._update(u,d,u,d),h.ciphers[2]._update(u,d,u,d)};EDE.prototype._pad=DES$2.prototype._pad;EDE.prototype._unpad=DES$2.prototype._unpad;des$2.utils=utils$n;des$2.Cipher=cipher;des$2.DES=des$1;des$2.CBC=cbc$2;des$2.EDE=ede;var CipherBase=cipherBase,des=des$2,inherits$9=inherits_browserExports,Buffer$j=safeBufferExports$2.Buffer,modes$3={"des-ede3-cbc":des.CBC.instantiate(des.EDE),"des-ede3":des.EDE,"des-ede-cbc":des.CBC.instantiate(des.EDE),"des-ede":des.EDE,"des-cbc":des.CBC.instantiate(des.DES),"des-ecb":des.DES};modes$3.des=modes$3["des-cbc"];modes$3.des3=modes$3["des-ede3-cbc"];var browserifyDes=DES$1;inherits$9(DES$1,CipherBase);function DES$1(e){CipherBase.call(this);var t=e.mode.toLowerCase(),a=modes$3[t],u;e.decrypt?u="decrypt":u="encrypt";var d=e.key;Buffer$j.isBuffer(d)||(d=Buffer$j.from(d)),(t==="des-ede"||t==="des-ede-cbc")&&(d=Buffer$j.concat([d,d.slice(0,8)]));var h=e.iv;Buffer$j.isBuffer(h)||(h=Buffer$j.from(h)),this._des=a.create({key:d,iv:h,type:u})}DES$1.prototype._update=function(e){return Buffer$j.from(this._des.update(e))};DES$1.prototype._final=function(){return Buffer$j.from(this._des.final())};var browser$5={},encrypter={},ecb={};ecb.encrypt=function(e,t){return e._cipher.encryptBlock(t)};ecb.decrypt=function(e,t){return e._cipher.decryptBlock(t)};var cbc$1={},bufferXor=function(t,a){for(var u=Math.min(t.length,a.length),d=new Buffer$F(u),h=0;h<u;++h)d[h]=t[h]^a[h];return d},xor$7=bufferXor;cbc$1.encrypt=function(e,t){var a=xor$7(t,e._prev);return e._prev=e._cipher.encryptBlock(a),e._prev};cbc$1.decrypt=function(e,t){var a=e._prev;e._prev=t;var u=e._cipher.decryptBlock(t);return xor$7(u,a)};var cfb={},Buffer$i=safeBufferExports$2.Buffer,xor$6=bufferXor;function encryptStart(e,t,a){var u=t.length,d=xor$6(t,e._cache);return e._cache=e._cache.slice(u),e._prev=Buffer$i.concat([e._prev,a?t:d]),d}cfb.encrypt=function(e,t,a){for(var u=Buffer$i.allocUnsafe(0),d;t.length;)if(e._cache.length===0&&(e._cache=e._cipher.encryptBlock(e._prev),e._prev=Buffer$i.allocUnsafe(0)),e._cache.length<=t.length)d=e._cache.length,u=Buffer$i.concat([u,encryptStart(e,t.slice(0,d),a)]),t=t.slice(d);else{u=Buffer$i.concat([u,encryptStart(e,t,a)]);break}return u};var cfb8={},Buffer$h=safeBufferExports$2.Buffer;function encryptByte$1(e,t,a){var u=e._cipher.encryptBlock(e._prev),d=u[0]^t;return e._prev=Buffer$h.concat([e._prev.slice(1),Buffer$h.from([a?t:d])]),d}cfb8.encrypt=function(e,t,a){for(var u=t.length,d=Buffer$h.allocUnsafe(u),h=-1;++h<u;)d[h]=encryptByte$1(e,t[h],a);return d};var cfb1={},Buffer$g=safeBufferExports$2.Buffer;function encryptByte(e,t,a){for(var u,d=-1,h=8,w=0,x,M;++d<h;)u=e._cipher.encryptBlock(e._prev),x=t&1<<7-d?128:0,M=u[0]^x,w+=(M&128)>>d%8,e._prev=shiftIn(e._prev,a?x:M);return w}function shiftIn(e,t){var a=e.length,u=-1,d=Buffer$g.allocUnsafe(e.length);for(e=Buffer$g.concat([e,Buffer$g.from([t])]);++u<a;)d[u]=e[u]<<1|e[u+1]>>7;return d}cfb1.encrypt=function(e,t,a){for(var u=t.length,d=Buffer$g.allocUnsafe(u),h=-1;++h<u;)d[h]=encryptByte(e,t[h],a);return d};var ofb={},xor$5=bufferXor;function getBlock$1(e){return e._prev=e._cipher.encryptBlock(e._prev),e._prev}ofb.encrypt=function(e,t){for(;e._cache.length<t.length;)e._cache=Buffer$F.concat([e._cache,getBlock$1(e)]);var a=e._cache.slice(0,t.length);return e._cache=e._cache.slice(t.length),xor$5(t,a)};var ctr={};function incr32$2(e){for(var t=e.length,a;t--;)if(a=e.readUInt8(t),a===255)e.writeUInt8(0,t);else{a++,e.writeUInt8(a,t);break}}var incr32_1=incr32$2,xor$4=bufferXor,Buffer$f=safeBufferExports$2.Buffer,incr32$1=incr32_1;function getBlock(e){var t=e._cipher.encryptBlockRaw(e._prev);return incr32$1(e._prev),t}var blockSize=16;ctr.encrypt=function(e,t){var a=Math.ceil(t.length/blockSize),u=e._cache.length;e._cache=Buffer$f.concat([e._cache,Buffer$f.allocUnsafe(a*blockSize)]);for(var d=0;d<a;d++){var h=getBlock(e),w=u+d*blockSize;e._cache.writeUInt32BE(h[0],w+0),e._cache.writeUInt32BE(h[1],w+4),e._cache.writeUInt32BE(h[2],w+8),e._cache.writeUInt32BE(h[3],w+12)}var x=e._cache.slice(0,t.length);return e._cache=e._cache.slice(t.length),xor$4(t,x)};const aes128={cipher:"AES",key:128,iv:16,mode:"CBC",type:"block"},aes192={cipher:"AES",key:192,iv:16,mode:"CBC",type:"block"},aes256={cipher:"AES",key:256,iv:16,mode:"CBC",type:"block"},require$$2={"aes-128-ecb":{cipher:"AES",key:128,iv:0,mode:"ECB",type:"block"},"aes-192-ecb":{cipher:"AES",key:192,iv:0,mode:"ECB",type:"block"},"aes-256-ecb":{cipher:"AES",key:256,iv:0,mode:"ECB",type:"block"},"aes-128-cbc":{cipher:"AES",key:128,iv:16,mode:"CBC",type:"block"},"aes-192-cbc":{cipher:"AES",key:192,iv:16,mode:"CBC",type:"block"},"aes-256-cbc":{cipher:"AES",key:256,iv:16,mode:"CBC",type:"block"},aes128,aes192,aes256,"aes-128-cfb":{cipher:"AES",key:128,iv:16,mode:"CFB",type:"stream"},"aes-192-cfb":{cipher:"AES",key:192,iv:16,mode:"CFB",type:"stream"},"aes-256-cfb":{cipher:"AES",key:256,iv:16,mode:"CFB",type:"stream"},"aes-128-cfb8":{cipher:"AES",key:128,iv:16,mode:"CFB8",type:"stream"},"aes-192-cfb8":{cipher:"AES",key:192,iv:16,mode:"CFB8",type:"stream"},"aes-256-cfb8":{cipher:"AES",key:256,iv:16,mode:"CFB8",type:"stream"},"aes-128-cfb1":{cipher:"AES",key:128,iv:16,mode:"CFB1",type:"stream"},"aes-192-cfb1":{cipher:"AES",key:192,iv:16,mode:"CFB1",type:"stream"},"aes-256-cfb1":{cipher:"AES",key:256,iv:16,mode:"CFB1",type:"stream"},"aes-128-ofb":{cipher:"AES",key:128,iv:16,mode:"OFB",type:"stream"},"aes-192-ofb":{cipher:"AES",key:192,iv:16,mode:"OFB",type:"stream"},"aes-256-ofb":{cipher:"AES",key:256,iv:16,mode:"OFB",type:"stream"},"aes-128-ctr":{cipher:"AES",key:128,iv:16,mode:"CTR",type:"stream"},"aes-192-ctr":{cipher:"AES",key:192,iv:16,mode:"CTR",type:"stream"},"aes-256-ctr":{cipher:"AES",key:256,iv:16,mode:"CTR",type:"stream"},"aes-128-gcm":{cipher:"AES",key:128,iv:12,mode:"GCM",type:"auth"},"aes-192-gcm":{cipher:"AES",key:192,iv:12,mode:"GCM",type:"auth"},"aes-256-gcm":{cipher:"AES",key:256,iv:12,mode:"GCM",type:"auth"}};var modeModules={ECB:ecb,CBC:cbc$1,CFB:cfb,CFB8:cfb8,CFB1:cfb1,OFB:ofb,CTR:ctr,GCM:ctr},modes$2=require$$2;for(var key$2 in modes$2)modes$2[key$2].module=modeModules[modes$2[key$2].mode];var modes_1=modes$2,aes$5={},Buffer$e=safeBufferExports$2.Buffer;function asUInt32Array(e){Buffer$e.isBuffer(e)||(e=Buffer$e.from(e));for(var t=e.length/4|0,a=new Array(t),u=0;u<t;u++)a[u]=e.readUInt32BE(u*4);return a}function scrubVec(e){for(var t=0;t<e.length;e++)e[t]=0}function cryptBlock(e,t,a,u,d){for(var h=a[0],w=a[1],x=a[2],M=a[3],B=e[0]^t[0],E=e[1]^t[1],S=e[2]^t[2],k=e[3]^t[3],C,q,O,U,P=4,L=1;L<d;L++)C=h[B>>>24]^w[E>>>16&255]^x[S>>>8&255]^M[k&255]^t[P++],q=h[E>>>24]^w[S>>>16&255]^x[k>>>8&255]^M[B&255]^t[P++],O=h[S>>>24]^w[k>>>16&255]^x[B>>>8&255]^M[E&255]^t[P++],U=h[k>>>24]^w[B>>>16&255]^x[E>>>8&255]^M[S&255]^t[P++],B=C,E=q,S=O,k=U;return C=(u[B>>>24]<<24|u[E>>>16&255]<<16|u[S>>>8&255]<<8|u[k&255])^t[P++],q=(u[E>>>24]<<24|u[S>>>16&255]<<16|u[k>>>8&255]<<8|u[B&255])^t[P++],O=(u[S>>>24]<<24|u[k>>>16&255]<<16|u[B>>>8&255]<<8|u[E&255])^t[P++],U=(u[k>>>24]<<24|u[B>>>16&255]<<16|u[E>>>8&255]<<8|u[S&255])^t[P++],C=C>>>0,q=q>>>0,O=O>>>0,U=U>>>0,[C,q,O,U]}var RCON=[0,1,2,4,8,16,32,64,128,27,54],G=function(){for(var e=new Array(256),t=0;t<256;t++)t<128?e[t]=t<<1:e[t]=t<<1^283;for(var a=[],u=[],d=[[],[],[],[]],h=[[],[],[],[]],w=0,x=0,M=0;M<256;++M){var B=x^x<<1^x<<2^x<<3^x<<4;B=B>>>8^B&255^99,a[w]=B,u[B]=w;var E=e[w],S=e[E],k=e[S],C=e[B]*257^B*16843008;d[0][w]=C<<24|C>>>8,d[1][w]=C<<16|C>>>16,d[2][w]=C<<8|C>>>24,d[3][w]=C,C=k*16843009^S*65537^E*257^w*16843008,h[0][B]=C<<24|C>>>8,h[1][B]=C<<16|C>>>16,h[2][B]=C<<8|C>>>24,h[3][B]=C,w===0?w=x=1:(w=E^e[e[e[k^E]]],x^=e[e[x]])}return{SBOX:a,INV_SBOX:u,SUB_MIX:d,INV_SUB_MIX:h}}();function AES(e){this._key=asUInt32Array(e),this._reset()}AES.blockSize=4*4;AES.keySize=256/8;AES.prototype.blockSize=AES.blockSize;AES.prototype.keySize=AES.keySize;AES.prototype._reset=function(){for(var e=this._key,t=e.length,a=t+6,u=(a+1)*4,d=[],h=0;h<t;h++)d[h]=e[h];for(h=t;h<u;h++){var w=d[h-1];h%t===0?(w=w<<8|w>>>24,w=G.SBOX[w>>>24]<<24|G.SBOX[w>>>16&255]<<16|G.SBOX[w>>>8&255]<<8|G.SBOX[w&255],w^=RCON[h/t|0]<<24):t>6&&h%t===4&&(w=G.SBOX[w>>>24]<<24|G.SBOX[w>>>16&255]<<16|G.SBOX[w>>>8&255]<<8|G.SBOX[w&255]),d[h]=d[h-t]^w}for(var x=[],M=0;M<u;M++){var B=u-M,E=d[B-(M%4?0:4)];M<4||B<=4?x[M]=E:x[M]=G.INV_SUB_MIX[0][G.SBOX[E>>>24]]^G.INV_SUB_MIX[1][G.SBOX[E>>>16&255]]^G.INV_SUB_MIX[2][G.SBOX[E>>>8&255]]^G.INV_SUB_MIX[3][G.SBOX[E&255]]}this._nRounds=a,this._keySchedule=d,this._invKeySchedule=x};AES.prototype.encryptBlockRaw=function(e){return e=asUInt32Array(e),cryptBlock(e,this._keySchedule,G.SUB_MIX,G.SBOX,this._nRounds)};AES.prototype.encryptBlock=function(e){var t=this.encryptBlockRaw(e),a=Buffer$e.allocUnsafe(16);return a.writeUInt32BE(t[0],0),a.writeUInt32BE(t[1],4),a.writeUInt32BE(t[2],8),a.writeUInt32BE(t[3],12),a};AES.prototype.decryptBlock=function(e){e=asUInt32Array(e);var t=e[1];e[1]=e[3],e[3]=t;var a=cryptBlock(e,this._invKeySchedule,G.INV_SUB_MIX,G.INV_SBOX,this._nRounds),u=Buffer$e.allocUnsafe(16);return u.writeUInt32BE(a[0],0),u.writeUInt32BE(a[3],4),u.writeUInt32BE(a[2],8),u.writeUInt32BE(a[1],12),u};AES.prototype.scrub=function(){scrubVec(this._keySchedule),scrubVec(this._invKeySchedule),scrubVec(this._key)};aes$5.AES=AES;var Buffer$d=safeBufferExports$2.Buffer,ZEROES=Buffer$d.alloc(16,0);function toArray$1(e){return[e.readUInt32BE(0),e.readUInt32BE(4),e.readUInt32BE(8),e.readUInt32BE(12)]}function fromArray(e){var t=Buffer$d.allocUnsafe(16);return t.writeUInt32BE(e[0]>>>0,0),t.writeUInt32BE(e[1]>>>0,4),t.writeUInt32BE(e[2]>>>0,8),t.writeUInt32BE(e[3]>>>0,12),t}function GHASH$2(e){this.h=e,this.state=Buffer$d.alloc(16,0),this.cache=Buffer$d.allocUnsafe(0)}GHASH$2.prototype.ghash=function(e){for(var t=-1;++t<e.length;)this.state[t]^=e[t];this._multiply()};GHASH$2.prototype._multiply=function(){for(var e=toArray$1(this.h),t=[0,0,0,0],a,u,d,h=-1;++h<128;){for(u=(this.state[~~(h/8)]&1<<7-h%8)!==0,u&&(t[0]^=e[0],t[1]^=e[1],t[2]^=e[2],t[3]^=e[3]),d=(e[3]&1)!==0,a=3;a>0;a--)e[a]=e[a]>>>1|(e[a-1]&1)<<31;e[0]=e[0]>>>1,d&&(e[0]=e[0]^225<<24)}this.state=fromArray(t)};GHASH$2.prototype.update=function(e){this.cache=Buffer$d.concat([this.cache,e]);for(var t;this.cache.length>=16;)t=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(t)};GHASH$2.prototype.final=function(e,t){return this.cache.length&&this.ghash(Buffer$d.concat([this.cache,ZEROES],16)),this.ghash(fromArray([0,e,0,t])),this.state};var ghash=GHASH$2,aes$4=aes$5,Buffer$c=safeBufferExports$2.Buffer,Transform$5=cipherBase,inherits$8=inherits_browserExports,GHASH$1=ghash,xor$3=bufferXor,incr32=incr32_1;function xorTest(e,t){var a=0;e.length!==t.length&&a++;for(var u=Math.min(e.length,t.length),d=0;d<u;++d)a+=e[d]^t[d];return a}function calcIv(e,t,a){if(t.length===12)return e._finID=Buffer$c.concat([t,Buffer$c.from([0,0,0,1])]),Buffer$c.concat([t,Buffer$c.from([0,0,0,2])]);var u=new GHASH$1(a),d=t.length,h=d%16;u.update(t),h&&(h=16-h,u.update(Buffer$c.alloc(h,0))),u.update(Buffer$c.alloc(8,0));var w=d*8,x=Buffer$c.alloc(8);x.writeUIntBE(w,0,8),u.update(x),e._finID=u.state;var M=Buffer$c.from(e._finID);return incr32(M),M}function StreamCipher$3(e,t,a,u){Transform$5.call(this);var d=Buffer$c.alloc(4,0);this._cipher=new aes$4.AES(t);var h=this._cipher.encryptBlock(d);this._ghash=new GHASH$1(h),a=calcIv(this,a,h),this._prev=Buffer$c.from(a),this._cache=Buffer$c.allocUnsafe(0),this._secCache=Buffer$c.allocUnsafe(0),this._decrypt=u,this._alen=0,this._len=0,this._mode=e,this._authTag=null,this._called=!1}inherits$8(StreamCipher$3,Transform$5);StreamCipher$3.prototype._update=function(e){if(!this._called&&this._alen){var t=16-this._alen%16;t<16&&(t=Buffer$c.alloc(t,0),this._ghash.update(t))}this._called=!0;var a=this._mode.encrypt(this,e);return this._decrypt?this._ghash.update(e):this._ghash.update(a),this._len+=e.length,a};StreamCipher$3.prototype._final=function(){if(this._decrypt&&!this._authTag)throw new Error("Unsupported state or unable to authenticate data");var e=xor$3(this._ghash.final(this._alen*8,this._len*8),this._cipher.encryptBlock(this._finID));if(this._decrypt&&xorTest(e,this._authTag))throw new Error("Unsupported state or unable to authenticate data");this._authTag=e,this._cipher.scrub()};StreamCipher$3.prototype.getAuthTag=function(){if(this._decrypt||!Buffer$c.isBuffer(this._authTag))throw new Error("Attempting to get auth tag in unsupported state");return this._authTag};StreamCipher$3.prototype.setAuthTag=function(t){if(!this._decrypt)throw new Error("Attempting to set auth tag in unsupported state");this._authTag=t};StreamCipher$3.prototype.setAAD=function(t){if(this._called)throw new Error("Attempting to set AAD in unsupported state");this._ghash.update(t),this._alen+=t.length};var authCipher=StreamCipher$3,aes$3=aes$5,Buffer$b=safeBufferExports$2.Buffer,Transform$4=cipherBase,inherits$7=inherits_browserExports;function StreamCipher$2(e,t,a,u){Transform$4.call(this),this._cipher=new aes$3.AES(t),this._prev=Buffer$b.from(a),this._cache=Buffer$b.allocUnsafe(0),this._secCache=Buffer$b.allocUnsafe(0),this._decrypt=u,this._mode=e}inherits$7(StreamCipher$2,Transform$4);StreamCipher$2.prototype._update=function(e){return this._mode.encrypt(this,e,this._decrypt)};StreamCipher$2.prototype._final=function(){this._cipher.scrub()};var streamCipher=StreamCipher$2,Buffer$a=safeBufferExports$2.Buffer,MD5=md5_js;function EVP_BytesToKey(e,t,a,u){if(Buffer$a.isBuffer(e)||(e=Buffer$a.from(e,"binary")),t&&(Buffer$a.isBuffer(t)||(t=Buffer$a.from(t,"binary")),t.length!==8))throw new RangeError("salt should be Buffer with 8 byte length");for(var d=a/8,h=Buffer$a.alloc(d),w=Buffer$a.alloc(u||0),x=Buffer$a.alloc(0);d>0||u>0;){var M=new MD5;M.update(x),M.update(e),t&&M.update(t),x=M.digest();var B=0;if(d>0){var E=h.length-d;B=Math.min(d,x.length),x.copy(h,E,0,B),d-=B}if(B<x.length&&u>0){var S=w.length-u,k=Math.min(u,x.length-B);x.copy(w,S,B,B+k),u-=k}}return x.fill(0),{key:h,iv:w}}var evp_bytestokey=EVP_BytesToKey,MODES$1=modes_1,AuthCipher$1=authCipher,Buffer$9=safeBufferExports$2.Buffer,StreamCipher$1=streamCipher,Transform$3=cipherBase,aes$2=aes$5,ebtk$2=evp_bytestokey,inherits$6=inherits_browserExports;function Cipher(e,t,a){Transform$3.call(this),this._cache=new Splitter$1,this._cipher=new aes$2.AES(t),this._prev=Buffer$9.from(a),this._mode=e,this._autopadding=!0}inherits$6(Cipher,Transform$3);Cipher.prototype._update=function(e){this._cache.add(e);for(var t,a,u=[];t=this._cache.get();)a=this._mode.encrypt(this,t),u.push(a);return Buffer$9.concat(u)};var PADDING=Buffer$9.alloc(16,16);Cipher.prototype._final=function(){var e=this._cache.flush();if(this._autopadding)return e=this._mode.encrypt(this,e),this._cipher.scrub(),e;if(!e.equals(PADDING))throw this._cipher.scrub(),new Error("data not multiple of block length")};Cipher.prototype.setAutoPadding=function(e){return this._autopadding=!!e,this};function Splitter$1(){this.cache=Buffer$9.allocUnsafe(0)}Splitter$1.prototype.add=function(e){this.cache=Buffer$9.concat([this.cache,e])};Splitter$1.prototype.get=function(){if(this.cache.length>15){var e=this.cache.slice(0,16);return this.cache=this.cache.slice(16),e}return null};Splitter$1.prototype.flush=function(){for(var e=16-this.cache.length,t=Buffer$9.allocUnsafe(e),a=-1;++a<e;)t.writeUInt8(e,a);return Buffer$9.concat([this.cache,t])};function createCipheriv$1(e,t,a){var u=MODES$1[e.toLowerCase()];if(!u)throw new TypeError("invalid suite type");if(typeof t=="string"&&(t=Buffer$9.from(t)),t.length!==u.key/8)throw new TypeError("invalid key length "+t.length);if(typeof a=="string"&&(a=Buffer$9.from(a)),u.mode!=="GCM"&&a.length!==u.iv)throw new TypeError("invalid iv length "+a.length);return u.type==="stream"?new StreamCipher$1(u.module,t,a):u.type==="auth"?new AuthCipher$1(u.module,t,a):new Cipher(u.module,t,a)}function createCipher$2(e,t){var a=MODES$1[e.toLowerCase()];if(!a)throw new TypeError("invalid suite type");var u=ebtk$2(t,!1,a.key,a.iv);return createCipheriv$1(e,u.key,u.iv)}encrypter.createCipheriv=createCipheriv$1;encrypter.createCipher=createCipher$2;var decrypter={},AuthCipher=authCipher,Buffer$8=safeBufferExports$2.Buffer,MODES=modes_1,StreamCipher=streamCipher,Transform$2=cipherBase,aes$1=aes$5,ebtk$1=evp_bytestokey,inherits$5=inherits_browserExports;function Decipher(e,t,a){Transform$2.call(this),this._cache=new Splitter,this._last=void 0,this._cipher=new aes$1.AES(t),this._prev=Buffer$8.from(a),this._mode=e,this._autopadding=!0}inherits$5(Decipher,Transform$2);Decipher.prototype._update=function(e){this._cache.add(e);for(var t,a,u=[];t=this._cache.get(this._autopadding);)a=this._mode.decrypt(this,t),u.push(a);return Buffer$8.concat(u)};Decipher.prototype._final=function(){var e=this._cache.flush();if(this._autopadding)return unpad$1(this._mode.decrypt(this,e));if(e)throw new Error("data not multiple of block length")};Decipher.prototype.setAutoPadding=function(e){return this._autopadding=!!e,this};function Splitter(){this.cache=Buffer$8.allocUnsafe(0)}Splitter.prototype.add=function(e){this.cache=Buffer$8.concat([this.cache,e])};Splitter.prototype.get=function(e){var t;if(e){if(this.cache.length>16)return t=this.cache.slice(0,16),this.cache=this.cache.slice(16),t}else if(this.cache.length>=16)return t=this.cache.slice(0,16),this.cache=this.cache.slice(16),t;return null};Splitter.prototype.flush=function(){if(this.cache.length)return this.cache};function unpad$1(e){var t=e[15];if(t<1||t>16)throw new Error("unable to decrypt data");for(var a=-1;++a<t;)if(e[a+(16-t)]!==t)throw new Error("unable to decrypt data");if(t!==16)return e.slice(0,16-t)}function createDecipheriv$1(e,t,a){var u=MODES[e.toLowerCase()];if(!u)throw new TypeError("invalid suite type");if(typeof a=="string"&&(a=Buffer$8.from(a)),u.mode!=="GCM"&&a.length!==u.iv)throw new TypeError("invalid iv length "+a.length);if(typeof t=="string"&&(t=Buffer$8.from(t)),t.length!==u.key/8)throw new TypeError("invalid key length "+t.length);return u.type==="stream"?new StreamCipher(u.module,t,a,!0):u.type==="auth"?new AuthCipher(u.module,t,a,!0):new Decipher(u.module,t,a)}function createDecipher$1(e,t){var a=MODES[e.toLowerCase()];if(!a)throw new TypeError("invalid suite type");var u=ebtk$1(t,!1,a.key,a.iv);return createDecipheriv$1(e,u.key,u.iv)}decrypter.createDecipher=createDecipher$1;decrypter.createDecipheriv=createDecipheriv$1;var ciphers$2=encrypter,deciphers=decrypter,modes$1=require$$2;function getCiphers$1(){return Object.keys(modes$1)}browser$5.createCipher=browser$5.Cipher=ciphers$2.createCipher;browser$5.createCipheriv=browser$5.Cipheriv=ciphers$2.createCipheriv;browser$5.createDecipher=browser$5.Decipher=deciphers.createDecipher;browser$5.createDecipheriv=browser$5.Decipheriv=deciphers.createDecipheriv;browser$5.listCiphers=browser$5.getCiphers=getCiphers$1;var modes={};(function(e){e["des-ecb"]={key:8,iv:0},e["des-cbc"]=e.des={key:8,iv:8},e["des-ede3-cbc"]=e.des3={key:24,iv:8},e["des-ede3"]={key:24,iv:0},e["des-ede-cbc"]={key:16,iv:8},e["des-ede"]={key:16,iv:0}})(modes);var DES=browserifyDes,aes=browser$5,aesModes=modes_1,desModes=modes,ebtk=evp_bytestokey;function createCipher$1(e,t){e=e.toLowerCase();var a,u;if(aesModes[e])a=aesModes[e].key,u=aesModes[e].iv;else if(desModes[e])a=desModes[e].key*8,u=desModes[e].iv;else throw new TypeError("invalid suite type");var d=ebtk(t,!1,a,u);return createCipheriv(e,d.key,d.iv)}function createDecipher(e,t){e=e.toLowerCase();var a,u;if(aesModes[e])a=aesModes[e].key,u=aesModes[e].iv;else if(desModes[e])a=desModes[e].key*8,u=desModes[e].iv;else throw new TypeError("invalid suite type");var d=ebtk(t,!1,a,u);return createDecipheriv(e,d.key,d.iv)}function createCipheriv(e,t,a){if(e=e.toLowerCase(),aesModes[e])return aes.createCipheriv(e,t,a);if(desModes[e])return new DES({key:t,iv:a,mode:e});throw new TypeError("invalid suite type")}function createDecipheriv(e,t,a){if(e=e.toLowerCase(),aesModes[e])return aes.createDecipheriv(e,t,a);if(desModes[e])return new DES({key:t,iv:a,mode:e,decrypt:!0});throw new TypeError("invalid suite type")}function getCiphers(){return Object.keys(desModes).concat(aes.getCiphers())}browser$6.createCipher=browser$6.Cipher=createCipher$1;browser$6.createCipheriv=browser$6.Cipheriv=createCipheriv;browser$6.createDecipher=browser$6.Decipher=createDecipher;browser$6.createDecipheriv=browser$6.Decipheriv=createDecipheriv;browser$6.listCiphers=browser$6.getCiphers=getCiphers;var browser$4={},bn$6={exports:{}};bn$6.exports;(function(e){(function(t,a){function u($,n){if(!$)throw new Error(n||"Assertion failed")}function d($,n){$.super_=n;var l=function(){};l.prototype=n.prototype,$.prototype=new l,$.prototype.constructor=$}function h($,n,l){if(h.isBN($))return $;this.negative=0,this.words=null,this.length=0,this.red=null,$!==null&&((n==="le"||n==="be")&&(l=n,n=10),this._init($||0,n||10,l||"be"))}typeof t=="object"?t.exports=h:a.BN=h,h.BN=h,h.wordSize=26;var w;try{typeof window<"u"&&typeof window.Buffer<"u"?w=window.Buffer:w=dist.Buffer}catch{}h.isBN=function(n){return n instanceof h?!0:n!==null&&typeof n=="object"&&n.constructor.wordSize===h.wordSize&&Array.isArray(n.words)},h.max=function(n,l){return n.cmp(l)>0?n:l},h.min=function(n,l){return n.cmp(l)<0?n:l},h.prototype._init=function(n,l,c){if(typeof n=="number")return this._initNumber(n,l,c);if(typeof n=="object")return this._initArray(n,l,c);l==="hex"&&(l=16),u(l===(l|0)&&l>=2&&l<=36),n=n.toString().replace(/\s+/g,"");var p=0;n[0]==="-"&&(p++,this.negative=1),p<n.length&&(l===16?this._parseHex(n,p,c):(this._parseBase(n,l,p),c==="le"&&this._initArray(this.toArray(),l,c)))},h.prototype._initNumber=function(n,l,c){n<0&&(this.negative=1,n=-n),n<67108864?(this.words=[n&67108863],this.length=1):n<4503599627370496?(this.words=[n&67108863,n/67108864&67108863],this.length=2):(u(n<9007199254740992),this.words=[n&67108863,n/67108864&67108863,1],this.length=3),c==="le"&&this._initArray(this.toArray(),l,c)},h.prototype._initArray=function(n,l,c){if(u(typeof n.length=="number"),n.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(n.length/3),this.words=new Array(this.length);for(var p=0;p<this.length;p++)this.words[p]=0;var y,b,_=0;if(c==="be")for(p=n.length-1,y=0;p>=0;p-=3)b=n[p]|n[p-1]<<8|n[p-2]<<16,this.words[y]|=b<<_&67108863,this.words[y+1]=b>>>26-_&67108863,_+=24,_>=26&&(_-=26,y++);else if(c==="le")for(p=0,y=0;p<n.length;p+=3)b=n[p]|n[p+1]<<8|n[p+2]<<16,this.words[y]|=b<<_&67108863,this.words[y+1]=b>>>26-_&67108863,_+=24,_>=26&&(_-=26,y++);return this.strip()};function x($,n){var l=$.charCodeAt(n);return l>=65&&l<=70?l-55:l>=97&&l<=102?l-87:l-48&15}function M($,n,l){var c=x($,l);return l-1>=n&&(c|=x($,l-1)<<4),c}h.prototype._parseHex=function(n,l,c){this.length=Math.ceil((n.length-l)/6),this.words=new Array(this.length);for(var p=0;p<this.length;p++)this.words[p]=0;var y=0,b=0,_;if(c==="be")for(p=n.length-1;p>=l;p-=2)_=M(n,l,p)<<y,this.words[b]|=_&67108863,y>=18?(y-=18,b+=1,this.words[b]|=_>>>26):y+=8;else{var v=n.length-l;for(p=v%2===0?l+1:l;p<n.length;p+=2)_=M(n,l,p)<<y,this.words[b]|=_&67108863,y>=18?(y-=18,b+=1,this.words[b]|=_>>>26):y+=8}this.strip()};function B($,n,l,c){for(var p=0,y=Math.min($.length,l),b=n;b<y;b++){var _=$.charCodeAt(b)-48;p*=c,_>=49?p+=_-49+10:_>=17?p+=_-17+10:p+=_}return p}h.prototype._parseBase=function(n,l,c){this.words=[0],this.length=1;for(var p=0,y=1;y<=67108863;y*=l)p++;p--,y=y/l|0;for(var b=n.length-c,_=b%p,v=Math.min(b,b-_)+c,o=0,m=c;m<v;m+=p)o=B(n,m,m+p,l),this.imuln(y),this.words[0]+o<67108864?this.words[0]+=o:this._iaddn(o);if(_!==0){var A=1;for(o=B(n,m,n.length,l),m=0;m<_;m++)A*=l;this.imuln(A),this.words[0]+o<67108864?this.words[0]+=o:this._iaddn(o)}this.strip()},h.prototype.copy=function(n){n.words=new Array(this.length);for(var l=0;l<this.length;l++)n.words[l]=this.words[l];n.length=this.length,n.negative=this.negative,n.red=this.red},h.prototype.clone=function(){var n=new h(null);return this.copy(n),n},h.prototype._expand=function(n){for(;this.length<n;)this.words[this.length++]=0;return this},h.prototype.strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},h.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},h.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var E=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],S=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],k=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];h.prototype.toString=function(n,l){n=n||10,l=l|0||1;var c;if(n===16||n==="hex"){c="";for(var p=0,y=0,b=0;b<this.length;b++){var _=this.words[b],v=((_<<p|y)&16777215).toString(16);y=_>>>24-p&16777215,p+=2,p>=26&&(p-=26,b--),y!==0||b!==this.length-1?c=E[6-v.length]+v+c:c=v+c}for(y!==0&&(c=y.toString(16)+c);c.length%l!==0;)c="0"+c;return this.negative!==0&&(c="-"+c),c}if(n===(n|0)&&n>=2&&n<=36){var o=S[n],m=k[n];c="";var A=this.clone();for(A.negative=0;!A.isZero();){var I=A.modn(m).toString(n);A=A.idivn(m),A.isZero()?c=I+c:c=E[o-I.length]+I+c}for(this.isZero()&&(c="0"+c);c.length%l!==0;)c="0"+c;return this.negative!==0&&(c="-"+c),c}u(!1,"Base should be between 2 and 36")},h.prototype.toNumber=function(){var n=this.words[0];return this.length===2?n+=this.words[1]*67108864:this.length===3&&this.words[2]===1?n+=4503599627370496+this.words[1]*67108864:this.length>2&&u(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-n:n},h.prototype.toJSON=function(){return this.toString(16)},h.prototype.toBuffer=function(n,l){return u(typeof w<"u"),this.toArrayLike(w,n,l)},h.prototype.toArray=function(n,l){return this.toArrayLike(Array,n,l)},h.prototype.toArrayLike=function(n,l,c){var p=this.byteLength(),y=c||Math.max(1,p);u(p<=y,"byte array longer than desired length"),u(y>0,"Requested array length <= 0"),this.strip();var b=l==="le",_=new n(y),v,o,m=this.clone();if(b){for(o=0;!m.isZero();o++)v=m.andln(255),m.iushrn(8),_[o]=v;for(;o<y;o++)_[o]=0}else{for(o=0;o<y-p;o++)_[o]=0;for(o=0;!m.isZero();o++)v=m.andln(255),m.iushrn(8),_[y-o-1]=v}return _},Math.clz32?h.prototype._countBits=function(n){return 32-Math.clz32(n)}:h.prototype._countBits=function(n){var l=n,c=0;return l>=4096&&(c+=13,l>>>=13),l>=64&&(c+=7,l>>>=7),l>=8&&(c+=4,l>>>=4),l>=2&&(c+=2,l>>>=2),c+l},h.prototype._zeroBits=function(n){if(n===0)return 26;var l=n,c=0;return l&8191||(c+=13,l>>>=13),l&127||(c+=7,l>>>=7),l&15||(c+=4,l>>>=4),l&3||(c+=2,l>>>=2),l&1||c++,c},h.prototype.bitLength=function(){var n=this.words[this.length-1],l=this._countBits(n);return(this.length-1)*26+l};function C($){for(var n=new Array($.bitLength()),l=0;l<n.length;l++){var c=l/26|0,p=l%26;n[l]=($.words[c]&1<<p)>>>p}return n}h.prototype.zeroBits=function(){if(this.isZero())return 0;for(var n=0,l=0;l<this.length;l++){var c=this._zeroBits(this.words[l]);if(n+=c,c!==26)break}return n},h.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},h.prototype.toTwos=function(n){return this.negative!==0?this.abs().inotn(n).iaddn(1):this.clone()},h.prototype.fromTwos=function(n){return this.testn(n-1)?this.notn(n).iaddn(1).ineg():this.clone()},h.prototype.isNeg=function(){return this.negative!==0},h.prototype.neg=function(){return this.clone().ineg()},h.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},h.prototype.iuor=function(n){for(;this.length<n.length;)this.words[this.length++]=0;for(var l=0;l<n.length;l++)this.words[l]=this.words[l]|n.words[l];return this.strip()},h.prototype.ior=function(n){return u((this.negative|n.negative)===0),this.iuor(n)},h.prototype.or=function(n){return this.length>n.length?this.clone().ior(n):n.clone().ior(this)},h.prototype.uor=function(n){return this.length>n.length?this.clone().iuor(n):n.clone().iuor(this)},h.prototype.iuand=function(n){var l;this.length>n.length?l=n:l=this;for(var c=0;c<l.length;c++)this.words[c]=this.words[c]&n.words[c];return this.length=l.length,this.strip()},h.prototype.iand=function(n){return u((this.negative|n.negative)===0),this.iuand(n)},h.prototype.and=function(n){return this.length>n.length?this.clone().iand(n):n.clone().iand(this)},h.prototype.uand=function(n){return this.length>n.length?this.clone().iuand(n):n.clone().iuand(this)},h.prototype.iuxor=function(n){var l,c;this.length>n.length?(l=this,c=n):(l=n,c=this);for(var p=0;p<c.length;p++)this.words[p]=l.words[p]^c.words[p];if(this!==l)for(;p<l.length;p++)this.words[p]=l.words[p];return this.length=l.length,this.strip()},h.prototype.ixor=function(n){return u((this.negative|n.negative)===0),this.iuxor(n)},h.prototype.xor=function(n){return this.length>n.length?this.clone().ixor(n):n.clone().ixor(this)},h.prototype.uxor=function(n){return this.length>n.length?this.clone().iuxor(n):n.clone().iuxor(this)},h.prototype.inotn=function(n){u(typeof n=="number"&&n>=0);var l=Math.ceil(n/26)|0,c=n%26;this._expand(l),c>0&&l--;for(var p=0;p<l;p++)this.words[p]=~this.words[p]&67108863;return c>0&&(this.words[p]=~this.words[p]&67108863>>26-c),this.strip()},h.prototype.notn=function(n){return this.clone().inotn(n)},h.prototype.setn=function(n,l){u(typeof n=="number"&&n>=0);var c=n/26|0,p=n%26;return this._expand(c+1),l?this.words[c]=this.words[c]|1<<p:this.words[c]=this.words[c]&~(1<<p),this.strip()},h.prototype.iadd=function(n){var l;if(this.negative!==0&&n.negative===0)return this.negative=0,l=this.isub(n),this.negative^=1,this._normSign();if(this.negative===0&&n.negative!==0)return n.negative=0,l=this.isub(n),n.negative=1,l._normSign();var c,p;this.length>n.length?(c=this,p=n):(c=n,p=this);for(var y=0,b=0;b<p.length;b++)l=(c.words[b]|0)+(p.words[b]|0)+y,this.words[b]=l&67108863,y=l>>>26;for(;y!==0&&b<c.length;b++)l=(c.words[b]|0)+y,this.words[b]=l&67108863,y=l>>>26;if(this.length=c.length,y!==0)this.words[this.length]=y,this.length++;else if(c!==this)for(;b<c.length;b++)this.words[b]=c.words[b];return this},h.prototype.add=function(n){var l;return n.negative!==0&&this.negative===0?(n.negative=0,l=this.sub(n),n.negative^=1,l):n.negative===0&&this.negative!==0?(this.negative=0,l=n.sub(this),this.negative=1,l):this.length>n.length?this.clone().iadd(n):n.clone().iadd(this)},h.prototype.isub=function(n){if(n.negative!==0){n.negative=0;var l=this.iadd(n);return n.negative=1,l._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(n),this.negative=1,this._normSign();var c=this.cmp(n);if(c===0)return this.negative=0,this.length=1,this.words[0]=0,this;var p,y;c>0?(p=this,y=n):(p=n,y=this);for(var b=0,_=0;_<y.length;_++)l=(p.words[_]|0)-(y.words[_]|0)+b,b=l>>26,this.words[_]=l&67108863;for(;b!==0&&_<p.length;_++)l=(p.words[_]|0)+b,b=l>>26,this.words[_]=l&67108863;if(b===0&&_<p.length&&p!==this)for(;_<p.length;_++)this.words[_]=p.words[_];return this.length=Math.max(this.length,_),p!==this&&(this.negative=1),this.strip()},h.prototype.sub=function(n){return this.clone().isub(n)};function q($,n,l){l.negative=n.negative^$.negative;var c=$.length+n.length|0;l.length=c,c=c-1|0;var p=$.words[0]|0,y=n.words[0]|0,b=p*y,_=b&67108863,v=b/67108864|0;l.words[0]=_;for(var o=1;o<c;o++){for(var m=v>>>26,A=v&67108863,I=Math.min(o,n.length-1),F=Math.max(0,o-$.length+1);F<=I;F++){var X=o-F|0;p=$.words[X]|0,y=n.words[F]|0,b=p*y+A,m+=b/67108864|0,A=b&67108863}l.words[o]=A|0,v=m|0}return v!==0?l.words[o]=v|0:l.length--,l.strip()}var O=function(n,l,c){var p=n.words,y=l.words,b=c.words,_=0,v,o,m,A=p[0]|0,I=A&8191,F=A>>>13,X=p[1]|0,V=X&8191,T=X>>>13,D=p[2]|0,Z=D&8191,te=D>>>13,ee=p[3]|0,j=ee&8191,re=ee>>>13,qe=p[4]|0,de=qe&8191,pe=qe>>>13,je=p[5]|0,we=je&8191,le=je>>>13,Ve=p[6]|0,_e=Ve&8191,xe=Ve>>>13,ze=p[7]|0,me=ze&8191,ke=ze>>>13,Ge=p[8]|0,Me=Ge&8191,Ne=Ge>>>13,Ze=p[9]|0,Be=Ze&8191,De=Ze>>>13,rt=y[0]|0,Ae=rt&8191,Oe=rt>>>13,Je=y[1]|0,Re=Je&8191,He=Je>>>13,Qe=y[2]|0,Te=Qe&8191,Ue=Qe>>>13,tt=y[3]|0,Ee=tt&8191,Pe=tt>>>13,et=y[4]|0,Ie=et&8191,Le=et>>>13,it=y[5]|0,z=it&8191,N=it>>>13,H=y[6]|0,Q=H&8191,ne=H>>>13,ve=y[7]|0,he=ve&8191,be=ve>>>13,We=y[8]|0,ye=We&8191,Se=We>>>13,Ke=y[9]|0,Ce=Ke&8191,Fe=Ke>>>13;c.negative=n.negative^l.negative,c.length=19,v=Math.imul(I,Ae),o=Math.imul(I,Oe),o=o+Math.imul(F,Ae)|0,m=Math.imul(F,Oe);var Xe=(_+v|0)+((o&8191)<<13)|0;_=(m+(o>>>13)|0)+(Xe>>>26)|0,Xe&=67108863,v=Math.imul(V,Ae),o=Math.imul(V,Oe),o=o+Math.imul(T,Ae)|0,m=Math.imul(T,Oe),v=v+Math.imul(I,Re)|0,o=o+Math.imul(I,He)|0,o=o+Math.imul(F,Re)|0,m=m+Math.imul(F,He)|0;var Ye=(_+v|0)+((o&8191)<<13)|0;_=(m+(o>>>13)|0)+(Ye>>>26)|0,Ye&=67108863,v=Math.imul(Z,Ae),o=Math.imul(Z,Oe),o=o+Math.imul(te,Ae)|0,m=Math.imul(te,Oe),v=v+Math.imul(V,Re)|0,o=o+Math.imul(V,He)|0,o=o+Math.imul(T,Re)|0,m=m+Math.imul(T,He)|0,v=v+Math.imul(I,Te)|0,o=o+Math.imul(I,Ue)|0,o=o+Math.imul(F,Te)|0,m=m+Math.imul(F,Ue)|0;var nt=(_+v|0)+((o&8191)<<13)|0;_=(m+(o>>>13)|0)+(nt>>>26)|0,nt&=67108863,v=Math.imul(j,Ae),o=Math.imul(j,Oe),o=o+Math.imul(re,Ae)|0,m=Math.imul(re,Oe),v=v+Math.imul(Z,Re)|0,o=o+Math.imul(Z,He)|0,o=o+Math.imul(te,Re)|0,m=m+Math.imul(te,He)|0,v=v+Math.imul(V,Te)|0,o=o+Math.imul(V,Ue)|0,o=o+Math.imul(T,Te)|0,m=m+Math.imul(T,Ue)|0,v=v+Math.imul(I,Ee)|0,o=o+Math.imul(I,Pe)|0,o=o+Math.imul(F,Ee)|0,m=m+Math.imul(F,Pe)|0;var at=(_+v|0)+((o&8191)<<13)|0;_=(m+(o>>>13)|0)+(at>>>26)|0,at&=67108863,v=Math.imul(de,Ae),o=Math.imul(de,Oe),o=o+Math.imul(pe,Ae)|0,m=Math.imul(pe,Oe),v=v+Math.imul(j,Re)|0,o=o+Math.imul(j,He)|0,o=o+Math.imul(re,Re)|0,m=m+Math.imul(re,He)|0,v=v+Math.imul(Z,Te)|0,o=o+Math.imul(Z,Ue)|0,o=o+Math.imul(te,Te)|0,m=m+Math.imul(te,Ue)|0,v=v+Math.imul(V,Ee)|0,o=o+Math.imul(V,Pe)|0,o=o+Math.imul(T,Ee)|0,m=m+Math.imul(T,Pe)|0,v=v+Math.imul(I,Ie)|0,o=o+Math.imul(I,Le)|0,o=o+Math.imul(F,Ie)|0,m=m+Math.imul(F,Le)|0;var ot=(_+v|0)+((o&8191)<<13)|0;_=(m+(o>>>13)|0)+(ot>>>26)|0,ot&=67108863,v=Math.imul(we,Ae),o=Math.imul(we,Oe),o=o+Math.imul(le,Ae)|0,m=Math.imul(le,Oe),v=v+Math.imul(de,Re)|0,o=o+Math.imul(de,He)|0,o=o+Math.imul(pe,Re)|0,m=m+Math.imul(pe,He)|0,v=v+Math.imul(j,Te)|0,o=o+Math.imul(j,Ue)|0,o=o+Math.imul(re,Te)|0,m=m+Math.imul(re,Ue)|0,v=v+Math.imul(Z,Ee)|0,o=o+Math.imul(Z,Pe)|0,o=o+Math.imul(te,Ee)|0,m=m+Math.imul(te,Pe)|0,v=v+Math.imul(V,Ie)|0,o=o+Math.imul(V,Le)|0,o=o+Math.imul(T,Ie)|0,m=m+Math.imul(T,Le)|0,v=v+Math.imul(I,z)|0,o=o+Math.imul(I,N)|0,o=o+Math.imul(F,z)|0,m=m+Math.imul(F,N)|0;var st=(_+v|0)+((o&8191)<<13)|0;_=(m+(o>>>13)|0)+(st>>>26)|0,st&=67108863,v=Math.imul(_e,Ae),o=Math.imul(_e,Oe),o=o+Math.imul(xe,Ae)|0,m=Math.imul(xe,Oe),v=v+Math.imul(we,Re)|0,o=o+Math.imul(we,He)|0,o=o+Math.imul(le,Re)|0,m=m+Math.imul(le,He)|0,v=v+Math.imul(de,Te)|0,o=o+Math.imul(de,Ue)|0,o=o+Math.imul(pe,Te)|0,m=m+Math.imul(pe,Ue)|0,v=v+Math.imul(j,Ee)|0,o=o+Math.imul(j,Pe)|0,o=o+Math.imul(re,Ee)|0,m=m+Math.imul(re,Pe)|0,v=v+Math.imul(Z,Ie)|0,o=o+Math.imul(Z,Le)|0,o=o+Math.imul(te,Ie)|0,m=m+Math.imul(te,Le)|0,v=v+Math.imul(V,z)|0,o=o+Math.imul(V,N)|0,o=o+Math.imul(T,z)|0,m=m+Math.imul(T,N)|0,v=v+Math.imul(I,Q)|0,o=o+Math.imul(I,ne)|0,o=o+Math.imul(F,Q)|0,m=m+Math.imul(F,ne)|0;var ht=(_+v|0)+((o&8191)<<13)|0;_=(m+(o>>>13)|0)+(ht>>>26)|0,ht&=67108863,v=Math.imul(me,Ae),o=Math.imul(me,Oe),o=o+Math.imul(ke,Ae)|0,m=Math.imul(ke,Oe),v=v+Math.imul(_e,Re)|0,o=o+Math.imul(_e,He)|0,o=o+Math.imul(xe,Re)|0,m=m+Math.imul(xe,He)|0,v=v+Math.imul(we,Te)|0,o=o+Math.imul(we,Ue)|0,o=o+Math.imul(le,Te)|0,m=m+Math.imul(le,Ue)|0,v=v+Math.imul(de,Ee)|0,o=o+Math.imul(de,Pe)|0,o=o+Math.imul(pe,Ee)|0,m=m+Math.imul(pe,Pe)|0,v=v+Math.imul(j,Ie)|0,o=o+Math.imul(j,Le)|0,o=o+Math.imul(re,Ie)|0,m=m+Math.imul(re,Le)|0,v=v+Math.imul(Z,z)|0,o=o+Math.imul(Z,N)|0,o=o+Math.imul(te,z)|0,m=m+Math.imul(te,N)|0,v=v+Math.imul(V,Q)|0,o=o+Math.imul(V,ne)|0,o=o+Math.imul(T,Q)|0,m=m+Math.imul(T,ne)|0,v=v+Math.imul(I,he)|0,o=o+Math.imul(I,be)|0,o=o+Math.imul(F,he)|0,m=m+Math.imul(F,be)|0;var lt=(_+v|0)+((o&8191)<<13)|0;_=(m+(o>>>13)|0)+(lt>>>26)|0,lt&=67108863,v=Math.imul(Me,Ae),o=Math.imul(Me,Oe),o=o+Math.imul(Ne,Ae)|0,m=Math.imul(Ne,Oe),v=v+Math.imul(me,Re)|0,o=o+Math.imul(me,He)|0,o=o+Math.imul(ke,Re)|0,m=m+Math.imul(ke,He)|0,v=v+Math.imul(_e,Te)|0,o=o+Math.imul(_e,Ue)|0,o=o+Math.imul(xe,Te)|0,m=m+Math.imul(xe,Ue)|0,v=v+Math.imul(we,Ee)|0,o=o+Math.imul(we,Pe)|0,o=o+Math.imul(le,Ee)|0,m=m+Math.imul(le,Pe)|0,v=v+Math.imul(de,Ie)|0,o=o+Math.imul(de,Le)|0,o=o+Math.imul(pe,Ie)|0,m=m+Math.imul(pe,Le)|0,v=v+Math.imul(j,z)|0,o=o+Math.imul(j,N)|0,o=o+Math.imul(re,z)|0,m=m+Math.imul(re,N)|0,v=v+Math.imul(Z,Q)|0,o=o+Math.imul(Z,ne)|0,o=o+Math.imul(te,Q)|0,m=m+Math.imul(te,ne)|0,v=v+Math.imul(V,he)|0,o=o+Math.imul(V,be)|0,o=o+Math.imul(T,he)|0,m=m+Math.imul(T,be)|0,v=v+Math.imul(I,ye)|0,o=o+Math.imul(I,Se)|0,o=o+Math.imul(F,ye)|0,m=m+Math.imul(F,Se)|0;var ct=(_+v|0)+((o&8191)<<13)|0;_=(m+(o>>>13)|0)+(ct>>>26)|0,ct&=67108863,v=Math.imul(Be,Ae),o=Math.imul(Be,Oe),o=o+Math.imul(De,Ae)|0,m=Math.imul(De,Oe),v=v+Math.imul(Me,Re)|0,o=o+Math.imul(Me,He)|0,o=o+Math.imul(Ne,Re)|0,m=m+Math.imul(Ne,He)|0,v=v+Math.imul(me,Te)|0,o=o+Math.imul(me,Ue)|0,o=o+Math.imul(ke,Te)|0,m=m+Math.imul(ke,Ue)|0,v=v+Math.imul(_e,Ee)|0,o=o+Math.imul(_e,Pe)|0,o=o+Math.imul(xe,Ee)|0,m=m+Math.imul(xe,Pe)|0,v=v+Math.imul(we,Ie)|0,o=o+Math.imul(we,Le)|0,o=o+Math.imul(le,Ie)|0,m=m+Math.imul(le,Le)|0,v=v+Math.imul(de,z)|0,o=o+Math.imul(de,N)|0,o=o+Math.imul(pe,z)|0,m=m+Math.imul(pe,N)|0,v=v+Math.imul(j,Q)|0,o=o+Math.imul(j,ne)|0,o=o+Math.imul(re,Q)|0,m=m+Math.imul(re,ne)|0,v=v+Math.imul(Z,he)|0,o=o+Math.imul(Z,be)|0,o=o+Math.imul(te,he)|0,m=m+Math.imul(te,be)|0,v=v+Math.imul(V,ye)|0,o=o+Math.imul(V,Se)|0,o=o+Math.imul(T,ye)|0,m=m+Math.imul(T,Se)|0,v=v+Math.imul(I,Ce)|0,o=o+Math.imul(I,Fe)|0,o=o+Math.imul(F,Ce)|0,m=m+Math.imul(F,Fe)|0;var dt=(_+v|0)+((o&8191)<<13)|0;_=(m+(o>>>13)|0)+(dt>>>26)|0,dt&=67108863,v=Math.imul(Be,Re),o=Math.imul(Be,He),o=o+Math.imul(De,Re)|0,m=Math.imul(De,He),v=v+Math.imul(Me,Te)|0,o=o+Math.imul(Me,Ue)|0,o=o+Math.imul(Ne,Te)|0,m=m+Math.imul(Ne,Ue)|0,v=v+Math.imul(me,Ee)|0,o=o+Math.imul(me,Pe)|0,o=o+Math.imul(ke,Ee)|0,m=m+Math.imul(ke,Pe)|0,v=v+Math.imul(_e,Ie)|0,o=o+Math.imul(_e,Le)|0,o=o+Math.imul(xe,Ie)|0,m=m+Math.imul(xe,Le)|0,v=v+Math.imul(we,z)|0,o=o+Math.imul(we,N)|0,o=o+Math.imul(le,z)|0,m=m+Math.imul(le,N)|0,v=v+Math.imul(de,Q)|0,o=o+Math.imul(de,ne)|0,o=o+Math.imul(pe,Q)|0,m=m+Math.imul(pe,ne)|0,v=v+Math.imul(j,he)|0,o=o+Math.imul(j,be)|0,o=o+Math.imul(re,he)|0,m=m+Math.imul(re,be)|0,v=v+Math.imul(Z,ye)|0,o=o+Math.imul(Z,Se)|0,o=o+Math.imul(te,ye)|0,m=m+Math.imul(te,Se)|0,v=v+Math.imul(V,Ce)|0,o=o+Math.imul(V,Fe)|0,o=o+Math.imul(T,Ce)|0,m=m+Math.imul(T,Fe)|0;var pt=(_+v|0)+((o&8191)<<13)|0;_=(m+(o>>>13)|0)+(pt>>>26)|0,pt&=67108863,v=Math.imul(Be,Te),o=Math.imul(Be,Ue),o=o+Math.imul(De,Te)|0,m=Math.imul(De,Ue),v=v+Math.imul(Me,Ee)|0,o=o+Math.imul(Me,Pe)|0,o=o+Math.imul(Ne,Ee)|0,m=m+Math.imul(Ne,Pe)|0,v=v+Math.imul(me,Ie)|0,o=o+Math.imul(me,Le)|0,o=o+Math.imul(ke,Ie)|0,m=m+Math.imul(ke,Le)|0,v=v+Math.imul(_e,z)|0,o=o+Math.imul(_e,N)|0,o=o+Math.imul(xe,z)|0,m=m+Math.imul(xe,N)|0,v=v+Math.imul(we,Q)|0,o=o+Math.imul(we,ne)|0,o=o+Math.imul(le,Q)|0,m=m+Math.imul(le,ne)|0,v=v+Math.imul(de,he)|0,o=o+Math.imul(de,be)|0,o=o+Math.imul(pe,he)|0,m=m+Math.imul(pe,be)|0,v=v+Math.imul(j,ye)|0,o=o+Math.imul(j,Se)|0,o=o+Math.imul(re,ye)|0,m=m+Math.imul(re,Se)|0,v=v+Math.imul(Z,Ce)|0,o=o+Math.imul(Z,Fe)|0,o=o+Math.imul(te,Ce)|0,m=m+Math.imul(te,Fe)|0;var vt=(_+v|0)+((o&8191)<<13)|0;_=(m+(o>>>13)|0)+(vt>>>26)|0,vt&=67108863,v=Math.imul(Be,Ee),o=Math.imul(Be,Pe),o=o+Math.imul(De,Ee)|0,m=Math.imul(De,Pe),v=v+Math.imul(Me,Ie)|0,o=o+Math.imul(Me,Le)|0,o=o+Math.imul(Ne,Ie)|0,m=m+Math.imul(Ne,Le)|0,v=v+Math.imul(me,z)|0,o=o+Math.imul(me,N)|0,o=o+Math.imul(ke,z)|0,m=m+Math.imul(ke,N)|0,v=v+Math.imul(_e,Q)|0,o=o+Math.imul(_e,ne)|0,o=o+Math.imul(xe,Q)|0,m=m+Math.imul(xe,ne)|0,v=v+Math.imul(we,he)|0,o=o+Math.imul(we,be)|0,o=o+Math.imul(le,he)|0,m=m+Math.imul(le,be)|0,v=v+Math.imul(de,ye)|0,o=o+Math.imul(de,Se)|0,o=o+Math.imul(pe,ye)|0,m=m+Math.imul(pe,Se)|0,v=v+Math.imul(j,Ce)|0,o=o+Math.imul(j,Fe)|0,o=o+Math.imul(re,Ce)|0,m=m+Math.imul(re,Fe)|0;var yt=(_+v|0)+((o&8191)<<13)|0;_=(m+(o>>>13)|0)+(yt>>>26)|0,yt&=67108863,v=Math.imul(Be,Ie),o=Math.imul(Be,Le),o=o+Math.imul(De,Ie)|0,m=Math.imul(De,Le),v=v+Math.imul(Me,z)|0,o=o+Math.imul(Me,N)|0,o=o+Math.imul(Ne,z)|0,m=m+Math.imul(Ne,N)|0,v=v+Math.imul(me,Q)|0,o=o+Math.imul(me,ne)|0,o=o+Math.imul(ke,Q)|0,m=m+Math.imul(ke,ne)|0,v=v+Math.imul(_e,he)|0,o=o+Math.imul(_e,be)|0,o=o+Math.imul(xe,he)|0,m=m+Math.imul(xe,be)|0,v=v+Math.imul(we,ye)|0,o=o+Math.imul(we,Se)|0,o=o+Math.imul(le,ye)|0,m=m+Math.imul(le,Se)|0,v=v+Math.imul(de,Ce)|0,o=o+Math.imul(de,Fe)|0,o=o+Math.imul(pe,Ce)|0,m=m+Math.imul(pe,Fe)|0;var mt=(_+v|0)+((o&8191)<<13)|0;_=(m+(o>>>13)|0)+(mt>>>26)|0,mt&=67108863,v=Math.imul(Be,z),o=Math.imul(Be,N),o=o+Math.imul(De,z)|0,m=Math.imul(De,N),v=v+Math.imul(Me,Q)|0,o=o+Math.imul(Me,ne)|0,o=o+Math.imul(Ne,Q)|0,m=m+Math.imul(Ne,ne)|0,v=v+Math.imul(me,he)|0,o=o+Math.imul(me,be)|0,o=o+Math.imul(ke,he)|0,m=m+Math.imul(ke,be)|0,v=v+Math.imul(_e,ye)|0,o=o+Math.imul(_e,Se)|0,o=o+Math.imul(xe,ye)|0,m=m+Math.imul(xe,Se)|0,v=v+Math.imul(we,Ce)|0,o=o+Math.imul(we,Fe)|0,o=o+Math.imul(le,Ce)|0,m=m+Math.imul(le,Fe)|0;var gt=(_+v|0)+((o&8191)<<13)|0;_=(m+(o>>>13)|0)+(gt>>>26)|0,gt&=67108863,v=Math.imul(Be,Q),o=Math.imul(Be,ne),o=o+Math.imul(De,Q)|0,m=Math.imul(De,ne),v=v+Math.imul(Me,he)|0,o=o+Math.imul(Me,be)|0,o=o+Math.imul(Ne,he)|0,m=m+Math.imul(Ne,be)|0,v=v+Math.imul(me,ye)|0,o=o+Math.imul(me,Se)|0,o=o+Math.imul(ke,ye)|0,m=m+Math.imul(ke,Se)|0,v=v+Math.imul(_e,Ce)|0,o=o+Math.imul(_e,Fe)|0,o=o+Math.imul(xe,Ce)|0,m=m+Math.imul(xe,Fe)|0;var bt=(_+v|0)+((o&8191)<<13)|0;_=(m+(o>>>13)|0)+(bt>>>26)|0,bt&=67108863,v=Math.imul(Be,he),o=Math.imul(Be,be),o=o+Math.imul(De,he)|0,m=Math.imul(De,be),v=v+Math.imul(Me,ye)|0,o=o+Math.imul(Me,Se)|0,o=o+Math.imul(Ne,ye)|0,m=m+Math.imul(Ne,Se)|0,v=v+Math.imul(me,Ce)|0,o=o+Math.imul(me,Fe)|0,o=o+Math.imul(ke,Ce)|0,m=m+Math.imul(ke,Fe)|0;var wt=(_+v|0)+((o&8191)<<13)|0;_=(m+(o>>>13)|0)+(wt>>>26)|0,wt&=67108863,v=Math.imul(Be,ye),o=Math.imul(Be,Se),o=o+Math.imul(De,ye)|0,m=Math.imul(De,Se),v=v+Math.imul(Me,Ce)|0,o=o+Math.imul(Me,Fe)|0,o=o+Math.imul(Ne,Ce)|0,m=m+Math.imul(Ne,Fe)|0;var _t=(_+v|0)+((o&8191)<<13)|0;_=(m+(o>>>13)|0)+(_t>>>26)|0,_t&=67108863,v=Math.imul(Be,Ce),o=Math.imul(Be,Fe),o=o+Math.imul(De,Ce)|0,m=Math.imul(De,Fe);var xt=(_+v|0)+((o&8191)<<13)|0;return _=(m+(o>>>13)|0)+(xt>>>26)|0,xt&=67108863,b[0]=Xe,b[1]=Ye,b[2]=nt,b[3]=at,b[4]=ot,b[5]=st,b[6]=ht,b[7]=lt,b[8]=ct,b[9]=dt,b[10]=pt,b[11]=vt,b[12]=yt,b[13]=mt,b[14]=gt,b[15]=bt,b[16]=wt,b[17]=_t,b[18]=xt,_!==0&&(b[19]=_,c.length++),c};Math.imul||(O=q);function U($,n,l){l.negative=n.negative^$.negative,l.length=$.length+n.length;for(var c=0,p=0,y=0;y<l.length-1;y++){var b=p;p=0;for(var _=c&67108863,v=Math.min(y,n.length-1),o=Math.max(0,y-$.length+1);o<=v;o++){var m=y-o,A=$.words[m]|0,I=n.words[o]|0,F=A*I,X=F&67108863;b=b+(F/67108864|0)|0,X=X+_|0,_=X&67108863,b=b+(X>>>26)|0,p+=b>>>26,b&=67108863}l.words[y]=_,c=b,b=p}return c!==0?l.words[y]=c:l.length--,l.strip()}function P($,n,l){var c=new L;return c.mulp($,n,l)}h.prototype.mulTo=function(n,l){var c,p=this.length+n.length;return this.length===10&&n.length===10?c=O(this,n,l):p<63?c=q(this,n,l):p<1024?c=U(this,n,l):c=P(this,n,l),c};function L($,n){this.x=$,this.y=n}L.prototype.makeRBT=function(n){for(var l=new Array(n),c=h.prototype._countBits(n)-1,p=0;p<n;p++)l[p]=this.revBin(p,c,n);return l},L.prototype.revBin=function(n,l,c){if(n===0||n===c-1)return n;for(var p=0,y=0;y<l;y++)p|=(n&1)<<l-y-1,n>>=1;return p},L.prototype.permute=function(n,l,c,p,y,b){for(var _=0;_<b;_++)p[_]=l[n[_]],y[_]=c[n[_]]},L.prototype.transform=function(n,l,c,p,y,b){this.permute(b,n,l,c,p,y);for(var _=1;_<y;_<<=1)for(var v=_<<1,o=Math.cos(2*Math.PI/v),m=Math.sin(2*Math.PI/v),A=0;A<y;A+=v)for(var I=o,F=m,X=0;X<_;X++){var V=c[A+X],T=p[A+X],D=c[A+X+_],Z=p[A+X+_],te=I*D-F*Z;Z=I*Z+F*D,D=te,c[A+X]=V+D,p[A+X]=T+Z,c[A+X+_]=V-D,p[A+X+_]=T-Z,X!==v&&(te=o*I-m*F,F=o*F+m*I,I=te)}},L.prototype.guessLen13b=function(n,l){var c=Math.max(l,n)|1,p=c&1,y=0;for(c=c/2|0;c;c=c>>>1)y++;return 1<<y+1+p},L.prototype.conjugate=function(n,l,c){if(!(c<=1))for(var p=0;p<c/2;p++){var y=n[p];n[p]=n[c-p-1],n[c-p-1]=y,y=l[p],l[p]=-l[c-p-1],l[c-p-1]=-y}},L.prototype.normalize13b=function(n,l){for(var c=0,p=0;p<l/2;p++){var y=Math.round(n[2*p+1]/l)*8192+Math.round(n[2*p]/l)+c;n[p]=y&67108863,y<67108864?c=0:c=y/67108864|0}return n},L.prototype.convert13b=function(n,l,c,p){for(var y=0,b=0;b<l;b++)y=y+(n[b]|0),c[2*b]=y&8191,y=y>>>13,c[2*b+1]=y&8191,y=y>>>13;for(b=2*l;b<p;++b)c[b]=0;u(y===0),u((y&-8192)===0)},L.prototype.stub=function(n){for(var l=new Array(n),c=0;c<n;c++)l[c]=0;return l},L.prototype.mulp=function(n,l,c){var p=2*this.guessLen13b(n.length,l.length),y=this.makeRBT(p),b=this.stub(p),_=new Array(p),v=new Array(p),o=new Array(p),m=new Array(p),A=new Array(p),I=new Array(p),F=c.words;F.length=p,this.convert13b(n.words,n.length,_,p),this.convert13b(l.words,l.length,m,p),this.transform(_,b,v,o,p,y),this.transform(m,b,A,I,p,y);for(var X=0;X<p;X++){var V=v[X]*A[X]-o[X]*I[X];o[X]=v[X]*I[X]+o[X]*A[X],v[X]=V}return this.conjugate(v,o,p),this.transform(v,o,F,b,p,y),this.conjugate(F,b,p),this.normalize13b(F,p),c.negative=n.negative^l.negative,c.length=n.length+l.length,c.strip()},h.prototype.mul=function(n){var l=new h(null);return l.words=new Array(this.length+n.length),this.mulTo(n,l)},h.prototype.mulf=function(n){var l=new h(null);return l.words=new Array(this.length+n.length),P(this,n,l)},h.prototype.imul=function(n){return this.clone().mulTo(n,this)},h.prototype.imuln=function(n){u(typeof n=="number"),u(n<67108864);for(var l=0,c=0;c<this.length;c++){var p=(this.words[c]|0)*n,y=(p&67108863)+(l&67108863);l>>=26,l+=p/67108864|0,l+=y>>>26,this.words[c]=y&67108863}return l!==0&&(this.words[c]=l,this.length++),this.length=n===0?1:this.length,this},h.prototype.muln=function(n){return this.clone().imuln(n)},h.prototype.sqr=function(){return this.mul(this)},h.prototype.isqr=function(){return this.imul(this.clone())},h.prototype.pow=function(n){var l=C(n);if(l.length===0)return new h(1);for(var c=this,p=0;p<l.length&&l[p]===0;p++,c=c.sqr());if(++p<l.length)for(var y=c.sqr();p<l.length;p++,y=y.sqr())l[p]!==0&&(c=c.mul(y));return c},h.prototype.iushln=function(n){u(typeof n=="number"&&n>=0);var l=n%26,c=(n-l)/26,p=67108863>>>26-l<<26-l,y;if(l!==0){var b=0;for(y=0;y<this.length;y++){var _=this.words[y]&p,v=(this.words[y]|0)-_<<l;this.words[y]=v|b,b=_>>>26-l}b&&(this.words[y]=b,this.length++)}if(c!==0){for(y=this.length-1;y>=0;y--)this.words[y+c]=this.words[y];for(y=0;y<c;y++)this.words[y]=0;this.length+=c}return this.strip()},h.prototype.ishln=function(n){return u(this.negative===0),this.iushln(n)},h.prototype.iushrn=function(n,l,c){u(typeof n=="number"&&n>=0);var p;l?p=(l-l%26)/26:p=0;var y=n%26,b=Math.min((n-y)/26,this.length),_=67108863^67108863>>>y<<y,v=c;if(p-=b,p=Math.max(0,p),v){for(var o=0;o<b;o++)v.words[o]=this.words[o];v.length=b}if(b!==0)if(this.length>b)for(this.length-=b,o=0;o<this.length;o++)this.words[o]=this.words[o+b];else this.words[0]=0,this.length=1;var m=0;for(o=this.length-1;o>=0&&(m!==0||o>=p);o--){var A=this.words[o]|0;this.words[o]=m<<26-y|A>>>y,m=A&_}return v&&m!==0&&(v.words[v.length++]=m),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},h.prototype.ishrn=function(n,l,c){return u(this.negative===0),this.iushrn(n,l,c)},h.prototype.shln=function(n){return this.clone().ishln(n)},h.prototype.ushln=function(n){return this.clone().iushln(n)},h.prototype.shrn=function(n){return this.clone().ishrn(n)},h.prototype.ushrn=function(n){return this.clone().iushrn(n)},h.prototype.testn=function(n){u(typeof n=="number"&&n>=0);var l=n%26,c=(n-l)/26,p=1<<l;if(this.length<=c)return!1;var y=this.words[c];return!!(y&p)},h.prototype.imaskn=function(n){u(typeof n=="number"&&n>=0);var l=n%26,c=(n-l)/26;if(u(this.negative===0,"imaskn works only with positive numbers"),this.length<=c)return this;if(l!==0&&c++,this.length=Math.min(c,this.length),l!==0){var p=67108863^67108863>>>l<<l;this.words[this.length-1]&=p}return this.strip()},h.prototype.maskn=function(n){return this.clone().imaskn(n)},h.prototype.iaddn=function(n){return u(typeof n=="number"),u(n<67108864),n<0?this.isubn(-n):this.negative!==0?this.length===1&&(this.words[0]|0)<n?(this.words[0]=n-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(n),this.negative=1,this):this._iaddn(n)},h.prototype._iaddn=function(n){this.words[0]+=n;for(var l=0;l<this.length&&this.words[l]>=67108864;l++)this.words[l]-=67108864,l===this.length-1?this.words[l+1]=1:this.words[l+1]++;return this.length=Math.max(this.length,l+1),this},h.prototype.isubn=function(n){if(u(typeof n=="number"),u(n<67108864),n<0)return this.iaddn(-n);if(this.negative!==0)return this.negative=0,this.iaddn(n),this.negative=1,this;if(this.words[0]-=n,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var l=0;l<this.length&&this.words[l]<0;l++)this.words[l]+=67108864,this.words[l+1]-=1;return this.strip()},h.prototype.addn=function(n){return this.clone().iaddn(n)},h.prototype.subn=function(n){return this.clone().isubn(n)},h.prototype.iabs=function(){return this.negative=0,this},h.prototype.abs=function(){return this.clone().iabs()},h.prototype._ishlnsubmul=function(n,l,c){var p=n.length+c,y;this._expand(p);var b,_=0;for(y=0;y<n.length;y++){b=(this.words[y+c]|0)+_;var v=(n.words[y]|0)*l;b-=v&67108863,_=(b>>26)-(v/67108864|0),this.words[y+c]=b&67108863}for(;y<this.length-c;y++)b=(this.words[y+c]|0)+_,_=b>>26,this.words[y+c]=b&67108863;if(_===0)return this.strip();for(u(_===-1),_=0,y=0;y<this.length;y++)b=-(this.words[y]|0)+_,_=b>>26,this.words[y]=b&67108863;return this.negative=1,this.strip()},h.prototype._wordDiv=function(n,l){var c=this.length-n.length,p=this.clone(),y=n,b=y.words[y.length-1]|0,_=this._countBits(b);c=26-_,c!==0&&(y=y.ushln(c),p.iushln(c),b=y.words[y.length-1]|0);var v=p.length-y.length,o;if(l!=="mod"){o=new h(null),o.length=v+1,o.words=new Array(o.length);for(var m=0;m<o.length;m++)o.words[m]=0}var A=p.clone()._ishlnsubmul(y,1,v);A.negative===0&&(p=A,o&&(o.words[v]=1));for(var I=v-1;I>=0;I--){var F=(p.words[y.length+I]|0)*67108864+(p.words[y.length+I-1]|0);for(F=Math.min(F/b|0,67108863),p._ishlnsubmul(y,F,I);p.negative!==0;)F--,p.negative=0,p._ishlnsubmul(y,1,I),p.isZero()||(p.negative^=1);o&&(o.words[I]=F)}return o&&o.strip(),p.strip(),l!=="div"&&c!==0&&p.iushrn(c),{div:o||null,mod:p}},h.prototype.divmod=function(n,l,c){if(u(!n.isZero()),this.isZero())return{div:new h(0),mod:new h(0)};var p,y,b;return this.negative!==0&&n.negative===0?(b=this.neg().divmod(n,l),l!=="mod"&&(p=b.div.neg()),l!=="div"&&(y=b.mod.neg(),c&&y.negative!==0&&y.iadd(n)),{div:p,mod:y}):this.negative===0&&n.negative!==0?(b=this.divmod(n.neg(),l),l!=="mod"&&(p=b.div.neg()),{div:p,mod:b.mod}):this.negative&n.negative?(b=this.neg().divmod(n.neg(),l),l!=="div"&&(y=b.mod.neg(),c&&y.negative!==0&&y.isub(n)),{div:b.div,mod:y}):n.length>this.length||this.cmp(n)<0?{div:new h(0),mod:this}:n.length===1?l==="div"?{div:this.divn(n.words[0]),mod:null}:l==="mod"?{div:null,mod:new h(this.modn(n.words[0]))}:{div:this.divn(n.words[0]),mod:new h(this.modn(n.words[0]))}:this._wordDiv(n,l)},h.prototype.div=function(n){return this.divmod(n,"div",!1).div},h.prototype.mod=function(n){return this.divmod(n,"mod",!1).mod},h.prototype.umod=function(n){return this.divmod(n,"mod",!0).mod},h.prototype.divRound=function(n){var l=this.divmod(n);if(l.mod.isZero())return l.div;var c=l.div.negative!==0?l.mod.isub(n):l.mod,p=n.ushrn(1),y=n.andln(1),b=c.cmp(p);return b<0||y===1&&b===0?l.div:l.div.negative!==0?l.div.isubn(1):l.div.iaddn(1)},h.prototype.modn=function(n){u(n<=67108863);for(var l=(1<<26)%n,c=0,p=this.length-1;p>=0;p--)c=(l*c+(this.words[p]|0))%n;return c},h.prototype.idivn=function(n){u(n<=67108863);for(var l=0,c=this.length-1;c>=0;c--){var p=(this.words[c]|0)+l*67108864;this.words[c]=p/n|0,l=p%n}return this.strip()},h.prototype.divn=function(n){return this.clone().idivn(n)},h.prototype.egcd=function(n){u(n.negative===0),u(!n.isZero());var l=this,c=n.clone();l.negative!==0?l=l.umod(n):l=l.clone();for(var p=new h(1),y=new h(0),b=new h(0),_=new h(1),v=0;l.isEven()&&c.isEven();)l.iushrn(1),c.iushrn(1),++v;for(var o=c.clone(),m=l.clone();!l.isZero();){for(var A=0,I=1;!(l.words[0]&I)&&A<26;++A,I<<=1);if(A>0)for(l.iushrn(A);A-- >0;)(p.isOdd()||y.isOdd())&&(p.iadd(o),y.isub(m)),p.iushrn(1),y.iushrn(1);for(var F=0,X=1;!(c.words[0]&X)&&F<26;++F,X<<=1);if(F>0)for(c.iushrn(F);F-- >0;)(b.isOdd()||_.isOdd())&&(b.iadd(o),_.isub(m)),b.iushrn(1),_.iushrn(1);l.cmp(c)>=0?(l.isub(c),p.isub(b),y.isub(_)):(c.isub(l),b.isub(p),_.isub(y))}return{a:b,b:_,gcd:c.iushln(v)}},h.prototype._invmp=function(n){u(n.negative===0),u(!n.isZero());var l=this,c=n.clone();l.negative!==0?l=l.umod(n):l=l.clone();for(var p=new h(1),y=new h(0),b=c.clone();l.cmpn(1)>0&&c.cmpn(1)>0;){for(var _=0,v=1;!(l.words[0]&v)&&_<26;++_,v<<=1);if(_>0)for(l.iushrn(_);_-- >0;)p.isOdd()&&p.iadd(b),p.iushrn(1);for(var o=0,m=1;!(c.words[0]&m)&&o<26;++o,m<<=1);if(o>0)for(c.iushrn(o);o-- >0;)y.isOdd()&&y.iadd(b),y.iushrn(1);l.cmp(c)>=0?(l.isub(c),p.isub(y)):(c.isub(l),y.isub(p))}var A;return l.cmpn(1)===0?A=p:A=y,A.cmpn(0)<0&&A.iadd(n),A},h.prototype.gcd=function(n){if(this.isZero())return n.abs();if(n.isZero())return this.abs();var l=this.clone(),c=n.clone();l.negative=0,c.negative=0;for(var p=0;l.isEven()&&c.isEven();p++)l.iushrn(1),c.iushrn(1);do{for(;l.isEven();)l.iushrn(1);for(;c.isEven();)c.iushrn(1);var y=l.cmp(c);if(y<0){var b=l;l=c,c=b}else if(y===0||c.cmpn(1)===0)break;l.isub(c)}while(!0);return c.iushln(p)},h.prototype.invm=function(n){return this.egcd(n).a.umod(n)},h.prototype.isEven=function(){return(this.words[0]&1)===0},h.prototype.isOdd=function(){return(this.words[0]&1)===1},h.prototype.andln=function(n){return this.words[0]&n},h.prototype.bincn=function(n){u(typeof n=="number");var l=n%26,c=(n-l)/26,p=1<<l;if(this.length<=c)return this._expand(c+1),this.words[c]|=p,this;for(var y=p,b=c;y!==0&&b<this.length;b++){var _=this.words[b]|0;_+=y,y=_>>>26,_&=67108863,this.words[b]=_}return y!==0&&(this.words[b]=y,this.length++),this},h.prototype.isZero=function(){return this.length===1&&this.words[0]===0},h.prototype.cmpn=function(n){var l=n<0;if(this.negative!==0&&!l)return-1;if(this.negative===0&&l)return 1;this.strip();var c;if(this.length>1)c=1;else{l&&(n=-n),u(n<=67108863,"Number is too big");var p=this.words[0]|0;c=p===n?0:p<n?-1:1}return this.negative!==0?-c|0:c},h.prototype.cmp=function(n){if(this.negative!==0&&n.negative===0)return-1;if(this.negative===0&&n.negative!==0)return 1;var l=this.ucmp(n);return this.negative!==0?-l|0:l},h.prototype.ucmp=function(n){if(this.length>n.length)return 1;if(this.length<n.length)return-1;for(var l=0,c=this.length-1;c>=0;c--){var p=this.words[c]|0,y=n.words[c]|0;if(p!==y){p<y?l=-1:p>y&&(l=1);break}}return l},h.prototype.gtn=function(n){return this.cmpn(n)===1},h.prototype.gt=function(n){return this.cmp(n)===1},h.prototype.gten=function(n){return this.cmpn(n)>=0},h.prototype.gte=function(n){return this.cmp(n)>=0},h.prototype.ltn=function(n){return this.cmpn(n)===-1},h.prototype.lt=function(n){return this.cmp(n)===-1},h.prototype.lten=function(n){return this.cmpn(n)<=0},h.prototype.lte=function(n){return this.cmp(n)<=0},h.prototype.eqn=function(n){return this.cmpn(n)===0},h.prototype.eq=function(n){return this.cmp(n)===0},h.red=function(n){return new ie(n)},h.prototype.toRed=function(n){return u(!this.red,"Already a number in reduction context"),u(this.negative===0,"red works only with positives"),n.convertTo(this)._forceRed(n)},h.prototype.fromRed=function(){return u(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},h.prototype._forceRed=function(n){return this.red=n,this},h.prototype.forceRed=function(n){return u(!this.red,"Already a number in reduction context"),this._forceRed(n)},h.prototype.redAdd=function(n){return u(this.red,"redAdd works only with red numbers"),this.red.add(this,n)},h.prototype.redIAdd=function(n){return u(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,n)},h.prototype.redSub=function(n){return u(this.red,"redSub works only with red numbers"),this.red.sub(this,n)},h.prototype.redISub=function(n){return u(this.red,"redISub works only with red numbers"),this.red.isub(this,n)},h.prototype.redShl=function(n){return u(this.red,"redShl works only with red numbers"),this.red.shl(this,n)},h.prototype.redMul=function(n){return u(this.red,"redMul works only with red numbers"),this.red._verify2(this,n),this.red.mul(this,n)},h.prototype.redIMul=function(n){return u(this.red,"redMul works only with red numbers"),this.red._verify2(this,n),this.red.imul(this,n)},h.prototype.redSqr=function(){return u(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},h.prototype.redISqr=function(){return u(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},h.prototype.redSqrt=function(){return u(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},h.prototype.redInvm=function(){return u(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},h.prototype.redNeg=function(){return u(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},h.prototype.redPow=function(n){return u(this.red&&!n.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,n)};var J={k256:null,p224:null,p192:null,p25519:null};function Y($,n){this.name=$,this.p=new h(n,16),this.n=this.p.bitLength(),this.k=new h(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}Y.prototype._tmp=function(){var n=new h(null);return n.words=new Array(Math.ceil(this.n/13)),n},Y.prototype.ireduce=function(n){var l=n,c;do this.split(l,this.tmp),l=this.imulK(l),l=l.iadd(this.tmp),c=l.bitLength();while(c>this.n);var p=c<this.n?-1:l.ucmp(this.p);return p===0?(l.words[0]=0,l.length=1):p>0?l.isub(this.p):l.strip!==void 0?l.strip():l._strip(),l},Y.prototype.split=function(n,l){n.iushrn(this.n,0,l)},Y.prototype.imulK=function(n){return n.imul(this.k)};function ae(){Y.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}d(ae,Y),ae.prototype.split=function(n,l){for(var c=4194303,p=Math.min(n.length,9),y=0;y<p;y++)l.words[y]=n.words[y];if(l.length=p,n.length<=9){n.words[0]=0,n.length=1;return}var b=n.words[9];for(l.words[l.length++]=b&c,y=10;y<n.length;y++){var _=n.words[y]|0;n.words[y-10]=(_&c)<<4|b>>>22,b=_}b>>>=22,n.words[y-10]=b,b===0&&n.length>10?n.length-=10:n.length-=9},ae.prototype.imulK=function(n){n.words[n.length]=0,n.words[n.length+1]=0,n.length+=2;for(var l=0,c=0;c<n.length;c++){var p=n.words[c]|0;l+=p*977,n.words[c]=l&67108863,l=p*64+(l/67108864|0)}return n.words[n.length-1]===0&&(n.length--,n.words[n.length-1]===0&&n.length--),n};function oe(){Y.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}d(oe,Y);function ue(){Y.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}d(ue,Y);function se(){Y.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}d(se,Y),se.prototype.imulK=function(n){for(var l=0,c=0;c<n.length;c++){var p=(n.words[c]|0)*19+l,y=p&67108863;p>>>=26,n.words[c]=y,l=p}return l!==0&&(n.words[n.length++]=l),n},h._prime=function(n){if(J[n])return J[n];var l;if(n==="k256")l=new ae;else if(n==="p224")l=new oe;else if(n==="p192")l=new ue;else if(n==="p25519")l=new se;else throw new Error("Unknown prime "+n);return J[n]=l,l};function ie($){if(typeof $=="string"){var n=h._prime($);this.m=n.p,this.prime=n}else u($.gtn(1),"modulus must be greater than 1"),this.m=$,this.prime=null}ie.prototype._verify1=function(n){u(n.negative===0,"red works only with positives"),u(n.red,"red works only with red numbers")},ie.prototype._verify2=function(n,l){u((n.negative|l.negative)===0,"red works only with positives"),u(n.red&&n.red===l.red,"red works only with red numbers")},ie.prototype.imod=function(n){return this.prime?this.prime.ireduce(n)._forceRed(this):n.umod(this.m)._forceRed(this)},ie.prototype.neg=function(n){return n.isZero()?n.clone():this.m.sub(n)._forceRed(this)},ie.prototype.add=function(n,l){this._verify2(n,l);var c=n.add(l);return c.cmp(this.m)>=0&&c.isub(this.m),c._forceRed(this)},ie.prototype.iadd=function(n,l){this._verify2(n,l);var c=n.iadd(l);return c.cmp(this.m)>=0&&c.isub(this.m),c},ie.prototype.sub=function(n,l){this._verify2(n,l);var c=n.sub(l);return c.cmpn(0)<0&&c.iadd(this.m),c._forceRed(this)},ie.prototype.isub=function(n,l){this._verify2(n,l);var c=n.isub(l);return c.cmpn(0)<0&&c.iadd(this.m),c},ie.prototype.shl=function(n,l){return this._verify1(n),this.imod(n.ushln(l))},ie.prototype.imul=function(n,l){return this._verify2(n,l),this.imod(n.imul(l))},ie.prototype.mul=function(n,l){return this._verify2(n,l),this.imod(n.mul(l))},ie.prototype.isqr=function(n){return this.imul(n,n.clone())},ie.prototype.sqr=function(n){return this.mul(n,n)},ie.prototype.sqrt=function(n){if(n.isZero())return n.clone();var l=this.m.andln(3);if(u(l%2===1),l===3){var c=this.m.add(new h(1)).iushrn(2);return this.pow(n,c)}for(var p=this.m.subn(1),y=0;!p.isZero()&&p.andln(1)===0;)y++,p.iushrn(1);u(!p.isZero());var b=new h(1).toRed(this),_=b.redNeg(),v=this.m.subn(1).iushrn(1),o=this.m.bitLength();for(o=new h(2*o*o).toRed(this);this.pow(o,v).cmp(_)!==0;)o.redIAdd(_);for(var m=this.pow(o,p),A=this.pow(n,p.addn(1).iushrn(1)),I=this.pow(n,p),F=y;I.cmp(b)!==0;){for(var X=I,V=0;X.cmp(b)!==0;V++)X=X.redSqr();u(V<F);var T=this.pow(m,new h(1).iushln(F-V-1));A=A.redMul(T),m=T.redSqr(),I=I.redMul(m),F=V}return A},ie.prototype.invm=function(n){var l=n._invmp(this.m);return l.negative!==0?(l.negative=0,this.imod(l).redNeg()):this.imod(l)},ie.prototype.pow=function(n,l){if(l.isZero())return new h(1).toRed(this);if(l.cmpn(1)===0)return n.clone();var c=4,p=new Array(1<<c);p[0]=new h(1).toRed(this),p[1]=n;for(var y=2;y<p.length;y++)p[y]=this.mul(p[y-1],n);var b=p[0],_=0,v=0,o=l.bitLength()%26;for(o===0&&(o=26),y=l.length-1;y>=0;y--){for(var m=l.words[y],A=o-1;A>=0;A--){var I=m>>A&1;if(b!==p[0]&&(b=this.sqr(b)),I===0&&_===0){v=0;continue}_<<=1,_|=I,v++,!(v!==c&&(y!==0||A!==0))&&(b=this.mul(b,p[_]),v=0,_=0)}o=26}return b},ie.prototype.convertTo=function(n){var l=n.umod(this.m);return l===n?l.clone():l},ie.prototype.convertFrom=function(n){var l=n.clone();return l.red=null,l},h.mont=function(n){return new ce(n)};function ce($){ie.call(this,$),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new h(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}d(ce,ie),ce.prototype.convertTo=function(n){return this.imod(n.ushln(this.shift))},ce.prototype.convertFrom=function(n){var l=this.imod(n.mul(this.rinv));return l.red=null,l},ce.prototype.imul=function(n,l){if(n.isZero()||l.isZero())return n.words[0]=0,n.length=1,n;var c=n.imul(l),p=c.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),y=c.isub(p).iushrn(this.shift),b=y;return y.cmp(this.m)>=0?b=y.isub(this.m):y.cmpn(0)<0&&(b=y.iadd(this.m)),b._forceRed(this)},ce.prototype.mul=function(n,l){if(n.isZero()||l.isZero())return new h(0)._forceRed(this);var c=n.mul(l),p=c.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),y=c.isub(p).iushrn(this.shift),b=y;return y.cmp(this.m)>=0?b=y.isub(this.m):y.cmpn(0)<0&&(b=y.iadd(this.m)),b._forceRed(this)},ce.prototype.invm=function(n){var l=this.imod(n._invmp(this.m).mul(this.r2));return l._forceRed(this)}})(e,commonjsGlobal)})(bn$6);var bnExports$6=bn$6.exports,bn$5={exports:{}};bn$5.exports;(function(e){(function(t,a){function u($,n){if(!$)throw new Error(n||"Assertion failed")}function d($,n){$.super_=n;var l=function(){};l.prototype=n.prototype,$.prototype=new l,$.prototype.constructor=$}function h($,n,l){if(h.isBN($))return $;this.negative=0,this.words=null,this.length=0,this.red=null,$!==null&&((n==="le"||n==="be")&&(l=n,n=10),this._init($||0,n||10,l||"be"))}typeof t=="object"?t.exports=h:a.BN=h,h.BN=h,h.wordSize=26;var w;try{typeof window<"u"&&typeof window.Buffer<"u"?w=window.Buffer:w=dist.Buffer}catch{}h.isBN=function(n){return n instanceof h?!0:n!==null&&typeof n=="object"&&n.constructor.wordSize===h.wordSize&&Array.isArray(n.words)},h.max=function(n,l){return n.cmp(l)>0?n:l},h.min=function(n,l){return n.cmp(l)<0?n:l},h.prototype._init=function(n,l,c){if(typeof n=="number")return this._initNumber(n,l,c);if(typeof n=="object")return this._initArray(n,l,c);l==="hex"&&(l=16),u(l===(l|0)&&l>=2&&l<=36),n=n.toString().replace(/\s+/g,"");var p=0;n[0]==="-"&&(p++,this.negative=1),p<n.length&&(l===16?this._parseHex(n,p,c):(this._parseBase(n,l,p),c==="le"&&this._initArray(this.toArray(),l,c)))},h.prototype._initNumber=function(n,l,c){n<0&&(this.negative=1,n=-n),n<67108864?(this.words=[n&67108863],this.length=1):n<4503599627370496?(this.words=[n&67108863,n/67108864&67108863],this.length=2):(u(n<9007199254740992),this.words=[n&67108863,n/67108864&67108863,1],this.length=3),c==="le"&&this._initArray(this.toArray(),l,c)},h.prototype._initArray=function(n,l,c){if(u(typeof n.length=="number"),n.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(n.length/3),this.words=new Array(this.length);for(var p=0;p<this.length;p++)this.words[p]=0;var y,b,_=0;if(c==="be")for(p=n.length-1,y=0;p>=0;p-=3)b=n[p]|n[p-1]<<8|n[p-2]<<16,this.words[y]|=b<<_&67108863,this.words[y+1]=b>>>26-_&67108863,_+=24,_>=26&&(_-=26,y++);else if(c==="le")for(p=0,y=0;p<n.length;p+=3)b=n[p]|n[p+1]<<8|n[p+2]<<16,this.words[y]|=b<<_&67108863,this.words[y+1]=b>>>26-_&67108863,_+=24,_>=26&&(_-=26,y++);return this.strip()};function x($,n){var l=$.charCodeAt(n);return l>=65&&l<=70?l-55:l>=97&&l<=102?l-87:l-48&15}function M($,n,l){var c=x($,l);return l-1>=n&&(c|=x($,l-1)<<4),c}h.prototype._parseHex=function(n,l,c){this.length=Math.ceil((n.length-l)/6),this.words=new Array(this.length);for(var p=0;p<this.length;p++)this.words[p]=0;var y=0,b=0,_;if(c==="be")for(p=n.length-1;p>=l;p-=2)_=M(n,l,p)<<y,this.words[b]|=_&67108863,y>=18?(y-=18,b+=1,this.words[b]|=_>>>26):y+=8;else{var v=n.length-l;for(p=v%2===0?l+1:l;p<n.length;p+=2)_=M(n,l,p)<<y,this.words[b]|=_&67108863,y>=18?(y-=18,b+=1,this.words[b]|=_>>>26):y+=8}this.strip()};function B($,n,l,c){for(var p=0,y=Math.min($.length,l),b=n;b<y;b++){var _=$.charCodeAt(b)-48;p*=c,_>=49?p+=_-49+10:_>=17?p+=_-17+10:p+=_}return p}h.prototype._parseBase=function(n,l,c){this.words=[0],this.length=1;for(var p=0,y=1;y<=67108863;y*=l)p++;p--,y=y/l|0;for(var b=n.length-c,_=b%p,v=Math.min(b,b-_)+c,o=0,m=c;m<v;m+=p)o=B(n,m,m+p,l),this.imuln(y),this.words[0]+o<67108864?this.words[0]+=o:this._iaddn(o);if(_!==0){var A=1;for(o=B(n,m,n.length,l),m=0;m<_;m++)A*=l;this.imuln(A),this.words[0]+o<67108864?this.words[0]+=o:this._iaddn(o)}this.strip()},h.prototype.copy=function(n){n.words=new Array(this.length);for(var l=0;l<this.length;l++)n.words[l]=this.words[l];n.length=this.length,n.negative=this.negative,n.red=this.red},h.prototype.clone=function(){var n=new h(null);return this.copy(n),n},h.prototype._expand=function(n){for(;this.length<n;)this.words[this.length++]=0;return this},h.prototype.strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},h.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},h.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var E=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],S=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],k=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];h.prototype.toString=function(n,l){n=n||10,l=l|0||1;var c;if(n===16||n==="hex"){c="";for(var p=0,y=0,b=0;b<this.length;b++){var _=this.words[b],v=((_<<p|y)&16777215).toString(16);y=_>>>24-p&16777215,p+=2,p>=26&&(p-=26,b--),y!==0||b!==this.length-1?c=E[6-v.length]+v+c:c=v+c}for(y!==0&&(c=y.toString(16)+c);c.length%l!==0;)c="0"+c;return this.negative!==0&&(c="-"+c),c}if(n===(n|0)&&n>=2&&n<=36){var o=S[n],m=k[n];c="";var A=this.clone();for(A.negative=0;!A.isZero();){var I=A.modn(m).toString(n);A=A.idivn(m),A.isZero()?c=I+c:c=E[o-I.length]+I+c}for(this.isZero()&&(c="0"+c);c.length%l!==0;)c="0"+c;return this.negative!==0&&(c="-"+c),c}u(!1,"Base should be between 2 and 36")},h.prototype.toNumber=function(){var n=this.words[0];return this.length===2?n+=this.words[1]*67108864:this.length===3&&this.words[2]===1?n+=4503599627370496+this.words[1]*67108864:this.length>2&&u(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-n:n},h.prototype.toJSON=function(){return this.toString(16)},h.prototype.toBuffer=function(n,l){return u(typeof w<"u"),this.toArrayLike(w,n,l)},h.prototype.toArray=function(n,l){return this.toArrayLike(Array,n,l)},h.prototype.toArrayLike=function(n,l,c){var p=this.byteLength(),y=c||Math.max(1,p);u(p<=y,"byte array longer than desired length"),u(y>0,"Requested array length <= 0"),this.strip();var b=l==="le",_=new n(y),v,o,m=this.clone();if(b){for(o=0;!m.isZero();o++)v=m.andln(255),m.iushrn(8),_[o]=v;for(;o<y;o++)_[o]=0}else{for(o=0;o<y-p;o++)_[o]=0;for(o=0;!m.isZero();o++)v=m.andln(255),m.iushrn(8),_[y-o-1]=v}return _},Math.clz32?h.prototype._countBits=function(n){return 32-Math.clz32(n)}:h.prototype._countBits=function(n){var l=n,c=0;return l>=4096&&(c+=13,l>>>=13),l>=64&&(c+=7,l>>>=7),l>=8&&(c+=4,l>>>=4),l>=2&&(c+=2,l>>>=2),c+l},h.prototype._zeroBits=function(n){if(n===0)return 26;var l=n,c=0;return l&8191||(c+=13,l>>>=13),l&127||(c+=7,l>>>=7),l&15||(c+=4,l>>>=4),l&3||(c+=2,l>>>=2),l&1||c++,c},h.prototype.bitLength=function(){var n=this.words[this.length-1],l=this._countBits(n);return(this.length-1)*26+l};function C($){for(var n=new Array($.bitLength()),l=0;l<n.length;l++){var c=l/26|0,p=l%26;n[l]=($.words[c]&1<<p)>>>p}return n}h.prototype.zeroBits=function(){if(this.isZero())return 0;for(var n=0,l=0;l<this.length;l++){var c=this._zeroBits(this.words[l]);if(n+=c,c!==26)break}return n},h.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},h.prototype.toTwos=function(n){return this.negative!==0?this.abs().inotn(n).iaddn(1):this.clone()},h.prototype.fromTwos=function(n){return this.testn(n-1)?this.notn(n).iaddn(1).ineg():this.clone()},h.prototype.isNeg=function(){return this.negative!==0},h.prototype.neg=function(){return this.clone().ineg()},h.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},h.prototype.iuor=function(n){for(;this.length<n.length;)this.words[this.length++]=0;for(var l=0;l<n.length;l++)this.words[l]=this.words[l]|n.words[l];return this.strip()},h.prototype.ior=function(n){return u((this.negative|n.negative)===0),this.iuor(n)},h.prototype.or=function(n){return this.length>n.length?this.clone().ior(n):n.clone().ior(this)},h.prototype.uor=function(n){return this.length>n.length?this.clone().iuor(n):n.clone().iuor(this)},h.prototype.iuand=function(n){var l;this.length>n.length?l=n:l=this;for(var c=0;c<l.length;c++)this.words[c]=this.words[c]&n.words[c];return this.length=l.length,this.strip()},h.prototype.iand=function(n){return u((this.negative|n.negative)===0),this.iuand(n)},h.prototype.and=function(n){return this.length>n.length?this.clone().iand(n):n.clone().iand(this)},h.prototype.uand=function(n){return this.length>n.length?this.clone().iuand(n):n.clone().iuand(this)},h.prototype.iuxor=function(n){var l,c;this.length>n.length?(l=this,c=n):(l=n,c=this);for(var p=0;p<c.length;p++)this.words[p]=l.words[p]^c.words[p];if(this!==l)for(;p<l.length;p++)this.words[p]=l.words[p];return this.length=l.length,this.strip()},h.prototype.ixor=function(n){return u((this.negative|n.negative)===0),this.iuxor(n)},h.prototype.xor=function(n){return this.length>n.length?this.clone().ixor(n):n.clone().ixor(this)},h.prototype.uxor=function(n){return this.length>n.length?this.clone().iuxor(n):n.clone().iuxor(this)},h.prototype.inotn=function(n){u(typeof n=="number"&&n>=0);var l=Math.ceil(n/26)|0,c=n%26;this._expand(l),c>0&&l--;for(var p=0;p<l;p++)this.words[p]=~this.words[p]&67108863;return c>0&&(this.words[p]=~this.words[p]&67108863>>26-c),this.strip()},h.prototype.notn=function(n){return this.clone().inotn(n)},h.prototype.setn=function(n,l){u(typeof n=="number"&&n>=0);var c=n/26|0,p=n%26;return this._expand(c+1),l?this.words[c]=this.words[c]|1<<p:this.words[c]=this.words[c]&~(1<<p),this.strip()},h.prototype.iadd=function(n){var l;if(this.negative!==0&&n.negative===0)return this.negative=0,l=this.isub(n),this.negative^=1,this._normSign();if(this.negative===0&&n.negative!==0)return n.negative=0,l=this.isub(n),n.negative=1,l._normSign();var c,p;this.length>n.length?(c=this,p=n):(c=n,p=this);for(var y=0,b=0;b<p.length;b++)l=(c.words[b]|0)+(p.words[b]|0)+y,this.words[b]=l&67108863,y=l>>>26;for(;y!==0&&b<c.length;b++)l=(c.words[b]|0)+y,this.words[b]=l&67108863,y=l>>>26;if(this.length=c.length,y!==0)this.words[this.length]=y,this.length++;else if(c!==this)for(;b<c.length;b++)this.words[b]=c.words[b];return this},h.prototype.add=function(n){var l;return n.negative!==0&&this.negative===0?(n.negative=0,l=this.sub(n),n.negative^=1,l):n.negative===0&&this.negative!==0?(this.negative=0,l=n.sub(this),this.negative=1,l):this.length>n.length?this.clone().iadd(n):n.clone().iadd(this)},h.prototype.isub=function(n){if(n.negative!==0){n.negative=0;var l=this.iadd(n);return n.negative=1,l._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(n),this.negative=1,this._normSign();var c=this.cmp(n);if(c===0)return this.negative=0,this.length=1,this.words[0]=0,this;var p,y;c>0?(p=this,y=n):(p=n,y=this);for(var b=0,_=0;_<y.length;_++)l=(p.words[_]|0)-(y.words[_]|0)+b,b=l>>26,this.words[_]=l&67108863;for(;b!==0&&_<p.length;_++)l=(p.words[_]|0)+b,b=l>>26,this.words[_]=l&67108863;if(b===0&&_<p.length&&p!==this)for(;_<p.length;_++)this.words[_]=p.words[_];return this.length=Math.max(this.length,_),p!==this&&(this.negative=1),this.strip()},h.prototype.sub=function(n){return this.clone().isub(n)};function q($,n,l){l.negative=n.negative^$.negative;var c=$.length+n.length|0;l.length=c,c=c-1|0;var p=$.words[0]|0,y=n.words[0]|0,b=p*y,_=b&67108863,v=b/67108864|0;l.words[0]=_;for(var o=1;o<c;o++){for(var m=v>>>26,A=v&67108863,I=Math.min(o,n.length-1),F=Math.max(0,o-$.length+1);F<=I;F++){var X=o-F|0;p=$.words[X]|0,y=n.words[F]|0,b=p*y+A,m+=b/67108864|0,A=b&67108863}l.words[o]=A|0,v=m|0}return v!==0?l.words[o]=v|0:l.length--,l.strip()}var O=function(n,l,c){var p=n.words,y=l.words,b=c.words,_=0,v,o,m,A=p[0]|0,I=A&8191,F=A>>>13,X=p[1]|0,V=X&8191,T=X>>>13,D=p[2]|0,Z=D&8191,te=D>>>13,ee=p[3]|0,j=ee&8191,re=ee>>>13,qe=p[4]|0,de=qe&8191,pe=qe>>>13,je=p[5]|0,we=je&8191,le=je>>>13,Ve=p[6]|0,_e=Ve&8191,xe=Ve>>>13,ze=p[7]|0,me=ze&8191,ke=ze>>>13,Ge=p[8]|0,Me=Ge&8191,Ne=Ge>>>13,Ze=p[9]|0,Be=Ze&8191,De=Ze>>>13,rt=y[0]|0,Ae=rt&8191,Oe=rt>>>13,Je=y[1]|0,Re=Je&8191,He=Je>>>13,Qe=y[2]|0,Te=Qe&8191,Ue=Qe>>>13,tt=y[3]|0,Ee=tt&8191,Pe=tt>>>13,et=y[4]|0,Ie=et&8191,Le=et>>>13,it=y[5]|0,z=it&8191,N=it>>>13,H=y[6]|0,Q=H&8191,ne=H>>>13,ve=y[7]|0,he=ve&8191,be=ve>>>13,We=y[8]|0,ye=We&8191,Se=We>>>13,Ke=y[9]|0,Ce=Ke&8191,Fe=Ke>>>13;c.negative=n.negative^l.negative,c.length=19,v=Math.imul(I,Ae),o=Math.imul(I,Oe),o=o+Math.imul(F,Ae)|0,m=Math.imul(F,Oe);var Xe=(_+v|0)+((o&8191)<<13)|0;_=(m+(o>>>13)|0)+(Xe>>>26)|0,Xe&=67108863,v=Math.imul(V,Ae),o=Math.imul(V,Oe),o=o+Math.imul(T,Ae)|0,m=Math.imul(T,Oe),v=v+Math.imul(I,Re)|0,o=o+Math.imul(I,He)|0,o=o+Math.imul(F,Re)|0,m=m+Math.imul(F,He)|0;var Ye=(_+v|0)+((o&8191)<<13)|0;_=(m+(o>>>13)|0)+(Ye>>>26)|0,Ye&=67108863,v=Math.imul(Z,Ae),o=Math.imul(Z,Oe),o=o+Math.imul(te,Ae)|0,m=Math.imul(te,Oe),v=v+Math.imul(V,Re)|0,o=o+Math.imul(V,He)|0,o=o+Math.imul(T,Re)|0,m=m+Math.imul(T,He)|0,v=v+Math.imul(I,Te)|0,o=o+Math.imul(I,Ue)|0,o=o+Math.imul(F,Te)|0,m=m+Math.imul(F,Ue)|0;var nt=(_+v|0)+((o&8191)<<13)|0;_=(m+(o>>>13)|0)+(nt>>>26)|0,nt&=67108863,v=Math.imul(j,Ae),o=Math.imul(j,Oe),o=o+Math.imul(re,Ae)|0,m=Math.imul(re,Oe),v=v+Math.imul(Z,Re)|0,o=o+Math.imul(Z,He)|0,o=o+Math.imul(te,Re)|0,m=m+Math.imul(te,He)|0,v=v+Math.imul(V,Te)|0,o=o+Math.imul(V,Ue)|0,o=o+Math.imul(T,Te)|0,m=m+Math.imul(T,Ue)|0,v=v+Math.imul(I,Ee)|0,o=o+Math.imul(I,Pe)|0,o=o+Math.imul(F,Ee)|0,m=m+Math.imul(F,Pe)|0;var at=(_+v|0)+((o&8191)<<13)|0;_=(m+(o>>>13)|0)+(at>>>26)|0,at&=67108863,v=Math.imul(de,Ae),o=Math.imul(de,Oe),o=o+Math.imul(pe,Ae)|0,m=Math.imul(pe,Oe),v=v+Math.imul(j,Re)|0,o=o+Math.imul(j,He)|0,o=o+Math.imul(re,Re)|0,m=m+Math.imul(re,He)|0,v=v+Math.imul(Z,Te)|0,o=o+Math.imul(Z,Ue)|0,o=o+Math.imul(te,Te)|0,m=m+Math.imul(te,Ue)|0,v=v+Math.imul(V,Ee)|0,o=o+Math.imul(V,Pe)|0,o=o+Math.imul(T,Ee)|0,m=m+Math.imul(T,Pe)|0,v=v+Math.imul(I,Ie)|0,o=o+Math.imul(I,Le)|0,o=o+Math.imul(F,Ie)|0,m=m+Math.imul(F,Le)|0;var ot=(_+v|0)+((o&8191)<<13)|0;_=(m+(o>>>13)|0)+(ot>>>26)|0,ot&=67108863,v=Math.imul(we,Ae),o=Math.imul(we,Oe),o=o+Math.imul(le,Ae)|0,m=Math.imul(le,Oe),v=v+Math.imul(de,Re)|0,o=o+Math.imul(de,He)|0,o=o+Math.imul(pe,Re)|0,m=m+Math.imul(pe,He)|0,v=v+Math.imul(j,Te)|0,o=o+Math.imul(j,Ue)|0,o=o+Math.imul(re,Te)|0,m=m+Math.imul(re,Ue)|0,v=v+Math.imul(Z,Ee)|0,o=o+Math.imul(Z,Pe)|0,o=o+Math.imul(te,Ee)|0,m=m+Math.imul(te,Pe)|0,v=v+Math.imul(V,Ie)|0,o=o+Math.imul(V,Le)|0,o=o+Math.imul(T,Ie)|0,m=m+Math.imul(T,Le)|0,v=v+Math.imul(I,z)|0,o=o+Math.imul(I,N)|0,o=o+Math.imul(F,z)|0,m=m+Math.imul(F,N)|0;var st=(_+v|0)+((o&8191)<<13)|0;_=(m+(o>>>13)|0)+(st>>>26)|0,st&=67108863,v=Math.imul(_e,Ae),o=Math.imul(_e,Oe),o=o+Math.imul(xe,Ae)|0,m=Math.imul(xe,Oe),v=v+Math.imul(we,Re)|0,o=o+Math.imul(we,He)|0,o=o+Math.imul(le,Re)|0,m=m+Math.imul(le,He)|0,v=v+Math.imul(de,Te)|0,o=o+Math.imul(de,Ue)|0,o=o+Math.imul(pe,Te)|0,m=m+Math.imul(pe,Ue)|0,v=v+Math.imul(j,Ee)|0,o=o+Math.imul(j,Pe)|0,o=o+Math.imul(re,Ee)|0,m=m+Math.imul(re,Pe)|0,v=v+Math.imul(Z,Ie)|0,o=o+Math.imul(Z,Le)|0,o=o+Math.imul(te,Ie)|0,m=m+Math.imul(te,Le)|0,v=v+Math.imul(V,z)|0,o=o+Math.imul(V,N)|0,o=o+Math.imul(T,z)|0,m=m+Math.imul(T,N)|0,v=v+Math.imul(I,Q)|0,o=o+Math.imul(I,ne)|0,o=o+Math.imul(F,Q)|0,m=m+Math.imul(F,ne)|0;var ht=(_+v|0)+((o&8191)<<13)|0;_=(m+(o>>>13)|0)+(ht>>>26)|0,ht&=67108863,v=Math.imul(me,Ae),o=Math.imul(me,Oe),o=o+Math.imul(ke,Ae)|0,m=Math.imul(ke,Oe),v=v+Math.imul(_e,Re)|0,o=o+Math.imul(_e,He)|0,o=o+Math.imul(xe,Re)|0,m=m+Math.imul(xe,He)|0,v=v+Math.imul(we,Te)|0,o=o+Math.imul(we,Ue)|0,o=o+Math.imul(le,Te)|0,m=m+Math.imul(le,Ue)|0,v=v+Math.imul(de,Ee)|0,o=o+Math.imul(de,Pe)|0,o=o+Math.imul(pe,Ee)|0,m=m+Math.imul(pe,Pe)|0,v=v+Math.imul(j,Ie)|0,o=o+Math.imul(j,Le)|0,o=o+Math.imul(re,Ie)|0,m=m+Math.imul(re,Le)|0,v=v+Math.imul(Z,z)|0,o=o+Math.imul(Z,N)|0,o=o+Math.imul(te,z)|0,m=m+Math.imul(te,N)|0,v=v+Math.imul(V,Q)|0,o=o+Math.imul(V,ne)|0,o=o+Math.imul(T,Q)|0,m=m+Math.imul(T,ne)|0,v=v+Math.imul(I,he)|0,o=o+Math.imul(I,be)|0,o=o+Math.imul(F,he)|0,m=m+Math.imul(F,be)|0;var lt=(_+v|0)+((o&8191)<<13)|0;_=(m+(o>>>13)|0)+(lt>>>26)|0,lt&=67108863,v=Math.imul(Me,Ae),o=Math.imul(Me,Oe),o=o+Math.imul(Ne,Ae)|0,m=Math.imul(Ne,Oe),v=v+Math.imul(me,Re)|0,o=o+Math.imul(me,He)|0,o=o+Math.imul(ke,Re)|0,m=m+Math.imul(ke,He)|0,v=v+Math.imul(_e,Te)|0,o=o+Math.imul(_e,Ue)|0,o=o+Math.imul(xe,Te)|0,m=m+Math.imul(xe,Ue)|0,v=v+Math.imul(we,Ee)|0,o=o+Math.imul(we,Pe)|0,o=o+Math.imul(le,Ee)|0,m=m+Math.imul(le,Pe)|0,v=v+Math.imul(de,Ie)|0,o=o+Math.imul(de,Le)|0,o=o+Math.imul(pe,Ie)|0,m=m+Math.imul(pe,Le)|0,v=v+Math.imul(j,z)|0,o=o+Math.imul(j,N)|0,o=o+Math.imul(re,z)|0,m=m+Math.imul(re,N)|0,v=v+Math.imul(Z,Q)|0,o=o+Math.imul(Z,ne)|0,o=o+Math.imul(te,Q)|0,m=m+Math.imul(te,ne)|0,v=v+Math.imul(V,he)|0,o=o+Math.imul(V,be)|0,o=o+Math.imul(T,he)|0,m=m+Math.imul(T,be)|0,v=v+Math.imul(I,ye)|0,o=o+Math.imul(I,Se)|0,o=o+Math.imul(F,ye)|0,m=m+Math.imul(F,Se)|0;var ct=(_+v|0)+((o&8191)<<13)|0;_=(m+(o>>>13)|0)+(ct>>>26)|0,ct&=67108863,v=Math.imul(Be,Ae),o=Math.imul(Be,Oe),o=o+Math.imul(De,Ae)|0,m=Math.imul(De,Oe),v=v+Math.imul(Me,Re)|0,o=o+Math.imul(Me,He)|0,o=o+Math.imul(Ne,Re)|0,m=m+Math.imul(Ne,He)|0,v=v+Math.imul(me,Te)|0,o=o+Math.imul(me,Ue)|0,o=o+Math.imul(ke,Te)|0,m=m+Math.imul(ke,Ue)|0,v=v+Math.imul(_e,Ee)|0,o=o+Math.imul(_e,Pe)|0,o=o+Math.imul(xe,Ee)|0,m=m+Math.imul(xe,Pe)|0,v=v+Math.imul(we,Ie)|0,o=o+Math.imul(we,Le)|0,o=o+Math.imul(le,Ie)|0,m=m+Math.imul(le,Le)|0,v=v+Math.imul(de,z)|0,o=o+Math.imul(de,N)|0,o=o+Math.imul(pe,z)|0,m=m+Math.imul(pe,N)|0,v=v+Math.imul(j,Q)|0,o=o+Math.imul(j,ne)|0,o=o+Math.imul(re,Q)|0,m=m+Math.imul(re,ne)|0,v=v+Math.imul(Z,he)|0,o=o+Math.imul(Z,be)|0,o=o+Math.imul(te,he)|0,m=m+Math.imul(te,be)|0,v=v+Math.imul(V,ye)|0,o=o+Math.imul(V,Se)|0,o=o+Math.imul(T,ye)|0,m=m+Math.imul(T,Se)|0,v=v+Math.imul(I,Ce)|0,o=o+Math.imul(I,Fe)|0,o=o+Math.imul(F,Ce)|0,m=m+Math.imul(F,Fe)|0;var dt=(_+v|0)+((o&8191)<<13)|0;_=(m+(o>>>13)|0)+(dt>>>26)|0,dt&=67108863,v=Math.imul(Be,Re),o=Math.imul(Be,He),o=o+Math.imul(De,Re)|0,m=Math.imul(De,He),v=v+Math.imul(Me,Te)|0,o=o+Math.imul(Me,Ue)|0,o=o+Math.imul(Ne,Te)|0,m=m+Math.imul(Ne,Ue)|0,v=v+Math.imul(me,Ee)|0,o=o+Math.imul(me,Pe)|0,o=o+Math.imul(ke,Ee)|0,m=m+Math.imul(ke,Pe)|0,v=v+Math.imul(_e,Ie)|0,o=o+Math.imul(_e,Le)|0,o=o+Math.imul(xe,Ie)|0,m=m+Math.imul(xe,Le)|0,v=v+Math.imul(we,z)|0,o=o+Math.imul(we,N)|0,o=o+Math.imul(le,z)|0,m=m+Math.imul(le,N)|0,v=v+Math.imul(de,Q)|0,o=o+Math.imul(de,ne)|0,o=o+Math.imul(pe,Q)|0,m=m+Math.imul(pe,ne)|0,v=v+Math.imul(j,he)|0,o=o+Math.imul(j,be)|0,o=o+Math.imul(re,he)|0,m=m+Math.imul(re,be)|0,v=v+Math.imul(Z,ye)|0,o=o+Math.imul(Z,Se)|0,o=o+Math.imul(te,ye)|0,m=m+Math.imul(te,Se)|0,v=v+Math.imul(V,Ce)|0,o=o+Math.imul(V,Fe)|0,o=o+Math.imul(T,Ce)|0,m=m+Math.imul(T,Fe)|0;var pt=(_+v|0)+((o&8191)<<13)|0;_=(m+(o>>>13)|0)+(pt>>>26)|0,pt&=67108863,v=Math.imul(Be,Te),o=Math.imul(Be,Ue),o=o+Math.imul(De,Te)|0,m=Math.imul(De,Ue),v=v+Math.imul(Me,Ee)|0,o=o+Math.imul(Me,Pe)|0,o=o+Math.imul(Ne,Ee)|0,m=m+Math.imul(Ne,Pe)|0,v=v+Math.imul(me,Ie)|0,o=o+Math.imul(me,Le)|0,o=o+Math.imul(ke,Ie)|0,m=m+Math.imul(ke,Le)|0,v=v+Math.imul(_e,z)|0,o=o+Math.imul(_e,N)|0,o=o+Math.imul(xe,z)|0,m=m+Math.imul(xe,N)|0,v=v+Math.imul(we,Q)|0,o=o+Math.imul(we,ne)|0,o=o+Math.imul(le,Q)|0,m=m+Math.imul(le,ne)|0,v=v+Math.imul(de,he)|0,o=o+Math.imul(de,be)|0,o=o+Math.imul(pe,he)|0,m=m+Math.imul(pe,be)|0,v=v+Math.imul(j,ye)|0,o=o+Math.imul(j,Se)|0,o=o+Math.imul(re,ye)|0,m=m+Math.imul(re,Se)|0,v=v+Math.imul(Z,Ce)|0,o=o+Math.imul(Z,Fe)|0,o=o+Math.imul(te,Ce)|0,m=m+Math.imul(te,Fe)|0;var vt=(_+v|0)+((o&8191)<<13)|0;_=(m+(o>>>13)|0)+(vt>>>26)|0,vt&=67108863,v=Math.imul(Be,Ee),o=Math.imul(Be,Pe),o=o+Math.imul(De,Ee)|0,m=Math.imul(De,Pe),v=v+Math.imul(Me,Ie)|0,o=o+Math.imul(Me,Le)|0,o=o+Math.imul(Ne,Ie)|0,m=m+Math.imul(Ne,Le)|0,v=v+Math.imul(me,z)|0,o=o+Math.imul(me,N)|0,o=o+Math.imul(ke,z)|0,m=m+Math.imul(ke,N)|0,v=v+Math.imul(_e,Q)|0,o=o+Math.imul(_e,ne)|0,o=o+Math.imul(xe,Q)|0,m=m+Math.imul(xe,ne)|0,v=v+Math.imul(we,he)|0,o=o+Math.imul(we,be)|0,o=o+Math.imul(le,he)|0,m=m+Math.imul(le,be)|0,v=v+Math.imul(de,ye)|0,o=o+Math.imul(de,Se)|0,o=o+Math.imul(pe,ye)|0,m=m+Math.imul(pe,Se)|0,v=v+Math.imul(j,Ce)|0,o=o+Math.imul(j,Fe)|0,o=o+Math.imul(re,Ce)|0,m=m+Math.imul(re,Fe)|0;var yt=(_+v|0)+((o&8191)<<13)|0;_=(m+(o>>>13)|0)+(yt>>>26)|0,yt&=67108863,v=Math.imul(Be,Ie),o=Math.imul(Be,Le),o=o+Math.imul(De,Ie)|0,m=Math.imul(De,Le),v=v+Math.imul(Me,z)|0,o=o+Math.imul(Me,N)|0,o=o+Math.imul(Ne,z)|0,m=m+Math.imul(Ne,N)|0,v=v+Math.imul(me,Q)|0,o=o+Math.imul(me,ne)|0,o=o+Math.imul(ke,Q)|0,m=m+Math.imul(ke,ne)|0,v=v+Math.imul(_e,he)|0,o=o+Math.imul(_e,be)|0,o=o+Math.imul(xe,he)|0,m=m+Math.imul(xe,be)|0,v=v+Math.imul(we,ye)|0,o=o+Math.imul(we,Se)|0,o=o+Math.imul(le,ye)|0,m=m+Math.imul(le,Se)|0,v=v+Math.imul(de,Ce)|0,o=o+Math.imul(de,Fe)|0,o=o+Math.imul(pe,Ce)|0,m=m+Math.imul(pe,Fe)|0;var mt=(_+v|0)+((o&8191)<<13)|0;_=(m+(o>>>13)|0)+(mt>>>26)|0,mt&=67108863,v=Math.imul(Be,z),o=Math.imul(Be,N),o=o+Math.imul(De,z)|0,m=Math.imul(De,N),v=v+Math.imul(Me,Q)|0,o=o+Math.imul(Me,ne)|0,o=o+Math.imul(Ne,Q)|0,m=m+Math.imul(Ne,ne)|0,v=v+Math.imul(me,he)|0,o=o+Math.imul(me,be)|0,o=o+Math.imul(ke,he)|0,m=m+Math.imul(ke,be)|0,v=v+Math.imul(_e,ye)|0,o=o+Math.imul(_e,Se)|0,o=o+Math.imul(xe,ye)|0,m=m+Math.imul(xe,Se)|0,v=v+Math.imul(we,Ce)|0,o=o+Math.imul(we,Fe)|0,o=o+Math.imul(le,Ce)|0,m=m+Math.imul(le,Fe)|0;var gt=(_+v|0)+((o&8191)<<13)|0;_=(m+(o>>>13)|0)+(gt>>>26)|0,gt&=67108863,v=Math.imul(Be,Q),o=Math.imul(Be,ne),o=o+Math.imul(De,Q)|0,m=Math.imul(De,ne),v=v+Math.imul(Me,he)|0,o=o+Math.imul(Me,be)|0,o=o+Math.imul(Ne,he)|0,m=m+Math.imul(Ne,be)|0,v=v+Math.imul(me,ye)|0,o=o+Math.imul(me,Se)|0,o=o+Math.imul(ke,ye)|0,m=m+Math.imul(ke,Se)|0,v=v+Math.imul(_e,Ce)|0,o=o+Math.imul(_e,Fe)|0,o=o+Math.imul(xe,Ce)|0,m=m+Math.imul(xe,Fe)|0;var bt=(_+v|0)+((o&8191)<<13)|0;_=(m+(o>>>13)|0)+(bt>>>26)|0,bt&=67108863,v=Math.imul(Be,he),o=Math.imul(Be,be),o=o+Math.imul(De,he)|0,m=Math.imul(De,be),v=v+Math.imul(Me,ye)|0,o=o+Math.imul(Me,Se)|0,o=o+Math.imul(Ne,ye)|0,m=m+Math.imul(Ne,Se)|0,v=v+Math.imul(me,Ce)|0,o=o+Math.imul(me,Fe)|0,o=o+Math.imul(ke,Ce)|0,m=m+Math.imul(ke,Fe)|0;var wt=(_+v|0)+((o&8191)<<13)|0;_=(m+(o>>>13)|0)+(wt>>>26)|0,wt&=67108863,v=Math.imul(Be,ye),o=Math.imul(Be,Se),o=o+Math.imul(De,ye)|0,m=Math.imul(De,Se),v=v+Math.imul(Me,Ce)|0,o=o+Math.imul(Me,Fe)|0,o=o+Math.imul(Ne,Ce)|0,m=m+Math.imul(Ne,Fe)|0;var _t=(_+v|0)+((o&8191)<<13)|0;_=(m+(o>>>13)|0)+(_t>>>26)|0,_t&=67108863,v=Math.imul(Be,Ce),o=Math.imul(Be,Fe),o=o+Math.imul(De,Ce)|0,m=Math.imul(De,Fe);var xt=(_+v|0)+((o&8191)<<13)|0;return _=(m+(o>>>13)|0)+(xt>>>26)|0,xt&=67108863,b[0]=Xe,b[1]=Ye,b[2]=nt,b[3]=at,b[4]=ot,b[5]=st,b[6]=ht,b[7]=lt,b[8]=ct,b[9]=dt,b[10]=pt,b[11]=vt,b[12]=yt,b[13]=mt,b[14]=gt,b[15]=bt,b[16]=wt,b[17]=_t,b[18]=xt,_!==0&&(b[19]=_,c.length++),c};Math.imul||(O=q);function U($,n,l){l.negative=n.negative^$.negative,l.length=$.length+n.length;for(var c=0,p=0,y=0;y<l.length-1;y++){var b=p;p=0;for(var _=c&67108863,v=Math.min(y,n.length-1),o=Math.max(0,y-$.length+1);o<=v;o++){var m=y-o,A=$.words[m]|0,I=n.words[o]|0,F=A*I,X=F&67108863;b=b+(F/67108864|0)|0,X=X+_|0,_=X&67108863,b=b+(X>>>26)|0,p+=b>>>26,b&=67108863}l.words[y]=_,c=b,b=p}return c!==0?l.words[y]=c:l.length--,l.strip()}function P($,n,l){var c=new L;return c.mulp($,n,l)}h.prototype.mulTo=function(n,l){var c,p=this.length+n.length;return this.length===10&&n.length===10?c=O(this,n,l):p<63?c=q(this,n,l):p<1024?c=U(this,n,l):c=P(this,n,l),c};function L($,n){this.x=$,this.y=n}L.prototype.makeRBT=function(n){for(var l=new Array(n),c=h.prototype._countBits(n)-1,p=0;p<n;p++)l[p]=this.revBin(p,c,n);return l},L.prototype.revBin=function(n,l,c){if(n===0||n===c-1)return n;for(var p=0,y=0;y<l;y++)p|=(n&1)<<l-y-1,n>>=1;return p},L.prototype.permute=function(n,l,c,p,y,b){for(var _=0;_<b;_++)p[_]=l[n[_]],y[_]=c[n[_]]},L.prototype.transform=function(n,l,c,p,y,b){this.permute(b,n,l,c,p,y);for(var _=1;_<y;_<<=1)for(var v=_<<1,o=Math.cos(2*Math.PI/v),m=Math.sin(2*Math.PI/v),A=0;A<y;A+=v)for(var I=o,F=m,X=0;X<_;X++){var V=c[A+X],T=p[A+X],D=c[A+X+_],Z=p[A+X+_],te=I*D-F*Z;Z=I*Z+F*D,D=te,c[A+X]=V+D,p[A+X]=T+Z,c[A+X+_]=V-D,p[A+X+_]=T-Z,X!==v&&(te=o*I-m*F,F=o*F+m*I,I=te)}},L.prototype.guessLen13b=function(n,l){var c=Math.max(l,n)|1,p=c&1,y=0;for(c=c/2|0;c;c=c>>>1)y++;return 1<<y+1+p},L.prototype.conjugate=function(n,l,c){if(!(c<=1))for(var p=0;p<c/2;p++){var y=n[p];n[p]=n[c-p-1],n[c-p-1]=y,y=l[p],l[p]=-l[c-p-1],l[c-p-1]=-y}},L.prototype.normalize13b=function(n,l){for(var c=0,p=0;p<l/2;p++){var y=Math.round(n[2*p+1]/l)*8192+Math.round(n[2*p]/l)+c;n[p]=y&67108863,y<67108864?c=0:c=y/67108864|0}return n},L.prototype.convert13b=function(n,l,c,p){for(var y=0,b=0;b<l;b++)y=y+(n[b]|0),c[2*b]=y&8191,y=y>>>13,c[2*b+1]=y&8191,y=y>>>13;for(b=2*l;b<p;++b)c[b]=0;u(y===0),u((y&-8192)===0)},L.prototype.stub=function(n){for(var l=new Array(n),c=0;c<n;c++)l[c]=0;return l},L.prototype.mulp=function(n,l,c){var p=2*this.guessLen13b(n.length,l.length),y=this.makeRBT(p),b=this.stub(p),_=new Array(p),v=new Array(p),o=new Array(p),m=new Array(p),A=new Array(p),I=new Array(p),F=c.words;F.length=p,this.convert13b(n.words,n.length,_,p),this.convert13b(l.words,l.length,m,p),this.transform(_,b,v,o,p,y),this.transform(m,b,A,I,p,y);for(var X=0;X<p;X++){var V=v[X]*A[X]-o[X]*I[X];o[X]=v[X]*I[X]+o[X]*A[X],v[X]=V}return this.conjugate(v,o,p),this.transform(v,o,F,b,p,y),this.conjugate(F,b,p),this.normalize13b(F,p),c.negative=n.negative^l.negative,c.length=n.length+l.length,c.strip()},h.prototype.mul=function(n){var l=new h(null);return l.words=new Array(this.length+n.length),this.mulTo(n,l)},h.prototype.mulf=function(n){var l=new h(null);return l.words=new Array(this.length+n.length),P(this,n,l)},h.prototype.imul=function(n){return this.clone().mulTo(n,this)},h.prototype.imuln=function(n){u(typeof n=="number"),u(n<67108864);for(var l=0,c=0;c<this.length;c++){var p=(this.words[c]|0)*n,y=(p&67108863)+(l&67108863);l>>=26,l+=p/67108864|0,l+=y>>>26,this.words[c]=y&67108863}return l!==0&&(this.words[c]=l,this.length++),this.length=n===0?1:this.length,this},h.prototype.muln=function(n){return this.clone().imuln(n)},h.prototype.sqr=function(){return this.mul(this)},h.prototype.isqr=function(){return this.imul(this.clone())},h.prototype.pow=function(n){var l=C(n);if(l.length===0)return new h(1);for(var c=this,p=0;p<l.length&&l[p]===0;p++,c=c.sqr());if(++p<l.length)for(var y=c.sqr();p<l.length;p++,y=y.sqr())l[p]!==0&&(c=c.mul(y));return c},h.prototype.iushln=function(n){u(typeof n=="number"&&n>=0);var l=n%26,c=(n-l)/26,p=67108863>>>26-l<<26-l,y;if(l!==0){var b=0;for(y=0;y<this.length;y++){var _=this.words[y]&p,v=(this.words[y]|0)-_<<l;this.words[y]=v|b,b=_>>>26-l}b&&(this.words[y]=b,this.length++)}if(c!==0){for(y=this.length-1;y>=0;y--)this.words[y+c]=this.words[y];for(y=0;y<c;y++)this.words[y]=0;this.length+=c}return this.strip()},h.prototype.ishln=function(n){return u(this.negative===0),this.iushln(n)},h.prototype.iushrn=function(n,l,c){u(typeof n=="number"&&n>=0);var p;l?p=(l-l%26)/26:p=0;var y=n%26,b=Math.min((n-y)/26,this.length),_=67108863^67108863>>>y<<y,v=c;if(p-=b,p=Math.max(0,p),v){for(var o=0;o<b;o++)v.words[o]=this.words[o];v.length=b}if(b!==0)if(this.length>b)for(this.length-=b,o=0;o<this.length;o++)this.words[o]=this.words[o+b];else this.words[0]=0,this.length=1;var m=0;for(o=this.length-1;o>=0&&(m!==0||o>=p);o--){var A=this.words[o]|0;this.words[o]=m<<26-y|A>>>y,m=A&_}return v&&m!==0&&(v.words[v.length++]=m),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},h.prototype.ishrn=function(n,l,c){return u(this.negative===0),this.iushrn(n,l,c)},h.prototype.shln=function(n){return this.clone().ishln(n)},h.prototype.ushln=function(n){return this.clone().iushln(n)},h.prototype.shrn=function(n){return this.clone().ishrn(n)},h.prototype.ushrn=function(n){return this.clone().iushrn(n)},h.prototype.testn=function(n){u(typeof n=="number"&&n>=0);var l=n%26,c=(n-l)/26,p=1<<l;if(this.length<=c)return!1;var y=this.words[c];return!!(y&p)},h.prototype.imaskn=function(n){u(typeof n=="number"&&n>=0);var l=n%26,c=(n-l)/26;if(u(this.negative===0,"imaskn works only with positive numbers"),this.length<=c)return this;if(l!==0&&c++,this.length=Math.min(c,this.length),l!==0){var p=67108863^67108863>>>l<<l;this.words[this.length-1]&=p}return this.strip()},h.prototype.maskn=function(n){return this.clone().imaskn(n)},h.prototype.iaddn=function(n){return u(typeof n=="number"),u(n<67108864),n<0?this.isubn(-n):this.negative!==0?this.length===1&&(this.words[0]|0)<n?(this.words[0]=n-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(n),this.negative=1,this):this._iaddn(n)},h.prototype._iaddn=function(n){this.words[0]+=n;for(var l=0;l<this.length&&this.words[l]>=67108864;l++)this.words[l]-=67108864,l===this.length-1?this.words[l+1]=1:this.words[l+1]++;return this.length=Math.max(this.length,l+1),this},h.prototype.isubn=function(n){if(u(typeof n=="number"),u(n<67108864),n<0)return this.iaddn(-n);if(this.negative!==0)return this.negative=0,this.iaddn(n),this.negative=1,this;if(this.words[0]-=n,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var l=0;l<this.length&&this.words[l]<0;l++)this.words[l]+=67108864,this.words[l+1]-=1;return this.strip()},h.prototype.addn=function(n){return this.clone().iaddn(n)},h.prototype.subn=function(n){return this.clone().isubn(n)},h.prototype.iabs=function(){return this.negative=0,this},h.prototype.abs=function(){return this.clone().iabs()},h.prototype._ishlnsubmul=function(n,l,c){var p=n.length+c,y;this._expand(p);var b,_=0;for(y=0;y<n.length;y++){b=(this.words[y+c]|0)+_;var v=(n.words[y]|0)*l;b-=v&67108863,_=(b>>26)-(v/67108864|0),this.words[y+c]=b&67108863}for(;y<this.length-c;y++)b=(this.words[y+c]|0)+_,_=b>>26,this.words[y+c]=b&67108863;if(_===0)return this.strip();for(u(_===-1),_=0,y=0;y<this.length;y++)b=-(this.words[y]|0)+_,_=b>>26,this.words[y]=b&67108863;return this.negative=1,this.strip()},h.prototype._wordDiv=function(n,l){var c=this.length-n.length,p=this.clone(),y=n,b=y.words[y.length-1]|0,_=this._countBits(b);c=26-_,c!==0&&(y=y.ushln(c),p.iushln(c),b=y.words[y.length-1]|0);var v=p.length-y.length,o;if(l!=="mod"){o=new h(null),o.length=v+1,o.words=new Array(o.length);for(var m=0;m<o.length;m++)o.words[m]=0}var A=p.clone()._ishlnsubmul(y,1,v);A.negative===0&&(p=A,o&&(o.words[v]=1));for(var I=v-1;I>=0;I--){var F=(p.words[y.length+I]|0)*67108864+(p.words[y.length+I-1]|0);for(F=Math.min(F/b|0,67108863),p._ishlnsubmul(y,F,I);p.negative!==0;)F--,p.negative=0,p._ishlnsubmul(y,1,I),p.isZero()||(p.negative^=1);o&&(o.words[I]=F)}return o&&o.strip(),p.strip(),l!=="div"&&c!==0&&p.iushrn(c),{div:o||null,mod:p}},h.prototype.divmod=function(n,l,c){if(u(!n.isZero()),this.isZero())return{div:new h(0),mod:new h(0)};var p,y,b;return this.negative!==0&&n.negative===0?(b=this.neg().divmod(n,l),l!=="mod"&&(p=b.div.neg()),l!=="div"&&(y=b.mod.neg(),c&&y.negative!==0&&y.iadd(n)),{div:p,mod:y}):this.negative===0&&n.negative!==0?(b=this.divmod(n.neg(),l),l!=="mod"&&(p=b.div.neg()),{div:p,mod:b.mod}):this.negative&n.negative?(b=this.neg().divmod(n.neg(),l),l!=="div"&&(y=b.mod.neg(),c&&y.negative!==0&&y.isub(n)),{div:b.div,mod:y}):n.length>this.length||this.cmp(n)<0?{div:new h(0),mod:this}:n.length===1?l==="div"?{div:this.divn(n.words[0]),mod:null}:l==="mod"?{div:null,mod:new h(this.modn(n.words[0]))}:{div:this.divn(n.words[0]),mod:new h(this.modn(n.words[0]))}:this._wordDiv(n,l)},h.prototype.div=function(n){return this.divmod(n,"div",!1).div},h.prototype.mod=function(n){return this.divmod(n,"mod",!1).mod},h.prototype.umod=function(n){return this.divmod(n,"mod",!0).mod},h.prototype.divRound=function(n){var l=this.divmod(n);if(l.mod.isZero())return l.div;var c=l.div.negative!==0?l.mod.isub(n):l.mod,p=n.ushrn(1),y=n.andln(1),b=c.cmp(p);return b<0||y===1&&b===0?l.div:l.div.negative!==0?l.div.isubn(1):l.div.iaddn(1)},h.prototype.modn=function(n){u(n<=67108863);for(var l=(1<<26)%n,c=0,p=this.length-1;p>=0;p--)c=(l*c+(this.words[p]|0))%n;return c},h.prototype.idivn=function(n){u(n<=67108863);for(var l=0,c=this.length-1;c>=0;c--){var p=(this.words[c]|0)+l*67108864;this.words[c]=p/n|0,l=p%n}return this.strip()},h.prototype.divn=function(n){return this.clone().idivn(n)},h.prototype.egcd=function(n){u(n.negative===0),u(!n.isZero());var l=this,c=n.clone();l.negative!==0?l=l.umod(n):l=l.clone();for(var p=new h(1),y=new h(0),b=new h(0),_=new h(1),v=0;l.isEven()&&c.isEven();)l.iushrn(1),c.iushrn(1),++v;for(var o=c.clone(),m=l.clone();!l.isZero();){for(var A=0,I=1;!(l.words[0]&I)&&A<26;++A,I<<=1);if(A>0)for(l.iushrn(A);A-- >0;)(p.isOdd()||y.isOdd())&&(p.iadd(o),y.isub(m)),p.iushrn(1),y.iushrn(1);for(var F=0,X=1;!(c.words[0]&X)&&F<26;++F,X<<=1);if(F>0)for(c.iushrn(F);F-- >0;)(b.isOdd()||_.isOdd())&&(b.iadd(o),_.isub(m)),b.iushrn(1),_.iushrn(1);l.cmp(c)>=0?(l.isub(c),p.isub(b),y.isub(_)):(c.isub(l),b.isub(p),_.isub(y))}return{a:b,b:_,gcd:c.iushln(v)}},h.prototype._invmp=function(n){u(n.negative===0),u(!n.isZero());var l=this,c=n.clone();l.negative!==0?l=l.umod(n):l=l.clone();for(var p=new h(1),y=new h(0),b=c.clone();l.cmpn(1)>0&&c.cmpn(1)>0;){for(var _=0,v=1;!(l.words[0]&v)&&_<26;++_,v<<=1);if(_>0)for(l.iushrn(_);_-- >0;)p.isOdd()&&p.iadd(b),p.iushrn(1);for(var o=0,m=1;!(c.words[0]&m)&&o<26;++o,m<<=1);if(o>0)for(c.iushrn(o);o-- >0;)y.isOdd()&&y.iadd(b),y.iushrn(1);l.cmp(c)>=0?(l.isub(c),p.isub(y)):(c.isub(l),y.isub(p))}var A;return l.cmpn(1)===0?A=p:A=y,A.cmpn(0)<0&&A.iadd(n),A},h.prototype.gcd=function(n){if(this.isZero())return n.abs();if(n.isZero())return this.abs();var l=this.clone(),c=n.clone();l.negative=0,c.negative=0;for(var p=0;l.isEven()&&c.isEven();p++)l.iushrn(1),c.iushrn(1);do{for(;l.isEven();)l.iushrn(1);for(;c.isEven();)c.iushrn(1);var y=l.cmp(c);if(y<0){var b=l;l=c,c=b}else if(y===0||c.cmpn(1)===0)break;l.isub(c)}while(!0);return c.iushln(p)},h.prototype.invm=function(n){return this.egcd(n).a.umod(n)},h.prototype.isEven=function(){return(this.words[0]&1)===0},h.prototype.isOdd=function(){return(this.words[0]&1)===1},h.prototype.andln=function(n){return this.words[0]&n},h.prototype.bincn=function(n){u(typeof n=="number");var l=n%26,c=(n-l)/26,p=1<<l;if(this.length<=c)return this._expand(c+1),this.words[c]|=p,this;for(var y=p,b=c;y!==0&&b<this.length;b++){var _=this.words[b]|0;_+=y,y=_>>>26,_&=67108863,this.words[b]=_}return y!==0&&(this.words[b]=y,this.length++),this},h.prototype.isZero=function(){return this.length===1&&this.words[0]===0},h.prototype.cmpn=function(n){var l=n<0;if(this.negative!==0&&!l)return-1;if(this.negative===0&&l)return 1;this.strip();var c;if(this.length>1)c=1;else{l&&(n=-n),u(n<=67108863,"Number is too big");var p=this.words[0]|0;c=p===n?0:p<n?-1:1}return this.negative!==0?-c|0:c},h.prototype.cmp=function(n){if(this.negative!==0&&n.negative===0)return-1;if(this.negative===0&&n.negative!==0)return 1;var l=this.ucmp(n);return this.negative!==0?-l|0:l},h.prototype.ucmp=function(n){if(this.length>n.length)return 1;if(this.length<n.length)return-1;for(var l=0,c=this.length-1;c>=0;c--){var p=this.words[c]|0,y=n.words[c]|0;if(p!==y){p<y?l=-1:p>y&&(l=1);break}}return l},h.prototype.gtn=function(n){return this.cmpn(n)===1},h.prototype.gt=function(n){return this.cmp(n)===1},h.prototype.gten=function(n){return this.cmpn(n)>=0},h.prototype.gte=function(n){return this.cmp(n)>=0},h.prototype.ltn=function(n){return this.cmpn(n)===-1},h.prototype.lt=function(n){return this.cmp(n)===-1},h.prototype.lten=function(n){return this.cmpn(n)<=0},h.prototype.lte=function(n){return this.cmp(n)<=0},h.prototype.eqn=function(n){return this.cmpn(n)===0},h.prototype.eq=function(n){return this.cmp(n)===0},h.red=function(n){return new ie(n)},h.prototype.toRed=function(n){return u(!this.red,"Already a number in reduction context"),u(this.negative===0,"red works only with positives"),n.convertTo(this)._forceRed(n)},h.prototype.fromRed=function(){return u(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},h.prototype._forceRed=function(n){return this.red=n,this},h.prototype.forceRed=function(n){return u(!this.red,"Already a number in reduction context"),this._forceRed(n)},h.prototype.redAdd=function(n){return u(this.red,"redAdd works only with red numbers"),this.red.add(this,n)},h.prototype.redIAdd=function(n){return u(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,n)},h.prototype.redSub=function(n){return u(this.red,"redSub works only with red numbers"),this.red.sub(this,n)},h.prototype.redISub=function(n){return u(this.red,"redISub works only with red numbers"),this.red.isub(this,n)},h.prototype.redShl=function(n){return u(this.red,"redShl works only with red numbers"),this.red.shl(this,n)},h.prototype.redMul=function(n){return u(this.red,"redMul works only with red numbers"),this.red._verify2(this,n),this.red.mul(this,n)},h.prototype.redIMul=function(n){return u(this.red,"redMul works only with red numbers"),this.red._verify2(this,n),this.red.imul(this,n)},h.prototype.redSqr=function(){return u(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},h.prototype.redISqr=function(){return u(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},h.prototype.redSqrt=function(){return u(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},h.prototype.redInvm=function(){return u(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},h.prototype.redNeg=function(){return u(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},h.prototype.redPow=function(n){return u(this.red&&!n.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,n)};var J={k256:null,p224:null,p192:null,p25519:null};function Y($,n){this.name=$,this.p=new h(n,16),this.n=this.p.bitLength(),this.k=new h(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}Y.prototype._tmp=function(){var n=new h(null);return n.words=new Array(Math.ceil(this.n/13)),n},Y.prototype.ireduce=function(n){var l=n,c;do this.split(l,this.tmp),l=this.imulK(l),l=l.iadd(this.tmp),c=l.bitLength();while(c>this.n);var p=c<this.n?-1:l.ucmp(this.p);return p===0?(l.words[0]=0,l.length=1):p>0?l.isub(this.p):l.strip!==void 0?l.strip():l._strip(),l},Y.prototype.split=function(n,l){n.iushrn(this.n,0,l)},Y.prototype.imulK=function(n){return n.imul(this.k)};function ae(){Y.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}d(ae,Y),ae.prototype.split=function(n,l){for(var c=4194303,p=Math.min(n.length,9),y=0;y<p;y++)l.words[y]=n.words[y];if(l.length=p,n.length<=9){n.words[0]=0,n.length=1;return}var b=n.words[9];for(l.words[l.length++]=b&c,y=10;y<n.length;y++){var _=n.words[y]|0;n.words[y-10]=(_&c)<<4|b>>>22,b=_}b>>>=22,n.words[y-10]=b,b===0&&n.length>10?n.length-=10:n.length-=9},ae.prototype.imulK=function(n){n.words[n.length]=0,n.words[n.length+1]=0,n.length+=2;for(var l=0,c=0;c<n.length;c++){var p=n.words[c]|0;l+=p*977,n.words[c]=l&67108863,l=p*64+(l/67108864|0)}return n.words[n.length-1]===0&&(n.length--,n.words[n.length-1]===0&&n.length--),n};function oe(){Y.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}d(oe,Y);function ue(){Y.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}d(ue,Y);function se(){Y.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}d(se,Y),se.prototype.imulK=function(n){for(var l=0,c=0;c<n.length;c++){var p=(n.words[c]|0)*19+l,y=p&67108863;p>>>=26,n.words[c]=y,l=p}return l!==0&&(n.words[n.length++]=l),n},h._prime=function(n){if(J[n])return J[n];var l;if(n==="k256")l=new ae;else if(n==="p224")l=new oe;else if(n==="p192")l=new ue;else if(n==="p25519")l=new se;else throw new Error("Unknown prime "+n);return J[n]=l,l};function ie($){if(typeof $=="string"){var n=h._prime($);this.m=n.p,this.prime=n}else u($.gtn(1),"modulus must be greater than 1"),this.m=$,this.prime=null}ie.prototype._verify1=function(n){u(n.negative===0,"red works only with positives"),u(n.red,"red works only with red numbers")},ie.prototype._verify2=function(n,l){u((n.negative|l.negative)===0,"red works only with positives"),u(n.red&&n.red===l.red,"red works only with red numbers")},ie.prototype.imod=function(n){return this.prime?this.prime.ireduce(n)._forceRed(this):n.umod(this.m)._forceRed(this)},ie.prototype.neg=function(n){return n.isZero()?n.clone():this.m.sub(n)._forceRed(this)},ie.prototype.add=function(n,l){this._verify2(n,l);var c=n.add(l);return c.cmp(this.m)>=0&&c.isub(this.m),c._forceRed(this)},ie.prototype.iadd=function(n,l){this._verify2(n,l);var c=n.iadd(l);return c.cmp(this.m)>=0&&c.isub(this.m),c},ie.prototype.sub=function(n,l){this._verify2(n,l);var c=n.sub(l);return c.cmpn(0)<0&&c.iadd(this.m),c._forceRed(this)},ie.prototype.isub=function(n,l){this._verify2(n,l);var c=n.isub(l);return c.cmpn(0)<0&&c.iadd(this.m),c},ie.prototype.shl=function(n,l){return this._verify1(n),this.imod(n.ushln(l))},ie.prototype.imul=function(n,l){return this._verify2(n,l),this.imod(n.imul(l))},ie.prototype.mul=function(n,l){return this._verify2(n,l),this.imod(n.mul(l))},ie.prototype.isqr=function(n){return this.imul(n,n.clone())},ie.prototype.sqr=function(n){return this.mul(n,n)},ie.prototype.sqrt=function(n){if(n.isZero())return n.clone();var l=this.m.andln(3);if(u(l%2===1),l===3){var c=this.m.add(new h(1)).iushrn(2);return this.pow(n,c)}for(var p=this.m.subn(1),y=0;!p.isZero()&&p.andln(1)===0;)y++,p.iushrn(1);u(!p.isZero());var b=new h(1).toRed(this),_=b.redNeg(),v=this.m.subn(1).iushrn(1),o=this.m.bitLength();for(o=new h(2*o*o).toRed(this);this.pow(o,v).cmp(_)!==0;)o.redIAdd(_);for(var m=this.pow(o,p),A=this.pow(n,p.addn(1).iushrn(1)),I=this.pow(n,p),F=y;I.cmp(b)!==0;){for(var X=I,V=0;X.cmp(b)!==0;V++)X=X.redSqr();u(V<F);var T=this.pow(m,new h(1).iushln(F-V-1));A=A.redMul(T),m=T.redSqr(),I=I.redMul(m),F=V}return A},ie.prototype.invm=function(n){var l=n._invmp(this.m);return l.negative!==0?(l.negative=0,this.imod(l).redNeg()):this.imod(l)},ie.prototype.pow=function(n,l){if(l.isZero())return new h(1).toRed(this);if(l.cmpn(1)===0)return n.clone();var c=4,p=new Array(1<<c);p[0]=new h(1).toRed(this),p[1]=n;for(var y=2;y<p.length;y++)p[y]=this.mul(p[y-1],n);var b=p[0],_=0,v=0,o=l.bitLength()%26;for(o===0&&(o=26),y=l.length-1;y>=0;y--){for(var m=l.words[y],A=o-1;A>=0;A--){var I=m>>A&1;if(b!==p[0]&&(b=this.sqr(b)),I===0&&_===0){v=0;continue}_<<=1,_|=I,v++,!(v!==c&&(y!==0||A!==0))&&(b=this.mul(b,p[_]),v=0,_=0)}o=26}return b},ie.prototype.convertTo=function(n){var l=n.umod(this.m);return l===n?l.clone():l},ie.prototype.convertFrom=function(n){var l=n.clone();return l.red=null,l},h.mont=function(n){return new ce(n)};function ce($){ie.call(this,$),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new h(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}d(ce,ie),ce.prototype.convertTo=function(n){return this.imod(n.ushln(this.shift))},ce.prototype.convertFrom=function(n){var l=this.imod(n.mul(this.rinv));return l.red=null,l},ce.prototype.imul=function(n,l){if(n.isZero()||l.isZero())return n.words[0]=0,n.length=1,n;var c=n.imul(l),p=c.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),y=c.isub(p).iushrn(this.shift),b=y;return y.cmp(this.m)>=0?b=y.isub(this.m):y.cmpn(0)<0&&(b=y.iadd(this.m)),b._forceRed(this)},ce.prototype.mul=function(n,l){if(n.isZero()||l.isZero())return new h(0)._forceRed(this);var c=n.mul(l),p=c.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),y=c.isub(p).iushrn(this.shift),b=y;return y.cmp(this.m)>=0?b=y.isub(this.m):y.cmpn(0)<0&&(b=y.iadd(this.m)),b._forceRed(this)},ce.prototype.invm=function(n){var l=this.imod(n._invmp(this.m).mul(this.r2));return l._forceRed(this)}})(e,commonjsGlobal)})(bn$5);var bnExports$5=bn$5.exports,brorand={exports:{}},hasRequiredBrorand;function requireBrorand(){if(hasRequiredBrorand)return brorand.exports;hasRequiredBrorand=1;var e;brorand.exports=function(d){return e||(e=new t(null)),e.generate(d)};function t(u){this.rand=u}if(brorand.exports.Rand=t,t.prototype.generate=function(d){return this._rand(d)},t.prototype._rand=function(d){if(this.rand.getBytes)return this.rand.getBytes(d);for(var h=new Uint8Array(d),w=0;w<h.length;w++)h[w]=this.rand.getByte();return h},typeof self=="object")self.crypto&&self.crypto.getRandomValues?t.prototype._rand=function(d){var h=new Uint8Array(d);return self.crypto.getRandomValues(h),h}:self.msCrypto&&self.msCrypto.getRandomValues?t.prototype._rand=function(d){var h=new Uint8Array(d);return self.msCrypto.getRandomValues(h),h}:typeof window=="object"&&(t.prototype._rand=function(){throw new Error("Not implemented yet")});else try{var a=requireCryptoBrowserify();if(typeof a.randomBytes!="function")throw new Error("Not supported");t.prototype._rand=function(d){return a.randomBytes(d)}}catch{}return brorand.exports}var mr,hasRequiredMr;function requireMr(){if(hasRequiredMr)return mr;hasRequiredMr=1;var e=bnExports$5,t=requireBrorand();function a(u){this.rand=u||new t.Rand}return mr=a,a.create=function(d){return new a(d)},a.prototype._randbelow=function(d){var h=d.bitLength(),w=Math.ceil(h/8);do var x=new e(this.rand.generate(w));while(x.cmp(d)>=0);return x},a.prototype._randrange=function(d,h){var w=h.sub(d);return d.add(this._randbelow(w))},a.prototype.test=function(d,h,w){var x=d.bitLength(),M=e.mont(d),B=new e(1).toRed(M);h||(h=Math.max(1,x/48|0));for(var E=d.subn(1),S=0;!E.testn(S);S++);for(var k=d.shrn(S),C=E.toRed(M),q=!0;h>0;h--){var O=this._randrange(new e(2),E);w&&w(O);var U=O.toRed(M).redPow(k);if(!(U.cmp(B)===0||U.cmp(C)===0)){for(var P=1;P<S;P++){if(U=U.redSqr(),U.cmp(B)===0)return!1;if(U.cmp(C)===0)break}if(P===S)return!1}}return q},a.prototype.getDivisor=function(d,h){var w=d.bitLength(),x=e.mont(d),M=new e(1).toRed(x);h||(h=Math.max(1,w/48|0));for(var B=d.subn(1),E=0;!B.testn(E);E++);for(var S=d.shrn(E),k=B.toRed(x);h>0;h--){var C=this._randrange(new e(2),B),q=d.gcd(C);if(q.cmpn(1)!==0)return q;var O=C.toRed(x).redPow(S);if(!(O.cmp(M)===0||O.cmp(k)===0)){for(var U=1;U<E;U++){if(O=O.redSqr(),O.cmp(M)===0)return O.fromRed().subn(1).gcd(d);if(O.cmp(k)===0)break}if(U===E)return O=O.redSqr(),O.fromRed().subn(1).gcd(d)}}return!1},mr}var generatePrime,hasRequiredGeneratePrime;function requireGeneratePrime(){if(hasRequiredGeneratePrime)return generatePrime;hasRequiredGeneratePrime=1;var e=browserExports;generatePrime=U,U.simpleSieve=q,U.fermatTest=O;var t=bnExports$6,a=new t(24),u=requireMr(),d=new u,h=new t(1),w=new t(2),x=new t(5);new t(16),new t(8);var M=new t(10),B=new t(3);new t(7);var E=new t(11),S=new t(4);new t(12);var k=null;function C(){if(k!==null)return k;var P=1048576,L=[];L[0]=2;for(var J=1,Y=3;Y<P;Y+=2){for(var ae=Math.ceil(Math.sqrt(Y)),oe=0;oe<J&&L[oe]<=ae&&Y%L[oe]!==0;oe++);J!==oe&&L[oe]<=ae||(L[J++]=Y)}return k=L,L}function q(P){for(var L=C(),J=0;J<L.length;J++)if(P.modn(L[J])===0)return P.cmpn(L[J])===0;return!0}function O(P){var L=t.mont(P);return w.toRed(L).redPow(P.subn(1)).fromRed().cmpn(1)===0}function U(P,L){if(P<16)return L===2||L===5?new t([140,123]):new t([140,39]);L=new t(L);for(var J,Y;;){for(J=new t(e(Math.ceil(P/8)));J.bitLength()>P;)J.ishrn(1);if(J.isEven()&&J.iadd(h),J.testn(1)||J.iadd(w),L.cmp(w)){if(!L.cmp(x))for(;J.mod(M).cmp(B);)J.iadd(S)}else for(;J.mod(a).cmp(E);)J.iadd(S);if(Y=J.shrn(1),q(Y)&&q(J)&&O(Y)&&O(J)&&d.test(Y)&&d.test(J))return J}}return generatePrime}const modp1={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff"},modp2={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff"},modp5={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff"},modp14={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff"},modp15={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff"},modp16={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff"},modp17={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff"},modp18={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff"},require$$1$1={modp1,modp2,modp5,modp14,modp15,modp16,modp17,modp18};var dh,hasRequiredDh;function requireDh(){if(hasRequiredDh)return dh;hasRequiredDh=1;var e=bnExports$6,t=requireMr(),a=new t,u=new e(24),d=new e(11),h=new e(10),w=new e(3),x=new e(7),M=requireGeneratePrime(),B=browserExports;dh=q;function E(U,P){return P=P||"utf8",Buffer$F.isBuffer(U)||(U=new Buffer$F(U,P)),this._pub=new e(U),this}function S(U,P){return P=P||"utf8",Buffer$F.isBuffer(U)||(U=new Buffer$F(U,P)),this._priv=new e(U),this}var k={};function C(U,P){var L=P.toString("hex"),J=[L,U.toString(16)].join("_");if(J in k)return k[J];var Y=0;if(U.isEven()||!M.simpleSieve||!M.fermatTest(U)||!a.test(U))return Y+=1,L==="02"||L==="05"?Y+=8:Y+=4,k[J]=Y,Y;a.test(U.shrn(1))||(Y+=2);var ae;switch(L){case"02":U.mod(u).cmp(d)&&(Y+=8);break;case"05":ae=U.mod(h),ae.cmp(w)&&ae.cmp(x)&&(Y+=8);break;default:Y+=4}return k[J]=Y,Y}function q(U,P,L){this.setGenerator(P),this.__prime=new e(U),this._prime=e.mont(this.__prime),this._primeLen=U.length,this._pub=void 0,this._priv=void 0,this._primeCode=void 0,L?(this.setPublicKey=E,this.setPrivateKey=S):this._primeCode=8}Object.defineProperty(q.prototype,"verifyError",{enumerable:!0,get:function(){return typeof this._primeCode!="number"&&(this._primeCode=C(this.__prime,this.__gen)),this._primeCode}}),q.prototype.generateKeys=function(){return this._priv||(this._priv=new e(B(this._primeLen))),this._pub=this._gen.toRed(this._prime).redPow(this._priv).fromRed(),this.getPublicKey()},q.prototype.computeSecret=function(U){U=new e(U),U=U.toRed(this._prime);var P=U.redPow(this._priv).fromRed(),L=new Buffer$F(P.toArray()),J=this.getPrime();if(L.length<J.length){var Y=new Buffer$F(J.length-L.length);Y.fill(0),L=Buffer$F.concat([Y,L])}return L},q.prototype.getPublicKey=function(P){return O(this._pub,P)},q.prototype.getPrivateKey=function(P){return O(this._priv,P)},q.prototype.getPrime=function(U){return O(this.__prime,U)},q.prototype.getGenerator=function(U){return O(this._gen,U)},q.prototype.setGenerator=function(U,P){return P=P||"utf8",Buffer$F.isBuffer(U)||(U=new Buffer$F(U,P)),this.__gen=U,this._gen=new e(U),this};function O(U,P){var L=new Buffer$F(U.toArray());return P?L.toString(P):L}return dh}var hasRequiredBrowser$2;function requireBrowser$2(){if(hasRequiredBrowser$2)return browser$4;hasRequiredBrowser$2=1;var e=requireGeneratePrime(),t=require$$1$1,a=requireDh();function u(w){var x=new Buffer$F(t[w].prime,"hex"),M=new Buffer$F(t[w].gen,"hex");return new a(x,M)}var d={binary:!0,hex:!0,base64:!0};function h(w,x,M,B){return Buffer$F.isBuffer(x)||d[x]===void 0?h(w,"binary",x,M):(x=x||"binary",B=B||"binary",M=M||new Buffer$F([2]),Buffer$F.isBuffer(M)||(M=new Buffer$F(M,B)),typeof w=="number"?new a(e(w,M),M,!0):(Buffer$F.isBuffer(w)||(w=new Buffer$F(w,x)),new a(w,M,!0)))}return browser$4.DiffieHellmanGroup=browser$4.createDiffieHellmanGroup=browser$4.getDiffieHellman=u,browser$4.createDiffieHellman=browser$4.DiffieHellman=h,browser$4}var readableBrowser={exports:{}},toString={}.toString,isarray=Array.isArray||function(e){return toString.call(e)=="[object Array]"},streamBrowser=eventsExports.EventEmitter,safeBuffer$2={exports:{}};(function(e,t){var a=dist,u=a.Buffer;function d(w,x){for(var M in w)x[M]=w[M]}u.from&&u.alloc&&u.allocUnsafe&&u.allocUnsafeSlow?e.exports=a:(d(a,t),t.Buffer=h);function h(w,x,M){return u(w,x,M)}d(u,h),h.from=function(w,x,M){if(typeof w=="number")throw new TypeError("Argument must not be a number");return u(w,x,M)},h.alloc=function(w,x,M){if(typeof w!="number")throw new TypeError("Argument must be a number");var B=u(w);return x!==void 0?typeof M=="string"?B.fill(x,M):B.fill(x):B.fill(0),B},h.allocUnsafe=function(w){if(typeof w!="number")throw new TypeError("Argument must be a number");return u(w)},h.allocUnsafeSlow=function(w){if(typeof w!="number")throw new TypeError("Argument must be a number");return a.SlowBuffer(w)}})(safeBuffer$2,safeBuffer$2.exports);var safeBufferExports=safeBuffer$2.exports,BufferList={exports:{}},hasRequiredBufferList;function requireBufferList(){return hasRequiredBufferList||(hasRequiredBufferList=1,function(e){function t(h,w){if(!(h instanceof w))throw new TypeError("Cannot call a class as a function")}var a=safeBufferExports.Buffer,u=util$5;function d(h,w,x){h.copy(w,x)}e.exports=function(){function h(){t(this,h),this.head=null,this.tail=null,this.length=0}return h.prototype.push=function(x){var M={data:x,next:null};this.length>0?this.tail.next=M:this.head=M,this.tail=M,++this.length},h.prototype.unshift=function(x){var M={data:x,next:this.head};this.length===0&&(this.tail=M),this.head=M,++this.length},h.prototype.shift=function(){if(this.length!==0){var x=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,x}},h.prototype.clear=function(){this.head=this.tail=null,this.length=0},h.prototype.join=function(x){if(this.length===0)return"";for(var M=this.head,B=""+M.data;M=M.next;)B+=x+M.data;return B},h.prototype.concat=function(x){if(this.length===0)return a.alloc(0);for(var M=a.allocUnsafe(x>>>0),B=this.head,E=0;B;)d(B.data,M,E),E+=B.data.length,B=B.next;return M},h}(),u&&u.inspect&&u.inspect.custom&&(e.exports.prototype[u.inspect.custom]=function(){var h=u.inspect({length:this.length});return this.constructor.name+" "+h})}(BufferList)),BufferList.exports}var pna=processNextickArgsExports;function destroy(e,t){var a=this,u=this._readableState&&this._readableState.destroyed,d=this._writableState&&this._writableState.destroyed;return u||d?(t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,pna.nextTick(emitErrorNT,this,e)):pna.nextTick(emitErrorNT,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(h){!t&&h?a._writableState?a._writableState.errorEmitted||(a._writableState.errorEmitted=!0,pna.nextTick(emitErrorNT,a,h)):pna.nextTick(emitErrorNT,a,h):t&&t(h)}),this)}function undestroy(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function emitErrorNT(e,t){e.emit("error",t)}var destroy_1={destroy,undestroy},_stream_writable,hasRequired_stream_writable;function require_stream_writable(){if(hasRequired_stream_writable)return _stream_writable;hasRequired_stream_writable=1;var e=processNextickArgsExports;_stream_writable=O;function t(b){var _=this;this.next=null,this.entry=null,this.finish=function(){y(_,b)}}var a=!process$1.browser&&["v0.10","v0.9."].indexOf(process$1.version.slice(0,5))>-1?setImmediate:e.nextTick,u;O.WritableState=C;var d=Object.create(util$4);d.inherits=inherits_browserExports;var h={deprecate:browser$a},w=streamBrowser,x=safeBufferExports.Buffer,M=(typeof commonjsGlobal<"u"?commonjsGlobal:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function B(b){return x.from(b)}function E(b){return x.isBuffer(b)||b instanceof M}var S=destroy_1;d.inherits(O,w);function k(){}function C(b,_){u=u||require_stream_duplex(),b=b||{};var v=_ instanceof u;this.objectMode=!!b.objectMode,v&&(this.objectMode=this.objectMode||!!b.writableObjectMode);var o=b.highWaterMark,m=b.writableHighWaterMark,A=this.objectMode?16:16*1024;o||o===0?this.highWaterMark=o:v&&(m||m===0)?this.highWaterMark=m:this.highWaterMark=A,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var I=b.decodeStrings===!1;this.decodeStrings=!I,this.defaultEncoding=b.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(F){ue(_,F)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new t(this)}C.prototype.getBuffer=function(){for(var _=this.bufferedRequest,v=[];_;)v.push(_),_=_.next;return v},function(){try{Object.defineProperty(C.prototype,"buffer",{get:h.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}}();var q;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(q=Function.prototype[Symbol.hasInstance],Object.defineProperty(O,Symbol.hasInstance,{value:function(b){return q.call(this,b)?!0:this!==O?!1:b&&b._writableState instanceof C}})):q=function(b){return b instanceof this};function O(b){if(u=u||require_stream_duplex(),!q.call(O,this)&&!(this instanceof u))return new O(b);this._writableState=new C(b,this),this.writable=!0,b&&(typeof b.write=="function"&&(this._write=b.write),typeof b.writev=="function"&&(this._writev=b.writev),typeof b.destroy=="function"&&(this._destroy=b.destroy),typeof b.final=="function"&&(this._final=b.final)),w.call(this)}O.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))};function U(b,_){var v=new Error("write after end");b.emit("error",v),e.nextTick(_,v)}function P(b,_,v,o){var m=!0,A=!1;return v===null?A=new TypeError("May not write null values to stream"):typeof v!="string"&&v!==void 0&&!_.objectMode&&(A=new TypeError("Invalid non-string/buffer chunk")),A&&(b.emit("error",A),e.nextTick(o,A),m=!1),m}O.prototype.write=function(b,_,v){var o=this._writableState,m=!1,A=!o.objectMode&&E(b);return A&&!x.isBuffer(b)&&(b=B(b)),typeof _=="function"&&(v=_,_=null),A?_="buffer":_||(_=o.defaultEncoding),typeof v!="function"&&(v=k),o.ended?U(this,v):(A||P(this,o,b,v))&&(o.pendingcb++,m=J(this,o,A,b,_,v)),m},O.prototype.cork=function(){var b=this._writableState;b.corked++},O.prototype.uncork=function(){var b=this._writableState;b.corked&&(b.corked--,!b.writing&&!b.corked&&!b.bufferProcessing&&b.bufferedRequest&&ce(this,b))},O.prototype.setDefaultEncoding=function(_){if(typeof _=="string"&&(_=_.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((_+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+_);return this._writableState.defaultEncoding=_,this};function L(b,_,v){return!b.objectMode&&b.decodeStrings!==!1&&typeof _=="string"&&(_=x.from(_,v)),_}Object.defineProperty(O.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function J(b,_,v,o,m,A){if(!v){var I=L(_,o,m);o!==I&&(v=!0,m="buffer",o=I)}var F=_.objectMode?1:o.length;_.length+=F;var X=_.length<_.highWaterMark;if(X||(_.needDrain=!0),_.writing||_.corked){var V=_.lastBufferedRequest;_.lastBufferedRequest={chunk:o,encoding:m,isBuf:v,callback:A,next:null},V?V.next=_.lastBufferedRequest:_.bufferedRequest=_.lastBufferedRequest,_.bufferedRequestCount+=1}else Y(b,_,!1,F,o,m,A);return X}function Y(b,_,v,o,m,A,I){_.writelen=o,_.writecb=I,_.writing=!0,_.sync=!0,v?b._writev(m,_.onwrite):b._write(m,A,_.onwrite),_.sync=!1}function ae(b,_,v,o,m){--_.pendingcb,v?(e.nextTick(m,o),e.nextTick(c,b,_),b._writableState.errorEmitted=!0,b.emit("error",o)):(m(o),b._writableState.errorEmitted=!0,b.emit("error",o),c(b,_))}function oe(b){b.writing=!1,b.writecb=null,b.length-=b.writelen,b.writelen=0}function ue(b,_){var v=b._writableState,o=v.sync,m=v.writecb;if(oe(v),_)ae(b,v,o,_,m);else{var A=$(v);!A&&!v.corked&&!v.bufferProcessing&&v.bufferedRequest&&ce(b,v),o?a(se,b,v,A,m):se(b,v,A,m)}}function se(b,_,v,o){v||ie(b,_),_.pendingcb--,o(),c(b,_)}function ie(b,_){_.length===0&&_.needDrain&&(_.needDrain=!1,b.emit("drain"))}function ce(b,_){_.bufferProcessing=!0;var v=_.bufferedRequest;if(b._writev&&v&&v.next){var o=_.bufferedRequestCount,m=new Array(o),A=_.corkedRequestsFree;A.entry=v;for(var I=0,F=!0;v;)m[I]=v,v.isBuf||(F=!1),v=v.next,I+=1;m.allBuffers=F,Y(b,_,!0,_.length,m,"",A.finish),_.pendingcb++,_.lastBufferedRequest=null,A.next?(_.corkedRequestsFree=A.next,A.next=null):_.corkedRequestsFree=new t(_),_.bufferedRequestCount=0}else{for(;v;){var X=v.chunk,V=v.encoding,T=v.callback,D=_.objectMode?1:X.length;if(Y(b,_,!1,D,X,V,T),v=v.next,_.bufferedRequestCount--,_.writing)break}v===null&&(_.lastBufferedRequest=null)}_.bufferedRequest=v,_.bufferProcessing=!1}O.prototype._write=function(b,_,v){v(new Error("_write() is not implemented"))},O.prototype._writev=null,O.prototype.end=function(b,_,v){var o=this._writableState;typeof b=="function"?(v=b,b=null,_=null):typeof _=="function"&&(v=_,_=null),b!=null&&this.write(b,_),o.corked&&(o.corked=1,this.uncork()),o.ending||p(this,o,v)};function $(b){return b.ending&&b.length===0&&b.bufferedRequest===null&&!b.finished&&!b.writing}function n(b,_){b._final(function(v){_.pendingcb--,v&&b.emit("error",v),_.prefinished=!0,b.emit("prefinish"),c(b,_)})}function l(b,_){!_.prefinished&&!_.finalCalled&&(typeof b._final=="function"?(_.pendingcb++,_.finalCalled=!0,e.nextTick(n,b,_)):(_.prefinished=!0,b.emit("prefinish")))}function c(b,_){var v=$(_);return v&&(l(b,_),_.pendingcb===0&&(_.finished=!0,b.emit("finish"))),v}function p(b,_,v){_.ending=!0,c(b,_),v&&(_.finished?e.nextTick(v):b.once("finish",v)),_.ended=!0,b.writable=!1}function y(b,_,v){var o=b.entry;for(b.entry=null;o;){var m=o.callback;_.pendingcb--,m(v),o=o.next}_.corkedRequestsFree.next=b}return Object.defineProperty(O.prototype,"destroyed",{get:function(){return this._writableState===void 0?!1:this._writableState.destroyed},set:function(b){this._writableState&&(this._writableState.destroyed=b)}}),O.prototype.destroy=S.destroy,O.prototype._undestroy=S.undestroy,O.prototype._destroy=function(b,_){this.end(),_(b)},_stream_writable}var _stream_duplex,hasRequired_stream_duplex;function require_stream_duplex(){if(hasRequired_stream_duplex)return _stream_duplex;hasRequired_stream_duplex=1;var e=processNextickArgsExports,t=Object.keys||function(S){var k=[];for(var C in S)k.push(C);return k};_stream_duplex=M;var a=Object.create(util$4);a.inherits=inherits_browserExports;var u=require_stream_readable(),d=require_stream_writable();a.inherits(M,u);for(var h=t(d.prototype),w=0;w<h.length;w++){var x=h[w];M.prototype[x]||(M.prototype[x]=d.prototype[x])}function M(S){if(!(this instanceof M))return new M(S);u.call(this,S),d.call(this,S),S&&S.readable===!1&&(this.readable=!1),S&&S.writable===!1&&(this.writable=!1),this.allowHalfOpen=!0,S&&S.allowHalfOpen===!1&&(this.allowHalfOpen=!1),this.once("end",B)}Object.defineProperty(M.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function B(){this.allowHalfOpen||this._writableState.ended||e.nextTick(E,this)}function E(S){S.end()}return Object.defineProperty(M.prototype,"destroyed",{get:function(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set:function(S){this._readableState===void 0||this._writableState===void 0||(this._readableState.destroyed=S,this._writableState.destroyed=S)}}),M.prototype._destroy=function(S,k){this.push(null),this.end(),e.nextTick(k,S)},_stream_duplex}var string_decoder={},safeBuffer$1={exports:{}},hasRequiredSafeBuffer;function requireSafeBuffer(){return hasRequiredSafeBuffer||(hasRequiredSafeBuffer=1,function(e,t){var a=dist,u=a.Buffer;function d(w,x){for(var M in w)x[M]=w[M]}u.from&&u.alloc&&u.allocUnsafe&&u.allocUnsafeSlow?e.exports=a:(d(a,t),t.Buffer=h);function h(w,x,M){return u(w,x,M)}d(u,h),h.from=function(w,x,M){if(typeof w=="number")throw new TypeError("Argument must not be a number");return u(w,x,M)},h.alloc=function(w,x,M){if(typeof w!="number")throw new TypeError("Argument must be a number");var B=u(w);return x!==void 0?typeof M=="string"?B.fill(x,M):B.fill(x):B.fill(0),B},h.allocUnsafe=function(w){if(typeof w!="number")throw new TypeError("Argument must be a number");return u(w)},h.allocUnsafeSlow=function(w){if(typeof w!="number")throw new TypeError("Argument must be a number");return a.SlowBuffer(w)}}(safeBuffer$1,safeBuffer$1.exports)),safeBuffer$1.exports}var hasRequiredString_decoder;function requireString_decoder(){if(hasRequiredString_decoder)return string_decoder;hasRequiredString_decoder=1;var e=requireSafeBuffer().Buffer,t=e.isEncoding||function(P){switch(P=""+P,P&&P.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function a(P){if(!P)return"utf8";for(var L;;)switch(P){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return P;default:if(L)return;P=(""+P).toLowerCase(),L=!0}}function u(P){var L=a(P);if(typeof L!="string"&&(e.isEncoding===t||!t(P)))throw new Error("Unknown encoding: "+P);return L||P}string_decoder.StringDecoder=d;function d(P){this.encoding=u(P);var L;switch(this.encoding){case"utf16le":this.text=S,this.end=k,L=4;break;case"utf8":this.fillLast=M,L=4;break;case"base64":this.text=C,this.end=q,L=3;break;default:this.write=O,this.end=U;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=e.allocUnsafe(L)}d.prototype.write=function(P){if(P.length===0)return"";var L,J;if(this.lastNeed){if(L=this.fillLast(P),L===void 0)return"";J=this.lastNeed,this.lastNeed=0}else J=0;return J<P.length?L?L+this.text(P,J):this.text(P,J):L||""},d.prototype.end=E,d.prototype.text=B,d.prototype.fillLast=function(P){if(this.lastNeed<=P.length)return P.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);P.copy(this.lastChar,this.lastTotal-this.lastNeed,0,P.length),this.lastNeed-=P.length};function h(P){return P<=127?0:P>>5===6?2:P>>4===14?3:P>>3===30?4:P>>6===2?-1:-2}function w(P,L,J){var Y=L.length-1;if(Y<J)return 0;var ae=h(L[Y]);return ae>=0?(ae>0&&(P.lastNeed=ae-1),ae):--Y<J||ae===-2?0:(ae=h(L[Y]),ae>=0?(ae>0&&(P.lastNeed=ae-2),ae):--Y<J||ae===-2?0:(ae=h(L[Y]),ae>=0?(ae>0&&(ae===2?ae=0:P.lastNeed=ae-3),ae):0))}function x(P,L,J){if((L[0]&192)!==128)return P.lastNeed=0,"�";if(P.lastNeed>1&&L.length>1){if((L[1]&192)!==128)return P.lastNeed=1,"�";if(P.lastNeed>2&&L.length>2&&(L[2]&192)!==128)return P.lastNeed=2,"�"}}function M(P){var L=this.lastTotal-this.lastNeed,J=x(this,P);if(J!==void 0)return J;if(this.lastNeed<=P.length)return P.copy(this.lastChar,L,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);P.copy(this.lastChar,L,0,P.length),this.lastNeed-=P.length}function B(P,L){var J=w(this,P,L);if(!this.lastNeed)return P.toString("utf8",L);this.lastTotal=J;var Y=P.length-(J-this.lastNeed);return P.copy(this.lastChar,0,Y),P.toString("utf8",L,Y)}function E(P){var L=P&&P.length?this.write(P):"";return this.lastNeed?L+"�":L}function S(P,L){if((P.length-L)%2===0){var J=P.toString("utf16le",L);if(J){var Y=J.charCodeAt(J.length-1);if(Y>=55296&&Y<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=P[P.length-2],this.lastChar[1]=P[P.length-1],J.slice(0,-1)}return J}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=P[P.length-1],P.toString("utf16le",L,P.length-1)}function k(P){var L=P&&P.length?this.write(P):"";if(this.lastNeed){var J=this.lastTotal-this.lastNeed;return L+this.lastChar.toString("utf16le",0,J)}return L}function C(P,L){var J=(P.length-L)%3;return J===0?P.toString("base64",L):(this.lastNeed=3-J,this.lastTotal=3,J===1?this.lastChar[0]=P[P.length-1]:(this.lastChar[0]=P[P.length-2],this.lastChar[1]=P[P.length-1]),P.toString("base64",L,P.length-J))}function q(P){var L=P&&P.length?this.write(P):"";return this.lastNeed?L+this.lastChar.toString("base64",0,3-this.lastNeed):L}function O(P){return P.toString(this.encoding)}function U(P){return P&&P.length?this.write(P):""}return string_decoder}var _stream_readable,hasRequired_stream_readable;function require_stream_readable(){if(hasRequired_stream_readable)return _stream_readable;hasRequired_stream_readable=1;var e=processNextickArgsExports;_stream_readable=L;var t=isarray,a;L.ReadableState=P,eventsExports.EventEmitter;var u=function(T,D){return T.listeners(D).length},d=streamBrowser,h=safeBufferExports.Buffer,w=(typeof commonjsGlobal<"u"?commonjsGlobal:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function x(T){return h.from(T)}function M(T){return h.isBuffer(T)||T instanceof w}var B=Object.create(util$4);B.inherits=inherits_browserExports;var E=util$5,S=void 0;E&&E.debuglog?S=E.debuglog("stream"):S=function(){};var k=requireBufferList(),C=destroy_1,q;B.inherits(L,d);var O=["error","close","destroy","pause","resume"];function U(T,D,Z){if(typeof T.prependListener=="function")return T.prependListener(D,Z);!T._events||!T._events[D]?T.on(D,Z):t(T._events[D])?T._events[D].unshift(Z):T._events[D]=[Z,T._events[D]]}function P(T,D){a=a||require_stream_duplex(),T=T||{};var Z=D instanceof a;this.objectMode=!!T.objectMode,Z&&(this.objectMode=this.objectMode||!!T.readableObjectMode);var te=T.highWaterMark,ee=T.readableHighWaterMark,j=this.objectMode?16:16*1024;te||te===0?this.highWaterMark=te:Z&&(ee||ee===0)?this.highWaterMark=ee:this.highWaterMark=j,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new k,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=T.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,T.encoding&&(q||(q=requireString_decoder().StringDecoder),this.decoder=new q(T.encoding),this.encoding=T.encoding)}function L(T){if(a=a||require_stream_duplex(),!(this instanceof L))return new L(T);this._readableState=new P(T,this),this.readable=!0,T&&(typeof T.read=="function"&&(this._read=T.read),typeof T.destroy=="function"&&(this._destroy=T.destroy)),d.call(this)}Object.defineProperty(L.prototype,"destroyed",{get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(T){this._readableState&&(this._readableState.destroyed=T)}}),L.prototype.destroy=C.destroy,L.prototype._undestroy=C.undestroy,L.prototype._destroy=function(T,D){this.push(null),D(T)},L.prototype.push=function(T,D){var Z=this._readableState,te;return Z.objectMode?te=!0:typeof T=="string"&&(D=D||Z.defaultEncoding,D!==Z.encoding&&(T=h.from(T,D),D=""),te=!0),J(this,T,D,!1,te)},L.prototype.unshift=function(T){return J(this,T,null,!0,!1)};function J(T,D,Z,te,ee){var j=T._readableState;if(D===null)j.reading=!1,ce(T,j);else{var re;ee||(re=ae(j,D)),re?T.emit("error",re):j.objectMode||D&&D.length>0?(typeof D!="string"&&!j.objectMode&&Object.getPrototypeOf(D)!==h.prototype&&(D=x(D)),te?j.endEmitted?T.emit("error",new Error("stream.unshift() after end event")):Y(T,j,D,!0):j.ended?T.emit("error",new Error("stream.push() after EOF")):(j.reading=!1,j.decoder&&!Z?(D=j.decoder.write(D),j.objectMode||D.length!==0?Y(T,j,D,!1):l(T,j)):Y(T,j,D,!1))):te||(j.reading=!1)}return oe(j)}function Y(T,D,Z,te){D.flowing&&D.length===0&&!D.sync?(T.emit("data",Z),T.read(0)):(D.length+=D.objectMode?1:Z.length,te?D.buffer.unshift(Z):D.buffer.push(Z),D.needReadable&&$(T)),l(T,D)}function ae(T,D){var Z;return!M(D)&&typeof D!="string"&&D!==void 0&&!T.objectMode&&(Z=new TypeError("Invalid non-string/buffer chunk")),Z}function oe(T){return!T.ended&&(T.needReadable||T.length<T.highWaterMark||T.length===0)}L.prototype.isPaused=function(){return this._readableState.flowing===!1},L.prototype.setEncoding=function(T){return q||(q=requireString_decoder().StringDecoder),this._readableState.decoder=new q(T),this._readableState.encoding=T,this};var ue=8388608;function se(T){return T>=ue?T=ue:(T--,T|=T>>>1,T|=T>>>2,T|=T>>>4,T|=T>>>8,T|=T>>>16,T++),T}function ie(T,D){return T<=0||D.length===0&&D.ended?0:D.objectMode?1:T!==T?D.flowing&&D.length?D.buffer.head.data.length:D.length:(T>D.highWaterMark&&(D.highWaterMark=se(T)),T<=D.length?T:D.ended?D.length:(D.needReadable=!0,0))}L.prototype.read=function(T){S("read",T),T=parseInt(T,10);var D=this._readableState,Z=T;if(T!==0&&(D.emittedReadable=!1),T===0&&D.needReadable&&(D.length>=D.highWaterMark||D.ended))return S("read: emitReadable",D.length,D.ended),D.length===0&&D.ended?F(this):$(this),null;if(T=ie(T,D),T===0&&D.ended)return D.length===0&&F(this),null;var te=D.needReadable;S("need readable",te),(D.length===0||D.length-T<D.highWaterMark)&&(te=!0,S("length less than watermark",te)),D.ended||D.reading?(te=!1,S("reading or ended",te)):te&&(S("do read"),D.reading=!0,D.sync=!0,D.length===0&&(D.needReadable=!0),this._read(D.highWaterMark),D.sync=!1,D.reading||(T=ie(Z,D)));var ee;return T>0?ee=o(T,D):ee=null,ee===null?(D.needReadable=!0,T=0):D.length-=T,D.length===0&&(D.ended||(D.needReadable=!0),Z!==T&&D.ended&&F(this)),ee!==null&&this.emit("data",ee),ee};function ce(T,D){if(!D.ended){if(D.decoder){var Z=D.decoder.end();Z&&Z.length&&(D.buffer.push(Z),D.length+=D.objectMode?1:Z.length)}D.ended=!0,$(T)}}function $(T){var D=T._readableState;D.needReadable=!1,D.emittedReadable||(S("emitReadable",D.flowing),D.emittedReadable=!0,D.sync?e.nextTick(n,T):n(T))}function n(T){S("emit readable"),T.emit("readable"),v(T)}function l(T,D){D.readingMore||(D.readingMore=!0,e.nextTick(c,T,D))}function c(T,D){for(var Z=D.length;!D.reading&&!D.flowing&&!D.ended&&D.length<D.highWaterMark&&(S("maybeReadMore read 0"),T.read(0),Z!==D.length);)Z=D.length;D.readingMore=!1}L.prototype._read=function(T){this.emit("error",new Error("_read() is not implemented"))},L.prototype.pipe=function(T,D){var Z=this,te=this._readableState;switch(te.pipesCount){case 0:te.pipes=T;break;case 1:te.pipes=[te.pipes,T];break;default:te.pipes.push(T);break}te.pipesCount+=1,S("pipe count=%d opts=%j",te.pipesCount,D);var ee=(!D||D.end!==!1)&&T!==process$1.stdout&&T!==process$1.stderr,j=ee?qe:ze;te.endEmitted?e.nextTick(j):Z.once("end",j),T.on("unpipe",re);function re(me,ke){S("onunpipe"),me===Z&&ke&&ke.hasUnpiped===!1&&(ke.hasUnpiped=!0,je())}function qe(){S("onend"),T.end()}var de=p(Z);T.on("drain",de);var pe=!1;function je(){S("cleanup"),T.removeListener("close",_e),T.removeListener("finish",xe),T.removeListener("drain",de),T.removeListener("error",Ve),T.removeListener("unpipe",re),Z.removeListener("end",qe),Z.removeListener("end",ze),Z.removeListener("data",le),pe=!0,te.awaitDrain&&(!T._writableState||T._writableState.needDrain)&&de()}var we=!1;Z.on("data",le);function le(me){S("ondata"),we=!1;var ke=T.write(me);ke===!1&&!we&&((te.pipesCount===1&&te.pipes===T||te.pipesCount>1&&V(te.pipes,T)!==-1)&&!pe&&(S("false write response, pause",te.awaitDrain),te.awaitDrain++,we=!0),Z.pause())}function Ve(me){S("onerror",me),ze(),T.removeListener("error",Ve),u(T,"error")===0&&T.emit("error",me)}U(T,"error",Ve);function _e(){T.removeListener("finish",xe),ze()}T.once("close",_e);function xe(){S("onfinish"),T.removeListener("close",_e),ze()}T.once("finish",xe);function ze(){S("unpipe"),Z.unpipe(T)}return T.emit("pipe",Z),te.flowing||(S("pipe resume"),Z.resume()),T};function p(T){return function(){var D=T._readableState;S("pipeOnDrain",D.awaitDrain),D.awaitDrain&&D.awaitDrain--,D.awaitDrain===0&&u(T,"data")&&(D.flowing=!0,v(T))}}L.prototype.unpipe=function(T){var D=this._readableState,Z={hasUnpiped:!1};if(D.pipesCount===0)return this;if(D.pipesCount===1)return T&&T!==D.pipes?this:(T||(T=D.pipes),D.pipes=null,D.pipesCount=0,D.flowing=!1,T&&T.emit("unpipe",this,Z),this);if(!T){var te=D.pipes,ee=D.pipesCount;D.pipes=null,D.pipesCount=0,D.flowing=!1;for(var j=0;j<ee;j++)te[j].emit("unpipe",this,{hasUnpiped:!1});return this}var re=V(D.pipes,T);return re===-1?this:(D.pipes.splice(re,1),D.pipesCount-=1,D.pipesCount===1&&(D.pipes=D.pipes[0]),T.emit("unpipe",this,Z),this)},L.prototype.on=function(T,D){var Z=d.prototype.on.call(this,T,D);if(T==="data")this._readableState.flowing!==!1&&this.resume();else if(T==="readable"){var te=this._readableState;!te.endEmitted&&!te.readableListening&&(te.readableListening=te.needReadable=!0,te.emittedReadable=!1,te.reading?te.length&&$(this):e.nextTick(y,this))}return Z},L.prototype.addListener=L.prototype.on;function y(T){S("readable nexttick read 0"),T.read(0)}L.prototype.resume=function(){var T=this._readableState;return T.flowing||(S("resume"),T.flowing=!0,b(this,T)),this};function b(T,D){D.resumeScheduled||(D.resumeScheduled=!0,e.nextTick(_,T,D))}function _(T,D){D.reading||(S("resume read 0"),T.read(0)),D.resumeScheduled=!1,D.awaitDrain=0,T.emit("resume"),v(T),D.flowing&&!D.reading&&T.read(0)}L.prototype.pause=function(){return S("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(S("pause"),this._readableState.flowing=!1,this.emit("pause")),this};function v(T){var D=T._readableState;for(S("flow",D.flowing);D.flowing&&T.read()!==null;);}L.prototype.wrap=function(T){var D=this,Z=this._readableState,te=!1;T.on("end",function(){if(S("wrapped end"),Z.decoder&&!Z.ended){var re=Z.decoder.end();re&&re.length&&D.push(re)}D.push(null)}),T.on("data",function(re){if(S("wrapped data"),Z.decoder&&(re=Z.decoder.write(re)),!(Z.objectMode&&re==null)&&!(!Z.objectMode&&(!re||!re.length))){var qe=D.push(re);qe||(te=!0,T.pause())}});for(var ee in T)this[ee]===void 0&&typeof T[ee]=="function"&&(this[ee]=function(re){return function(){return T[re].apply(T,arguments)}}(ee));for(var j=0;j<O.length;j++)T.on(O[j],this.emit.bind(this,O[j]));return this._read=function(re){S("wrapped _read",re),te&&(te=!1,T.resume())},this},Object.defineProperty(L.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),L._fromList=o;function o(T,D){if(D.length===0)return null;var Z;return D.objectMode?Z=D.buffer.shift():!T||T>=D.length?(D.decoder?Z=D.buffer.join(""):D.buffer.length===1?Z=D.buffer.head.data:Z=D.buffer.concat(D.length),D.buffer.clear()):Z=m(T,D.buffer,D.decoder),Z}function m(T,D,Z){var te;return T<D.head.data.length?(te=D.head.data.slice(0,T),D.head.data=D.head.data.slice(T)):T===D.head.data.length?te=D.shift():te=Z?A(T,D):I(T,D),te}function A(T,D){var Z=D.head,te=1,ee=Z.data;for(T-=ee.length;Z=Z.next;){var j=Z.data,re=T>j.length?j.length:T;if(re===j.length?ee+=j:ee+=j.slice(0,T),T-=re,T===0){re===j.length?(++te,Z.next?D.head=Z.next:D.head=D.tail=null):(D.head=Z,Z.data=j.slice(re));break}++te}return D.length-=te,ee}function I(T,D){var Z=h.allocUnsafe(T),te=D.head,ee=1;for(te.data.copy(Z),T-=te.data.length;te=te.next;){var j=te.data,re=T>j.length?j.length:T;if(j.copy(Z,Z.length-T,0,re),T-=re,T===0){re===j.length?(++ee,te.next?D.head=te.next:D.head=D.tail=null):(D.head=te,te.data=j.slice(re));break}++ee}return D.length-=ee,Z}function F(T){var D=T._readableState;if(D.length>0)throw new Error('"endReadable()" called on non-empty stream');D.endEmitted||(D.ended=!0,e.nextTick(X,D,T))}function X(T,D){!T.endEmitted&&T.length===0&&(T.endEmitted=!0,D.readable=!1,D.emit("end"))}function V(T,D){for(var Z=0,te=T.length;Z<te;Z++)if(T[Z]===D)return Z;return-1}return _stream_readable}var _stream_transform=Transform$1,Duplex=require_stream_duplex(),util$1=Object.create(util$4);util$1.inherits=inherits_browserExports;util$1.inherits(Transform$1,Duplex);function afterTransform(e,t){var a=this._transformState;a.transforming=!1;var u=a.writecb;if(!u)return this.emit("error",new Error("write callback called multiple times"));a.writechunk=null,a.writecb=null,t!=null&&this.push(t),u(e);var d=this._readableState;d.reading=!1,(d.needReadable||d.length<d.highWaterMark)&&this._read(d.highWaterMark)}function Transform$1(e){if(!(this instanceof Transform$1))return new Transform$1(e);Duplex.call(this,e),this._transformState={afterTransform:afterTransform.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&(typeof e.transform=="function"&&(this._transform=e.transform),typeof e.flush=="function"&&(this._flush=e.flush)),this.on("prefinish",prefinish)}function prefinish(){var e=this;typeof this._flush=="function"?this._flush(function(t,a){done(e,t,a)}):done(this,null,null)}Transform$1.prototype.push=function(e,t){return this._transformState.needTransform=!1,Duplex.prototype.push.call(this,e,t)};Transform$1.prototype._transform=function(e,t,a){throw new Error("_transform() is not implemented")};Transform$1.prototype._write=function(e,t,a){var u=this._transformState;if(u.writecb=a,u.writechunk=e,u.writeencoding=t,!u.transforming){var d=this._readableState;(u.needTransform||d.needReadable||d.length<d.highWaterMark)&&this._read(d.highWaterMark)}};Transform$1.prototype._read=function(e){var t=this._transformState;t.writechunk!==null&&t.writecb&&!t.transforming?(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform)):t.needTransform=!0};Transform$1.prototype._destroy=function(e,t){var a=this;Duplex.prototype._destroy.call(this,e,function(u){t(u),a.emit("close")})};function done(e,t,a){if(t)return e.emit("error",t);if(a!=null&&e.push(a),e._writableState.length)throw new Error("Calling transform done when ws.length != 0");if(e._transformState.transforming)throw new Error("Calling transform done when still transforming");return e.push(null)}var _stream_passthrough=PassThrough,Transform=_stream_transform,util=Object.create(util$4);util.inherits=inherits_browserExports;util.inherits(PassThrough,Transform);function PassThrough(e){if(!(this instanceof PassThrough))return new PassThrough(e);Transform.call(this,e)}PassThrough.prototype._transform=function(e,t,a){a(null,e)};(function(e,t){t=e.exports=require_stream_readable(),t.Stream=t,t.Readable=t,t.Writable=require_stream_writable(),t.Duplex=require_stream_duplex(),t.Transform=_stream_transform,t.PassThrough=_stream_passthrough})(readableBrowser,readableBrowser.exports);var readableBrowserExports=readableBrowser.exports,sign={exports:{}},bn$4={exports:{}};bn$4.exports;(function(e){(function(t,a){function u(l,c){if(!l)throw new Error(c||"Assertion failed")}function d(l,c){l.super_=c;var p=function(){};p.prototype=c.prototype,l.prototype=new p,l.prototype.constructor=l}function h(l,c,p){if(h.isBN(l))return l;this.negative=0,this.words=null,this.length=0,this.red=null,l!==null&&((c==="le"||c==="be")&&(p=c,c=10),this._init(l||0,c||10,p||"be"))}typeof t=="object"?t.exports=h:a.BN=h,h.BN=h,h.wordSize=26;var w;try{typeof window<"u"&&typeof window.Buffer<"u"?w=window.Buffer:w=dist.Buffer}catch{}h.isBN=function(c){return c instanceof h?!0:c!==null&&typeof c=="object"&&c.constructor.wordSize===h.wordSize&&Array.isArray(c.words)},h.max=function(c,p){return c.cmp(p)>0?c:p},h.min=function(c,p){return c.cmp(p)<0?c:p},h.prototype._init=function(c,p,y){if(typeof c=="number")return this._initNumber(c,p,y);if(typeof c=="object")return this._initArray(c,p,y);p==="hex"&&(p=16),u(p===(p|0)&&p>=2&&p<=36),c=c.toString().replace(/\s+/g,"");var b=0;c[0]==="-"&&(b++,this.negative=1),b<c.length&&(p===16?this._parseHex(c,b,y):(this._parseBase(c,p,b),y==="le"&&this._initArray(this.toArray(),p,y)))},h.prototype._initNumber=function(c,p,y){c<0&&(this.negative=1,c=-c),c<67108864?(this.words=[c&67108863],this.length=1):c<4503599627370496?(this.words=[c&67108863,c/67108864&67108863],this.length=2):(u(c<9007199254740992),this.words=[c&67108863,c/67108864&67108863,1],this.length=3),y==="le"&&this._initArray(this.toArray(),p,y)},h.prototype._initArray=function(c,p,y){if(u(typeof c.length=="number"),c.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(c.length/3),this.words=new Array(this.length);for(var b=0;b<this.length;b++)this.words[b]=0;var _,v,o=0;if(y==="be")for(b=c.length-1,_=0;b>=0;b-=3)v=c[b]|c[b-1]<<8|c[b-2]<<16,this.words[_]|=v<<o&67108863,this.words[_+1]=v>>>26-o&67108863,o+=24,o>=26&&(o-=26,_++);else if(y==="le")for(b=0,_=0;b<c.length;b+=3)v=c[b]|c[b+1]<<8|c[b+2]<<16,this.words[_]|=v<<o&67108863,this.words[_+1]=v>>>26-o&67108863,o+=24,o>=26&&(o-=26,_++);return this._strip()};function x(l,c){var p=l.charCodeAt(c);if(p>=48&&p<=57)return p-48;if(p>=65&&p<=70)return p-55;if(p>=97&&p<=102)return p-87;u(!1,"Invalid character in "+l)}function M(l,c,p){var y=x(l,p);return p-1>=c&&(y|=x(l,p-1)<<4),y}h.prototype._parseHex=function(c,p,y){this.length=Math.ceil((c.length-p)/6),this.words=new Array(this.length);for(var b=0;b<this.length;b++)this.words[b]=0;var _=0,v=0,o;if(y==="be")for(b=c.length-1;b>=p;b-=2)o=M(c,p,b)<<_,this.words[v]|=o&67108863,_>=18?(_-=18,v+=1,this.words[v]|=o>>>26):_+=8;else{var m=c.length-p;for(b=m%2===0?p+1:p;b<c.length;b+=2)o=M(c,p,b)<<_,this.words[v]|=o&67108863,_>=18?(_-=18,v+=1,this.words[v]|=o>>>26):_+=8}this._strip()};function B(l,c,p,y){for(var b=0,_=0,v=Math.min(l.length,p),o=c;o<v;o++){var m=l.charCodeAt(o)-48;b*=y,m>=49?_=m-49+10:m>=17?_=m-17+10:_=m,u(m>=0&&_<y,"Invalid character"),b+=_}return b}h.prototype._parseBase=function(c,p,y){this.words=[0],this.length=1;for(var b=0,_=1;_<=67108863;_*=p)b++;b--,_=_/p|0;for(var v=c.length-y,o=v%b,m=Math.min(v,v-o)+y,A=0,I=y;I<m;I+=b)A=B(c,I,I+b,p),this.imuln(_),this.words[0]+A<67108864?this.words[0]+=A:this._iaddn(A);if(o!==0){var F=1;for(A=B(c,I,c.length,p),I=0;I<o;I++)F*=p;this.imuln(F),this.words[0]+A<67108864?this.words[0]+=A:this._iaddn(A)}this._strip()},h.prototype.copy=function(c){c.words=new Array(this.length);for(var p=0;p<this.length;p++)c.words[p]=this.words[p];c.length=this.length,c.negative=this.negative,c.red=this.red};function E(l,c){l.words=c.words,l.length=c.length,l.negative=c.negative,l.red=c.red}if(h.prototype._move=function(c){E(c,this)},h.prototype.clone=function(){var c=new h(null);return this.copy(c),c},h.prototype._expand=function(c){for(;this.length<c;)this.words[this.length++]=0;return this},h.prototype._strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},h.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{h.prototype[Symbol.for("nodejs.util.inspect.custom")]=S}catch{h.prototype.inspect=S}else h.prototype.inspect=S;function S(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var k=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],C=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],q=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];h.prototype.toString=function(c,p){c=c||10,p=p|0||1;var y;if(c===16||c==="hex"){y="";for(var b=0,_=0,v=0;v<this.length;v++){var o=this.words[v],m=((o<<b|_)&16777215).toString(16);_=o>>>24-b&16777215,b+=2,b>=26&&(b-=26,v--),_!==0||v!==this.length-1?y=k[6-m.length]+m+y:y=m+y}for(_!==0&&(y=_.toString(16)+y);y.length%p!==0;)y="0"+y;return this.negative!==0&&(y="-"+y),y}if(c===(c|0)&&c>=2&&c<=36){var A=C[c],I=q[c];y="";var F=this.clone();for(F.negative=0;!F.isZero();){var X=F.modrn(I).toString(c);F=F.idivn(I),F.isZero()?y=X+y:y=k[A-X.length]+X+y}for(this.isZero()&&(y="0"+y);y.length%p!==0;)y="0"+y;return this.negative!==0&&(y="-"+y),y}u(!1,"Base should be between 2 and 36")},h.prototype.toNumber=function(){var c=this.words[0];return this.length===2?c+=this.words[1]*67108864:this.length===3&&this.words[2]===1?c+=4503599627370496+this.words[1]*67108864:this.length>2&&u(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-c:c},h.prototype.toJSON=function(){return this.toString(16,2)},w&&(h.prototype.toBuffer=function(c,p){return this.toArrayLike(w,c,p)}),h.prototype.toArray=function(c,p){return this.toArrayLike(Array,c,p)};var O=function(c,p){return c.allocUnsafe?c.allocUnsafe(p):new c(p)};h.prototype.toArrayLike=function(c,p,y){this._strip();var b=this.byteLength(),_=y||Math.max(1,b);u(b<=_,"byte array longer than desired length"),u(_>0,"Requested array length <= 0");var v=O(c,_),o=p==="le"?"LE":"BE";return this["_toArrayLike"+o](v,b),v},h.prototype._toArrayLikeLE=function(c,p){for(var y=0,b=0,_=0,v=0;_<this.length;_++){var o=this.words[_]<<v|b;c[y++]=o&255,y<c.length&&(c[y++]=o>>8&255),y<c.length&&(c[y++]=o>>16&255),v===6?(y<c.length&&(c[y++]=o>>24&255),b=0,v=0):(b=o>>>24,v+=2)}if(y<c.length)for(c[y++]=b;y<c.length;)c[y++]=0},h.prototype._toArrayLikeBE=function(c,p){for(var y=c.length-1,b=0,_=0,v=0;_<this.length;_++){var o=this.words[_]<<v|b;c[y--]=o&255,y>=0&&(c[y--]=o>>8&255),y>=0&&(c[y--]=o>>16&255),v===6?(y>=0&&(c[y--]=o>>24&255),b=0,v=0):(b=o>>>24,v+=2)}if(y>=0)for(c[y--]=b;y>=0;)c[y--]=0},Math.clz32?h.prototype._countBits=function(c){return 32-Math.clz32(c)}:h.prototype._countBits=function(c){var p=c,y=0;return p>=4096&&(y+=13,p>>>=13),p>=64&&(y+=7,p>>>=7),p>=8&&(y+=4,p>>>=4),p>=2&&(y+=2,p>>>=2),y+p},h.prototype._zeroBits=function(c){if(c===0)return 26;var p=c,y=0;return p&8191||(y+=13,p>>>=13),p&127||(y+=7,p>>>=7),p&15||(y+=4,p>>>=4),p&3||(y+=2,p>>>=2),p&1||y++,y},h.prototype.bitLength=function(){var c=this.words[this.length-1],p=this._countBits(c);return(this.length-1)*26+p};function U(l){for(var c=new Array(l.bitLength()),p=0;p<c.length;p++){var y=p/26|0,b=p%26;c[p]=l.words[y]>>>b&1}return c}h.prototype.zeroBits=function(){if(this.isZero())return 0;for(var c=0,p=0;p<this.length;p++){var y=this._zeroBits(this.words[p]);if(c+=y,y!==26)break}return c},h.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},h.prototype.toTwos=function(c){return this.negative!==0?this.abs().inotn(c).iaddn(1):this.clone()},h.prototype.fromTwos=function(c){return this.testn(c-1)?this.notn(c).iaddn(1).ineg():this.clone()},h.prototype.isNeg=function(){return this.negative!==0},h.prototype.neg=function(){return this.clone().ineg()},h.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},h.prototype.iuor=function(c){for(;this.length<c.length;)this.words[this.length++]=0;for(var p=0;p<c.length;p++)this.words[p]=this.words[p]|c.words[p];return this._strip()},h.prototype.ior=function(c){return u((this.negative|c.negative)===0),this.iuor(c)},h.prototype.or=function(c){return this.length>c.length?this.clone().ior(c):c.clone().ior(this)},h.prototype.uor=function(c){return this.length>c.length?this.clone().iuor(c):c.clone().iuor(this)},h.prototype.iuand=function(c){var p;this.length>c.length?p=c:p=this;for(var y=0;y<p.length;y++)this.words[y]=this.words[y]&c.words[y];return this.length=p.length,this._strip()},h.prototype.iand=function(c){return u((this.negative|c.negative)===0),this.iuand(c)},h.prototype.and=function(c){return this.length>c.length?this.clone().iand(c):c.clone().iand(this)},h.prototype.uand=function(c){return this.length>c.length?this.clone().iuand(c):c.clone().iuand(this)},h.prototype.iuxor=function(c){var p,y;this.length>c.length?(p=this,y=c):(p=c,y=this);for(var b=0;b<y.length;b++)this.words[b]=p.words[b]^y.words[b];if(this!==p)for(;b<p.length;b++)this.words[b]=p.words[b];return this.length=p.length,this._strip()},h.prototype.ixor=function(c){return u((this.negative|c.negative)===0),this.iuxor(c)},h.prototype.xor=function(c){return this.length>c.length?this.clone().ixor(c):c.clone().ixor(this)},h.prototype.uxor=function(c){return this.length>c.length?this.clone().iuxor(c):c.clone().iuxor(this)},h.prototype.inotn=function(c){u(typeof c=="number"&&c>=0);var p=Math.ceil(c/26)|0,y=c%26;this._expand(p),y>0&&p--;for(var b=0;b<p;b++)this.words[b]=~this.words[b]&67108863;return y>0&&(this.words[b]=~this.words[b]&67108863>>26-y),this._strip()},h.prototype.notn=function(c){return this.clone().inotn(c)},h.prototype.setn=function(c,p){u(typeof c=="number"&&c>=0);var y=c/26|0,b=c%26;return this._expand(y+1),p?this.words[y]=this.words[y]|1<<b:this.words[y]=this.words[y]&~(1<<b),this._strip()},h.prototype.iadd=function(c){var p;if(this.negative!==0&&c.negative===0)return this.negative=0,p=this.isub(c),this.negative^=1,this._normSign();if(this.negative===0&&c.negative!==0)return c.negative=0,p=this.isub(c),c.negative=1,p._normSign();var y,b;this.length>c.length?(y=this,b=c):(y=c,b=this);for(var _=0,v=0;v<b.length;v++)p=(y.words[v]|0)+(b.words[v]|0)+_,this.words[v]=p&67108863,_=p>>>26;for(;_!==0&&v<y.length;v++)p=(y.words[v]|0)+_,this.words[v]=p&67108863,_=p>>>26;if(this.length=y.length,_!==0)this.words[this.length]=_,this.length++;else if(y!==this)for(;v<y.length;v++)this.words[v]=y.words[v];return this},h.prototype.add=function(c){var p;return c.negative!==0&&this.negative===0?(c.negative=0,p=this.sub(c),c.negative^=1,p):c.negative===0&&this.negative!==0?(this.negative=0,p=c.sub(this),this.negative=1,p):this.length>c.length?this.clone().iadd(c):c.clone().iadd(this)},h.prototype.isub=function(c){if(c.negative!==0){c.negative=0;var p=this.iadd(c);return c.negative=1,p._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(c),this.negative=1,this._normSign();var y=this.cmp(c);if(y===0)return this.negative=0,this.length=1,this.words[0]=0,this;var b,_;y>0?(b=this,_=c):(b=c,_=this);for(var v=0,o=0;o<_.length;o++)p=(b.words[o]|0)-(_.words[o]|0)+v,v=p>>26,this.words[o]=p&67108863;for(;v!==0&&o<b.length;o++)p=(b.words[o]|0)+v,v=p>>26,this.words[o]=p&67108863;if(v===0&&o<b.length&&b!==this)for(;o<b.length;o++)this.words[o]=b.words[o];return this.length=Math.max(this.length,o),b!==this&&(this.negative=1),this._strip()},h.prototype.sub=function(c){return this.clone().isub(c)};function P(l,c,p){p.negative=c.negative^l.negative;var y=l.length+c.length|0;p.length=y,y=y-1|0;var b=l.words[0]|0,_=c.words[0]|0,v=b*_,o=v&67108863,m=v/67108864|0;p.words[0]=o;for(var A=1;A<y;A++){for(var I=m>>>26,F=m&67108863,X=Math.min(A,c.length-1),V=Math.max(0,A-l.length+1);V<=X;V++){var T=A-V|0;b=l.words[T]|0,_=c.words[V]|0,v=b*_+F,I+=v/67108864|0,F=v&67108863}p.words[A]=F|0,m=I|0}return m!==0?p.words[A]=m|0:p.length--,p._strip()}var L=function(c,p,y){var b=c.words,_=p.words,v=y.words,o=0,m,A,I,F=b[0]|0,X=F&8191,V=F>>>13,T=b[1]|0,D=T&8191,Z=T>>>13,te=b[2]|0,ee=te&8191,j=te>>>13,re=b[3]|0,qe=re&8191,de=re>>>13,pe=b[4]|0,je=pe&8191,we=pe>>>13,le=b[5]|0,Ve=le&8191,_e=le>>>13,xe=b[6]|0,ze=xe&8191,me=xe>>>13,ke=b[7]|0,Ge=ke&8191,Me=ke>>>13,Ne=b[8]|0,Ze=Ne&8191,Be=Ne>>>13,De=b[9]|0,rt=De&8191,Ae=De>>>13,Oe=_[0]|0,Je=Oe&8191,Re=Oe>>>13,He=_[1]|0,Qe=He&8191,Te=He>>>13,Ue=_[2]|0,tt=Ue&8191,Ee=Ue>>>13,Pe=_[3]|0,et=Pe&8191,Ie=Pe>>>13,Le=_[4]|0,it=Le&8191,z=Le>>>13,N=_[5]|0,H=N&8191,Q=N>>>13,ne=_[6]|0,ve=ne&8191,he=ne>>>13,be=_[7]|0,We=be&8191,ye=be>>>13,Se=_[8]|0,Ke=Se&8191,Ce=Se>>>13,Fe=_[9]|0,Xe=Fe&8191,Ye=Fe>>>13;y.negative=c.negative^p.negative,y.length=19,m=Math.imul(X,Je),A=Math.imul(X,Re),A=A+Math.imul(V,Je)|0,I=Math.imul(V,Re);var nt=(o+m|0)+((A&8191)<<13)|0;o=(I+(A>>>13)|0)+(nt>>>26)|0,nt&=67108863,m=Math.imul(D,Je),A=Math.imul(D,Re),A=A+Math.imul(Z,Je)|0,I=Math.imul(Z,Re),m=m+Math.imul(X,Qe)|0,A=A+Math.imul(X,Te)|0,A=A+Math.imul(V,Qe)|0,I=I+Math.imul(V,Te)|0;var at=(o+m|0)+((A&8191)<<13)|0;o=(I+(A>>>13)|0)+(at>>>26)|0,at&=67108863,m=Math.imul(ee,Je),A=Math.imul(ee,Re),A=A+Math.imul(j,Je)|0,I=Math.imul(j,Re),m=m+Math.imul(D,Qe)|0,A=A+Math.imul(D,Te)|0,A=A+Math.imul(Z,Qe)|0,I=I+Math.imul(Z,Te)|0,m=m+Math.imul(X,tt)|0,A=A+Math.imul(X,Ee)|0,A=A+Math.imul(V,tt)|0,I=I+Math.imul(V,Ee)|0;var ot=(o+m|0)+((A&8191)<<13)|0;o=(I+(A>>>13)|0)+(ot>>>26)|0,ot&=67108863,m=Math.imul(qe,Je),A=Math.imul(qe,Re),A=A+Math.imul(de,Je)|0,I=Math.imul(de,Re),m=m+Math.imul(ee,Qe)|0,A=A+Math.imul(ee,Te)|0,A=A+Math.imul(j,Qe)|0,I=I+Math.imul(j,Te)|0,m=m+Math.imul(D,tt)|0,A=A+Math.imul(D,Ee)|0,A=A+Math.imul(Z,tt)|0,I=I+Math.imul(Z,Ee)|0,m=m+Math.imul(X,et)|0,A=A+Math.imul(X,Ie)|0,A=A+Math.imul(V,et)|0,I=I+Math.imul(V,Ie)|0;var st=(o+m|0)+((A&8191)<<13)|0;o=(I+(A>>>13)|0)+(st>>>26)|0,st&=67108863,m=Math.imul(je,Je),A=Math.imul(je,Re),A=A+Math.imul(we,Je)|0,I=Math.imul(we,Re),m=m+Math.imul(qe,Qe)|0,A=A+Math.imul(qe,Te)|0,A=A+Math.imul(de,Qe)|0,I=I+Math.imul(de,Te)|0,m=m+Math.imul(ee,tt)|0,A=A+Math.imul(ee,Ee)|0,A=A+Math.imul(j,tt)|0,I=I+Math.imul(j,Ee)|0,m=m+Math.imul(D,et)|0,A=A+Math.imul(D,Ie)|0,A=A+Math.imul(Z,et)|0,I=I+Math.imul(Z,Ie)|0,m=m+Math.imul(X,it)|0,A=A+Math.imul(X,z)|0,A=A+Math.imul(V,it)|0,I=I+Math.imul(V,z)|0;var ht=(o+m|0)+((A&8191)<<13)|0;o=(I+(A>>>13)|0)+(ht>>>26)|0,ht&=67108863,m=Math.imul(Ve,Je),A=Math.imul(Ve,Re),A=A+Math.imul(_e,Je)|0,I=Math.imul(_e,Re),m=m+Math.imul(je,Qe)|0,A=A+Math.imul(je,Te)|0,A=A+Math.imul(we,Qe)|0,I=I+Math.imul(we,Te)|0,m=m+Math.imul(qe,tt)|0,A=A+Math.imul(qe,Ee)|0,A=A+Math.imul(de,tt)|0,I=I+Math.imul(de,Ee)|0,m=m+Math.imul(ee,et)|0,A=A+Math.imul(ee,Ie)|0,A=A+Math.imul(j,et)|0,I=I+Math.imul(j,Ie)|0,m=m+Math.imul(D,it)|0,A=A+Math.imul(D,z)|0,A=A+Math.imul(Z,it)|0,I=I+Math.imul(Z,z)|0,m=m+Math.imul(X,H)|0,A=A+Math.imul(X,Q)|0,A=A+Math.imul(V,H)|0,I=I+Math.imul(V,Q)|0;var lt=(o+m|0)+((A&8191)<<13)|0;o=(I+(A>>>13)|0)+(lt>>>26)|0,lt&=67108863,m=Math.imul(ze,Je),A=Math.imul(ze,Re),A=A+Math.imul(me,Je)|0,I=Math.imul(me,Re),m=m+Math.imul(Ve,Qe)|0,A=A+Math.imul(Ve,Te)|0,A=A+Math.imul(_e,Qe)|0,I=I+Math.imul(_e,Te)|0,m=m+Math.imul(je,tt)|0,A=A+Math.imul(je,Ee)|0,A=A+Math.imul(we,tt)|0,I=I+Math.imul(we,Ee)|0,m=m+Math.imul(qe,et)|0,A=A+Math.imul(qe,Ie)|0,A=A+Math.imul(de,et)|0,I=I+Math.imul(de,Ie)|0,m=m+Math.imul(ee,it)|0,A=A+Math.imul(ee,z)|0,A=A+Math.imul(j,it)|0,I=I+Math.imul(j,z)|0,m=m+Math.imul(D,H)|0,A=A+Math.imul(D,Q)|0,A=A+Math.imul(Z,H)|0,I=I+Math.imul(Z,Q)|0,m=m+Math.imul(X,ve)|0,A=A+Math.imul(X,he)|0,A=A+Math.imul(V,ve)|0,I=I+Math.imul(V,he)|0;var ct=(o+m|0)+((A&8191)<<13)|0;o=(I+(A>>>13)|0)+(ct>>>26)|0,ct&=67108863,m=Math.imul(Ge,Je),A=Math.imul(Ge,Re),A=A+Math.imul(Me,Je)|0,I=Math.imul(Me,Re),m=m+Math.imul(ze,Qe)|0,A=A+Math.imul(ze,Te)|0,A=A+Math.imul(me,Qe)|0,I=I+Math.imul(me,Te)|0,m=m+Math.imul(Ve,tt)|0,A=A+Math.imul(Ve,Ee)|0,A=A+Math.imul(_e,tt)|0,I=I+Math.imul(_e,Ee)|0,m=m+Math.imul(je,et)|0,A=A+Math.imul(je,Ie)|0,A=A+Math.imul(we,et)|0,I=I+Math.imul(we,Ie)|0,m=m+Math.imul(qe,it)|0,A=A+Math.imul(qe,z)|0,A=A+Math.imul(de,it)|0,I=I+Math.imul(de,z)|0,m=m+Math.imul(ee,H)|0,A=A+Math.imul(ee,Q)|0,A=A+Math.imul(j,H)|0,I=I+Math.imul(j,Q)|0,m=m+Math.imul(D,ve)|0,A=A+Math.imul(D,he)|0,A=A+Math.imul(Z,ve)|0,I=I+Math.imul(Z,he)|0,m=m+Math.imul(X,We)|0,A=A+Math.imul(X,ye)|0,A=A+Math.imul(V,We)|0,I=I+Math.imul(V,ye)|0;var dt=(o+m|0)+((A&8191)<<13)|0;o=(I+(A>>>13)|0)+(dt>>>26)|0,dt&=67108863,m=Math.imul(Ze,Je),A=Math.imul(Ze,Re),A=A+Math.imul(Be,Je)|0,I=Math.imul(Be,Re),m=m+Math.imul(Ge,Qe)|0,A=A+Math.imul(Ge,Te)|0,A=A+Math.imul(Me,Qe)|0,I=I+Math.imul(Me,Te)|0,m=m+Math.imul(ze,tt)|0,A=A+Math.imul(ze,Ee)|0,A=A+Math.imul(me,tt)|0,I=I+Math.imul(me,Ee)|0,m=m+Math.imul(Ve,et)|0,A=A+Math.imul(Ve,Ie)|0,A=A+Math.imul(_e,et)|0,I=I+Math.imul(_e,Ie)|0,m=m+Math.imul(je,it)|0,A=A+Math.imul(je,z)|0,A=A+Math.imul(we,it)|0,I=I+Math.imul(we,z)|0,m=m+Math.imul(qe,H)|0,A=A+Math.imul(qe,Q)|0,A=A+Math.imul(de,H)|0,I=I+Math.imul(de,Q)|0,m=m+Math.imul(ee,ve)|0,A=A+Math.imul(ee,he)|0,A=A+Math.imul(j,ve)|0,I=I+Math.imul(j,he)|0,m=m+Math.imul(D,We)|0,A=A+Math.imul(D,ye)|0,A=A+Math.imul(Z,We)|0,I=I+Math.imul(Z,ye)|0,m=m+Math.imul(X,Ke)|0,A=A+Math.imul(X,Ce)|0,A=A+Math.imul(V,Ke)|0,I=I+Math.imul(V,Ce)|0;var pt=(o+m|0)+((A&8191)<<13)|0;o=(I+(A>>>13)|0)+(pt>>>26)|0,pt&=67108863,m=Math.imul(rt,Je),A=Math.imul(rt,Re),A=A+Math.imul(Ae,Je)|0,I=Math.imul(Ae,Re),m=m+Math.imul(Ze,Qe)|0,A=A+Math.imul(Ze,Te)|0,A=A+Math.imul(Be,Qe)|0,I=I+Math.imul(Be,Te)|0,m=m+Math.imul(Ge,tt)|0,A=A+Math.imul(Ge,Ee)|0,A=A+Math.imul(Me,tt)|0,I=I+Math.imul(Me,Ee)|0,m=m+Math.imul(ze,et)|0,A=A+Math.imul(ze,Ie)|0,A=A+Math.imul(me,et)|0,I=I+Math.imul(me,Ie)|0,m=m+Math.imul(Ve,it)|0,A=A+Math.imul(Ve,z)|0,A=A+Math.imul(_e,it)|0,I=I+Math.imul(_e,z)|0,m=m+Math.imul(je,H)|0,A=A+Math.imul(je,Q)|0,A=A+Math.imul(we,H)|0,I=I+Math.imul(we,Q)|0,m=m+Math.imul(qe,ve)|0,A=A+Math.imul(qe,he)|0,A=A+Math.imul(de,ve)|0,I=I+Math.imul(de,he)|0,m=m+Math.imul(ee,We)|0,A=A+Math.imul(ee,ye)|0,A=A+Math.imul(j,We)|0,I=I+Math.imul(j,ye)|0,m=m+Math.imul(D,Ke)|0,A=A+Math.imul(D,Ce)|0,A=A+Math.imul(Z,Ke)|0,I=I+Math.imul(Z,Ce)|0,m=m+Math.imul(X,Xe)|0,A=A+Math.imul(X,Ye)|0,A=A+Math.imul(V,Xe)|0,I=I+Math.imul(V,Ye)|0;var vt=(o+m|0)+((A&8191)<<13)|0;o=(I+(A>>>13)|0)+(vt>>>26)|0,vt&=67108863,m=Math.imul(rt,Qe),A=Math.imul(rt,Te),A=A+Math.imul(Ae,Qe)|0,I=Math.imul(Ae,Te),m=m+Math.imul(Ze,tt)|0,A=A+Math.imul(Ze,Ee)|0,A=A+Math.imul(Be,tt)|0,I=I+Math.imul(Be,Ee)|0,m=m+Math.imul(Ge,et)|0,A=A+Math.imul(Ge,Ie)|0,A=A+Math.imul(Me,et)|0,I=I+Math.imul(Me,Ie)|0,m=m+Math.imul(ze,it)|0,A=A+Math.imul(ze,z)|0,A=A+Math.imul(me,it)|0,I=I+Math.imul(me,z)|0,m=m+Math.imul(Ve,H)|0,A=A+Math.imul(Ve,Q)|0,A=A+Math.imul(_e,H)|0,I=I+Math.imul(_e,Q)|0,m=m+Math.imul(je,ve)|0,A=A+Math.imul(je,he)|0,A=A+Math.imul(we,ve)|0,I=I+Math.imul(we,he)|0,m=m+Math.imul(qe,We)|0,A=A+Math.imul(qe,ye)|0,A=A+Math.imul(de,We)|0,I=I+Math.imul(de,ye)|0,m=m+Math.imul(ee,Ke)|0,A=A+Math.imul(ee,Ce)|0,A=A+Math.imul(j,Ke)|0,I=I+Math.imul(j,Ce)|0,m=m+Math.imul(D,Xe)|0,A=A+Math.imul(D,Ye)|0,A=A+Math.imul(Z,Xe)|0,I=I+Math.imul(Z,Ye)|0;var yt=(o+m|0)+((A&8191)<<13)|0;o=(I+(A>>>13)|0)+(yt>>>26)|0,yt&=67108863,m=Math.imul(rt,tt),A=Math.imul(rt,Ee),A=A+Math.imul(Ae,tt)|0,I=Math.imul(Ae,Ee),m=m+Math.imul(Ze,et)|0,A=A+Math.imul(Ze,Ie)|0,A=A+Math.imul(Be,et)|0,I=I+Math.imul(Be,Ie)|0,m=m+Math.imul(Ge,it)|0,A=A+Math.imul(Ge,z)|0,A=A+Math.imul(Me,it)|0,I=I+Math.imul(Me,z)|0,m=m+Math.imul(ze,H)|0,A=A+Math.imul(ze,Q)|0,A=A+Math.imul(me,H)|0,I=I+Math.imul(me,Q)|0,m=m+Math.imul(Ve,ve)|0,A=A+Math.imul(Ve,he)|0,A=A+Math.imul(_e,ve)|0,I=I+Math.imul(_e,he)|0,m=m+Math.imul(je,We)|0,A=A+Math.imul(je,ye)|0,A=A+Math.imul(we,We)|0,I=I+Math.imul(we,ye)|0,m=m+Math.imul(qe,Ke)|0,A=A+Math.imul(qe,Ce)|0,A=A+Math.imul(de,Ke)|0,I=I+Math.imul(de,Ce)|0,m=m+Math.imul(ee,Xe)|0,A=A+Math.imul(ee,Ye)|0,A=A+Math.imul(j,Xe)|0,I=I+Math.imul(j,Ye)|0;var mt=(o+m|0)+((A&8191)<<13)|0;o=(I+(A>>>13)|0)+(mt>>>26)|0,mt&=67108863,m=Math.imul(rt,et),A=Math.imul(rt,Ie),A=A+Math.imul(Ae,et)|0,I=Math.imul(Ae,Ie),m=m+Math.imul(Ze,it)|0,A=A+Math.imul(Ze,z)|0,A=A+Math.imul(Be,it)|0,I=I+Math.imul(Be,z)|0,m=m+Math.imul(Ge,H)|0,A=A+Math.imul(Ge,Q)|0,A=A+Math.imul(Me,H)|0,I=I+Math.imul(Me,Q)|0,m=m+Math.imul(ze,ve)|0,A=A+Math.imul(ze,he)|0,A=A+Math.imul(me,ve)|0,I=I+Math.imul(me,he)|0,m=m+Math.imul(Ve,We)|0,A=A+Math.imul(Ve,ye)|0,A=A+Math.imul(_e,We)|0,I=I+Math.imul(_e,ye)|0,m=m+Math.imul(je,Ke)|0,A=A+Math.imul(je,Ce)|0,A=A+Math.imul(we,Ke)|0,I=I+Math.imul(we,Ce)|0,m=m+Math.imul(qe,Xe)|0,A=A+Math.imul(qe,Ye)|0,A=A+Math.imul(de,Xe)|0,I=I+Math.imul(de,Ye)|0;var gt=(o+m|0)+((A&8191)<<13)|0;o=(I+(A>>>13)|0)+(gt>>>26)|0,gt&=67108863,m=Math.imul(rt,it),A=Math.imul(rt,z),A=A+Math.imul(Ae,it)|0,I=Math.imul(Ae,z),m=m+Math.imul(Ze,H)|0,A=A+Math.imul(Ze,Q)|0,A=A+Math.imul(Be,H)|0,I=I+Math.imul(Be,Q)|0,m=m+Math.imul(Ge,ve)|0,A=A+Math.imul(Ge,he)|0,A=A+Math.imul(Me,ve)|0,I=I+Math.imul(Me,he)|0,m=m+Math.imul(ze,We)|0,A=A+Math.imul(ze,ye)|0,A=A+Math.imul(me,We)|0,I=I+Math.imul(me,ye)|0,m=m+Math.imul(Ve,Ke)|0,A=A+Math.imul(Ve,Ce)|0,A=A+Math.imul(_e,Ke)|0,I=I+Math.imul(_e,Ce)|0,m=m+Math.imul(je,Xe)|0,A=A+Math.imul(je,Ye)|0,A=A+Math.imul(we,Xe)|0,I=I+Math.imul(we,Ye)|0;var bt=(o+m|0)+((A&8191)<<13)|0;o=(I+(A>>>13)|0)+(bt>>>26)|0,bt&=67108863,m=Math.imul(rt,H),A=Math.imul(rt,Q),A=A+Math.imul(Ae,H)|0,I=Math.imul(Ae,Q),m=m+Math.imul(Ze,ve)|0,A=A+Math.imul(Ze,he)|0,A=A+Math.imul(Be,ve)|0,I=I+Math.imul(Be,he)|0,m=m+Math.imul(Ge,We)|0,A=A+Math.imul(Ge,ye)|0,A=A+Math.imul(Me,We)|0,I=I+Math.imul(Me,ye)|0,m=m+Math.imul(ze,Ke)|0,A=A+Math.imul(ze,Ce)|0,A=A+Math.imul(me,Ke)|0,I=I+Math.imul(me,Ce)|0,m=m+Math.imul(Ve,Xe)|0,A=A+Math.imul(Ve,Ye)|0,A=A+Math.imul(_e,Xe)|0,I=I+Math.imul(_e,Ye)|0;var wt=(o+m|0)+((A&8191)<<13)|0;o=(I+(A>>>13)|0)+(wt>>>26)|0,wt&=67108863,m=Math.imul(rt,ve),A=Math.imul(rt,he),A=A+Math.imul(Ae,ve)|0,I=Math.imul(Ae,he),m=m+Math.imul(Ze,We)|0,A=A+Math.imul(Ze,ye)|0,A=A+Math.imul(Be,We)|0,I=I+Math.imul(Be,ye)|0,m=m+Math.imul(Ge,Ke)|0,A=A+Math.imul(Ge,Ce)|0,A=A+Math.imul(Me,Ke)|0,I=I+Math.imul(Me,Ce)|0,m=m+Math.imul(ze,Xe)|0,A=A+Math.imul(ze,Ye)|0,A=A+Math.imul(me,Xe)|0,I=I+Math.imul(me,Ye)|0;var _t=(o+m|0)+((A&8191)<<13)|0;o=(I+(A>>>13)|0)+(_t>>>26)|0,_t&=67108863,m=Math.imul(rt,We),A=Math.imul(rt,ye),A=A+Math.imul(Ae,We)|0,I=Math.imul(Ae,ye),m=m+Math.imul(Ze,Ke)|0,A=A+Math.imul(Ze,Ce)|0,A=A+Math.imul(Be,Ke)|0,I=I+Math.imul(Be,Ce)|0,m=m+Math.imul(Ge,Xe)|0,A=A+Math.imul(Ge,Ye)|0,A=A+Math.imul(Me,Xe)|0,I=I+Math.imul(Me,Ye)|0;var xt=(o+m|0)+((A&8191)<<13)|0;o=(I+(A>>>13)|0)+(xt>>>26)|0,xt&=67108863,m=Math.imul(rt,Ke),A=Math.imul(rt,Ce),A=A+Math.imul(Ae,Ke)|0,I=Math.imul(Ae,Ce),m=m+Math.imul(Ze,Xe)|0,A=A+Math.imul(Ze,Ye)|0,A=A+Math.imul(Be,Xe)|0,I=I+Math.imul(Be,Ye)|0;var $t=(o+m|0)+((A&8191)<<13)|0;o=(I+(A>>>13)|0)+($t>>>26)|0,$t&=67108863,m=Math.imul(rt,Xe),A=Math.imul(rt,Ye),A=A+Math.imul(Ae,Xe)|0,I=Math.imul(Ae,Ye);var Mt=(o+m|0)+((A&8191)<<13)|0;return o=(I+(A>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,v[0]=nt,v[1]=at,v[2]=ot,v[3]=st,v[4]=ht,v[5]=lt,v[6]=ct,v[7]=dt,v[8]=pt,v[9]=vt,v[10]=yt,v[11]=mt,v[12]=gt,v[13]=bt,v[14]=wt,v[15]=_t,v[16]=xt,v[17]=$t,v[18]=Mt,o!==0&&(v[19]=o,y.length++),y};Math.imul||(L=P);function J(l,c,p){p.negative=c.negative^l.negative,p.length=l.length+c.length;for(var y=0,b=0,_=0;_<p.length-1;_++){var v=b;b=0;for(var o=y&67108863,m=Math.min(_,c.length-1),A=Math.max(0,_-l.length+1);A<=m;A++){var I=_-A,F=l.words[I]|0,X=c.words[A]|0,V=F*X,T=V&67108863;v=v+(V/67108864|0)|0,T=T+o|0,o=T&67108863,v=v+(T>>>26)|0,b+=v>>>26,v&=67108863}p.words[_]=o,y=v,v=b}return y!==0?p.words[_]=y:p.length--,p._strip()}function Y(l,c,p){return J(l,c,p)}h.prototype.mulTo=function(c,p){var y,b=this.length+c.length;return this.length===10&&c.length===10?y=L(this,c,p):b<63?y=P(this,c,p):b<1024?y=J(this,c,p):y=Y(this,c,p),y},h.prototype.mul=function(c){var p=new h(null);return p.words=new Array(this.length+c.length),this.mulTo(c,p)},h.prototype.mulf=function(c){var p=new h(null);return p.words=new Array(this.length+c.length),Y(this,c,p)},h.prototype.imul=function(c){return this.clone().mulTo(c,this)},h.prototype.imuln=function(c){var p=c<0;p&&(c=-c),u(typeof c=="number"),u(c<67108864);for(var y=0,b=0;b<this.length;b++){var _=(this.words[b]|0)*c,v=(_&67108863)+(y&67108863);y>>=26,y+=_/67108864|0,y+=v>>>26,this.words[b]=v&67108863}return y!==0&&(this.words[b]=y,this.length++),this.length=c===0?1:this.length,p?this.ineg():this},h.prototype.muln=function(c){return this.clone().imuln(c)},h.prototype.sqr=function(){return this.mul(this)},h.prototype.isqr=function(){return this.imul(this.clone())},h.prototype.pow=function(c){var p=U(c);if(p.length===0)return new h(1);for(var y=this,b=0;b<p.length&&p[b]===0;b++,y=y.sqr());if(++b<p.length)for(var _=y.sqr();b<p.length;b++,_=_.sqr())p[b]!==0&&(y=y.mul(_));return y},h.prototype.iushln=function(c){u(typeof c=="number"&&c>=0);var p=c%26,y=(c-p)/26,b=67108863>>>26-p<<26-p,_;if(p!==0){var v=0;for(_=0;_<this.length;_++){var o=this.words[_]&b,m=(this.words[_]|0)-o<<p;this.words[_]=m|v,v=o>>>26-p}v&&(this.words[_]=v,this.length++)}if(y!==0){for(_=this.length-1;_>=0;_--)this.words[_+y]=this.words[_];for(_=0;_<y;_++)this.words[_]=0;this.length+=y}return this._strip()},h.prototype.ishln=function(c){return u(this.negative===0),this.iushln(c)},h.prototype.iushrn=function(c,p,y){u(typeof c=="number"&&c>=0);var b;p?b=(p-p%26)/26:b=0;var _=c%26,v=Math.min((c-_)/26,this.length),o=67108863^67108863>>>_<<_,m=y;if(b-=v,b=Math.max(0,b),m){for(var A=0;A<v;A++)m.words[A]=this.words[A];m.length=v}if(v!==0)if(this.length>v)for(this.length-=v,A=0;A<this.length;A++)this.words[A]=this.words[A+v];else this.words[0]=0,this.length=1;var I=0;for(A=this.length-1;A>=0&&(I!==0||A>=b);A--){var F=this.words[A]|0;this.words[A]=I<<26-_|F>>>_,I=F&o}return m&&I!==0&&(m.words[m.length++]=I),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},h.prototype.ishrn=function(c,p,y){return u(this.negative===0),this.iushrn(c,p,y)},h.prototype.shln=function(c){return this.clone().ishln(c)},h.prototype.ushln=function(c){return this.clone().iushln(c)},h.prototype.shrn=function(c){return this.clone().ishrn(c)},h.prototype.ushrn=function(c){return this.clone().iushrn(c)},h.prototype.testn=function(c){u(typeof c=="number"&&c>=0);var p=c%26,y=(c-p)/26,b=1<<p;if(this.length<=y)return!1;var _=this.words[y];return!!(_&b)},h.prototype.imaskn=function(c){u(typeof c=="number"&&c>=0);var p=c%26,y=(c-p)/26;if(u(this.negative===0,"imaskn works only with positive numbers"),this.length<=y)return this;if(p!==0&&y++,this.length=Math.min(y,this.length),p!==0){var b=67108863^67108863>>>p<<p;this.words[this.length-1]&=b}return this._strip()},h.prototype.maskn=function(c){return this.clone().imaskn(c)},h.prototype.iaddn=function(c){return u(typeof c=="number"),u(c<67108864),c<0?this.isubn(-c):this.negative!==0?this.length===1&&(this.words[0]|0)<=c?(this.words[0]=c-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(c),this.negative=1,this):this._iaddn(c)},h.prototype._iaddn=function(c){this.words[0]+=c;for(var p=0;p<this.length&&this.words[p]>=67108864;p++)this.words[p]-=67108864,p===this.length-1?this.words[p+1]=1:this.words[p+1]++;return this.length=Math.max(this.length,p+1),this},h.prototype.isubn=function(c){if(u(typeof c=="number"),u(c<67108864),c<0)return this.iaddn(-c);if(this.negative!==0)return this.negative=0,this.iaddn(c),this.negative=1,this;if(this.words[0]-=c,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var p=0;p<this.length&&this.words[p]<0;p++)this.words[p]+=67108864,this.words[p+1]-=1;return this._strip()},h.prototype.addn=function(c){return this.clone().iaddn(c)},h.prototype.subn=function(c){return this.clone().isubn(c)},h.prototype.iabs=function(){return this.negative=0,this},h.prototype.abs=function(){return this.clone().iabs()},h.prototype._ishlnsubmul=function(c,p,y){var b=c.length+y,_;this._expand(b);var v,o=0;for(_=0;_<c.length;_++){v=(this.words[_+y]|0)+o;var m=(c.words[_]|0)*p;v-=m&67108863,o=(v>>26)-(m/67108864|0),this.words[_+y]=v&67108863}for(;_<this.length-y;_++)v=(this.words[_+y]|0)+o,o=v>>26,this.words[_+y]=v&67108863;if(o===0)return this._strip();for(u(o===-1),o=0,_=0;_<this.length;_++)v=-(this.words[_]|0)+o,o=v>>26,this.words[_]=v&67108863;return this.negative=1,this._strip()},h.prototype._wordDiv=function(c,p){var y=this.length-c.length,b=this.clone(),_=c,v=_.words[_.length-1]|0,o=this._countBits(v);y=26-o,y!==0&&(_=_.ushln(y),b.iushln(y),v=_.words[_.length-1]|0);var m=b.length-_.length,A;if(p!=="mod"){A=new h(null),A.length=m+1,A.words=new Array(A.length);for(var I=0;I<A.length;I++)A.words[I]=0}var F=b.clone()._ishlnsubmul(_,1,m);F.negative===0&&(b=F,A&&(A.words[m]=1));for(var X=m-1;X>=0;X--){var V=(b.words[_.length+X]|0)*67108864+(b.words[_.length+X-1]|0);for(V=Math.min(V/v|0,67108863),b._ishlnsubmul(_,V,X);b.negative!==0;)V--,b.negative=0,b._ishlnsubmul(_,1,X),b.isZero()||(b.negative^=1);A&&(A.words[X]=V)}return A&&A._strip(),b._strip(),p!=="div"&&y!==0&&b.iushrn(y),{div:A||null,mod:b}},h.prototype.divmod=function(c,p,y){if(u(!c.isZero()),this.isZero())return{div:new h(0),mod:new h(0)};var b,_,v;return this.negative!==0&&c.negative===0?(v=this.neg().divmod(c,p),p!=="mod"&&(b=v.div.neg()),p!=="div"&&(_=v.mod.neg(),y&&_.negative!==0&&_.iadd(c)),{div:b,mod:_}):this.negative===0&&c.negative!==0?(v=this.divmod(c.neg(),p),p!=="mod"&&(b=v.div.neg()),{div:b,mod:v.mod}):this.negative&c.negative?(v=this.neg().divmod(c.neg(),p),p!=="div"&&(_=v.mod.neg(),y&&_.negative!==0&&_.isub(c)),{div:v.div,mod:_}):c.length>this.length||this.cmp(c)<0?{div:new h(0),mod:this}:c.length===1?p==="div"?{div:this.divn(c.words[0]),mod:null}:p==="mod"?{div:null,mod:new h(this.modrn(c.words[0]))}:{div:this.divn(c.words[0]),mod:new h(this.modrn(c.words[0]))}:this._wordDiv(c,p)},h.prototype.div=function(c){return this.divmod(c,"div",!1).div},h.prototype.mod=function(c){return this.divmod(c,"mod",!1).mod},h.prototype.umod=function(c){return this.divmod(c,"mod",!0).mod},h.prototype.divRound=function(c){var p=this.divmod(c);if(p.mod.isZero())return p.div;var y=p.div.negative!==0?p.mod.isub(c):p.mod,b=c.ushrn(1),_=c.andln(1),v=y.cmp(b);return v<0||_===1&&v===0?p.div:p.div.negative!==0?p.div.isubn(1):p.div.iaddn(1)},h.prototype.modrn=function(c){var p=c<0;p&&(c=-c),u(c<=67108863);for(var y=(1<<26)%c,b=0,_=this.length-1;_>=0;_--)b=(y*b+(this.words[_]|0))%c;return p?-b:b},h.prototype.modn=function(c){return this.modrn(c)},h.prototype.idivn=function(c){var p=c<0;p&&(c=-c),u(c<=67108863);for(var y=0,b=this.length-1;b>=0;b--){var _=(this.words[b]|0)+y*67108864;this.words[b]=_/c|0,y=_%c}return this._strip(),p?this.ineg():this},h.prototype.divn=function(c){return this.clone().idivn(c)},h.prototype.egcd=function(c){u(c.negative===0),u(!c.isZero());var p=this,y=c.clone();p.negative!==0?p=p.umod(c):p=p.clone();for(var b=new h(1),_=new h(0),v=new h(0),o=new h(1),m=0;p.isEven()&&y.isEven();)p.iushrn(1),y.iushrn(1),++m;for(var A=y.clone(),I=p.clone();!p.isZero();){for(var F=0,X=1;!(p.words[0]&X)&&F<26;++F,X<<=1);if(F>0)for(p.iushrn(F);F-- >0;)(b.isOdd()||_.isOdd())&&(b.iadd(A),_.isub(I)),b.iushrn(1),_.iushrn(1);for(var V=0,T=1;!(y.words[0]&T)&&V<26;++V,T<<=1);if(V>0)for(y.iushrn(V);V-- >0;)(v.isOdd()||o.isOdd())&&(v.iadd(A),o.isub(I)),v.iushrn(1),o.iushrn(1);p.cmp(y)>=0?(p.isub(y),b.isub(v),_.isub(o)):(y.isub(p),v.isub(b),o.isub(_))}return{a:v,b:o,gcd:y.iushln(m)}},h.prototype._invmp=function(c){u(c.negative===0),u(!c.isZero());var p=this,y=c.clone();p.negative!==0?p=p.umod(c):p=p.clone();for(var b=new h(1),_=new h(0),v=y.clone();p.cmpn(1)>0&&y.cmpn(1)>0;){for(var o=0,m=1;!(p.words[0]&m)&&o<26;++o,m<<=1);if(o>0)for(p.iushrn(o);o-- >0;)b.isOdd()&&b.iadd(v),b.iushrn(1);for(var A=0,I=1;!(y.words[0]&I)&&A<26;++A,I<<=1);if(A>0)for(y.iushrn(A);A-- >0;)_.isOdd()&&_.iadd(v),_.iushrn(1);p.cmp(y)>=0?(p.isub(y),b.isub(_)):(y.isub(p),_.isub(b))}var F;return p.cmpn(1)===0?F=b:F=_,F.cmpn(0)<0&&F.iadd(c),F},h.prototype.gcd=function(c){if(this.isZero())return c.abs();if(c.isZero())return this.abs();var p=this.clone(),y=c.clone();p.negative=0,y.negative=0;for(var b=0;p.isEven()&&y.isEven();b++)p.iushrn(1),y.iushrn(1);do{for(;p.isEven();)p.iushrn(1);for(;y.isEven();)y.iushrn(1);var _=p.cmp(y);if(_<0){var v=p;p=y,y=v}else if(_===0||y.cmpn(1)===0)break;p.isub(y)}while(!0);return y.iushln(b)},h.prototype.invm=function(c){return this.egcd(c).a.umod(c)},h.prototype.isEven=function(){return(this.words[0]&1)===0},h.prototype.isOdd=function(){return(this.words[0]&1)===1},h.prototype.andln=function(c){return this.words[0]&c},h.prototype.bincn=function(c){u(typeof c=="number");var p=c%26,y=(c-p)/26,b=1<<p;if(this.length<=y)return this._expand(y+1),this.words[y]|=b,this;for(var _=b,v=y;_!==0&&v<this.length;v++){var o=this.words[v]|0;o+=_,_=o>>>26,o&=67108863,this.words[v]=o}return _!==0&&(this.words[v]=_,this.length++),this},h.prototype.isZero=function(){return this.length===1&&this.words[0]===0},h.prototype.cmpn=function(c){var p=c<0;if(this.negative!==0&&!p)return-1;if(this.negative===0&&p)return 1;this._strip();var y;if(this.length>1)y=1;else{p&&(c=-c),u(c<=67108863,"Number is too big");var b=this.words[0]|0;y=b===c?0:b<c?-1:1}return this.negative!==0?-y|0:y},h.prototype.cmp=function(c){if(this.negative!==0&&c.negative===0)return-1;if(this.negative===0&&c.negative!==0)return 1;var p=this.ucmp(c);return this.negative!==0?-p|0:p},h.prototype.ucmp=function(c){if(this.length>c.length)return 1;if(this.length<c.length)return-1;for(var p=0,y=this.length-1;y>=0;y--){var b=this.words[y]|0,_=c.words[y]|0;if(b!==_){b<_?p=-1:b>_&&(p=1);break}}return p},h.prototype.gtn=function(c){return this.cmpn(c)===1},h.prototype.gt=function(c){return this.cmp(c)===1},h.prototype.gten=function(c){return this.cmpn(c)>=0},h.prototype.gte=function(c){return this.cmp(c)>=0},h.prototype.ltn=function(c){return this.cmpn(c)===-1},h.prototype.lt=function(c){return this.cmp(c)===-1},h.prototype.lten=function(c){return this.cmpn(c)<=0},h.prototype.lte=function(c){return this.cmp(c)<=0},h.prototype.eqn=function(c){return this.cmpn(c)===0},h.prototype.eq=function(c){return this.cmp(c)===0},h.red=function(c){return new $(c)},h.prototype.toRed=function(c){return u(!this.red,"Already a number in reduction context"),u(this.negative===0,"red works only with positives"),c.convertTo(this)._forceRed(c)},h.prototype.fromRed=function(){return u(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},h.prototype._forceRed=function(c){return this.red=c,this},h.prototype.forceRed=function(c){return u(!this.red,"Already a number in reduction context"),this._forceRed(c)},h.prototype.redAdd=function(c){return u(this.red,"redAdd works only with red numbers"),this.red.add(this,c)},h.prototype.redIAdd=function(c){return u(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,c)},h.prototype.redSub=function(c){return u(this.red,"redSub works only with red numbers"),this.red.sub(this,c)},h.prototype.redISub=function(c){return u(this.red,"redISub works only with red numbers"),this.red.isub(this,c)},h.prototype.redShl=function(c){return u(this.red,"redShl works only with red numbers"),this.red.shl(this,c)},h.prototype.redMul=function(c){return u(this.red,"redMul works only with red numbers"),this.red._verify2(this,c),this.red.mul(this,c)},h.prototype.redIMul=function(c){return u(this.red,"redMul works only with red numbers"),this.red._verify2(this,c),this.red.imul(this,c)},h.prototype.redSqr=function(){return u(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},h.prototype.redISqr=function(){return u(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},h.prototype.redSqrt=function(){return u(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},h.prototype.redInvm=function(){return u(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},h.prototype.redNeg=function(){return u(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},h.prototype.redPow=function(c){return u(this.red&&!c.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,c)};var ae={k256:null,p224:null,p192:null,p25519:null};function oe(l,c){this.name=l,this.p=new h(c,16),this.n=this.p.bitLength(),this.k=new h(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}oe.prototype._tmp=function(){var c=new h(null);return c.words=new Array(Math.ceil(this.n/13)),c},oe.prototype.ireduce=function(c){var p=c,y;do this.split(p,this.tmp),p=this.imulK(p),p=p.iadd(this.tmp),y=p.bitLength();while(y>this.n);var b=y<this.n?-1:p.ucmp(this.p);return b===0?(p.words[0]=0,p.length=1):b>0?p.isub(this.p):p.strip!==void 0?p.strip():p._strip(),p},oe.prototype.split=function(c,p){c.iushrn(this.n,0,p)},oe.prototype.imulK=function(c){return c.imul(this.k)};function ue(){oe.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}d(ue,oe),ue.prototype.split=function(c,p){for(var y=4194303,b=Math.min(c.length,9),_=0;_<b;_++)p.words[_]=c.words[_];if(p.length=b,c.length<=9){c.words[0]=0,c.length=1;return}var v=c.words[9];for(p.words[p.length++]=v&y,_=10;_<c.length;_++){var o=c.words[_]|0;c.words[_-10]=(o&y)<<4|v>>>22,v=o}v>>>=22,c.words[_-10]=v,v===0&&c.length>10?c.length-=10:c.length-=9},ue.prototype.imulK=function(c){c.words[c.length]=0,c.words[c.length+1]=0,c.length+=2;for(var p=0,y=0;y<c.length;y++){var b=c.words[y]|0;p+=b*977,c.words[y]=p&67108863,p=b*64+(p/67108864|0)}return c.words[c.length-1]===0&&(c.length--,c.words[c.length-1]===0&&c.length--),c};function se(){oe.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}d(se,oe);function ie(){oe.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}d(ie,oe);function ce(){oe.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}d(ce,oe),ce.prototype.imulK=function(c){for(var p=0,y=0;y<c.length;y++){var b=(c.words[y]|0)*19+p,_=b&67108863;b>>>=26,c.words[y]=_,p=b}return p!==0&&(c.words[c.length++]=p),c},h._prime=function(c){if(ae[c])return ae[c];var p;if(c==="k256")p=new ue;else if(c==="p224")p=new se;else if(c==="p192")p=new ie;else if(c==="p25519")p=new ce;else throw new Error("Unknown prime "+c);return ae[c]=p,p};function $(l){if(typeof l=="string"){var c=h._prime(l);this.m=c.p,this.prime=c}else u(l.gtn(1),"modulus must be greater than 1"),this.m=l,this.prime=null}$.prototype._verify1=function(c){u(c.negative===0,"red works only with positives"),u(c.red,"red works only with red numbers")},$.prototype._verify2=function(c,p){u((c.negative|p.negative)===0,"red works only with positives"),u(c.red&&c.red===p.red,"red works only with red numbers")},$.prototype.imod=function(c){return this.prime?this.prime.ireduce(c)._forceRed(this):(E(c,c.umod(this.m)._forceRed(this)),c)},$.prototype.neg=function(c){return c.isZero()?c.clone():this.m.sub(c)._forceRed(this)},$.prototype.add=function(c,p){this._verify2(c,p);var y=c.add(p);return y.cmp(this.m)>=0&&y.isub(this.m),y._forceRed(this)},$.prototype.iadd=function(c,p){this._verify2(c,p);var y=c.iadd(p);return y.cmp(this.m)>=0&&y.isub(this.m),y},$.prototype.sub=function(c,p){this._verify2(c,p);var y=c.sub(p);return y.cmpn(0)<0&&y.iadd(this.m),y._forceRed(this)},$.prototype.isub=function(c,p){this._verify2(c,p);var y=c.isub(p);return y.cmpn(0)<0&&y.iadd(this.m),y},$.prototype.shl=function(c,p){return this._verify1(c),this.imod(c.ushln(p))},$.prototype.imul=function(c,p){return this._verify2(c,p),this.imod(c.imul(p))},$.prototype.mul=function(c,p){return this._verify2(c,p),this.imod(c.mul(p))},$.prototype.isqr=function(c){return this.imul(c,c.clone())},$.prototype.sqr=function(c){return this.mul(c,c)},$.prototype.sqrt=function(c){if(c.isZero())return c.clone();var p=this.m.andln(3);if(u(p%2===1),p===3){var y=this.m.add(new h(1)).iushrn(2);return this.pow(c,y)}for(var b=this.m.subn(1),_=0;!b.isZero()&&b.andln(1)===0;)_++,b.iushrn(1);u(!b.isZero());var v=new h(1).toRed(this),o=v.redNeg(),m=this.m.subn(1).iushrn(1),A=this.m.bitLength();for(A=new h(2*A*A).toRed(this);this.pow(A,m).cmp(o)!==0;)A.redIAdd(o);for(var I=this.pow(A,b),F=this.pow(c,b.addn(1).iushrn(1)),X=this.pow(c,b),V=_;X.cmp(v)!==0;){for(var T=X,D=0;T.cmp(v)!==0;D++)T=T.redSqr();u(D<V);var Z=this.pow(I,new h(1).iushln(V-D-1));F=F.redMul(Z),I=Z.redSqr(),X=X.redMul(I),V=D}return F},$.prototype.invm=function(c){var p=c._invmp(this.m);return p.negative!==0?(p.negative=0,this.imod(p).redNeg()):this.imod(p)},$.prototype.pow=function(c,p){if(p.isZero())return new h(1).toRed(this);if(p.cmpn(1)===0)return c.clone();var y=4,b=new Array(1<<y);b[0]=new h(1).toRed(this),b[1]=c;for(var _=2;_<b.length;_++)b[_]=this.mul(b[_-1],c);var v=b[0],o=0,m=0,A=p.bitLength()%26;for(A===0&&(A=26),_=p.length-1;_>=0;_--){for(var I=p.words[_],F=A-1;F>=0;F--){var X=I>>F&1;if(v!==b[0]&&(v=this.sqr(v)),X===0&&o===0){m=0;continue}o<<=1,o|=X,m++,!(m!==y&&(_!==0||F!==0))&&(v=this.mul(v,b[o]),m=0,o=0)}A=26}return v},$.prototype.convertTo=function(c){var p=c.umod(this.m);return p===c?p.clone():p},$.prototype.convertFrom=function(c){var p=c.clone();return p.red=null,p},h.mont=function(c){return new n(c)};function n(l){$.call(this,l),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new h(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}d(n,$),n.prototype.convertTo=function(c){return this.imod(c.ushln(this.shift))},n.prototype.convertFrom=function(c){var p=this.imod(c.mul(this.rinv));return p.red=null,p},n.prototype.imul=function(c,p){if(c.isZero()||p.isZero())return c.words[0]=0,c.length=1,c;var y=c.imul(p),b=y.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),_=y.isub(b).iushrn(this.shift),v=_;return _.cmp(this.m)>=0?v=_.isub(this.m):_.cmpn(0)<0&&(v=_.iadd(this.m)),v._forceRed(this)},n.prototype.mul=function(c,p){if(c.isZero()||p.isZero())return new h(0)._forceRed(this);var y=c.mul(p),b=y.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),_=y.isub(b).iushrn(this.shift),v=_;return _.cmp(this.m)>=0?v=_.isub(this.m):_.cmpn(0)<0&&(v=_.iadd(this.m)),v._forceRed(this)},n.prototype.invm=function(c){var p=this.imod(c._invmp(this.m).mul(this.r2));return p._forceRed(this)}})(e,commonjsGlobal)})(bn$4);var bnExports$4=bn$4.exports,BN$a=bnExports$4,randomBytes$2=browserExports,Buffer$7=safeBufferExports$2.Buffer;function getr(e){var t=e.modulus.byteLength(),a;do a=new BN$a(randomBytes$2(t));while(a.cmp(e.modulus)>=0||!a.umod(e.prime1)||!a.umod(e.prime2));return a}function blind(e){var t=getr(e),a=t.toRed(BN$a.mont(e.modulus)).redPow(new BN$a(e.publicExponent)).fromRed();return{blinder:a,unblinder:t.invm(e.modulus)}}function crt$2(e,t){var a=blind(t),u=t.modulus.byteLength(),d=new BN$a(e).mul(a.blinder).umod(t.modulus),h=d.toRed(BN$a.mont(t.prime1)),w=d.toRed(BN$a.mont(t.prime2)),x=t.coefficient,M=t.prime1,B=t.prime2,E=h.redPow(t.exponent1).fromRed(),S=w.redPow(t.exponent2).fromRed(),k=E.isub(S).imul(x).umod(M).imul(B);return S.iadd(k).imul(a.unblinder).umod(t.modulus).toArrayLike(Buffer$7,"be",u)}crt$2.getr=getr;var browserifyRsa=crt$2,elliptic={};const version="6.6.1",require$$0={version};var utils$l={},bn$3={exports:{}};bn$3.exports;(function(e){(function(t,a){function u($,n){if(!$)throw new Error(n||"Assertion failed")}function d($,n){$.super_=n;var l=function(){};l.prototype=n.prototype,$.prototype=new l,$.prototype.constructor=$}function h($,n,l){if(h.isBN($))return $;this.negative=0,this.words=null,this.length=0,this.red=null,$!==null&&((n==="le"||n==="be")&&(l=n,n=10),this._init($||0,n||10,l||"be"))}typeof t=="object"?t.exports=h:a.BN=h,h.BN=h,h.wordSize=26;var w;try{typeof window<"u"&&typeof window.Buffer<"u"?w=window.Buffer:w=dist.Buffer}catch{}h.isBN=function(n){return n instanceof h?!0:n!==null&&typeof n=="object"&&n.constructor.wordSize===h.wordSize&&Array.isArray(n.words)},h.max=function(n,l){return n.cmp(l)>0?n:l},h.min=function(n,l){return n.cmp(l)<0?n:l},h.prototype._init=function(n,l,c){if(typeof n=="number")return this._initNumber(n,l,c);if(typeof n=="object")return this._initArray(n,l,c);l==="hex"&&(l=16),u(l===(l|0)&&l>=2&&l<=36),n=n.toString().replace(/\s+/g,"");var p=0;n[0]==="-"&&(p++,this.negative=1),p<n.length&&(l===16?this._parseHex(n,p,c):(this._parseBase(n,l,p),c==="le"&&this._initArray(this.toArray(),l,c)))},h.prototype._initNumber=function(n,l,c){n<0&&(this.negative=1,n=-n),n<67108864?(this.words=[n&67108863],this.length=1):n<4503599627370496?(this.words=[n&67108863,n/67108864&67108863],this.length=2):(u(n<9007199254740992),this.words=[n&67108863,n/67108864&67108863,1],this.length=3),c==="le"&&this._initArray(this.toArray(),l,c)},h.prototype._initArray=function(n,l,c){if(u(typeof n.length=="number"),n.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(n.length/3),this.words=new Array(this.length);for(var p=0;p<this.length;p++)this.words[p]=0;var y,b,_=0;if(c==="be")for(p=n.length-1,y=0;p>=0;p-=3)b=n[p]|n[p-1]<<8|n[p-2]<<16,this.words[y]|=b<<_&67108863,this.words[y+1]=b>>>26-_&67108863,_+=24,_>=26&&(_-=26,y++);else if(c==="le")for(p=0,y=0;p<n.length;p+=3)b=n[p]|n[p+1]<<8|n[p+2]<<16,this.words[y]|=b<<_&67108863,this.words[y+1]=b>>>26-_&67108863,_+=24,_>=26&&(_-=26,y++);return this.strip()};function x($,n){var l=$.charCodeAt(n);return l>=65&&l<=70?l-55:l>=97&&l<=102?l-87:l-48&15}function M($,n,l){var c=x($,l);return l-1>=n&&(c|=x($,l-1)<<4),c}h.prototype._parseHex=function(n,l,c){this.length=Math.ceil((n.length-l)/6),this.words=new Array(this.length);for(var p=0;p<this.length;p++)this.words[p]=0;var y=0,b=0,_;if(c==="be")for(p=n.length-1;p>=l;p-=2)_=M(n,l,p)<<y,this.words[b]|=_&67108863,y>=18?(y-=18,b+=1,this.words[b]|=_>>>26):y+=8;else{var v=n.length-l;for(p=v%2===0?l+1:l;p<n.length;p+=2)_=M(n,l,p)<<y,this.words[b]|=_&67108863,y>=18?(y-=18,b+=1,this.words[b]|=_>>>26):y+=8}this.strip()};function B($,n,l,c){for(var p=0,y=Math.min($.length,l),b=n;b<y;b++){var _=$.charCodeAt(b)-48;p*=c,_>=49?p+=_-49+10:_>=17?p+=_-17+10:p+=_}return p}h.prototype._parseBase=function(n,l,c){this.words=[0],this.length=1;for(var p=0,y=1;y<=67108863;y*=l)p++;p--,y=y/l|0;for(var b=n.length-c,_=b%p,v=Math.min(b,b-_)+c,o=0,m=c;m<v;m+=p)o=B(n,m,m+p,l),this.imuln(y),this.words[0]+o<67108864?this.words[0]+=o:this._iaddn(o);if(_!==0){var A=1;for(o=B(n,m,n.length,l),m=0;m<_;m++)A*=l;this.imuln(A),this.words[0]+o<67108864?this.words[0]+=o:this._iaddn(o)}this.strip()},h.prototype.copy=function(n){n.words=new Array(this.length);for(var l=0;l<this.length;l++)n.words[l]=this.words[l];n.length=this.length,n.negative=this.negative,n.red=this.red},h.prototype.clone=function(){var n=new h(null);return this.copy(n),n},h.prototype._expand=function(n){for(;this.length<n;)this.words[this.length++]=0;return this},h.prototype.strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},h.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},h.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var E=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],S=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],k=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];h.prototype.toString=function(n,l){n=n||10,l=l|0||1;var c;if(n===16||n==="hex"){c="";for(var p=0,y=0,b=0;b<this.length;b++){var _=this.words[b],v=((_<<p|y)&16777215).toString(16);y=_>>>24-p&16777215,p+=2,p>=26&&(p-=26,b--),y!==0||b!==this.length-1?c=E[6-v.length]+v+c:c=v+c}for(y!==0&&(c=y.toString(16)+c);c.length%l!==0;)c="0"+c;return this.negative!==0&&(c="-"+c),c}if(n===(n|0)&&n>=2&&n<=36){var o=S[n],m=k[n];c="";var A=this.clone();for(A.negative=0;!A.isZero();){var I=A.modn(m).toString(n);A=A.idivn(m),A.isZero()?c=I+c:c=E[o-I.length]+I+c}for(this.isZero()&&(c="0"+c);c.length%l!==0;)c="0"+c;return this.negative!==0&&(c="-"+c),c}u(!1,"Base should be between 2 and 36")},h.prototype.toNumber=function(){var n=this.words[0];return this.length===2?n+=this.words[1]*67108864:this.length===3&&this.words[2]===1?n+=4503599627370496+this.words[1]*67108864:this.length>2&&u(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-n:n},h.prototype.toJSON=function(){return this.toString(16)},h.prototype.toBuffer=function(n,l){return u(typeof w<"u"),this.toArrayLike(w,n,l)},h.prototype.toArray=function(n,l){return this.toArrayLike(Array,n,l)},h.prototype.toArrayLike=function(n,l,c){var p=this.byteLength(),y=c||Math.max(1,p);u(p<=y,"byte array longer than desired length"),u(y>0,"Requested array length <= 0"),this.strip();var b=l==="le",_=new n(y),v,o,m=this.clone();if(b){for(o=0;!m.isZero();o++)v=m.andln(255),m.iushrn(8),_[o]=v;for(;o<y;o++)_[o]=0}else{for(o=0;o<y-p;o++)_[o]=0;for(o=0;!m.isZero();o++)v=m.andln(255),m.iushrn(8),_[y-o-1]=v}return _},Math.clz32?h.prototype._countBits=function(n){return 32-Math.clz32(n)}:h.prototype._countBits=function(n){var l=n,c=0;return l>=4096&&(c+=13,l>>>=13),l>=64&&(c+=7,l>>>=7),l>=8&&(c+=4,l>>>=4),l>=2&&(c+=2,l>>>=2),c+l},h.prototype._zeroBits=function(n){if(n===0)return 26;var l=n,c=0;return l&8191||(c+=13,l>>>=13),l&127||(c+=7,l>>>=7),l&15||(c+=4,l>>>=4),l&3||(c+=2,l>>>=2),l&1||c++,c},h.prototype.bitLength=function(){var n=this.words[this.length-1],l=this._countBits(n);return(this.length-1)*26+l};function C($){for(var n=new Array($.bitLength()),l=0;l<n.length;l++){var c=l/26|0,p=l%26;n[l]=($.words[c]&1<<p)>>>p}return n}h.prototype.zeroBits=function(){if(this.isZero())return 0;for(var n=0,l=0;l<this.length;l++){var c=this._zeroBits(this.words[l]);if(n+=c,c!==26)break}return n},h.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},h.prototype.toTwos=function(n){return this.negative!==0?this.abs().inotn(n).iaddn(1):this.clone()},h.prototype.fromTwos=function(n){return this.testn(n-1)?this.notn(n).iaddn(1).ineg():this.clone()},h.prototype.isNeg=function(){return this.negative!==0},h.prototype.neg=function(){return this.clone().ineg()},h.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},h.prototype.iuor=function(n){for(;this.length<n.length;)this.words[this.length++]=0;for(var l=0;l<n.length;l++)this.words[l]=this.words[l]|n.words[l];return this.strip()},h.prototype.ior=function(n){return u((this.negative|n.negative)===0),this.iuor(n)},h.prototype.or=function(n){return this.length>n.length?this.clone().ior(n):n.clone().ior(this)},h.prototype.uor=function(n){return this.length>n.length?this.clone().iuor(n):n.clone().iuor(this)},h.prototype.iuand=function(n){var l;this.length>n.length?l=n:l=this;for(var c=0;c<l.length;c++)this.words[c]=this.words[c]&n.words[c];return this.length=l.length,this.strip()},h.prototype.iand=function(n){return u((this.negative|n.negative)===0),this.iuand(n)},h.prototype.and=function(n){return this.length>n.length?this.clone().iand(n):n.clone().iand(this)},h.prototype.uand=function(n){return this.length>n.length?this.clone().iuand(n):n.clone().iuand(this)},h.prototype.iuxor=function(n){var l,c;this.length>n.length?(l=this,c=n):(l=n,c=this);for(var p=0;p<c.length;p++)this.words[p]=l.words[p]^c.words[p];if(this!==l)for(;p<l.length;p++)this.words[p]=l.words[p];return this.length=l.length,this.strip()},h.prototype.ixor=function(n){return u((this.negative|n.negative)===0),this.iuxor(n)},h.prototype.xor=function(n){return this.length>n.length?this.clone().ixor(n):n.clone().ixor(this)},h.prototype.uxor=function(n){return this.length>n.length?this.clone().iuxor(n):n.clone().iuxor(this)},h.prototype.inotn=function(n){u(typeof n=="number"&&n>=0);var l=Math.ceil(n/26)|0,c=n%26;this._expand(l),c>0&&l--;for(var p=0;p<l;p++)this.words[p]=~this.words[p]&67108863;return c>0&&(this.words[p]=~this.words[p]&67108863>>26-c),this.strip()},h.prototype.notn=function(n){return this.clone().inotn(n)},h.prototype.setn=function(n,l){u(typeof n=="number"&&n>=0);var c=n/26|0,p=n%26;return this._expand(c+1),l?this.words[c]=this.words[c]|1<<p:this.words[c]=this.words[c]&~(1<<p),this.strip()},h.prototype.iadd=function(n){var l;if(this.negative!==0&&n.negative===0)return this.negative=0,l=this.isub(n),this.negative^=1,this._normSign();if(this.negative===0&&n.negative!==0)return n.negative=0,l=this.isub(n),n.negative=1,l._normSign();var c,p;this.length>n.length?(c=this,p=n):(c=n,p=this);for(var y=0,b=0;b<p.length;b++)l=(c.words[b]|0)+(p.words[b]|0)+y,this.words[b]=l&67108863,y=l>>>26;for(;y!==0&&b<c.length;b++)l=(c.words[b]|0)+y,this.words[b]=l&67108863,y=l>>>26;if(this.length=c.length,y!==0)this.words[this.length]=y,this.length++;else if(c!==this)for(;b<c.length;b++)this.words[b]=c.words[b];return this},h.prototype.add=function(n){var l;return n.negative!==0&&this.negative===0?(n.negative=0,l=this.sub(n),n.negative^=1,l):n.negative===0&&this.negative!==0?(this.negative=0,l=n.sub(this),this.negative=1,l):this.length>n.length?this.clone().iadd(n):n.clone().iadd(this)},h.prototype.isub=function(n){if(n.negative!==0){n.negative=0;var l=this.iadd(n);return n.negative=1,l._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(n),this.negative=1,this._normSign();var c=this.cmp(n);if(c===0)return this.negative=0,this.length=1,this.words[0]=0,this;var p,y;c>0?(p=this,y=n):(p=n,y=this);for(var b=0,_=0;_<y.length;_++)l=(p.words[_]|0)-(y.words[_]|0)+b,b=l>>26,this.words[_]=l&67108863;for(;b!==0&&_<p.length;_++)l=(p.words[_]|0)+b,b=l>>26,this.words[_]=l&67108863;if(b===0&&_<p.length&&p!==this)for(;_<p.length;_++)this.words[_]=p.words[_];return this.length=Math.max(this.length,_),p!==this&&(this.negative=1),this.strip()},h.prototype.sub=function(n){return this.clone().isub(n)};function q($,n,l){l.negative=n.negative^$.negative;var c=$.length+n.length|0;l.length=c,c=c-1|0;var p=$.words[0]|0,y=n.words[0]|0,b=p*y,_=b&67108863,v=b/67108864|0;l.words[0]=_;for(var o=1;o<c;o++){for(var m=v>>>26,A=v&67108863,I=Math.min(o,n.length-1),F=Math.max(0,o-$.length+1);F<=I;F++){var X=o-F|0;p=$.words[X]|0,y=n.words[F]|0,b=p*y+A,m+=b/67108864|0,A=b&67108863}l.words[o]=A|0,v=m|0}return v!==0?l.words[o]=v|0:l.length--,l.strip()}var O=function(n,l,c){var p=n.words,y=l.words,b=c.words,_=0,v,o,m,A=p[0]|0,I=A&8191,F=A>>>13,X=p[1]|0,V=X&8191,T=X>>>13,D=p[2]|0,Z=D&8191,te=D>>>13,ee=p[3]|0,j=ee&8191,re=ee>>>13,qe=p[4]|0,de=qe&8191,pe=qe>>>13,je=p[5]|0,we=je&8191,le=je>>>13,Ve=p[6]|0,_e=Ve&8191,xe=Ve>>>13,ze=p[7]|0,me=ze&8191,ke=ze>>>13,Ge=p[8]|0,Me=Ge&8191,Ne=Ge>>>13,Ze=p[9]|0,Be=Ze&8191,De=Ze>>>13,rt=y[0]|0,Ae=rt&8191,Oe=rt>>>13,Je=y[1]|0,Re=Je&8191,He=Je>>>13,Qe=y[2]|0,Te=Qe&8191,Ue=Qe>>>13,tt=y[3]|0,Ee=tt&8191,Pe=tt>>>13,et=y[4]|0,Ie=et&8191,Le=et>>>13,it=y[5]|0,z=it&8191,N=it>>>13,H=y[6]|0,Q=H&8191,ne=H>>>13,ve=y[7]|0,he=ve&8191,be=ve>>>13,We=y[8]|0,ye=We&8191,Se=We>>>13,Ke=y[9]|0,Ce=Ke&8191,Fe=Ke>>>13;c.negative=n.negative^l.negative,c.length=19,v=Math.imul(I,Ae),o=Math.imul(I,Oe),o=o+Math.imul(F,Ae)|0,m=Math.imul(F,Oe);var Xe=(_+v|0)+((o&8191)<<13)|0;_=(m+(o>>>13)|0)+(Xe>>>26)|0,Xe&=67108863,v=Math.imul(V,Ae),o=Math.imul(V,Oe),o=o+Math.imul(T,Ae)|0,m=Math.imul(T,Oe),v=v+Math.imul(I,Re)|0,o=o+Math.imul(I,He)|0,o=o+Math.imul(F,Re)|0,m=m+Math.imul(F,He)|0;var Ye=(_+v|0)+((o&8191)<<13)|0;_=(m+(o>>>13)|0)+(Ye>>>26)|0,Ye&=67108863,v=Math.imul(Z,Ae),o=Math.imul(Z,Oe),o=o+Math.imul(te,Ae)|0,m=Math.imul(te,Oe),v=v+Math.imul(V,Re)|0,o=o+Math.imul(V,He)|0,o=o+Math.imul(T,Re)|0,m=m+Math.imul(T,He)|0,v=v+Math.imul(I,Te)|0,o=o+Math.imul(I,Ue)|0,o=o+Math.imul(F,Te)|0,m=m+Math.imul(F,Ue)|0;var nt=(_+v|0)+((o&8191)<<13)|0;_=(m+(o>>>13)|0)+(nt>>>26)|0,nt&=67108863,v=Math.imul(j,Ae),o=Math.imul(j,Oe),o=o+Math.imul(re,Ae)|0,m=Math.imul(re,Oe),v=v+Math.imul(Z,Re)|0,o=o+Math.imul(Z,He)|0,o=o+Math.imul(te,Re)|0,m=m+Math.imul(te,He)|0,v=v+Math.imul(V,Te)|0,o=o+Math.imul(V,Ue)|0,o=o+Math.imul(T,Te)|0,m=m+Math.imul(T,Ue)|0,v=v+Math.imul(I,Ee)|0,o=o+Math.imul(I,Pe)|0,o=o+Math.imul(F,Ee)|0,m=m+Math.imul(F,Pe)|0;var at=(_+v|0)+((o&8191)<<13)|0;_=(m+(o>>>13)|0)+(at>>>26)|0,at&=67108863,v=Math.imul(de,Ae),o=Math.imul(de,Oe),o=o+Math.imul(pe,Ae)|0,m=Math.imul(pe,Oe),v=v+Math.imul(j,Re)|0,o=o+Math.imul(j,He)|0,o=o+Math.imul(re,Re)|0,m=m+Math.imul(re,He)|0,v=v+Math.imul(Z,Te)|0,o=o+Math.imul(Z,Ue)|0,o=o+Math.imul(te,Te)|0,m=m+Math.imul(te,Ue)|0,v=v+Math.imul(V,Ee)|0,o=o+Math.imul(V,Pe)|0,o=o+Math.imul(T,Ee)|0,m=m+Math.imul(T,Pe)|0,v=v+Math.imul(I,Ie)|0,o=o+Math.imul(I,Le)|0,o=o+Math.imul(F,Ie)|0,m=m+Math.imul(F,Le)|0;var ot=(_+v|0)+((o&8191)<<13)|0;_=(m+(o>>>13)|0)+(ot>>>26)|0,ot&=67108863,v=Math.imul(we,Ae),o=Math.imul(we,Oe),o=o+Math.imul(le,Ae)|0,m=Math.imul(le,Oe),v=v+Math.imul(de,Re)|0,o=o+Math.imul(de,He)|0,o=o+Math.imul(pe,Re)|0,m=m+Math.imul(pe,He)|0,v=v+Math.imul(j,Te)|0,o=o+Math.imul(j,Ue)|0,o=o+Math.imul(re,Te)|0,m=m+Math.imul(re,Ue)|0,v=v+Math.imul(Z,Ee)|0,o=o+Math.imul(Z,Pe)|0,o=o+Math.imul(te,Ee)|0,m=m+Math.imul(te,Pe)|0,v=v+Math.imul(V,Ie)|0,o=o+Math.imul(V,Le)|0,o=o+Math.imul(T,Ie)|0,m=m+Math.imul(T,Le)|0,v=v+Math.imul(I,z)|0,o=o+Math.imul(I,N)|0,o=o+Math.imul(F,z)|0,m=m+Math.imul(F,N)|0;var st=(_+v|0)+((o&8191)<<13)|0;_=(m+(o>>>13)|0)+(st>>>26)|0,st&=67108863,v=Math.imul(_e,Ae),o=Math.imul(_e,Oe),o=o+Math.imul(xe,Ae)|0,m=Math.imul(xe,Oe),v=v+Math.imul(we,Re)|0,o=o+Math.imul(we,He)|0,o=o+Math.imul(le,Re)|0,m=m+Math.imul(le,He)|0,v=v+Math.imul(de,Te)|0,o=o+Math.imul(de,Ue)|0,o=o+Math.imul(pe,Te)|0,m=m+Math.imul(pe,Ue)|0,v=v+Math.imul(j,Ee)|0,o=o+Math.imul(j,Pe)|0,o=o+Math.imul(re,Ee)|0,m=m+Math.imul(re,Pe)|0,v=v+Math.imul(Z,Ie)|0,o=o+Math.imul(Z,Le)|0,o=o+Math.imul(te,Ie)|0,m=m+Math.imul(te,Le)|0,v=v+Math.imul(V,z)|0,o=o+Math.imul(V,N)|0,o=o+Math.imul(T,z)|0,m=m+Math.imul(T,N)|0,v=v+Math.imul(I,Q)|0,o=o+Math.imul(I,ne)|0,o=o+Math.imul(F,Q)|0,m=m+Math.imul(F,ne)|0;var ht=(_+v|0)+((o&8191)<<13)|0;_=(m+(o>>>13)|0)+(ht>>>26)|0,ht&=67108863,v=Math.imul(me,Ae),o=Math.imul(me,Oe),o=o+Math.imul(ke,Ae)|0,m=Math.imul(ke,Oe),v=v+Math.imul(_e,Re)|0,o=o+Math.imul(_e,He)|0,o=o+Math.imul(xe,Re)|0,m=m+Math.imul(xe,He)|0,v=v+Math.imul(we,Te)|0,o=o+Math.imul(we,Ue)|0,o=o+Math.imul(le,Te)|0,m=m+Math.imul(le,Ue)|0,v=v+Math.imul(de,Ee)|0,o=o+Math.imul(de,Pe)|0,o=o+Math.imul(pe,Ee)|0,m=m+Math.imul(pe,Pe)|0,v=v+Math.imul(j,Ie)|0,o=o+Math.imul(j,Le)|0,o=o+Math.imul(re,Ie)|0,m=m+Math.imul(re,Le)|0,v=v+Math.imul(Z,z)|0,o=o+Math.imul(Z,N)|0,o=o+Math.imul(te,z)|0,m=m+Math.imul(te,N)|0,v=v+Math.imul(V,Q)|0,o=o+Math.imul(V,ne)|0,o=o+Math.imul(T,Q)|0,m=m+Math.imul(T,ne)|0,v=v+Math.imul(I,he)|0,o=o+Math.imul(I,be)|0,o=o+Math.imul(F,he)|0,m=m+Math.imul(F,be)|0;var lt=(_+v|0)+((o&8191)<<13)|0;_=(m+(o>>>13)|0)+(lt>>>26)|0,lt&=67108863,v=Math.imul(Me,Ae),o=Math.imul(Me,Oe),o=o+Math.imul(Ne,Ae)|0,m=Math.imul(Ne,Oe),v=v+Math.imul(me,Re)|0,o=o+Math.imul(me,He)|0,o=o+Math.imul(ke,Re)|0,m=m+Math.imul(ke,He)|0,v=v+Math.imul(_e,Te)|0,o=o+Math.imul(_e,Ue)|0,o=o+Math.imul(xe,Te)|0,m=m+Math.imul(xe,Ue)|0,v=v+Math.imul(we,Ee)|0,o=o+Math.imul(we,Pe)|0,o=o+Math.imul(le,Ee)|0,m=m+Math.imul(le,Pe)|0,v=v+Math.imul(de,Ie)|0,o=o+Math.imul(de,Le)|0,o=o+Math.imul(pe,Ie)|0,m=m+Math.imul(pe,Le)|0,v=v+Math.imul(j,z)|0,o=o+Math.imul(j,N)|0,o=o+Math.imul(re,z)|0,m=m+Math.imul(re,N)|0,v=v+Math.imul(Z,Q)|0,o=o+Math.imul(Z,ne)|0,o=o+Math.imul(te,Q)|0,m=m+Math.imul(te,ne)|0,v=v+Math.imul(V,he)|0,o=o+Math.imul(V,be)|0,o=o+Math.imul(T,he)|0,m=m+Math.imul(T,be)|0,v=v+Math.imul(I,ye)|0,o=o+Math.imul(I,Se)|0,o=o+Math.imul(F,ye)|0,m=m+Math.imul(F,Se)|0;var ct=(_+v|0)+((o&8191)<<13)|0;_=(m+(o>>>13)|0)+(ct>>>26)|0,ct&=67108863,v=Math.imul(Be,Ae),o=Math.imul(Be,Oe),o=o+Math.imul(De,Ae)|0,m=Math.imul(De,Oe),v=v+Math.imul(Me,Re)|0,o=o+Math.imul(Me,He)|0,o=o+Math.imul(Ne,Re)|0,m=m+Math.imul(Ne,He)|0,v=v+Math.imul(me,Te)|0,o=o+Math.imul(me,Ue)|0,o=o+Math.imul(ke,Te)|0,m=m+Math.imul(ke,Ue)|0,v=v+Math.imul(_e,Ee)|0,o=o+Math.imul(_e,Pe)|0,o=o+Math.imul(xe,Ee)|0,m=m+Math.imul(xe,Pe)|0,v=v+Math.imul(we,Ie)|0,o=o+Math.imul(we,Le)|0,o=o+Math.imul(le,Ie)|0,m=m+Math.imul(le,Le)|0,v=v+Math.imul(de,z)|0,o=o+Math.imul(de,N)|0,o=o+Math.imul(pe,z)|0,m=m+Math.imul(pe,N)|0,v=v+Math.imul(j,Q)|0,o=o+Math.imul(j,ne)|0,o=o+Math.imul(re,Q)|0,m=m+Math.imul(re,ne)|0,v=v+Math.imul(Z,he)|0,o=o+Math.imul(Z,be)|0,o=o+Math.imul(te,he)|0,m=m+Math.imul(te,be)|0,v=v+Math.imul(V,ye)|0,o=o+Math.imul(V,Se)|0,o=o+Math.imul(T,ye)|0,m=m+Math.imul(T,Se)|0,v=v+Math.imul(I,Ce)|0,o=o+Math.imul(I,Fe)|0,o=o+Math.imul(F,Ce)|0,m=m+Math.imul(F,Fe)|0;var dt=(_+v|0)+((o&8191)<<13)|0;_=(m+(o>>>13)|0)+(dt>>>26)|0,dt&=67108863,v=Math.imul(Be,Re),o=Math.imul(Be,He),o=o+Math.imul(De,Re)|0,m=Math.imul(De,He),v=v+Math.imul(Me,Te)|0,o=o+Math.imul(Me,Ue)|0,o=o+Math.imul(Ne,Te)|0,m=m+Math.imul(Ne,Ue)|0,v=v+Math.imul(me,Ee)|0,o=o+Math.imul(me,Pe)|0,o=o+Math.imul(ke,Ee)|0,m=m+Math.imul(ke,Pe)|0,v=v+Math.imul(_e,Ie)|0,o=o+Math.imul(_e,Le)|0,o=o+Math.imul(xe,Ie)|0,m=m+Math.imul(xe,Le)|0,v=v+Math.imul(we,z)|0,o=o+Math.imul(we,N)|0,o=o+Math.imul(le,z)|0,m=m+Math.imul(le,N)|0,v=v+Math.imul(de,Q)|0,o=o+Math.imul(de,ne)|0,o=o+Math.imul(pe,Q)|0,m=m+Math.imul(pe,ne)|0,v=v+Math.imul(j,he)|0,o=o+Math.imul(j,be)|0,o=o+Math.imul(re,he)|0,m=m+Math.imul(re,be)|0,v=v+Math.imul(Z,ye)|0,o=o+Math.imul(Z,Se)|0,o=o+Math.imul(te,ye)|0,m=m+Math.imul(te,Se)|0,v=v+Math.imul(V,Ce)|0,o=o+Math.imul(V,Fe)|0,o=o+Math.imul(T,Ce)|0,m=m+Math.imul(T,Fe)|0;var pt=(_+v|0)+((o&8191)<<13)|0;_=(m+(o>>>13)|0)+(pt>>>26)|0,pt&=67108863,v=Math.imul(Be,Te),o=Math.imul(Be,Ue),o=o+Math.imul(De,Te)|0,m=Math.imul(De,Ue),v=v+Math.imul(Me,Ee)|0,o=o+Math.imul(Me,Pe)|0,o=o+Math.imul(Ne,Ee)|0,m=m+Math.imul(Ne,Pe)|0,v=v+Math.imul(me,Ie)|0,o=o+Math.imul(me,Le)|0,o=o+Math.imul(ke,Ie)|0,m=m+Math.imul(ke,Le)|0,v=v+Math.imul(_e,z)|0,o=o+Math.imul(_e,N)|0,o=o+Math.imul(xe,z)|0,m=m+Math.imul(xe,N)|0,v=v+Math.imul(we,Q)|0,o=o+Math.imul(we,ne)|0,o=o+Math.imul(le,Q)|0,m=m+Math.imul(le,ne)|0,v=v+Math.imul(de,he)|0,o=o+Math.imul(de,be)|0,o=o+Math.imul(pe,he)|0,m=m+Math.imul(pe,be)|0,v=v+Math.imul(j,ye)|0,o=o+Math.imul(j,Se)|0,o=o+Math.imul(re,ye)|0,m=m+Math.imul(re,Se)|0,v=v+Math.imul(Z,Ce)|0,o=o+Math.imul(Z,Fe)|0,o=o+Math.imul(te,Ce)|0,m=m+Math.imul(te,Fe)|0;var vt=(_+v|0)+((o&8191)<<13)|0;_=(m+(o>>>13)|0)+(vt>>>26)|0,vt&=67108863,v=Math.imul(Be,Ee),o=Math.imul(Be,Pe),o=o+Math.imul(De,Ee)|0,m=Math.imul(De,Pe),v=v+Math.imul(Me,Ie)|0,o=o+Math.imul(Me,Le)|0,o=o+Math.imul(Ne,Ie)|0,m=m+Math.imul(Ne,Le)|0,v=v+Math.imul(me,z)|0,o=o+Math.imul(me,N)|0,o=o+Math.imul(ke,z)|0,m=m+Math.imul(ke,N)|0,v=v+Math.imul(_e,Q)|0,o=o+Math.imul(_e,ne)|0,o=o+Math.imul(xe,Q)|0,m=m+Math.imul(xe,ne)|0,v=v+Math.imul(we,he)|0,o=o+Math.imul(we,be)|0,o=o+Math.imul(le,he)|0,m=m+Math.imul(le,be)|0,v=v+Math.imul(de,ye)|0,o=o+Math.imul(de,Se)|0,o=o+Math.imul(pe,ye)|0,m=m+Math.imul(pe,Se)|0,v=v+Math.imul(j,Ce)|0,o=o+Math.imul(j,Fe)|0,o=o+Math.imul(re,Ce)|0,m=m+Math.imul(re,Fe)|0;var yt=(_+v|0)+((o&8191)<<13)|0;_=(m+(o>>>13)|0)+(yt>>>26)|0,yt&=67108863,v=Math.imul(Be,Ie),o=Math.imul(Be,Le),o=o+Math.imul(De,Ie)|0,m=Math.imul(De,Le),v=v+Math.imul(Me,z)|0,o=o+Math.imul(Me,N)|0,o=o+Math.imul(Ne,z)|0,m=m+Math.imul(Ne,N)|0,v=v+Math.imul(me,Q)|0,o=o+Math.imul(me,ne)|0,o=o+Math.imul(ke,Q)|0,m=m+Math.imul(ke,ne)|0,v=v+Math.imul(_e,he)|0,o=o+Math.imul(_e,be)|0,o=o+Math.imul(xe,he)|0,m=m+Math.imul(xe,be)|0,v=v+Math.imul(we,ye)|0,o=o+Math.imul(we,Se)|0,o=o+Math.imul(le,ye)|0,m=m+Math.imul(le,Se)|0,v=v+Math.imul(de,Ce)|0,o=o+Math.imul(de,Fe)|0,o=o+Math.imul(pe,Ce)|0,m=m+Math.imul(pe,Fe)|0;var mt=(_+v|0)+((o&8191)<<13)|0;_=(m+(o>>>13)|0)+(mt>>>26)|0,mt&=67108863,v=Math.imul(Be,z),o=Math.imul(Be,N),o=o+Math.imul(De,z)|0,m=Math.imul(De,N),v=v+Math.imul(Me,Q)|0,o=o+Math.imul(Me,ne)|0,o=o+Math.imul(Ne,Q)|0,m=m+Math.imul(Ne,ne)|0,v=v+Math.imul(me,he)|0,o=o+Math.imul(me,be)|0,o=o+Math.imul(ke,he)|0,m=m+Math.imul(ke,be)|0,v=v+Math.imul(_e,ye)|0,o=o+Math.imul(_e,Se)|0,o=o+Math.imul(xe,ye)|0,m=m+Math.imul(xe,Se)|0,v=v+Math.imul(we,Ce)|0,o=o+Math.imul(we,Fe)|0,o=o+Math.imul(le,Ce)|0,m=m+Math.imul(le,Fe)|0;var gt=(_+v|0)+((o&8191)<<13)|0;_=(m+(o>>>13)|0)+(gt>>>26)|0,gt&=67108863,v=Math.imul(Be,Q),o=Math.imul(Be,ne),o=o+Math.imul(De,Q)|0,m=Math.imul(De,ne),v=v+Math.imul(Me,he)|0,o=o+Math.imul(Me,be)|0,o=o+Math.imul(Ne,he)|0,m=m+Math.imul(Ne,be)|0,v=v+Math.imul(me,ye)|0,o=o+Math.imul(me,Se)|0,o=o+Math.imul(ke,ye)|0,m=m+Math.imul(ke,Se)|0,v=v+Math.imul(_e,Ce)|0,o=o+Math.imul(_e,Fe)|0,o=o+Math.imul(xe,Ce)|0,m=m+Math.imul(xe,Fe)|0;var bt=(_+v|0)+((o&8191)<<13)|0;_=(m+(o>>>13)|0)+(bt>>>26)|0,bt&=67108863,v=Math.imul(Be,he),o=Math.imul(Be,be),o=o+Math.imul(De,he)|0,m=Math.imul(De,be),v=v+Math.imul(Me,ye)|0,o=o+Math.imul(Me,Se)|0,o=o+Math.imul(Ne,ye)|0,m=m+Math.imul(Ne,Se)|0,v=v+Math.imul(me,Ce)|0,o=o+Math.imul(me,Fe)|0,o=o+Math.imul(ke,Ce)|0,m=m+Math.imul(ke,Fe)|0;var wt=(_+v|0)+((o&8191)<<13)|0;_=(m+(o>>>13)|0)+(wt>>>26)|0,wt&=67108863,v=Math.imul(Be,ye),o=Math.imul(Be,Se),o=o+Math.imul(De,ye)|0,m=Math.imul(De,Se),v=v+Math.imul(Me,Ce)|0,o=o+Math.imul(Me,Fe)|0,o=o+Math.imul(Ne,Ce)|0,m=m+Math.imul(Ne,Fe)|0;var _t=(_+v|0)+((o&8191)<<13)|0;_=(m+(o>>>13)|0)+(_t>>>26)|0,_t&=67108863,v=Math.imul(Be,Ce),o=Math.imul(Be,Fe),o=o+Math.imul(De,Ce)|0,m=Math.imul(De,Fe);var xt=(_+v|0)+((o&8191)<<13)|0;return _=(m+(o>>>13)|0)+(xt>>>26)|0,xt&=67108863,b[0]=Xe,b[1]=Ye,b[2]=nt,b[3]=at,b[4]=ot,b[5]=st,b[6]=ht,b[7]=lt,b[8]=ct,b[9]=dt,b[10]=pt,b[11]=vt,b[12]=yt,b[13]=mt,b[14]=gt,b[15]=bt,b[16]=wt,b[17]=_t,b[18]=xt,_!==0&&(b[19]=_,c.length++),c};Math.imul||(O=q);function U($,n,l){l.negative=n.negative^$.negative,l.length=$.length+n.length;for(var c=0,p=0,y=0;y<l.length-1;y++){var b=p;p=0;for(var _=c&67108863,v=Math.min(y,n.length-1),o=Math.max(0,y-$.length+1);o<=v;o++){var m=y-o,A=$.words[m]|0,I=n.words[o]|0,F=A*I,X=F&67108863;b=b+(F/67108864|0)|0,X=X+_|0,_=X&67108863,b=b+(X>>>26)|0,p+=b>>>26,b&=67108863}l.words[y]=_,c=b,b=p}return c!==0?l.words[y]=c:l.length--,l.strip()}function P($,n,l){var c=new L;return c.mulp($,n,l)}h.prototype.mulTo=function(n,l){var c,p=this.length+n.length;return this.length===10&&n.length===10?c=O(this,n,l):p<63?c=q(this,n,l):p<1024?c=U(this,n,l):c=P(this,n,l),c};function L($,n){this.x=$,this.y=n}L.prototype.makeRBT=function(n){for(var l=new Array(n),c=h.prototype._countBits(n)-1,p=0;p<n;p++)l[p]=this.revBin(p,c,n);return l},L.prototype.revBin=function(n,l,c){if(n===0||n===c-1)return n;for(var p=0,y=0;y<l;y++)p|=(n&1)<<l-y-1,n>>=1;return p},L.prototype.permute=function(n,l,c,p,y,b){for(var _=0;_<b;_++)p[_]=l[n[_]],y[_]=c[n[_]]},L.prototype.transform=function(n,l,c,p,y,b){this.permute(b,n,l,c,p,y);for(var _=1;_<y;_<<=1)for(var v=_<<1,o=Math.cos(2*Math.PI/v),m=Math.sin(2*Math.PI/v),A=0;A<y;A+=v)for(var I=o,F=m,X=0;X<_;X++){var V=c[A+X],T=p[A+X],D=c[A+X+_],Z=p[A+X+_],te=I*D-F*Z;Z=I*Z+F*D,D=te,c[A+X]=V+D,p[A+X]=T+Z,c[A+X+_]=V-D,p[A+X+_]=T-Z,X!==v&&(te=o*I-m*F,F=o*F+m*I,I=te)}},L.prototype.guessLen13b=function(n,l){var c=Math.max(l,n)|1,p=c&1,y=0;for(c=c/2|0;c;c=c>>>1)y++;return 1<<y+1+p},L.prototype.conjugate=function(n,l,c){if(!(c<=1))for(var p=0;p<c/2;p++){var y=n[p];n[p]=n[c-p-1],n[c-p-1]=y,y=l[p],l[p]=-l[c-p-1],l[c-p-1]=-y}},L.prototype.normalize13b=function(n,l){for(var c=0,p=0;p<l/2;p++){var y=Math.round(n[2*p+1]/l)*8192+Math.round(n[2*p]/l)+c;n[p]=y&67108863,y<67108864?c=0:c=y/67108864|0}return n},L.prototype.convert13b=function(n,l,c,p){for(var y=0,b=0;b<l;b++)y=y+(n[b]|0),c[2*b]=y&8191,y=y>>>13,c[2*b+1]=y&8191,y=y>>>13;for(b=2*l;b<p;++b)c[b]=0;u(y===0),u((y&-8192)===0)},L.prototype.stub=function(n){for(var l=new Array(n),c=0;c<n;c++)l[c]=0;return l},L.prototype.mulp=function(n,l,c){var p=2*this.guessLen13b(n.length,l.length),y=this.makeRBT(p),b=this.stub(p),_=new Array(p),v=new Array(p),o=new Array(p),m=new Array(p),A=new Array(p),I=new Array(p),F=c.words;F.length=p,this.convert13b(n.words,n.length,_,p),this.convert13b(l.words,l.length,m,p),this.transform(_,b,v,o,p,y),this.transform(m,b,A,I,p,y);for(var X=0;X<p;X++){var V=v[X]*A[X]-o[X]*I[X];o[X]=v[X]*I[X]+o[X]*A[X],v[X]=V}return this.conjugate(v,o,p),this.transform(v,o,F,b,p,y),this.conjugate(F,b,p),this.normalize13b(F,p),c.negative=n.negative^l.negative,c.length=n.length+l.length,c.strip()},h.prototype.mul=function(n){var l=new h(null);return l.words=new Array(this.length+n.length),this.mulTo(n,l)},h.prototype.mulf=function(n){var l=new h(null);return l.words=new Array(this.length+n.length),P(this,n,l)},h.prototype.imul=function(n){return this.clone().mulTo(n,this)},h.prototype.imuln=function(n){u(typeof n=="number"),u(n<67108864);for(var l=0,c=0;c<this.length;c++){var p=(this.words[c]|0)*n,y=(p&67108863)+(l&67108863);l>>=26,l+=p/67108864|0,l+=y>>>26,this.words[c]=y&67108863}return l!==0&&(this.words[c]=l,this.length++),this.length=n===0?1:this.length,this},h.prototype.muln=function(n){return this.clone().imuln(n)},h.prototype.sqr=function(){return this.mul(this)},h.prototype.isqr=function(){return this.imul(this.clone())},h.prototype.pow=function(n){var l=C(n);if(l.length===0)return new h(1);for(var c=this,p=0;p<l.length&&l[p]===0;p++,c=c.sqr());if(++p<l.length)for(var y=c.sqr();p<l.length;p++,y=y.sqr())l[p]!==0&&(c=c.mul(y));return c},h.prototype.iushln=function(n){u(typeof n=="number"&&n>=0);var l=n%26,c=(n-l)/26,p=67108863>>>26-l<<26-l,y;if(l!==0){var b=0;for(y=0;y<this.length;y++){var _=this.words[y]&p,v=(this.words[y]|0)-_<<l;this.words[y]=v|b,b=_>>>26-l}b&&(this.words[y]=b,this.length++)}if(c!==0){for(y=this.length-1;y>=0;y--)this.words[y+c]=this.words[y];for(y=0;y<c;y++)this.words[y]=0;this.length+=c}return this.strip()},h.prototype.ishln=function(n){return u(this.negative===0),this.iushln(n)},h.prototype.iushrn=function(n,l,c){u(typeof n=="number"&&n>=0);var p;l?p=(l-l%26)/26:p=0;var y=n%26,b=Math.min((n-y)/26,this.length),_=67108863^67108863>>>y<<y,v=c;if(p-=b,p=Math.max(0,p),v){for(var o=0;o<b;o++)v.words[o]=this.words[o];v.length=b}if(b!==0)if(this.length>b)for(this.length-=b,o=0;o<this.length;o++)this.words[o]=this.words[o+b];else this.words[0]=0,this.length=1;var m=0;for(o=this.length-1;o>=0&&(m!==0||o>=p);o--){var A=this.words[o]|0;this.words[o]=m<<26-y|A>>>y,m=A&_}return v&&m!==0&&(v.words[v.length++]=m),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},h.prototype.ishrn=function(n,l,c){return u(this.negative===0),this.iushrn(n,l,c)},h.prototype.shln=function(n){return this.clone().ishln(n)},h.prototype.ushln=function(n){return this.clone().iushln(n)},h.prototype.shrn=function(n){return this.clone().ishrn(n)},h.prototype.ushrn=function(n){return this.clone().iushrn(n)},h.prototype.testn=function(n){u(typeof n=="number"&&n>=0);var l=n%26,c=(n-l)/26,p=1<<l;if(this.length<=c)return!1;var y=this.words[c];return!!(y&p)},h.prototype.imaskn=function(n){u(typeof n=="number"&&n>=0);var l=n%26,c=(n-l)/26;if(u(this.negative===0,"imaskn works only with positive numbers"),this.length<=c)return this;if(l!==0&&c++,this.length=Math.min(c,this.length),l!==0){var p=67108863^67108863>>>l<<l;this.words[this.length-1]&=p}return this.strip()},h.prototype.maskn=function(n){return this.clone().imaskn(n)},h.prototype.iaddn=function(n){return u(typeof n=="number"),u(n<67108864),n<0?this.isubn(-n):this.negative!==0?this.length===1&&(this.words[0]|0)<n?(this.words[0]=n-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(n),this.negative=1,this):this._iaddn(n)},h.prototype._iaddn=function(n){this.words[0]+=n;for(var l=0;l<this.length&&this.words[l]>=67108864;l++)this.words[l]-=67108864,l===this.length-1?this.words[l+1]=1:this.words[l+1]++;return this.length=Math.max(this.length,l+1),this},h.prototype.isubn=function(n){if(u(typeof n=="number"),u(n<67108864),n<0)return this.iaddn(-n);if(this.negative!==0)return this.negative=0,this.iaddn(n),this.negative=1,this;if(this.words[0]-=n,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var l=0;l<this.length&&this.words[l]<0;l++)this.words[l]+=67108864,this.words[l+1]-=1;return this.strip()},h.prototype.addn=function(n){return this.clone().iaddn(n)},h.prototype.subn=function(n){return this.clone().isubn(n)},h.prototype.iabs=function(){return this.negative=0,this},h.prototype.abs=function(){return this.clone().iabs()},h.prototype._ishlnsubmul=function(n,l,c){var p=n.length+c,y;this._expand(p);var b,_=0;for(y=0;y<n.length;y++){b=(this.words[y+c]|0)+_;var v=(n.words[y]|0)*l;b-=v&67108863,_=(b>>26)-(v/67108864|0),this.words[y+c]=b&67108863}for(;y<this.length-c;y++)b=(this.words[y+c]|0)+_,_=b>>26,this.words[y+c]=b&67108863;if(_===0)return this.strip();for(u(_===-1),_=0,y=0;y<this.length;y++)b=-(this.words[y]|0)+_,_=b>>26,this.words[y]=b&67108863;return this.negative=1,this.strip()},h.prototype._wordDiv=function(n,l){var c=this.length-n.length,p=this.clone(),y=n,b=y.words[y.length-1]|0,_=this._countBits(b);c=26-_,c!==0&&(y=y.ushln(c),p.iushln(c),b=y.words[y.length-1]|0);var v=p.length-y.length,o;if(l!=="mod"){o=new h(null),o.length=v+1,o.words=new Array(o.length);for(var m=0;m<o.length;m++)o.words[m]=0}var A=p.clone()._ishlnsubmul(y,1,v);A.negative===0&&(p=A,o&&(o.words[v]=1));for(var I=v-1;I>=0;I--){var F=(p.words[y.length+I]|0)*67108864+(p.words[y.length+I-1]|0);for(F=Math.min(F/b|0,67108863),p._ishlnsubmul(y,F,I);p.negative!==0;)F--,p.negative=0,p._ishlnsubmul(y,1,I),p.isZero()||(p.negative^=1);o&&(o.words[I]=F)}return o&&o.strip(),p.strip(),l!=="div"&&c!==0&&p.iushrn(c),{div:o||null,mod:p}},h.prototype.divmod=function(n,l,c){if(u(!n.isZero()),this.isZero())return{div:new h(0),mod:new h(0)};var p,y,b;return this.negative!==0&&n.negative===0?(b=this.neg().divmod(n,l),l!=="mod"&&(p=b.div.neg()),l!=="div"&&(y=b.mod.neg(),c&&y.negative!==0&&y.iadd(n)),{div:p,mod:y}):this.negative===0&&n.negative!==0?(b=this.divmod(n.neg(),l),l!=="mod"&&(p=b.div.neg()),{div:p,mod:b.mod}):this.negative&n.negative?(b=this.neg().divmod(n.neg(),l),l!=="div"&&(y=b.mod.neg(),c&&y.negative!==0&&y.isub(n)),{div:b.div,mod:y}):n.length>this.length||this.cmp(n)<0?{div:new h(0),mod:this}:n.length===1?l==="div"?{div:this.divn(n.words[0]),mod:null}:l==="mod"?{div:null,mod:new h(this.modn(n.words[0]))}:{div:this.divn(n.words[0]),mod:new h(this.modn(n.words[0]))}:this._wordDiv(n,l)},h.prototype.div=function(n){return this.divmod(n,"div",!1).div},h.prototype.mod=function(n){return this.divmod(n,"mod",!1).mod},h.prototype.umod=function(n){return this.divmod(n,"mod",!0).mod},h.prototype.divRound=function(n){var l=this.divmod(n);if(l.mod.isZero())return l.div;var c=l.div.negative!==0?l.mod.isub(n):l.mod,p=n.ushrn(1),y=n.andln(1),b=c.cmp(p);return b<0||y===1&&b===0?l.div:l.div.negative!==0?l.div.isubn(1):l.div.iaddn(1)},h.prototype.modn=function(n){u(n<=67108863);for(var l=(1<<26)%n,c=0,p=this.length-1;p>=0;p--)c=(l*c+(this.words[p]|0))%n;return c},h.prototype.idivn=function(n){u(n<=67108863);for(var l=0,c=this.length-1;c>=0;c--){var p=(this.words[c]|0)+l*67108864;this.words[c]=p/n|0,l=p%n}return this.strip()},h.prototype.divn=function(n){return this.clone().idivn(n)},h.prototype.egcd=function(n){u(n.negative===0),u(!n.isZero());var l=this,c=n.clone();l.negative!==0?l=l.umod(n):l=l.clone();for(var p=new h(1),y=new h(0),b=new h(0),_=new h(1),v=0;l.isEven()&&c.isEven();)l.iushrn(1),c.iushrn(1),++v;for(var o=c.clone(),m=l.clone();!l.isZero();){for(var A=0,I=1;!(l.words[0]&I)&&A<26;++A,I<<=1);if(A>0)for(l.iushrn(A);A-- >0;)(p.isOdd()||y.isOdd())&&(p.iadd(o),y.isub(m)),p.iushrn(1),y.iushrn(1);for(var F=0,X=1;!(c.words[0]&X)&&F<26;++F,X<<=1);if(F>0)for(c.iushrn(F);F-- >0;)(b.isOdd()||_.isOdd())&&(b.iadd(o),_.isub(m)),b.iushrn(1),_.iushrn(1);l.cmp(c)>=0?(l.isub(c),p.isub(b),y.isub(_)):(c.isub(l),b.isub(p),_.isub(y))}return{a:b,b:_,gcd:c.iushln(v)}},h.prototype._invmp=function(n){u(n.negative===0),u(!n.isZero());var l=this,c=n.clone();l.negative!==0?l=l.umod(n):l=l.clone();for(var p=new h(1),y=new h(0),b=c.clone();l.cmpn(1)>0&&c.cmpn(1)>0;){for(var _=0,v=1;!(l.words[0]&v)&&_<26;++_,v<<=1);if(_>0)for(l.iushrn(_);_-- >0;)p.isOdd()&&p.iadd(b),p.iushrn(1);for(var o=0,m=1;!(c.words[0]&m)&&o<26;++o,m<<=1);if(o>0)for(c.iushrn(o);o-- >0;)y.isOdd()&&y.iadd(b),y.iushrn(1);l.cmp(c)>=0?(l.isub(c),p.isub(y)):(c.isub(l),y.isub(p))}var A;return l.cmpn(1)===0?A=p:A=y,A.cmpn(0)<0&&A.iadd(n),A},h.prototype.gcd=function(n){if(this.isZero())return n.abs();if(n.isZero())return this.abs();var l=this.clone(),c=n.clone();l.negative=0,c.negative=0;for(var p=0;l.isEven()&&c.isEven();p++)l.iushrn(1),c.iushrn(1);do{for(;l.isEven();)l.iushrn(1);for(;c.isEven();)c.iushrn(1);var y=l.cmp(c);if(y<0){var b=l;l=c,c=b}else if(y===0||c.cmpn(1)===0)break;l.isub(c)}while(!0);return c.iushln(p)},h.prototype.invm=function(n){return this.egcd(n).a.umod(n)},h.prototype.isEven=function(){return(this.words[0]&1)===0},h.prototype.isOdd=function(){return(this.words[0]&1)===1},h.prototype.andln=function(n){return this.words[0]&n},h.prototype.bincn=function(n){u(typeof n=="number");var l=n%26,c=(n-l)/26,p=1<<l;if(this.length<=c)return this._expand(c+1),this.words[c]|=p,this;for(var y=p,b=c;y!==0&&b<this.length;b++){var _=this.words[b]|0;_+=y,y=_>>>26,_&=67108863,this.words[b]=_}return y!==0&&(this.words[b]=y,this.length++),this},h.prototype.isZero=function(){return this.length===1&&this.words[0]===0},h.prototype.cmpn=function(n){var l=n<0;if(this.negative!==0&&!l)return-1;if(this.negative===0&&l)return 1;this.strip();var c;if(this.length>1)c=1;else{l&&(n=-n),u(n<=67108863,"Number is too big");var p=this.words[0]|0;c=p===n?0:p<n?-1:1}return this.negative!==0?-c|0:c},h.prototype.cmp=function(n){if(this.negative!==0&&n.negative===0)return-1;if(this.negative===0&&n.negative!==0)return 1;var l=this.ucmp(n);return this.negative!==0?-l|0:l},h.prototype.ucmp=function(n){if(this.length>n.length)return 1;if(this.length<n.length)return-1;for(var l=0,c=this.length-1;c>=0;c--){var p=this.words[c]|0,y=n.words[c]|0;if(p!==y){p<y?l=-1:p>y&&(l=1);break}}return l},h.prototype.gtn=function(n){return this.cmpn(n)===1},h.prototype.gt=function(n){return this.cmp(n)===1},h.prototype.gten=function(n){return this.cmpn(n)>=0},h.prototype.gte=function(n){return this.cmp(n)>=0},h.prototype.ltn=function(n){return this.cmpn(n)===-1},h.prototype.lt=function(n){return this.cmp(n)===-1},h.prototype.lten=function(n){return this.cmpn(n)<=0},h.prototype.lte=function(n){return this.cmp(n)<=0},h.prototype.eqn=function(n){return this.cmpn(n)===0},h.prototype.eq=function(n){return this.cmp(n)===0},h.red=function(n){return new ie(n)},h.prototype.toRed=function(n){return u(!this.red,"Already a number in reduction context"),u(this.negative===0,"red works only with positives"),n.convertTo(this)._forceRed(n)},h.prototype.fromRed=function(){return u(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},h.prototype._forceRed=function(n){return this.red=n,this},h.prototype.forceRed=function(n){return u(!this.red,"Already a number in reduction context"),this._forceRed(n)},h.prototype.redAdd=function(n){return u(this.red,"redAdd works only with red numbers"),this.red.add(this,n)},h.prototype.redIAdd=function(n){return u(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,n)},h.prototype.redSub=function(n){return u(this.red,"redSub works only with red numbers"),this.red.sub(this,n)},h.prototype.redISub=function(n){return u(this.red,"redISub works only with red numbers"),this.red.isub(this,n)},h.prototype.redShl=function(n){return u(this.red,"redShl works only with red numbers"),this.red.shl(this,n)},h.prototype.redMul=function(n){return u(this.red,"redMul works only with red numbers"),this.red._verify2(this,n),this.red.mul(this,n)},h.prototype.redIMul=function(n){return u(this.red,"redMul works only with red numbers"),this.red._verify2(this,n),this.red.imul(this,n)},h.prototype.redSqr=function(){return u(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},h.prototype.redISqr=function(){return u(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},h.prototype.redSqrt=function(){return u(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},h.prototype.redInvm=function(){return u(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},h.prototype.redNeg=function(){return u(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},h.prototype.redPow=function(n){return u(this.red&&!n.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,n)};var J={k256:null,p224:null,p192:null,p25519:null};function Y($,n){this.name=$,this.p=new h(n,16),this.n=this.p.bitLength(),this.k=new h(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}Y.prototype._tmp=function(){var n=new h(null);return n.words=new Array(Math.ceil(this.n/13)),n},Y.prototype.ireduce=function(n){var l=n,c;do this.split(l,this.tmp),l=this.imulK(l),l=l.iadd(this.tmp),c=l.bitLength();while(c>this.n);var p=c<this.n?-1:l.ucmp(this.p);return p===0?(l.words[0]=0,l.length=1):p>0?l.isub(this.p):l.strip!==void 0?l.strip():l._strip(),l},Y.prototype.split=function(n,l){n.iushrn(this.n,0,l)},Y.prototype.imulK=function(n){return n.imul(this.k)};function ae(){Y.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}d(ae,Y),ae.prototype.split=function(n,l){for(var c=4194303,p=Math.min(n.length,9),y=0;y<p;y++)l.words[y]=n.words[y];if(l.length=p,n.length<=9){n.words[0]=0,n.length=1;return}var b=n.words[9];for(l.words[l.length++]=b&c,y=10;y<n.length;y++){var _=n.words[y]|0;n.words[y-10]=(_&c)<<4|b>>>22,b=_}b>>>=22,n.words[y-10]=b,b===0&&n.length>10?n.length-=10:n.length-=9},ae.prototype.imulK=function(n){n.words[n.length]=0,n.words[n.length+1]=0,n.length+=2;for(var l=0,c=0;c<n.length;c++){var p=n.words[c]|0;l+=p*977,n.words[c]=l&67108863,l=p*64+(l/67108864|0)}return n.words[n.length-1]===0&&(n.length--,n.words[n.length-1]===0&&n.length--),n};function oe(){Y.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}d(oe,Y);function ue(){Y.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}d(ue,Y);function se(){Y.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}d(se,Y),se.prototype.imulK=function(n){for(var l=0,c=0;c<n.length;c++){var p=(n.words[c]|0)*19+l,y=p&67108863;p>>>=26,n.words[c]=y,l=p}return l!==0&&(n.words[n.length++]=l),n},h._prime=function(n){if(J[n])return J[n];var l;if(n==="k256")l=new ae;else if(n==="p224")l=new oe;else if(n==="p192")l=new ue;else if(n==="p25519")l=new se;else throw new Error("Unknown prime "+n);return J[n]=l,l};function ie($){if(typeof $=="string"){var n=h._prime($);this.m=n.p,this.prime=n}else u($.gtn(1),"modulus must be greater than 1"),this.m=$,this.prime=null}ie.prototype._verify1=function(n){u(n.negative===0,"red works only with positives"),u(n.red,"red works only with red numbers")},ie.prototype._verify2=function(n,l){u((n.negative|l.negative)===0,"red works only with positives"),u(n.red&&n.red===l.red,"red works only with red numbers")},ie.prototype.imod=function(n){return this.prime?this.prime.ireduce(n)._forceRed(this):n.umod(this.m)._forceRed(this)},ie.prototype.neg=function(n){return n.isZero()?n.clone():this.m.sub(n)._forceRed(this)},ie.prototype.add=function(n,l){this._verify2(n,l);var c=n.add(l);return c.cmp(this.m)>=0&&c.isub(this.m),c._forceRed(this)},ie.prototype.iadd=function(n,l){this._verify2(n,l);var c=n.iadd(l);return c.cmp(this.m)>=0&&c.isub(this.m),c},ie.prototype.sub=function(n,l){this._verify2(n,l);var c=n.sub(l);return c.cmpn(0)<0&&c.iadd(this.m),c._forceRed(this)},ie.prototype.isub=function(n,l){this._verify2(n,l);var c=n.isub(l);return c.cmpn(0)<0&&c.iadd(this.m),c},ie.prototype.shl=function(n,l){return this._verify1(n),this.imod(n.ushln(l))},ie.prototype.imul=function(n,l){return this._verify2(n,l),this.imod(n.imul(l))},ie.prototype.mul=function(n,l){return this._verify2(n,l),this.imod(n.mul(l))},ie.prototype.isqr=function(n){return this.imul(n,n.clone())},ie.prototype.sqr=function(n){return this.mul(n,n)},ie.prototype.sqrt=function(n){if(n.isZero())return n.clone();var l=this.m.andln(3);if(u(l%2===1),l===3){var c=this.m.add(new h(1)).iushrn(2);return this.pow(n,c)}for(var p=this.m.subn(1),y=0;!p.isZero()&&p.andln(1)===0;)y++,p.iushrn(1);u(!p.isZero());var b=new h(1).toRed(this),_=b.redNeg(),v=this.m.subn(1).iushrn(1),o=this.m.bitLength();for(o=new h(2*o*o).toRed(this);this.pow(o,v).cmp(_)!==0;)o.redIAdd(_);for(var m=this.pow(o,p),A=this.pow(n,p.addn(1).iushrn(1)),I=this.pow(n,p),F=y;I.cmp(b)!==0;){for(var X=I,V=0;X.cmp(b)!==0;V++)X=X.redSqr();u(V<F);var T=this.pow(m,new h(1).iushln(F-V-1));A=A.redMul(T),m=T.redSqr(),I=I.redMul(m),F=V}return A},ie.prototype.invm=function(n){var l=n._invmp(this.m);return l.negative!==0?(l.negative=0,this.imod(l).redNeg()):this.imod(l)},ie.prototype.pow=function(n,l){if(l.isZero())return new h(1).toRed(this);if(l.cmpn(1)===0)return n.clone();var c=4,p=new Array(1<<c);p[0]=new h(1).toRed(this),p[1]=n;for(var y=2;y<p.length;y++)p[y]=this.mul(p[y-1],n);var b=p[0],_=0,v=0,o=l.bitLength()%26;for(o===0&&(o=26),y=l.length-1;y>=0;y--){for(var m=l.words[y],A=o-1;A>=0;A--){var I=m>>A&1;if(b!==p[0]&&(b=this.sqr(b)),I===0&&_===0){v=0;continue}_<<=1,_|=I,v++,!(v!==c&&(y!==0||A!==0))&&(b=this.mul(b,p[_]),v=0,_=0)}o=26}return b},ie.prototype.convertTo=function(n){var l=n.umod(this.m);return l===n?l.clone():l},ie.prototype.convertFrom=function(n){var l=n.clone();return l.red=null,l},h.mont=function(n){return new ce(n)};function ce($){ie.call(this,$),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new h(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}d(ce,ie),ce.prototype.convertTo=function(n){return this.imod(n.ushln(this.shift))},ce.prototype.convertFrom=function(n){var l=this.imod(n.mul(this.rinv));return l.red=null,l},ce.prototype.imul=function(n,l){if(n.isZero()||l.isZero())return n.words[0]=0,n.length=1,n;var c=n.imul(l),p=c.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),y=c.isub(p).iushrn(this.shift),b=y;return y.cmp(this.m)>=0?b=y.isub(this.m):y.cmpn(0)<0&&(b=y.iadd(this.m)),b._forceRed(this)},ce.prototype.mul=function(n,l){if(n.isZero()||l.isZero())return new h(0)._forceRed(this);var c=n.mul(l),p=c.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),y=c.isub(p).iushrn(this.shift),b=y;return y.cmp(this.m)>=0?b=y.isub(this.m):y.cmpn(0)<0&&(b=y.iadd(this.m)),b._forceRed(this)},ce.prototype.invm=function(n){var l=this.imod(n._invmp(this.m).mul(this.r2));return l._forceRed(this)}})(e,commonjsGlobal)})(bn$3);var bnExports$3=bn$3.exports,utils$k={};(function(e){var t=e;function a(h,w){if(Array.isArray(h))return h.slice();if(!h)return[];var x=[];if(typeof h!="string"){for(var M=0;M<h.length;M++)x[M]=h[M]|0;return x}if(w==="hex"){h=h.replace(/[^a-z0-9]+/ig,""),h.length%2!==0&&(h="0"+h);for(var M=0;M<h.length;M+=2)x.push(parseInt(h[M]+h[M+1],16))}else for(var M=0;M<h.length;M++){var B=h.charCodeAt(M),E=B>>8,S=B&255;E?x.push(E,S):x.push(S)}return x}t.toArray=a;function u(h){return h.length===1?"0"+h:h}t.zero2=u;function d(h){for(var w="",x=0;x<h.length;x++)w+=u(h[x].toString(16));return w}t.toHex=d,t.encode=function(w,x){return x==="hex"?d(w):w}})(utils$k);(function(e){var t=e,a=bnExports$3,u=minimalisticAssert,d=utils$k;t.assert=u,t.toArray=d.toArray,t.zero2=d.zero2,t.toHex=d.toHex,t.encode=d.encode;function h(E,S,k){var C=new Array(Math.max(E.bitLength(),k)+1),q;for(q=0;q<C.length;q+=1)C[q]=0;var O=1<<S+1,U=E.clone();for(q=0;q<C.length;q++){var P,L=U.andln(O-1);U.isOdd()?(L>(O>>1)-1?P=(O>>1)-L:P=L,U.isubn(P)):P=0,C[q]=P,U.iushrn(1)}return C}t.getNAF=h;function w(E,S){var k=[[],[]];E=E.clone(),S=S.clone();for(var C=0,q=0,O;E.cmpn(-C)>0||S.cmpn(-q)>0;){var U=E.andln(3)+C&3,P=S.andln(3)+q&3;U===3&&(U=-1),P===3&&(P=-1);var L;U&1?(O=E.andln(7)+C&7,(O===3||O===5)&&P===2?L=-U:L=U):L=0,k[0].push(L);var J;P&1?(O=S.andln(7)+q&7,(O===3||O===5)&&U===2?J=-P:J=P):J=0,k[1].push(J),2*C===L+1&&(C=1-C),2*q===J+1&&(q=1-q),E.iushrn(1),S.iushrn(1)}return k}t.getJSF=w;function x(E,S,k){var C="_"+S;E.prototype[S]=function(){return this[C]!==void 0?this[C]:this[C]=k.call(this)}}t.cachedProperty=x;function M(E){return typeof E=="string"?t.toArray(E,"hex"):E}t.parseBytes=M;function B(E){return new a(E,"hex","le")}t.intFromLE=B})(utils$l);var curve={},BN$9=bnExports$3,utils$j=utils$l,getNAF=utils$j.getNAF,getJSF=utils$j.getJSF,assert$e=utils$j.assert;function BaseCurve(e,t){this.type=e,this.p=new BN$9(t.p,16),this.red=t.prime?BN$9.red(t.prime):BN$9.mont(this.p),this.zero=new BN$9(0).toRed(this.red),this.one=new BN$9(1).toRed(this.red),this.two=new BN$9(2).toRed(this.red),this.n=t.n&&new BN$9(t.n,16),this.g=t.g&&this.pointFromJSON(t.g,t.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var a=this.n&&this.p.div(this.n);!a||a.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var base$1=BaseCurve;BaseCurve.prototype.point=function(){throw new Error("Not implemented")};BaseCurve.prototype.validate=function(){throw new Error("Not implemented")};BaseCurve.prototype._fixedNafMul=function(t,a){assert$e(t.precomputed);var u=t._getDoubles(),d=getNAF(a,1,this._bitLength),h=(1<<u.step+1)-(u.step%2===0?2:1);h/=3;var w=[],x,M;for(x=0;x<d.length;x+=u.step){M=0;for(var B=x+u.step-1;B>=x;B--)M=(M<<1)+d[B];w.push(M)}for(var E=this.jpoint(null,null,null),S=this.jpoint(null,null,null),k=h;k>0;k--){for(x=0;x<w.length;x++)M=w[x],M===k?S=S.mixedAdd(u.points[x]):M===-k&&(S=S.mixedAdd(u.points[x].neg()));E=E.add(S)}return E.toP()};BaseCurve.prototype._wnafMul=function(t,a){var u=4,d=t._getNAFPoints(u);u=d.wnd;for(var h=d.points,w=getNAF(a,u,this._bitLength),x=this.jpoint(null,null,null),M=w.length-1;M>=0;M--){for(var B=0;M>=0&&w[M]===0;M--)B++;if(M>=0&&B++,x=x.dblp(B),M<0)break;var E=w[M];assert$e(E!==0),t.type==="affine"?E>0?x=x.mixedAdd(h[E-1>>1]):x=x.mixedAdd(h[-E-1>>1].neg()):E>0?x=x.add(h[E-1>>1]):x=x.add(h[-E-1>>1].neg())}return t.type==="affine"?x.toP():x};BaseCurve.prototype._wnafMulAdd=function(t,a,u,d,h){var w=this._wnafT1,x=this._wnafT2,M=this._wnafT3,B=0,E,S,k;for(E=0;E<d;E++){k=a[E];var C=k._getNAFPoints(t);w[E]=C.wnd,x[E]=C.points}for(E=d-1;E>=1;E-=2){var q=E-1,O=E;if(w[q]!==1||w[O]!==1){M[q]=getNAF(u[q],w[q],this._bitLength),M[O]=getNAF(u[O],w[O],this._bitLength),B=Math.max(M[q].length,B),B=Math.max(M[O].length,B);continue}var U=[a[q],null,null,a[O]];a[q].y.cmp(a[O].y)===0?(U[1]=a[q].add(a[O]),U[2]=a[q].toJ().mixedAdd(a[O].neg())):a[q].y.cmp(a[O].y.redNeg())===0?(U[1]=a[q].toJ().mixedAdd(a[O]),U[2]=a[q].add(a[O].neg())):(U[1]=a[q].toJ().mixedAdd(a[O]),U[2]=a[q].toJ().mixedAdd(a[O].neg()));var P=[-3,-1,-5,-7,0,7,5,1,3],L=getJSF(u[q],u[O]);for(B=Math.max(L[0].length,B),M[q]=new Array(B),M[O]=new Array(B),S=0;S<B;S++){var J=L[0][S]|0,Y=L[1][S]|0;M[q][S]=P[(J+1)*3+(Y+1)],M[O][S]=0,x[q]=U}}var ae=this.jpoint(null,null,null),oe=this._wnafT4;for(E=B;E>=0;E--){for(var ue=0;E>=0;){var se=!0;for(S=0;S<d;S++)oe[S]=M[S][E]|0,oe[S]!==0&&(se=!1);if(!se)break;ue++,E--}if(E>=0&&ue++,ae=ae.dblp(ue),E<0)break;for(S=0;S<d;S++){var ie=oe[S];ie!==0&&(ie>0?k=x[S][ie-1>>1]:ie<0&&(k=x[S][-ie-1>>1].neg()),k.type==="affine"?ae=ae.mixedAdd(k):ae=ae.add(k))}}for(E=0;E<d;E++)x[E]=null;return h?ae:ae.toP()};function BasePoint(e,t){this.curve=e,this.type=t,this.precomputed=null}BaseCurve.BasePoint=BasePoint;BasePoint.prototype.eq=function(){throw new Error("Not implemented")};BasePoint.prototype.validate=function(){return this.curve.validate(this)};BaseCurve.prototype.decodePoint=function(t,a){t=utils$j.toArray(t,a);var u=this.p.byteLength();if((t[0]===4||t[0]===6||t[0]===7)&&t.length-1===2*u){t[0]===6?assert$e(t[t.length-1]%2===0):t[0]===7&&assert$e(t[t.length-1]%2===1);var d=this.point(t.slice(1,1+u),t.slice(1+u,1+2*u));return d}else if((t[0]===2||t[0]===3)&&t.length-1===u)return this.pointFromX(t.slice(1,1+u),t[0]===3);throw new Error("Unknown point format")};BasePoint.prototype.encodeCompressed=function(t){return this.encode(t,!0)};BasePoint.prototype._encode=function(t){var a=this.curve.p.byteLength(),u=this.getX().toArray("be",a);return t?[this.getY().isEven()?2:3].concat(u):[4].concat(u,this.getY().toArray("be",a))};BasePoint.prototype.encode=function(t,a){return utils$j.encode(this._encode(a),t)};BasePoint.prototype.precompute=function(t){if(this.precomputed)return this;var a={doubles:null,naf:null,beta:null};return a.naf=this._getNAFPoints(8),a.doubles=this._getDoubles(4,t),a.beta=this._getBeta(),this.precomputed=a,this};BasePoint.prototype._hasDoubles=function(t){if(!this.precomputed)return!1;var a=this.precomputed.doubles;return a?a.points.length>=Math.ceil((t.bitLength()+1)/a.step):!1};BasePoint.prototype._getDoubles=function(t,a){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var u=[this],d=this,h=0;h<a;h+=t){for(var w=0;w<t;w++)d=d.dbl();u.push(d)}return{step:t,points:u}};BasePoint.prototype._getNAFPoints=function(t){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var a=[this],u=(1<<t)-1,d=u===1?null:this.dbl(),h=1;h<u;h++)a[h]=a[h-1].add(d);return{wnd:t,points:a}};BasePoint.prototype._getBeta=function(){return null};BasePoint.prototype.dblp=function(t){for(var a=this,u=0;u<t;u++)a=a.dbl();return a};var utils$i=utils$l,BN$8=bnExports$3,inherits$4=inherits_browserExports,Base$2=base$1,assert$d=utils$i.assert;function ShortCurve(e){Base$2.call(this,"short",e),this.a=new BN$8(e.a,16).toRed(this.red),this.b=new BN$8(e.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=this.a.fromRed().cmpn(0)===0,this.threeA=this.a.fromRed().sub(this.p).cmpn(-3)===0,this.endo=this._getEndomorphism(e),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}inherits$4(ShortCurve,Base$2);var short=ShortCurve;ShortCurve.prototype._getEndomorphism=function(t){if(!(!this.zeroA||!this.g||!this.n||this.p.modn(3)!==1)){var a,u;if(t.beta)a=new BN$8(t.beta,16).toRed(this.red);else{var d=this._getEndoRoots(this.p);a=d[0].cmp(d[1])<0?d[0]:d[1],a=a.toRed(this.red)}if(t.lambda)u=new BN$8(t.lambda,16);else{var h=this._getEndoRoots(this.n);this.g.mul(h[0]).x.cmp(this.g.x.redMul(a))===0?u=h[0]:(u=h[1],assert$d(this.g.mul(u).x.cmp(this.g.x.redMul(a))===0))}var w;return t.basis?w=t.basis.map(function(x){return{a:new BN$8(x.a,16),b:new BN$8(x.b,16)}}):w=this._getEndoBasis(u),{beta:a,lambda:u,basis:w}}};ShortCurve.prototype._getEndoRoots=function(t){var a=t===this.p?this.red:BN$8.mont(t),u=new BN$8(2).toRed(a).redInvm(),d=u.redNeg(),h=new BN$8(3).toRed(a).redNeg().redSqrt().redMul(u),w=d.redAdd(h).fromRed(),x=d.redSub(h).fromRed();return[w,x]};ShortCurve.prototype._getEndoBasis=function(t){for(var a=this.n.ushrn(Math.floor(this.n.bitLength()/2)),u=t,d=this.n.clone(),h=new BN$8(1),w=new BN$8(0),x=new BN$8(0),M=new BN$8(1),B,E,S,k,C,q,O,U=0,P,L;u.cmpn(0)!==0;){var J=d.div(u);P=d.sub(J.mul(u)),L=x.sub(J.mul(h));var Y=M.sub(J.mul(w));if(!S&&P.cmp(a)<0)B=O.neg(),E=h,S=P.neg(),k=L;else if(S&&++U===2)break;O=P,d=u,u=P,x=h,h=L,M=w,w=Y}C=P.neg(),q=L;var ae=S.sqr().add(k.sqr()),oe=C.sqr().add(q.sqr());return oe.cmp(ae)>=0&&(C=B,q=E),S.negative&&(S=S.neg(),k=k.neg()),C.negative&&(C=C.neg(),q=q.neg()),[{a:S,b:k},{a:C,b:q}]};ShortCurve.prototype._endoSplit=function(t){var a=this.endo.basis,u=a[0],d=a[1],h=d.b.mul(t).divRound(this.n),w=u.b.neg().mul(t).divRound(this.n),x=h.mul(u.a),M=w.mul(d.a),B=h.mul(u.b),E=w.mul(d.b),S=t.sub(x).sub(M),k=B.add(E).neg();return{k1:S,k2:k}};ShortCurve.prototype.pointFromX=function(t,a){t=new BN$8(t,16),t.red||(t=t.toRed(this.red));var u=t.redSqr().redMul(t).redIAdd(t.redMul(this.a)).redIAdd(this.b),d=u.redSqrt();if(d.redSqr().redSub(u).cmp(this.zero)!==0)throw new Error("invalid point");var h=d.fromRed().isOdd();return(a&&!h||!a&&h)&&(d=d.redNeg()),this.point(t,d)};ShortCurve.prototype.validate=function(t){if(t.inf)return!0;var a=t.x,u=t.y,d=this.a.redMul(a),h=a.redSqr().redMul(a).redIAdd(d).redIAdd(this.b);return u.redSqr().redISub(h).cmpn(0)===0};ShortCurve.prototype._endoWnafMulAdd=function(t,a,u){for(var d=this._endoWnafT1,h=this._endoWnafT2,w=0;w<t.length;w++){var x=this._endoSplit(a[w]),M=t[w],B=M._getBeta();x.k1.negative&&(x.k1.ineg(),M=M.neg(!0)),x.k2.negative&&(x.k2.ineg(),B=B.neg(!0)),d[w*2]=M,d[w*2+1]=B,h[w*2]=x.k1,h[w*2+1]=x.k2}for(var E=this._wnafMulAdd(1,d,h,w*2,u),S=0;S<w*2;S++)d[S]=null,h[S]=null;return E};function Point$3(e,t,a,u){Base$2.BasePoint.call(this,e,"affine"),t===null&&a===null?(this.x=null,this.y=null,this.inf=!0):(this.x=new BN$8(t,16),this.y=new BN$8(a,16),u&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}inherits$4(Point$3,Base$2.BasePoint);ShortCurve.prototype.point=function(t,a,u){return new Point$3(this,t,a,u)};ShortCurve.prototype.pointFromJSON=function(t,a){return Point$3.fromJSON(this,t,a)};Point$3.prototype._getBeta=function(){if(this.curve.endo){var t=this.precomputed;if(t&&t.beta)return t.beta;var a=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(t){var u=this.curve,d=function(h){return u.point(h.x.redMul(u.endo.beta),h.y)};t.beta=a,a.precomputed={beta:null,naf:t.naf&&{wnd:t.naf.wnd,points:t.naf.points.map(d)},doubles:t.doubles&&{step:t.doubles.step,points:t.doubles.points.map(d)}}}return a}};Point$3.prototype.toJSON=function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]};Point$3.fromJSON=function(t,a,u){typeof a=="string"&&(a=JSON.parse(a));var d=t.point(a[0],a[1],u);if(!a[2])return d;function h(x){return t.point(x[0],x[1],u)}var w=a[2];return d.precomputed={beta:null,doubles:w.doubles&&{step:w.doubles.step,points:[d].concat(w.doubles.points.map(h))},naf:w.naf&&{wnd:w.naf.wnd,points:[d].concat(w.naf.points.map(h))}},d};Point$3.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"};Point$3.prototype.isInfinity=function(){return this.inf};Point$3.prototype.add=function(t){if(this.inf)return t;if(t.inf)return this;if(this.eq(t))return this.dbl();if(this.neg().eq(t))return this.curve.point(null,null);if(this.x.cmp(t.x)===0)return this.curve.point(null,null);var a=this.y.redSub(t.y);a.cmpn(0)!==0&&(a=a.redMul(this.x.redSub(t.x).redInvm()));var u=a.redSqr().redISub(this.x).redISub(t.x),d=a.redMul(this.x.redSub(u)).redISub(this.y);return this.curve.point(u,d)};Point$3.prototype.dbl=function(){if(this.inf)return this;var t=this.y.redAdd(this.y);if(t.cmpn(0)===0)return this.curve.point(null,null);var a=this.curve.a,u=this.x.redSqr(),d=t.redInvm(),h=u.redAdd(u).redIAdd(u).redIAdd(a).redMul(d),w=h.redSqr().redISub(this.x.redAdd(this.x)),x=h.redMul(this.x.redSub(w)).redISub(this.y);return this.curve.point(w,x)};Point$3.prototype.getX=function(){return this.x.fromRed()};Point$3.prototype.getY=function(){return this.y.fromRed()};Point$3.prototype.mul=function(t){return t=new BN$8(t,16),this.isInfinity()?this:this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve.endo?this.curve._endoWnafMulAdd([this],[t]):this.curve._wnafMul(this,t)};Point$3.prototype.mulAdd=function(t,a,u){var d=[this,a],h=[t,u];return this.curve.endo?this.curve._endoWnafMulAdd(d,h):this.curve._wnafMulAdd(1,d,h,2)};Point$3.prototype.jmulAdd=function(t,a,u){var d=[this,a],h=[t,u];return this.curve.endo?this.curve._endoWnafMulAdd(d,h,!0):this.curve._wnafMulAdd(1,d,h,2,!0)};Point$3.prototype.eq=function(t){return this===t||this.inf===t.inf&&(this.inf||this.x.cmp(t.x)===0&&this.y.cmp(t.y)===0)};Point$3.prototype.neg=function(t){if(this.inf)return this;var a=this.curve.point(this.x,this.y.redNeg());if(t&&this.precomputed){var u=this.precomputed,d=function(h){return h.neg()};a.precomputed={naf:u.naf&&{wnd:u.naf.wnd,points:u.naf.points.map(d)},doubles:u.doubles&&{step:u.doubles.step,points:u.doubles.points.map(d)}}}return a};Point$3.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var t=this.curve.jpoint(this.x,this.y,this.curve.one);return t};function JPoint(e,t,a,u){Base$2.BasePoint.call(this,e,"jacobian"),t===null&&a===null&&u===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new BN$8(0)):(this.x=new BN$8(t,16),this.y=new BN$8(a,16),this.z=new BN$8(u,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}inherits$4(JPoint,Base$2.BasePoint);ShortCurve.prototype.jpoint=function(t,a,u){return new JPoint(this,t,a,u)};JPoint.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var t=this.z.redInvm(),a=t.redSqr(),u=this.x.redMul(a),d=this.y.redMul(a).redMul(t);return this.curve.point(u,d)};JPoint.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)};JPoint.prototype.add=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var a=t.z.redSqr(),u=this.z.redSqr(),d=this.x.redMul(a),h=t.x.redMul(u),w=this.y.redMul(a.redMul(t.z)),x=t.y.redMul(u.redMul(this.z)),M=d.redSub(h),B=w.redSub(x);if(M.cmpn(0)===0)return B.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var E=M.redSqr(),S=E.redMul(M),k=d.redMul(E),C=B.redSqr().redIAdd(S).redISub(k).redISub(k),q=B.redMul(k.redISub(C)).redISub(w.redMul(S)),O=this.z.redMul(t.z).redMul(M);return this.curve.jpoint(C,q,O)};JPoint.prototype.mixedAdd=function(t){if(this.isInfinity())return t.toJ();if(t.isInfinity())return this;var a=this.z.redSqr(),u=this.x,d=t.x.redMul(a),h=this.y,w=t.y.redMul(a).redMul(this.z),x=u.redSub(d),M=h.redSub(w);if(x.cmpn(0)===0)return M.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var B=x.redSqr(),E=B.redMul(x),S=u.redMul(B),k=M.redSqr().redIAdd(E).redISub(S).redISub(S),C=M.redMul(S.redISub(k)).redISub(h.redMul(E)),q=this.z.redMul(x);return this.curve.jpoint(k,C,q)};JPoint.prototype.dblp=function(t){if(t===0)return this;if(this.isInfinity())return this;if(!t)return this.dbl();var a;if(this.curve.zeroA||this.curve.threeA){var u=this;for(a=0;a<t;a++)u=u.dbl();return u}var d=this.curve.a,h=this.curve.tinv,w=this.x,x=this.y,M=this.z,B=M.redSqr().redSqr(),E=x.redAdd(x);for(a=0;a<t;a++){var S=w.redSqr(),k=E.redSqr(),C=k.redSqr(),q=S.redAdd(S).redIAdd(S).redIAdd(d.redMul(B)),O=w.redMul(k),U=q.redSqr().redISub(O.redAdd(O)),P=O.redISub(U),L=q.redMul(P);L=L.redIAdd(L).redISub(C);var J=E.redMul(M);a+1<t&&(B=B.redMul(C)),w=U,M=J,E=L}return this.curve.jpoint(w,E.redMul(h),M)};JPoint.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()};JPoint.prototype._zeroDbl=function(){var t,a,u;if(this.zOne){var d=this.x.redSqr(),h=this.y.redSqr(),w=h.redSqr(),x=this.x.redAdd(h).redSqr().redISub(d).redISub(w);x=x.redIAdd(x);var M=d.redAdd(d).redIAdd(d),B=M.redSqr().redISub(x).redISub(x),E=w.redIAdd(w);E=E.redIAdd(E),E=E.redIAdd(E),t=B,a=M.redMul(x.redISub(B)).redISub(E),u=this.y.redAdd(this.y)}else{var S=this.x.redSqr(),k=this.y.redSqr(),C=k.redSqr(),q=this.x.redAdd(k).redSqr().redISub(S).redISub(C);q=q.redIAdd(q);var O=S.redAdd(S).redIAdd(S),U=O.redSqr(),P=C.redIAdd(C);P=P.redIAdd(P),P=P.redIAdd(P),t=U.redISub(q).redISub(q),a=O.redMul(q.redISub(t)).redISub(P),u=this.y.redMul(this.z),u=u.redIAdd(u)}return this.curve.jpoint(t,a,u)};JPoint.prototype._threeDbl=function(){var t,a,u;if(this.zOne){var d=this.x.redSqr(),h=this.y.redSqr(),w=h.redSqr(),x=this.x.redAdd(h).redSqr().redISub(d).redISub(w);x=x.redIAdd(x);var M=d.redAdd(d).redIAdd(d).redIAdd(this.curve.a),B=M.redSqr().redISub(x).redISub(x);t=B;var E=w.redIAdd(w);E=E.redIAdd(E),E=E.redIAdd(E),a=M.redMul(x.redISub(B)).redISub(E),u=this.y.redAdd(this.y)}else{var S=this.z.redSqr(),k=this.y.redSqr(),C=this.x.redMul(k),q=this.x.redSub(S).redMul(this.x.redAdd(S));q=q.redAdd(q).redIAdd(q);var O=C.redIAdd(C);O=O.redIAdd(O);var U=O.redAdd(O);t=q.redSqr().redISub(U),u=this.y.redAdd(this.z).redSqr().redISub(k).redISub(S);var P=k.redSqr();P=P.redIAdd(P),P=P.redIAdd(P),P=P.redIAdd(P),a=q.redMul(O.redISub(t)).redISub(P)}return this.curve.jpoint(t,a,u)};JPoint.prototype._dbl=function(){var t=this.curve.a,a=this.x,u=this.y,d=this.z,h=d.redSqr().redSqr(),w=a.redSqr(),x=u.redSqr(),M=w.redAdd(w).redIAdd(w).redIAdd(t.redMul(h)),B=a.redAdd(a);B=B.redIAdd(B);var E=B.redMul(x),S=M.redSqr().redISub(E.redAdd(E)),k=E.redISub(S),C=x.redSqr();C=C.redIAdd(C),C=C.redIAdd(C),C=C.redIAdd(C);var q=M.redMul(k).redISub(C),O=u.redAdd(u).redMul(d);return this.curve.jpoint(S,q,O)};JPoint.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var t=this.x.redSqr(),a=this.y.redSqr(),u=this.z.redSqr(),d=a.redSqr(),h=t.redAdd(t).redIAdd(t),w=h.redSqr(),x=this.x.redAdd(a).redSqr().redISub(t).redISub(d);x=x.redIAdd(x),x=x.redAdd(x).redIAdd(x),x=x.redISub(w);var M=x.redSqr(),B=d.redIAdd(d);B=B.redIAdd(B),B=B.redIAdd(B),B=B.redIAdd(B);var E=h.redIAdd(x).redSqr().redISub(w).redISub(M).redISub(B),S=a.redMul(E);S=S.redIAdd(S),S=S.redIAdd(S);var k=this.x.redMul(M).redISub(S);k=k.redIAdd(k),k=k.redIAdd(k);var C=this.y.redMul(E.redMul(B.redISub(E)).redISub(x.redMul(M)));C=C.redIAdd(C),C=C.redIAdd(C),C=C.redIAdd(C);var q=this.z.redAdd(x).redSqr().redISub(u).redISub(M);return this.curve.jpoint(k,C,q)};JPoint.prototype.mul=function(t,a){return t=new BN$8(t,a),this.curve._wnafMul(this,t)};JPoint.prototype.eq=function(t){if(t.type==="affine")return this.eq(t.toJ());if(this===t)return!0;var a=this.z.redSqr(),u=t.z.redSqr();if(this.x.redMul(u).redISub(t.x.redMul(a)).cmpn(0)!==0)return!1;var d=a.redMul(this.z),h=u.redMul(t.z);return this.y.redMul(h).redISub(t.y.redMul(d)).cmpn(0)===0};JPoint.prototype.eqXToP=function(t){var a=this.z.redSqr(),u=t.toRed(this.curve.red).redMul(a);if(this.x.cmp(u)===0)return!0;for(var d=t.clone(),h=this.curve.redN.redMul(a);;){if(d.iadd(this.curve.n),d.cmp(this.curve.p)>=0)return!1;if(u.redIAdd(h),this.x.cmp(u)===0)return!0}};JPoint.prototype.inspect=function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"};JPoint.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var BN$7=bnExports$3,inherits$3=inherits_browserExports,Base$1=base$1,utils$h=utils$l;function MontCurve(e){Base$1.call(this,"mont",e),this.a=new BN$7(e.a,16).toRed(this.red),this.b=new BN$7(e.b,16).toRed(this.red),this.i4=new BN$7(4).toRed(this.red).redInvm(),this.two=new BN$7(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}inherits$3(MontCurve,Base$1);var mont=MontCurve;MontCurve.prototype.validate=function(t){var a=t.normalize().x,u=a.redSqr(),d=u.redMul(a).redAdd(u.redMul(this.a)).redAdd(a),h=d.redSqrt();return h.redSqr().cmp(d)===0};function Point$2(e,t,a){Base$1.BasePoint.call(this,e,"projective"),t===null&&a===null?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new BN$7(t,16),this.z=new BN$7(a,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}inherits$3(Point$2,Base$1.BasePoint);MontCurve.prototype.decodePoint=function(t,a){return this.point(utils$h.toArray(t,a),1)};MontCurve.prototype.point=function(t,a){return new Point$2(this,t,a)};MontCurve.prototype.pointFromJSON=function(t){return Point$2.fromJSON(this,t)};Point$2.prototype.precompute=function(){};Point$2.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())};Point$2.fromJSON=function(t,a){return new Point$2(t,a[0],a[1]||t.one)};Point$2.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"};Point$2.prototype.isInfinity=function(){return this.z.cmpn(0)===0};Point$2.prototype.dbl=function(){var t=this.x.redAdd(this.z),a=t.redSqr(),u=this.x.redSub(this.z),d=u.redSqr(),h=a.redSub(d),w=a.redMul(d),x=h.redMul(d.redAdd(this.curve.a24.redMul(h)));return this.curve.point(w,x)};Point$2.prototype.add=function(){throw new Error("Not supported on Montgomery curve")};Point$2.prototype.diffAdd=function(t,a){var u=this.x.redAdd(this.z),d=this.x.redSub(this.z),h=t.x.redAdd(t.z),w=t.x.redSub(t.z),x=w.redMul(u),M=h.redMul(d),B=a.z.redMul(x.redAdd(M).redSqr()),E=a.x.redMul(x.redISub(M).redSqr());return this.curve.point(B,E)};Point$2.prototype.mul=function(t){for(var a=t.clone(),u=this,d=this.curve.point(null,null),h=this,w=[];a.cmpn(0)!==0;a.iushrn(1))w.push(a.andln(1));for(var x=w.length-1;x>=0;x--)w[x]===0?(u=u.diffAdd(d,h),d=d.dbl()):(d=u.diffAdd(d,h),u=u.dbl());return d};Point$2.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")};Point$2.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")};Point$2.prototype.eq=function(t){return this.getX().cmp(t.getX())===0};Point$2.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this};Point$2.prototype.getX=function(){return this.normalize(),this.x.fromRed()};var utils$g=utils$l,BN$6=bnExports$3,inherits$2=inherits_browserExports,Base=base$1,assert$c=utils$g.assert;function EdwardsCurve(e){this.twisted=(e.a|0)!==1,this.mOneA=this.twisted&&(e.a|0)===-1,this.extended=this.mOneA,Base.call(this,"edwards",e),this.a=new BN$6(e.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new BN$6(e.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new BN$6(e.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),assert$c(!this.twisted||this.c.fromRed().cmpn(1)===0),this.oneC=(e.c|0)===1}inherits$2(EdwardsCurve,Base);var edwards=EdwardsCurve;EdwardsCurve.prototype._mulA=function(t){return this.mOneA?t.redNeg():this.a.redMul(t)};EdwardsCurve.prototype._mulC=function(t){return this.oneC?t:this.c.redMul(t)};EdwardsCurve.prototype.jpoint=function(t,a,u,d){return this.point(t,a,u,d)};EdwardsCurve.prototype.pointFromX=function(t,a){t=new BN$6(t,16),t.red||(t=t.toRed(this.red));var u=t.redSqr(),d=this.c2.redSub(this.a.redMul(u)),h=this.one.redSub(this.c2.redMul(this.d).redMul(u)),w=d.redMul(h.redInvm()),x=w.redSqrt();if(x.redSqr().redSub(w).cmp(this.zero)!==0)throw new Error("invalid point");var M=x.fromRed().isOdd();return(a&&!M||!a&&M)&&(x=x.redNeg()),this.point(t,x)};EdwardsCurve.prototype.pointFromY=function(t,a){t=new BN$6(t,16),t.red||(t=t.toRed(this.red));var u=t.redSqr(),d=u.redSub(this.c2),h=u.redMul(this.d).redMul(this.c2).redSub(this.a),w=d.redMul(h.redInvm());if(w.cmp(this.zero)===0){if(a)throw new Error("invalid point");return this.point(this.zero,t)}var x=w.redSqrt();if(x.redSqr().redSub(w).cmp(this.zero)!==0)throw new Error("invalid point");return x.fromRed().isOdd()!==a&&(x=x.redNeg()),this.point(x,t)};EdwardsCurve.prototype.validate=function(t){if(t.isInfinity())return!0;t.normalize();var a=t.x.redSqr(),u=t.y.redSqr(),d=a.redMul(this.a).redAdd(u),h=this.c2.redMul(this.one.redAdd(this.d.redMul(a).redMul(u)));return d.cmp(h)===0};function Point$1(e,t,a,u,d){Base.BasePoint.call(this,e,"projective"),t===null&&a===null&&u===null?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new BN$6(t,16),this.y=new BN$6(a,16),this.z=u?new BN$6(u,16):this.curve.one,this.t=d&&new BN$6(d,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}inherits$2(Point$1,Base.BasePoint);EdwardsCurve.prototype.pointFromJSON=function(t){return Point$1.fromJSON(this,t)};EdwardsCurve.prototype.point=function(t,a,u,d){return new Point$1(this,t,a,u,d)};Point$1.fromJSON=function(t,a){return new Point$1(t,a[0],a[1],a[2])};Point$1.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"};Point$1.prototype.isInfinity=function(){return this.x.cmpn(0)===0&&(this.y.cmp(this.z)===0||this.zOne&&this.y.cmp(this.curve.c)===0)};Point$1.prototype._extDbl=function(){var t=this.x.redSqr(),a=this.y.redSqr(),u=this.z.redSqr();u=u.redIAdd(u);var d=this.curve._mulA(t),h=this.x.redAdd(this.y).redSqr().redISub(t).redISub(a),w=d.redAdd(a),x=w.redSub(u),M=d.redSub(a),B=h.redMul(x),E=w.redMul(M),S=h.redMul(M),k=x.redMul(w);return this.curve.point(B,E,k,S)};Point$1.prototype._projDbl=function(){var t=this.x.redAdd(this.y).redSqr(),a=this.x.redSqr(),u=this.y.redSqr(),d,h,w,x,M,B;if(this.curve.twisted){x=this.curve._mulA(a);var E=x.redAdd(u);this.zOne?(d=t.redSub(a).redSub(u).redMul(E.redSub(this.curve.two)),h=E.redMul(x.redSub(u)),w=E.redSqr().redSub(E).redSub(E)):(M=this.z.redSqr(),B=E.redSub(M).redISub(M),d=t.redSub(a).redISub(u).redMul(B),h=E.redMul(x.redSub(u)),w=E.redMul(B))}else x=a.redAdd(u),M=this.curve._mulC(this.z).redSqr(),B=x.redSub(M).redSub(M),d=this.curve._mulC(t.redISub(x)).redMul(B),h=this.curve._mulC(x).redMul(a.redISub(u)),w=x.redMul(B);return this.curve.point(d,h,w)};Point$1.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()};Point$1.prototype._extAdd=function(t){var a=this.y.redSub(this.x).redMul(t.y.redSub(t.x)),u=this.y.redAdd(this.x).redMul(t.y.redAdd(t.x)),d=this.t.redMul(this.curve.dd).redMul(t.t),h=this.z.redMul(t.z.redAdd(t.z)),w=u.redSub(a),x=h.redSub(d),M=h.redAdd(d),B=u.redAdd(a),E=w.redMul(x),S=M.redMul(B),k=w.redMul(B),C=x.redMul(M);return this.curve.point(E,S,C,k)};Point$1.prototype._projAdd=function(t){var a=this.z.redMul(t.z),u=a.redSqr(),d=this.x.redMul(t.x),h=this.y.redMul(t.y),w=this.curve.d.redMul(d).redMul(h),x=u.redSub(w),M=u.redAdd(w),B=this.x.redAdd(this.y).redMul(t.x.redAdd(t.y)).redISub(d).redISub(h),E=a.redMul(x).redMul(B),S,k;return this.curve.twisted?(S=a.redMul(M).redMul(h.redSub(this.curve._mulA(d))),k=x.redMul(M)):(S=a.redMul(M).redMul(h.redSub(d)),k=this.curve._mulC(x).redMul(M)),this.curve.point(E,S,k)};Point$1.prototype.add=function(t){return this.isInfinity()?t:t.isInfinity()?this:this.curve.extended?this._extAdd(t):this._projAdd(t)};Point$1.prototype.mul=function(t){return this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve._wnafMul(this,t)};Point$1.prototype.mulAdd=function(t,a,u){return this.curve._wnafMulAdd(1,[this,a],[t,u],2,!1)};Point$1.prototype.jmulAdd=function(t,a,u){return this.curve._wnafMulAdd(1,[this,a],[t,u],2,!0)};Point$1.prototype.normalize=function(){if(this.zOne)return this;var t=this.z.redInvm();return this.x=this.x.redMul(t),this.y=this.y.redMul(t),this.t&&(this.t=this.t.redMul(t)),this.z=this.curve.one,this.zOne=!0,this};Point$1.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())};Point$1.prototype.getX=function(){return this.normalize(),this.x.fromRed()};Point$1.prototype.getY=function(){return this.normalize(),this.y.fromRed()};Point$1.prototype.eq=function(t){return this===t||this.getX().cmp(t.getX())===0&&this.getY().cmp(t.getY())===0};Point$1.prototype.eqXToP=function(t){var a=t.toRed(this.curve.red).redMul(this.z);if(this.x.cmp(a)===0)return!0;for(var u=t.clone(),d=this.curve.redN.redMul(this.z);;){if(u.iadd(this.curve.n),u.cmp(this.curve.p)>=0)return!1;if(a.redIAdd(d),this.x.cmp(a)===0)return!0}};Point$1.prototype.toP=Point$1.prototype.normalize;Point$1.prototype.mixedAdd=Point$1.prototype.add;(function(e){var t=e;t.base=base$1,t.short=short,t.mont=mont,t.edwards=edwards})(curve);var curves$1={},hash$3={},utils$f={},assert$b=minimalisticAssert,inherits$1=inherits_browserExports;utils$f.inherits=inherits$1;function isSurrogatePair(e,t){return(e.charCodeAt(t)&64512)!==55296||t<0||t+1>=e.length?!1:(e.charCodeAt(t+1)&64512)===56320}function toArray(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var a=[];if(typeof e=="string")if(t){if(t==="hex")for(e=e.replace(/[^a-z0-9]+/ig,""),e.length%2!==0&&(e="0"+e),d=0;d<e.length;d+=2)a.push(parseInt(e[d]+e[d+1],16))}else for(var u=0,d=0;d<e.length;d++){var h=e.charCodeAt(d);h<128?a[u++]=h:h<2048?(a[u++]=h>>6|192,a[u++]=h&63|128):isSurrogatePair(e,d)?(h=65536+((h&1023)<<10)+(e.charCodeAt(++d)&1023),a[u++]=h>>18|240,a[u++]=h>>12&63|128,a[u++]=h>>6&63|128,a[u++]=h&63|128):(a[u++]=h>>12|224,a[u++]=h>>6&63|128,a[u++]=h&63|128)}else for(d=0;d<e.length;d++)a[d]=e[d]|0;return a}utils$f.toArray=toArray;function toHex(e){for(var t="",a=0;a<e.length;a++)t+=zero2(e[a].toString(16));return t}utils$f.toHex=toHex;function htonl(e){var t=e>>>24|e>>>8&65280|e<<8&16711680|(e&255)<<24;return t>>>0}utils$f.htonl=htonl;function toHex32(e,t){for(var a="",u=0;u<e.length;u++){var d=e[u];t==="little"&&(d=htonl(d)),a+=zero8(d.toString(16))}return a}utils$f.toHex32=toHex32;function zero2(e){return e.length===1?"0"+e:e}utils$f.zero2=zero2;function zero8(e){return e.length===7?"0"+e:e.length===6?"00"+e:e.length===5?"000"+e:e.length===4?"0000"+e:e.length===3?"00000"+e:e.length===2?"000000"+e:e.length===1?"0000000"+e:e}utils$f.zero8=zero8;function join32(e,t,a,u){var d=a-t;assert$b(d%4===0);for(var h=new Array(d/4),w=0,x=t;w<h.length;w++,x+=4){var M;u==="big"?M=e[x]<<24|e[x+1]<<16|e[x+2]<<8|e[x+3]:M=e[x+3]<<24|e[x+2]<<16|e[x+1]<<8|e[x],h[w]=M>>>0}return h}utils$f.join32=join32;function split32(e,t){for(var a=new Array(e.length*4),u=0,d=0;u<e.length;u++,d+=4){var h=e[u];t==="big"?(a[d]=h>>>24,a[d+1]=h>>>16&255,a[d+2]=h>>>8&255,a[d+3]=h&255):(a[d+3]=h>>>24,a[d+2]=h>>>16&255,a[d+1]=h>>>8&255,a[d]=h&255)}return a}utils$f.split32=split32;function rotr32$1(e,t){return e>>>t|e<<32-t}utils$f.rotr32=rotr32$1;function rotl32$2(e,t){return e<<t|e>>>32-t}utils$f.rotl32=rotl32$2;function sum32$3(e,t){return e+t>>>0}utils$f.sum32=sum32$3;function sum32_3$1(e,t,a){return e+t+a>>>0}utils$f.sum32_3=sum32_3$1;function sum32_4$2(e,t,a,u){return e+t+a+u>>>0}utils$f.sum32_4=sum32_4$2;function sum32_5$2(e,t,a,u,d){return e+t+a+u+d>>>0}utils$f.sum32_5=sum32_5$2;function sum64$1(e,t,a,u){var d=e[t],h=e[t+1],w=u+h>>>0,x=(w<u?1:0)+a+d;e[t]=x>>>0,e[t+1]=w}utils$f.sum64=sum64$1;function sum64_hi$1(e,t,a,u){var d=t+u>>>0,h=(d<t?1:0)+e+a;return h>>>0}utils$f.sum64_hi=sum64_hi$1;function sum64_lo$1(e,t,a,u){var d=t+u;return d>>>0}utils$f.sum64_lo=sum64_lo$1;function sum64_4_hi$1(e,t,a,u,d,h,w,x){var M=0,B=t;B=B+u>>>0,M+=B<t?1:0,B=B+h>>>0,M+=B<h?1:0,B=B+x>>>0,M+=B<x?1:0;var E=e+a+d+w+M;return E>>>0}utils$f.sum64_4_hi=sum64_4_hi$1;function sum64_4_lo$1(e,t,a,u,d,h,w,x){var M=t+u+h+x;return M>>>0}utils$f.sum64_4_lo=sum64_4_lo$1;function sum64_5_hi$1(e,t,a,u,d,h,w,x,M,B){var E=0,S=t;S=S+u>>>0,E+=S<t?1:0,S=S+h>>>0,E+=S<h?1:0,S=S+x>>>0,E+=S<x?1:0,S=S+B>>>0,E+=S<B?1:0;var k=e+a+d+w+M+E;return k>>>0}utils$f.sum64_5_hi=sum64_5_hi$1;function sum64_5_lo$1(e,t,a,u,d,h,w,x,M,B){var E=t+u+h+x+B;return E>>>0}utils$f.sum64_5_lo=sum64_5_lo$1;function rotr64_hi$1(e,t,a){var u=t<<32-a|e>>>a;return u>>>0}utils$f.rotr64_hi=rotr64_hi$1;function rotr64_lo$1(e,t,a){var u=e<<32-a|t>>>a;return u>>>0}utils$f.rotr64_lo=rotr64_lo$1;function shr64_hi$1(e,t,a){return e>>>a}utils$f.shr64_hi=shr64_hi$1;function shr64_lo$1(e,t,a){var u=e<<32-a|t>>>a;return u>>>0}utils$f.shr64_lo=shr64_lo$1;var common$5={},utils$e=utils$f,assert$a=minimalisticAssert;function BlockHash$4(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}common$5.BlockHash=BlockHash$4;BlockHash$4.prototype.update=function(t,a){if(t=utils$e.toArray(t,a),this.pending?this.pending=this.pending.concat(t):this.pending=t,this.pendingTotal+=t.length,this.pending.length>=this._delta8){t=this.pending;var u=t.length%this._delta8;this.pending=t.slice(t.length-u,t.length),this.pending.length===0&&(this.pending=null),t=utils$e.join32(t,0,t.length-u,this.endian);for(var d=0;d<t.length;d+=this._delta32)this._update(t,d,d+this._delta32)}return this};BlockHash$4.prototype.digest=function(t){return this.update(this._pad()),assert$a(this.pending===null),this._digest(t)};BlockHash$4.prototype._pad=function(){var t=this.pendingTotal,a=this._delta8,u=a-(t+this.padLength)%a,d=new Array(u+this.padLength);d[0]=128;for(var h=1;h<u;h++)d[h]=0;if(t<<=3,this.endian==="big"){for(var w=8;w<this.padLength;w++)d[h++]=0;d[h++]=0,d[h++]=0,d[h++]=0,d[h++]=0,d[h++]=t>>>24&255,d[h++]=t>>>16&255,d[h++]=t>>>8&255,d[h++]=t&255}else for(d[h++]=t&255,d[h++]=t>>>8&255,d[h++]=t>>>16&255,d[h++]=t>>>24&255,d[h++]=0,d[h++]=0,d[h++]=0,d[h++]=0,w=8;w<this.padLength;w++)d[h++]=0;return d};var sha={},common$4={},utils$d=utils$f,rotr32=utils$d.rotr32;function ft_1$1(e,t,a,u){if(e===0)return ch32$1(t,a,u);if(e===1||e===3)return p32(t,a,u);if(e===2)return maj32$1(t,a,u)}common$4.ft_1=ft_1$1;function ch32$1(e,t,a){return e&t^~e&a}common$4.ch32=ch32$1;function maj32$1(e,t,a){return e&t^e&a^t&a}common$4.maj32=maj32$1;function p32(e,t,a){return e^t^a}common$4.p32=p32;function s0_256$1(e){return rotr32(e,2)^rotr32(e,13)^rotr32(e,22)}common$4.s0_256=s0_256$1;function s1_256$1(e){return rotr32(e,6)^rotr32(e,11)^rotr32(e,25)}common$4.s1_256=s1_256$1;function g0_256$1(e){return rotr32(e,7)^rotr32(e,18)^e>>>3}common$4.g0_256=g0_256$1;function g1_256$1(e){return rotr32(e,17)^rotr32(e,19)^e>>>10}common$4.g1_256=g1_256$1;var utils$c=utils$f,common$3=common$5,shaCommon$1=common$4,rotl32$1=utils$c.rotl32,sum32$2=utils$c.sum32,sum32_5$1=utils$c.sum32_5,ft_1=shaCommon$1.ft_1,BlockHash$3=common$3.BlockHash,sha1_K=[1518500249,1859775393,2400959708,3395469782];function SHA1(){if(!(this instanceof SHA1))return new SHA1;BlockHash$3.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}utils$c.inherits(SHA1,BlockHash$3);var _1=SHA1;SHA1.blockSize=512;SHA1.outSize=160;SHA1.hmacStrength=80;SHA1.padLength=64;SHA1.prototype._update=function(t,a){for(var u=this.W,d=0;d<16;d++)u[d]=t[a+d];for(;d<u.length;d++)u[d]=rotl32$1(u[d-3]^u[d-8]^u[d-14]^u[d-16],1);var h=this.h[0],w=this.h[1],x=this.h[2],M=this.h[3],B=this.h[4];for(d=0;d<u.length;d++){var E=~~(d/20),S=sum32_5$1(rotl32$1(h,5),ft_1(E,w,x,M),B,u[d],sha1_K[E]);B=M,M=x,x=rotl32$1(w,30),w=h,h=S}this.h[0]=sum32$2(this.h[0],h),this.h[1]=sum32$2(this.h[1],w),this.h[2]=sum32$2(this.h[2],x),this.h[3]=sum32$2(this.h[3],M),this.h[4]=sum32$2(this.h[4],B)};SHA1.prototype._digest=function(t){return t==="hex"?utils$c.toHex32(this.h,"big"):utils$c.split32(this.h,"big")};var utils$b=utils$f,common$2=common$5,shaCommon=common$4,assert$9=minimalisticAssert,sum32$1=utils$b.sum32,sum32_4$1=utils$b.sum32_4,sum32_5=utils$b.sum32_5,ch32=shaCommon.ch32,maj32=shaCommon.maj32,s0_256=shaCommon.s0_256,s1_256=shaCommon.s1_256,g0_256=shaCommon.g0_256,g1_256=shaCommon.g1_256,BlockHash$2=common$2.BlockHash,sha256_K=[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];function SHA256$2(){if(!(this instanceof SHA256$2))return new SHA256$2;BlockHash$2.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=sha256_K,this.W=new Array(64)}utils$b.inherits(SHA256$2,BlockHash$2);var _256=SHA256$2;SHA256$2.blockSize=512;SHA256$2.outSize=256;SHA256$2.hmacStrength=192;SHA256$2.padLength=64;SHA256$2.prototype._update=function(t,a){for(var u=this.W,d=0;d<16;d++)u[d]=t[a+d];for(;d<u.length;d++)u[d]=sum32_4$1(g1_256(u[d-2]),u[d-7],g0_256(u[d-15]),u[d-16]);var h=this.h[0],w=this.h[1],x=this.h[2],M=this.h[3],B=this.h[4],E=this.h[5],S=this.h[6],k=this.h[7];for(assert$9(this.k.length===u.length),d=0;d<u.length;d++){var C=sum32_5(k,s1_256(B),ch32(B,E,S),this.k[d],u[d]),q=sum32$1(s0_256(h),maj32(h,w,x));k=S,S=E,E=B,B=sum32$1(M,C),M=x,x=w,w=h,h=sum32$1(C,q)}this.h[0]=sum32$1(this.h[0],h),this.h[1]=sum32$1(this.h[1],w),this.h[2]=sum32$1(this.h[2],x),this.h[3]=sum32$1(this.h[3],M),this.h[4]=sum32$1(this.h[4],B),this.h[5]=sum32$1(this.h[5],E),this.h[6]=sum32$1(this.h[6],S),this.h[7]=sum32$1(this.h[7],k)};SHA256$2.prototype._digest=function(t){return t==="hex"?utils$b.toHex32(this.h,"big"):utils$b.split32(this.h,"big")};var utils$a=utils$f,SHA256$1=_256;function SHA224$1(){if(!(this instanceof SHA224$1))return new SHA224$1;SHA256$1.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}utils$a.inherits(SHA224$1,SHA256$1);var _224=SHA224$1;SHA224$1.blockSize=512;SHA224$1.outSize=224;SHA224$1.hmacStrength=192;SHA224$1.padLength=64;SHA224$1.prototype._digest=function(t){return t==="hex"?utils$a.toHex32(this.h.slice(0,7),"big"):utils$a.split32(this.h.slice(0,7),"big")};var utils$9=utils$f,common$1=common$5,assert$8=minimalisticAssert,rotr64_hi=utils$9.rotr64_hi,rotr64_lo=utils$9.rotr64_lo,shr64_hi=utils$9.shr64_hi,shr64_lo=utils$9.shr64_lo,sum64=utils$9.sum64,sum64_hi=utils$9.sum64_hi,sum64_lo=utils$9.sum64_lo,sum64_4_hi=utils$9.sum64_4_hi,sum64_4_lo=utils$9.sum64_4_lo,sum64_5_hi=utils$9.sum64_5_hi,sum64_5_lo=utils$9.sum64_5_lo,BlockHash$1=common$1.BlockHash,sha512_K=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function SHA512$1(){if(!(this instanceof SHA512$1))return new SHA512$1;BlockHash$1.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=sha512_K,this.W=new Array(160)}utils$9.inherits(SHA512$1,BlockHash$1);var _512=SHA512$1;SHA512$1.blockSize=1024;SHA512$1.outSize=512;SHA512$1.hmacStrength=192;SHA512$1.padLength=128;SHA512$1.prototype._prepareBlock=function(t,a){for(var u=this.W,d=0;d<32;d++)u[d]=t[a+d];for(;d<u.length;d+=2){var h=g1_512_hi(u[d-4],u[d-3]),w=g1_512_lo(u[d-4],u[d-3]),x=u[d-14],M=u[d-13],B=g0_512_hi(u[d-30],u[d-29]),E=g0_512_lo(u[d-30],u[d-29]),S=u[d-32],k=u[d-31];u[d]=sum64_4_hi(h,w,x,M,B,E,S,k),u[d+1]=sum64_4_lo(h,w,x,M,B,E,S,k)}};SHA512$1.prototype._update=function(t,a){this._prepareBlock(t,a);var u=this.W,d=this.h[0],h=this.h[1],w=this.h[2],x=this.h[3],M=this.h[4],B=this.h[5],E=this.h[6],S=this.h[7],k=this.h[8],C=this.h[9],q=this.h[10],O=this.h[11],U=this.h[12],P=this.h[13],L=this.h[14],J=this.h[15];assert$8(this.k.length===u.length);for(var Y=0;Y<u.length;Y+=2){var ae=L,oe=J,ue=s1_512_hi(k,C),se=s1_512_lo(k,C),ie=ch64_hi(k,C,q,O,U),ce=ch64_lo(k,C,q,O,U,P),$=this.k[Y],n=this.k[Y+1],l=u[Y],c=u[Y+1],p=sum64_5_hi(ae,oe,ue,se,ie,ce,$,n,l,c),y=sum64_5_lo(ae,oe,ue,se,ie,ce,$,n,l,c);ae=s0_512_hi(d,h),oe=s0_512_lo(d,h),ue=maj64_hi(d,h,w,x,M),se=maj64_lo(d,h,w,x,M,B);var b=sum64_hi(ae,oe,ue,se),_=sum64_lo(ae,oe,ue,se);L=U,J=P,U=q,P=O,q=k,O=C,k=sum64_hi(E,S,p,y),C=sum64_lo(S,S,p,y),E=M,S=B,M=w,B=x,w=d,x=h,d=sum64_hi(p,y,b,_),h=sum64_lo(p,y,b,_)}sum64(this.h,0,d,h),sum64(this.h,2,w,x),sum64(this.h,4,M,B),sum64(this.h,6,E,S),sum64(this.h,8,k,C),sum64(this.h,10,q,O),sum64(this.h,12,U,P),sum64(this.h,14,L,J)};SHA512$1.prototype._digest=function(t){return t==="hex"?utils$9.toHex32(this.h,"big"):utils$9.split32(this.h,"big")};function ch64_hi(e,t,a,u,d){var h=e&a^~e&d;return h<0&&(h+=4294967296),h}function ch64_lo(e,t,a,u,d,h){var w=t&u^~t&h;return w<0&&(w+=4294967296),w}function maj64_hi(e,t,a,u,d){var h=e&a^e&d^a&d;return h<0&&(h+=4294967296),h}function maj64_lo(e,t,a,u,d,h){var w=t&u^t&h^u&h;return w<0&&(w+=4294967296),w}function s0_512_hi(e,t){var a=rotr64_hi(e,t,28),u=rotr64_hi(t,e,2),d=rotr64_hi(t,e,7),h=a^u^d;return h<0&&(h+=4294967296),h}function s0_512_lo(e,t){var a=rotr64_lo(e,t,28),u=rotr64_lo(t,e,2),d=rotr64_lo(t,e,7),h=a^u^d;return h<0&&(h+=4294967296),h}function s1_512_hi(e,t){var a=rotr64_hi(e,t,14),u=rotr64_hi(e,t,18),d=rotr64_hi(t,e,9),h=a^u^d;return h<0&&(h+=4294967296),h}function s1_512_lo(e,t){var a=rotr64_lo(e,t,14),u=rotr64_lo(e,t,18),d=rotr64_lo(t,e,9),h=a^u^d;return h<0&&(h+=4294967296),h}function g0_512_hi(e,t){var a=rotr64_hi(e,t,1),u=rotr64_hi(e,t,8),d=shr64_hi(e,t,7),h=a^u^d;return h<0&&(h+=4294967296),h}function g0_512_lo(e,t){var a=rotr64_lo(e,t,1),u=rotr64_lo(e,t,8),d=shr64_lo(e,t,7),h=a^u^d;return h<0&&(h+=4294967296),h}function g1_512_hi(e,t){var a=rotr64_hi(e,t,19),u=rotr64_hi(t,e,29),d=shr64_hi(e,t,6),h=a^u^d;return h<0&&(h+=4294967296),h}function g1_512_lo(e,t){var a=rotr64_lo(e,t,19),u=rotr64_lo(t,e,29),d=shr64_lo(e,t,6),h=a^u^d;return h<0&&(h+=4294967296),h}var utils$8=utils$f,SHA512=_512;function SHA384(){if(!(this instanceof SHA384))return new SHA384;SHA512.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}utils$8.inherits(SHA384,SHA512);var _384=SHA384;SHA384.blockSize=1024;SHA384.outSize=384;SHA384.hmacStrength=192;SHA384.padLength=128;SHA384.prototype._digest=function(t){return t==="hex"?utils$8.toHex32(this.h.slice(0,12),"big"):utils$8.split32(this.h.slice(0,12),"big")};sha.sha1=_1;sha.sha224=_224;sha.sha256=_256;sha.sha384=_384;sha.sha512=_512;var ripemd={},utils$7=utils$f,common=common$5,rotl32=utils$7.rotl32,sum32=utils$7.sum32,sum32_3=utils$7.sum32_3,sum32_4=utils$7.sum32_4,BlockHash=common.BlockHash;function RIPEMD160(){if(!(this instanceof RIPEMD160))return new RIPEMD160;BlockHash.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}utils$7.inherits(RIPEMD160,BlockHash);ripemd.ripemd160=RIPEMD160;RIPEMD160.blockSize=512;RIPEMD160.outSize=160;RIPEMD160.hmacStrength=192;RIPEMD160.padLength=64;RIPEMD160.prototype._update=function(t,a){for(var u=this.h[0],d=this.h[1],h=this.h[2],w=this.h[3],x=this.h[4],M=u,B=d,E=h,S=w,k=x,C=0;C<80;C++){var q=sum32(rotl32(sum32_4(u,f(C,d,h,w),t[r[C]+a],K(C)),s[C]),x);u=x,x=w,w=rotl32(h,10),h=d,d=q,q=sum32(rotl32(sum32_4(M,f(79-C,B,E,S),t[rh[C]+a],Kh(C)),sh[C]),k),M=k,k=S,S=rotl32(E,10),E=B,B=q}q=sum32_3(this.h[1],h,S),this.h[1]=sum32_3(this.h[2],w,k),this.h[2]=sum32_3(this.h[3],x,M),this.h[3]=sum32_3(this.h[4],u,B),this.h[4]=sum32_3(this.h[0],d,E),this.h[0]=q};RIPEMD160.prototype._digest=function(t){return t==="hex"?utils$7.toHex32(this.h,"little"):utils$7.split32(this.h,"little")};function f(e,t,a,u){return e<=15?t^a^u:e<=31?t&a|~t&u:e<=47?(t|~a)^u:e<=63?t&u|a&~u:t^(a|~u)}function K(e){return e<=15?0:e<=31?1518500249:e<=47?1859775393:e<=63?2400959708:2840853838}function Kh(e){return e<=15?1352829926:e<=31?1548603684:e<=47?1836072691:e<=63?2053994217:0}var r=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],rh=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],s=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],sh=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],utils$6=utils$f,assert$7=minimalisticAssert;function Hmac(e,t,a){if(!(this instanceof Hmac))return new Hmac(e,t,a);this.Hash=e,this.blockSize=e.blockSize/8,this.outSize=e.outSize/8,this.inner=null,this.outer=null,this._init(utils$6.toArray(t,a))}var hmac$1=Hmac;Hmac.prototype._init=function(t){t.length>this.blockSize&&(t=new this.Hash().update(t).digest()),assert$7(t.length<=this.blockSize);for(var a=t.length;a<this.blockSize;a++)t.push(0);for(a=0;a<t.length;a++)t[a]^=54;for(this.inner=new this.Hash().update(t),a=0;a<t.length;a++)t[a]^=106;this.outer=new this.Hash().update(t)};Hmac.prototype.update=function(t,a){return this.inner.update(t,a),this};Hmac.prototype.digest=function(t){return this.outer.update(this.inner.digest()),this.outer.digest(t)};(function(e){var t=e;t.utils=utils$f,t.common=common$5,t.sha=sha,t.ripemd=ripemd,t.hmac=hmac$1,t.sha1=t.sha.sha1,t.sha256=t.sha.sha256,t.sha224=t.sha.sha224,t.sha384=t.sha.sha384,t.sha512=t.sha.sha512,t.ripemd160=t.ripemd.ripemd160})(hash$3);var secp256k1$1,hasRequiredSecp256k1;function requireSecp256k1(){return hasRequiredSecp256k1||(hasRequiredSecp256k1=1,secp256k1$1={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}}),secp256k1$1}(function(e){var t=e,a=hash$3,u=curve,d=utils$l,h=d.assert;function w(B){B.type==="short"?this.curve=new u.short(B):B.type==="edwards"?this.curve=new u.edwards(B):this.curve=new u.mont(B),this.g=this.curve.g,this.n=this.curve.n,this.hash=B.hash,h(this.g.validate(),"Invalid curve"),h(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}t.PresetCurve=w;function x(B,E){Object.defineProperty(t,B,{configurable:!0,enumerable:!0,get:function(){var S=new w(E);return Object.defineProperty(t,B,{configurable:!0,enumerable:!0,value:S}),S}})}x("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:a.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),x("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:a.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),x("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:a.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),x("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:a.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),x("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:a.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),x("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:a.sha256,gRed:!1,g:["9"]}),x("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:a.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var M;try{M=requireSecp256k1()}catch{M=void 0}x("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:a.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",M]})})(curves$1);var hash$2=hash$3,utils$5=utils$k,assert$6=minimalisticAssert;function HmacDRBG(e){if(!(this instanceof HmacDRBG))return new HmacDRBG(e);this.hash=e.hash,this.predResist=!!e.predResist,this.outLen=this.hash.outSize,this.minEntropy=e.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var t=utils$5.toArray(e.entropy,e.entropyEnc||"hex"),a=utils$5.toArray(e.nonce,e.nonceEnc||"hex"),u=utils$5.toArray(e.pers,e.persEnc||"hex");assert$6(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(t,a,u)}var hmacDrbg=HmacDRBG;HmacDRBG.prototype._init=function(t,a,u){var d=t.concat(a).concat(u);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var h=0;h<this.V.length;h++)this.K[h]=0,this.V[h]=1;this._update(d),this._reseed=1,this.reseedInterval=281474976710656};HmacDRBG.prototype._hmac=function(){return new hash$2.hmac(this.hash,this.K)};HmacDRBG.prototype._update=function(t){var a=this._hmac().update(this.V).update([0]);t&&(a=a.update(t)),this.K=a.digest(),this.V=this._hmac().update(this.V).digest(),t&&(this.K=this._hmac().update(this.V).update([1]).update(t).digest(),this.V=this._hmac().update(this.V).digest())};HmacDRBG.prototype.reseed=function(t,a,u,d){typeof a!="string"&&(d=u,u=a,a=null),t=utils$5.toArray(t,a),u=utils$5.toArray(u,d),assert$6(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(t.concat(u||[])),this._reseed=1};HmacDRBG.prototype.generate=function(t,a,u,d){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof a!="string"&&(d=u,u=a,a=null),u&&(u=utils$5.toArray(u,d||"hex"),this._update(u));for(var h=[];h.length<t;)this.V=this._hmac().update(this.V).digest(),h=h.concat(this.V);var w=h.slice(0,t);return this._update(u),this._reseed++,utils$5.encode(w,a)};var BN$5=bnExports$3,utils$4=utils$l,assert$5=utils$4.assert;function KeyPair$2(e,t){this.ec=e,this.priv=null,this.pub=null,t.priv&&this._importPrivate(t.priv,t.privEnc),t.pub&&this._importPublic(t.pub,t.pubEnc)}var key$1=KeyPair$2;KeyPair$2.fromPublic=function(t,a,u){return a instanceof KeyPair$2?a:new KeyPair$2(t,{pub:a,pubEnc:u})};KeyPair$2.fromPrivate=function(t,a,u){return a instanceof KeyPair$2?a:new KeyPair$2(t,{priv:a,privEnc:u})};KeyPair$2.prototype.validate=function(){var t=this.getPublic();return t.isInfinity()?{result:!1,reason:"Invalid public key"}:t.validate()?t.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}};KeyPair$2.prototype.getPublic=function(t,a){return typeof t=="string"&&(a=t,t=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),a?this.pub.encode(a,t):this.pub};KeyPair$2.prototype.getPrivate=function(t){return t==="hex"?this.priv.toString(16,2):this.priv};KeyPair$2.prototype._importPrivate=function(t,a){this.priv=new BN$5(t,a||16),this.priv=this.priv.umod(this.ec.curve.n)};KeyPair$2.prototype._importPublic=function(t,a){if(t.x||t.y){this.ec.curve.type==="mont"?assert$5(t.x,"Need x coordinate"):(this.ec.curve.type==="short"||this.ec.curve.type==="edwards")&&assert$5(t.x&&t.y,"Need both x and y coordinate"),this.pub=this.ec.curve.point(t.x,t.y);return}this.pub=this.ec.curve.decodePoint(t,a)};KeyPair$2.prototype.derive=function(t){return t.validate()||assert$5(t.validate(),"public point not validated"),t.mul(this.priv).getX()};KeyPair$2.prototype.sign=function(t,a,u){return this.ec.sign(t,this,a,u)};KeyPair$2.prototype.verify=function(t,a,u){return this.ec.verify(t,a,this,void 0,u)};KeyPair$2.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"};var BN$4=bnExports$3,utils$3=utils$l,assert$4=utils$3.assert;function Signature$2(e,t){if(e instanceof Signature$2)return e;this._importDER(e,t)||(assert$4(e.r&&e.s,"Signature without r or s"),this.r=new BN$4(e.r,16),this.s=new BN$4(e.s,16),e.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}var signature$1=Signature$2;function Position(){this.place=0}function getLength(e,t){var a=e[t.place++];if(!(a&128))return a;var u=a&15;if(u===0||u>4||e[t.place]===0)return!1;for(var d=0,h=0,w=t.place;h<u;h++,w++)d<<=8,d|=e[w],d>>>=0;return d<=127?!1:(t.place=w,d)}function rmPadding(e){for(var t=0,a=e.length-1;!e[t]&&!(e[t+1]&128)&&t<a;)t++;return t===0?e:e.slice(t)}Signature$2.prototype._importDER=function(t,a){t=utils$3.toArray(t,a);var u=new Position;if(t[u.place++]!==48)return!1;var d=getLength(t,u);if(d===!1||d+u.place!==t.length||t[u.place++]!==2)return!1;var h=getLength(t,u);if(h===!1||t[u.place]&128)return!1;var w=t.slice(u.place,h+u.place);if(u.place+=h,t[u.place++]!==2)return!1;var x=getLength(t,u);if(x===!1||t.length!==x+u.place||t[u.place]&128)return!1;var M=t.slice(u.place,x+u.place);if(w[0]===0)if(w[1]&128)w=w.slice(1);else return!1;if(M[0]===0)if(M[1]&128)M=M.slice(1);else return!1;return this.r=new BN$4(w),this.s=new BN$4(M),this.recoveryParam=null,!0};function constructLength(e,t){if(t<128){e.push(t);return}var a=1+(Math.log(t)/Math.LN2>>>3);for(e.push(a|128);--a;)e.push(t>>>(a<<3)&255);e.push(t)}Signature$2.prototype.toDER=function(t){var a=this.r.toArray(),u=this.s.toArray();for(a[0]&128&&(a=[0].concat(a)),u[0]&128&&(u=[0].concat(u)),a=rmPadding(a),u=rmPadding(u);!u[0]&&!(u[1]&128);)u=u.slice(1);var d=[2];constructLength(d,a.length),d=d.concat(a),d.push(2),constructLength(d,u.length);var h=d.concat(u),w=[48];return constructLength(w,h.length),w=w.concat(h),utils$3.encode(w,t)};var ec,hasRequiredEc;function requireEc(){if(hasRequiredEc)return ec;hasRequiredEc=1;var e=bnExports$3,t=hmacDrbg,a=utils$l,u=curves$1,d=requireBrorand(),h=a.assert,w=key$1,x=signature$1;function M(B){if(!(this instanceof M))return new M(B);typeof B=="string"&&(h(Object.prototype.hasOwnProperty.call(u,B),"Unknown curve "+B),B=u[B]),B instanceof u.PresetCurve&&(B={curve:B}),this.curve=B.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=B.curve.g,this.g.precompute(B.curve.n.bitLength()+1),this.hash=B.hash||B.curve.hash}return ec=M,M.prototype.keyPair=function(E){return new w(this,E)},M.prototype.keyFromPrivate=function(E,S){return w.fromPrivate(this,E,S)},M.prototype.keyFromPublic=function(E,S){return w.fromPublic(this,E,S)},M.prototype.genKeyPair=function(E){E||(E={});for(var S=new t({hash:this.hash,pers:E.pers,persEnc:E.persEnc||"utf8",entropy:E.entropy||d(this.hash.hmacStrength),entropyEnc:E.entropy&&E.entropyEnc||"utf8",nonce:this.n.toArray()}),k=this.n.byteLength(),C=this.n.sub(new e(2));;){var q=new e(S.generate(k));if(!(q.cmp(C)>0))return q.iaddn(1),this.keyFromPrivate(q)}},M.prototype._truncateToN=function(E,S,k){var C;if(e.isBN(E)||typeof E=="number")E=new e(E,16),C=E.byteLength();else if(typeof E=="object")C=E.length,E=new e(E,16);else{var q=E.toString();C=q.length+1>>>1,E=new e(q,16)}typeof k!="number"&&(k=C*8);var O=k-this.n.bitLength();return O>0&&(E=E.ushrn(O)),!S&&E.cmp(this.n)>=0?E.sub(this.n):E},M.prototype.sign=function(E,S,k,C){if(typeof k=="object"&&(C=k,k=null),C||(C={}),typeof E!="string"&&typeof E!="number"&&!e.isBN(E)){h(typeof E=="object"&&E&&typeof E.length=="number","Expected message to be an array-like, a hex string, or a BN instance"),h(E.length>>>0===E.length);for(var q=0;q<E.length;q++)h((E[q]&255)===E[q])}S=this.keyFromPrivate(S,k),E=this._truncateToN(E,!1,C.msgBitLength),h(!E.isNeg(),"Can not sign a negative message");var O=this.n.byteLength(),U=S.getPrivate().toArray("be",O),P=E.toArray("be",O);h(new e(P).eq(E),"Can not sign message");for(var L=new t({hash:this.hash,entropy:U,nonce:P,pers:C.pers,persEnc:C.persEnc||"utf8"}),J=this.n.sub(new e(1)),Y=0;;Y++){var ae=C.k?C.k(Y):new e(L.generate(this.n.byteLength()));if(ae=this._truncateToN(ae,!0),!(ae.cmpn(1)<=0||ae.cmp(J)>=0)){var oe=this.g.mul(ae);if(!oe.isInfinity()){var ue=oe.getX(),se=ue.umod(this.n);if(se.cmpn(0)!==0){var ie=ae.invm(this.n).mul(se.mul(S.getPrivate()).iadd(E));if(ie=ie.umod(this.n),ie.cmpn(0)!==0){var ce=(oe.getY().isOdd()?1:0)|(ue.cmp(se)!==0?2:0);return C.canonical&&ie.cmp(this.nh)>0&&(ie=this.n.sub(ie),ce^=1),new x({r:se,s:ie,recoveryParam:ce})}}}}}},M.prototype.verify=function(E,S,k,C,q){q||(q={}),E=this._truncateToN(E,!1,q.msgBitLength),k=this.keyFromPublic(k,C),S=new x(S,"hex");var O=S.r,U=S.s;if(O.cmpn(1)<0||O.cmp(this.n)>=0||U.cmpn(1)<0||U.cmp(this.n)>=0)return!1;var P=U.invm(this.n),L=P.mul(E).umod(this.n),J=P.mul(O).umod(this.n),Y;return this.curve._maxwellTrick?(Y=this.g.jmulAdd(L,k.getPublic(),J),Y.isInfinity()?!1:Y.eqXToP(O)):(Y=this.g.mulAdd(L,k.getPublic(),J),Y.isInfinity()?!1:Y.getX().umod(this.n).cmp(O)===0)},M.prototype.recoverPubKey=function(B,E,S,k){h((3&S)===S,"The recovery param is more than two bits"),E=new x(E,k);var C=this.n,q=new e(B),O=E.r,U=E.s,P=S&1,L=S>>1;if(O.cmp(this.curve.p.umod(this.curve.n))>=0&&L)throw new Error("Unable to find sencond key candinate");L?O=this.curve.pointFromX(O.add(this.curve.n),P):O=this.curve.pointFromX(O,P);var J=E.r.invm(C),Y=C.sub(q).mul(J).umod(C),ae=U.mul(J).umod(C);return this.g.mulAdd(Y,O,ae)},M.prototype.getKeyRecoveryParam=function(B,E,S,k){if(E=new x(E,k),E.recoveryParam!==null)return E.recoveryParam;for(var C=0;C<4;C++){var q;try{q=this.recoverPubKey(B,E,C)}catch{continue}if(q.eq(S))return C}throw new Error("Unable to find valid recovery factor")},ec}var utils$2=utils$l,assert$3=utils$2.assert,parseBytes$2=utils$2.parseBytes,cachedProperty$1=utils$2.cachedProperty;function KeyPair$1(e,t){this.eddsa=e,this._secret=parseBytes$2(t.secret),e.isPoint(t.pub)?this._pub=t.pub:this._pubBytes=parseBytes$2(t.pub)}KeyPair$1.fromPublic=function(t,a){return a instanceof KeyPair$1?a:new KeyPair$1(t,{pub:a})};KeyPair$1.fromSecret=function(t,a){return a instanceof KeyPair$1?a:new KeyPair$1(t,{secret:a})};KeyPair$1.prototype.secret=function(){return this._secret};cachedProperty$1(KeyPair$1,"pubBytes",function(){return this.eddsa.encodePoint(this.pub())});cachedProperty$1(KeyPair$1,"pub",function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())});cachedProperty$1(KeyPair$1,"privBytes",function(){var t=this.eddsa,a=this.hash(),u=t.encodingLength-1,d=a.slice(0,t.encodingLength);return d[0]&=248,d[u]&=127,d[u]|=64,d});cachedProperty$1(KeyPair$1,"priv",function(){return this.eddsa.decodeInt(this.privBytes())});cachedProperty$1(KeyPair$1,"hash",function(){return this.eddsa.hash().update(this.secret()).digest()});cachedProperty$1(KeyPair$1,"messagePrefix",function(){return this.hash().slice(this.eddsa.encodingLength)});KeyPair$1.prototype.sign=function(t){return assert$3(this._secret,"KeyPair can only verify"),this.eddsa.sign(t,this)};KeyPair$1.prototype.verify=function(t,a){return this.eddsa.verify(t,a,this)};KeyPair$1.prototype.getSecret=function(t){return assert$3(this._secret,"KeyPair is public only"),utils$2.encode(this.secret(),t)};KeyPair$1.prototype.getPublic=function(t){return utils$2.encode(this.pubBytes(),t)};var key=KeyPair$1,BN$3=bnExports$3,utils$1=utils$l,assert$2=utils$1.assert,cachedProperty=utils$1.cachedProperty,parseBytes$1=utils$1.parseBytes;function Signature$1(e,t){this.eddsa=e,typeof t!="object"&&(t=parseBytes$1(t)),Array.isArray(t)&&(assert$2(t.length===e.encodingLength*2,"Signature has invalid size"),t={R:t.slice(0,e.encodingLength),S:t.slice(e.encodingLength)}),assert$2(t.R&&t.S,"Signature without R or S"),e.isPoint(t.R)&&(this._R=t.R),t.S instanceof BN$3&&(this._S=t.S),this._Rencoded=Array.isArray(t.R)?t.R:t.Rencoded,this._Sencoded=Array.isArray(t.S)?t.S:t.Sencoded}cachedProperty(Signature$1,"S",function(){return this.eddsa.decodeInt(this.Sencoded())});cachedProperty(Signature$1,"R",function(){return this.eddsa.decodePoint(this.Rencoded())});cachedProperty(Signature$1,"Rencoded",function(){return this.eddsa.encodePoint(this.R())});cachedProperty(Signature$1,"Sencoded",function(){return this.eddsa.encodeInt(this.S())});Signature$1.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())};Signature$1.prototype.toHex=function(){return utils$1.encode(this.toBytes(),"hex").toUpperCase()};var signature=Signature$1,hash$1=hash$3,curves=curves$1,utils=utils$l,assert$1=utils.assert,parseBytes=utils.parseBytes,KeyPair=key,Signature=signature;function EDDSA(e){if(assert$1(e==="ed25519","only tested with ed25519 so far"),!(this instanceof EDDSA))return new EDDSA(e);e=curves[e].curve,this.curve=e,this.g=e.g,this.g.precompute(e.n.bitLength()+1),this.pointClass=e.point().constructor,this.encodingLength=Math.ceil(e.n.bitLength()/8),this.hash=hash$1.sha512}var eddsa=EDDSA;EDDSA.prototype.sign=function(t,a){t=parseBytes(t);var u=this.keyFromSecret(a),d=this.hashInt(u.messagePrefix(),t),h=this.g.mul(d),w=this.encodePoint(h),x=this.hashInt(w,u.pubBytes(),t).mul(u.priv()),M=d.add(x).umod(this.curve.n);return this.makeSignature({R:h,S:M,Rencoded:w})};EDDSA.prototype.verify=function(t,a,u){if(t=parseBytes(t),a=this.makeSignature(a),a.S().gte(a.eddsa.curve.n)||a.S().isNeg())return!1;var d=this.keyFromPublic(u),h=this.hashInt(a.Rencoded(),d.pubBytes(),t),w=this.g.mul(a.S()),x=a.R().add(d.pub().mul(h));return x.eq(w)};EDDSA.prototype.hashInt=function(){for(var t=this.hash(),a=0;a<arguments.length;a++)t.update(arguments[a]);return utils.intFromLE(t.digest()).umod(this.curve.n)};EDDSA.prototype.keyFromPublic=function(t){return KeyPair.fromPublic(this,t)};EDDSA.prototype.keyFromSecret=function(t){return KeyPair.fromSecret(this,t)};EDDSA.prototype.makeSignature=function(t){return t instanceof Signature?t:new Signature(this,t)};EDDSA.prototype.encodePoint=function(t){var a=t.getY().toArray("le",this.encodingLength);return a[this.encodingLength-1]|=t.getX().isOdd()?128:0,a};EDDSA.prototype.decodePoint=function(t){t=utils.parseBytes(t);var a=t.length-1,u=t.slice(0,a).concat(t[a]&-129),d=(t[a]&128)!==0,h=utils.intFromLE(u);return this.curve.pointFromY(h,d)};EDDSA.prototype.encodeInt=function(t){return t.toArray("le",this.encodingLength)};EDDSA.prototype.decodeInt=function(t){return utils.intFromLE(t)};EDDSA.prototype.isPoint=function(t){return t instanceof this.pointClass};var hasRequiredElliptic;function requireElliptic(){return hasRequiredElliptic||(hasRequiredElliptic=1,function(e){var t=e;t.version=require$$0.version,t.utils=utils$l,t.rand=requireBrorand(),t.curve=curve,t.curves=curves$1,t.ec=requireEc(),t.eddsa=eddsa}(elliptic)),elliptic}var asn1$3={},asn1$2={},bn$2={exports:{}};bn$2.exports;(function(e){(function(t,a){function u($,n){if(!$)throw new Error(n||"Assertion failed")}function d($,n){$.super_=n;var l=function(){};l.prototype=n.prototype,$.prototype=new l,$.prototype.constructor=$}function h($,n,l){if(h.isBN($))return $;this.negative=0,this.words=null,this.length=0,this.red=null,$!==null&&((n==="le"||n==="be")&&(l=n,n=10),this._init($||0,n||10,l||"be"))}typeof t=="object"?t.exports=h:a.BN=h,h.BN=h,h.wordSize=26;var w;try{typeof window<"u"&&typeof window.Buffer<"u"?w=window.Buffer:w=dist.Buffer}catch{}h.isBN=function(n){return n instanceof h?!0:n!==null&&typeof n=="object"&&n.constructor.wordSize===h.wordSize&&Array.isArray(n.words)},h.max=function(n,l){return n.cmp(l)>0?n:l},h.min=function(n,l){return n.cmp(l)<0?n:l},h.prototype._init=function(n,l,c){if(typeof n=="number")return this._initNumber(n,l,c);if(typeof n=="object")return this._initArray(n,l,c);l==="hex"&&(l=16),u(l===(l|0)&&l>=2&&l<=36),n=n.toString().replace(/\s+/g,"");var p=0;n[0]==="-"&&(p++,this.negative=1),p<n.length&&(l===16?this._parseHex(n,p,c):(this._parseBase(n,l,p),c==="le"&&this._initArray(this.toArray(),l,c)))},h.prototype._initNumber=function(n,l,c){n<0&&(this.negative=1,n=-n),n<67108864?(this.words=[n&67108863],this.length=1):n<4503599627370496?(this.words=[n&67108863,n/67108864&67108863],this.length=2):(u(n<9007199254740992),this.words=[n&67108863,n/67108864&67108863,1],this.length=3),c==="le"&&this._initArray(this.toArray(),l,c)},h.prototype._initArray=function(n,l,c){if(u(typeof n.length=="number"),n.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(n.length/3),this.words=new Array(this.length);for(var p=0;p<this.length;p++)this.words[p]=0;var y,b,_=0;if(c==="be")for(p=n.length-1,y=0;p>=0;p-=3)b=n[p]|n[p-1]<<8|n[p-2]<<16,this.words[y]|=b<<_&67108863,this.words[y+1]=b>>>26-_&67108863,_+=24,_>=26&&(_-=26,y++);else if(c==="le")for(p=0,y=0;p<n.length;p+=3)b=n[p]|n[p+1]<<8|n[p+2]<<16,this.words[y]|=b<<_&67108863,this.words[y+1]=b>>>26-_&67108863,_+=24,_>=26&&(_-=26,y++);return this.strip()};function x($,n){var l=$.charCodeAt(n);return l>=65&&l<=70?l-55:l>=97&&l<=102?l-87:l-48&15}function M($,n,l){var c=x($,l);return l-1>=n&&(c|=x($,l-1)<<4),c}h.prototype._parseHex=function(n,l,c){this.length=Math.ceil((n.length-l)/6),this.words=new Array(this.length);for(var p=0;p<this.length;p++)this.words[p]=0;var y=0,b=0,_;if(c==="be")for(p=n.length-1;p>=l;p-=2)_=M(n,l,p)<<y,this.words[b]|=_&67108863,y>=18?(y-=18,b+=1,this.words[b]|=_>>>26):y+=8;else{var v=n.length-l;for(p=v%2===0?l+1:l;p<n.length;p+=2)_=M(n,l,p)<<y,this.words[b]|=_&67108863,y>=18?(y-=18,b+=1,this.words[b]|=_>>>26):y+=8}this.strip()};function B($,n,l,c){for(var p=0,y=Math.min($.length,l),b=n;b<y;b++){var _=$.charCodeAt(b)-48;p*=c,_>=49?p+=_-49+10:_>=17?p+=_-17+10:p+=_}return p}h.prototype._parseBase=function(n,l,c){this.words=[0],this.length=1;for(var p=0,y=1;y<=67108863;y*=l)p++;p--,y=y/l|0;for(var b=n.length-c,_=b%p,v=Math.min(b,b-_)+c,o=0,m=c;m<v;m+=p)o=B(n,m,m+p,l),this.imuln(y),this.words[0]+o<67108864?this.words[0]+=o:this._iaddn(o);if(_!==0){var A=1;for(o=B(n,m,n.length,l),m=0;m<_;m++)A*=l;this.imuln(A),this.words[0]+o<67108864?this.words[0]+=o:this._iaddn(o)}this.strip()},h.prototype.copy=function(n){n.words=new Array(this.length);for(var l=0;l<this.length;l++)n.words[l]=this.words[l];n.length=this.length,n.negative=this.negative,n.red=this.red},h.prototype.clone=function(){var n=new h(null);return this.copy(n),n},h.prototype._expand=function(n){for(;this.length<n;)this.words[this.length++]=0;return this},h.prototype.strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},h.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},h.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var E=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],S=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],k=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];h.prototype.toString=function(n,l){n=n||10,l=l|0||1;var c;if(n===16||n==="hex"){c="";for(var p=0,y=0,b=0;b<this.length;b++){var _=this.words[b],v=((_<<p|y)&16777215).toString(16);y=_>>>24-p&16777215,p+=2,p>=26&&(p-=26,b--),y!==0||b!==this.length-1?c=E[6-v.length]+v+c:c=v+c}for(y!==0&&(c=y.toString(16)+c);c.length%l!==0;)c="0"+c;return this.negative!==0&&(c="-"+c),c}if(n===(n|0)&&n>=2&&n<=36){var o=S[n],m=k[n];c="";var A=this.clone();for(A.negative=0;!A.isZero();){var I=A.modn(m).toString(n);A=A.idivn(m),A.isZero()?c=I+c:c=E[o-I.length]+I+c}for(this.isZero()&&(c="0"+c);c.length%l!==0;)c="0"+c;return this.negative!==0&&(c="-"+c),c}u(!1,"Base should be between 2 and 36")},h.prototype.toNumber=function(){var n=this.words[0];return this.length===2?n+=this.words[1]*67108864:this.length===3&&this.words[2]===1?n+=4503599627370496+this.words[1]*67108864:this.length>2&&u(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-n:n},h.prototype.toJSON=function(){return this.toString(16)},h.prototype.toBuffer=function(n,l){return u(typeof w<"u"),this.toArrayLike(w,n,l)},h.prototype.toArray=function(n,l){return this.toArrayLike(Array,n,l)},h.prototype.toArrayLike=function(n,l,c){var p=this.byteLength(),y=c||Math.max(1,p);u(p<=y,"byte array longer than desired length"),u(y>0,"Requested array length <= 0"),this.strip();var b=l==="le",_=new n(y),v,o,m=this.clone();if(b){for(o=0;!m.isZero();o++)v=m.andln(255),m.iushrn(8),_[o]=v;for(;o<y;o++)_[o]=0}else{for(o=0;o<y-p;o++)_[o]=0;for(o=0;!m.isZero();o++)v=m.andln(255),m.iushrn(8),_[y-o-1]=v}return _},Math.clz32?h.prototype._countBits=function(n){return 32-Math.clz32(n)}:h.prototype._countBits=function(n){var l=n,c=0;return l>=4096&&(c+=13,l>>>=13),l>=64&&(c+=7,l>>>=7),l>=8&&(c+=4,l>>>=4),l>=2&&(c+=2,l>>>=2),c+l},h.prototype._zeroBits=function(n){if(n===0)return 26;var l=n,c=0;return l&8191||(c+=13,l>>>=13),l&127||(c+=7,l>>>=7),l&15||(c+=4,l>>>=4),l&3||(c+=2,l>>>=2),l&1||c++,c},h.prototype.bitLength=function(){var n=this.words[this.length-1],l=this._countBits(n);return(this.length-1)*26+l};function C($){for(var n=new Array($.bitLength()),l=0;l<n.length;l++){var c=l/26|0,p=l%26;n[l]=($.words[c]&1<<p)>>>p}return n}h.prototype.zeroBits=function(){if(this.isZero())return 0;for(var n=0,l=0;l<this.length;l++){var c=this._zeroBits(this.words[l]);if(n+=c,c!==26)break}return n},h.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},h.prototype.toTwos=function(n){return this.negative!==0?this.abs().inotn(n).iaddn(1):this.clone()},h.prototype.fromTwos=function(n){return this.testn(n-1)?this.notn(n).iaddn(1).ineg():this.clone()},h.prototype.isNeg=function(){return this.negative!==0},h.prototype.neg=function(){return this.clone().ineg()},h.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},h.prototype.iuor=function(n){for(;this.length<n.length;)this.words[this.length++]=0;for(var l=0;l<n.length;l++)this.words[l]=this.words[l]|n.words[l];return this.strip()},h.prototype.ior=function(n){return u((this.negative|n.negative)===0),this.iuor(n)},h.prototype.or=function(n){return this.length>n.length?this.clone().ior(n):n.clone().ior(this)},h.prototype.uor=function(n){return this.length>n.length?this.clone().iuor(n):n.clone().iuor(this)},h.prototype.iuand=function(n){var l;this.length>n.length?l=n:l=this;for(var c=0;c<l.length;c++)this.words[c]=this.words[c]&n.words[c];return this.length=l.length,this.strip()},h.prototype.iand=function(n){return u((this.negative|n.negative)===0),this.iuand(n)},h.prototype.and=function(n){return this.length>n.length?this.clone().iand(n):n.clone().iand(this)},h.prototype.uand=function(n){return this.length>n.length?this.clone().iuand(n):n.clone().iuand(this)},h.prototype.iuxor=function(n){var l,c;this.length>n.length?(l=this,c=n):(l=n,c=this);for(var p=0;p<c.length;p++)this.words[p]=l.words[p]^c.words[p];if(this!==l)for(;p<l.length;p++)this.words[p]=l.words[p];return this.length=l.length,this.strip()},h.prototype.ixor=function(n){return u((this.negative|n.negative)===0),this.iuxor(n)},h.prototype.xor=function(n){return this.length>n.length?this.clone().ixor(n):n.clone().ixor(this)},h.prototype.uxor=function(n){return this.length>n.length?this.clone().iuxor(n):n.clone().iuxor(this)},h.prototype.inotn=function(n){u(typeof n=="number"&&n>=0);var l=Math.ceil(n/26)|0,c=n%26;this._expand(l),c>0&&l--;for(var p=0;p<l;p++)this.words[p]=~this.words[p]&67108863;return c>0&&(this.words[p]=~this.words[p]&67108863>>26-c),this.strip()},h.prototype.notn=function(n){return this.clone().inotn(n)},h.prototype.setn=function(n,l){u(typeof n=="number"&&n>=0);var c=n/26|0,p=n%26;return this._expand(c+1),l?this.words[c]=this.words[c]|1<<p:this.words[c]=this.words[c]&~(1<<p),this.strip()},h.prototype.iadd=function(n){var l;if(this.negative!==0&&n.negative===0)return this.negative=0,l=this.isub(n),this.negative^=1,this._normSign();if(this.negative===0&&n.negative!==0)return n.negative=0,l=this.isub(n),n.negative=1,l._normSign();var c,p;this.length>n.length?(c=this,p=n):(c=n,p=this);for(var y=0,b=0;b<p.length;b++)l=(c.words[b]|0)+(p.words[b]|0)+y,this.words[b]=l&67108863,y=l>>>26;for(;y!==0&&b<c.length;b++)l=(c.words[b]|0)+y,this.words[b]=l&67108863,y=l>>>26;if(this.length=c.length,y!==0)this.words[this.length]=y,this.length++;else if(c!==this)for(;b<c.length;b++)this.words[b]=c.words[b];return this},h.prototype.add=function(n){var l;return n.negative!==0&&this.negative===0?(n.negative=0,l=this.sub(n),n.negative^=1,l):n.negative===0&&this.negative!==0?(this.negative=0,l=n.sub(this),this.negative=1,l):this.length>n.length?this.clone().iadd(n):n.clone().iadd(this)},h.prototype.isub=function(n){if(n.negative!==0){n.negative=0;var l=this.iadd(n);return n.negative=1,l._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(n),this.negative=1,this._normSign();var c=this.cmp(n);if(c===0)return this.negative=0,this.length=1,this.words[0]=0,this;var p,y;c>0?(p=this,y=n):(p=n,y=this);for(var b=0,_=0;_<y.length;_++)l=(p.words[_]|0)-(y.words[_]|0)+b,b=l>>26,this.words[_]=l&67108863;for(;b!==0&&_<p.length;_++)l=(p.words[_]|0)+b,b=l>>26,this.words[_]=l&67108863;if(b===0&&_<p.length&&p!==this)for(;_<p.length;_++)this.words[_]=p.words[_];return this.length=Math.max(this.length,_),p!==this&&(this.negative=1),this.strip()},h.prototype.sub=function(n){return this.clone().isub(n)};function q($,n,l){l.negative=n.negative^$.negative;var c=$.length+n.length|0;l.length=c,c=c-1|0;var p=$.words[0]|0,y=n.words[0]|0,b=p*y,_=b&67108863,v=b/67108864|0;l.words[0]=_;for(var o=1;o<c;o++){for(var m=v>>>26,A=v&67108863,I=Math.min(o,n.length-1),F=Math.max(0,o-$.length+1);F<=I;F++){var X=o-F|0;p=$.words[X]|0,y=n.words[F]|0,b=p*y+A,m+=b/67108864|0,A=b&67108863}l.words[o]=A|0,v=m|0}return v!==0?l.words[o]=v|0:l.length--,l.strip()}var O=function(n,l,c){var p=n.words,y=l.words,b=c.words,_=0,v,o,m,A=p[0]|0,I=A&8191,F=A>>>13,X=p[1]|0,V=X&8191,T=X>>>13,D=p[2]|0,Z=D&8191,te=D>>>13,ee=p[3]|0,j=ee&8191,re=ee>>>13,qe=p[4]|0,de=qe&8191,pe=qe>>>13,je=p[5]|0,we=je&8191,le=je>>>13,Ve=p[6]|0,_e=Ve&8191,xe=Ve>>>13,ze=p[7]|0,me=ze&8191,ke=ze>>>13,Ge=p[8]|0,Me=Ge&8191,Ne=Ge>>>13,Ze=p[9]|0,Be=Ze&8191,De=Ze>>>13,rt=y[0]|0,Ae=rt&8191,Oe=rt>>>13,Je=y[1]|0,Re=Je&8191,He=Je>>>13,Qe=y[2]|0,Te=Qe&8191,Ue=Qe>>>13,tt=y[3]|0,Ee=tt&8191,Pe=tt>>>13,et=y[4]|0,Ie=et&8191,Le=et>>>13,it=y[5]|0,z=it&8191,N=it>>>13,H=y[6]|0,Q=H&8191,ne=H>>>13,ve=y[7]|0,he=ve&8191,be=ve>>>13,We=y[8]|0,ye=We&8191,Se=We>>>13,Ke=y[9]|0,Ce=Ke&8191,Fe=Ke>>>13;c.negative=n.negative^l.negative,c.length=19,v=Math.imul(I,Ae),o=Math.imul(I,Oe),o=o+Math.imul(F,Ae)|0,m=Math.imul(F,Oe);var Xe=(_+v|0)+((o&8191)<<13)|0;_=(m+(o>>>13)|0)+(Xe>>>26)|0,Xe&=67108863,v=Math.imul(V,Ae),o=Math.imul(V,Oe),o=o+Math.imul(T,Ae)|0,m=Math.imul(T,Oe),v=v+Math.imul(I,Re)|0,o=o+Math.imul(I,He)|0,o=o+Math.imul(F,Re)|0,m=m+Math.imul(F,He)|0;var Ye=(_+v|0)+((o&8191)<<13)|0;_=(m+(o>>>13)|0)+(Ye>>>26)|0,Ye&=67108863,v=Math.imul(Z,Ae),o=Math.imul(Z,Oe),o=o+Math.imul(te,Ae)|0,m=Math.imul(te,Oe),v=v+Math.imul(V,Re)|0,o=o+Math.imul(V,He)|0,o=o+Math.imul(T,Re)|0,m=m+Math.imul(T,He)|0,v=v+Math.imul(I,Te)|0,o=o+Math.imul(I,Ue)|0,o=o+Math.imul(F,Te)|0,m=m+Math.imul(F,Ue)|0;var nt=(_+v|0)+((o&8191)<<13)|0;_=(m+(o>>>13)|0)+(nt>>>26)|0,nt&=67108863,v=Math.imul(j,Ae),o=Math.imul(j,Oe),o=o+Math.imul(re,Ae)|0,m=Math.imul(re,Oe),v=v+Math.imul(Z,Re)|0,o=o+Math.imul(Z,He)|0,o=o+Math.imul(te,Re)|0,m=m+Math.imul(te,He)|0,v=v+Math.imul(V,Te)|0,o=o+Math.imul(V,Ue)|0,o=o+Math.imul(T,Te)|0,m=m+Math.imul(T,Ue)|0,v=v+Math.imul(I,Ee)|0,o=o+Math.imul(I,Pe)|0,o=o+Math.imul(F,Ee)|0,m=m+Math.imul(F,Pe)|0;var at=(_+v|0)+((o&8191)<<13)|0;_=(m+(o>>>13)|0)+(at>>>26)|0,at&=67108863,v=Math.imul(de,Ae),o=Math.imul(de,Oe),o=o+Math.imul(pe,Ae)|0,m=Math.imul(pe,Oe),v=v+Math.imul(j,Re)|0,o=o+Math.imul(j,He)|0,o=o+Math.imul(re,Re)|0,m=m+Math.imul(re,He)|0,v=v+Math.imul(Z,Te)|0,o=o+Math.imul(Z,Ue)|0,o=o+Math.imul(te,Te)|0,m=m+Math.imul(te,Ue)|0,v=v+Math.imul(V,Ee)|0,o=o+Math.imul(V,Pe)|0,o=o+Math.imul(T,Ee)|0,m=m+Math.imul(T,Pe)|0,v=v+Math.imul(I,Ie)|0,o=o+Math.imul(I,Le)|0,o=o+Math.imul(F,Ie)|0,m=m+Math.imul(F,Le)|0;var ot=(_+v|0)+((o&8191)<<13)|0;_=(m+(o>>>13)|0)+(ot>>>26)|0,ot&=67108863,v=Math.imul(we,Ae),o=Math.imul(we,Oe),o=o+Math.imul(le,Ae)|0,m=Math.imul(le,Oe),v=v+Math.imul(de,Re)|0,o=o+Math.imul(de,He)|0,o=o+Math.imul(pe,Re)|0,m=m+Math.imul(pe,He)|0,v=v+Math.imul(j,Te)|0,o=o+Math.imul(j,Ue)|0,o=o+Math.imul(re,Te)|0,m=m+Math.imul(re,Ue)|0,v=v+Math.imul(Z,Ee)|0,o=o+Math.imul(Z,Pe)|0,o=o+Math.imul(te,Ee)|0,m=m+Math.imul(te,Pe)|0,v=v+Math.imul(V,Ie)|0,o=o+Math.imul(V,Le)|0,o=o+Math.imul(T,Ie)|0,m=m+Math.imul(T,Le)|0,v=v+Math.imul(I,z)|0,o=o+Math.imul(I,N)|0,o=o+Math.imul(F,z)|0,m=m+Math.imul(F,N)|0;var st=(_+v|0)+((o&8191)<<13)|0;_=(m+(o>>>13)|0)+(st>>>26)|0,st&=67108863,v=Math.imul(_e,Ae),o=Math.imul(_e,Oe),o=o+Math.imul(xe,Ae)|0,m=Math.imul(xe,Oe),v=v+Math.imul(we,Re)|0,o=o+Math.imul(we,He)|0,o=o+Math.imul(le,Re)|0,m=m+Math.imul(le,He)|0,v=v+Math.imul(de,Te)|0,o=o+Math.imul(de,Ue)|0,o=o+Math.imul(pe,Te)|0,m=m+Math.imul(pe,Ue)|0,v=v+Math.imul(j,Ee)|0,o=o+Math.imul(j,Pe)|0,o=o+Math.imul(re,Ee)|0,m=m+Math.imul(re,Pe)|0,v=v+Math.imul(Z,Ie)|0,o=o+Math.imul(Z,Le)|0,o=o+Math.imul(te,Ie)|0,m=m+Math.imul(te,Le)|0,v=v+Math.imul(V,z)|0,o=o+Math.imul(V,N)|0,o=o+Math.imul(T,z)|0,m=m+Math.imul(T,N)|0,v=v+Math.imul(I,Q)|0,o=o+Math.imul(I,ne)|0,o=o+Math.imul(F,Q)|0,m=m+Math.imul(F,ne)|0;var ht=(_+v|0)+((o&8191)<<13)|0;_=(m+(o>>>13)|0)+(ht>>>26)|0,ht&=67108863,v=Math.imul(me,Ae),o=Math.imul(me,Oe),o=o+Math.imul(ke,Ae)|0,m=Math.imul(ke,Oe),v=v+Math.imul(_e,Re)|0,o=o+Math.imul(_e,He)|0,o=o+Math.imul(xe,Re)|0,m=m+Math.imul(xe,He)|0,v=v+Math.imul(we,Te)|0,o=o+Math.imul(we,Ue)|0,o=o+Math.imul(le,Te)|0,m=m+Math.imul(le,Ue)|0,v=v+Math.imul(de,Ee)|0,o=o+Math.imul(de,Pe)|0,o=o+Math.imul(pe,Ee)|0,m=m+Math.imul(pe,Pe)|0,v=v+Math.imul(j,Ie)|0,o=o+Math.imul(j,Le)|0,o=o+Math.imul(re,Ie)|0,m=m+Math.imul(re,Le)|0,v=v+Math.imul(Z,z)|0,o=o+Math.imul(Z,N)|0,o=o+Math.imul(te,z)|0,m=m+Math.imul(te,N)|0,v=v+Math.imul(V,Q)|0,o=o+Math.imul(V,ne)|0,o=o+Math.imul(T,Q)|0,m=m+Math.imul(T,ne)|0,v=v+Math.imul(I,he)|0,o=o+Math.imul(I,be)|0,o=o+Math.imul(F,he)|0,m=m+Math.imul(F,be)|0;var lt=(_+v|0)+((o&8191)<<13)|0;_=(m+(o>>>13)|0)+(lt>>>26)|0,lt&=67108863,v=Math.imul(Me,Ae),o=Math.imul(Me,Oe),o=o+Math.imul(Ne,Ae)|0,m=Math.imul(Ne,Oe),v=v+Math.imul(me,Re)|0,o=o+Math.imul(me,He)|0,o=o+Math.imul(ke,Re)|0,m=m+Math.imul(ke,He)|0,v=v+Math.imul(_e,Te)|0,o=o+Math.imul(_e,Ue)|0,o=o+Math.imul(xe,Te)|0,m=m+Math.imul(xe,Ue)|0,v=v+Math.imul(we,Ee)|0,o=o+Math.imul(we,Pe)|0,o=o+Math.imul(le,Ee)|0,m=m+Math.imul(le,Pe)|0,v=v+Math.imul(de,Ie)|0,o=o+Math.imul(de,Le)|0,o=o+Math.imul(pe,Ie)|0,m=m+Math.imul(pe,Le)|0,v=v+Math.imul(j,z)|0,o=o+Math.imul(j,N)|0,o=o+Math.imul(re,z)|0,m=m+Math.imul(re,N)|0,v=v+Math.imul(Z,Q)|0,o=o+Math.imul(Z,ne)|0,o=o+Math.imul(te,Q)|0,m=m+Math.imul(te,ne)|0,v=v+Math.imul(V,he)|0,o=o+Math.imul(V,be)|0,o=o+Math.imul(T,he)|0,m=m+Math.imul(T,be)|0,v=v+Math.imul(I,ye)|0,o=o+Math.imul(I,Se)|0,o=o+Math.imul(F,ye)|0,m=m+Math.imul(F,Se)|0;var ct=(_+v|0)+((o&8191)<<13)|0;_=(m+(o>>>13)|0)+(ct>>>26)|0,ct&=67108863,v=Math.imul(Be,Ae),o=Math.imul(Be,Oe),o=o+Math.imul(De,Ae)|0,m=Math.imul(De,Oe),v=v+Math.imul(Me,Re)|0,o=o+Math.imul(Me,He)|0,o=o+Math.imul(Ne,Re)|0,m=m+Math.imul(Ne,He)|0,v=v+Math.imul(me,Te)|0,o=o+Math.imul(me,Ue)|0,o=o+Math.imul(ke,Te)|0,m=m+Math.imul(ke,Ue)|0,v=v+Math.imul(_e,Ee)|0,o=o+Math.imul(_e,Pe)|0,o=o+Math.imul(xe,Ee)|0,m=m+Math.imul(xe,Pe)|0,v=v+Math.imul(we,Ie)|0,o=o+Math.imul(we,Le)|0,o=o+Math.imul(le,Ie)|0,m=m+Math.imul(le,Le)|0,v=v+Math.imul(de,z)|0,o=o+Math.imul(de,N)|0,o=o+Math.imul(pe,z)|0,m=m+Math.imul(pe,N)|0,v=v+Math.imul(j,Q)|0,o=o+Math.imul(j,ne)|0,o=o+Math.imul(re,Q)|0,m=m+Math.imul(re,ne)|0,v=v+Math.imul(Z,he)|0,o=o+Math.imul(Z,be)|0,o=o+Math.imul(te,he)|0,m=m+Math.imul(te,be)|0,v=v+Math.imul(V,ye)|0,o=o+Math.imul(V,Se)|0,o=o+Math.imul(T,ye)|0,m=m+Math.imul(T,Se)|0,v=v+Math.imul(I,Ce)|0,o=o+Math.imul(I,Fe)|0,o=o+Math.imul(F,Ce)|0,m=m+Math.imul(F,Fe)|0;var dt=(_+v|0)+((o&8191)<<13)|0;_=(m+(o>>>13)|0)+(dt>>>26)|0,dt&=67108863,v=Math.imul(Be,Re),o=Math.imul(Be,He),o=o+Math.imul(De,Re)|0,m=Math.imul(De,He),v=v+Math.imul(Me,Te)|0,o=o+Math.imul(Me,Ue)|0,o=o+Math.imul(Ne,Te)|0,m=m+Math.imul(Ne,Ue)|0,v=v+Math.imul(me,Ee)|0,o=o+Math.imul(me,Pe)|0,o=o+Math.imul(ke,Ee)|0,m=m+Math.imul(ke,Pe)|0,v=v+Math.imul(_e,Ie)|0,o=o+Math.imul(_e,Le)|0,o=o+Math.imul(xe,Ie)|0,m=m+Math.imul(xe,Le)|0,v=v+Math.imul(we,z)|0,o=o+Math.imul(we,N)|0,o=o+Math.imul(le,z)|0,m=m+Math.imul(le,N)|0,v=v+Math.imul(de,Q)|0,o=o+Math.imul(de,ne)|0,o=o+Math.imul(pe,Q)|0,m=m+Math.imul(pe,ne)|0,v=v+Math.imul(j,he)|0,o=o+Math.imul(j,be)|0,o=o+Math.imul(re,he)|0,m=m+Math.imul(re,be)|0,v=v+Math.imul(Z,ye)|0,o=o+Math.imul(Z,Se)|0,o=o+Math.imul(te,ye)|0,m=m+Math.imul(te,Se)|0,v=v+Math.imul(V,Ce)|0,o=o+Math.imul(V,Fe)|0,o=o+Math.imul(T,Ce)|0,m=m+Math.imul(T,Fe)|0;var pt=(_+v|0)+((o&8191)<<13)|0;_=(m+(o>>>13)|0)+(pt>>>26)|0,pt&=67108863,v=Math.imul(Be,Te),o=Math.imul(Be,Ue),o=o+Math.imul(De,Te)|0,m=Math.imul(De,Ue),v=v+Math.imul(Me,Ee)|0,o=o+Math.imul(Me,Pe)|0,o=o+Math.imul(Ne,Ee)|0,m=m+Math.imul(Ne,Pe)|0,v=v+Math.imul(me,Ie)|0,o=o+Math.imul(me,Le)|0,o=o+Math.imul(ke,Ie)|0,m=m+Math.imul(ke,Le)|0,v=v+Math.imul(_e,z)|0,o=o+Math.imul(_e,N)|0,o=o+Math.imul(xe,z)|0,m=m+Math.imul(xe,N)|0,v=v+Math.imul(we,Q)|0,o=o+Math.imul(we,ne)|0,o=o+Math.imul(le,Q)|0,m=m+Math.imul(le,ne)|0,v=v+Math.imul(de,he)|0,o=o+Math.imul(de,be)|0,o=o+Math.imul(pe,he)|0,m=m+Math.imul(pe,be)|0,v=v+Math.imul(j,ye)|0,o=o+Math.imul(j,Se)|0,o=o+Math.imul(re,ye)|0,m=m+Math.imul(re,Se)|0,v=v+Math.imul(Z,Ce)|0,o=o+Math.imul(Z,Fe)|0,o=o+Math.imul(te,Ce)|0,m=m+Math.imul(te,Fe)|0;var vt=(_+v|0)+((o&8191)<<13)|0;_=(m+(o>>>13)|0)+(vt>>>26)|0,vt&=67108863,v=Math.imul(Be,Ee),o=Math.imul(Be,Pe),o=o+Math.imul(De,Ee)|0,m=Math.imul(De,Pe),v=v+Math.imul(Me,Ie)|0,o=o+Math.imul(Me,Le)|0,o=o+Math.imul(Ne,Ie)|0,m=m+Math.imul(Ne,Le)|0,v=v+Math.imul(me,z)|0,o=o+Math.imul(me,N)|0,o=o+Math.imul(ke,z)|0,m=m+Math.imul(ke,N)|0,v=v+Math.imul(_e,Q)|0,o=o+Math.imul(_e,ne)|0,o=o+Math.imul(xe,Q)|0,m=m+Math.imul(xe,ne)|0,v=v+Math.imul(we,he)|0,o=o+Math.imul(we,be)|0,o=o+Math.imul(le,he)|0,m=m+Math.imul(le,be)|0,v=v+Math.imul(de,ye)|0,o=o+Math.imul(de,Se)|0,o=o+Math.imul(pe,ye)|0,m=m+Math.imul(pe,Se)|0,v=v+Math.imul(j,Ce)|0,o=o+Math.imul(j,Fe)|0,o=o+Math.imul(re,Ce)|0,m=m+Math.imul(re,Fe)|0;var yt=(_+v|0)+((o&8191)<<13)|0;_=(m+(o>>>13)|0)+(yt>>>26)|0,yt&=67108863,v=Math.imul(Be,Ie),o=Math.imul(Be,Le),o=o+Math.imul(De,Ie)|0,m=Math.imul(De,Le),v=v+Math.imul(Me,z)|0,o=o+Math.imul(Me,N)|0,o=o+Math.imul(Ne,z)|0,m=m+Math.imul(Ne,N)|0,v=v+Math.imul(me,Q)|0,o=o+Math.imul(me,ne)|0,o=o+Math.imul(ke,Q)|0,m=m+Math.imul(ke,ne)|0,v=v+Math.imul(_e,he)|0,o=o+Math.imul(_e,be)|0,o=o+Math.imul(xe,he)|0,m=m+Math.imul(xe,be)|0,v=v+Math.imul(we,ye)|0,o=o+Math.imul(we,Se)|0,o=o+Math.imul(le,ye)|0,m=m+Math.imul(le,Se)|0,v=v+Math.imul(de,Ce)|0,o=o+Math.imul(de,Fe)|0,o=o+Math.imul(pe,Ce)|0,m=m+Math.imul(pe,Fe)|0;var mt=(_+v|0)+((o&8191)<<13)|0;_=(m+(o>>>13)|0)+(mt>>>26)|0,mt&=67108863,v=Math.imul(Be,z),o=Math.imul(Be,N),o=o+Math.imul(De,z)|0,m=Math.imul(De,N),v=v+Math.imul(Me,Q)|0,o=o+Math.imul(Me,ne)|0,o=o+Math.imul(Ne,Q)|0,m=m+Math.imul(Ne,ne)|0,v=v+Math.imul(me,he)|0,o=o+Math.imul(me,be)|0,o=o+Math.imul(ke,he)|0,m=m+Math.imul(ke,be)|0,v=v+Math.imul(_e,ye)|0,o=o+Math.imul(_e,Se)|0,o=o+Math.imul(xe,ye)|0,m=m+Math.imul(xe,Se)|0,v=v+Math.imul(we,Ce)|0,o=o+Math.imul(we,Fe)|0,o=o+Math.imul(le,Ce)|0,m=m+Math.imul(le,Fe)|0;var gt=(_+v|0)+((o&8191)<<13)|0;_=(m+(o>>>13)|0)+(gt>>>26)|0,gt&=67108863,v=Math.imul(Be,Q),o=Math.imul(Be,ne),o=o+Math.imul(De,Q)|0,m=Math.imul(De,ne),v=v+Math.imul(Me,he)|0,o=o+Math.imul(Me,be)|0,o=o+Math.imul(Ne,he)|0,m=m+Math.imul(Ne,be)|0,v=v+Math.imul(me,ye)|0,o=o+Math.imul(me,Se)|0,o=o+Math.imul(ke,ye)|0,m=m+Math.imul(ke,Se)|0,v=v+Math.imul(_e,Ce)|0,o=o+Math.imul(_e,Fe)|0,o=o+Math.imul(xe,Ce)|0,m=m+Math.imul(xe,Fe)|0;var bt=(_+v|0)+((o&8191)<<13)|0;_=(m+(o>>>13)|0)+(bt>>>26)|0,bt&=67108863,v=Math.imul(Be,he),o=Math.imul(Be,be),o=o+Math.imul(De,he)|0,m=Math.imul(De,be),v=v+Math.imul(Me,ye)|0,o=o+Math.imul(Me,Se)|0,o=o+Math.imul(Ne,ye)|0,m=m+Math.imul(Ne,Se)|0,v=v+Math.imul(me,Ce)|0,o=o+Math.imul(me,Fe)|0,o=o+Math.imul(ke,Ce)|0,m=m+Math.imul(ke,Fe)|0;var wt=(_+v|0)+((o&8191)<<13)|0;_=(m+(o>>>13)|0)+(wt>>>26)|0,wt&=67108863,v=Math.imul(Be,ye),o=Math.imul(Be,Se),o=o+Math.imul(De,ye)|0,m=Math.imul(De,Se),v=v+Math.imul(Me,Ce)|0,o=o+Math.imul(Me,Fe)|0,o=o+Math.imul(Ne,Ce)|0,m=m+Math.imul(Ne,Fe)|0;var _t=(_+v|0)+((o&8191)<<13)|0;_=(m+(o>>>13)|0)+(_t>>>26)|0,_t&=67108863,v=Math.imul(Be,Ce),o=Math.imul(Be,Fe),o=o+Math.imul(De,Ce)|0,m=Math.imul(De,Fe);var xt=(_+v|0)+((o&8191)<<13)|0;return _=(m+(o>>>13)|0)+(xt>>>26)|0,xt&=67108863,b[0]=Xe,b[1]=Ye,b[2]=nt,b[3]=at,b[4]=ot,b[5]=st,b[6]=ht,b[7]=lt,b[8]=ct,b[9]=dt,b[10]=pt,b[11]=vt,b[12]=yt,b[13]=mt,b[14]=gt,b[15]=bt,b[16]=wt,b[17]=_t,b[18]=xt,_!==0&&(b[19]=_,c.length++),c};Math.imul||(O=q);function U($,n,l){l.negative=n.negative^$.negative,l.length=$.length+n.length;for(var c=0,p=0,y=0;y<l.length-1;y++){var b=p;p=0;for(var _=c&67108863,v=Math.min(y,n.length-1),o=Math.max(0,y-$.length+1);o<=v;o++){var m=y-o,A=$.words[m]|0,I=n.words[o]|0,F=A*I,X=F&67108863;b=b+(F/67108864|0)|0,X=X+_|0,_=X&67108863,b=b+(X>>>26)|0,p+=b>>>26,b&=67108863}l.words[y]=_,c=b,b=p}return c!==0?l.words[y]=c:l.length--,l.strip()}function P($,n,l){var c=new L;return c.mulp($,n,l)}h.prototype.mulTo=function(n,l){var c,p=this.length+n.length;return this.length===10&&n.length===10?c=O(this,n,l):p<63?c=q(this,n,l):p<1024?c=U(this,n,l):c=P(this,n,l),c};function L($,n){this.x=$,this.y=n}L.prototype.makeRBT=function(n){for(var l=new Array(n),c=h.prototype._countBits(n)-1,p=0;p<n;p++)l[p]=this.revBin(p,c,n);return l},L.prototype.revBin=function(n,l,c){if(n===0||n===c-1)return n;for(var p=0,y=0;y<l;y++)p|=(n&1)<<l-y-1,n>>=1;return p},L.prototype.permute=function(n,l,c,p,y,b){for(var _=0;_<b;_++)p[_]=l[n[_]],y[_]=c[n[_]]},L.prototype.transform=function(n,l,c,p,y,b){this.permute(b,n,l,c,p,y);for(var _=1;_<y;_<<=1)for(var v=_<<1,o=Math.cos(2*Math.PI/v),m=Math.sin(2*Math.PI/v),A=0;A<y;A+=v)for(var I=o,F=m,X=0;X<_;X++){var V=c[A+X],T=p[A+X],D=c[A+X+_],Z=p[A+X+_],te=I*D-F*Z;Z=I*Z+F*D,D=te,c[A+X]=V+D,p[A+X]=T+Z,c[A+X+_]=V-D,p[A+X+_]=T-Z,X!==v&&(te=o*I-m*F,F=o*F+m*I,I=te)}},L.prototype.guessLen13b=function(n,l){var c=Math.max(l,n)|1,p=c&1,y=0;for(c=c/2|0;c;c=c>>>1)y++;return 1<<y+1+p},L.prototype.conjugate=function(n,l,c){if(!(c<=1))for(var p=0;p<c/2;p++){var y=n[p];n[p]=n[c-p-1],n[c-p-1]=y,y=l[p],l[p]=-l[c-p-1],l[c-p-1]=-y}},L.prototype.normalize13b=function(n,l){for(var c=0,p=0;p<l/2;p++){var y=Math.round(n[2*p+1]/l)*8192+Math.round(n[2*p]/l)+c;n[p]=y&67108863,y<67108864?c=0:c=y/67108864|0}return n},L.prototype.convert13b=function(n,l,c,p){for(var y=0,b=0;b<l;b++)y=y+(n[b]|0),c[2*b]=y&8191,y=y>>>13,c[2*b+1]=y&8191,y=y>>>13;for(b=2*l;b<p;++b)c[b]=0;u(y===0),u((y&-8192)===0)},L.prototype.stub=function(n){for(var l=new Array(n),c=0;c<n;c++)l[c]=0;return l},L.prototype.mulp=function(n,l,c){var p=2*this.guessLen13b(n.length,l.length),y=this.makeRBT(p),b=this.stub(p),_=new Array(p),v=new Array(p),o=new Array(p),m=new Array(p),A=new Array(p),I=new Array(p),F=c.words;F.length=p,this.convert13b(n.words,n.length,_,p),this.convert13b(l.words,l.length,m,p),this.transform(_,b,v,o,p,y),this.transform(m,b,A,I,p,y);for(var X=0;X<p;X++){var V=v[X]*A[X]-o[X]*I[X];o[X]=v[X]*I[X]+o[X]*A[X],v[X]=V}return this.conjugate(v,o,p),this.transform(v,o,F,b,p,y),this.conjugate(F,b,p),this.normalize13b(F,p),c.negative=n.negative^l.negative,c.length=n.length+l.length,c.strip()},h.prototype.mul=function(n){var l=new h(null);return l.words=new Array(this.length+n.length),this.mulTo(n,l)},h.prototype.mulf=function(n){var l=new h(null);return l.words=new Array(this.length+n.length),P(this,n,l)},h.prototype.imul=function(n){return this.clone().mulTo(n,this)},h.prototype.imuln=function(n){u(typeof n=="number"),u(n<67108864);for(var l=0,c=0;c<this.length;c++){var p=(this.words[c]|0)*n,y=(p&67108863)+(l&67108863);l>>=26,l+=p/67108864|0,l+=y>>>26,this.words[c]=y&67108863}return l!==0&&(this.words[c]=l,this.length++),this.length=n===0?1:this.length,this},h.prototype.muln=function(n){return this.clone().imuln(n)},h.prototype.sqr=function(){return this.mul(this)},h.prototype.isqr=function(){return this.imul(this.clone())},h.prototype.pow=function(n){var l=C(n);if(l.length===0)return new h(1);for(var c=this,p=0;p<l.length&&l[p]===0;p++,c=c.sqr());if(++p<l.length)for(var y=c.sqr();p<l.length;p++,y=y.sqr())l[p]!==0&&(c=c.mul(y));return c},h.prototype.iushln=function(n){u(typeof n=="number"&&n>=0);var l=n%26,c=(n-l)/26,p=67108863>>>26-l<<26-l,y;if(l!==0){var b=0;for(y=0;y<this.length;y++){var _=this.words[y]&p,v=(this.words[y]|0)-_<<l;this.words[y]=v|b,b=_>>>26-l}b&&(this.words[y]=b,this.length++)}if(c!==0){for(y=this.length-1;y>=0;y--)this.words[y+c]=this.words[y];for(y=0;y<c;y++)this.words[y]=0;this.length+=c}return this.strip()},h.prototype.ishln=function(n){return u(this.negative===0),this.iushln(n)},h.prototype.iushrn=function(n,l,c){u(typeof n=="number"&&n>=0);var p;l?p=(l-l%26)/26:p=0;var y=n%26,b=Math.min((n-y)/26,this.length),_=67108863^67108863>>>y<<y,v=c;if(p-=b,p=Math.max(0,p),v){for(var o=0;o<b;o++)v.words[o]=this.words[o];v.length=b}if(b!==0)if(this.length>b)for(this.length-=b,o=0;o<this.length;o++)this.words[o]=this.words[o+b];else this.words[0]=0,this.length=1;var m=0;for(o=this.length-1;o>=0&&(m!==0||o>=p);o--){var A=this.words[o]|0;this.words[o]=m<<26-y|A>>>y,m=A&_}return v&&m!==0&&(v.words[v.length++]=m),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},h.prototype.ishrn=function(n,l,c){return u(this.negative===0),this.iushrn(n,l,c)},h.prototype.shln=function(n){return this.clone().ishln(n)},h.prototype.ushln=function(n){return this.clone().iushln(n)},h.prototype.shrn=function(n){return this.clone().ishrn(n)},h.prototype.ushrn=function(n){return this.clone().iushrn(n)},h.prototype.testn=function(n){u(typeof n=="number"&&n>=0);var l=n%26,c=(n-l)/26,p=1<<l;if(this.length<=c)return!1;var y=this.words[c];return!!(y&p)},h.prototype.imaskn=function(n){u(typeof n=="number"&&n>=0);var l=n%26,c=(n-l)/26;if(u(this.negative===0,"imaskn works only with positive numbers"),this.length<=c)return this;if(l!==0&&c++,this.length=Math.min(c,this.length),l!==0){var p=67108863^67108863>>>l<<l;this.words[this.length-1]&=p}return this.strip()},h.prototype.maskn=function(n){return this.clone().imaskn(n)},h.prototype.iaddn=function(n){return u(typeof n=="number"),u(n<67108864),n<0?this.isubn(-n):this.negative!==0?this.length===1&&(this.words[0]|0)<n?(this.words[0]=n-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(n),this.negative=1,this):this._iaddn(n)},h.prototype._iaddn=function(n){this.words[0]+=n;for(var l=0;l<this.length&&this.words[l]>=67108864;l++)this.words[l]-=67108864,l===this.length-1?this.words[l+1]=1:this.words[l+1]++;return this.length=Math.max(this.length,l+1),this},h.prototype.isubn=function(n){if(u(typeof n=="number"),u(n<67108864),n<0)return this.iaddn(-n);if(this.negative!==0)return this.negative=0,this.iaddn(n),this.negative=1,this;if(this.words[0]-=n,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var l=0;l<this.length&&this.words[l]<0;l++)this.words[l]+=67108864,this.words[l+1]-=1;return this.strip()},h.prototype.addn=function(n){return this.clone().iaddn(n)},h.prototype.subn=function(n){return this.clone().isubn(n)},h.prototype.iabs=function(){return this.negative=0,this},h.prototype.abs=function(){return this.clone().iabs()},h.prototype._ishlnsubmul=function(n,l,c){var p=n.length+c,y;this._expand(p);var b,_=0;for(y=0;y<n.length;y++){b=(this.words[y+c]|0)+_;var v=(n.words[y]|0)*l;b-=v&67108863,_=(b>>26)-(v/67108864|0),this.words[y+c]=b&67108863}for(;y<this.length-c;y++)b=(this.words[y+c]|0)+_,_=b>>26,this.words[y+c]=b&67108863;if(_===0)return this.strip();for(u(_===-1),_=0,y=0;y<this.length;y++)b=-(this.words[y]|0)+_,_=b>>26,this.words[y]=b&67108863;return this.negative=1,this.strip()},h.prototype._wordDiv=function(n,l){var c=this.length-n.length,p=this.clone(),y=n,b=y.words[y.length-1]|0,_=this._countBits(b);c=26-_,c!==0&&(y=y.ushln(c),p.iushln(c),b=y.words[y.length-1]|0);var v=p.length-y.length,o;if(l!=="mod"){o=new h(null),o.length=v+1,o.words=new Array(o.length);for(var m=0;m<o.length;m++)o.words[m]=0}var A=p.clone()._ishlnsubmul(y,1,v);A.negative===0&&(p=A,o&&(o.words[v]=1));for(var I=v-1;I>=0;I--){var F=(p.words[y.length+I]|0)*67108864+(p.words[y.length+I-1]|0);for(F=Math.min(F/b|0,67108863),p._ishlnsubmul(y,F,I);p.negative!==0;)F--,p.negative=0,p._ishlnsubmul(y,1,I),p.isZero()||(p.negative^=1);o&&(o.words[I]=F)}return o&&o.strip(),p.strip(),l!=="div"&&c!==0&&p.iushrn(c),{div:o||null,mod:p}},h.prototype.divmod=function(n,l,c){if(u(!n.isZero()),this.isZero())return{div:new h(0),mod:new h(0)};var p,y,b;return this.negative!==0&&n.negative===0?(b=this.neg().divmod(n,l),l!=="mod"&&(p=b.div.neg()),l!=="div"&&(y=b.mod.neg(),c&&y.negative!==0&&y.iadd(n)),{div:p,mod:y}):this.negative===0&&n.negative!==0?(b=this.divmod(n.neg(),l),l!=="mod"&&(p=b.div.neg()),{div:p,mod:b.mod}):this.negative&n.negative?(b=this.neg().divmod(n.neg(),l),l!=="div"&&(y=b.mod.neg(),c&&y.negative!==0&&y.isub(n)),{div:b.div,mod:y}):n.length>this.length||this.cmp(n)<0?{div:new h(0),mod:this}:n.length===1?l==="div"?{div:this.divn(n.words[0]),mod:null}:l==="mod"?{div:null,mod:new h(this.modn(n.words[0]))}:{div:this.divn(n.words[0]),mod:new h(this.modn(n.words[0]))}:this._wordDiv(n,l)},h.prototype.div=function(n){return this.divmod(n,"div",!1).div},h.prototype.mod=function(n){return this.divmod(n,"mod",!1).mod},h.prototype.umod=function(n){return this.divmod(n,"mod",!0).mod},h.prototype.divRound=function(n){var l=this.divmod(n);if(l.mod.isZero())return l.div;var c=l.div.negative!==0?l.mod.isub(n):l.mod,p=n.ushrn(1),y=n.andln(1),b=c.cmp(p);return b<0||y===1&&b===0?l.div:l.div.negative!==0?l.div.isubn(1):l.div.iaddn(1)},h.prototype.modn=function(n){u(n<=67108863);for(var l=(1<<26)%n,c=0,p=this.length-1;p>=0;p--)c=(l*c+(this.words[p]|0))%n;return c},h.prototype.idivn=function(n){u(n<=67108863);for(var l=0,c=this.length-1;c>=0;c--){var p=(this.words[c]|0)+l*67108864;this.words[c]=p/n|0,l=p%n}return this.strip()},h.prototype.divn=function(n){return this.clone().idivn(n)},h.prototype.egcd=function(n){u(n.negative===0),u(!n.isZero());var l=this,c=n.clone();l.negative!==0?l=l.umod(n):l=l.clone();for(var p=new h(1),y=new h(0),b=new h(0),_=new h(1),v=0;l.isEven()&&c.isEven();)l.iushrn(1),c.iushrn(1),++v;for(var o=c.clone(),m=l.clone();!l.isZero();){for(var A=0,I=1;!(l.words[0]&I)&&A<26;++A,I<<=1);if(A>0)for(l.iushrn(A);A-- >0;)(p.isOdd()||y.isOdd())&&(p.iadd(o),y.isub(m)),p.iushrn(1),y.iushrn(1);for(var F=0,X=1;!(c.words[0]&X)&&F<26;++F,X<<=1);if(F>0)for(c.iushrn(F);F-- >0;)(b.isOdd()||_.isOdd())&&(b.iadd(o),_.isub(m)),b.iushrn(1),_.iushrn(1);l.cmp(c)>=0?(l.isub(c),p.isub(b),y.isub(_)):(c.isub(l),b.isub(p),_.isub(y))}return{a:b,b:_,gcd:c.iushln(v)}},h.prototype._invmp=function(n){u(n.negative===0),u(!n.isZero());var l=this,c=n.clone();l.negative!==0?l=l.umod(n):l=l.clone();for(var p=new h(1),y=new h(0),b=c.clone();l.cmpn(1)>0&&c.cmpn(1)>0;){for(var _=0,v=1;!(l.words[0]&v)&&_<26;++_,v<<=1);if(_>0)for(l.iushrn(_);_-- >0;)p.isOdd()&&p.iadd(b),p.iushrn(1);for(var o=0,m=1;!(c.words[0]&m)&&o<26;++o,m<<=1);if(o>0)for(c.iushrn(o);o-- >0;)y.isOdd()&&y.iadd(b),y.iushrn(1);l.cmp(c)>=0?(l.isub(c),p.isub(y)):(c.isub(l),y.isub(p))}var A;return l.cmpn(1)===0?A=p:A=y,A.cmpn(0)<0&&A.iadd(n),A},h.prototype.gcd=function(n){if(this.isZero())return n.abs();if(n.isZero())return this.abs();var l=this.clone(),c=n.clone();l.negative=0,c.negative=0;for(var p=0;l.isEven()&&c.isEven();p++)l.iushrn(1),c.iushrn(1);do{for(;l.isEven();)l.iushrn(1);for(;c.isEven();)c.iushrn(1);var y=l.cmp(c);if(y<0){var b=l;l=c,c=b}else if(y===0||c.cmpn(1)===0)break;l.isub(c)}while(!0);return c.iushln(p)},h.prototype.invm=function(n){return this.egcd(n).a.umod(n)},h.prototype.isEven=function(){return(this.words[0]&1)===0},h.prototype.isOdd=function(){return(this.words[0]&1)===1},h.prototype.andln=function(n){return this.words[0]&n},h.prototype.bincn=function(n){u(typeof n=="number");var l=n%26,c=(n-l)/26,p=1<<l;if(this.length<=c)return this._expand(c+1),this.words[c]|=p,this;for(var y=p,b=c;y!==0&&b<this.length;b++){var _=this.words[b]|0;_+=y,y=_>>>26,_&=67108863,this.words[b]=_}return y!==0&&(this.words[b]=y,this.length++),this},h.prototype.isZero=function(){return this.length===1&&this.words[0]===0},h.prototype.cmpn=function(n){var l=n<0;if(this.negative!==0&&!l)return-1;if(this.negative===0&&l)return 1;this.strip();var c;if(this.length>1)c=1;else{l&&(n=-n),u(n<=67108863,"Number is too big");var p=this.words[0]|0;c=p===n?0:p<n?-1:1}return this.negative!==0?-c|0:c},h.prototype.cmp=function(n){if(this.negative!==0&&n.negative===0)return-1;if(this.negative===0&&n.negative!==0)return 1;var l=this.ucmp(n);return this.negative!==0?-l|0:l},h.prototype.ucmp=function(n){if(this.length>n.length)return 1;if(this.length<n.length)return-1;for(var l=0,c=this.length-1;c>=0;c--){var p=this.words[c]|0,y=n.words[c]|0;if(p!==y){p<y?l=-1:p>y&&(l=1);break}}return l},h.prototype.gtn=function(n){return this.cmpn(n)===1},h.prototype.gt=function(n){return this.cmp(n)===1},h.prototype.gten=function(n){return this.cmpn(n)>=0},h.prototype.gte=function(n){return this.cmp(n)>=0},h.prototype.ltn=function(n){return this.cmpn(n)===-1},h.prototype.lt=function(n){return this.cmp(n)===-1},h.prototype.lten=function(n){return this.cmpn(n)<=0},h.prototype.lte=function(n){return this.cmp(n)<=0},h.prototype.eqn=function(n){return this.cmpn(n)===0},h.prototype.eq=function(n){return this.cmp(n)===0},h.red=function(n){return new ie(n)},h.prototype.toRed=function(n){return u(!this.red,"Already a number in reduction context"),u(this.negative===0,"red works only with positives"),n.convertTo(this)._forceRed(n)},h.prototype.fromRed=function(){return u(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},h.prototype._forceRed=function(n){return this.red=n,this},h.prototype.forceRed=function(n){return u(!this.red,"Already a number in reduction context"),this._forceRed(n)},h.prototype.redAdd=function(n){return u(this.red,"redAdd works only with red numbers"),this.red.add(this,n)},h.prototype.redIAdd=function(n){return u(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,n)},h.prototype.redSub=function(n){return u(this.red,"redSub works only with red numbers"),this.red.sub(this,n)},h.prototype.redISub=function(n){return u(this.red,"redISub works only with red numbers"),this.red.isub(this,n)},h.prototype.redShl=function(n){return u(this.red,"redShl works only with red numbers"),this.red.shl(this,n)},h.prototype.redMul=function(n){return u(this.red,"redMul works only with red numbers"),this.red._verify2(this,n),this.red.mul(this,n)},h.prototype.redIMul=function(n){return u(this.red,"redMul works only with red numbers"),this.red._verify2(this,n),this.red.imul(this,n)},h.prototype.redSqr=function(){return u(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},h.prototype.redISqr=function(){return u(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},h.prototype.redSqrt=function(){return u(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},h.prototype.redInvm=function(){return u(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},h.prototype.redNeg=function(){return u(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},h.prototype.redPow=function(n){return u(this.red&&!n.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,n)};var J={k256:null,p224:null,p192:null,p25519:null};function Y($,n){this.name=$,this.p=new h(n,16),this.n=this.p.bitLength(),this.k=new h(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}Y.prototype._tmp=function(){var n=new h(null);return n.words=new Array(Math.ceil(this.n/13)),n},Y.prototype.ireduce=function(n){var l=n,c;do this.split(l,this.tmp),l=this.imulK(l),l=l.iadd(this.tmp),c=l.bitLength();while(c>this.n);var p=c<this.n?-1:l.ucmp(this.p);return p===0?(l.words[0]=0,l.length=1):p>0?l.isub(this.p):l.strip!==void 0?l.strip():l._strip(),l},Y.prototype.split=function(n,l){n.iushrn(this.n,0,l)},Y.prototype.imulK=function(n){return n.imul(this.k)};function ae(){Y.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}d(ae,Y),ae.prototype.split=function(n,l){for(var c=4194303,p=Math.min(n.length,9),y=0;y<p;y++)l.words[y]=n.words[y];if(l.length=p,n.length<=9){n.words[0]=0,n.length=1;return}var b=n.words[9];for(l.words[l.length++]=b&c,y=10;y<n.length;y++){var _=n.words[y]|0;n.words[y-10]=(_&c)<<4|b>>>22,b=_}b>>>=22,n.words[y-10]=b,b===0&&n.length>10?n.length-=10:n.length-=9},ae.prototype.imulK=function(n){n.words[n.length]=0,n.words[n.length+1]=0,n.length+=2;for(var l=0,c=0;c<n.length;c++){var p=n.words[c]|0;l+=p*977,n.words[c]=l&67108863,l=p*64+(l/67108864|0)}return n.words[n.length-1]===0&&(n.length--,n.words[n.length-1]===0&&n.length--),n};function oe(){Y.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}d(oe,Y);function ue(){Y.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}d(ue,Y);function se(){Y.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}d(se,Y),se.prototype.imulK=function(n){for(var l=0,c=0;c<n.length;c++){var p=(n.words[c]|0)*19+l,y=p&67108863;p>>>=26,n.words[c]=y,l=p}return l!==0&&(n.words[n.length++]=l),n},h._prime=function(n){if(J[n])return J[n];var l;if(n==="k256")l=new ae;else if(n==="p224")l=new oe;else if(n==="p192")l=new ue;else if(n==="p25519")l=new se;else throw new Error("Unknown prime "+n);return J[n]=l,l};function ie($){if(typeof $=="string"){var n=h._prime($);this.m=n.p,this.prime=n}else u($.gtn(1),"modulus must be greater than 1"),this.m=$,this.prime=null}ie.prototype._verify1=function(n){u(n.negative===0,"red works only with positives"),u(n.red,"red works only with red numbers")},ie.prototype._verify2=function(n,l){u((n.negative|l.negative)===0,"red works only with positives"),u(n.red&&n.red===l.red,"red works only with red numbers")},ie.prototype.imod=function(n){return this.prime?this.prime.ireduce(n)._forceRed(this):n.umod(this.m)._forceRed(this)},ie.prototype.neg=function(n){return n.isZero()?n.clone():this.m.sub(n)._forceRed(this)},ie.prototype.add=function(n,l){this._verify2(n,l);var c=n.add(l);return c.cmp(this.m)>=0&&c.isub(this.m),c._forceRed(this)},ie.prototype.iadd=function(n,l){this._verify2(n,l);var c=n.iadd(l);return c.cmp(this.m)>=0&&c.isub(this.m),c},ie.prototype.sub=function(n,l){this._verify2(n,l);var c=n.sub(l);return c.cmpn(0)<0&&c.iadd(this.m),c._forceRed(this)},ie.prototype.isub=function(n,l){this._verify2(n,l);var c=n.isub(l);return c.cmpn(0)<0&&c.iadd(this.m),c},ie.prototype.shl=function(n,l){return this._verify1(n),this.imod(n.ushln(l))},ie.prototype.imul=function(n,l){return this._verify2(n,l),this.imod(n.imul(l))},ie.prototype.mul=function(n,l){return this._verify2(n,l),this.imod(n.mul(l))},ie.prototype.isqr=function(n){return this.imul(n,n.clone())},ie.prototype.sqr=function(n){return this.mul(n,n)},ie.prototype.sqrt=function(n){if(n.isZero())return n.clone();var l=this.m.andln(3);if(u(l%2===1),l===3){var c=this.m.add(new h(1)).iushrn(2);return this.pow(n,c)}for(var p=this.m.subn(1),y=0;!p.isZero()&&p.andln(1)===0;)y++,p.iushrn(1);u(!p.isZero());var b=new h(1).toRed(this),_=b.redNeg(),v=this.m.subn(1).iushrn(1),o=this.m.bitLength();for(o=new h(2*o*o).toRed(this);this.pow(o,v).cmp(_)!==0;)o.redIAdd(_);for(var m=this.pow(o,p),A=this.pow(n,p.addn(1).iushrn(1)),I=this.pow(n,p),F=y;I.cmp(b)!==0;){for(var X=I,V=0;X.cmp(b)!==0;V++)X=X.redSqr();u(V<F);var T=this.pow(m,new h(1).iushln(F-V-1));A=A.redMul(T),m=T.redSqr(),I=I.redMul(m),F=V}return A},ie.prototype.invm=function(n){var l=n._invmp(this.m);return l.negative!==0?(l.negative=0,this.imod(l).redNeg()):this.imod(l)},ie.prototype.pow=function(n,l){if(l.isZero())return new h(1).toRed(this);if(l.cmpn(1)===0)return n.clone();var c=4,p=new Array(1<<c);p[0]=new h(1).toRed(this),p[1]=n;for(var y=2;y<p.length;y++)p[y]=this.mul(p[y-1],n);var b=p[0],_=0,v=0,o=l.bitLength()%26;for(o===0&&(o=26),y=l.length-1;y>=0;y--){for(var m=l.words[y],A=o-1;A>=0;A--){var I=m>>A&1;if(b!==p[0]&&(b=this.sqr(b)),I===0&&_===0){v=0;continue}_<<=1,_|=I,v++,!(v!==c&&(y!==0||A!==0))&&(b=this.mul(b,p[_]),v=0,_=0)}o=26}return b},ie.prototype.convertTo=function(n){var l=n.umod(this.m);return l===n?l.clone():l},ie.prototype.convertFrom=function(n){var l=n.clone();return l.red=null,l},h.mont=function(n){return new ce(n)};function ce($){ie.call(this,$),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new h(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}d(ce,ie),ce.prototype.convertTo=function(n){return this.imod(n.ushln(this.shift))},ce.prototype.convertFrom=function(n){var l=this.imod(n.mul(this.rinv));return l.red=null,l},ce.prototype.imul=function(n,l){if(n.isZero()||l.isZero())return n.words[0]=0,n.length=1,n;var c=n.imul(l),p=c.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),y=c.isub(p).iushrn(this.shift),b=y;return y.cmp(this.m)>=0?b=y.isub(this.m):y.cmpn(0)<0&&(b=y.iadd(this.m)),b._forceRed(this)},ce.prototype.mul=function(n,l){if(n.isZero()||l.isZero())return new h(0)._forceRed(this);var c=n.mul(l),p=c.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),y=c.isub(p).iushrn(this.shift),b=y;return y.cmp(this.m)>=0?b=y.isub(this.m):y.cmpn(0)<0&&(b=y.iadd(this.m)),b._forceRed(this)},ce.prototype.invm=function(n){var l=this.imod(n._invmp(this.m).mul(this.r2));return l._forceRed(this)}})(e,commonjsGlobal)})(bn$2);var bnExports$2=bn$2.exports,api={},vmBrowserify={},hasRequiredVmBrowserify;function requireVmBrowserify(){return hasRequiredVmBrowserify||(hasRequiredVmBrowserify=1,function(exports$1){var indexOf=function(e,t){if(e.indexOf)return e.indexOf(t);for(var a=0;a<e.length;a++)if(e[a]===t)return a;return-1},Object_keys=function(e){if(Object.keys)return Object.keys(e);var t=[];for(var a in e)t.push(a);return t},forEach=function(e,t){if(e.forEach)return e.forEach(t);for(var a=0;a<e.length;a++)t(e[a],a,e)},defineProp=function(){try{return Object.defineProperty({},"_",{}),function(e,t,a){Object.defineProperty(e,t,{writable:!0,enumerable:!1,configurable:!0,value:a})}}catch{return function(t,a,u){t[a]=u}}}(),globals=["Array","Boolean","Date","Error","EvalError","Function","Infinity","JSON","Math","NaN","Number","Object","RangeError","ReferenceError","RegExp","String","SyntaxError","TypeError","URIError","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","eval","isFinite","isNaN","parseFloat","parseInt","undefined","unescape"];function Context(){}Context.prototype={};var Script=exports$1.Script=function(t){if(!(this instanceof Script))return new Script(t);this.code=t};Script.prototype.runInContext=function(e){if(!(e instanceof Context))throw new TypeError("needs a 'context' argument.");var t=document.createElement("iframe");t.style||(t.style={}),t.style.display="none",document.body.appendChild(t);var a=t.contentWindow,u=a.eval,d=a.execScript;!u&&d&&(d.call(a,"null"),u=a.eval),forEach(Object_keys(e),function(x){a[x]=e[x]}),forEach(globals,function(x){e[x]&&(a[x]=e[x])});var h=Object_keys(a),w=u.call(a,this.code);return forEach(Object_keys(a),function(x){(x in e||indexOf(h,x)===-1)&&(e[x]=a[x])}),forEach(globals,function(x){x in e||defineProp(e,x,a[x])}),document.body.removeChild(t),w},Script.prototype.runInThisContext=function(){return eval(this.code)},Script.prototype.runInNewContext=function(e){var t=Script.createContext(e),a=this.runInContext(t);return e&&forEach(Object_keys(t),function(u){e[u]=t[u]}),a},forEach(Object_keys(Script.prototype),function(e){exports$1[e]=Script[e]=function(t){var a=Script(t);return a[e].apply(a,[].slice.call(arguments,1))}}),exports$1.isContext=function(e){return e instanceof Context},exports$1.createScript=function(e){return exports$1.Script(e)},exports$1.createContext=Script.createContext=function(e){var t=new Context;return typeof e=="object"&&forEach(Object_keys(e),function(a){t[a]=e[a]}),t}}(vmBrowserify)),vmBrowserify}var hasRequiredApi;function requireApi(){return hasRequiredApi||(hasRequiredApi=1,function(e){var t=requireAsn1(),a=inherits_browserExports,u=e;u.define=function(w,x){return new d(w,x)};function d(h,w){this.name=h,this.body=w,this.decoders={},this.encoders={}}d.prototype._createNamed=function(w){var x;try{x=requireVmBrowserify().runInThisContext("(function "+this.name+`(entity) {
17
+ this._initNamed(entity);
18
+ })`)}catch{x=function(B){this._initNamed(B)}}return a(x,w),x.prototype._initNamed=function(B){w.call(this,B)},new x(this)},d.prototype._getDecoder=function(w){return w=w||"der",this.decoders.hasOwnProperty(w)||(this.decoders[w]=this._createNamed(t.decoders[w])),this.decoders[w]},d.prototype.decode=function(w,x,M){return this._getDecoder(x).decode(w,M)},d.prototype._getEncoder=function(w){return w=w||"der",this.encoders.hasOwnProperty(w)||(this.encoders[w]=this._createNamed(t.encoders[w])),this.encoders[w]},d.prototype.encode=function(w,x,M){return this._getEncoder(x).encode(w,M)}}(api)),api}var base={},reporter={},inherits=inherits_browserExports;function Reporter(e){this._reporterState={obj:null,path:[],options:e||{},errors:[]}}reporter.Reporter=Reporter;Reporter.prototype.isError=function e(t){return t instanceof ReporterError};Reporter.prototype.save=function e(){var t=this._reporterState;return{obj:t.obj,pathLen:t.path.length}};Reporter.prototype.restore=function e(t){var a=this._reporterState;a.obj=t.obj,a.path=a.path.slice(0,t.pathLen)};Reporter.prototype.enterKey=function e(t){return this._reporterState.path.push(t)};Reporter.prototype.exitKey=function e(t){var a=this._reporterState;a.path=a.path.slice(0,t-1)};Reporter.prototype.leaveKey=function e(t,a,u){var d=this._reporterState;this.exitKey(t),d.obj!==null&&(d.obj[a]=u)};Reporter.prototype.path=function e(){return this._reporterState.path.join("/")};Reporter.prototype.enterObject=function e(){var t=this._reporterState,a=t.obj;return t.obj={},a};Reporter.prototype.leaveObject=function e(t){var a=this._reporterState,u=a.obj;return a.obj=t,u};Reporter.prototype.error=function e(t){var a,u=this._reporterState,d=t instanceof ReporterError;if(d?a=t:a=new ReporterError(u.path.map(function(h){return"["+JSON.stringify(h)+"]"}).join(""),t.message||t,t.stack),!u.options.partial)throw a;return d||u.errors.push(a),a};Reporter.prototype.wrapResult=function e(t){var a=this._reporterState;return a.options.partial?{result:this.isError(t)?null:t,errors:a.errors}:t};function ReporterError(e,t){this.path=e,this.rethrow(t)}inherits(ReporterError,Error);ReporterError.prototype.rethrow=function e(t){if(this.message=t+" at: "+(this.path||"(shallow)"),Error.captureStackTrace&&Error.captureStackTrace(this,ReporterError),!this.stack)try{throw new Error(this.message)}catch(a){this.stack=a.stack}return this};var buffer={},hasRequiredBuffer;function requireBuffer(){if(hasRequiredBuffer)return buffer;hasRequiredBuffer=1;var e=inherits_browserExports,t=requireBase().Reporter,a=dist.Buffer;function u(h,w){if(t.call(this,w),!a.isBuffer(h)){this.error("Input not Buffer");return}this.base=h,this.offset=0,this.length=h.length}e(u,t),buffer.DecoderBuffer=u,u.prototype.save=function(){return{offset:this.offset,reporter:t.prototype.save.call(this)}},u.prototype.restore=function(w){var x=new u(this.base);return x.offset=w.offset,x.length=this.offset,this.offset=w.offset,t.prototype.restore.call(this,w.reporter),x},u.prototype.isEmpty=function(){return this.offset===this.length},u.prototype.readUInt8=function(w){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(w||"DecoderBuffer overrun")},u.prototype.skip=function(w,x){if(!(this.offset+w<=this.length))return this.error(x||"DecoderBuffer overrun");var M=new u(this.base);return M._reporterState=this._reporterState,M.offset=this.offset,M.length=this.offset+w,this.offset+=w,M},u.prototype.raw=function(w){return this.base.slice(w?w.offset:this.offset,this.length)};function d(h,w){if(Array.isArray(h))this.length=0,this.value=h.map(function(x){return x instanceof d||(x=new d(x,w)),this.length+=x.length,x},this);else if(typeof h=="number"){if(!(0<=h&&h<=255))return w.error("non-byte EncoderBuffer value");this.value=h,this.length=1}else if(typeof h=="string")this.value=h,this.length=a.byteLength(h);else if(a.isBuffer(h))this.value=h,this.length=h.length;else return w.error("Unsupported type: "+typeof h)}return buffer.EncoderBuffer=d,d.prototype.join=function(w,x){return w||(w=new a(this.length)),x||(x=0),this.length===0||(Array.isArray(this.value)?this.value.forEach(function(M){M.join(w,x),x+=M.length}):(typeof this.value=="number"?w[x]=this.value:typeof this.value=="string"?w.write(this.value,x):a.isBuffer(this.value)&&this.value.copy(w,x),x+=this.length)),w},buffer}var node,hasRequiredNode;function requireNode(){if(hasRequiredNode)return node;hasRequiredNode=1;var e=requireBase().Reporter,t=requireBase().EncoderBuffer,a=requireBase().DecoderBuffer,u=minimalisticAssert,d=["seq","seqof","set","setof","objid","bool","gentime","utctime","null_","enum","int","objDesc","bitstr","bmpstr","charstr","genstr","graphstr","ia5str","iso646str","numstr","octstr","printstr","t61str","unistr","utf8str","videostr"],h=["key","obj","use","optional","explicit","implicit","def","choice","any","contains"].concat(d),w=["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"];function x(B,E){var S={};this._baseState=S,S.enc=B,S.parent=E||null,S.children=null,S.tag=null,S.args=null,S.reverseArgs=null,S.choice=null,S.optional=!1,S.any=!1,S.obj=!1,S.use=null,S.useDecoder=null,S.key=null,S.default=null,S.explicit=null,S.implicit=null,S.contains=null,S.parent||(S.children=[],this._wrap())}node=x;var M=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];return x.prototype.clone=function(){var E=this._baseState,S={};M.forEach(function(C){S[C]=E[C]});var k=new this.constructor(S.parent);return k._baseState=S,k},x.prototype._wrap=function(){var E=this._baseState;h.forEach(function(S){this[S]=function(){var C=new this.constructor(this);return E.children.push(C),C[S].apply(C,arguments)}},this)},x.prototype._init=function(E){var S=this._baseState;u(S.parent===null),E.call(this),S.children=S.children.filter(function(k){return k._baseState.parent===this},this),u.equal(S.children.length,1,"Root node can have only one child")},x.prototype._useArgs=function(E){var S=this._baseState,k=E.filter(function(C){return C instanceof this.constructor},this);E=E.filter(function(C){return!(C instanceof this.constructor)},this),k.length!==0&&(u(S.children===null),S.children=k,k.forEach(function(C){C._baseState.parent=this},this)),E.length!==0&&(u(S.args===null),S.args=E,S.reverseArgs=E.map(function(C){if(typeof C!="object"||C.constructor!==Object)return C;var q={};return Object.keys(C).forEach(function(O){O==(O|0)&&(O|=0);var U=C[O];q[U]=O}),q}))},w.forEach(function(B){x.prototype[B]=function(){var S=this._baseState;throw new Error(B+" not implemented for encoding: "+S.enc)}}),d.forEach(function(B){x.prototype[B]=function(){var S=this._baseState,k=Array.prototype.slice.call(arguments);return u(S.tag===null),S.tag=B,this._useArgs(k),this}}),x.prototype.use=function(E){u(E);var S=this._baseState;return u(S.use===null),S.use=E,this},x.prototype.optional=function(){var E=this._baseState;return E.optional=!0,this},x.prototype.def=function(E){var S=this._baseState;return u(S.default===null),S.default=E,S.optional=!0,this},x.prototype.explicit=function(E){var S=this._baseState;return u(S.explicit===null&&S.implicit===null),S.explicit=E,this},x.prototype.implicit=function(E){var S=this._baseState;return u(S.explicit===null&&S.implicit===null),S.implicit=E,this},x.prototype.obj=function(){var E=this._baseState,S=Array.prototype.slice.call(arguments);return E.obj=!0,S.length!==0&&this._useArgs(S),this},x.prototype.key=function(E){var S=this._baseState;return u(S.key===null),S.key=E,this},x.prototype.any=function(){var E=this._baseState;return E.any=!0,this},x.prototype.choice=function(E){var S=this._baseState;return u(S.choice===null),S.choice=E,this._useArgs(Object.keys(E).map(function(k){return E[k]})),this},x.prototype.contains=function(E){var S=this._baseState;return u(S.use===null),S.contains=E,this},x.prototype._decode=function(E,S){var k=this._baseState;if(k.parent===null)return E.wrapResult(k.children[0]._decode(E,S));var C=k.default,q=!0,O=null;if(k.key!==null&&(O=E.enterKey(k.key)),k.optional){var U=null;if(k.explicit!==null?U=k.explicit:k.implicit!==null?U=k.implicit:k.tag!==null&&(U=k.tag),U===null&&!k.any){var P=E.save();try{k.choice===null?this._decodeGeneric(k.tag,E,S):this._decodeChoice(E,S),q=!0}catch{q=!1}E.restore(P)}else if(q=this._peekTag(E,U,k.any),E.isError(q))return q}var L;if(k.obj&&q&&(L=E.enterObject()),q){if(k.explicit!==null){var J=this._decodeTag(E,k.explicit);if(E.isError(J))return J;E=J}var Y=E.offset;if(k.use===null&&k.choice===null){if(k.any)var P=E.save();var ae=this._decodeTag(E,k.implicit!==null?k.implicit:k.tag,k.any);if(E.isError(ae))return ae;k.any?C=E.raw(P):E=ae}if(S&&S.track&&k.tag!==null&&S.track(E.path(),Y,E.length,"tagged"),S&&S.track&&k.tag!==null&&S.track(E.path(),E.offset,E.length,"content"),k.any?C=C:k.choice===null?C=this._decodeGeneric(k.tag,E,S):C=this._decodeChoice(E,S),E.isError(C))return C;if(!k.any&&k.choice===null&&k.children!==null&&k.children.forEach(function(se){se._decode(E,S)}),k.contains&&(k.tag==="octstr"||k.tag==="bitstr")){var oe=new a(C);C=this._getUse(k.contains,E._reporterState.obj)._decode(oe,S)}}return k.obj&&q&&(C=E.leaveObject(L)),k.key!==null&&(C!==null||q===!0)?E.leaveKey(O,k.key,C):O!==null&&E.exitKey(O),C},x.prototype._decodeGeneric=function(E,S,k){var C=this._baseState;return E==="seq"||E==="set"?null:E==="seqof"||E==="setof"?this._decodeList(S,E,C.args[0],k):/str$/.test(E)?this._decodeStr(S,E,k):E==="objid"&&C.args?this._decodeObjid(S,C.args[0],C.args[1],k):E==="objid"?this._decodeObjid(S,null,null,k):E==="gentime"||E==="utctime"?this._decodeTime(S,E,k):E==="null_"?this._decodeNull(S,k):E==="bool"?this._decodeBool(S,k):E==="objDesc"?this._decodeStr(S,E,k):E==="int"||E==="enum"?this._decodeInt(S,C.args&&C.args[0],k):C.use!==null?this._getUse(C.use,S._reporterState.obj)._decode(S,k):S.error("unknown tag: "+E)},x.prototype._getUse=function(E,S){var k=this._baseState;return k.useDecoder=this._use(E,S),u(k.useDecoder._baseState.parent===null),k.useDecoder=k.useDecoder._baseState.children[0],k.implicit!==k.useDecoder._baseState.implicit&&(k.useDecoder=k.useDecoder.clone(),k.useDecoder._baseState.implicit=k.implicit),k.useDecoder},x.prototype._decodeChoice=function(E,S){var k=this._baseState,C=null,q=!1;return Object.keys(k.choice).some(function(O){var U=E.save(),P=k.choice[O];try{var L=P._decode(E,S);if(E.isError(L))return!1;C={type:O,value:L},q=!0}catch{return E.restore(U),!1}return!0},this),q?C:E.error("Choice not matched")},x.prototype._createEncoderBuffer=function(E){return new t(E,this.reporter)},x.prototype._encode=function(E,S,k){var C=this._baseState;if(!(C.default!==null&&C.default===E)){var q=this._encodeValue(E,S,k);if(q!==void 0&&!this._skipDefault(q,S,k))return q}},x.prototype._encodeValue=function(E,S,k){var C=this._baseState;if(C.parent===null)return C.children[0]._encode(E,S||new e);var P=null;if(this.reporter=S,C.optional&&E===void 0)if(C.default!==null)E=C.default;else return;var q=null,O=!1;if(C.any)P=this._createEncoderBuffer(E);else if(C.choice)P=this._encodeChoice(E,S);else if(C.contains)q=this._getUse(C.contains,k)._encode(E,S),O=!0;else if(C.children)q=C.children.map(function(Y){if(Y._baseState.tag==="null_")return Y._encode(null,S,E);if(Y._baseState.key===null)return S.error("Child should have a key");var ae=S.enterKey(Y._baseState.key);if(typeof E!="object")return S.error("Child expected, but input is not object");var oe=Y._encode(E[Y._baseState.key],S,E);return S.leaveKey(ae),oe},this).filter(function(Y){return Y}),q=this._createEncoderBuffer(q);else if(C.tag==="seqof"||C.tag==="setof"){if(!(C.args&&C.args.length===1))return S.error("Too many args for : "+C.tag);if(!Array.isArray(E))return S.error("seqof/setof, but data is not Array");var U=this.clone();U._baseState.implicit=null,q=this._createEncoderBuffer(E.map(function(Y){var ae=this._baseState;return this._getUse(ae.args[0],E)._encode(Y,S)},U))}else C.use!==null?P=this._getUse(C.use,k)._encode(E,S):(q=this._encodePrimitive(C.tag,E),O=!0);var P;if(!C.any&&C.choice===null){var L=C.implicit!==null?C.implicit:C.tag,J=C.implicit===null?"universal":"context";L===null?C.use===null&&S.error("Tag could be omitted only for .use()"):C.use===null&&(P=this._encodeComposite(L,O,J,q))}return C.explicit!==null&&(P=this._encodeComposite(C.explicit,!1,"context",P)),P},x.prototype._encodeChoice=function(E,S){var k=this._baseState,C=k.choice[E.type];return C||u(!1,E.type+" not found in "+JSON.stringify(Object.keys(k.choice))),C._encode(E.value,S)},x.prototype._encodePrimitive=function(E,S){var k=this._baseState;if(/str$/.test(E))return this._encodeStr(S,E);if(E==="objid"&&k.args)return this._encodeObjid(S,k.reverseArgs[0],k.args[1]);if(E==="objid")return this._encodeObjid(S,null,null);if(E==="gentime"||E==="utctime")return this._encodeTime(S,E);if(E==="null_")return this._encodeNull();if(E==="int"||E==="enum")return this._encodeInt(S,k.args&&k.reverseArgs[0]);if(E==="bool")return this._encodeBool(S);if(E==="objDesc")return this._encodeStr(S,E);throw new Error("Unsupported tag: "+E)},x.prototype._isNumstr=function(E){return/^[0-9 ]*$/.test(E)},x.prototype._isPrintstr=function(E){return/^[A-Za-z0-9 '\(\)\+,\-\.\/:=\?]*$/.test(E)},node}var hasRequiredBase;function requireBase(){return hasRequiredBase||(hasRequiredBase=1,function(e){var t=e;t.Reporter=reporter.Reporter,t.DecoderBuffer=requireBuffer().DecoderBuffer,t.EncoderBuffer=requireBuffer().EncoderBuffer,t.Node=requireNode()}(base)),base}var constants={},der={},hasRequiredDer$2;function requireDer$2(){return hasRequiredDer$2||(hasRequiredDer$2=1,function(e){var t=requireConstants();e.tagClass={0:"universal",1:"application",2:"context",3:"private"},e.tagClassByName=t._reverse(e.tagClass),e.tag={0:"end",1:"bool",2:"int",3:"bitstr",4:"octstr",5:"null_",6:"objid",7:"objDesc",8:"external",9:"real",10:"enum",11:"embed",12:"utf8str",13:"relativeOid",16:"seq",17:"set",18:"numstr",19:"printstr",20:"t61str",21:"videostr",22:"ia5str",23:"utctime",24:"gentime",25:"graphstr",26:"iso646str",27:"genstr",28:"unistr",29:"charstr",30:"bmpstr"},e.tagByName=t._reverse(e.tag)}(der)),der}var hasRequiredConstants;function requireConstants(){return hasRequiredConstants||(hasRequiredConstants=1,function(e){var t=e;t._reverse=function(u){var d={};return Object.keys(u).forEach(function(h){(h|0)==h&&(h=h|0);var w=u[h];d[w]=h}),d},t.der=requireDer$2()}(constants)),constants}var decoders={},der_1$1,hasRequiredDer$1;function requireDer$1(){if(hasRequiredDer$1)return der_1$1;hasRequiredDer$1=1;var e=inherits_browserExports,t=requireAsn1(),a=t.base,u=t.bignum,d=t.constants.der;function h(B){this.enc="der",this.name=B.name,this.entity=B,this.tree=new w,this.tree._init(B.body)}der_1$1=h,h.prototype.decode=function(E,S){return E instanceof a.DecoderBuffer||(E=new a.DecoderBuffer(E,S)),this.tree._decode(E,S)};function w(B){a.Node.call(this,"der",B)}e(w,a.Node),w.prototype._peekTag=function(E,S,k){if(E.isEmpty())return!1;var C=E.save(),q=x(E,'Failed to peek tag: "'+S+'"');return E.isError(q)?q:(E.restore(C),q.tag===S||q.tagStr===S||q.tagStr+"of"===S||k)},w.prototype._decodeTag=function(E,S,k){var C=x(E,'Failed to decode tag of "'+S+'"');if(E.isError(C))return C;var q=M(E,C.primitive,'Failed to get length of "'+S+'"');if(E.isError(q))return q;if(!k&&C.tag!==S&&C.tagStr!==S&&C.tagStr+"of"!==S)return E.error('Failed to match tag: "'+S+'"');if(C.primitive||q!==null)return E.skip(q,'Failed to match body of: "'+S+'"');var O=E.save(),U=this._skipUntilEnd(E,'Failed to skip indefinite length body: "'+this.tag+'"');return E.isError(U)?U:(q=E.offset-O.offset,E.restore(O),E.skip(q,'Failed to match body of: "'+S+'"'))},w.prototype._skipUntilEnd=function(E,S){for(;;){var k=x(E,S);if(E.isError(k))return k;var C=M(E,k.primitive,S);if(E.isError(C))return C;var q;if(k.primitive||C!==null?q=E.skip(C):q=this._skipUntilEnd(E,S),E.isError(q))return q;if(k.tagStr==="end")break}},w.prototype._decodeList=function(E,S,k,C){for(var q=[];!E.isEmpty();){var O=this._peekTag(E,"end");if(E.isError(O))return O;var U=k.decode(E,"der",C);if(E.isError(U)&&O)break;q.push(U)}return q},w.prototype._decodeStr=function(E,S){if(S==="bitstr"){var k=E.readUInt8();return E.isError(k)?k:{unused:k,data:E.raw()}}else if(S==="bmpstr"){var C=E.raw();if(C.length%2===1)return E.error("Decoding of string type: bmpstr length mismatch");for(var q="",O=0;O<C.length/2;O++)q+=String.fromCharCode(C.readUInt16BE(O*2));return q}else if(S==="numstr"){var U=E.raw().toString("ascii");return this._isNumstr(U)?U:E.error("Decoding of string type: numstr unsupported characters")}else{if(S==="octstr")return E.raw();if(S==="objDesc")return E.raw();if(S==="printstr"){var P=E.raw().toString("ascii");return this._isPrintstr(P)?P:E.error("Decoding of string type: printstr unsupported characters")}else return/str$/.test(S)?E.raw().toString():E.error("Decoding of string type: "+S+" unsupported")}},w.prototype._decodeObjid=function(E,S,k){for(var C,q=[],O=0;!E.isEmpty();){var U=E.readUInt8();O<<=7,O|=U&127,U&128||(q.push(O),O=0)}U&128&&q.push(O);var P=q[0]/40|0,L=q[0]%40;if(k?C=q:C=[P,L].concat(q.slice(1)),S){var J=S[C.join(" ")];J===void 0&&(J=S[C.join(".")]),J!==void 0&&(C=J)}return C},w.prototype._decodeTime=function(E,S){var k=E.raw().toString();if(S==="gentime")var C=k.slice(0,4)|0,q=k.slice(4,6)|0,O=k.slice(6,8)|0,U=k.slice(8,10)|0,P=k.slice(10,12)|0,L=k.slice(12,14)|0;else if(S==="utctime"){var C=k.slice(0,2)|0,q=k.slice(2,4)|0,O=k.slice(4,6)|0,U=k.slice(6,8)|0,P=k.slice(8,10)|0,L=k.slice(10,12)|0;C<70?C=2e3+C:C=1900+C}else return E.error("Decoding "+S+" time is not supported yet");return Date.UTC(C,q-1,O,U,P,L,0)},w.prototype._decodeNull=function(E){return null},w.prototype._decodeBool=function(E){var S=E.readUInt8();return E.isError(S)?S:S!==0},w.prototype._decodeInt=function(E,S){var k=E.raw(),C=new u(k);return S&&(C=S[C.toString(10)]||C),C},w.prototype._use=function(E,S){return typeof E=="function"&&(E=E(S)),E._getDecoder("der").tree};function x(B,E){var S=B.readUInt8(E);if(B.isError(S))return S;var k=d.tagClass[S>>6],C=(S&32)===0;if((S&31)===31){var q=S;for(S=0;(q&128)===128;){if(q=B.readUInt8(E),B.isError(q))return q;S<<=7,S|=q&127}}else S&=31;var O=d.tag[S];return{cls:k,primitive:C,tag:S,tagStr:O}}function M(B,E,S){var k=B.readUInt8(S);if(B.isError(k))return k;if(!E&&k===128)return null;if(!(k&128))return k;var C=k&127;if(C>4)return B.error("length octect is too long");k=0;for(var q=0;q<C;q++){k<<=8;var O=B.readUInt8(S);if(B.isError(O))return O;k|=O}return k}return der_1$1}var pem$1,hasRequiredPem$1;function requirePem$1(){if(hasRequiredPem$1)return pem$1;hasRequiredPem$1=1;var e=inherits_browserExports,t=dist.Buffer,a=requireDer$1();function u(d){a.call(this,d),this.enc="pem"}return e(u,a),pem$1=u,u.prototype.decode=function(h,w){for(var x=h.toString().split(/[\r\n]+/g),M=w.label.toUpperCase(),B=/^-----(BEGIN|END) ([^-]+)-----$/,E=-1,S=-1,k=0;k<x.length;k++){var C=x[k].match(B);if(C!==null&&C[2]===M)if(E===-1){if(C[1]!=="BEGIN")break;E=k}else{if(C[1]!=="END")break;S=k;break}}if(E===-1||S===-1)throw new Error("PEM section not found for: "+M);var q=x.slice(E+1,S).join("");q.replace(/[^a-z0-9\+\/=]+/gi,"");var O=new t(q,"base64");return a.prototype.decode.call(this,O,w)},pem$1}var hasRequiredDecoders;function requireDecoders(){return hasRequiredDecoders||(hasRequiredDecoders=1,function(e){var t=e;t.der=requireDer$1(),t.pem=requirePem$1()}(decoders)),decoders}var encoders={},der_1,hasRequiredDer;function requireDer(){if(hasRequiredDer)return der_1;hasRequiredDer=1;var e=inherits_browserExports,t=dist.Buffer,a=requireAsn1(),u=a.base,d=a.constants.der;function h(B){this.enc="der",this.name=B.name,this.entity=B,this.tree=new w,this.tree._init(B.body)}der_1=h,h.prototype.encode=function(E,S){return this.tree._encode(E,S).join()};function w(B){u.Node.call(this,"der",B)}e(w,u.Node),w.prototype._encodeComposite=function(E,S,k,C){var q=M(E,S,k,this.reporter);if(C.length<128){var P=new t(2);return P[0]=q,P[1]=C.length,this._createEncoderBuffer([P,C])}for(var O=1,U=C.length;U>=256;U>>=8)O++;var P=new t(2+O);P[0]=q,P[1]=128|O;for(var U=1+O,L=C.length;L>0;U--,L>>=8)P[U]=L&255;return this._createEncoderBuffer([P,C])},w.prototype._encodeStr=function(E,S){if(S==="bitstr")return this._createEncoderBuffer([E.unused|0,E.data]);if(S==="bmpstr"){for(var k=new t(E.length*2),C=0;C<E.length;C++)k.writeUInt16BE(E.charCodeAt(C),C*2);return this._createEncoderBuffer(k)}else return S==="numstr"?this._isNumstr(E)?this._createEncoderBuffer(E):this.reporter.error("Encoding of string type: numstr supports only digits and space"):S==="printstr"?this._isPrintstr(E)?this._createEncoderBuffer(E):this.reporter.error("Encoding of string type: printstr supports only latin upper and lower case letters, digits, space, apostrophe, left and rigth parenthesis, plus sign, comma, hyphen, dot, slash, colon, equal sign, question mark"):/str$/.test(S)?this._createEncoderBuffer(E):S==="objDesc"?this._createEncoderBuffer(E):this.reporter.error("Encoding of string type: "+S+" unsupported")},w.prototype._encodeObjid=function(E,S,k){if(typeof E=="string"){if(!S)return this.reporter.error("string objid given, but no values map found");if(!S.hasOwnProperty(E))return this.reporter.error("objid not found in values map");E=S[E].split(/[\s\.]+/g);for(var C=0;C<E.length;C++)E[C]|=0}else if(Array.isArray(E)){E=E.slice();for(var C=0;C<E.length;C++)E[C]|=0}if(!Array.isArray(E))return this.reporter.error("objid() should be either array or string, got: "+JSON.stringify(E));if(!k){if(E[1]>=40)return this.reporter.error("Second objid identifier OOB");E.splice(0,2,E[0]*40+E[1])}for(var q=0,C=0;C<E.length;C++){var O=E[C];for(q++;O>=128;O>>=7)q++}for(var U=new t(q),P=U.length-1,C=E.length-1;C>=0;C--){var O=E[C];for(U[P--]=O&127;(O>>=7)>0;)U[P--]=128|O&127}return this._createEncoderBuffer(U)};function x(B){return B<10?"0"+B:B}w.prototype._encodeTime=function(E,S){var k,C=new Date(E);return S==="gentime"?k=[x(C.getFullYear()),x(C.getUTCMonth()+1),x(C.getUTCDate()),x(C.getUTCHours()),x(C.getUTCMinutes()),x(C.getUTCSeconds()),"Z"].join(""):S==="utctime"?k=[x(C.getFullYear()%100),x(C.getUTCMonth()+1),x(C.getUTCDate()),x(C.getUTCHours()),x(C.getUTCMinutes()),x(C.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+S+" time is not supported yet"),this._encodeStr(k,"octstr")},w.prototype._encodeNull=function(){return this._createEncoderBuffer("")},w.prototype._encodeInt=function(E,S){if(typeof E=="string"){if(!S)return this.reporter.error("String int or enum given, but no values map");if(!S.hasOwnProperty(E))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(E));E=S[E]}if(typeof E!="number"&&!t.isBuffer(E)){var k=E.toArray();!E.sign&&k[0]&128&&k.unshift(0),E=new t(k)}if(t.isBuffer(E)){var C=E.length;E.length===0&&C++;var O=new t(C);return E.copy(O),E.length===0&&(O[0]=0),this._createEncoderBuffer(O)}if(E<128)return this._createEncoderBuffer(E);if(E<256)return this._createEncoderBuffer([0,E]);for(var C=1,q=E;q>=256;q>>=8)C++;for(var O=new Array(C),q=O.length-1;q>=0;q--)O[q]=E&255,E>>=8;return O[0]&128&&O.unshift(0),this._createEncoderBuffer(new t(O))},w.prototype._encodeBool=function(E){return this._createEncoderBuffer(E?255:0)},w.prototype._use=function(E,S){return typeof E=="function"&&(E=E(S)),E._getEncoder("der").tree},w.prototype._skipDefault=function(E,S,k){var C=this._baseState,q;if(C.default===null)return!1;var O=E.join();if(C.defaultBuffer===void 0&&(C.defaultBuffer=this._encodeValue(C.default,S,k).join()),O.length!==C.defaultBuffer.length)return!1;for(q=0;q<O.length;q++)if(O[q]!==C.defaultBuffer[q])return!1;return!0};function M(B,E,S,k){var C;if(B==="seqof"?B="seq":B==="setof"&&(B="set"),d.tagByName.hasOwnProperty(B))C=d.tagByName[B];else if(typeof B=="number"&&(B|0)===B)C=B;else return k.error("Unknown tag: "+B);return C>=31?k.error("Multi-octet tag encoding unsupported"):(E||(C|=32),C|=d.tagClassByName[S||"universal"]<<6,C)}return der_1}var pem,hasRequiredPem;function requirePem(){if(hasRequiredPem)return pem;hasRequiredPem=1;var e=inherits_browserExports,t=requireDer();function a(u){t.call(this,u),this.enc="pem"}return e(a,t),pem=a,a.prototype.encode=function(d,h){for(var w=t.prototype.encode.call(this,d),x=w.toString("base64"),M=["-----BEGIN "+h.label+"-----"],B=0;B<x.length;B+=64)M.push(x.slice(B,B+64));return M.push("-----END "+h.label+"-----"),M.join(`
19
+ `)},pem}var hasRequiredEncoders;function requireEncoders(){return hasRequiredEncoders||(hasRequiredEncoders=1,function(e){var t=e;t.der=requireDer(),t.pem=requirePem()}(encoders)),encoders}var hasRequiredAsn1;function requireAsn1(){return hasRequiredAsn1||(hasRequiredAsn1=1,function(e){var t=e;t.bignum=bnExports$2,t.define=requireApi().define,t.base=requireBase(),t.constants=requireConstants(),t.decoders=requireDecoders(),t.encoders=requireEncoders()}(asn1$2)),asn1$2}var asn=requireAsn1(),Time$1=asn.define("Time",function(){this.choice({utcTime:this.utctime(),generalTime:this.gentime()})}),AttributeTypeValue=asn.define("AttributeTypeValue",function(){this.seq().obj(this.key("type").objid(),this.key("value").any())}),AlgorithmIdentifier$1=asn.define("AlgorithmIdentifier",function(){this.seq().obj(this.key("algorithm").objid(),this.key("parameters").optional(),this.key("curve").objid().optional())}),SubjectPublicKeyInfo=asn.define("SubjectPublicKeyInfo",function(){this.seq().obj(this.key("algorithm").use(AlgorithmIdentifier$1),this.key("subjectPublicKey").bitstr())}),RelativeDistinguishedName=asn.define("RelativeDistinguishedName",function(){this.setof(AttributeTypeValue)}),RDNSequence=asn.define("RDNSequence",function(){this.seqof(RelativeDistinguishedName)}),Name=asn.define("Name",function(){this.choice({rdnSequence:this.use(RDNSequence)})}),Validity=asn.define("Validity",function(){this.seq().obj(this.key("notBefore").use(Time$1),this.key("notAfter").use(Time$1))}),Extension=asn.define("Extension",function(){this.seq().obj(this.key("extnID").objid(),this.key("critical").bool().def(!1),this.key("extnValue").octstr())}),TBSCertificate=asn.define("TBSCertificate",function(){this.seq().obj(this.key("version").explicit(0).int().optional(),this.key("serialNumber").int(),this.key("signature").use(AlgorithmIdentifier$1),this.key("issuer").use(Name),this.key("validity").use(Validity),this.key("subject").use(Name),this.key("subjectPublicKeyInfo").use(SubjectPublicKeyInfo),this.key("issuerUniqueID").implicit(1).bitstr().optional(),this.key("subjectUniqueID").implicit(2).bitstr().optional(),this.key("extensions").explicit(3).seqof(Extension).optional())}),X509Certificate=asn.define("X509Certificate",function(){this.seq().obj(this.key("tbsCertificate").use(TBSCertificate),this.key("signatureAlgorithm").use(AlgorithmIdentifier$1),this.key("signatureValue").bitstr())}),certificate=X509Certificate,asn1$1=requireAsn1();asn1$3.certificate=certificate;var RSAPrivateKey=asn1$1.define("RSAPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("modulus").int(),this.key("publicExponent").int(),this.key("privateExponent").int(),this.key("prime1").int(),this.key("prime2").int(),this.key("exponent1").int(),this.key("exponent2").int(),this.key("coefficient").int())});asn1$3.RSAPrivateKey=RSAPrivateKey;var RSAPublicKey=asn1$1.define("RSAPublicKey",function(){this.seq().obj(this.key("modulus").int(),this.key("publicExponent").int())});asn1$3.RSAPublicKey=RSAPublicKey;var AlgorithmIdentifier=asn1$1.define("AlgorithmIdentifier",function(){this.seq().obj(this.key("algorithm").objid(),this.key("none").null_().optional(),this.key("curve").objid().optional(),this.key("params").seq().obj(this.key("p").int(),this.key("q").int(),this.key("g").int()).optional())}),PublicKey=asn1$1.define("SubjectPublicKeyInfo",function(){this.seq().obj(this.key("algorithm").use(AlgorithmIdentifier),this.key("subjectPublicKey").bitstr())});asn1$3.PublicKey=PublicKey;var PrivateKeyInfo=asn1$1.define("PrivateKeyInfo",function(){this.seq().obj(this.key("version").int(),this.key("algorithm").use(AlgorithmIdentifier),this.key("subjectPrivateKey").octstr())});asn1$3.PrivateKey=PrivateKeyInfo;var EncryptedPrivateKeyInfo=asn1$1.define("EncryptedPrivateKeyInfo",function(){this.seq().obj(this.key("algorithm").seq().obj(this.key("id").objid(),this.key("decrypt").seq().obj(this.key("kde").seq().obj(this.key("id").objid(),this.key("kdeparams").seq().obj(this.key("salt").octstr(),this.key("iters").int())),this.key("cipher").seq().obj(this.key("algo").objid(),this.key("iv").octstr()))),this.key("subjectPrivateKey").octstr())});asn1$3.EncryptedPrivateKey=EncryptedPrivateKeyInfo;var DSAPrivateKey=asn1$1.define("DSAPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("p").int(),this.key("q").int(),this.key("g").int(),this.key("pub_key").int(),this.key("priv_key").int())});asn1$3.DSAPrivateKey=DSAPrivateKey;asn1$3.DSAparam=asn1$1.define("DSAparam",function(){this.int()});var ECParameters=asn1$1.define("ECParameters",function(){this.choice({namedCurve:this.objid()})}),ECPrivateKey=asn1$1.define("ECPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("privateKey").octstr(),this.key("parameters").optional().explicit(0).use(ECParameters),this.key("publicKey").optional().explicit(1).bitstr())});asn1$3.ECPrivateKey=ECPrivateKey;asn1$3.signature=asn1$1.define("signature",function(){this.seq().obj(this.key("r").int(),this.key("s").int())});const require$$1={"2.16.840.1.101.3.4.1.1":"aes-128-ecb","2.16.840.1.101.3.4.1.2":"aes-128-cbc","2.16.840.1.101.3.4.1.3":"aes-128-ofb","2.16.840.1.101.3.4.1.4":"aes-128-cfb","2.16.840.1.101.3.4.1.21":"aes-192-ecb","2.16.840.1.101.3.4.1.22":"aes-192-cbc","2.16.840.1.101.3.4.1.23":"aes-192-ofb","2.16.840.1.101.3.4.1.24":"aes-192-cfb","2.16.840.1.101.3.4.1.41":"aes-256-ecb","2.16.840.1.101.3.4.1.42":"aes-256-cbc","2.16.840.1.101.3.4.1.43":"aes-256-ofb","2.16.840.1.101.3.4.1.44":"aes-256-cfb"};var findProc=/Proc-Type: 4,ENCRYPTED[\n\r]+DEK-Info: AES-((?:128)|(?:192)|(?:256))-CBC,([0-9A-H]+)[\n\r]+([0-9A-z\n\r+/=]+)[\n\r]+/m,startRegex=/^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----/m,fullRegex=/^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----([0-9A-z\n\r+/=]+)-----END \1-----$/m,evp=evp_bytestokey,ciphers$1=browser$5,Buffer$6=safeBufferExports$2.Buffer,fixProc$1=function(e,t){var a=e.toString(),u=a.match(findProc),d;if(u){var w="aes"+u[1],x=Buffer$6.from(u[2],"hex"),M=Buffer$6.from(u[3].replace(/[\r\n]/g,""),"base64"),B=evp(t,x.slice(0,8),parseInt(u[1],10)).key,E=[],S=ciphers$1.createDecipheriv(w,B,x);E.push(S.update(M)),E.push(S.final()),d=Buffer$6.concat(E)}else{var h=a.match(fullRegex);d=Buffer$6.from(h[2].replace(/[\r\n]/g,""),"base64")}var k=a.match(startRegex)[1];return{tag:k,data:d}},asn1=asn1$3,aesid=require$$1,fixProc=fixProc$1,ciphers=browser$5,pbkdf2Sync=browser$7.pbkdf2Sync,Buffer$5=safeBufferExports$2.Buffer;function decrypt$1(e,t){var a=e.algorithm.decrypt.kde.kdeparams.salt,u=parseInt(e.algorithm.decrypt.kde.kdeparams.iters.toString(),10),d=aesid[e.algorithm.decrypt.cipher.algo.join(".")],h=e.algorithm.decrypt.cipher.iv,w=e.subjectPrivateKey,x=parseInt(d.split("-")[1],10)/8,M=pbkdf2Sync(t,a,u,x,"sha1"),B=ciphers.createDecipheriv(d,M,h),E=[];return E.push(B.update(w)),E.push(B.final()),Buffer$5.concat(E)}function parseKeys$2(e){var t;typeof e=="object"&&!Buffer$5.isBuffer(e)&&(t=e.passphrase,e=e.key),typeof e=="string"&&(e=Buffer$5.from(e));var a=fixProc(e,t),u=a.tag,d=a.data,h,w;switch(u){case"CERTIFICATE":w=asn1.certificate.decode(d,"der").tbsCertificate.subjectPublicKeyInfo;case"PUBLIC KEY":switch(w||(w=asn1.PublicKey.decode(d,"der")),h=w.algorithm.algorithm.join("."),h){case"1.2.840.113549.1.1.1":return asn1.RSAPublicKey.decode(w.subjectPublicKey.data,"der");case"1.2.840.10045.2.1":return w.subjectPrivateKey=w.subjectPublicKey,{type:"ec",data:w};case"1.2.840.10040.4.1":return w.algorithm.params.pub_key=asn1.DSAparam.decode(w.subjectPublicKey.data,"der"),{type:"dsa",data:w.algorithm.params};default:throw new Error("unknown key id "+h)}case"ENCRYPTED PRIVATE KEY":d=asn1.EncryptedPrivateKey.decode(d,"der"),d=decrypt$1(d,t);case"PRIVATE KEY":switch(w=asn1.PrivateKey.decode(d,"der"),h=w.algorithm.algorithm.join("."),h){case"1.2.840.113549.1.1.1":return asn1.RSAPrivateKey.decode(w.subjectPrivateKey,"der");case"1.2.840.10045.2.1":return{curve:w.algorithm.curve,privateKey:asn1.ECPrivateKey.decode(w.subjectPrivateKey,"der").privateKey};case"1.2.840.10040.4.1":return w.algorithm.params.priv_key=asn1.DSAparam.decode(w.subjectPrivateKey,"der"),{type:"dsa",params:w.algorithm.params};default:throw new Error("unknown key id "+h)}case"RSA PUBLIC KEY":return asn1.RSAPublicKey.decode(d,"der");case"RSA PRIVATE KEY":return asn1.RSAPrivateKey.decode(d,"der");case"DSA PRIVATE KEY":return{type:"dsa",params:asn1.DSAPrivateKey.decode(d,"der")};case"EC PRIVATE KEY":return d=asn1.ECPrivateKey.decode(d,"der"),{curve:d.parameters.value,privateKey:d.privateKey};default:throw new Error("unknown key type "+u)}}parseKeys$2.signature=asn1.signature;var parseAsn1=parseKeys$2;const require$$4={"1.3.132.0.10":"secp256k1","1.3.132.0.33":"p224","1.2.840.10045.3.1.1":"p192","1.2.840.10045.3.1.7":"p256","1.3.132.0.34":"p384","1.3.132.0.35":"p521"};var hasRequiredSign;function requireSign(){if(hasRequiredSign)return sign.exports;hasRequiredSign=1;var e=safeBufferExports$2.Buffer,t=browser$8,a=browserifyRsa,u=requireElliptic().ec,d=bnExports$4,h=parseAsn1,w=require$$4,x=1;function M(P,L,J,Y,ae){var oe=h(L);if(oe.curve){if(Y!=="ecdsa"&&Y!=="ecdsa/rsa")throw new Error("wrong private key type");return B(P,oe)}else if(oe.type==="dsa"){if(Y!=="dsa")throw new Error("wrong private key type");return E(P,oe,J)}if(Y!=="rsa"&&Y!=="ecdsa/rsa")throw new Error("wrong private key type");if(L.padding!==void 0&&L.padding!==x)throw new Error("illegal or unsupported padding mode");P=e.concat([ae,P]);for(var ue=oe.modulus.byteLength(),se=[0,1];P.length+se.length+1<ue;)se.push(255);se.push(0);for(var ie=-1;++ie<P.length;)se.push(P[ie]);var ce=a(se,oe);return ce}function B(P,L){var J=w[L.curve.join(".")];if(!J)throw new Error("unknown curve "+L.curve.join("."));var Y=new u(J),ae=Y.keyFromPrivate(L.privateKey),oe=ae.sign(P);return e.from(oe.toDER())}function E(P,L,J){for(var Y=L.params.priv_key,ae=L.params.p,oe=L.params.q,ue=L.params.g,se=new d(0),ie,ce=C(P,oe).mod(oe),$=!1,n=k(Y,oe,P,J);$===!1;)ie=O(oe,n,J),se=U(ue,ie,ae,oe),$=ie.invm(oe).imul(ce.add(Y.mul(se))).mod(oe),$.cmpn(0)===0&&($=!1,se=new d(0));return S(se,$)}function S(P,L){P=P.toArray(),L=L.toArray(),P[0]&128&&(P=[0].concat(P)),L[0]&128&&(L=[0].concat(L));var J=P.length+L.length+4,Y=[48,J,2,P.length];return Y=Y.concat(P,[2,L.length],L),e.from(Y)}function k(P,L,J,Y){if(P=e.from(P.toArray()),P.length<L.byteLength()){var ae=e.alloc(L.byteLength()-P.length);P=e.concat([ae,P])}var oe=J.length,ue=q(J,L),se=e.alloc(oe);se.fill(1);var ie=e.alloc(oe);return ie=t(Y,ie).update(se).update(e.from([0])).update(P).update(ue).digest(),se=t(Y,ie).update(se).digest(),ie=t(Y,ie).update(se).update(e.from([1])).update(P).update(ue).digest(),se=t(Y,ie).update(se).digest(),{k:ie,v:se}}function C(P,L){var J=new d(P),Y=(P.length<<3)-L.bitLength();return Y>0&&J.ishrn(Y),J}function q(P,L){P=C(P,L),P=P.mod(L);var J=e.from(P.toArray());if(J.length<L.byteLength()){var Y=e.alloc(L.byteLength()-J.length);J=e.concat([Y,J])}return J}function O(P,L,J){var Y,ae;do{for(Y=e.alloc(0);Y.length*8<P.bitLength();)L.v=t(J,L.k).update(L.v).digest(),Y=e.concat([Y,L.v]);ae=C(Y,P),L.k=t(J,L.k).update(L.v).update(e.from([0])).digest(),L.v=t(J,L.k).update(L.v).digest()}while(ae.cmp(P)!==-1);return ae}function U(P,L,J,Y){return P.toRed(d.mont(J)).redPow(L).fromRed().mod(Y)}return sign.exports=M,sign.exports.getKey=k,sign.exports.makeKey=O,sign.exports}var verify_1,hasRequiredVerify;function requireVerify(){if(hasRequiredVerify)return verify_1;hasRequiredVerify=1;var e=safeBufferExports$2.Buffer,t=bnExports$4,a=requireElliptic().ec,u=parseAsn1,d=require$$4;function h(B,E,S,k,C){var q=u(S);if(q.type==="ec"){if(k!=="ecdsa"&&k!=="ecdsa/rsa")throw new Error("wrong public key type");return w(B,E,q)}else if(q.type==="dsa"){if(k!=="dsa")throw new Error("wrong public key type");return x(B,E,q)}if(k!=="rsa"&&k!=="ecdsa/rsa")throw new Error("wrong public key type");E=e.concat([C,E]);for(var O=q.modulus.byteLength(),U=[1],P=0;E.length+U.length+2<O;)U.push(255),P+=1;U.push(0);for(var L=-1;++L<E.length;)U.push(E[L]);U=e.from(U);var J=t.mont(q.modulus);B=new t(B).toRed(J),B=B.redPow(new t(q.publicExponent)),B=e.from(B.fromRed().toArray());var Y=P<8?1:0;for(O=Math.min(B.length,U.length),B.length!==U.length&&(Y=1),L=-1;++L<O;)Y|=B[L]^U[L];return Y===0}function w(B,E,S){var k=d[S.data.algorithm.curve.join(".")];if(!k)throw new Error("unknown curve "+S.data.algorithm.curve.join("."));var C=new a(k),q=S.data.subjectPrivateKey.data;return C.verify(E,B,q)}function x(B,E,S){var k=S.data.p,C=S.data.q,q=S.data.g,O=S.data.pub_key,U=u.signature.decode(B,"der"),P=U.s,L=U.r;M(P,C),M(L,C);var J=t.mont(k),Y=P.invm(C),ae=q.toRed(J).redPow(new t(E).mul(Y).mod(C)).fromRed().mul(O.toRed(J).redPow(L.mul(Y).mod(C)).fromRed()).mod(k).mod(C);return ae.cmp(L)===0}function M(B,E){if(B.cmpn(0)<=0)throw new Error("invalid sig");if(B.cmp(E)>=0)throw new Error("invalid sig")}return verify_1=h,verify_1}var browser$3,hasRequiredBrowser$1;function requireBrowser$1(){if(hasRequiredBrowser$1)return browser$3;hasRequiredBrowser$1=1;var e=safeBufferExports$2.Buffer,t=browser$9,a=readableBrowserExports,u=inherits_browserExports,d=requireSign(),h=requireVerify(),w=require$$6;Object.keys(w).forEach(function(S){w[S].id=e.from(w[S].id,"hex"),w[S.toLowerCase()]=w[S]});function x(S){a.Writable.call(this);var k=w[S];if(!k)throw new Error("Unknown message digest");this._hashType=k.hash,this._hash=t(k.hash),this._tag=k.id,this._signType=k.sign}u(x,a.Writable),x.prototype._write=function(k,C,q){this._hash.update(k),q()},x.prototype.update=function(k,C){return this._hash.update(typeof k=="string"?e.from(k,C):k),this},x.prototype.sign=function(k,C){this.end();var q=this._hash.digest(),O=d(q,k,this._hashType,this._signType,this._tag);return C?O.toString(C):O};function M(S){a.Writable.call(this);var k=w[S];if(!k)throw new Error("Unknown message digest");this._hash=t(k.hash),this._tag=k.id,this._signType=k.sign}u(M,a.Writable),M.prototype._write=function(k,C,q){this._hash.update(k),q()},M.prototype.update=function(k,C){return this._hash.update(typeof k=="string"?e.from(k,C):k),this},M.prototype.verify=function(k,C,q){var O=typeof C=="string"?e.from(C,q):C;this.end();var U=this._hash.digest();return h(O,U,k,this._signType,this._tag)};function B(S){return new x(S)}function E(S){return new M(S)}return browser$3={Sign:B,Verify:E,createSign:B,createVerify:E},browser$3}var bn$1={exports:{}};bn$1.exports;(function(e){(function(t,a){function u($,n){if(!$)throw new Error(n||"Assertion failed")}function d($,n){$.super_=n;var l=function(){};l.prototype=n.prototype,$.prototype=new l,$.prototype.constructor=$}function h($,n,l){if(h.isBN($))return $;this.negative=0,this.words=null,this.length=0,this.red=null,$!==null&&((n==="le"||n==="be")&&(l=n,n=10),this._init($||0,n||10,l||"be"))}typeof t=="object"?t.exports=h:a.BN=h,h.BN=h,h.wordSize=26;var w;try{typeof window<"u"&&typeof window.Buffer<"u"?w=window.Buffer:w=dist.Buffer}catch{}h.isBN=function(n){return n instanceof h?!0:n!==null&&typeof n=="object"&&n.constructor.wordSize===h.wordSize&&Array.isArray(n.words)},h.max=function(n,l){return n.cmp(l)>0?n:l},h.min=function(n,l){return n.cmp(l)<0?n:l},h.prototype._init=function(n,l,c){if(typeof n=="number")return this._initNumber(n,l,c);if(typeof n=="object")return this._initArray(n,l,c);l==="hex"&&(l=16),u(l===(l|0)&&l>=2&&l<=36),n=n.toString().replace(/\s+/g,"");var p=0;n[0]==="-"&&(p++,this.negative=1),p<n.length&&(l===16?this._parseHex(n,p,c):(this._parseBase(n,l,p),c==="le"&&this._initArray(this.toArray(),l,c)))},h.prototype._initNumber=function(n,l,c){n<0&&(this.negative=1,n=-n),n<67108864?(this.words=[n&67108863],this.length=1):n<4503599627370496?(this.words=[n&67108863,n/67108864&67108863],this.length=2):(u(n<9007199254740992),this.words=[n&67108863,n/67108864&67108863,1],this.length=3),c==="le"&&this._initArray(this.toArray(),l,c)},h.prototype._initArray=function(n,l,c){if(u(typeof n.length=="number"),n.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(n.length/3),this.words=new Array(this.length);for(var p=0;p<this.length;p++)this.words[p]=0;var y,b,_=0;if(c==="be")for(p=n.length-1,y=0;p>=0;p-=3)b=n[p]|n[p-1]<<8|n[p-2]<<16,this.words[y]|=b<<_&67108863,this.words[y+1]=b>>>26-_&67108863,_+=24,_>=26&&(_-=26,y++);else if(c==="le")for(p=0,y=0;p<n.length;p+=3)b=n[p]|n[p+1]<<8|n[p+2]<<16,this.words[y]|=b<<_&67108863,this.words[y+1]=b>>>26-_&67108863,_+=24,_>=26&&(_-=26,y++);return this.strip()};function x($,n){var l=$.charCodeAt(n);return l>=65&&l<=70?l-55:l>=97&&l<=102?l-87:l-48&15}function M($,n,l){var c=x($,l);return l-1>=n&&(c|=x($,l-1)<<4),c}h.prototype._parseHex=function(n,l,c){this.length=Math.ceil((n.length-l)/6),this.words=new Array(this.length);for(var p=0;p<this.length;p++)this.words[p]=0;var y=0,b=0,_;if(c==="be")for(p=n.length-1;p>=l;p-=2)_=M(n,l,p)<<y,this.words[b]|=_&67108863,y>=18?(y-=18,b+=1,this.words[b]|=_>>>26):y+=8;else{var v=n.length-l;for(p=v%2===0?l+1:l;p<n.length;p+=2)_=M(n,l,p)<<y,this.words[b]|=_&67108863,y>=18?(y-=18,b+=1,this.words[b]|=_>>>26):y+=8}this.strip()};function B($,n,l,c){for(var p=0,y=Math.min($.length,l),b=n;b<y;b++){var _=$.charCodeAt(b)-48;p*=c,_>=49?p+=_-49+10:_>=17?p+=_-17+10:p+=_}return p}h.prototype._parseBase=function(n,l,c){this.words=[0],this.length=1;for(var p=0,y=1;y<=67108863;y*=l)p++;p--,y=y/l|0;for(var b=n.length-c,_=b%p,v=Math.min(b,b-_)+c,o=0,m=c;m<v;m+=p)o=B(n,m,m+p,l),this.imuln(y),this.words[0]+o<67108864?this.words[0]+=o:this._iaddn(o);if(_!==0){var A=1;for(o=B(n,m,n.length,l),m=0;m<_;m++)A*=l;this.imuln(A),this.words[0]+o<67108864?this.words[0]+=o:this._iaddn(o)}this.strip()},h.prototype.copy=function(n){n.words=new Array(this.length);for(var l=0;l<this.length;l++)n.words[l]=this.words[l];n.length=this.length,n.negative=this.negative,n.red=this.red},h.prototype.clone=function(){var n=new h(null);return this.copy(n),n},h.prototype._expand=function(n){for(;this.length<n;)this.words[this.length++]=0;return this},h.prototype.strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},h.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},h.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var E=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],S=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],k=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];h.prototype.toString=function(n,l){n=n||10,l=l|0||1;var c;if(n===16||n==="hex"){c="";for(var p=0,y=0,b=0;b<this.length;b++){var _=this.words[b],v=((_<<p|y)&16777215).toString(16);y=_>>>24-p&16777215,p+=2,p>=26&&(p-=26,b--),y!==0||b!==this.length-1?c=E[6-v.length]+v+c:c=v+c}for(y!==0&&(c=y.toString(16)+c);c.length%l!==0;)c="0"+c;return this.negative!==0&&(c="-"+c),c}if(n===(n|0)&&n>=2&&n<=36){var o=S[n],m=k[n];c="";var A=this.clone();for(A.negative=0;!A.isZero();){var I=A.modn(m).toString(n);A=A.idivn(m),A.isZero()?c=I+c:c=E[o-I.length]+I+c}for(this.isZero()&&(c="0"+c);c.length%l!==0;)c="0"+c;return this.negative!==0&&(c="-"+c),c}u(!1,"Base should be between 2 and 36")},h.prototype.toNumber=function(){var n=this.words[0];return this.length===2?n+=this.words[1]*67108864:this.length===3&&this.words[2]===1?n+=4503599627370496+this.words[1]*67108864:this.length>2&&u(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-n:n},h.prototype.toJSON=function(){return this.toString(16)},h.prototype.toBuffer=function(n,l){return u(typeof w<"u"),this.toArrayLike(w,n,l)},h.prototype.toArray=function(n,l){return this.toArrayLike(Array,n,l)},h.prototype.toArrayLike=function(n,l,c){var p=this.byteLength(),y=c||Math.max(1,p);u(p<=y,"byte array longer than desired length"),u(y>0,"Requested array length <= 0"),this.strip();var b=l==="le",_=new n(y),v,o,m=this.clone();if(b){for(o=0;!m.isZero();o++)v=m.andln(255),m.iushrn(8),_[o]=v;for(;o<y;o++)_[o]=0}else{for(o=0;o<y-p;o++)_[o]=0;for(o=0;!m.isZero();o++)v=m.andln(255),m.iushrn(8),_[y-o-1]=v}return _},Math.clz32?h.prototype._countBits=function(n){return 32-Math.clz32(n)}:h.prototype._countBits=function(n){var l=n,c=0;return l>=4096&&(c+=13,l>>>=13),l>=64&&(c+=7,l>>>=7),l>=8&&(c+=4,l>>>=4),l>=2&&(c+=2,l>>>=2),c+l},h.prototype._zeroBits=function(n){if(n===0)return 26;var l=n,c=0;return l&8191||(c+=13,l>>>=13),l&127||(c+=7,l>>>=7),l&15||(c+=4,l>>>=4),l&3||(c+=2,l>>>=2),l&1||c++,c},h.prototype.bitLength=function(){var n=this.words[this.length-1],l=this._countBits(n);return(this.length-1)*26+l};function C($){for(var n=new Array($.bitLength()),l=0;l<n.length;l++){var c=l/26|0,p=l%26;n[l]=($.words[c]&1<<p)>>>p}return n}h.prototype.zeroBits=function(){if(this.isZero())return 0;for(var n=0,l=0;l<this.length;l++){var c=this._zeroBits(this.words[l]);if(n+=c,c!==26)break}return n},h.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},h.prototype.toTwos=function(n){return this.negative!==0?this.abs().inotn(n).iaddn(1):this.clone()},h.prototype.fromTwos=function(n){return this.testn(n-1)?this.notn(n).iaddn(1).ineg():this.clone()},h.prototype.isNeg=function(){return this.negative!==0},h.prototype.neg=function(){return this.clone().ineg()},h.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},h.prototype.iuor=function(n){for(;this.length<n.length;)this.words[this.length++]=0;for(var l=0;l<n.length;l++)this.words[l]=this.words[l]|n.words[l];return this.strip()},h.prototype.ior=function(n){return u((this.negative|n.negative)===0),this.iuor(n)},h.prototype.or=function(n){return this.length>n.length?this.clone().ior(n):n.clone().ior(this)},h.prototype.uor=function(n){return this.length>n.length?this.clone().iuor(n):n.clone().iuor(this)},h.prototype.iuand=function(n){var l;this.length>n.length?l=n:l=this;for(var c=0;c<l.length;c++)this.words[c]=this.words[c]&n.words[c];return this.length=l.length,this.strip()},h.prototype.iand=function(n){return u((this.negative|n.negative)===0),this.iuand(n)},h.prototype.and=function(n){return this.length>n.length?this.clone().iand(n):n.clone().iand(this)},h.prototype.uand=function(n){return this.length>n.length?this.clone().iuand(n):n.clone().iuand(this)},h.prototype.iuxor=function(n){var l,c;this.length>n.length?(l=this,c=n):(l=n,c=this);for(var p=0;p<c.length;p++)this.words[p]=l.words[p]^c.words[p];if(this!==l)for(;p<l.length;p++)this.words[p]=l.words[p];return this.length=l.length,this.strip()},h.prototype.ixor=function(n){return u((this.negative|n.negative)===0),this.iuxor(n)},h.prototype.xor=function(n){return this.length>n.length?this.clone().ixor(n):n.clone().ixor(this)},h.prototype.uxor=function(n){return this.length>n.length?this.clone().iuxor(n):n.clone().iuxor(this)},h.prototype.inotn=function(n){u(typeof n=="number"&&n>=0);var l=Math.ceil(n/26)|0,c=n%26;this._expand(l),c>0&&l--;for(var p=0;p<l;p++)this.words[p]=~this.words[p]&67108863;return c>0&&(this.words[p]=~this.words[p]&67108863>>26-c),this.strip()},h.prototype.notn=function(n){return this.clone().inotn(n)},h.prototype.setn=function(n,l){u(typeof n=="number"&&n>=0);var c=n/26|0,p=n%26;return this._expand(c+1),l?this.words[c]=this.words[c]|1<<p:this.words[c]=this.words[c]&~(1<<p),this.strip()},h.prototype.iadd=function(n){var l;if(this.negative!==0&&n.negative===0)return this.negative=0,l=this.isub(n),this.negative^=1,this._normSign();if(this.negative===0&&n.negative!==0)return n.negative=0,l=this.isub(n),n.negative=1,l._normSign();var c,p;this.length>n.length?(c=this,p=n):(c=n,p=this);for(var y=0,b=0;b<p.length;b++)l=(c.words[b]|0)+(p.words[b]|0)+y,this.words[b]=l&67108863,y=l>>>26;for(;y!==0&&b<c.length;b++)l=(c.words[b]|0)+y,this.words[b]=l&67108863,y=l>>>26;if(this.length=c.length,y!==0)this.words[this.length]=y,this.length++;else if(c!==this)for(;b<c.length;b++)this.words[b]=c.words[b];return this},h.prototype.add=function(n){var l;return n.negative!==0&&this.negative===0?(n.negative=0,l=this.sub(n),n.negative^=1,l):n.negative===0&&this.negative!==0?(this.negative=0,l=n.sub(this),this.negative=1,l):this.length>n.length?this.clone().iadd(n):n.clone().iadd(this)},h.prototype.isub=function(n){if(n.negative!==0){n.negative=0;var l=this.iadd(n);return n.negative=1,l._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(n),this.negative=1,this._normSign();var c=this.cmp(n);if(c===0)return this.negative=0,this.length=1,this.words[0]=0,this;var p,y;c>0?(p=this,y=n):(p=n,y=this);for(var b=0,_=0;_<y.length;_++)l=(p.words[_]|0)-(y.words[_]|0)+b,b=l>>26,this.words[_]=l&67108863;for(;b!==0&&_<p.length;_++)l=(p.words[_]|0)+b,b=l>>26,this.words[_]=l&67108863;if(b===0&&_<p.length&&p!==this)for(;_<p.length;_++)this.words[_]=p.words[_];return this.length=Math.max(this.length,_),p!==this&&(this.negative=1),this.strip()},h.prototype.sub=function(n){return this.clone().isub(n)};function q($,n,l){l.negative=n.negative^$.negative;var c=$.length+n.length|0;l.length=c,c=c-1|0;var p=$.words[0]|0,y=n.words[0]|0,b=p*y,_=b&67108863,v=b/67108864|0;l.words[0]=_;for(var o=1;o<c;o++){for(var m=v>>>26,A=v&67108863,I=Math.min(o,n.length-1),F=Math.max(0,o-$.length+1);F<=I;F++){var X=o-F|0;p=$.words[X]|0,y=n.words[F]|0,b=p*y+A,m+=b/67108864|0,A=b&67108863}l.words[o]=A|0,v=m|0}return v!==0?l.words[o]=v|0:l.length--,l.strip()}var O=function(n,l,c){var p=n.words,y=l.words,b=c.words,_=0,v,o,m,A=p[0]|0,I=A&8191,F=A>>>13,X=p[1]|0,V=X&8191,T=X>>>13,D=p[2]|0,Z=D&8191,te=D>>>13,ee=p[3]|0,j=ee&8191,re=ee>>>13,qe=p[4]|0,de=qe&8191,pe=qe>>>13,je=p[5]|0,we=je&8191,le=je>>>13,Ve=p[6]|0,_e=Ve&8191,xe=Ve>>>13,ze=p[7]|0,me=ze&8191,ke=ze>>>13,Ge=p[8]|0,Me=Ge&8191,Ne=Ge>>>13,Ze=p[9]|0,Be=Ze&8191,De=Ze>>>13,rt=y[0]|0,Ae=rt&8191,Oe=rt>>>13,Je=y[1]|0,Re=Je&8191,He=Je>>>13,Qe=y[2]|0,Te=Qe&8191,Ue=Qe>>>13,tt=y[3]|0,Ee=tt&8191,Pe=tt>>>13,et=y[4]|0,Ie=et&8191,Le=et>>>13,it=y[5]|0,z=it&8191,N=it>>>13,H=y[6]|0,Q=H&8191,ne=H>>>13,ve=y[7]|0,he=ve&8191,be=ve>>>13,We=y[8]|0,ye=We&8191,Se=We>>>13,Ke=y[9]|0,Ce=Ke&8191,Fe=Ke>>>13;c.negative=n.negative^l.negative,c.length=19,v=Math.imul(I,Ae),o=Math.imul(I,Oe),o=o+Math.imul(F,Ae)|0,m=Math.imul(F,Oe);var Xe=(_+v|0)+((o&8191)<<13)|0;_=(m+(o>>>13)|0)+(Xe>>>26)|0,Xe&=67108863,v=Math.imul(V,Ae),o=Math.imul(V,Oe),o=o+Math.imul(T,Ae)|0,m=Math.imul(T,Oe),v=v+Math.imul(I,Re)|0,o=o+Math.imul(I,He)|0,o=o+Math.imul(F,Re)|0,m=m+Math.imul(F,He)|0;var Ye=(_+v|0)+((o&8191)<<13)|0;_=(m+(o>>>13)|0)+(Ye>>>26)|0,Ye&=67108863,v=Math.imul(Z,Ae),o=Math.imul(Z,Oe),o=o+Math.imul(te,Ae)|0,m=Math.imul(te,Oe),v=v+Math.imul(V,Re)|0,o=o+Math.imul(V,He)|0,o=o+Math.imul(T,Re)|0,m=m+Math.imul(T,He)|0,v=v+Math.imul(I,Te)|0,o=o+Math.imul(I,Ue)|0,o=o+Math.imul(F,Te)|0,m=m+Math.imul(F,Ue)|0;var nt=(_+v|0)+((o&8191)<<13)|0;_=(m+(o>>>13)|0)+(nt>>>26)|0,nt&=67108863,v=Math.imul(j,Ae),o=Math.imul(j,Oe),o=o+Math.imul(re,Ae)|0,m=Math.imul(re,Oe),v=v+Math.imul(Z,Re)|0,o=o+Math.imul(Z,He)|0,o=o+Math.imul(te,Re)|0,m=m+Math.imul(te,He)|0,v=v+Math.imul(V,Te)|0,o=o+Math.imul(V,Ue)|0,o=o+Math.imul(T,Te)|0,m=m+Math.imul(T,Ue)|0,v=v+Math.imul(I,Ee)|0,o=o+Math.imul(I,Pe)|0,o=o+Math.imul(F,Ee)|0,m=m+Math.imul(F,Pe)|0;var at=(_+v|0)+((o&8191)<<13)|0;_=(m+(o>>>13)|0)+(at>>>26)|0,at&=67108863,v=Math.imul(de,Ae),o=Math.imul(de,Oe),o=o+Math.imul(pe,Ae)|0,m=Math.imul(pe,Oe),v=v+Math.imul(j,Re)|0,o=o+Math.imul(j,He)|0,o=o+Math.imul(re,Re)|0,m=m+Math.imul(re,He)|0,v=v+Math.imul(Z,Te)|0,o=o+Math.imul(Z,Ue)|0,o=o+Math.imul(te,Te)|0,m=m+Math.imul(te,Ue)|0,v=v+Math.imul(V,Ee)|0,o=o+Math.imul(V,Pe)|0,o=o+Math.imul(T,Ee)|0,m=m+Math.imul(T,Pe)|0,v=v+Math.imul(I,Ie)|0,o=o+Math.imul(I,Le)|0,o=o+Math.imul(F,Ie)|0,m=m+Math.imul(F,Le)|0;var ot=(_+v|0)+((o&8191)<<13)|0;_=(m+(o>>>13)|0)+(ot>>>26)|0,ot&=67108863,v=Math.imul(we,Ae),o=Math.imul(we,Oe),o=o+Math.imul(le,Ae)|0,m=Math.imul(le,Oe),v=v+Math.imul(de,Re)|0,o=o+Math.imul(de,He)|0,o=o+Math.imul(pe,Re)|0,m=m+Math.imul(pe,He)|0,v=v+Math.imul(j,Te)|0,o=o+Math.imul(j,Ue)|0,o=o+Math.imul(re,Te)|0,m=m+Math.imul(re,Ue)|0,v=v+Math.imul(Z,Ee)|0,o=o+Math.imul(Z,Pe)|0,o=o+Math.imul(te,Ee)|0,m=m+Math.imul(te,Pe)|0,v=v+Math.imul(V,Ie)|0,o=o+Math.imul(V,Le)|0,o=o+Math.imul(T,Ie)|0,m=m+Math.imul(T,Le)|0,v=v+Math.imul(I,z)|0,o=o+Math.imul(I,N)|0,o=o+Math.imul(F,z)|0,m=m+Math.imul(F,N)|0;var st=(_+v|0)+((o&8191)<<13)|0;_=(m+(o>>>13)|0)+(st>>>26)|0,st&=67108863,v=Math.imul(_e,Ae),o=Math.imul(_e,Oe),o=o+Math.imul(xe,Ae)|0,m=Math.imul(xe,Oe),v=v+Math.imul(we,Re)|0,o=o+Math.imul(we,He)|0,o=o+Math.imul(le,Re)|0,m=m+Math.imul(le,He)|0,v=v+Math.imul(de,Te)|0,o=o+Math.imul(de,Ue)|0,o=o+Math.imul(pe,Te)|0,m=m+Math.imul(pe,Ue)|0,v=v+Math.imul(j,Ee)|0,o=o+Math.imul(j,Pe)|0,o=o+Math.imul(re,Ee)|0,m=m+Math.imul(re,Pe)|0,v=v+Math.imul(Z,Ie)|0,o=o+Math.imul(Z,Le)|0,o=o+Math.imul(te,Ie)|0,m=m+Math.imul(te,Le)|0,v=v+Math.imul(V,z)|0,o=o+Math.imul(V,N)|0,o=o+Math.imul(T,z)|0,m=m+Math.imul(T,N)|0,v=v+Math.imul(I,Q)|0,o=o+Math.imul(I,ne)|0,o=o+Math.imul(F,Q)|0,m=m+Math.imul(F,ne)|0;var ht=(_+v|0)+((o&8191)<<13)|0;_=(m+(o>>>13)|0)+(ht>>>26)|0,ht&=67108863,v=Math.imul(me,Ae),o=Math.imul(me,Oe),o=o+Math.imul(ke,Ae)|0,m=Math.imul(ke,Oe),v=v+Math.imul(_e,Re)|0,o=o+Math.imul(_e,He)|0,o=o+Math.imul(xe,Re)|0,m=m+Math.imul(xe,He)|0,v=v+Math.imul(we,Te)|0,o=o+Math.imul(we,Ue)|0,o=o+Math.imul(le,Te)|0,m=m+Math.imul(le,Ue)|0,v=v+Math.imul(de,Ee)|0,o=o+Math.imul(de,Pe)|0,o=o+Math.imul(pe,Ee)|0,m=m+Math.imul(pe,Pe)|0,v=v+Math.imul(j,Ie)|0,o=o+Math.imul(j,Le)|0,o=o+Math.imul(re,Ie)|0,m=m+Math.imul(re,Le)|0,v=v+Math.imul(Z,z)|0,o=o+Math.imul(Z,N)|0,o=o+Math.imul(te,z)|0,m=m+Math.imul(te,N)|0,v=v+Math.imul(V,Q)|0,o=o+Math.imul(V,ne)|0,o=o+Math.imul(T,Q)|0,m=m+Math.imul(T,ne)|0,v=v+Math.imul(I,he)|0,o=o+Math.imul(I,be)|0,o=o+Math.imul(F,he)|0,m=m+Math.imul(F,be)|0;var lt=(_+v|0)+((o&8191)<<13)|0;_=(m+(o>>>13)|0)+(lt>>>26)|0,lt&=67108863,v=Math.imul(Me,Ae),o=Math.imul(Me,Oe),o=o+Math.imul(Ne,Ae)|0,m=Math.imul(Ne,Oe),v=v+Math.imul(me,Re)|0,o=o+Math.imul(me,He)|0,o=o+Math.imul(ke,Re)|0,m=m+Math.imul(ke,He)|0,v=v+Math.imul(_e,Te)|0,o=o+Math.imul(_e,Ue)|0,o=o+Math.imul(xe,Te)|0,m=m+Math.imul(xe,Ue)|0,v=v+Math.imul(we,Ee)|0,o=o+Math.imul(we,Pe)|0,o=o+Math.imul(le,Ee)|0,m=m+Math.imul(le,Pe)|0,v=v+Math.imul(de,Ie)|0,o=o+Math.imul(de,Le)|0,o=o+Math.imul(pe,Ie)|0,m=m+Math.imul(pe,Le)|0,v=v+Math.imul(j,z)|0,o=o+Math.imul(j,N)|0,o=o+Math.imul(re,z)|0,m=m+Math.imul(re,N)|0,v=v+Math.imul(Z,Q)|0,o=o+Math.imul(Z,ne)|0,o=o+Math.imul(te,Q)|0,m=m+Math.imul(te,ne)|0,v=v+Math.imul(V,he)|0,o=o+Math.imul(V,be)|0,o=o+Math.imul(T,he)|0,m=m+Math.imul(T,be)|0,v=v+Math.imul(I,ye)|0,o=o+Math.imul(I,Se)|0,o=o+Math.imul(F,ye)|0,m=m+Math.imul(F,Se)|0;var ct=(_+v|0)+((o&8191)<<13)|0;_=(m+(o>>>13)|0)+(ct>>>26)|0,ct&=67108863,v=Math.imul(Be,Ae),o=Math.imul(Be,Oe),o=o+Math.imul(De,Ae)|0,m=Math.imul(De,Oe),v=v+Math.imul(Me,Re)|0,o=o+Math.imul(Me,He)|0,o=o+Math.imul(Ne,Re)|0,m=m+Math.imul(Ne,He)|0,v=v+Math.imul(me,Te)|0,o=o+Math.imul(me,Ue)|0,o=o+Math.imul(ke,Te)|0,m=m+Math.imul(ke,Ue)|0,v=v+Math.imul(_e,Ee)|0,o=o+Math.imul(_e,Pe)|0,o=o+Math.imul(xe,Ee)|0,m=m+Math.imul(xe,Pe)|0,v=v+Math.imul(we,Ie)|0,o=o+Math.imul(we,Le)|0,o=o+Math.imul(le,Ie)|0,m=m+Math.imul(le,Le)|0,v=v+Math.imul(de,z)|0,o=o+Math.imul(de,N)|0,o=o+Math.imul(pe,z)|0,m=m+Math.imul(pe,N)|0,v=v+Math.imul(j,Q)|0,o=o+Math.imul(j,ne)|0,o=o+Math.imul(re,Q)|0,m=m+Math.imul(re,ne)|0,v=v+Math.imul(Z,he)|0,o=o+Math.imul(Z,be)|0,o=o+Math.imul(te,he)|0,m=m+Math.imul(te,be)|0,v=v+Math.imul(V,ye)|0,o=o+Math.imul(V,Se)|0,o=o+Math.imul(T,ye)|0,m=m+Math.imul(T,Se)|0,v=v+Math.imul(I,Ce)|0,o=o+Math.imul(I,Fe)|0,o=o+Math.imul(F,Ce)|0,m=m+Math.imul(F,Fe)|0;var dt=(_+v|0)+((o&8191)<<13)|0;_=(m+(o>>>13)|0)+(dt>>>26)|0,dt&=67108863,v=Math.imul(Be,Re),o=Math.imul(Be,He),o=o+Math.imul(De,Re)|0,m=Math.imul(De,He),v=v+Math.imul(Me,Te)|0,o=o+Math.imul(Me,Ue)|0,o=o+Math.imul(Ne,Te)|0,m=m+Math.imul(Ne,Ue)|0,v=v+Math.imul(me,Ee)|0,o=o+Math.imul(me,Pe)|0,o=o+Math.imul(ke,Ee)|0,m=m+Math.imul(ke,Pe)|0,v=v+Math.imul(_e,Ie)|0,o=o+Math.imul(_e,Le)|0,o=o+Math.imul(xe,Ie)|0,m=m+Math.imul(xe,Le)|0,v=v+Math.imul(we,z)|0,o=o+Math.imul(we,N)|0,o=o+Math.imul(le,z)|0,m=m+Math.imul(le,N)|0,v=v+Math.imul(de,Q)|0,o=o+Math.imul(de,ne)|0,o=o+Math.imul(pe,Q)|0,m=m+Math.imul(pe,ne)|0,v=v+Math.imul(j,he)|0,o=o+Math.imul(j,be)|0,o=o+Math.imul(re,he)|0,m=m+Math.imul(re,be)|0,v=v+Math.imul(Z,ye)|0,o=o+Math.imul(Z,Se)|0,o=o+Math.imul(te,ye)|0,m=m+Math.imul(te,Se)|0,v=v+Math.imul(V,Ce)|0,o=o+Math.imul(V,Fe)|0,o=o+Math.imul(T,Ce)|0,m=m+Math.imul(T,Fe)|0;var pt=(_+v|0)+((o&8191)<<13)|0;_=(m+(o>>>13)|0)+(pt>>>26)|0,pt&=67108863,v=Math.imul(Be,Te),o=Math.imul(Be,Ue),o=o+Math.imul(De,Te)|0,m=Math.imul(De,Ue),v=v+Math.imul(Me,Ee)|0,o=o+Math.imul(Me,Pe)|0,o=o+Math.imul(Ne,Ee)|0,m=m+Math.imul(Ne,Pe)|0,v=v+Math.imul(me,Ie)|0,o=o+Math.imul(me,Le)|0,o=o+Math.imul(ke,Ie)|0,m=m+Math.imul(ke,Le)|0,v=v+Math.imul(_e,z)|0,o=o+Math.imul(_e,N)|0,o=o+Math.imul(xe,z)|0,m=m+Math.imul(xe,N)|0,v=v+Math.imul(we,Q)|0,o=o+Math.imul(we,ne)|0,o=o+Math.imul(le,Q)|0,m=m+Math.imul(le,ne)|0,v=v+Math.imul(de,he)|0,o=o+Math.imul(de,be)|0,o=o+Math.imul(pe,he)|0,m=m+Math.imul(pe,be)|0,v=v+Math.imul(j,ye)|0,o=o+Math.imul(j,Se)|0,o=o+Math.imul(re,ye)|0,m=m+Math.imul(re,Se)|0,v=v+Math.imul(Z,Ce)|0,o=o+Math.imul(Z,Fe)|0,o=o+Math.imul(te,Ce)|0,m=m+Math.imul(te,Fe)|0;var vt=(_+v|0)+((o&8191)<<13)|0;_=(m+(o>>>13)|0)+(vt>>>26)|0,vt&=67108863,v=Math.imul(Be,Ee),o=Math.imul(Be,Pe),o=o+Math.imul(De,Ee)|0,m=Math.imul(De,Pe),v=v+Math.imul(Me,Ie)|0,o=o+Math.imul(Me,Le)|0,o=o+Math.imul(Ne,Ie)|0,m=m+Math.imul(Ne,Le)|0,v=v+Math.imul(me,z)|0,o=o+Math.imul(me,N)|0,o=o+Math.imul(ke,z)|0,m=m+Math.imul(ke,N)|0,v=v+Math.imul(_e,Q)|0,o=o+Math.imul(_e,ne)|0,o=o+Math.imul(xe,Q)|0,m=m+Math.imul(xe,ne)|0,v=v+Math.imul(we,he)|0,o=o+Math.imul(we,be)|0,o=o+Math.imul(le,he)|0,m=m+Math.imul(le,be)|0,v=v+Math.imul(de,ye)|0,o=o+Math.imul(de,Se)|0,o=o+Math.imul(pe,ye)|0,m=m+Math.imul(pe,Se)|0,v=v+Math.imul(j,Ce)|0,o=o+Math.imul(j,Fe)|0,o=o+Math.imul(re,Ce)|0,m=m+Math.imul(re,Fe)|0;var yt=(_+v|0)+((o&8191)<<13)|0;_=(m+(o>>>13)|0)+(yt>>>26)|0,yt&=67108863,v=Math.imul(Be,Ie),o=Math.imul(Be,Le),o=o+Math.imul(De,Ie)|0,m=Math.imul(De,Le),v=v+Math.imul(Me,z)|0,o=o+Math.imul(Me,N)|0,o=o+Math.imul(Ne,z)|0,m=m+Math.imul(Ne,N)|0,v=v+Math.imul(me,Q)|0,o=o+Math.imul(me,ne)|0,o=o+Math.imul(ke,Q)|0,m=m+Math.imul(ke,ne)|0,v=v+Math.imul(_e,he)|0,o=o+Math.imul(_e,be)|0,o=o+Math.imul(xe,he)|0,m=m+Math.imul(xe,be)|0,v=v+Math.imul(we,ye)|0,o=o+Math.imul(we,Se)|0,o=o+Math.imul(le,ye)|0,m=m+Math.imul(le,Se)|0,v=v+Math.imul(de,Ce)|0,o=o+Math.imul(de,Fe)|0,o=o+Math.imul(pe,Ce)|0,m=m+Math.imul(pe,Fe)|0;var mt=(_+v|0)+((o&8191)<<13)|0;_=(m+(o>>>13)|0)+(mt>>>26)|0,mt&=67108863,v=Math.imul(Be,z),o=Math.imul(Be,N),o=o+Math.imul(De,z)|0,m=Math.imul(De,N),v=v+Math.imul(Me,Q)|0,o=o+Math.imul(Me,ne)|0,o=o+Math.imul(Ne,Q)|0,m=m+Math.imul(Ne,ne)|0,v=v+Math.imul(me,he)|0,o=o+Math.imul(me,be)|0,o=o+Math.imul(ke,he)|0,m=m+Math.imul(ke,be)|0,v=v+Math.imul(_e,ye)|0,o=o+Math.imul(_e,Se)|0,o=o+Math.imul(xe,ye)|0,m=m+Math.imul(xe,Se)|0,v=v+Math.imul(we,Ce)|0,o=o+Math.imul(we,Fe)|0,o=o+Math.imul(le,Ce)|0,m=m+Math.imul(le,Fe)|0;var gt=(_+v|0)+((o&8191)<<13)|0;_=(m+(o>>>13)|0)+(gt>>>26)|0,gt&=67108863,v=Math.imul(Be,Q),o=Math.imul(Be,ne),o=o+Math.imul(De,Q)|0,m=Math.imul(De,ne),v=v+Math.imul(Me,he)|0,o=o+Math.imul(Me,be)|0,o=o+Math.imul(Ne,he)|0,m=m+Math.imul(Ne,be)|0,v=v+Math.imul(me,ye)|0,o=o+Math.imul(me,Se)|0,o=o+Math.imul(ke,ye)|0,m=m+Math.imul(ke,Se)|0,v=v+Math.imul(_e,Ce)|0,o=o+Math.imul(_e,Fe)|0,o=o+Math.imul(xe,Ce)|0,m=m+Math.imul(xe,Fe)|0;var bt=(_+v|0)+((o&8191)<<13)|0;_=(m+(o>>>13)|0)+(bt>>>26)|0,bt&=67108863,v=Math.imul(Be,he),o=Math.imul(Be,be),o=o+Math.imul(De,he)|0,m=Math.imul(De,be),v=v+Math.imul(Me,ye)|0,o=o+Math.imul(Me,Se)|0,o=o+Math.imul(Ne,ye)|0,m=m+Math.imul(Ne,Se)|0,v=v+Math.imul(me,Ce)|0,o=o+Math.imul(me,Fe)|0,o=o+Math.imul(ke,Ce)|0,m=m+Math.imul(ke,Fe)|0;var wt=(_+v|0)+((o&8191)<<13)|0;_=(m+(o>>>13)|0)+(wt>>>26)|0,wt&=67108863,v=Math.imul(Be,ye),o=Math.imul(Be,Se),o=o+Math.imul(De,ye)|0,m=Math.imul(De,Se),v=v+Math.imul(Me,Ce)|0,o=o+Math.imul(Me,Fe)|0,o=o+Math.imul(Ne,Ce)|0,m=m+Math.imul(Ne,Fe)|0;var _t=(_+v|0)+((o&8191)<<13)|0;_=(m+(o>>>13)|0)+(_t>>>26)|0,_t&=67108863,v=Math.imul(Be,Ce),o=Math.imul(Be,Fe),o=o+Math.imul(De,Ce)|0,m=Math.imul(De,Fe);var xt=(_+v|0)+((o&8191)<<13)|0;return _=(m+(o>>>13)|0)+(xt>>>26)|0,xt&=67108863,b[0]=Xe,b[1]=Ye,b[2]=nt,b[3]=at,b[4]=ot,b[5]=st,b[6]=ht,b[7]=lt,b[8]=ct,b[9]=dt,b[10]=pt,b[11]=vt,b[12]=yt,b[13]=mt,b[14]=gt,b[15]=bt,b[16]=wt,b[17]=_t,b[18]=xt,_!==0&&(b[19]=_,c.length++),c};Math.imul||(O=q);function U($,n,l){l.negative=n.negative^$.negative,l.length=$.length+n.length;for(var c=0,p=0,y=0;y<l.length-1;y++){var b=p;p=0;for(var _=c&67108863,v=Math.min(y,n.length-1),o=Math.max(0,y-$.length+1);o<=v;o++){var m=y-o,A=$.words[m]|0,I=n.words[o]|0,F=A*I,X=F&67108863;b=b+(F/67108864|0)|0,X=X+_|0,_=X&67108863,b=b+(X>>>26)|0,p+=b>>>26,b&=67108863}l.words[y]=_,c=b,b=p}return c!==0?l.words[y]=c:l.length--,l.strip()}function P($,n,l){var c=new L;return c.mulp($,n,l)}h.prototype.mulTo=function(n,l){var c,p=this.length+n.length;return this.length===10&&n.length===10?c=O(this,n,l):p<63?c=q(this,n,l):p<1024?c=U(this,n,l):c=P(this,n,l),c};function L($,n){this.x=$,this.y=n}L.prototype.makeRBT=function(n){for(var l=new Array(n),c=h.prototype._countBits(n)-1,p=0;p<n;p++)l[p]=this.revBin(p,c,n);return l},L.prototype.revBin=function(n,l,c){if(n===0||n===c-1)return n;for(var p=0,y=0;y<l;y++)p|=(n&1)<<l-y-1,n>>=1;return p},L.prototype.permute=function(n,l,c,p,y,b){for(var _=0;_<b;_++)p[_]=l[n[_]],y[_]=c[n[_]]},L.prototype.transform=function(n,l,c,p,y,b){this.permute(b,n,l,c,p,y);for(var _=1;_<y;_<<=1)for(var v=_<<1,o=Math.cos(2*Math.PI/v),m=Math.sin(2*Math.PI/v),A=0;A<y;A+=v)for(var I=o,F=m,X=0;X<_;X++){var V=c[A+X],T=p[A+X],D=c[A+X+_],Z=p[A+X+_],te=I*D-F*Z;Z=I*Z+F*D,D=te,c[A+X]=V+D,p[A+X]=T+Z,c[A+X+_]=V-D,p[A+X+_]=T-Z,X!==v&&(te=o*I-m*F,F=o*F+m*I,I=te)}},L.prototype.guessLen13b=function(n,l){var c=Math.max(l,n)|1,p=c&1,y=0;for(c=c/2|0;c;c=c>>>1)y++;return 1<<y+1+p},L.prototype.conjugate=function(n,l,c){if(!(c<=1))for(var p=0;p<c/2;p++){var y=n[p];n[p]=n[c-p-1],n[c-p-1]=y,y=l[p],l[p]=-l[c-p-1],l[c-p-1]=-y}},L.prototype.normalize13b=function(n,l){for(var c=0,p=0;p<l/2;p++){var y=Math.round(n[2*p+1]/l)*8192+Math.round(n[2*p]/l)+c;n[p]=y&67108863,y<67108864?c=0:c=y/67108864|0}return n},L.prototype.convert13b=function(n,l,c,p){for(var y=0,b=0;b<l;b++)y=y+(n[b]|0),c[2*b]=y&8191,y=y>>>13,c[2*b+1]=y&8191,y=y>>>13;for(b=2*l;b<p;++b)c[b]=0;u(y===0),u((y&-8192)===0)},L.prototype.stub=function(n){for(var l=new Array(n),c=0;c<n;c++)l[c]=0;return l},L.prototype.mulp=function(n,l,c){var p=2*this.guessLen13b(n.length,l.length),y=this.makeRBT(p),b=this.stub(p),_=new Array(p),v=new Array(p),o=new Array(p),m=new Array(p),A=new Array(p),I=new Array(p),F=c.words;F.length=p,this.convert13b(n.words,n.length,_,p),this.convert13b(l.words,l.length,m,p),this.transform(_,b,v,o,p,y),this.transform(m,b,A,I,p,y);for(var X=0;X<p;X++){var V=v[X]*A[X]-o[X]*I[X];o[X]=v[X]*I[X]+o[X]*A[X],v[X]=V}return this.conjugate(v,o,p),this.transform(v,o,F,b,p,y),this.conjugate(F,b,p),this.normalize13b(F,p),c.negative=n.negative^l.negative,c.length=n.length+l.length,c.strip()},h.prototype.mul=function(n){var l=new h(null);return l.words=new Array(this.length+n.length),this.mulTo(n,l)},h.prototype.mulf=function(n){var l=new h(null);return l.words=new Array(this.length+n.length),P(this,n,l)},h.prototype.imul=function(n){return this.clone().mulTo(n,this)},h.prototype.imuln=function(n){u(typeof n=="number"),u(n<67108864);for(var l=0,c=0;c<this.length;c++){var p=(this.words[c]|0)*n,y=(p&67108863)+(l&67108863);l>>=26,l+=p/67108864|0,l+=y>>>26,this.words[c]=y&67108863}return l!==0&&(this.words[c]=l,this.length++),this.length=n===0?1:this.length,this},h.prototype.muln=function(n){return this.clone().imuln(n)},h.prototype.sqr=function(){return this.mul(this)},h.prototype.isqr=function(){return this.imul(this.clone())},h.prototype.pow=function(n){var l=C(n);if(l.length===0)return new h(1);for(var c=this,p=0;p<l.length&&l[p]===0;p++,c=c.sqr());if(++p<l.length)for(var y=c.sqr();p<l.length;p++,y=y.sqr())l[p]!==0&&(c=c.mul(y));return c},h.prototype.iushln=function(n){u(typeof n=="number"&&n>=0);var l=n%26,c=(n-l)/26,p=67108863>>>26-l<<26-l,y;if(l!==0){var b=0;for(y=0;y<this.length;y++){var _=this.words[y]&p,v=(this.words[y]|0)-_<<l;this.words[y]=v|b,b=_>>>26-l}b&&(this.words[y]=b,this.length++)}if(c!==0){for(y=this.length-1;y>=0;y--)this.words[y+c]=this.words[y];for(y=0;y<c;y++)this.words[y]=0;this.length+=c}return this.strip()},h.prototype.ishln=function(n){return u(this.negative===0),this.iushln(n)},h.prototype.iushrn=function(n,l,c){u(typeof n=="number"&&n>=0);var p;l?p=(l-l%26)/26:p=0;var y=n%26,b=Math.min((n-y)/26,this.length),_=67108863^67108863>>>y<<y,v=c;if(p-=b,p=Math.max(0,p),v){for(var o=0;o<b;o++)v.words[o]=this.words[o];v.length=b}if(b!==0)if(this.length>b)for(this.length-=b,o=0;o<this.length;o++)this.words[o]=this.words[o+b];else this.words[0]=0,this.length=1;var m=0;for(o=this.length-1;o>=0&&(m!==0||o>=p);o--){var A=this.words[o]|0;this.words[o]=m<<26-y|A>>>y,m=A&_}return v&&m!==0&&(v.words[v.length++]=m),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},h.prototype.ishrn=function(n,l,c){return u(this.negative===0),this.iushrn(n,l,c)},h.prototype.shln=function(n){return this.clone().ishln(n)},h.prototype.ushln=function(n){return this.clone().iushln(n)},h.prototype.shrn=function(n){return this.clone().ishrn(n)},h.prototype.ushrn=function(n){return this.clone().iushrn(n)},h.prototype.testn=function(n){u(typeof n=="number"&&n>=0);var l=n%26,c=(n-l)/26,p=1<<l;if(this.length<=c)return!1;var y=this.words[c];return!!(y&p)},h.prototype.imaskn=function(n){u(typeof n=="number"&&n>=0);var l=n%26,c=(n-l)/26;if(u(this.negative===0,"imaskn works only with positive numbers"),this.length<=c)return this;if(l!==0&&c++,this.length=Math.min(c,this.length),l!==0){var p=67108863^67108863>>>l<<l;this.words[this.length-1]&=p}return this.strip()},h.prototype.maskn=function(n){return this.clone().imaskn(n)},h.prototype.iaddn=function(n){return u(typeof n=="number"),u(n<67108864),n<0?this.isubn(-n):this.negative!==0?this.length===1&&(this.words[0]|0)<n?(this.words[0]=n-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(n),this.negative=1,this):this._iaddn(n)},h.prototype._iaddn=function(n){this.words[0]+=n;for(var l=0;l<this.length&&this.words[l]>=67108864;l++)this.words[l]-=67108864,l===this.length-1?this.words[l+1]=1:this.words[l+1]++;return this.length=Math.max(this.length,l+1),this},h.prototype.isubn=function(n){if(u(typeof n=="number"),u(n<67108864),n<0)return this.iaddn(-n);if(this.negative!==0)return this.negative=0,this.iaddn(n),this.negative=1,this;if(this.words[0]-=n,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var l=0;l<this.length&&this.words[l]<0;l++)this.words[l]+=67108864,this.words[l+1]-=1;return this.strip()},h.prototype.addn=function(n){return this.clone().iaddn(n)},h.prototype.subn=function(n){return this.clone().isubn(n)},h.prototype.iabs=function(){return this.negative=0,this},h.prototype.abs=function(){return this.clone().iabs()},h.prototype._ishlnsubmul=function(n,l,c){var p=n.length+c,y;this._expand(p);var b,_=0;for(y=0;y<n.length;y++){b=(this.words[y+c]|0)+_;var v=(n.words[y]|0)*l;b-=v&67108863,_=(b>>26)-(v/67108864|0),this.words[y+c]=b&67108863}for(;y<this.length-c;y++)b=(this.words[y+c]|0)+_,_=b>>26,this.words[y+c]=b&67108863;if(_===0)return this.strip();for(u(_===-1),_=0,y=0;y<this.length;y++)b=-(this.words[y]|0)+_,_=b>>26,this.words[y]=b&67108863;return this.negative=1,this.strip()},h.prototype._wordDiv=function(n,l){var c=this.length-n.length,p=this.clone(),y=n,b=y.words[y.length-1]|0,_=this._countBits(b);c=26-_,c!==0&&(y=y.ushln(c),p.iushln(c),b=y.words[y.length-1]|0);var v=p.length-y.length,o;if(l!=="mod"){o=new h(null),o.length=v+1,o.words=new Array(o.length);for(var m=0;m<o.length;m++)o.words[m]=0}var A=p.clone()._ishlnsubmul(y,1,v);A.negative===0&&(p=A,o&&(o.words[v]=1));for(var I=v-1;I>=0;I--){var F=(p.words[y.length+I]|0)*67108864+(p.words[y.length+I-1]|0);for(F=Math.min(F/b|0,67108863),p._ishlnsubmul(y,F,I);p.negative!==0;)F--,p.negative=0,p._ishlnsubmul(y,1,I),p.isZero()||(p.negative^=1);o&&(o.words[I]=F)}return o&&o.strip(),p.strip(),l!=="div"&&c!==0&&p.iushrn(c),{div:o||null,mod:p}},h.prototype.divmod=function(n,l,c){if(u(!n.isZero()),this.isZero())return{div:new h(0),mod:new h(0)};var p,y,b;return this.negative!==0&&n.negative===0?(b=this.neg().divmod(n,l),l!=="mod"&&(p=b.div.neg()),l!=="div"&&(y=b.mod.neg(),c&&y.negative!==0&&y.iadd(n)),{div:p,mod:y}):this.negative===0&&n.negative!==0?(b=this.divmod(n.neg(),l),l!=="mod"&&(p=b.div.neg()),{div:p,mod:b.mod}):this.negative&n.negative?(b=this.neg().divmod(n.neg(),l),l!=="div"&&(y=b.mod.neg(),c&&y.negative!==0&&y.isub(n)),{div:b.div,mod:y}):n.length>this.length||this.cmp(n)<0?{div:new h(0),mod:this}:n.length===1?l==="div"?{div:this.divn(n.words[0]),mod:null}:l==="mod"?{div:null,mod:new h(this.modn(n.words[0]))}:{div:this.divn(n.words[0]),mod:new h(this.modn(n.words[0]))}:this._wordDiv(n,l)},h.prototype.div=function(n){return this.divmod(n,"div",!1).div},h.prototype.mod=function(n){return this.divmod(n,"mod",!1).mod},h.prototype.umod=function(n){return this.divmod(n,"mod",!0).mod},h.prototype.divRound=function(n){var l=this.divmod(n);if(l.mod.isZero())return l.div;var c=l.div.negative!==0?l.mod.isub(n):l.mod,p=n.ushrn(1),y=n.andln(1),b=c.cmp(p);return b<0||y===1&&b===0?l.div:l.div.negative!==0?l.div.isubn(1):l.div.iaddn(1)},h.prototype.modn=function(n){u(n<=67108863);for(var l=(1<<26)%n,c=0,p=this.length-1;p>=0;p--)c=(l*c+(this.words[p]|0))%n;return c},h.prototype.idivn=function(n){u(n<=67108863);for(var l=0,c=this.length-1;c>=0;c--){var p=(this.words[c]|0)+l*67108864;this.words[c]=p/n|0,l=p%n}return this.strip()},h.prototype.divn=function(n){return this.clone().idivn(n)},h.prototype.egcd=function(n){u(n.negative===0),u(!n.isZero());var l=this,c=n.clone();l.negative!==0?l=l.umod(n):l=l.clone();for(var p=new h(1),y=new h(0),b=new h(0),_=new h(1),v=0;l.isEven()&&c.isEven();)l.iushrn(1),c.iushrn(1),++v;for(var o=c.clone(),m=l.clone();!l.isZero();){for(var A=0,I=1;!(l.words[0]&I)&&A<26;++A,I<<=1);if(A>0)for(l.iushrn(A);A-- >0;)(p.isOdd()||y.isOdd())&&(p.iadd(o),y.isub(m)),p.iushrn(1),y.iushrn(1);for(var F=0,X=1;!(c.words[0]&X)&&F<26;++F,X<<=1);if(F>0)for(c.iushrn(F);F-- >0;)(b.isOdd()||_.isOdd())&&(b.iadd(o),_.isub(m)),b.iushrn(1),_.iushrn(1);l.cmp(c)>=0?(l.isub(c),p.isub(b),y.isub(_)):(c.isub(l),b.isub(p),_.isub(y))}return{a:b,b:_,gcd:c.iushln(v)}},h.prototype._invmp=function(n){u(n.negative===0),u(!n.isZero());var l=this,c=n.clone();l.negative!==0?l=l.umod(n):l=l.clone();for(var p=new h(1),y=new h(0),b=c.clone();l.cmpn(1)>0&&c.cmpn(1)>0;){for(var _=0,v=1;!(l.words[0]&v)&&_<26;++_,v<<=1);if(_>0)for(l.iushrn(_);_-- >0;)p.isOdd()&&p.iadd(b),p.iushrn(1);for(var o=0,m=1;!(c.words[0]&m)&&o<26;++o,m<<=1);if(o>0)for(c.iushrn(o);o-- >0;)y.isOdd()&&y.iadd(b),y.iushrn(1);l.cmp(c)>=0?(l.isub(c),p.isub(y)):(c.isub(l),y.isub(p))}var A;return l.cmpn(1)===0?A=p:A=y,A.cmpn(0)<0&&A.iadd(n),A},h.prototype.gcd=function(n){if(this.isZero())return n.abs();if(n.isZero())return this.abs();var l=this.clone(),c=n.clone();l.negative=0,c.negative=0;for(var p=0;l.isEven()&&c.isEven();p++)l.iushrn(1),c.iushrn(1);do{for(;l.isEven();)l.iushrn(1);for(;c.isEven();)c.iushrn(1);var y=l.cmp(c);if(y<0){var b=l;l=c,c=b}else if(y===0||c.cmpn(1)===0)break;l.isub(c)}while(!0);return c.iushln(p)},h.prototype.invm=function(n){return this.egcd(n).a.umod(n)},h.prototype.isEven=function(){return(this.words[0]&1)===0},h.prototype.isOdd=function(){return(this.words[0]&1)===1},h.prototype.andln=function(n){return this.words[0]&n},h.prototype.bincn=function(n){u(typeof n=="number");var l=n%26,c=(n-l)/26,p=1<<l;if(this.length<=c)return this._expand(c+1),this.words[c]|=p,this;for(var y=p,b=c;y!==0&&b<this.length;b++){var _=this.words[b]|0;_+=y,y=_>>>26,_&=67108863,this.words[b]=_}return y!==0&&(this.words[b]=y,this.length++),this},h.prototype.isZero=function(){return this.length===1&&this.words[0]===0},h.prototype.cmpn=function(n){var l=n<0;if(this.negative!==0&&!l)return-1;if(this.negative===0&&l)return 1;this.strip();var c;if(this.length>1)c=1;else{l&&(n=-n),u(n<=67108863,"Number is too big");var p=this.words[0]|0;c=p===n?0:p<n?-1:1}return this.negative!==0?-c|0:c},h.prototype.cmp=function(n){if(this.negative!==0&&n.negative===0)return-1;if(this.negative===0&&n.negative!==0)return 1;var l=this.ucmp(n);return this.negative!==0?-l|0:l},h.prototype.ucmp=function(n){if(this.length>n.length)return 1;if(this.length<n.length)return-1;for(var l=0,c=this.length-1;c>=0;c--){var p=this.words[c]|0,y=n.words[c]|0;if(p!==y){p<y?l=-1:p>y&&(l=1);break}}return l},h.prototype.gtn=function(n){return this.cmpn(n)===1},h.prototype.gt=function(n){return this.cmp(n)===1},h.prototype.gten=function(n){return this.cmpn(n)>=0},h.prototype.gte=function(n){return this.cmp(n)>=0},h.prototype.ltn=function(n){return this.cmpn(n)===-1},h.prototype.lt=function(n){return this.cmp(n)===-1},h.prototype.lten=function(n){return this.cmpn(n)<=0},h.prototype.lte=function(n){return this.cmp(n)<=0},h.prototype.eqn=function(n){return this.cmpn(n)===0},h.prototype.eq=function(n){return this.cmp(n)===0},h.red=function(n){return new ie(n)},h.prototype.toRed=function(n){return u(!this.red,"Already a number in reduction context"),u(this.negative===0,"red works only with positives"),n.convertTo(this)._forceRed(n)},h.prototype.fromRed=function(){return u(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},h.prototype._forceRed=function(n){return this.red=n,this},h.prototype.forceRed=function(n){return u(!this.red,"Already a number in reduction context"),this._forceRed(n)},h.prototype.redAdd=function(n){return u(this.red,"redAdd works only with red numbers"),this.red.add(this,n)},h.prototype.redIAdd=function(n){return u(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,n)},h.prototype.redSub=function(n){return u(this.red,"redSub works only with red numbers"),this.red.sub(this,n)},h.prototype.redISub=function(n){return u(this.red,"redISub works only with red numbers"),this.red.isub(this,n)},h.prototype.redShl=function(n){return u(this.red,"redShl works only with red numbers"),this.red.shl(this,n)},h.prototype.redMul=function(n){return u(this.red,"redMul works only with red numbers"),this.red._verify2(this,n),this.red.mul(this,n)},h.prototype.redIMul=function(n){return u(this.red,"redMul works only with red numbers"),this.red._verify2(this,n),this.red.imul(this,n)},h.prototype.redSqr=function(){return u(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},h.prototype.redISqr=function(){return u(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},h.prototype.redSqrt=function(){return u(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},h.prototype.redInvm=function(){return u(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},h.prototype.redNeg=function(){return u(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},h.prototype.redPow=function(n){return u(this.red&&!n.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,n)};var J={k256:null,p224:null,p192:null,p25519:null};function Y($,n){this.name=$,this.p=new h(n,16),this.n=this.p.bitLength(),this.k=new h(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}Y.prototype._tmp=function(){var n=new h(null);return n.words=new Array(Math.ceil(this.n/13)),n},Y.prototype.ireduce=function(n){var l=n,c;do this.split(l,this.tmp),l=this.imulK(l),l=l.iadd(this.tmp),c=l.bitLength();while(c>this.n);var p=c<this.n?-1:l.ucmp(this.p);return p===0?(l.words[0]=0,l.length=1):p>0?l.isub(this.p):l.strip!==void 0?l.strip():l._strip(),l},Y.prototype.split=function(n,l){n.iushrn(this.n,0,l)},Y.prototype.imulK=function(n){return n.imul(this.k)};function ae(){Y.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}d(ae,Y),ae.prototype.split=function(n,l){for(var c=4194303,p=Math.min(n.length,9),y=0;y<p;y++)l.words[y]=n.words[y];if(l.length=p,n.length<=9){n.words[0]=0,n.length=1;return}var b=n.words[9];for(l.words[l.length++]=b&c,y=10;y<n.length;y++){var _=n.words[y]|0;n.words[y-10]=(_&c)<<4|b>>>22,b=_}b>>>=22,n.words[y-10]=b,b===0&&n.length>10?n.length-=10:n.length-=9},ae.prototype.imulK=function(n){n.words[n.length]=0,n.words[n.length+1]=0,n.length+=2;for(var l=0,c=0;c<n.length;c++){var p=n.words[c]|0;l+=p*977,n.words[c]=l&67108863,l=p*64+(l/67108864|0)}return n.words[n.length-1]===0&&(n.length--,n.words[n.length-1]===0&&n.length--),n};function oe(){Y.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}d(oe,Y);function ue(){Y.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}d(ue,Y);function se(){Y.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}d(se,Y),se.prototype.imulK=function(n){for(var l=0,c=0;c<n.length;c++){var p=(n.words[c]|0)*19+l,y=p&67108863;p>>>=26,n.words[c]=y,l=p}return l!==0&&(n.words[n.length++]=l),n},h._prime=function(n){if(J[n])return J[n];var l;if(n==="k256")l=new ae;else if(n==="p224")l=new oe;else if(n==="p192")l=new ue;else if(n==="p25519")l=new se;else throw new Error("Unknown prime "+n);return J[n]=l,l};function ie($){if(typeof $=="string"){var n=h._prime($);this.m=n.p,this.prime=n}else u($.gtn(1),"modulus must be greater than 1"),this.m=$,this.prime=null}ie.prototype._verify1=function(n){u(n.negative===0,"red works only with positives"),u(n.red,"red works only with red numbers")},ie.prototype._verify2=function(n,l){u((n.negative|l.negative)===0,"red works only with positives"),u(n.red&&n.red===l.red,"red works only with red numbers")},ie.prototype.imod=function(n){return this.prime?this.prime.ireduce(n)._forceRed(this):n.umod(this.m)._forceRed(this)},ie.prototype.neg=function(n){return n.isZero()?n.clone():this.m.sub(n)._forceRed(this)},ie.prototype.add=function(n,l){this._verify2(n,l);var c=n.add(l);return c.cmp(this.m)>=0&&c.isub(this.m),c._forceRed(this)},ie.prototype.iadd=function(n,l){this._verify2(n,l);var c=n.iadd(l);return c.cmp(this.m)>=0&&c.isub(this.m),c},ie.prototype.sub=function(n,l){this._verify2(n,l);var c=n.sub(l);return c.cmpn(0)<0&&c.iadd(this.m),c._forceRed(this)},ie.prototype.isub=function(n,l){this._verify2(n,l);var c=n.isub(l);return c.cmpn(0)<0&&c.iadd(this.m),c},ie.prototype.shl=function(n,l){return this._verify1(n),this.imod(n.ushln(l))},ie.prototype.imul=function(n,l){return this._verify2(n,l),this.imod(n.imul(l))},ie.prototype.mul=function(n,l){return this._verify2(n,l),this.imod(n.mul(l))},ie.prototype.isqr=function(n){return this.imul(n,n.clone())},ie.prototype.sqr=function(n){return this.mul(n,n)},ie.prototype.sqrt=function(n){if(n.isZero())return n.clone();var l=this.m.andln(3);if(u(l%2===1),l===3){var c=this.m.add(new h(1)).iushrn(2);return this.pow(n,c)}for(var p=this.m.subn(1),y=0;!p.isZero()&&p.andln(1)===0;)y++,p.iushrn(1);u(!p.isZero());var b=new h(1).toRed(this),_=b.redNeg(),v=this.m.subn(1).iushrn(1),o=this.m.bitLength();for(o=new h(2*o*o).toRed(this);this.pow(o,v).cmp(_)!==0;)o.redIAdd(_);for(var m=this.pow(o,p),A=this.pow(n,p.addn(1).iushrn(1)),I=this.pow(n,p),F=y;I.cmp(b)!==0;){for(var X=I,V=0;X.cmp(b)!==0;V++)X=X.redSqr();u(V<F);var T=this.pow(m,new h(1).iushln(F-V-1));A=A.redMul(T),m=T.redSqr(),I=I.redMul(m),F=V}return A},ie.prototype.invm=function(n){var l=n._invmp(this.m);return l.negative!==0?(l.negative=0,this.imod(l).redNeg()):this.imod(l)},ie.prototype.pow=function(n,l){if(l.isZero())return new h(1).toRed(this);if(l.cmpn(1)===0)return n.clone();var c=4,p=new Array(1<<c);p[0]=new h(1).toRed(this),p[1]=n;for(var y=2;y<p.length;y++)p[y]=this.mul(p[y-1],n);var b=p[0],_=0,v=0,o=l.bitLength()%26;for(o===0&&(o=26),y=l.length-1;y>=0;y--){for(var m=l.words[y],A=o-1;A>=0;A--){var I=m>>A&1;if(b!==p[0]&&(b=this.sqr(b)),I===0&&_===0){v=0;continue}_<<=1,_|=I,v++,!(v!==c&&(y!==0||A!==0))&&(b=this.mul(b,p[_]),v=0,_=0)}o=26}return b},ie.prototype.convertTo=function(n){var l=n.umod(this.m);return l===n?l.clone():l},ie.prototype.convertFrom=function(n){var l=n.clone();return l.red=null,l},h.mont=function(n){return new ce(n)};function ce($){ie.call(this,$),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new h(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}d(ce,ie),ce.prototype.convertTo=function(n){return this.imod(n.ushln(this.shift))},ce.prototype.convertFrom=function(n){var l=this.imod(n.mul(this.rinv));return l.red=null,l},ce.prototype.imul=function(n,l){if(n.isZero()||l.isZero())return n.words[0]=0,n.length=1,n;var c=n.imul(l),p=c.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),y=c.isub(p).iushrn(this.shift),b=y;return y.cmp(this.m)>=0?b=y.isub(this.m):y.cmpn(0)<0&&(b=y.iadd(this.m)),b._forceRed(this)},ce.prototype.mul=function(n,l){if(n.isZero()||l.isZero())return new h(0)._forceRed(this);var c=n.mul(l),p=c.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),y=c.isub(p).iushrn(this.shift),b=y;return y.cmp(this.m)>=0?b=y.isub(this.m):y.cmpn(0)<0&&(b=y.iadd(this.m)),b._forceRed(this)},ce.prototype.invm=function(n){var l=this.imod(n._invmp(this.m).mul(this.r2));return l._forceRed(this)}})(e,commonjsGlobal)})(bn$1);var bnExports$1=bn$1.exports,browser$2,hasRequiredBrowser;function requireBrowser(){if(hasRequiredBrowser)return browser$2;hasRequiredBrowser=1;var e=requireElliptic(),t=bnExports$1;browser$2=function(w){return new u(w)};var a={secp256k1:{name:"secp256k1",byteLength:32},secp224r1:{name:"p224",byteLength:28},prime256v1:{name:"p256",byteLength:32},prime192v1:{name:"p192",byteLength:24},ed25519:{name:"ed25519",byteLength:32},secp384r1:{name:"p384",byteLength:48},secp521r1:{name:"p521",byteLength:66}};a.p224=a.secp224r1,a.p256=a.secp256r1=a.prime256v1,a.p192=a.secp192r1=a.prime192v1,a.p384=a.secp384r1,a.p521=a.secp521r1;function u(h){this.curveType=a[h],this.curveType||(this.curveType={name:h}),this.curve=new e.ec(this.curveType.name),this.keys=void 0}u.prototype.generateKeys=function(h,w){return this.keys=this.curve.genKeyPair(),this.getPublicKey(h,w)},u.prototype.computeSecret=function(h,w,x){w=w||"utf8",Buffer$F.isBuffer(h)||(h=new Buffer$F(h,w));var M=this.curve.keyFromPublic(h).getPublic(),B=M.mul(this.keys.getPrivate()).getX();return d(B,x,this.curveType.byteLength)},u.prototype.getPublicKey=function(h,w){var x=this.keys.getPublic(w==="compressed",!0);return w==="hybrid"&&(x[x.length-1]%2?x[0]=7:x[0]=6),d(x,h)},u.prototype.getPrivateKey=function(h){return d(this.keys.getPrivate(),h)},u.prototype.setPublicKey=function(h,w){return w=w||"utf8",Buffer$F.isBuffer(h)||(h=new Buffer$F(h,w)),this.keys._importPublic(h),this},u.prototype.setPrivateKey=function(h,w){w=w||"utf8",Buffer$F.isBuffer(h)||(h=new Buffer$F(h,w));var x=new t(h);return x=x.toString(16),this.keys=this.curve.genKeyPair(),this.keys._importPrivate(x),this};function d(h,w,x){Array.isArray(h)||(h=h.toArray());var M=new Buffer$F(h);if(x&&M.length<x){var B=new Buffer$F(x-M.length);B.fill(0),M=Buffer$F.concat([B,M])}return w?M.toString(w):M}return browser$2}var browser$1={},createHash$2=browser$9,Buffer$4=safeBufferExports$2.Buffer,mgf$2=function(e,t){for(var a=Buffer$4.alloc(0),u=0,d;a.length<t;)d=i2ops(u++),a=Buffer$4.concat([a,createHash$2("sha1").update(e).update(d).digest()]);return a.slice(0,t)};function i2ops(e){var t=Buffer$4.allocUnsafe(4);return t.writeUInt32BE(e,0),t}var xor$2=function e(t,a){for(var u=t.length,d=-1;++d<u;)t[d]^=a[d];return t},bn={exports:{}};bn.exports;(function(e){(function(t,a){function u($,n){if(!$)throw new Error(n||"Assertion failed")}function d($,n){$.super_=n;var l=function(){};l.prototype=n.prototype,$.prototype=new l,$.prototype.constructor=$}function h($,n,l){if(h.isBN($))return $;this.negative=0,this.words=null,this.length=0,this.red=null,$!==null&&((n==="le"||n==="be")&&(l=n,n=10),this._init($||0,n||10,l||"be"))}typeof t=="object"?t.exports=h:a.BN=h,h.BN=h,h.wordSize=26;var w;try{typeof window<"u"&&typeof window.Buffer<"u"?w=window.Buffer:w=dist.Buffer}catch{}h.isBN=function(n){return n instanceof h?!0:n!==null&&typeof n=="object"&&n.constructor.wordSize===h.wordSize&&Array.isArray(n.words)},h.max=function(n,l){return n.cmp(l)>0?n:l},h.min=function(n,l){return n.cmp(l)<0?n:l},h.prototype._init=function(n,l,c){if(typeof n=="number")return this._initNumber(n,l,c);if(typeof n=="object")return this._initArray(n,l,c);l==="hex"&&(l=16),u(l===(l|0)&&l>=2&&l<=36),n=n.toString().replace(/\s+/g,"");var p=0;n[0]==="-"&&(p++,this.negative=1),p<n.length&&(l===16?this._parseHex(n,p,c):(this._parseBase(n,l,p),c==="le"&&this._initArray(this.toArray(),l,c)))},h.prototype._initNumber=function(n,l,c){n<0&&(this.negative=1,n=-n),n<67108864?(this.words=[n&67108863],this.length=1):n<4503599627370496?(this.words=[n&67108863,n/67108864&67108863],this.length=2):(u(n<9007199254740992),this.words=[n&67108863,n/67108864&67108863,1],this.length=3),c==="le"&&this._initArray(this.toArray(),l,c)},h.prototype._initArray=function(n,l,c){if(u(typeof n.length=="number"),n.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(n.length/3),this.words=new Array(this.length);for(var p=0;p<this.length;p++)this.words[p]=0;var y,b,_=0;if(c==="be")for(p=n.length-1,y=0;p>=0;p-=3)b=n[p]|n[p-1]<<8|n[p-2]<<16,this.words[y]|=b<<_&67108863,this.words[y+1]=b>>>26-_&67108863,_+=24,_>=26&&(_-=26,y++);else if(c==="le")for(p=0,y=0;p<n.length;p+=3)b=n[p]|n[p+1]<<8|n[p+2]<<16,this.words[y]|=b<<_&67108863,this.words[y+1]=b>>>26-_&67108863,_+=24,_>=26&&(_-=26,y++);return this.strip()};function x($,n){var l=$.charCodeAt(n);return l>=65&&l<=70?l-55:l>=97&&l<=102?l-87:l-48&15}function M($,n,l){var c=x($,l);return l-1>=n&&(c|=x($,l-1)<<4),c}h.prototype._parseHex=function(n,l,c){this.length=Math.ceil((n.length-l)/6),this.words=new Array(this.length);for(var p=0;p<this.length;p++)this.words[p]=0;var y=0,b=0,_;if(c==="be")for(p=n.length-1;p>=l;p-=2)_=M(n,l,p)<<y,this.words[b]|=_&67108863,y>=18?(y-=18,b+=1,this.words[b]|=_>>>26):y+=8;else{var v=n.length-l;for(p=v%2===0?l+1:l;p<n.length;p+=2)_=M(n,l,p)<<y,this.words[b]|=_&67108863,y>=18?(y-=18,b+=1,this.words[b]|=_>>>26):y+=8}this.strip()};function B($,n,l,c){for(var p=0,y=Math.min($.length,l),b=n;b<y;b++){var _=$.charCodeAt(b)-48;p*=c,_>=49?p+=_-49+10:_>=17?p+=_-17+10:p+=_}return p}h.prototype._parseBase=function(n,l,c){this.words=[0],this.length=1;for(var p=0,y=1;y<=67108863;y*=l)p++;p--,y=y/l|0;for(var b=n.length-c,_=b%p,v=Math.min(b,b-_)+c,o=0,m=c;m<v;m+=p)o=B(n,m,m+p,l),this.imuln(y),this.words[0]+o<67108864?this.words[0]+=o:this._iaddn(o);if(_!==0){var A=1;for(o=B(n,m,n.length,l),m=0;m<_;m++)A*=l;this.imuln(A),this.words[0]+o<67108864?this.words[0]+=o:this._iaddn(o)}this.strip()},h.prototype.copy=function(n){n.words=new Array(this.length);for(var l=0;l<this.length;l++)n.words[l]=this.words[l];n.length=this.length,n.negative=this.negative,n.red=this.red},h.prototype.clone=function(){var n=new h(null);return this.copy(n),n},h.prototype._expand=function(n){for(;this.length<n;)this.words[this.length++]=0;return this},h.prototype.strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},h.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},h.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var E=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],S=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],k=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];h.prototype.toString=function(n,l){n=n||10,l=l|0||1;var c;if(n===16||n==="hex"){c="";for(var p=0,y=0,b=0;b<this.length;b++){var _=this.words[b],v=((_<<p|y)&16777215).toString(16);y=_>>>24-p&16777215,p+=2,p>=26&&(p-=26,b--),y!==0||b!==this.length-1?c=E[6-v.length]+v+c:c=v+c}for(y!==0&&(c=y.toString(16)+c);c.length%l!==0;)c="0"+c;return this.negative!==0&&(c="-"+c),c}if(n===(n|0)&&n>=2&&n<=36){var o=S[n],m=k[n];c="";var A=this.clone();for(A.negative=0;!A.isZero();){var I=A.modn(m).toString(n);A=A.idivn(m),A.isZero()?c=I+c:c=E[o-I.length]+I+c}for(this.isZero()&&(c="0"+c);c.length%l!==0;)c="0"+c;return this.negative!==0&&(c="-"+c),c}u(!1,"Base should be between 2 and 36")},h.prototype.toNumber=function(){var n=this.words[0];return this.length===2?n+=this.words[1]*67108864:this.length===3&&this.words[2]===1?n+=4503599627370496+this.words[1]*67108864:this.length>2&&u(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-n:n},h.prototype.toJSON=function(){return this.toString(16)},h.prototype.toBuffer=function(n,l){return u(typeof w<"u"),this.toArrayLike(w,n,l)},h.prototype.toArray=function(n,l){return this.toArrayLike(Array,n,l)},h.prototype.toArrayLike=function(n,l,c){var p=this.byteLength(),y=c||Math.max(1,p);u(p<=y,"byte array longer than desired length"),u(y>0,"Requested array length <= 0"),this.strip();var b=l==="le",_=new n(y),v,o,m=this.clone();if(b){for(o=0;!m.isZero();o++)v=m.andln(255),m.iushrn(8),_[o]=v;for(;o<y;o++)_[o]=0}else{for(o=0;o<y-p;o++)_[o]=0;for(o=0;!m.isZero();o++)v=m.andln(255),m.iushrn(8),_[y-o-1]=v}return _},Math.clz32?h.prototype._countBits=function(n){return 32-Math.clz32(n)}:h.prototype._countBits=function(n){var l=n,c=0;return l>=4096&&(c+=13,l>>>=13),l>=64&&(c+=7,l>>>=7),l>=8&&(c+=4,l>>>=4),l>=2&&(c+=2,l>>>=2),c+l},h.prototype._zeroBits=function(n){if(n===0)return 26;var l=n,c=0;return l&8191||(c+=13,l>>>=13),l&127||(c+=7,l>>>=7),l&15||(c+=4,l>>>=4),l&3||(c+=2,l>>>=2),l&1||c++,c},h.prototype.bitLength=function(){var n=this.words[this.length-1],l=this._countBits(n);return(this.length-1)*26+l};function C($){for(var n=new Array($.bitLength()),l=0;l<n.length;l++){var c=l/26|0,p=l%26;n[l]=($.words[c]&1<<p)>>>p}return n}h.prototype.zeroBits=function(){if(this.isZero())return 0;for(var n=0,l=0;l<this.length;l++){var c=this._zeroBits(this.words[l]);if(n+=c,c!==26)break}return n},h.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},h.prototype.toTwos=function(n){return this.negative!==0?this.abs().inotn(n).iaddn(1):this.clone()},h.prototype.fromTwos=function(n){return this.testn(n-1)?this.notn(n).iaddn(1).ineg():this.clone()},h.prototype.isNeg=function(){return this.negative!==0},h.prototype.neg=function(){return this.clone().ineg()},h.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},h.prototype.iuor=function(n){for(;this.length<n.length;)this.words[this.length++]=0;for(var l=0;l<n.length;l++)this.words[l]=this.words[l]|n.words[l];return this.strip()},h.prototype.ior=function(n){return u((this.negative|n.negative)===0),this.iuor(n)},h.prototype.or=function(n){return this.length>n.length?this.clone().ior(n):n.clone().ior(this)},h.prototype.uor=function(n){return this.length>n.length?this.clone().iuor(n):n.clone().iuor(this)},h.prototype.iuand=function(n){var l;this.length>n.length?l=n:l=this;for(var c=0;c<l.length;c++)this.words[c]=this.words[c]&n.words[c];return this.length=l.length,this.strip()},h.prototype.iand=function(n){return u((this.negative|n.negative)===0),this.iuand(n)},h.prototype.and=function(n){return this.length>n.length?this.clone().iand(n):n.clone().iand(this)},h.prototype.uand=function(n){return this.length>n.length?this.clone().iuand(n):n.clone().iuand(this)},h.prototype.iuxor=function(n){var l,c;this.length>n.length?(l=this,c=n):(l=n,c=this);for(var p=0;p<c.length;p++)this.words[p]=l.words[p]^c.words[p];if(this!==l)for(;p<l.length;p++)this.words[p]=l.words[p];return this.length=l.length,this.strip()},h.prototype.ixor=function(n){return u((this.negative|n.negative)===0),this.iuxor(n)},h.prototype.xor=function(n){return this.length>n.length?this.clone().ixor(n):n.clone().ixor(this)},h.prototype.uxor=function(n){return this.length>n.length?this.clone().iuxor(n):n.clone().iuxor(this)},h.prototype.inotn=function(n){u(typeof n=="number"&&n>=0);var l=Math.ceil(n/26)|0,c=n%26;this._expand(l),c>0&&l--;for(var p=0;p<l;p++)this.words[p]=~this.words[p]&67108863;return c>0&&(this.words[p]=~this.words[p]&67108863>>26-c),this.strip()},h.prototype.notn=function(n){return this.clone().inotn(n)},h.prototype.setn=function(n,l){u(typeof n=="number"&&n>=0);var c=n/26|0,p=n%26;return this._expand(c+1),l?this.words[c]=this.words[c]|1<<p:this.words[c]=this.words[c]&~(1<<p),this.strip()},h.prototype.iadd=function(n){var l;if(this.negative!==0&&n.negative===0)return this.negative=0,l=this.isub(n),this.negative^=1,this._normSign();if(this.negative===0&&n.negative!==0)return n.negative=0,l=this.isub(n),n.negative=1,l._normSign();var c,p;this.length>n.length?(c=this,p=n):(c=n,p=this);for(var y=0,b=0;b<p.length;b++)l=(c.words[b]|0)+(p.words[b]|0)+y,this.words[b]=l&67108863,y=l>>>26;for(;y!==0&&b<c.length;b++)l=(c.words[b]|0)+y,this.words[b]=l&67108863,y=l>>>26;if(this.length=c.length,y!==0)this.words[this.length]=y,this.length++;else if(c!==this)for(;b<c.length;b++)this.words[b]=c.words[b];return this},h.prototype.add=function(n){var l;return n.negative!==0&&this.negative===0?(n.negative=0,l=this.sub(n),n.negative^=1,l):n.negative===0&&this.negative!==0?(this.negative=0,l=n.sub(this),this.negative=1,l):this.length>n.length?this.clone().iadd(n):n.clone().iadd(this)},h.prototype.isub=function(n){if(n.negative!==0){n.negative=0;var l=this.iadd(n);return n.negative=1,l._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(n),this.negative=1,this._normSign();var c=this.cmp(n);if(c===0)return this.negative=0,this.length=1,this.words[0]=0,this;var p,y;c>0?(p=this,y=n):(p=n,y=this);for(var b=0,_=0;_<y.length;_++)l=(p.words[_]|0)-(y.words[_]|0)+b,b=l>>26,this.words[_]=l&67108863;for(;b!==0&&_<p.length;_++)l=(p.words[_]|0)+b,b=l>>26,this.words[_]=l&67108863;if(b===0&&_<p.length&&p!==this)for(;_<p.length;_++)this.words[_]=p.words[_];return this.length=Math.max(this.length,_),p!==this&&(this.negative=1),this.strip()},h.prototype.sub=function(n){return this.clone().isub(n)};function q($,n,l){l.negative=n.negative^$.negative;var c=$.length+n.length|0;l.length=c,c=c-1|0;var p=$.words[0]|0,y=n.words[0]|0,b=p*y,_=b&67108863,v=b/67108864|0;l.words[0]=_;for(var o=1;o<c;o++){for(var m=v>>>26,A=v&67108863,I=Math.min(o,n.length-1),F=Math.max(0,o-$.length+1);F<=I;F++){var X=o-F|0;p=$.words[X]|0,y=n.words[F]|0,b=p*y+A,m+=b/67108864|0,A=b&67108863}l.words[o]=A|0,v=m|0}return v!==0?l.words[o]=v|0:l.length--,l.strip()}var O=function(n,l,c){var p=n.words,y=l.words,b=c.words,_=0,v,o,m,A=p[0]|0,I=A&8191,F=A>>>13,X=p[1]|0,V=X&8191,T=X>>>13,D=p[2]|0,Z=D&8191,te=D>>>13,ee=p[3]|0,j=ee&8191,re=ee>>>13,qe=p[4]|0,de=qe&8191,pe=qe>>>13,je=p[5]|0,we=je&8191,le=je>>>13,Ve=p[6]|0,_e=Ve&8191,xe=Ve>>>13,ze=p[7]|0,me=ze&8191,ke=ze>>>13,Ge=p[8]|0,Me=Ge&8191,Ne=Ge>>>13,Ze=p[9]|0,Be=Ze&8191,De=Ze>>>13,rt=y[0]|0,Ae=rt&8191,Oe=rt>>>13,Je=y[1]|0,Re=Je&8191,He=Je>>>13,Qe=y[2]|0,Te=Qe&8191,Ue=Qe>>>13,tt=y[3]|0,Ee=tt&8191,Pe=tt>>>13,et=y[4]|0,Ie=et&8191,Le=et>>>13,it=y[5]|0,z=it&8191,N=it>>>13,H=y[6]|0,Q=H&8191,ne=H>>>13,ve=y[7]|0,he=ve&8191,be=ve>>>13,We=y[8]|0,ye=We&8191,Se=We>>>13,Ke=y[9]|0,Ce=Ke&8191,Fe=Ke>>>13;c.negative=n.negative^l.negative,c.length=19,v=Math.imul(I,Ae),o=Math.imul(I,Oe),o=o+Math.imul(F,Ae)|0,m=Math.imul(F,Oe);var Xe=(_+v|0)+((o&8191)<<13)|0;_=(m+(o>>>13)|0)+(Xe>>>26)|0,Xe&=67108863,v=Math.imul(V,Ae),o=Math.imul(V,Oe),o=o+Math.imul(T,Ae)|0,m=Math.imul(T,Oe),v=v+Math.imul(I,Re)|0,o=o+Math.imul(I,He)|0,o=o+Math.imul(F,Re)|0,m=m+Math.imul(F,He)|0;var Ye=(_+v|0)+((o&8191)<<13)|0;_=(m+(o>>>13)|0)+(Ye>>>26)|0,Ye&=67108863,v=Math.imul(Z,Ae),o=Math.imul(Z,Oe),o=o+Math.imul(te,Ae)|0,m=Math.imul(te,Oe),v=v+Math.imul(V,Re)|0,o=o+Math.imul(V,He)|0,o=o+Math.imul(T,Re)|0,m=m+Math.imul(T,He)|0,v=v+Math.imul(I,Te)|0,o=o+Math.imul(I,Ue)|0,o=o+Math.imul(F,Te)|0,m=m+Math.imul(F,Ue)|0;var nt=(_+v|0)+((o&8191)<<13)|0;_=(m+(o>>>13)|0)+(nt>>>26)|0,nt&=67108863,v=Math.imul(j,Ae),o=Math.imul(j,Oe),o=o+Math.imul(re,Ae)|0,m=Math.imul(re,Oe),v=v+Math.imul(Z,Re)|0,o=o+Math.imul(Z,He)|0,o=o+Math.imul(te,Re)|0,m=m+Math.imul(te,He)|0,v=v+Math.imul(V,Te)|0,o=o+Math.imul(V,Ue)|0,o=o+Math.imul(T,Te)|0,m=m+Math.imul(T,Ue)|0,v=v+Math.imul(I,Ee)|0,o=o+Math.imul(I,Pe)|0,o=o+Math.imul(F,Ee)|0,m=m+Math.imul(F,Pe)|0;var at=(_+v|0)+((o&8191)<<13)|0;_=(m+(o>>>13)|0)+(at>>>26)|0,at&=67108863,v=Math.imul(de,Ae),o=Math.imul(de,Oe),o=o+Math.imul(pe,Ae)|0,m=Math.imul(pe,Oe),v=v+Math.imul(j,Re)|0,o=o+Math.imul(j,He)|0,o=o+Math.imul(re,Re)|0,m=m+Math.imul(re,He)|0,v=v+Math.imul(Z,Te)|0,o=o+Math.imul(Z,Ue)|0,o=o+Math.imul(te,Te)|0,m=m+Math.imul(te,Ue)|0,v=v+Math.imul(V,Ee)|0,o=o+Math.imul(V,Pe)|0,o=o+Math.imul(T,Ee)|0,m=m+Math.imul(T,Pe)|0,v=v+Math.imul(I,Ie)|0,o=o+Math.imul(I,Le)|0,o=o+Math.imul(F,Ie)|0,m=m+Math.imul(F,Le)|0;var ot=(_+v|0)+((o&8191)<<13)|0;_=(m+(o>>>13)|0)+(ot>>>26)|0,ot&=67108863,v=Math.imul(we,Ae),o=Math.imul(we,Oe),o=o+Math.imul(le,Ae)|0,m=Math.imul(le,Oe),v=v+Math.imul(de,Re)|0,o=o+Math.imul(de,He)|0,o=o+Math.imul(pe,Re)|0,m=m+Math.imul(pe,He)|0,v=v+Math.imul(j,Te)|0,o=o+Math.imul(j,Ue)|0,o=o+Math.imul(re,Te)|0,m=m+Math.imul(re,Ue)|0,v=v+Math.imul(Z,Ee)|0,o=o+Math.imul(Z,Pe)|0,o=o+Math.imul(te,Ee)|0,m=m+Math.imul(te,Pe)|0,v=v+Math.imul(V,Ie)|0,o=o+Math.imul(V,Le)|0,o=o+Math.imul(T,Ie)|0,m=m+Math.imul(T,Le)|0,v=v+Math.imul(I,z)|0,o=o+Math.imul(I,N)|0,o=o+Math.imul(F,z)|0,m=m+Math.imul(F,N)|0;var st=(_+v|0)+((o&8191)<<13)|0;_=(m+(o>>>13)|0)+(st>>>26)|0,st&=67108863,v=Math.imul(_e,Ae),o=Math.imul(_e,Oe),o=o+Math.imul(xe,Ae)|0,m=Math.imul(xe,Oe),v=v+Math.imul(we,Re)|0,o=o+Math.imul(we,He)|0,o=o+Math.imul(le,Re)|0,m=m+Math.imul(le,He)|0,v=v+Math.imul(de,Te)|0,o=o+Math.imul(de,Ue)|0,o=o+Math.imul(pe,Te)|0,m=m+Math.imul(pe,Ue)|0,v=v+Math.imul(j,Ee)|0,o=o+Math.imul(j,Pe)|0,o=o+Math.imul(re,Ee)|0,m=m+Math.imul(re,Pe)|0,v=v+Math.imul(Z,Ie)|0,o=o+Math.imul(Z,Le)|0,o=o+Math.imul(te,Ie)|0,m=m+Math.imul(te,Le)|0,v=v+Math.imul(V,z)|0,o=o+Math.imul(V,N)|0,o=o+Math.imul(T,z)|0,m=m+Math.imul(T,N)|0,v=v+Math.imul(I,Q)|0,o=o+Math.imul(I,ne)|0,o=o+Math.imul(F,Q)|0,m=m+Math.imul(F,ne)|0;var ht=(_+v|0)+((o&8191)<<13)|0;_=(m+(o>>>13)|0)+(ht>>>26)|0,ht&=67108863,v=Math.imul(me,Ae),o=Math.imul(me,Oe),o=o+Math.imul(ke,Ae)|0,m=Math.imul(ke,Oe),v=v+Math.imul(_e,Re)|0,o=o+Math.imul(_e,He)|0,o=o+Math.imul(xe,Re)|0,m=m+Math.imul(xe,He)|0,v=v+Math.imul(we,Te)|0,o=o+Math.imul(we,Ue)|0,o=o+Math.imul(le,Te)|0,m=m+Math.imul(le,Ue)|0,v=v+Math.imul(de,Ee)|0,o=o+Math.imul(de,Pe)|0,o=o+Math.imul(pe,Ee)|0,m=m+Math.imul(pe,Pe)|0,v=v+Math.imul(j,Ie)|0,o=o+Math.imul(j,Le)|0,o=o+Math.imul(re,Ie)|0,m=m+Math.imul(re,Le)|0,v=v+Math.imul(Z,z)|0,o=o+Math.imul(Z,N)|0,o=o+Math.imul(te,z)|0,m=m+Math.imul(te,N)|0,v=v+Math.imul(V,Q)|0,o=o+Math.imul(V,ne)|0,o=o+Math.imul(T,Q)|0,m=m+Math.imul(T,ne)|0,v=v+Math.imul(I,he)|0,o=o+Math.imul(I,be)|0,o=o+Math.imul(F,he)|0,m=m+Math.imul(F,be)|0;var lt=(_+v|0)+((o&8191)<<13)|0;_=(m+(o>>>13)|0)+(lt>>>26)|0,lt&=67108863,v=Math.imul(Me,Ae),o=Math.imul(Me,Oe),o=o+Math.imul(Ne,Ae)|0,m=Math.imul(Ne,Oe),v=v+Math.imul(me,Re)|0,o=o+Math.imul(me,He)|0,o=o+Math.imul(ke,Re)|0,m=m+Math.imul(ke,He)|0,v=v+Math.imul(_e,Te)|0,o=o+Math.imul(_e,Ue)|0,o=o+Math.imul(xe,Te)|0,m=m+Math.imul(xe,Ue)|0,v=v+Math.imul(we,Ee)|0,o=o+Math.imul(we,Pe)|0,o=o+Math.imul(le,Ee)|0,m=m+Math.imul(le,Pe)|0,v=v+Math.imul(de,Ie)|0,o=o+Math.imul(de,Le)|0,o=o+Math.imul(pe,Ie)|0,m=m+Math.imul(pe,Le)|0,v=v+Math.imul(j,z)|0,o=o+Math.imul(j,N)|0,o=o+Math.imul(re,z)|0,m=m+Math.imul(re,N)|0,v=v+Math.imul(Z,Q)|0,o=o+Math.imul(Z,ne)|0,o=o+Math.imul(te,Q)|0,m=m+Math.imul(te,ne)|0,v=v+Math.imul(V,he)|0,o=o+Math.imul(V,be)|0,o=o+Math.imul(T,he)|0,m=m+Math.imul(T,be)|0,v=v+Math.imul(I,ye)|0,o=o+Math.imul(I,Se)|0,o=o+Math.imul(F,ye)|0,m=m+Math.imul(F,Se)|0;var ct=(_+v|0)+((o&8191)<<13)|0;_=(m+(o>>>13)|0)+(ct>>>26)|0,ct&=67108863,v=Math.imul(Be,Ae),o=Math.imul(Be,Oe),o=o+Math.imul(De,Ae)|0,m=Math.imul(De,Oe),v=v+Math.imul(Me,Re)|0,o=o+Math.imul(Me,He)|0,o=o+Math.imul(Ne,Re)|0,m=m+Math.imul(Ne,He)|0,v=v+Math.imul(me,Te)|0,o=o+Math.imul(me,Ue)|0,o=o+Math.imul(ke,Te)|0,m=m+Math.imul(ke,Ue)|0,v=v+Math.imul(_e,Ee)|0,o=o+Math.imul(_e,Pe)|0,o=o+Math.imul(xe,Ee)|0,m=m+Math.imul(xe,Pe)|0,v=v+Math.imul(we,Ie)|0,o=o+Math.imul(we,Le)|0,o=o+Math.imul(le,Ie)|0,m=m+Math.imul(le,Le)|0,v=v+Math.imul(de,z)|0,o=o+Math.imul(de,N)|0,o=o+Math.imul(pe,z)|0,m=m+Math.imul(pe,N)|0,v=v+Math.imul(j,Q)|0,o=o+Math.imul(j,ne)|0,o=o+Math.imul(re,Q)|0,m=m+Math.imul(re,ne)|0,v=v+Math.imul(Z,he)|0,o=o+Math.imul(Z,be)|0,o=o+Math.imul(te,he)|0,m=m+Math.imul(te,be)|0,v=v+Math.imul(V,ye)|0,o=o+Math.imul(V,Se)|0,o=o+Math.imul(T,ye)|0,m=m+Math.imul(T,Se)|0,v=v+Math.imul(I,Ce)|0,o=o+Math.imul(I,Fe)|0,o=o+Math.imul(F,Ce)|0,m=m+Math.imul(F,Fe)|0;var dt=(_+v|0)+((o&8191)<<13)|0;_=(m+(o>>>13)|0)+(dt>>>26)|0,dt&=67108863,v=Math.imul(Be,Re),o=Math.imul(Be,He),o=o+Math.imul(De,Re)|0,m=Math.imul(De,He),v=v+Math.imul(Me,Te)|0,o=o+Math.imul(Me,Ue)|0,o=o+Math.imul(Ne,Te)|0,m=m+Math.imul(Ne,Ue)|0,v=v+Math.imul(me,Ee)|0,o=o+Math.imul(me,Pe)|0,o=o+Math.imul(ke,Ee)|0,m=m+Math.imul(ke,Pe)|0,v=v+Math.imul(_e,Ie)|0,o=o+Math.imul(_e,Le)|0,o=o+Math.imul(xe,Ie)|0,m=m+Math.imul(xe,Le)|0,v=v+Math.imul(we,z)|0,o=o+Math.imul(we,N)|0,o=o+Math.imul(le,z)|0,m=m+Math.imul(le,N)|0,v=v+Math.imul(de,Q)|0,o=o+Math.imul(de,ne)|0,o=o+Math.imul(pe,Q)|0,m=m+Math.imul(pe,ne)|0,v=v+Math.imul(j,he)|0,o=o+Math.imul(j,be)|0,o=o+Math.imul(re,he)|0,m=m+Math.imul(re,be)|0,v=v+Math.imul(Z,ye)|0,o=o+Math.imul(Z,Se)|0,o=o+Math.imul(te,ye)|0,m=m+Math.imul(te,Se)|0,v=v+Math.imul(V,Ce)|0,o=o+Math.imul(V,Fe)|0,o=o+Math.imul(T,Ce)|0,m=m+Math.imul(T,Fe)|0;var pt=(_+v|0)+((o&8191)<<13)|0;_=(m+(o>>>13)|0)+(pt>>>26)|0,pt&=67108863,v=Math.imul(Be,Te),o=Math.imul(Be,Ue),o=o+Math.imul(De,Te)|0,m=Math.imul(De,Ue),v=v+Math.imul(Me,Ee)|0,o=o+Math.imul(Me,Pe)|0,o=o+Math.imul(Ne,Ee)|0,m=m+Math.imul(Ne,Pe)|0,v=v+Math.imul(me,Ie)|0,o=o+Math.imul(me,Le)|0,o=o+Math.imul(ke,Ie)|0,m=m+Math.imul(ke,Le)|0,v=v+Math.imul(_e,z)|0,o=o+Math.imul(_e,N)|0,o=o+Math.imul(xe,z)|0,m=m+Math.imul(xe,N)|0,v=v+Math.imul(we,Q)|0,o=o+Math.imul(we,ne)|0,o=o+Math.imul(le,Q)|0,m=m+Math.imul(le,ne)|0,v=v+Math.imul(de,he)|0,o=o+Math.imul(de,be)|0,o=o+Math.imul(pe,he)|0,m=m+Math.imul(pe,be)|0,v=v+Math.imul(j,ye)|0,o=o+Math.imul(j,Se)|0,o=o+Math.imul(re,ye)|0,m=m+Math.imul(re,Se)|0,v=v+Math.imul(Z,Ce)|0,o=o+Math.imul(Z,Fe)|0,o=o+Math.imul(te,Ce)|0,m=m+Math.imul(te,Fe)|0;var vt=(_+v|0)+((o&8191)<<13)|0;_=(m+(o>>>13)|0)+(vt>>>26)|0,vt&=67108863,v=Math.imul(Be,Ee),o=Math.imul(Be,Pe),o=o+Math.imul(De,Ee)|0,m=Math.imul(De,Pe),v=v+Math.imul(Me,Ie)|0,o=o+Math.imul(Me,Le)|0,o=o+Math.imul(Ne,Ie)|0,m=m+Math.imul(Ne,Le)|0,v=v+Math.imul(me,z)|0,o=o+Math.imul(me,N)|0,o=o+Math.imul(ke,z)|0,m=m+Math.imul(ke,N)|0,v=v+Math.imul(_e,Q)|0,o=o+Math.imul(_e,ne)|0,o=o+Math.imul(xe,Q)|0,m=m+Math.imul(xe,ne)|0,v=v+Math.imul(we,he)|0,o=o+Math.imul(we,be)|0,o=o+Math.imul(le,he)|0,m=m+Math.imul(le,be)|0,v=v+Math.imul(de,ye)|0,o=o+Math.imul(de,Se)|0,o=o+Math.imul(pe,ye)|0,m=m+Math.imul(pe,Se)|0,v=v+Math.imul(j,Ce)|0,o=o+Math.imul(j,Fe)|0,o=o+Math.imul(re,Ce)|0,m=m+Math.imul(re,Fe)|0;var yt=(_+v|0)+((o&8191)<<13)|0;_=(m+(o>>>13)|0)+(yt>>>26)|0,yt&=67108863,v=Math.imul(Be,Ie),o=Math.imul(Be,Le),o=o+Math.imul(De,Ie)|0,m=Math.imul(De,Le),v=v+Math.imul(Me,z)|0,o=o+Math.imul(Me,N)|0,o=o+Math.imul(Ne,z)|0,m=m+Math.imul(Ne,N)|0,v=v+Math.imul(me,Q)|0,o=o+Math.imul(me,ne)|0,o=o+Math.imul(ke,Q)|0,m=m+Math.imul(ke,ne)|0,v=v+Math.imul(_e,he)|0,o=o+Math.imul(_e,be)|0,o=o+Math.imul(xe,he)|0,m=m+Math.imul(xe,be)|0,v=v+Math.imul(we,ye)|0,o=o+Math.imul(we,Se)|0,o=o+Math.imul(le,ye)|0,m=m+Math.imul(le,Se)|0,v=v+Math.imul(de,Ce)|0,o=o+Math.imul(de,Fe)|0,o=o+Math.imul(pe,Ce)|0,m=m+Math.imul(pe,Fe)|0;var mt=(_+v|0)+((o&8191)<<13)|0;_=(m+(o>>>13)|0)+(mt>>>26)|0,mt&=67108863,v=Math.imul(Be,z),o=Math.imul(Be,N),o=o+Math.imul(De,z)|0,m=Math.imul(De,N),v=v+Math.imul(Me,Q)|0,o=o+Math.imul(Me,ne)|0,o=o+Math.imul(Ne,Q)|0,m=m+Math.imul(Ne,ne)|0,v=v+Math.imul(me,he)|0,o=o+Math.imul(me,be)|0,o=o+Math.imul(ke,he)|0,m=m+Math.imul(ke,be)|0,v=v+Math.imul(_e,ye)|0,o=o+Math.imul(_e,Se)|0,o=o+Math.imul(xe,ye)|0,m=m+Math.imul(xe,Se)|0,v=v+Math.imul(we,Ce)|0,o=o+Math.imul(we,Fe)|0,o=o+Math.imul(le,Ce)|0,m=m+Math.imul(le,Fe)|0;var gt=(_+v|0)+((o&8191)<<13)|0;_=(m+(o>>>13)|0)+(gt>>>26)|0,gt&=67108863,v=Math.imul(Be,Q),o=Math.imul(Be,ne),o=o+Math.imul(De,Q)|0,m=Math.imul(De,ne),v=v+Math.imul(Me,he)|0,o=o+Math.imul(Me,be)|0,o=o+Math.imul(Ne,he)|0,m=m+Math.imul(Ne,be)|0,v=v+Math.imul(me,ye)|0,o=o+Math.imul(me,Se)|0,o=o+Math.imul(ke,ye)|0,m=m+Math.imul(ke,Se)|0,v=v+Math.imul(_e,Ce)|0,o=o+Math.imul(_e,Fe)|0,o=o+Math.imul(xe,Ce)|0,m=m+Math.imul(xe,Fe)|0;var bt=(_+v|0)+((o&8191)<<13)|0;_=(m+(o>>>13)|0)+(bt>>>26)|0,bt&=67108863,v=Math.imul(Be,he),o=Math.imul(Be,be),o=o+Math.imul(De,he)|0,m=Math.imul(De,be),v=v+Math.imul(Me,ye)|0,o=o+Math.imul(Me,Se)|0,o=o+Math.imul(Ne,ye)|0,m=m+Math.imul(Ne,Se)|0,v=v+Math.imul(me,Ce)|0,o=o+Math.imul(me,Fe)|0,o=o+Math.imul(ke,Ce)|0,m=m+Math.imul(ke,Fe)|0;var wt=(_+v|0)+((o&8191)<<13)|0;_=(m+(o>>>13)|0)+(wt>>>26)|0,wt&=67108863,v=Math.imul(Be,ye),o=Math.imul(Be,Se),o=o+Math.imul(De,ye)|0,m=Math.imul(De,Se),v=v+Math.imul(Me,Ce)|0,o=o+Math.imul(Me,Fe)|0,o=o+Math.imul(Ne,Ce)|0,m=m+Math.imul(Ne,Fe)|0;var _t=(_+v|0)+((o&8191)<<13)|0;_=(m+(o>>>13)|0)+(_t>>>26)|0,_t&=67108863,v=Math.imul(Be,Ce),o=Math.imul(Be,Fe),o=o+Math.imul(De,Ce)|0,m=Math.imul(De,Fe);var xt=(_+v|0)+((o&8191)<<13)|0;return _=(m+(o>>>13)|0)+(xt>>>26)|0,xt&=67108863,b[0]=Xe,b[1]=Ye,b[2]=nt,b[3]=at,b[4]=ot,b[5]=st,b[6]=ht,b[7]=lt,b[8]=ct,b[9]=dt,b[10]=pt,b[11]=vt,b[12]=yt,b[13]=mt,b[14]=gt,b[15]=bt,b[16]=wt,b[17]=_t,b[18]=xt,_!==0&&(b[19]=_,c.length++),c};Math.imul||(O=q);function U($,n,l){l.negative=n.negative^$.negative,l.length=$.length+n.length;for(var c=0,p=0,y=0;y<l.length-1;y++){var b=p;p=0;for(var _=c&67108863,v=Math.min(y,n.length-1),o=Math.max(0,y-$.length+1);o<=v;o++){var m=y-o,A=$.words[m]|0,I=n.words[o]|0,F=A*I,X=F&67108863;b=b+(F/67108864|0)|0,X=X+_|0,_=X&67108863,b=b+(X>>>26)|0,p+=b>>>26,b&=67108863}l.words[y]=_,c=b,b=p}return c!==0?l.words[y]=c:l.length--,l.strip()}function P($,n,l){var c=new L;return c.mulp($,n,l)}h.prototype.mulTo=function(n,l){var c,p=this.length+n.length;return this.length===10&&n.length===10?c=O(this,n,l):p<63?c=q(this,n,l):p<1024?c=U(this,n,l):c=P(this,n,l),c};function L($,n){this.x=$,this.y=n}L.prototype.makeRBT=function(n){for(var l=new Array(n),c=h.prototype._countBits(n)-1,p=0;p<n;p++)l[p]=this.revBin(p,c,n);return l},L.prototype.revBin=function(n,l,c){if(n===0||n===c-1)return n;for(var p=0,y=0;y<l;y++)p|=(n&1)<<l-y-1,n>>=1;return p},L.prototype.permute=function(n,l,c,p,y,b){for(var _=0;_<b;_++)p[_]=l[n[_]],y[_]=c[n[_]]},L.prototype.transform=function(n,l,c,p,y,b){this.permute(b,n,l,c,p,y);for(var _=1;_<y;_<<=1)for(var v=_<<1,o=Math.cos(2*Math.PI/v),m=Math.sin(2*Math.PI/v),A=0;A<y;A+=v)for(var I=o,F=m,X=0;X<_;X++){var V=c[A+X],T=p[A+X],D=c[A+X+_],Z=p[A+X+_],te=I*D-F*Z;Z=I*Z+F*D,D=te,c[A+X]=V+D,p[A+X]=T+Z,c[A+X+_]=V-D,p[A+X+_]=T-Z,X!==v&&(te=o*I-m*F,F=o*F+m*I,I=te)}},L.prototype.guessLen13b=function(n,l){var c=Math.max(l,n)|1,p=c&1,y=0;for(c=c/2|0;c;c=c>>>1)y++;return 1<<y+1+p},L.prototype.conjugate=function(n,l,c){if(!(c<=1))for(var p=0;p<c/2;p++){var y=n[p];n[p]=n[c-p-1],n[c-p-1]=y,y=l[p],l[p]=-l[c-p-1],l[c-p-1]=-y}},L.prototype.normalize13b=function(n,l){for(var c=0,p=0;p<l/2;p++){var y=Math.round(n[2*p+1]/l)*8192+Math.round(n[2*p]/l)+c;n[p]=y&67108863,y<67108864?c=0:c=y/67108864|0}return n},L.prototype.convert13b=function(n,l,c,p){for(var y=0,b=0;b<l;b++)y=y+(n[b]|0),c[2*b]=y&8191,y=y>>>13,c[2*b+1]=y&8191,y=y>>>13;for(b=2*l;b<p;++b)c[b]=0;u(y===0),u((y&-8192)===0)},L.prototype.stub=function(n){for(var l=new Array(n),c=0;c<n;c++)l[c]=0;return l},L.prototype.mulp=function(n,l,c){var p=2*this.guessLen13b(n.length,l.length),y=this.makeRBT(p),b=this.stub(p),_=new Array(p),v=new Array(p),o=new Array(p),m=new Array(p),A=new Array(p),I=new Array(p),F=c.words;F.length=p,this.convert13b(n.words,n.length,_,p),this.convert13b(l.words,l.length,m,p),this.transform(_,b,v,o,p,y),this.transform(m,b,A,I,p,y);for(var X=0;X<p;X++){var V=v[X]*A[X]-o[X]*I[X];o[X]=v[X]*I[X]+o[X]*A[X],v[X]=V}return this.conjugate(v,o,p),this.transform(v,o,F,b,p,y),this.conjugate(F,b,p),this.normalize13b(F,p),c.negative=n.negative^l.negative,c.length=n.length+l.length,c.strip()},h.prototype.mul=function(n){var l=new h(null);return l.words=new Array(this.length+n.length),this.mulTo(n,l)},h.prototype.mulf=function(n){var l=new h(null);return l.words=new Array(this.length+n.length),P(this,n,l)},h.prototype.imul=function(n){return this.clone().mulTo(n,this)},h.prototype.imuln=function(n){u(typeof n=="number"),u(n<67108864);for(var l=0,c=0;c<this.length;c++){var p=(this.words[c]|0)*n,y=(p&67108863)+(l&67108863);l>>=26,l+=p/67108864|0,l+=y>>>26,this.words[c]=y&67108863}return l!==0&&(this.words[c]=l,this.length++),this.length=n===0?1:this.length,this},h.prototype.muln=function(n){return this.clone().imuln(n)},h.prototype.sqr=function(){return this.mul(this)},h.prototype.isqr=function(){return this.imul(this.clone())},h.prototype.pow=function(n){var l=C(n);if(l.length===0)return new h(1);for(var c=this,p=0;p<l.length&&l[p]===0;p++,c=c.sqr());if(++p<l.length)for(var y=c.sqr();p<l.length;p++,y=y.sqr())l[p]!==0&&(c=c.mul(y));return c},h.prototype.iushln=function(n){u(typeof n=="number"&&n>=0);var l=n%26,c=(n-l)/26,p=67108863>>>26-l<<26-l,y;if(l!==0){var b=0;for(y=0;y<this.length;y++){var _=this.words[y]&p,v=(this.words[y]|0)-_<<l;this.words[y]=v|b,b=_>>>26-l}b&&(this.words[y]=b,this.length++)}if(c!==0){for(y=this.length-1;y>=0;y--)this.words[y+c]=this.words[y];for(y=0;y<c;y++)this.words[y]=0;this.length+=c}return this.strip()},h.prototype.ishln=function(n){return u(this.negative===0),this.iushln(n)},h.prototype.iushrn=function(n,l,c){u(typeof n=="number"&&n>=0);var p;l?p=(l-l%26)/26:p=0;var y=n%26,b=Math.min((n-y)/26,this.length),_=67108863^67108863>>>y<<y,v=c;if(p-=b,p=Math.max(0,p),v){for(var o=0;o<b;o++)v.words[o]=this.words[o];v.length=b}if(b!==0)if(this.length>b)for(this.length-=b,o=0;o<this.length;o++)this.words[o]=this.words[o+b];else this.words[0]=0,this.length=1;var m=0;for(o=this.length-1;o>=0&&(m!==0||o>=p);o--){var A=this.words[o]|0;this.words[o]=m<<26-y|A>>>y,m=A&_}return v&&m!==0&&(v.words[v.length++]=m),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},h.prototype.ishrn=function(n,l,c){return u(this.negative===0),this.iushrn(n,l,c)},h.prototype.shln=function(n){return this.clone().ishln(n)},h.prototype.ushln=function(n){return this.clone().iushln(n)},h.prototype.shrn=function(n){return this.clone().ishrn(n)},h.prototype.ushrn=function(n){return this.clone().iushrn(n)},h.prototype.testn=function(n){u(typeof n=="number"&&n>=0);var l=n%26,c=(n-l)/26,p=1<<l;if(this.length<=c)return!1;var y=this.words[c];return!!(y&p)},h.prototype.imaskn=function(n){u(typeof n=="number"&&n>=0);var l=n%26,c=(n-l)/26;if(u(this.negative===0,"imaskn works only with positive numbers"),this.length<=c)return this;if(l!==0&&c++,this.length=Math.min(c,this.length),l!==0){var p=67108863^67108863>>>l<<l;this.words[this.length-1]&=p}return this.strip()},h.prototype.maskn=function(n){return this.clone().imaskn(n)},h.prototype.iaddn=function(n){return u(typeof n=="number"),u(n<67108864),n<0?this.isubn(-n):this.negative!==0?this.length===1&&(this.words[0]|0)<n?(this.words[0]=n-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(n),this.negative=1,this):this._iaddn(n)},h.prototype._iaddn=function(n){this.words[0]+=n;for(var l=0;l<this.length&&this.words[l]>=67108864;l++)this.words[l]-=67108864,l===this.length-1?this.words[l+1]=1:this.words[l+1]++;return this.length=Math.max(this.length,l+1),this},h.prototype.isubn=function(n){if(u(typeof n=="number"),u(n<67108864),n<0)return this.iaddn(-n);if(this.negative!==0)return this.negative=0,this.iaddn(n),this.negative=1,this;if(this.words[0]-=n,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var l=0;l<this.length&&this.words[l]<0;l++)this.words[l]+=67108864,this.words[l+1]-=1;return this.strip()},h.prototype.addn=function(n){return this.clone().iaddn(n)},h.prototype.subn=function(n){return this.clone().isubn(n)},h.prototype.iabs=function(){return this.negative=0,this},h.prototype.abs=function(){return this.clone().iabs()},h.prototype._ishlnsubmul=function(n,l,c){var p=n.length+c,y;this._expand(p);var b,_=0;for(y=0;y<n.length;y++){b=(this.words[y+c]|0)+_;var v=(n.words[y]|0)*l;b-=v&67108863,_=(b>>26)-(v/67108864|0),this.words[y+c]=b&67108863}for(;y<this.length-c;y++)b=(this.words[y+c]|0)+_,_=b>>26,this.words[y+c]=b&67108863;if(_===0)return this.strip();for(u(_===-1),_=0,y=0;y<this.length;y++)b=-(this.words[y]|0)+_,_=b>>26,this.words[y]=b&67108863;return this.negative=1,this.strip()},h.prototype._wordDiv=function(n,l){var c=this.length-n.length,p=this.clone(),y=n,b=y.words[y.length-1]|0,_=this._countBits(b);c=26-_,c!==0&&(y=y.ushln(c),p.iushln(c),b=y.words[y.length-1]|0);var v=p.length-y.length,o;if(l!=="mod"){o=new h(null),o.length=v+1,o.words=new Array(o.length);for(var m=0;m<o.length;m++)o.words[m]=0}var A=p.clone()._ishlnsubmul(y,1,v);A.negative===0&&(p=A,o&&(o.words[v]=1));for(var I=v-1;I>=0;I--){var F=(p.words[y.length+I]|0)*67108864+(p.words[y.length+I-1]|0);for(F=Math.min(F/b|0,67108863),p._ishlnsubmul(y,F,I);p.negative!==0;)F--,p.negative=0,p._ishlnsubmul(y,1,I),p.isZero()||(p.negative^=1);o&&(o.words[I]=F)}return o&&o.strip(),p.strip(),l!=="div"&&c!==0&&p.iushrn(c),{div:o||null,mod:p}},h.prototype.divmod=function(n,l,c){if(u(!n.isZero()),this.isZero())return{div:new h(0),mod:new h(0)};var p,y,b;return this.negative!==0&&n.negative===0?(b=this.neg().divmod(n,l),l!=="mod"&&(p=b.div.neg()),l!=="div"&&(y=b.mod.neg(),c&&y.negative!==0&&y.iadd(n)),{div:p,mod:y}):this.negative===0&&n.negative!==0?(b=this.divmod(n.neg(),l),l!=="mod"&&(p=b.div.neg()),{div:p,mod:b.mod}):this.negative&n.negative?(b=this.neg().divmod(n.neg(),l),l!=="div"&&(y=b.mod.neg(),c&&y.negative!==0&&y.isub(n)),{div:b.div,mod:y}):n.length>this.length||this.cmp(n)<0?{div:new h(0),mod:this}:n.length===1?l==="div"?{div:this.divn(n.words[0]),mod:null}:l==="mod"?{div:null,mod:new h(this.modn(n.words[0]))}:{div:this.divn(n.words[0]),mod:new h(this.modn(n.words[0]))}:this._wordDiv(n,l)},h.prototype.div=function(n){return this.divmod(n,"div",!1).div},h.prototype.mod=function(n){return this.divmod(n,"mod",!1).mod},h.prototype.umod=function(n){return this.divmod(n,"mod",!0).mod},h.prototype.divRound=function(n){var l=this.divmod(n);if(l.mod.isZero())return l.div;var c=l.div.negative!==0?l.mod.isub(n):l.mod,p=n.ushrn(1),y=n.andln(1),b=c.cmp(p);return b<0||y===1&&b===0?l.div:l.div.negative!==0?l.div.isubn(1):l.div.iaddn(1)},h.prototype.modn=function(n){u(n<=67108863);for(var l=(1<<26)%n,c=0,p=this.length-1;p>=0;p--)c=(l*c+(this.words[p]|0))%n;return c},h.prototype.idivn=function(n){u(n<=67108863);for(var l=0,c=this.length-1;c>=0;c--){var p=(this.words[c]|0)+l*67108864;this.words[c]=p/n|0,l=p%n}return this.strip()},h.prototype.divn=function(n){return this.clone().idivn(n)},h.prototype.egcd=function(n){u(n.negative===0),u(!n.isZero());var l=this,c=n.clone();l.negative!==0?l=l.umod(n):l=l.clone();for(var p=new h(1),y=new h(0),b=new h(0),_=new h(1),v=0;l.isEven()&&c.isEven();)l.iushrn(1),c.iushrn(1),++v;for(var o=c.clone(),m=l.clone();!l.isZero();){for(var A=0,I=1;!(l.words[0]&I)&&A<26;++A,I<<=1);if(A>0)for(l.iushrn(A);A-- >0;)(p.isOdd()||y.isOdd())&&(p.iadd(o),y.isub(m)),p.iushrn(1),y.iushrn(1);for(var F=0,X=1;!(c.words[0]&X)&&F<26;++F,X<<=1);if(F>0)for(c.iushrn(F);F-- >0;)(b.isOdd()||_.isOdd())&&(b.iadd(o),_.isub(m)),b.iushrn(1),_.iushrn(1);l.cmp(c)>=0?(l.isub(c),p.isub(b),y.isub(_)):(c.isub(l),b.isub(p),_.isub(y))}return{a:b,b:_,gcd:c.iushln(v)}},h.prototype._invmp=function(n){u(n.negative===0),u(!n.isZero());var l=this,c=n.clone();l.negative!==0?l=l.umod(n):l=l.clone();for(var p=new h(1),y=new h(0),b=c.clone();l.cmpn(1)>0&&c.cmpn(1)>0;){for(var _=0,v=1;!(l.words[0]&v)&&_<26;++_,v<<=1);if(_>0)for(l.iushrn(_);_-- >0;)p.isOdd()&&p.iadd(b),p.iushrn(1);for(var o=0,m=1;!(c.words[0]&m)&&o<26;++o,m<<=1);if(o>0)for(c.iushrn(o);o-- >0;)y.isOdd()&&y.iadd(b),y.iushrn(1);l.cmp(c)>=0?(l.isub(c),p.isub(y)):(c.isub(l),y.isub(p))}var A;return l.cmpn(1)===0?A=p:A=y,A.cmpn(0)<0&&A.iadd(n),A},h.prototype.gcd=function(n){if(this.isZero())return n.abs();if(n.isZero())return this.abs();var l=this.clone(),c=n.clone();l.negative=0,c.negative=0;for(var p=0;l.isEven()&&c.isEven();p++)l.iushrn(1),c.iushrn(1);do{for(;l.isEven();)l.iushrn(1);for(;c.isEven();)c.iushrn(1);var y=l.cmp(c);if(y<0){var b=l;l=c,c=b}else if(y===0||c.cmpn(1)===0)break;l.isub(c)}while(!0);return c.iushln(p)},h.prototype.invm=function(n){return this.egcd(n).a.umod(n)},h.prototype.isEven=function(){return(this.words[0]&1)===0},h.prototype.isOdd=function(){return(this.words[0]&1)===1},h.prototype.andln=function(n){return this.words[0]&n},h.prototype.bincn=function(n){u(typeof n=="number");var l=n%26,c=(n-l)/26,p=1<<l;if(this.length<=c)return this._expand(c+1),this.words[c]|=p,this;for(var y=p,b=c;y!==0&&b<this.length;b++){var _=this.words[b]|0;_+=y,y=_>>>26,_&=67108863,this.words[b]=_}return y!==0&&(this.words[b]=y,this.length++),this},h.prototype.isZero=function(){return this.length===1&&this.words[0]===0},h.prototype.cmpn=function(n){var l=n<0;if(this.negative!==0&&!l)return-1;if(this.negative===0&&l)return 1;this.strip();var c;if(this.length>1)c=1;else{l&&(n=-n),u(n<=67108863,"Number is too big");var p=this.words[0]|0;c=p===n?0:p<n?-1:1}return this.negative!==0?-c|0:c},h.prototype.cmp=function(n){if(this.negative!==0&&n.negative===0)return-1;if(this.negative===0&&n.negative!==0)return 1;var l=this.ucmp(n);return this.negative!==0?-l|0:l},h.prototype.ucmp=function(n){if(this.length>n.length)return 1;if(this.length<n.length)return-1;for(var l=0,c=this.length-1;c>=0;c--){var p=this.words[c]|0,y=n.words[c]|0;if(p!==y){p<y?l=-1:p>y&&(l=1);break}}return l},h.prototype.gtn=function(n){return this.cmpn(n)===1},h.prototype.gt=function(n){return this.cmp(n)===1},h.prototype.gten=function(n){return this.cmpn(n)>=0},h.prototype.gte=function(n){return this.cmp(n)>=0},h.prototype.ltn=function(n){return this.cmpn(n)===-1},h.prototype.lt=function(n){return this.cmp(n)===-1},h.prototype.lten=function(n){return this.cmpn(n)<=0},h.prototype.lte=function(n){return this.cmp(n)<=0},h.prototype.eqn=function(n){return this.cmpn(n)===0},h.prototype.eq=function(n){return this.cmp(n)===0},h.red=function(n){return new ie(n)},h.prototype.toRed=function(n){return u(!this.red,"Already a number in reduction context"),u(this.negative===0,"red works only with positives"),n.convertTo(this)._forceRed(n)},h.prototype.fromRed=function(){return u(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},h.prototype._forceRed=function(n){return this.red=n,this},h.prototype.forceRed=function(n){return u(!this.red,"Already a number in reduction context"),this._forceRed(n)},h.prototype.redAdd=function(n){return u(this.red,"redAdd works only with red numbers"),this.red.add(this,n)},h.prototype.redIAdd=function(n){return u(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,n)},h.prototype.redSub=function(n){return u(this.red,"redSub works only with red numbers"),this.red.sub(this,n)},h.prototype.redISub=function(n){return u(this.red,"redISub works only with red numbers"),this.red.isub(this,n)},h.prototype.redShl=function(n){return u(this.red,"redShl works only with red numbers"),this.red.shl(this,n)},h.prototype.redMul=function(n){return u(this.red,"redMul works only with red numbers"),this.red._verify2(this,n),this.red.mul(this,n)},h.prototype.redIMul=function(n){return u(this.red,"redMul works only with red numbers"),this.red._verify2(this,n),this.red.imul(this,n)},h.prototype.redSqr=function(){return u(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},h.prototype.redISqr=function(){return u(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},h.prototype.redSqrt=function(){return u(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},h.prototype.redInvm=function(){return u(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},h.prototype.redNeg=function(){return u(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},h.prototype.redPow=function(n){return u(this.red&&!n.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,n)};var J={k256:null,p224:null,p192:null,p25519:null};function Y($,n){this.name=$,this.p=new h(n,16),this.n=this.p.bitLength(),this.k=new h(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}Y.prototype._tmp=function(){var n=new h(null);return n.words=new Array(Math.ceil(this.n/13)),n},Y.prototype.ireduce=function(n){var l=n,c;do this.split(l,this.tmp),l=this.imulK(l),l=l.iadd(this.tmp),c=l.bitLength();while(c>this.n);var p=c<this.n?-1:l.ucmp(this.p);return p===0?(l.words[0]=0,l.length=1):p>0?l.isub(this.p):l.strip!==void 0?l.strip():l._strip(),l},Y.prototype.split=function(n,l){n.iushrn(this.n,0,l)},Y.prototype.imulK=function(n){return n.imul(this.k)};function ae(){Y.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}d(ae,Y),ae.prototype.split=function(n,l){for(var c=4194303,p=Math.min(n.length,9),y=0;y<p;y++)l.words[y]=n.words[y];if(l.length=p,n.length<=9){n.words[0]=0,n.length=1;return}var b=n.words[9];for(l.words[l.length++]=b&c,y=10;y<n.length;y++){var _=n.words[y]|0;n.words[y-10]=(_&c)<<4|b>>>22,b=_}b>>>=22,n.words[y-10]=b,b===0&&n.length>10?n.length-=10:n.length-=9},ae.prototype.imulK=function(n){n.words[n.length]=0,n.words[n.length+1]=0,n.length+=2;for(var l=0,c=0;c<n.length;c++){var p=n.words[c]|0;l+=p*977,n.words[c]=l&67108863,l=p*64+(l/67108864|0)}return n.words[n.length-1]===0&&(n.length--,n.words[n.length-1]===0&&n.length--),n};function oe(){Y.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}d(oe,Y);function ue(){Y.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}d(ue,Y);function se(){Y.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}d(se,Y),se.prototype.imulK=function(n){for(var l=0,c=0;c<n.length;c++){var p=(n.words[c]|0)*19+l,y=p&67108863;p>>>=26,n.words[c]=y,l=p}return l!==0&&(n.words[n.length++]=l),n},h._prime=function(n){if(J[n])return J[n];var l;if(n==="k256")l=new ae;else if(n==="p224")l=new oe;else if(n==="p192")l=new ue;else if(n==="p25519")l=new se;else throw new Error("Unknown prime "+n);return J[n]=l,l};function ie($){if(typeof $=="string"){var n=h._prime($);this.m=n.p,this.prime=n}else u($.gtn(1),"modulus must be greater than 1"),this.m=$,this.prime=null}ie.prototype._verify1=function(n){u(n.negative===0,"red works only with positives"),u(n.red,"red works only with red numbers")},ie.prototype._verify2=function(n,l){u((n.negative|l.negative)===0,"red works only with positives"),u(n.red&&n.red===l.red,"red works only with red numbers")},ie.prototype.imod=function(n){return this.prime?this.prime.ireduce(n)._forceRed(this):n.umod(this.m)._forceRed(this)},ie.prototype.neg=function(n){return n.isZero()?n.clone():this.m.sub(n)._forceRed(this)},ie.prototype.add=function(n,l){this._verify2(n,l);var c=n.add(l);return c.cmp(this.m)>=0&&c.isub(this.m),c._forceRed(this)},ie.prototype.iadd=function(n,l){this._verify2(n,l);var c=n.iadd(l);return c.cmp(this.m)>=0&&c.isub(this.m),c},ie.prototype.sub=function(n,l){this._verify2(n,l);var c=n.sub(l);return c.cmpn(0)<0&&c.iadd(this.m),c._forceRed(this)},ie.prototype.isub=function(n,l){this._verify2(n,l);var c=n.isub(l);return c.cmpn(0)<0&&c.iadd(this.m),c},ie.prototype.shl=function(n,l){return this._verify1(n),this.imod(n.ushln(l))},ie.prototype.imul=function(n,l){return this._verify2(n,l),this.imod(n.imul(l))},ie.prototype.mul=function(n,l){return this._verify2(n,l),this.imod(n.mul(l))},ie.prototype.isqr=function(n){return this.imul(n,n.clone())},ie.prototype.sqr=function(n){return this.mul(n,n)},ie.prototype.sqrt=function(n){if(n.isZero())return n.clone();var l=this.m.andln(3);if(u(l%2===1),l===3){var c=this.m.add(new h(1)).iushrn(2);return this.pow(n,c)}for(var p=this.m.subn(1),y=0;!p.isZero()&&p.andln(1)===0;)y++,p.iushrn(1);u(!p.isZero());var b=new h(1).toRed(this),_=b.redNeg(),v=this.m.subn(1).iushrn(1),o=this.m.bitLength();for(o=new h(2*o*o).toRed(this);this.pow(o,v).cmp(_)!==0;)o.redIAdd(_);for(var m=this.pow(o,p),A=this.pow(n,p.addn(1).iushrn(1)),I=this.pow(n,p),F=y;I.cmp(b)!==0;){for(var X=I,V=0;X.cmp(b)!==0;V++)X=X.redSqr();u(V<F);var T=this.pow(m,new h(1).iushln(F-V-1));A=A.redMul(T),m=T.redSqr(),I=I.redMul(m),F=V}return A},ie.prototype.invm=function(n){var l=n._invmp(this.m);return l.negative!==0?(l.negative=0,this.imod(l).redNeg()):this.imod(l)},ie.prototype.pow=function(n,l){if(l.isZero())return new h(1).toRed(this);if(l.cmpn(1)===0)return n.clone();var c=4,p=new Array(1<<c);p[0]=new h(1).toRed(this),p[1]=n;for(var y=2;y<p.length;y++)p[y]=this.mul(p[y-1],n);var b=p[0],_=0,v=0,o=l.bitLength()%26;for(o===0&&(o=26),y=l.length-1;y>=0;y--){for(var m=l.words[y],A=o-1;A>=0;A--){var I=m>>A&1;if(b!==p[0]&&(b=this.sqr(b)),I===0&&_===0){v=0;continue}_<<=1,_|=I,v++,!(v!==c&&(y!==0||A!==0))&&(b=this.mul(b,p[_]),v=0,_=0)}o=26}return b},ie.prototype.convertTo=function(n){var l=n.umod(this.m);return l===n?l.clone():l},ie.prototype.convertFrom=function(n){var l=n.clone();return l.red=null,l},h.mont=function(n){return new ce(n)};function ce($){ie.call(this,$),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new h(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}d(ce,ie),ce.prototype.convertTo=function(n){return this.imod(n.ushln(this.shift))},ce.prototype.convertFrom=function(n){var l=this.imod(n.mul(this.rinv));return l.red=null,l},ce.prototype.imul=function(n,l){if(n.isZero()||l.isZero())return n.words[0]=0,n.length=1,n;var c=n.imul(l),p=c.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),y=c.isub(p).iushrn(this.shift),b=y;return y.cmp(this.m)>=0?b=y.isub(this.m):y.cmpn(0)<0&&(b=y.iadd(this.m)),b._forceRed(this)},ce.prototype.mul=function(n,l){if(n.isZero()||l.isZero())return new h(0)._forceRed(this);var c=n.mul(l),p=c.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),y=c.isub(p).iushrn(this.shift),b=y;return y.cmp(this.m)>=0?b=y.isub(this.m):y.cmpn(0)<0&&(b=y.iadd(this.m)),b._forceRed(this)},ce.prototype.invm=function(n){var l=this.imod(n._invmp(this.m).mul(this.r2));return l._forceRed(this)}})(e,commonjsGlobal)})(bn);var bnExports=bn.exports,BN$2=bnExports,Buffer$3=safeBufferExports$2.Buffer;function withPublic$2(e,t){return Buffer$3.from(e.toRed(BN$2.mont(t.modulus)).redPow(new BN$2(t.publicExponent)).fromRed().toArray())}var withPublic_1=withPublic$2,parseKeys$1=parseAsn1,randomBytes$1=browserExports,createHash$1=browser$9,mgf$1=mgf$2,xor$1=xor$2,BN$1=bnExports,withPublic$1=withPublic_1,crt$1=browserifyRsa,Buffer$2=safeBufferExports$2.Buffer,publicEncrypt=function e(t,a,u){var d;t.padding?d=t.padding:u?d=1:d=4;var h=parseKeys$1(t),w;if(d===4)w=oaep$1(h,a);else if(d===1)w=pkcs1$1(h,a,u);else if(d===3){if(w=new BN$1(a),w.cmp(h.modulus)>=0)throw new Error("data too long for modulus")}else throw new Error("unknown padding");return u?crt$1(w,h):withPublic$1(w,h)};function oaep$1(e,t){var a=e.modulus.byteLength(),u=t.length,d=createHash$1("sha1").update(Buffer$2.alloc(0)).digest(),h=d.length,w=2*h;if(u>a-w-2)throw new Error("message too long");var x=Buffer$2.alloc(a-u-w-2),M=a-h-1,B=randomBytes$1(h),E=xor$1(Buffer$2.concat([d,x,Buffer$2.alloc(1,1),t],M),mgf$1(B,M)),S=xor$1(B,mgf$1(E,h));return new BN$1(Buffer$2.concat([Buffer$2.alloc(1),S,E],a))}function pkcs1$1(e,t,a){var u=t.length,d=e.modulus.byteLength();if(u>d-11)throw new Error("message too long");var h;return a?h=Buffer$2.alloc(d-u-3,255):h=nonZero(d-u-3),new BN$1(Buffer$2.concat([Buffer$2.from([0,a?1:2]),h,Buffer$2.alloc(1),t],d))}function nonZero(e){for(var t=Buffer$2.allocUnsafe(e),a=0,u=randomBytes$1(e*2),d=0,h;a<e;)d===u.length&&(u=randomBytes$1(e*2),d=0),h=u[d++],h&&(t[a++]=h);return t}var parseKeys=parseAsn1,mgf=mgf$2,xor=xor$2,BN=bnExports,crt=browserifyRsa,createHash=browser$9,withPublic=withPublic_1,Buffer$1=safeBufferExports$2.Buffer,privateDecrypt=function e(t,a,u){var d;t.padding?d=t.padding:u?d=1:d=4;var h=parseKeys(t),w=h.modulus.byteLength();if(a.length>w||new BN(a).cmp(h.modulus)>=0)throw new Error("decryption error");var x;u?x=withPublic(new BN(a),h):x=crt(a,h);var M=Buffer$1.alloc(w-x.length);if(x=Buffer$1.concat([M,x],w),d===4)return oaep(h,x);if(d===1)return pkcs1(h,x,u);if(d===3)return x;throw new Error("unknown padding")};function oaep(e,t){var a=e.modulus.byteLength(),u=createHash("sha1").update(Buffer$1.alloc(0)).digest(),d=u.length;if(t[0]!==0)throw new Error("decryption error");var h=t.slice(1,d+1),w=t.slice(d+1),x=xor(h,mgf(w,d)),M=xor(w,mgf(x,a-d-1));if(compare(u,M.slice(0,d)))throw new Error("decryption error");for(var B=d;M[B]===0;)B++;if(M[B++]!==1)throw new Error("decryption error");return M.slice(B)}function pkcs1(e,t,a){for(var u=t.slice(0,2),d=2,h=0;t[d++]!==0;)if(d>=t.length){h++;break}var w=t.slice(2,d-1);if((u.toString("hex")!=="0002"&&!a||u.toString("hex")!=="0001"&&a)&&h++,w.length<8&&h++,h)throw new Error("decryption error");return t.slice(d)}function compare(e,t){e=Buffer$1.from(e),t=Buffer$1.from(t);var a=0,u=e.length;e.length!==t.length&&(a++,u=Math.min(e.length,t.length));for(var d=-1;++d<u;)a+=e[d]^t[d];return a}(function(e){e.publicEncrypt=publicEncrypt,e.privateDecrypt=privateDecrypt,e.privateEncrypt=function(a,u){return e.publicEncrypt(a,u,!0)},e.publicDecrypt=function(a,u){return e.privateDecrypt(a,u,!0)}})(browser$1);var browser={};function oldBrowser(){throw new Error(`secure random number generation not supported by this browser
20
+ use chrome, FireFox or Internet Explorer 11`)}var safeBuffer=safeBufferExports$2,randombytes=browserExports,Buffer=safeBuffer.Buffer,kBufferMaxLength=safeBuffer.kMaxLength,crypto$1=commonjsGlobal.crypto||commonjsGlobal.msCrypto,kMaxUint32=Math.pow(2,32)-1;function assertOffset(e,t){if(typeof e!="number"||e!==e)throw new TypeError("offset must be a number");if(e>kMaxUint32||e<0)throw new TypeError("offset must be a uint32");if(e>kBufferMaxLength||e>t)throw new RangeError("offset out of range")}function assertSize(e,t,a){if(typeof e!="number"||e!==e)throw new TypeError("size must be a number");if(e>kMaxUint32||e<0)throw new TypeError("size must be a uint32");if(e+t>a||e>kBufferMaxLength)throw new RangeError("buffer too small")}crypto$1&&crypto$1.getRandomValues||!process$1.browser?(browser.randomFill=randomFill,browser.randomFillSync=randomFillSync):(browser.randomFill=oldBrowser,browser.randomFillSync=oldBrowser);function randomFill(e,t,a,u){if(!Buffer.isBuffer(e)&&!(e instanceof commonjsGlobal.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');if(typeof t=="function")u=t,t=0,a=e.length;else if(typeof a=="function")u=a,a=e.length-t;else if(typeof u!="function")throw new TypeError('"cb" argument must be a function');return assertOffset(t,e.length),assertSize(a,t,e.length),actualFill(e,t,a,u)}function actualFill(e,t,a,u){if(process$1.browser){var d=e.buffer,h=new Uint8Array(d,t,a);if(crypto$1.getRandomValues(h),u){process$1.nextTick(function(){u(null,e)});return}return e}if(u){randombytes(a,function(x,M){if(x)return u(x);M.copy(e,t),u(null,e)});return}var w=randombytes(a);return w.copy(e,t),e}function randomFillSync(e,t,a){if(typeof t>"u"&&(t=0),!Buffer.isBuffer(e)&&!(e instanceof commonjsGlobal.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');return assertOffset(t,e.length),a===void 0&&(a=e.length-t),assertSize(a,t,e.length),actualFill(e,t,a)}var hasRequiredCryptoBrowserify;function requireCryptoBrowserify(){if(hasRequiredCryptoBrowserify)return cryptoBrowserify;hasRequiredCryptoBrowserify=1,cryptoBrowserify.randomBytes=cryptoBrowserify.rng=cryptoBrowserify.pseudoRandomBytes=cryptoBrowserify.prng=browserExports,cryptoBrowserify.createHash=cryptoBrowserify.Hash=browser$9,cryptoBrowserify.createHmac=cryptoBrowserify.Hmac=browser$8;var e=algos,t=Object.keys(e),a=["sha1","sha224","sha256","sha384","sha512","md5","rmd160"].concat(t);cryptoBrowserify.getHashes=function(){return a};var u=browser$7;cryptoBrowserify.pbkdf2=u.pbkdf2,cryptoBrowserify.pbkdf2Sync=u.pbkdf2Sync;var d=browser$6;cryptoBrowserify.Cipher=d.Cipher,cryptoBrowserify.createCipher=d.createCipher,cryptoBrowserify.Cipheriv=d.Cipheriv,cryptoBrowserify.createCipheriv=d.createCipheriv,cryptoBrowserify.Decipher=d.Decipher,cryptoBrowserify.createDecipher=d.createDecipher,cryptoBrowserify.Decipheriv=d.Decipheriv,cryptoBrowserify.createDecipheriv=d.createDecipheriv,cryptoBrowserify.getCiphers=d.getCiphers,cryptoBrowserify.listCiphers=d.listCiphers;var h=requireBrowser$2();cryptoBrowserify.DiffieHellmanGroup=h.DiffieHellmanGroup,cryptoBrowserify.createDiffieHellmanGroup=h.createDiffieHellmanGroup,cryptoBrowserify.getDiffieHellman=h.getDiffieHellman,cryptoBrowserify.createDiffieHellman=h.createDiffieHellman,cryptoBrowserify.DiffieHellman=h.DiffieHellman;var w=requireBrowser$1();cryptoBrowserify.createSign=w.createSign,cryptoBrowserify.Sign=w.Sign,cryptoBrowserify.createVerify=w.createVerify,cryptoBrowserify.Verify=w.Verify,cryptoBrowserify.createECDH=requireBrowser();var x=browser$1;cryptoBrowserify.publicEncrypt=x.publicEncrypt,cryptoBrowserify.privateEncrypt=x.privateEncrypt,cryptoBrowserify.publicDecrypt=x.publicDecrypt,cryptoBrowserify.privateDecrypt=x.privateDecrypt;var M=browser;return cryptoBrowserify.randomFill=M.randomFill,cryptoBrowserify.randomFillSync=M.randomFillSync,cryptoBrowserify.createCredentials=function(){throw new Error(`sorry, createCredentials is not implemented yet
21
+ we accept pull requests
22
+ https://github.com/browserify/crypto-browserify`)},cryptoBrowserify.constants={DH_CHECK_P_NOT_SAFE_PRIME:2,DH_CHECK_P_NOT_PRIME:1,DH_UNABLE_TO_CHECK_GENERATOR:4,DH_NOT_SUITABLE_GENERATOR:8,NPN_ENABLED:1,ALPN_ENABLED:1,RSA_PKCS1_PADDING:1,RSA_SSLV23_PADDING:2,RSA_NO_PADDING:3,RSA_PKCS1_OAEP_PADDING:4,RSA_X931_PADDING:5,RSA_PKCS1_PSS_PADDING:6,POINT_CONVERSION_COMPRESSED:2,POINT_CONVERSION_UNCOMPRESSED:4,POINT_CONVERSION_HYBRID:6},cryptoBrowserify}var cryptoBrowserifyExports=requireCryptoBrowserify();const index=getDefaultExportFromCjs$1(cryptoBrowserifyExports),nc2=_mergeNamespaces({__proto__:null,default:index},[cryptoBrowserifyExports]);var __defProp=Object.defineProperty,__export=(e,t)=>{for(var a in t)__defProp(e,a,{get:t[a],enumerable:!0})};function number(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`Wrong positive integer: ${e}`)}function bytes(e,...t){if(!(e instanceof Uint8Array))throw new Error("Expected Uint8Array");if(t.length>0&&!t.includes(e.length))throw new Error(`Expected Uint8Array of length ${t}, not of length=${e.length}`)}function hash(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");number(e.outputLen),number(e.blockLen)}function exists(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function output(e,t){bytes(e);const a=t.outputLen;if(e.length<a)throw new Error(`digestInto() expects output buffer of length at least ${a}`)}var crypto=nc2&&typeof nc2=="object"&&"webcrypto"in nc2?cryptoBrowserifyExports.webcrypto:void 0,u8a=e=>e instanceof Uint8Array,createView=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),rotr=(e,t)=>e<<32-t|e>>>t,isLE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!isLE)throw new Error("Non little-endian hardware is not supported");function utf8ToBytes(e){if(typeof e!="string")throw new Error(`utf8ToBytes expected string, got ${typeof e}`);return new Uint8Array(new TextEncoder().encode(e))}function toBytes(e){if(typeof e=="string"&&(e=utf8ToBytes(e)),!u8a(e))throw new Error(`expected Uint8Array, got ${typeof e}`);return e}function concatBytes(...e){const t=new Uint8Array(e.reduce((u,d)=>u+d.length,0));let a=0;return e.forEach(u=>{if(!u8a(u))throw new Error("Uint8Array expected");t.set(u,a),a+=u.length}),t}var Hash=class{clone(){return this._cloneInto()}};function wrapConstructor(e){const t=u=>e().update(toBytes(u)).digest(),a=e();return t.outputLen=a.outputLen,t.blockLen=a.blockLen,t.create=()=>e(),t}function randomBytes(e=32){if(crypto&&typeof crypto.getRandomValues=="function")return crypto.getRandomValues(new Uint8Array(e));throw new Error("crypto.getRandomValues must be defined")}function setBigUint64(e,t,a,u){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,a,u);const d=BigInt(32),h=BigInt(4294967295),w=Number(a>>d&h),x=Number(a&h),M=u?4:0,B=u?0:4;e.setUint32(t+M,w,u),e.setUint32(t+B,x,u)}var SHA2=class extends Hash{constructor(e,t,a,u){super(),this.blockLen=e,this.outputLen=t,this.padOffset=a,this.isLE=u,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=createView(this.buffer)}update(e){exists(this);const{view:t,buffer:a,blockLen:u}=this;e=toBytes(e);const d=e.length;for(let h=0;h<d;){const w=Math.min(u-this.pos,d-h);if(w===u){const x=createView(e);for(;u<=d-h;h+=u)this.process(x,h);continue}a.set(e.subarray(h,h+w),this.pos),this.pos+=w,h+=w,this.pos===u&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){exists(this),output(e,this),this.finished=!0;const{buffer:t,view:a,blockLen:u,isLE:d}=this;let{pos:h}=this;t[h++]=128,this.buffer.subarray(h).fill(0),this.padOffset>u-h&&(this.process(a,0),h=0);for(let E=h;E<u;E++)t[E]=0;setBigUint64(a,u-8,BigInt(this.length*8),d),this.process(a,0);const w=createView(e),x=this.outputLen;if(x%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const M=x/4,B=this.get();if(M>B.length)throw new Error("_sha2: outputLen bigger than state");for(let E=0;E<M;E++)w.setUint32(4*E,B[E],d)}digest(){const{buffer:e,outputLen:t}=this;this.digestInto(e);const a=e.slice(0,t);return this.destroy(),a}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:t,buffer:a,length:u,finished:d,destroyed:h,pos:w}=this;return e.length=u,e.pos=w,e.finished=d,e.destroyed=h,u%t&&e.buffer.set(a),e}},Chi=(e,t,a)=>e&t^~e&a,Maj=(e,t,a)=>e&t^e&a^t&a,SHA256_K=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]),IV=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),SHA256_W=new Uint32Array(64),SHA256=class extends SHA2{constructor(){super(64,32,8,!1),this.A=IV[0]|0,this.B=IV[1]|0,this.C=IV[2]|0,this.D=IV[3]|0,this.E=IV[4]|0,this.F=IV[5]|0,this.G=IV[6]|0,this.H=IV[7]|0}get(){const{A:e,B:t,C:a,D:u,E:d,F:h,G:w,H:x}=this;return[e,t,a,u,d,h,w,x]}set(e,t,a,u,d,h,w,x){this.A=e|0,this.B=t|0,this.C=a|0,this.D=u|0,this.E=d|0,this.F=h|0,this.G=w|0,this.H=x|0}process(e,t){for(let E=0;E<16;E++,t+=4)SHA256_W[E]=e.getUint32(t,!1);for(let E=16;E<64;E++){const S=SHA256_W[E-15],k=SHA256_W[E-2],C=rotr(S,7)^rotr(S,18)^S>>>3,q=rotr(k,17)^rotr(k,19)^k>>>10;SHA256_W[E]=q+SHA256_W[E-7]+C+SHA256_W[E-16]|0}let{A:a,B:u,C:d,D:h,E:w,F:x,G:M,H:B}=this;for(let E=0;E<64;E++){const S=rotr(w,6)^rotr(w,11)^rotr(w,25),k=B+S+Chi(w,x,M)+SHA256_K[E]+SHA256_W[E]|0,q=(rotr(a,2)^rotr(a,13)^rotr(a,22))+Maj(a,u,d)|0;B=M,M=x,x=w,w=h+k|0,h=d,d=u,u=a,a=k+q|0}a=a+this.A|0,u=u+this.B|0,d=d+this.C|0,h=h+this.D|0,w=w+this.E|0,x=x+this.F|0,M=M+this.G|0,B=B+this.H|0,this.set(a,u,d,h,w,x,M,B)}roundClean(){SHA256_W.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}},sha256=wrapConstructor(()=>new SHA256),utils_exports={};__export(utils_exports,{bitGet:()=>bitGet,bitLen:()=>bitLen,bitMask:()=>bitMask,bitSet:()=>bitSet,bytesToHex:()=>bytesToHex,bytesToNumberBE:()=>bytesToNumberBE,bytesToNumberLE:()=>bytesToNumberLE,concatBytes:()=>concatBytes2,createHmacDrbg:()=>createHmacDrbg,ensureBytes:()=>ensureBytes,equalBytes:()=>equalBytes,hexToBytes:()=>hexToBytes,hexToNumber:()=>hexToNumber,numberToBytesBE:()=>numberToBytesBE,numberToBytesLE:()=>numberToBytesLE,numberToHexUnpadded:()=>numberToHexUnpadded,numberToVarBytesBE:()=>numberToVarBytesBE,utf8ToBytes:()=>utf8ToBytes2,validateObject:()=>validateObject});var _0n=BigInt(0),_1n=BigInt(1),_2n=BigInt(2),u8a2=e=>e instanceof Uint8Array,hexes=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function bytesToHex(e){if(!u8a2(e))throw new Error("Uint8Array expected");let t="";for(let a=0;a<e.length;a++)t+=hexes[e[a]];return t}function numberToHexUnpadded(e){const t=e.toString(16);return t.length&1?`0${t}`:t}function hexToNumber(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);return BigInt(e===""?"0":`0x${e}`)}function hexToBytes(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);const t=e.length;if(t%2)throw new Error("padded hex string expected, got unpadded hex of length "+t);const a=new Uint8Array(t/2);for(let u=0;u<a.length;u++){const d=u*2,h=e.slice(d,d+2),w=Number.parseInt(h,16);if(Number.isNaN(w)||w<0)throw new Error("Invalid byte sequence");a[u]=w}return a}function bytesToNumberBE(e){return hexToNumber(bytesToHex(e))}function bytesToNumberLE(e){if(!u8a2(e))throw new Error("Uint8Array expected");return hexToNumber(bytesToHex(Uint8Array.from(e).reverse()))}function numberToBytesBE(e,t){return hexToBytes(e.toString(16).padStart(t*2,"0"))}function numberToBytesLE(e,t){return numberToBytesBE(e,t).reverse()}function numberToVarBytesBE(e){return hexToBytes(numberToHexUnpadded(e))}function ensureBytes(e,t,a){let u;if(typeof t=="string")try{u=hexToBytes(t)}catch(h){throw new Error(`${e} must be valid hex string, got "${t}". Cause: ${h}`)}else if(u8a2(t))u=Uint8Array.from(t);else throw new Error(`${e} must be hex string or Uint8Array`);const d=u.length;if(typeof a=="number"&&d!==a)throw new Error(`${e} expected ${a} bytes, got ${d}`);return u}function concatBytes2(...e){const t=new Uint8Array(e.reduce((u,d)=>u+d.length,0));let a=0;return e.forEach(u=>{if(!u8a2(u))throw new Error("Uint8Array expected");t.set(u,a),a+=u.length}),t}function equalBytes(e,t){if(e.length!==t.length)return!1;for(let a=0;a<e.length;a++)if(e[a]!==t[a])return!1;return!0}function utf8ToBytes2(e){if(typeof e!="string")throw new Error(`utf8ToBytes expected string, got ${typeof e}`);return new Uint8Array(new TextEncoder().encode(e))}function bitLen(e){let t;for(t=0;e>_0n;e>>=_1n,t+=1);return t}function bitGet(e,t){return e>>BigInt(t)&_1n}var bitSet=(e,t,a)=>e|(a?_1n:_0n)<<BigInt(t),bitMask=e=>(_2n<<BigInt(e-1))-_1n,u8n=e=>new Uint8Array(e),u8fr=e=>Uint8Array.from(e);function createHmacDrbg(e,t,a){if(typeof e!="number"||e<2)throw new Error("hashLen must be a number");if(typeof t!="number"||t<2)throw new Error("qByteLen must be a number");if(typeof a!="function")throw new Error("hmacFn must be a function");let u=u8n(e),d=u8n(e),h=0;const w=()=>{u.fill(1),d.fill(0),h=0},x=(...S)=>a(d,u,...S),M=(S=u8n())=>{d=x(u8fr([0]),S),u=x(),S.length!==0&&(d=x(u8fr([1]),S),u=x())},B=()=>{if(h++>=1e3)throw new Error("drbg: tried 1000 values");let S=0;const k=[];for(;S<t;){u=x();const C=u.slice();k.push(C),S+=u.length}return concatBytes2(...k)};return(S,k)=>{w(),M(S);let C;for(;!(C=k(B()));)M();return w(),C}}var validatorFns={bigint:e=>typeof e=="bigint",function:e=>typeof e=="function",boolean:e=>typeof e=="boolean",string:e=>typeof e=="string",stringOrUint8Array:e=>typeof e=="string"||e instanceof Uint8Array,isSafeInteger:e=>Number.isSafeInteger(e),array:e=>Array.isArray(e),field:(e,t)=>t.Fp.isValid(e),hash:e=>typeof e=="function"&&Number.isSafeInteger(e.outputLen)};function validateObject(e,t,a={}){const u=(d,h,w)=>{const x=validatorFns[h];if(typeof x!="function")throw new Error(`Invalid validator "${h}", expected function`);const M=e[d];if(!(w&&M===void 0)&&!x(M,e))throw new Error(`Invalid param ${String(d)}=${M} (${typeof M}), expected ${h}`)};for(const[d,h]of Object.entries(t))u(d,h,!1);for(const[d,h]of Object.entries(a))u(d,h,!0);return e}var _0n2=BigInt(0),_1n2=BigInt(1),_2n2=BigInt(2),_3n=BigInt(3),_4n=BigInt(4),_5n=BigInt(5),_8n=BigInt(8);BigInt(9);BigInt(16);function mod(e,t){const a=e%t;return a>=_0n2?a:t+a}function pow(e,t,a){if(a<=_0n2||t<_0n2)throw new Error("Expected power/modulo > 0");if(a===_1n2)return _0n2;let u=_1n2;for(;t>_0n2;)t&_1n2&&(u=u*e%a),e=e*e%a,t>>=_1n2;return u}function pow2(e,t,a){let u=e;for(;t-- >_0n2;)u*=u,u%=a;return u}function invert(e,t){if(e===_0n2||t<=_0n2)throw new Error(`invert: expected positive integers, got n=${e} mod=${t}`);let a=mod(e,t),u=t,d=_0n2,h=_1n2;for(;a!==_0n2;){const x=u/a,M=u%a,B=d-h*x;u=a,a=M,d=h,h=B}if(u!==_1n2)throw new Error("invert: does not exist");return mod(d,t)}function tonelliShanks(e){const t=(e-_1n2)/_2n2;let a,u,d;for(a=e-_1n2,u=0;a%_2n2===_0n2;a/=_2n2,u++);for(d=_2n2;d<e&&pow(d,t,e)!==e-_1n2;d++);if(u===1){const w=(e+_1n2)/_4n;return function(M,B){const E=M.pow(B,w);if(!M.eql(M.sqr(E),B))throw new Error("Cannot find square root");return E}}const h=(a+_1n2)/_2n2;return function(x,M){if(x.pow(M,t)===x.neg(x.ONE))throw new Error("Cannot find square root");let B=u,E=x.pow(x.mul(x.ONE,d),a),S=x.pow(M,h),k=x.pow(M,a);for(;!x.eql(k,x.ONE);){if(x.eql(k,x.ZERO))return x.ZERO;let C=1;for(let O=x.sqr(k);C<B&&!x.eql(O,x.ONE);C++)O=x.sqr(O);const q=x.pow(E,_1n2<<BigInt(B-C-1));E=x.sqr(q),S=x.mul(S,q),k=x.mul(k,E),B=C}return S}}function FpSqrt(e){if(e%_4n===_3n){const t=(e+_1n2)/_4n;return function(u,d){const h=u.pow(d,t);if(!u.eql(u.sqr(h),d))throw new Error("Cannot find square root");return h}}if(e%_8n===_5n){const t=(e-_5n)/_8n;return function(u,d){const h=u.mul(d,_2n2),w=u.pow(h,t),x=u.mul(d,w),M=u.mul(u.mul(x,_2n2),w),B=u.mul(x,u.sub(M,u.ONE));if(!u.eql(u.sqr(B),d))throw new Error("Cannot find square root");return B}}return tonelliShanks(e)}var FIELD_FIELDS=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function validateField(e){const t={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},a=FIELD_FIELDS.reduce((u,d)=>(u[d]="function",u),t);return validateObject(e,a)}function FpPow(e,t,a){if(a<_0n2)throw new Error("Expected power > 0");if(a===_0n2)return e.ONE;if(a===_1n2)return t;let u=e.ONE,d=t;for(;a>_0n2;)a&_1n2&&(u=e.mul(u,d)),d=e.sqr(d),a>>=_1n2;return u}function FpInvertBatch(e,t){const a=new Array(t.length),u=t.reduce((h,w,x)=>e.is0(w)?h:(a[x]=h,e.mul(h,w)),e.ONE),d=e.inv(u);return t.reduceRight((h,w,x)=>e.is0(w)?h:(a[x]=e.mul(h,a[x]),e.mul(h,w)),d),a}function nLength(e,t){const a=t!==void 0?t:e.toString(2).length,u=Math.ceil(a/8);return{nBitLength:a,nByteLength:u}}function Field(e,t,a=!1,u={}){if(e<=_0n2)throw new Error(`Expected Field ORDER > 0, got ${e}`);const{nBitLength:d,nByteLength:h}=nLength(e,t);if(h>2048)throw new Error("Field lengths over 2048 bytes are not supported");const w=FpSqrt(e),x=Object.freeze({ORDER:e,BITS:d,BYTES:h,MASK:bitMask(d),ZERO:_0n2,ONE:_1n2,create:M=>mod(M,e),isValid:M=>{if(typeof M!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof M}`);return _0n2<=M&&M<e},is0:M=>M===_0n2,isOdd:M=>(M&_1n2)===_1n2,neg:M=>mod(-M,e),eql:(M,B)=>M===B,sqr:M=>mod(M*M,e),add:(M,B)=>mod(M+B,e),sub:(M,B)=>mod(M-B,e),mul:(M,B)=>mod(M*B,e),pow:(M,B)=>FpPow(x,M,B),div:(M,B)=>mod(M*invert(B,e),e),sqrN:M=>M*M,addN:(M,B)=>M+B,subN:(M,B)=>M-B,mulN:(M,B)=>M*B,inv:M=>invert(M,e),sqrt:u.sqrt||(M=>w(x,M)),invertBatch:M=>FpInvertBatch(x,M),cmov:(M,B,E)=>E?B:M,toBytes:M=>a?numberToBytesLE(M,h):numberToBytesBE(M,h),fromBytes:M=>{if(M.length!==h)throw new Error(`Fp.fromBytes: expected ${h}, got ${M.length}`);return a?bytesToNumberLE(M):bytesToNumberBE(M)}});return Object.freeze(x)}function getFieldBytesLength(e){if(typeof e!="bigint")throw new Error("field order must be bigint");const t=e.toString(2).length;return Math.ceil(t/8)}function getMinHashLength(e){const t=getFieldBytesLength(e);return t+Math.ceil(t/2)}function mapHashToField(e,t,a=!1){const u=e.length,d=getFieldBytesLength(t),h=getMinHashLength(t);if(u<16||u<h||u>1024)throw new Error(`expected ${h}-1024 bytes of input, got ${u}`);const w=a?bytesToNumberBE(e):bytesToNumberLE(e),x=mod(w,t-_1n2)+_1n2;return a?numberToBytesLE(x,d):numberToBytesBE(x,d)}var _0n3=BigInt(0),_1n3=BigInt(1);function wNAF(e,t){const a=(d,h)=>{const w=h.negate();return d?w:h},u=d=>{const h=Math.ceil(t/d)+1,w=2**(d-1);return{windows:h,windowSize:w}};return{constTimeNegate:a,unsafeLadder(d,h){let w=e.ZERO,x=d;for(;h>_0n3;)h&_1n3&&(w=w.add(x)),x=x.double(),h>>=_1n3;return w},precomputeWindow(d,h){const{windows:w,windowSize:x}=u(h),M=[];let B=d,E=B;for(let S=0;S<w;S++){E=B,M.push(E);for(let k=1;k<x;k++)E=E.add(B),M.push(E);B=E.double()}return M},wNAF(d,h,w){const{windows:x,windowSize:M}=u(d);let B=e.ZERO,E=e.BASE;const S=BigInt(2**d-1),k=2**d,C=BigInt(d);for(let q=0;q<x;q++){const O=q*M;let U=Number(w&S);w>>=C,U>M&&(U-=k,w+=_1n3);const P=O,L=O+Math.abs(U)-1,J=q%2!==0,Y=U<0;U===0?E=E.add(a(J,h[P])):B=B.add(a(Y,h[L]))}return{p:B,f:E}},wNAFCached(d,h,w,x){const M=d._WINDOW_SIZE||1;let B=h.get(d);return B||(B=this.precomputeWindow(d,M),M!==1&&h.set(d,x(B))),this.wNAF(M,B,w)}}}function validateBasic(e){return validateField(e.Fp),validateObject(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...nLength(e.n,e.nBitLength),...e,p:e.Fp.ORDER})}function validatePointOpts(e){const t=validateBasic(e);validateObject(t,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:a,Fp:u,a:d}=t;if(a){if(!u.eql(d,u.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if(typeof a!="object"||typeof a.beta!="bigint"||typeof a.splitScalar!="function")throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...t})}var{bytesToNumberBE:b2n,hexToBytes:h2b}=utils_exports,DER={Err:class extends Error{constructor(t=""){super(t)}},_parseInt(e){const{Err:t}=DER;if(e.length<2||e[0]!==2)throw new t("Invalid signature integer tag");const a=e[1],u=e.subarray(2,a+2);if(!a||u.length!==a)throw new t("Invalid signature integer: wrong length");if(u[0]&128)throw new t("Invalid signature integer: negative");if(u[0]===0&&!(u[1]&128))throw new t("Invalid signature integer: unnecessary leading zero");return{d:b2n(u),l:e.subarray(a+2)}},toSig(e){const{Err:t}=DER,a=typeof e=="string"?h2b(e):e;if(!(a instanceof Uint8Array))throw new Error("ui8a expected");let u=a.length;if(u<2||a[0]!=48)throw new t("Invalid signature tag");if(a[1]!==u-2)throw new t("Invalid signature: incorrect length");const{d,l:h}=DER._parseInt(a.subarray(2)),{d:w,l:x}=DER._parseInt(h);if(x.length)throw new t("Invalid signature: left bytes after parsing");return{r:d,s:w}},hexFromSig(e){const t=B=>Number.parseInt(B[0],16)&8?"00"+B:B,a=B=>{const E=B.toString(16);return E.length&1?`0${E}`:E},u=t(a(e.s)),d=t(a(e.r)),h=u.length/2,w=d.length/2,x=a(h),M=a(w);return`30${a(w+h+4)}02${M}${d}02${x}${u}`}},_0n4=BigInt(0),_1n4=BigInt(1);BigInt(2);var _3n2=BigInt(3);BigInt(4);function weierstrassPoints(e){const t=validatePointOpts(e),{Fp:a}=t,u=t.toBytes||((q,O,U)=>{const P=O.toAffine();return concatBytes2(Uint8Array.from([4]),a.toBytes(P.x),a.toBytes(P.y))}),d=t.fromBytes||(q=>{const O=q.subarray(1),U=a.fromBytes(O.subarray(0,a.BYTES)),P=a.fromBytes(O.subarray(a.BYTES,2*a.BYTES));return{x:U,y:P}});function h(q){const{a:O,b:U}=t,P=a.sqr(q),L=a.mul(P,q);return a.add(a.add(L,a.mul(q,O)),U)}if(!a.eql(a.sqr(t.Gy),h(t.Gx)))throw new Error("bad generator point: equation left != right");function w(q){return typeof q=="bigint"&&_0n4<q&&q<t.n}function x(q){if(!w(q))throw new Error("Expected valid bigint: 0 < bigint < curve.n")}function M(q){const{allowedPrivateKeyLengths:O,nByteLength:U,wrapPrivateKey:P,n:L}=t;if(O&&typeof q!="bigint"){if(q instanceof Uint8Array&&(q=bytesToHex(q)),typeof q!="string"||!O.includes(q.length))throw new Error("Invalid key");q=q.padStart(U*2,"0")}let J;try{J=typeof q=="bigint"?q:bytesToNumberBE(ensureBytes("private key",q,U))}catch{throw new Error(`private key must be ${U} bytes, hex or bigint, not ${typeof q}`)}return P&&(J=mod(J,L)),x(J),J}const B=new Map;function E(q){if(!(q instanceof S))throw new Error("ProjectivePoint expected")}class S{constructor(O,U,P){if(this.px=O,this.py=U,this.pz=P,O==null||!a.isValid(O))throw new Error("x required");if(U==null||!a.isValid(U))throw new Error("y required");if(P==null||!a.isValid(P))throw new Error("z required")}static fromAffine(O){const{x:U,y:P}=O||{};if(!O||!a.isValid(U)||!a.isValid(P))throw new Error("invalid affine point");if(O instanceof S)throw new Error("projective point not allowed");const L=J=>a.eql(J,a.ZERO);return L(U)&&L(P)?S.ZERO:new S(U,P,a.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(O){const U=a.invertBatch(O.map(P=>P.pz));return O.map((P,L)=>P.toAffine(U[L])).map(S.fromAffine)}static fromHex(O){const U=S.fromAffine(d(ensureBytes("pointHex",O)));return U.assertValidity(),U}static fromPrivateKey(O){return S.BASE.multiply(M(O))}_setWindowSize(O){this._WINDOW_SIZE=O,B.delete(this)}assertValidity(){if(this.is0()){if(t.allowInfinityPoint&&!a.is0(this.py))return;throw new Error("bad point: ZERO")}const{x:O,y:U}=this.toAffine();if(!a.isValid(O)||!a.isValid(U))throw new Error("bad point: x or y not FE");const P=a.sqr(U),L=h(O);if(!a.eql(P,L))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:O}=this.toAffine();if(a.isOdd)return!a.isOdd(O);throw new Error("Field doesn't support isOdd")}equals(O){E(O);const{px:U,py:P,pz:L}=this,{px:J,py:Y,pz:ae}=O,oe=a.eql(a.mul(U,ae),a.mul(J,L)),ue=a.eql(a.mul(P,ae),a.mul(Y,L));return oe&&ue}negate(){return new S(this.px,a.neg(this.py),this.pz)}double(){const{a:O,b:U}=t,P=a.mul(U,_3n2),{px:L,py:J,pz:Y}=this;let ae=a.ZERO,oe=a.ZERO,ue=a.ZERO,se=a.mul(L,L),ie=a.mul(J,J),ce=a.mul(Y,Y),$=a.mul(L,J);return $=a.add($,$),ue=a.mul(L,Y),ue=a.add(ue,ue),ae=a.mul(O,ue),oe=a.mul(P,ce),oe=a.add(ae,oe),ae=a.sub(ie,oe),oe=a.add(ie,oe),oe=a.mul(ae,oe),ae=a.mul($,ae),ue=a.mul(P,ue),ce=a.mul(O,ce),$=a.sub(se,ce),$=a.mul(O,$),$=a.add($,ue),ue=a.add(se,se),se=a.add(ue,se),se=a.add(se,ce),se=a.mul(se,$),oe=a.add(oe,se),ce=a.mul(J,Y),ce=a.add(ce,ce),se=a.mul(ce,$),ae=a.sub(ae,se),ue=a.mul(ce,ie),ue=a.add(ue,ue),ue=a.add(ue,ue),new S(ae,oe,ue)}add(O){E(O);const{px:U,py:P,pz:L}=this,{px:J,py:Y,pz:ae}=O;let oe=a.ZERO,ue=a.ZERO,se=a.ZERO;const ie=t.a,ce=a.mul(t.b,_3n2);let $=a.mul(U,J),n=a.mul(P,Y),l=a.mul(L,ae),c=a.add(U,P),p=a.add(J,Y);c=a.mul(c,p),p=a.add($,n),c=a.sub(c,p),p=a.add(U,L);let y=a.add(J,ae);return p=a.mul(p,y),y=a.add($,l),p=a.sub(p,y),y=a.add(P,L),oe=a.add(Y,ae),y=a.mul(y,oe),oe=a.add(n,l),y=a.sub(y,oe),se=a.mul(ie,p),oe=a.mul(ce,l),se=a.add(oe,se),oe=a.sub(n,se),se=a.add(n,se),ue=a.mul(oe,se),n=a.add($,$),n=a.add(n,$),l=a.mul(ie,l),p=a.mul(ce,p),n=a.add(n,l),l=a.sub($,l),l=a.mul(ie,l),p=a.add(p,l),$=a.mul(n,p),ue=a.add(ue,$),$=a.mul(y,p),oe=a.mul(c,oe),oe=a.sub(oe,$),$=a.mul(c,n),se=a.mul(y,se),se=a.add(se,$),new S(oe,ue,se)}subtract(O){return this.add(O.negate())}is0(){return this.equals(S.ZERO)}wNAF(O){return C.wNAFCached(this,B,O,U=>{const P=a.invertBatch(U.map(L=>L.pz));return U.map((L,J)=>L.toAffine(P[J])).map(S.fromAffine)})}multiplyUnsafe(O){const U=S.ZERO;if(O===_0n4)return U;if(x(O),O===_1n4)return this;const{endo:P}=t;if(!P)return C.unsafeLadder(this,O);let{k1neg:L,k1:J,k2neg:Y,k2:ae}=P.splitScalar(O),oe=U,ue=U,se=this;for(;J>_0n4||ae>_0n4;)J&_1n4&&(oe=oe.add(se)),ae&_1n4&&(ue=ue.add(se)),se=se.double(),J>>=_1n4,ae>>=_1n4;return L&&(oe=oe.negate()),Y&&(ue=ue.negate()),ue=new S(a.mul(ue.px,P.beta),ue.py,ue.pz),oe.add(ue)}multiply(O){x(O);let U=O,P,L;const{endo:J}=t;if(J){const{k1neg:Y,k1:ae,k2neg:oe,k2:ue}=J.splitScalar(U);let{p:se,f:ie}=this.wNAF(ae),{p:ce,f:$}=this.wNAF(ue);se=C.constTimeNegate(Y,se),ce=C.constTimeNegate(oe,ce),ce=new S(a.mul(ce.px,J.beta),ce.py,ce.pz),P=se.add(ce),L=ie.add($)}else{const{p:Y,f:ae}=this.wNAF(U);P=Y,L=ae}return S.normalizeZ([P,L])[0]}multiplyAndAddUnsafe(O,U,P){const L=S.BASE,J=(ae,oe)=>oe===_0n4||oe===_1n4||!ae.equals(L)?ae.multiplyUnsafe(oe):ae.multiply(oe),Y=J(this,U).add(J(O,P));return Y.is0()?void 0:Y}toAffine(O){const{px:U,py:P,pz:L}=this,J=this.is0();O==null&&(O=J?a.ONE:a.inv(L));const Y=a.mul(U,O),ae=a.mul(P,O),oe=a.mul(L,O);if(J)return{x:a.ZERO,y:a.ZERO};if(!a.eql(oe,a.ONE))throw new Error("invZ was invalid");return{x:Y,y:ae}}isTorsionFree(){const{h:O,isTorsionFree:U}=t;if(O===_1n4)return!0;if(U)return U(S,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:O,clearCofactor:U}=t;return O===_1n4?this:U?U(S,this):this.multiplyUnsafe(t.h)}toRawBytes(O=!0){return this.assertValidity(),u(S,this,O)}toHex(O=!0){return bytesToHex(this.toRawBytes(O))}}S.BASE=new S(t.Gx,t.Gy,a.ONE),S.ZERO=new S(a.ZERO,a.ONE,a.ZERO);const k=t.nBitLength,C=wNAF(S,t.endo?Math.ceil(k/2):k);return{CURVE:t,ProjectivePoint:S,normPrivateKeyToScalar:M,weierstrassEquation:h,isWithinCurveOrder:w}}function validateOpts(e){const t=validateBasic(e);return validateObject(t,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...t})}function weierstrass(e){const t=validateOpts(e),{Fp:a,n:u}=t,d=a.BYTES+1,h=2*a.BYTES+1;function w(p){return _0n4<p&&p<a.ORDER}function x(p){return mod(p,u)}function M(p){return invert(p,u)}const{ProjectivePoint:B,normPrivateKeyToScalar:E,weierstrassEquation:S,isWithinCurveOrder:k}=weierstrassPoints({...t,toBytes(p,y,b){const _=y.toAffine(),v=a.toBytes(_.x),o=concatBytes2;return b?o(Uint8Array.from([y.hasEvenY()?2:3]),v):o(Uint8Array.from([4]),v,a.toBytes(_.y))},fromBytes(p){const y=p.length,b=p[0],_=p.subarray(1);if(y===d&&(b===2||b===3)){const v=bytesToNumberBE(_);if(!w(v))throw new Error("Point is not on curve");const o=S(v);let m=a.sqrt(o);const A=(m&_1n4)===_1n4;return(b&1)===1!==A&&(m=a.neg(m)),{x:v,y:m}}else if(y===h&&b===4){const v=a.fromBytes(_.subarray(0,a.BYTES)),o=a.fromBytes(_.subarray(a.BYTES,2*a.BYTES));return{x:v,y:o}}else throw new Error(`Point of length ${y} was invalid. Expected ${d} compressed bytes or ${h} uncompressed bytes`)}}),C=p=>bytesToHex(numberToBytesBE(p,t.nByteLength));function q(p){const y=u>>_1n4;return p>y}function O(p){return q(p)?x(-p):p}const U=(p,y,b)=>bytesToNumberBE(p.slice(y,b));class P{constructor(y,b,_){this.r=y,this.s=b,this.recovery=_,this.assertValidity()}static fromCompact(y){const b=t.nByteLength;return y=ensureBytes("compactSignature",y,b*2),new P(U(y,0,b),U(y,b,2*b))}static fromDER(y){const{r:b,s:_}=DER.toSig(ensureBytes("DER",y));return new P(b,_)}assertValidity(){if(!k(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!k(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(y){return new P(this.r,this.s,y)}recoverPublicKey(y){const{r:b,s:_,recovery:v}=this,o=ue(ensureBytes("msgHash",y));if(v==null||![0,1,2,3].includes(v))throw new Error("recovery id invalid");const m=v===2||v===3?b+t.n:b;if(m>=a.ORDER)throw new Error("recovery id 2 or 3 invalid");const A=v&1?"03":"02",I=B.fromHex(A+C(m)),F=M(m),X=x(-o*F),V=x(_*F),T=B.BASE.multiplyAndAddUnsafe(I,X,V);if(!T)throw new Error("point at infinify");return T.assertValidity(),T}hasHighS(){return q(this.s)}normalizeS(){return this.hasHighS()?new P(this.r,x(-this.s),this.recovery):this}toDERRawBytes(){return hexToBytes(this.toDERHex())}toDERHex(){return DER.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return hexToBytes(this.toCompactHex())}toCompactHex(){return C(this.r)+C(this.s)}}const L={isValidPrivateKey(p){try{return E(p),!0}catch{return!1}},normPrivateKeyToScalar:E,randomPrivateKey:()=>{const p=getMinHashLength(t.n);return mapHashToField(t.randomBytes(p),t.n)},precompute(p=8,y=B.BASE){return y._setWindowSize(p),y.multiply(BigInt(3)),y}};function J(p,y=!0){return B.fromPrivateKey(p).toRawBytes(y)}function Y(p){const y=p instanceof Uint8Array,b=typeof p=="string",_=(y||b)&&p.length;return y?_===d||_===h:b?_===2*d||_===2*h:p instanceof B}function ae(p,y,b=!0){if(Y(p))throw new Error("first arg must be private key");if(!Y(y))throw new Error("second arg must be public key");return B.fromHex(y).multiply(E(p)).toRawBytes(b)}const oe=t.bits2int||function(p){const y=bytesToNumberBE(p),b=p.length*8-t.nBitLength;return b>0?y>>BigInt(b):y},ue=t.bits2int_modN||function(p){return x(oe(p))},se=bitMask(t.nBitLength);function ie(p){if(typeof p!="bigint")throw new Error("bigint expected");if(!(_0n4<=p&&p<se))throw new Error(`bigint expected < 2^${t.nBitLength}`);return numberToBytesBE(p,t.nByteLength)}function ce(p,y,b=$){if(["recovered","canonical"].some(Z=>Z in b))throw new Error("sign() legacy options not supported");const{hash:_,randomBytes:v}=t;let{lowS:o,prehash:m,extraEntropy:A}=b;o==null&&(o=!0),p=ensureBytes("msgHash",p),m&&(p=ensureBytes("prehashed msgHash",_(p)));const I=ue(p),F=E(y),X=[ie(F),ie(I)];if(A!=null){const Z=A===!0?v(a.BYTES):A;X.push(ensureBytes("extraEntropy",Z))}const V=concatBytes2(...X),T=I;function D(Z){const te=oe(Z);if(!k(te))return;const ee=M(te),j=B.BASE.multiply(te).toAffine(),re=x(j.x);if(re===_0n4)return;const qe=x(ee*x(T+re*F));if(qe===_0n4)return;let de=(j.x===re?0:2)|Number(j.y&_1n4),pe=qe;return o&&q(qe)&&(pe=O(qe),de^=1),new P(re,pe,de)}return{seed:V,k2sig:D}}const $={lowS:t.lowS,prehash:!1},n={lowS:t.lowS,prehash:!1};function l(p,y,b=$){const{seed:_,k2sig:v}=ce(p,y,b),o=t;return createHmacDrbg(o.hash.outputLen,o.nByteLength,o.hmac)(_,v)}B.BASE._setWindowSize(8);function c(p,y,b,_=n){var j;const v=p;if(y=ensureBytes("msgHash",y),b=ensureBytes("publicKey",b),"strict"in _)throw new Error("options.strict was renamed to lowS");const{lowS:o,prehash:m}=_;let A,I;try{if(typeof v=="string"||v instanceof Uint8Array)try{A=P.fromDER(v)}catch(re){if(!(re instanceof DER.Err))throw re;A=P.fromCompact(v)}else if(typeof v=="object"&&typeof v.r=="bigint"&&typeof v.s=="bigint"){const{r:re,s:qe}=v;A=new P(re,qe)}else throw new Error("PARSE");I=B.fromHex(b)}catch(re){if(re.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(o&&A.hasHighS())return!1;m&&(y=t.hash(y));const{r:F,s:X}=A,V=ue(y),T=M(X),D=x(V*T),Z=x(F*T),te=(j=B.BASE.multiplyAndAddUnsafe(I,D,Z))==null?void 0:j.toAffine();return te?x(te.x)===F:!1}return{CURVE:t,getPublicKey:J,getSharedSecret:ae,sign:l,verify:c,ProjectivePoint:B,Signature:P,utils:L}}var HMAC=class extends Hash{constructor(e,t){super(),this.finished=!1,this.destroyed=!1,hash(e);const a=toBytes(t);if(this.iHash=e.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const u=this.blockLen,d=new Uint8Array(u);d.set(a.length>u?e.create().update(a).digest():a);for(let h=0;h<d.length;h++)d[h]^=54;this.iHash.update(d),this.oHash=e.create();for(let h=0;h<d.length;h++)d[h]^=106;this.oHash.update(d),d.fill(0)}update(e){return exists(this),this.iHash.update(e),this}digestInto(e){exists(this),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:t,iHash:a,finished:u,destroyed:d,blockLen:h,outputLen:w}=this;return e=e,e.finished=u,e.destroyed=d,e.blockLen=h,e.outputLen=w,e.oHash=t._cloneInto(e.oHash),e.iHash=a._cloneInto(e.iHash),e}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}},hmac=(e,t,a)=>new HMAC(e,t).update(a).digest();hmac.create=(e,t)=>new HMAC(e,t);function getHash(e){return{hash:e,hmac:(t,...a)=>hmac(e,t,concatBytes(...a)),randomBytes}}function createCurve(e,t){const a=u=>weierstrass({...e,...getHash(u)});return Object.freeze({...a(t),create:a})}var secp256k1P=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),secp256k1N=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),_1n5=BigInt(1),_2n4=BigInt(2),divNearest=(e,t)=>(e+t/_2n4)/t;function sqrtMod(e){const t=secp256k1P,a=BigInt(3),u=BigInt(6),d=BigInt(11),h=BigInt(22),w=BigInt(23),x=BigInt(44),M=BigInt(88),B=e*e*e%t,E=B*B*e%t,S=pow2(E,a,t)*E%t,k=pow2(S,a,t)*E%t,C=pow2(k,_2n4,t)*B%t,q=pow2(C,d,t)*C%t,O=pow2(q,h,t)*q%t,U=pow2(O,x,t)*O%t,P=pow2(U,M,t)*U%t,L=pow2(P,x,t)*O%t,J=pow2(L,a,t)*E%t,Y=pow2(J,w,t)*q%t,ae=pow2(Y,u,t)*B%t,oe=pow2(ae,_2n4,t);if(!Fp.eql(Fp.sqr(oe),e))throw new Error("Cannot find square root");return oe}var Fp=Field(secp256k1P,void 0,void 0,{sqrt:sqrtMod}),secp256k1=createCurve({a:BigInt(0),b:BigInt(7),Fp,n:secp256k1N,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:e=>{const t=secp256k1N,a=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),u=-_1n5*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),d=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),h=a,w=BigInt("0x100000000000000000000000000000000"),x=divNearest(h*e,t),M=divNearest(-u*e,t);let B=mod(e-x*a-M*d,t),E=mod(-x*u-M*h,t);const S=B>w,k=E>w;if(S&&(B=t-B),k&&(E=t-E),B>w||E>w)throw new Error("splitScalar: Endomorphism failed, k="+e);return{k1neg:S,k1:B,k2neg:k,k2:E}}}},sha256),_0n5=BigInt(0),fe=e=>typeof e=="bigint"&&_0n5<e&&e<secp256k1P,ge=e=>typeof e=="bigint"&&_0n5<e&&e<secp256k1N,TAGGED_HASH_PREFIXES={};function taggedHash(e,...t){let a=TAGGED_HASH_PREFIXES[e];if(a===void 0){const u=sha256(Uint8Array.from(e,d=>d.charCodeAt(0)));a=concatBytes2(u,u),TAGGED_HASH_PREFIXES[e]=a}return sha256(concatBytes2(a,...t))}var pointToBytes=e=>e.toRawBytes(!0).slice(1),numTo32b=e=>numberToBytesBE(e,32),modP=e=>mod(e,secp256k1P),modN=e=>mod(e,secp256k1N),Point=secp256k1.ProjectivePoint,GmulAdd=(e,t,a)=>Point.BASE.multiplyAndAddUnsafe(e,t,a);function schnorrGetExtPubKey(e){let t=secp256k1.utils.normPrivateKeyToScalar(e),a=Point.fromPrivateKey(t);return{scalar:a.hasEvenY()?t:modN(-t),bytes:pointToBytes(a)}}function lift_x(e){if(!fe(e))throw new Error("bad x: need 0 < x < p");const t=modP(e*e),a=modP(t*e+BigInt(7));let u=sqrtMod(a);u%_2n4!==_0n5&&(u=modP(-u));const d=new Point(e,u,_1n5);return d.assertValidity(),d}function challenge(...e){return modN(bytesToNumberBE(taggedHash("BIP0340/challenge",...e)))}function schnorrGetPublicKey(e){return schnorrGetExtPubKey(e).bytes}function schnorrSign(e,t,a=randomBytes(32)){const u=ensureBytes("message",e),{bytes:d,scalar:h}=schnorrGetExtPubKey(t),w=ensureBytes("auxRand",a,32),x=numTo32b(h^bytesToNumberBE(taggedHash("BIP0340/aux",w))),M=taggedHash("BIP0340/nonce",x,d,u),B=modN(bytesToNumberBE(M));if(B===_0n5)throw new Error("sign failed: k is zero");const{bytes:E,scalar:S}=schnorrGetExtPubKey(B),k=challenge(E,d,u),C=new Uint8Array(64);if(C.set(E,0),C.set(numTo32b(modN(S+k*h)),32),!schnorrVerify(C,u,d))throw new Error("sign: Invalid signature produced");return C}function schnorrVerify(e,t,a){const u=ensureBytes("signature",e,64),d=ensureBytes("message",t),h=ensureBytes("publicKey",a,32);try{const w=lift_x(bytesToNumberBE(h)),x=bytesToNumberBE(u.subarray(0,32));if(!fe(x))return!1;const M=bytesToNumberBE(u.subarray(32,64));if(!ge(M))return!1;const B=challenge(numTo32b(x),pointToBytes(w),d),E=GmulAdd(w,M,modN(-B));return!(!E||!E.hasEvenY()||E.toAffine().x!==x)}catch{return!1}}var schnorr={getPublicKey:schnorrGetPublicKey,sign:schnorrSign,verify:schnorrVerify,utils:{randomPrivateKey:secp256k1.utils.randomPrivateKey,lift_x,pointToBytes,numberToBytesBE,bytesToNumberBE,taggedHash,mod}},crypto2=nc2&&typeof nc2=="object"&&"webcrypto"in nc2?cryptoBrowserifyExports.webcrypto:void 0,u8a3=e=>e instanceof Uint8Array,createView2=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),rotr2=(e,t)=>e<<32-t|e>>>t,isLE2=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!isLE2)throw new Error("Non little-endian hardware is not supported");var hexes2=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function bytesToHex2(e){if(!u8a3(e))throw new Error("Uint8Array expected");let t="";for(let a=0;a<e.length;a++)t+=hexes2[e[a]];return t}function hexToBytes2(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);const t=e.length;if(t%2)throw new Error("padded hex string expected, got unpadded hex of length "+t);const a=new Uint8Array(t/2);for(let u=0;u<a.length;u++){const d=u*2,h=e.slice(d,d+2),w=Number.parseInt(h,16);if(Number.isNaN(w)||w<0)throw new Error("Invalid byte sequence");a[u]=w}return a}function utf8ToBytes3(e){if(typeof e!="string")throw new Error(`utf8ToBytes expected string, got ${typeof e}`);return new Uint8Array(new TextEncoder().encode(e))}function toBytes2(e){if(typeof e=="string"&&(e=utf8ToBytes3(e)),!u8a3(e))throw new Error(`expected Uint8Array, got ${typeof e}`);return e}function concatBytes3(...e){const t=new Uint8Array(e.reduce((u,d)=>u+d.length,0));let a=0;return e.forEach(u=>{if(!u8a3(u))throw new Error("Uint8Array expected");t.set(u,a),a+=u.length}),t}var Hash2=class{clone(){return this._cloneInto()}};function wrapConstructor2(e){const t=u=>e().update(toBytes2(u)).digest(),a=e();return t.outputLen=a.outputLen,t.blockLen=a.blockLen,t.create=()=>e(),t}function randomBytes2(e=32){if(crypto2&&typeof crypto2.getRandomValues=="function")return crypto2.getRandomValues(new Uint8Array(e));throw new Error("crypto.getRandomValues must be defined")}function number2(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`Wrong positive integer: ${e}`)}function bool(e){if(typeof e!="boolean")throw new Error(`Expected boolean, not ${e}`)}function bytes2(e,...t){if(!(e instanceof Uint8Array))throw new Error("Expected Uint8Array");if(t.length>0&&!t.includes(e.length))throw new Error(`Expected Uint8Array of length ${t}, not of length=${e.length}`)}function hash2(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");number2(e.outputLen),number2(e.blockLen)}function exists2(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function output2(e,t){bytes2(e);const a=t.outputLen;if(e.length<a)throw new Error(`digestInto() expects output buffer of length at least ${a}`)}var assert={number:number2,bool,bytes:bytes2,hash:hash2,exists:exists2,output:output2},assert_default=assert;function setBigUint642(e,t,a,u){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,a,u);const d=BigInt(32),h=BigInt(4294967295),w=Number(a>>d&h),x=Number(a&h),M=u?4:0,B=u?0:4;e.setUint32(t+M,w,u),e.setUint32(t+B,x,u)}var SHA22=class extends Hash2{constructor(e,t,a,u){super(),this.blockLen=e,this.outputLen=t,this.padOffset=a,this.isLE=u,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=createView2(this.buffer)}update(e){assert_default.exists(this);const{view:t,buffer:a,blockLen:u}=this;e=toBytes2(e);const d=e.length;for(let h=0;h<d;){const w=Math.min(u-this.pos,d-h);if(w===u){const x=createView2(e);for(;u<=d-h;h+=u)this.process(x,h);continue}a.set(e.subarray(h,h+w),this.pos),this.pos+=w,h+=w,this.pos===u&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){assert_default.exists(this),assert_default.output(e,this),this.finished=!0;const{buffer:t,view:a,blockLen:u,isLE:d}=this;let{pos:h}=this;t[h++]=128,this.buffer.subarray(h).fill(0),this.padOffset>u-h&&(this.process(a,0),h=0);for(let E=h;E<u;E++)t[E]=0;setBigUint642(a,u-8,BigInt(this.length*8),d),this.process(a,0);const w=createView2(e),x=this.outputLen;if(x%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const M=x/4,B=this.get();if(M>B.length)throw new Error("_sha2: outputLen bigger than state");for(let E=0;E<M;E++)w.setUint32(4*E,B[E],d)}digest(){const{buffer:e,outputLen:t}=this;this.digestInto(e);const a=e.slice(0,t);return this.destroy(),a}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:t,buffer:a,length:u,finished:d,destroyed:h,pos:w}=this;return e.length=u,e.pos=w,e.finished=d,e.destroyed=h,u%t&&e.buffer.set(a),e}},Chi2=(e,t,a)=>e&t^~e&a,Maj2=(e,t,a)=>e&t^e&a^t&a,SHA256_K2=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]),IV2=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),SHA256_W2=new Uint32Array(64),SHA2562=class extends SHA22{constructor(){super(64,32,8,!1),this.A=IV2[0]|0,this.B=IV2[1]|0,this.C=IV2[2]|0,this.D=IV2[3]|0,this.E=IV2[4]|0,this.F=IV2[5]|0,this.G=IV2[6]|0,this.H=IV2[7]|0}get(){const{A:e,B:t,C:a,D:u,E:d,F:h,G:w,H:x}=this;return[e,t,a,u,d,h,w,x]}set(e,t,a,u,d,h,w,x){this.A=e|0,this.B=t|0,this.C=a|0,this.D=u|0,this.E=d|0,this.F=h|0,this.G=w|0,this.H=x|0}process(e,t){for(let E=0;E<16;E++,t+=4)SHA256_W2[E]=e.getUint32(t,!1);for(let E=16;E<64;E++){const S=SHA256_W2[E-15],k=SHA256_W2[E-2],C=rotr2(S,7)^rotr2(S,18)^S>>>3,q=rotr2(k,17)^rotr2(k,19)^k>>>10;SHA256_W2[E]=q+SHA256_W2[E-7]+C+SHA256_W2[E-16]|0}let{A:a,B:u,C:d,D:h,E:w,F:x,G:M,H:B}=this;for(let E=0;E<64;E++){const S=rotr2(w,6)^rotr2(w,11)^rotr2(w,25),k=B+S+Chi2(w,x,M)+SHA256_K2[E]+SHA256_W2[E]|0,q=(rotr2(a,2)^rotr2(a,13)^rotr2(a,22))+Maj2(a,u,d)|0;B=M,M=x,x=w,w=h+k|0,h=d,d=u,u=a,a=k+q|0}a=a+this.A|0,u=u+this.B|0,d=d+this.C|0,h=h+this.D|0,w=w+this.E|0,x=x+this.F|0,M=M+this.G|0,B=B+this.H|0,this.set(a,u,d,h,w,x,M,B)}roundClean(){SHA256_W2.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}},SHA224=class extends SHA2562{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}},sha2562=wrapConstructor2(()=>new SHA2562);wrapConstructor2(()=>new SHA224);var verifiedSymbol=Symbol("verified"),isRecord=e=>e instanceof Object;function validateEvent(e){if(!isRecord(e)||typeof e.kind!="number"||typeof e.content!="string"||typeof e.created_at!="number"||typeof e.pubkey!="string"||!e.pubkey.match(/^[a-f0-9]{64}$/)||!Array.isArray(e.tags))return!1;for(let t=0;t<e.tags.length;t++){let a=e.tags[t];if(!Array.isArray(a))return!1;for(let u=0;u<a.length;u++)if(typeof a[u]!="string")return!1}return!0}new TextDecoder("utf-8");var utf8Encoder=new TextEncoder,JS=class{generateSecretKey(){return schnorr.utils.randomPrivateKey()}getPublicKey(e){return bytesToHex2(schnorr.getPublicKey(e))}finalizeEvent(e,t){const a=e;return a.pubkey=bytesToHex2(schnorr.getPublicKey(t)),a.id=getEventHash(a),a.sig=bytesToHex2(schnorr.sign(getEventHash(a),t)),a[verifiedSymbol]=!0,a}verifyEvent(e){if(typeof e[verifiedSymbol]=="boolean")return e[verifiedSymbol];const t=getEventHash(e);if(t!==e.id)return e[verifiedSymbol]=!1,!1;try{const a=schnorr.verify(e.sig,t,e.pubkey);return e[verifiedSymbol]=a,a}catch{return e[verifiedSymbol]=!1,!1}}};function serializeEvent(e){if(!validateEvent(e))throw new Error("can't serialize event with wrong or missing properties");return JSON.stringify([0,e.pubkey,e.created_at,e.kind,e.tags,e.content])}function getEventHash(e){let t=sha2562(utf8Encoder.encode(serializeEvent(e)));return bytesToHex2(t)}var i=new JS;i.generateSecretKey;i.getPublicKey;i.finalizeEvent;i.verifyEvent;new TextDecoder("utf-8");new TextEncoder;var KINDS={SERVICE_RECORD:30059,ATTESTATION:30060,REVOCATION:30061};function assertNumber(e){if(!Number.isSafeInteger(e))throw new Error(`Wrong integer: ${e}`)}function chain(...e){const t=(d,h)=>w=>d(h(w)),a=Array.from(e).reverse().reduce((d,h)=>d?t(d,h.encode):h.encode,void 0),u=e.reduce((d,h)=>d?t(d,h.decode):h.decode,void 0);return{encode:a,decode:u}}function alphabet(e){return{encode:t=>{if(!Array.isArray(t)||t.length&&typeof t[0]!="number")throw new Error("alphabet.encode input should be an array of numbers");return t.map(a=>{if(assertNumber(a),a<0||a>=e.length)throw new Error(`Digit index outside alphabet: ${a} (alphabet: ${e.length})`);return e[a]})},decode:t=>{if(!Array.isArray(t)||t.length&&typeof t[0]!="string")throw new Error("alphabet.decode input should be array of strings");return t.map(a=>{if(typeof a!="string")throw new Error(`alphabet.decode: not string element=${a}`);const u=e.indexOf(a);if(u===-1)throw new Error(`Unknown letter: "${a}". Allowed: ${e}`);return u})}}}function join(e=""){if(typeof e!="string")throw new Error("join separator should be string");return{encode:t=>{if(!Array.isArray(t)||t.length&&typeof t[0]!="string")throw new Error("join.encode input should be array of strings");for(let a of t)if(typeof a!="string")throw new Error(`join.encode: non-string input=${a}`);return t.join(e)},decode:t=>{if(typeof t!="string")throw new Error("join.decode input should be string");return t.split(e)}}}function padding(e,t="="){if(assertNumber(e),typeof t!="string")throw new Error("padding chr should be string");return{encode(a){if(!Array.isArray(a)||a.length&&typeof a[0]!="string")throw new Error("padding.encode input should be array of strings");for(let u of a)if(typeof u!="string")throw new Error(`padding.encode: non-string input=${u}`);for(;a.length*e%8;)a.push(t);return a},decode(a){if(!Array.isArray(a)||a.length&&typeof a[0]!="string")throw new Error("padding.encode input should be array of strings");for(let d of a)if(typeof d!="string")throw new Error(`padding.decode: non-string input=${d}`);let u=a.length;if(u*e%8)throw new Error("Invalid padding: string should have whole number of bytes");for(;u>0&&a[u-1]===t;u--)if(!((u-1)*e%8))throw new Error("Invalid padding: string has too much padding");return a.slice(0,u)}}}function normalize(e){if(typeof e!="function")throw new Error("normalize fn should be function");return{encode:t=>t,decode:t=>e(t)}}function convertRadix(e,t,a){if(t<2)throw new Error(`convertRadix: wrong from=${t}, base cannot be less than 2`);if(a<2)throw new Error(`convertRadix: wrong to=${a}, base cannot be less than 2`);if(!Array.isArray(e))throw new Error("convertRadix: data should be array");if(!e.length)return[];let u=0;const d=[],h=Array.from(e);for(h.forEach(w=>{if(assertNumber(w),w<0||w>=t)throw new Error(`Wrong integer: ${w}`)});;){let w=0,x=!0;for(let M=u;M<h.length;M++){const B=h[M],E=t*w+B;if(!Number.isSafeInteger(E)||t*w/t!==w||E-B!==t*w)throw new Error("convertRadix: carry overflow");if(w=E%a,h[M]=Math.floor(E/a),!Number.isSafeInteger(h[M])||h[M]*a+w!==E)throw new Error("convertRadix: carry overflow");if(x)h[M]?x=!1:u=M;else continue}if(d.push(w),x)break}for(let w=0;w<e.length-1&&e[w]===0;w++)d.push(0);return d.reverse()}var gcd=(e,t)=>t?gcd(t,e%t):e,radix2carry=(e,t)=>e+(t-gcd(e,t));function convertRadix2(e,t,a,u){if(!Array.isArray(e))throw new Error("convertRadix2: data should be array");if(t<=0||t>32)throw new Error(`convertRadix2: wrong from=${t}`);if(a<=0||a>32)throw new Error(`convertRadix2: wrong to=${a}`);if(radix2carry(t,a)>32)throw new Error(`convertRadix2: carry overflow from=${t} to=${a} carryBits=${radix2carry(t,a)}`);let d=0,h=0;const w=2**a-1,x=[];for(const M of e){if(assertNumber(M),M>=2**t)throw new Error(`convertRadix2: invalid data word=${M} from=${t}`);if(d=d<<t|M,h+t>32)throw new Error(`convertRadix2: carry overflow pos=${h} from=${t}`);for(h+=t;h>=a;h-=a)x.push((d>>h-a&w)>>>0);d&=2**h-1}if(d=d<<a-h&w,!u&&h>=t)throw new Error("Excess padding");if(!u&&d)throw new Error(`Non-zero padding: ${d}`);return u&&h>0&&x.push(d>>>0),x}function radix(e){return assertNumber(e),{encode:t=>{if(!(t instanceof Uint8Array))throw new Error("radix.encode input should be Uint8Array");return convertRadix(Array.from(t),2**8,e)},decode:t=>{if(!Array.isArray(t)||t.length&&typeof t[0]!="number")throw new Error("radix.decode input should be array of strings");return Uint8Array.from(convertRadix(t,e,2**8))}}}function radix2(e,t=!1){if(assertNumber(e),e<=0||e>32)throw new Error("radix2: bits should be in (0..32]");if(radix2carry(8,e)>32||radix2carry(e,8)>32)throw new Error("radix2: carry overflow");return{encode:a=>{if(!(a instanceof Uint8Array))throw new Error("radix2.encode input should be Uint8Array");return convertRadix2(Array.from(a),8,e,!t)},decode:a=>{if(!Array.isArray(a)||a.length&&typeof a[0]!="number")throw new Error("radix2.decode input should be array of strings");return Uint8Array.from(convertRadix2(a,e,8,t))}}}function unsafeWrapper(e){if(typeof e!="function")throw new Error("unsafeWrapper fn should be function");return function(...t){try{return e.apply(null,t)}catch{}}}var base16=chain(radix2(4),alphabet("0123456789ABCDEF"),join("")),base32=chain(radix2(5),alphabet("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"),padding(5),join(""));chain(radix2(5),alphabet("0123456789ABCDEFGHIJKLMNOPQRSTUV"),padding(5),join(""));chain(radix2(5),alphabet("0123456789ABCDEFGHJKMNPQRSTVWXYZ"),join(""),normalize(e=>e.toUpperCase().replace(/O/g,"0").replace(/[IL]/g,"1")));var base64=chain(radix2(6),alphabet("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),padding(6),join("")),base64url=chain(radix2(6),alphabet("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),padding(6),join("")),genBase58=e=>chain(radix(58),alphabet(e),join("")),base58=genBase58("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");genBase58("123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ");genBase58("rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz");var XMR_BLOCK_LEN=[0,2,3,5,6,7,9,10,11],base58xmr={encode(e){let t="";for(let a=0;a<e.length;a+=8){const u=e.subarray(a,a+8);t+=base58.encode(u).padStart(XMR_BLOCK_LEN[u.length],"1")}return t},decode(e){let t=[];for(let a=0;a<e.length;a+=11){const u=e.slice(a,a+11),d=XMR_BLOCK_LEN.indexOf(u.length),h=base58.decode(u);for(let w=0;w<h.length-d;w++)if(h[w]!==0)throw new Error("base58xmr: wrong padding");t=t.concat(Array.from(h.slice(h.length-d)))}return Uint8Array.from(t)}},BECH_ALPHABET=chain(alphabet("qpzry9x8gf2tvdw0s3jn54khce6mua7l"),join("")),POLYMOD_GENERATORS=[996825010,642813549,513874426,1027748829,705979059];function bech32Polymod(e){const t=e>>25;let a=(e&33554431)<<5;for(let u=0;u<POLYMOD_GENERATORS.length;u++)(t>>u&1)===1&&(a^=POLYMOD_GENERATORS[u]);return a}function bechChecksum(e,t,a=1){const u=e.length;let d=1;for(let h=0;h<u;h++){const w=e.charCodeAt(h);if(w<33||w>126)throw new Error(`Invalid prefix (${e})`);d=bech32Polymod(d)^w>>5}d=bech32Polymod(d);for(let h=0;h<u;h++)d=bech32Polymod(d)^e.charCodeAt(h)&31;for(let h of t)d=bech32Polymod(d)^h;for(let h=0;h<6;h++)d=bech32Polymod(d);return d^=a,BECH_ALPHABET.encode(convertRadix2([d%2**30],30,5,!1))}function genBech32(e){const t=e==="bech32"?1:734539939,a=radix2(5),u=a.decode,d=a.encode,h=unsafeWrapper(u);function w(E,S,k=90){if(typeof E!="string")throw new Error(`bech32.encode prefix should be string, not ${typeof E}`);if(!Array.isArray(S)||S.length&&typeof S[0]!="number")throw new Error(`bech32.encode words should be array of numbers, not ${typeof S}`);const C=E.length+7+S.length;if(k!==!1&&C>k)throw new TypeError(`Length ${C} exceeds limit ${k}`);return E=E.toLowerCase(),`${E}1${BECH_ALPHABET.encode(S)}${bechChecksum(E,S,t)}`}function x(E,S=90){if(typeof E!="string")throw new Error(`bech32.decode input should be string, not ${typeof E}`);if(E.length<8||S!==!1&&E.length>S)throw new TypeError(`Wrong string length: ${E.length} (${E}). Expected (8..${S})`);const k=E.toLowerCase();if(E!==k&&E!==E.toUpperCase())throw new Error("String must be lowercase or uppercase");E=k;const C=E.lastIndexOf("1");if(C===0||C===-1)throw new Error('Letter "1" must be present between prefix and data only');const q=E.slice(0,C),O=E.slice(C+1);if(O.length<6)throw new Error("Data must be at least 6 characters long");const U=BECH_ALPHABET.decode(O).slice(0,-6),P=bechChecksum(q,U,t);if(!O.endsWith(P))throw new Error(`Invalid checksum in ${E}: expected "${P}"`);return{prefix:q,words:U}}const M=unsafeWrapper(x);function B(E){const{prefix:S,words:k}=x(E,!1);return{prefix:S,words:k,bytes:u(k)}}return{encode:w,decode:x,decodeToBytes:B,decodeUnsafe:M,fromWords:u,fromWordsUnsafe:h,toWords:d}}var bech32=genBech32("bech32");genBech32("bech32m");var utf8={encode:e=>new TextDecoder().decode(e),decode:e=>new TextEncoder().encode(e)},hex=chain(radix2(4),alphabet("0123456789abcdef"),join(""),normalize(e=>{if(typeof e!="string"||e.length%2)throw new TypeError(`hex.decode: expected string, got ${typeof e} with length ${e.length}`);return e.toLowerCase()})),CODERS={utf8,hex,base16,base32,base64,base64url,base58,base58xmr};`${Object.keys(CODERS).join(", ")}`;function number3(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`positive integer expected, not ${e}`)}function bool2(e){if(typeof e!="boolean")throw new Error(`boolean expected, not ${e}`)}function isBytes(e){return e instanceof Uint8Array||e!=null&&typeof e=="object"&&e.constructor.name==="Uint8Array"}function bytes3(e,...t){if(!isBytes(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error(`Uint8Array expected of length ${t}, not of length=${e.length}`)}function exists3(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function output3(e,t){bytes3(e);const a=t.outputLen;if(e.length<a)throw new Error(`digestInto() expects output buffer of length at least ${a}`)}var u32=e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4)),createView3=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),isLE3=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!isLE3)throw new Error("Non little-endian hardware is not supported");var hexes3=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function bytesToHex3(e){bytes3(e);let t="";for(let a=0;a<e.length;a++)t+=hexes3[e[a]];return t}var asciis={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};function asciiToBase16(e){if(e>=asciis._0&&e<=asciis._9)return e-asciis._0;if(e>=asciis._A&&e<=asciis._F)return e-(asciis._A-10);if(e>=asciis._a&&e<=asciis._f)return e-(asciis._a-10)}function hexToBytes3(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);const t=e.length,a=t/2;if(t%2)throw new Error("padded hex string expected, got unpadded hex of length "+t);const u=new Uint8Array(a);for(let d=0,h=0;d<a;d++,h+=2){const w=asciiToBase16(e.charCodeAt(h)),x=asciiToBase16(e.charCodeAt(h+1));if(w===void 0||x===void 0){const M=e[h]+e[h+1];throw new Error('hex string expected, got non-hex character "'+M+'" at index '+h)}u[d]=w*16+x}return u}function utf8ToBytes4(e){if(typeof e!="string")throw new Error(`string expected, got ${typeof e}`);return new Uint8Array(new TextEncoder().encode(e))}function toBytes3(e){if(typeof e=="string")e=utf8ToBytes4(e);else if(isBytes(e))e=e.slice();else throw new Error(`Uint8Array expected, got ${typeof e}`);return e}function checkOpts(e,t){if(t==null||typeof t!="object")throw new Error("options must be defined");return Object.assign(e,t)}function equalBytes2(e,t){if(e.length!==t.length)return!1;let a=0;for(let u=0;u<e.length;u++)a|=e[u]^t[u];return a===0}var wrapCipher=(e,t)=>(Object.assign(t,e),t),BLOCK_SIZE=16,ZEROS16=new Uint8Array(16),ZEROS32=u32(ZEROS16),POLY=225,mul2=(e,t,a,u)=>{const d=u&1;return{s3:a<<31|u>>>1,s2:t<<31|a>>>1,s1:e<<31|t>>>1,s0:e>>>1^POLY<<24&-(d&1)}},swapLE=e=>(e>>>0&255)<<24|(e>>>8&255)<<16|(e>>>16&255)<<8|e>>>24&255|0;function _toGHASHKey(e){e.reverse();const t=e[15]&1;let a=0;for(let u=0;u<e.length;u++){const d=e[u];e[u]=d>>>1|a,a=(d&1)<<7}return e[0]^=-t&225,e}var estimateWindow=e=>e>64*1024?8:e>1024?4:2,GHASH=class{constructor(e,t){this.blockLen=BLOCK_SIZE,this.outputLen=BLOCK_SIZE,this.s0=0,this.s1=0,this.s2=0,this.s3=0,this.finished=!1,e=toBytes3(e),bytes3(e,16);const a=createView3(e);let u=a.getUint32(0,!1),d=a.getUint32(4,!1),h=a.getUint32(8,!1),w=a.getUint32(12,!1);const x=[];for(let C=0;C<128;C++)x.push({s0:swapLE(u),s1:swapLE(d),s2:swapLE(h),s3:swapLE(w)}),{s0:u,s1:d,s2:h,s3:w}=mul2(u,d,h,w);const M=estimateWindow(t||1024);if(![1,2,4,8].includes(M))throw new Error(`ghash: wrong window size=${M}, should be 2, 4 or 8`);this.W=M;const E=128/M,S=this.windowSize=2**M,k=[];for(let C=0;C<E;C++)for(let q=0;q<S;q++){let O=0,U=0,P=0,L=0;for(let J=0;J<M;J++){if(!(q>>>M-J-1&1))continue;const{s0:ae,s1:oe,s2:ue,s3:se}=x[M*C+J];O^=ae,U^=oe,P^=ue,L^=se}k.push({s0:O,s1:U,s2:P,s3:L})}this.t=k}_updateBlock(e,t,a,u){e^=this.s0,t^=this.s1,a^=this.s2,u^=this.s3;const{W:d,t:h,windowSize:w}=this;let x=0,M=0,B=0,E=0;const S=(1<<d)-1;let k=0;for(const C of[e,t,a,u])for(let q=0;q<4;q++){const O=C>>>8*q&255;for(let U=8/d-1;U>=0;U--){const P=O>>>d*U&S,{s0:L,s1:J,s2:Y,s3:ae}=h[k*w+P];x^=L,M^=J,B^=Y,E^=ae,k+=1}}this.s0=x,this.s1=M,this.s2=B,this.s3=E}update(e){e=toBytes3(e),exists3(this);const t=u32(e),a=Math.floor(e.length/BLOCK_SIZE),u=e.length%BLOCK_SIZE;for(let d=0;d<a;d++)this._updateBlock(t[d*4+0],t[d*4+1],t[d*4+2],t[d*4+3]);return u&&(ZEROS16.set(e.subarray(a*BLOCK_SIZE)),this._updateBlock(ZEROS32[0],ZEROS32[1],ZEROS32[2],ZEROS32[3]),ZEROS32.fill(0)),this}destroy(){const{t:e}=this;for(const t of e)t.s0=0,t.s1=0,t.s2=0,t.s3=0}digestInto(e){exists3(this),output3(e,this),this.finished=!0;const{s0:t,s1:a,s2:u,s3:d}=this,h=u32(e);return h[0]=t,h[1]=a,h[2]=u,h[3]=d,e}digest(){const e=new Uint8Array(BLOCK_SIZE);return this.digestInto(e),this.destroy(),e}},Polyval=class extends GHASH{constructor(e,t){e=toBytes3(e);const a=_toGHASHKey(e.slice());super(a,t),a.fill(0)}update(e){e=toBytes3(e),exists3(this);const t=u32(e),a=e.length%BLOCK_SIZE,u=Math.floor(e.length/BLOCK_SIZE);for(let d=0;d<u;d++)this._updateBlock(swapLE(t[d*4+3]),swapLE(t[d*4+2]),swapLE(t[d*4+1]),swapLE(t[d*4+0]));return a&&(ZEROS16.set(e.subarray(u*BLOCK_SIZE)),this._updateBlock(swapLE(ZEROS32[3]),swapLE(ZEROS32[2]),swapLE(ZEROS32[1]),swapLE(ZEROS32[0])),ZEROS32.fill(0)),this}digestInto(e){exists3(this),output3(e,this),this.finished=!0;const{s0:t,s1:a,s2:u,s3:d}=this,h=u32(e);return h[0]=t,h[1]=a,h[2]=u,h[3]=d,e.reverse()}};function wrapConstructorWithKey(e){const t=(u,d)=>e(d,u.length).update(toBytes3(u)).digest(),a=e(new Uint8Array(16),0);return t.outputLen=a.outputLen,t.blockLen=a.blockLen,t.create=(u,d)=>e(u,d),t}wrapConstructorWithKey((e,t)=>new GHASH(e,t));wrapConstructorWithKey((e,t)=>new Polyval(e,t));var BLOCK_SIZE2=16,POLY2=283;function mul22(e){return e<<1^POLY2&-(e>>7)}function mul(e,t){let a=0;for(;t>0;t>>=1)a^=e&-(t&1),e=mul22(e);return a}var sbox=(()=>{let e=new Uint8Array(256);for(let a=0,u=1;a<256;a++,u^=mul22(u))e[a]=u;const t=new Uint8Array(256);t[0]=99;for(let a=0;a<255;a++){let u=e[255-a];u|=u<<8,t[e[a]]=(u^u>>4^u>>5^u>>6^u>>7^99)&255}return t})(),invSbox=sbox.map((e,t)=>sbox.indexOf(t)),rotr32_8=e=>e<<24|e>>>8,rotl32_8=e=>e<<8|e>>>24;function genTtable(e,t){if(e.length!==256)throw new Error("Wrong sbox length");const a=new Uint32Array(256).map((B,E)=>t(e[E])),u=a.map(rotl32_8),d=u.map(rotl32_8),h=d.map(rotl32_8),w=new Uint32Array(256*256),x=new Uint32Array(256*256),M=new Uint16Array(256*256);for(let B=0;B<256;B++)for(let E=0;E<256;E++){const S=B*256+E;w[S]=a[B]^u[E],x[S]=d[B]^h[E],M[S]=e[B]<<8|e[E]}return{sbox:e,sbox2:M,T0:a,T1:u,T2:d,T3:h,T01:w,T23:x}}var tableEncoding=genTtable(sbox,e=>mul(e,3)<<24|e<<16|e<<8|mul(e,2)),tableDecoding=genTtable(invSbox,e=>mul(e,11)<<24|mul(e,13)<<16|mul(e,9)<<8|mul(e,14)),xPowers=(()=>{const e=new Uint8Array(16);for(let t=0,a=1;t<16;t++,a=mul22(a))e[t]=a;return e})();function expandKeyLE(e){bytes3(e);const t=e.length;if(![16,24,32].includes(t))throw new Error(`aes: wrong key size: should be 16, 24 or 32, got: ${t}`);const{sbox2:a}=tableEncoding,u=u32(e),d=u.length,h=x=>applySbox(a,x,x,x,x),w=new Uint32Array(t+28);w.set(u);for(let x=d;x<w.length;x++){let M=w[x-1];x%d===0?M=h(rotr32_8(M))^xPowers[x/d-1]:d>6&&x%d===4&&(M=h(M)),w[x]=w[x-d]^M}return w}function expandKeyDecLE(e){const t=expandKeyLE(e),a=t.slice(),u=t.length,{sbox2:d}=tableEncoding,{T0:h,T1:w,T2:x,T3:M}=tableDecoding;for(let B=0;B<u;B+=4)for(let E=0;E<4;E++)a[B+E]=t[u-B-4+E];t.fill(0);for(let B=4;B<u-4;B++){const E=a[B],S=applySbox(d,E,E,E,E);a[B]=h[S&255]^w[S>>>8&255]^x[S>>>16&255]^M[S>>>24]}return a}function apply0123(e,t,a,u,d,h){return e[a<<8&65280|u>>>8&255]^t[d>>>8&65280|h>>>24&255]}function applySbox(e,t,a,u,d){return e[t&255|a&65280]|e[u>>>16&255|d>>>16&65280]<<16}function encrypt(e,t,a,u,d){const{sbox2:h,T01:w,T23:x}=tableEncoding;let M=0;t^=e[M++],a^=e[M++],u^=e[M++],d^=e[M++];const B=e.length/4-2;for(let q=0;q<B;q++){const O=e[M++]^apply0123(w,x,t,a,u,d),U=e[M++]^apply0123(w,x,a,u,d,t),P=e[M++]^apply0123(w,x,u,d,t,a),L=e[M++]^apply0123(w,x,d,t,a,u);t=O,a=U,u=P,d=L}const E=e[M++]^applySbox(h,t,a,u,d),S=e[M++]^applySbox(h,a,u,d,t),k=e[M++]^applySbox(h,u,d,t,a),C=e[M++]^applySbox(h,d,t,a,u);return{s0:E,s1:S,s2:k,s3:C}}function decrypt(e,t,a,u,d){const{sbox2:h,T01:w,T23:x}=tableDecoding;let M=0;t^=e[M++],a^=e[M++],u^=e[M++],d^=e[M++];const B=e.length/4-2;for(let q=0;q<B;q++){const O=e[M++]^apply0123(w,x,t,d,u,a),U=e[M++]^apply0123(w,x,a,t,d,u),P=e[M++]^apply0123(w,x,u,a,t,d),L=e[M++]^apply0123(w,x,d,u,a,t);t=O,a=U,u=P,d=L}const E=e[M++]^applySbox(h,t,d,u,a),S=e[M++]^applySbox(h,a,t,d,u),k=e[M++]^applySbox(h,u,a,t,d),C=e[M++]^applySbox(h,d,u,a,t);return{s0:E,s1:S,s2:k,s3:C}}function getDst(e,t){if(!t)return new Uint8Array(e);if(bytes3(t),t.length<e)throw new Error(`aes: wrong destination length, expected at least ${e}, got: ${t.length}`);return t}function validateBlockDecrypt(e){if(bytes3(e),e.length%BLOCK_SIZE2!==0)throw new Error(`aes/(cbc-ecb).decrypt ciphertext should consist of blocks with size ${BLOCK_SIZE2}`)}function validateBlockEncrypt(e,t,a){let u=e.length;const d=u%BLOCK_SIZE2;if(!t&&d!==0)throw new Error("aec/(cbc-ecb): unpadded plaintext with disabled padding");const h=u32(e);if(t){let M=BLOCK_SIZE2-d;M||(M=BLOCK_SIZE2),u=u+M}const w=getDst(u,a),x=u32(w);return{b:h,o:x,out:w}}function validatePCKS(e,t){if(!t)return e;const a=e.length;if(!a)throw new Error("aes/pcks5: empty ciphertext not allowed");const u=e[a-1];if(u<=0||u>16)throw new Error(`aes/pcks5: wrong padding byte: ${u}`);const d=e.subarray(0,-u);for(let h=0;h<u;h++)if(e[a-h-1]!==u)throw new Error("aes/pcks5: wrong padding");return d}function padPCKS(e){const t=new Uint8Array(16),a=u32(t);t.set(e);const u=BLOCK_SIZE2-e.length;for(let d=BLOCK_SIZE2-u;d<BLOCK_SIZE2;d++)t[d]=u;return a}var cbc=wrapCipher({blockSize:16,nonceLength:16},function e(t,a,u={}){bytes3(t),bytes3(a,16);const d=!u.disablePadding;return{encrypt:(h,w)=>{const x=expandKeyLE(t),{b:M,o:B,out:E}=validateBlockEncrypt(h,d,w),S=u32(a);let k=S[0],C=S[1],q=S[2],O=S[3],U=0;for(;U+4<=M.length;)k^=M[U+0],C^=M[U+1],q^=M[U+2],O^=M[U+3],{s0:k,s1:C,s2:q,s3:O}=encrypt(x,k,C,q,O),B[U++]=k,B[U++]=C,B[U++]=q,B[U++]=O;if(d){const P=padPCKS(h.subarray(U*4));k^=P[0],C^=P[1],q^=P[2],O^=P[3],{s0:k,s1:C,s2:q,s3:O}=encrypt(x,k,C,q,O),B[U++]=k,B[U++]=C,B[U++]=q,B[U++]=O}return x.fill(0),E},decrypt:(h,w)=>{validateBlockDecrypt(h);const x=expandKeyDecLE(t),M=u32(a),B=getDst(h.length,w),E=u32(h),S=u32(B);let k=M[0],C=M[1],q=M[2],O=M[3];for(let U=0;U+4<=E.length;){const P=k,L=C,J=q,Y=O;k=E[U+0],C=E[U+1],q=E[U+2],O=E[U+3];const{s0:ae,s1:oe,s2:ue,s3:se}=decrypt(x,k,C,q,O);S[U++]=ae^P,S[U++]=oe^L,S[U++]=ue^J,S[U++]=se^Y}return x.fill(0),validatePCKS(B,d)}}}),u8to16=(e,t)=>e[t++]&255|(e[t++]&255)<<8,Poly1305=class{constructor(e){this.blockLen=16,this.outputLen=16,this.buffer=new Uint8Array(16),this.r=new Uint16Array(10),this.h=new Uint16Array(10),this.pad=new Uint16Array(8),this.pos=0,this.finished=!1,e=toBytes3(e),bytes3(e,32);const t=u8to16(e,0),a=u8to16(e,2),u=u8to16(e,4),d=u8to16(e,6),h=u8to16(e,8),w=u8to16(e,10),x=u8to16(e,12),M=u8to16(e,14);this.r[0]=t&8191,this.r[1]=(t>>>13|a<<3)&8191,this.r[2]=(a>>>10|u<<6)&7939,this.r[3]=(u>>>7|d<<9)&8191,this.r[4]=(d>>>4|h<<12)&255,this.r[5]=h>>>1&8190,this.r[6]=(h>>>14|w<<2)&8191,this.r[7]=(w>>>11|x<<5)&8065,this.r[8]=(x>>>8|M<<8)&8191,this.r[9]=M>>>5&127;for(let B=0;B<8;B++)this.pad[B]=u8to16(e,16+2*B)}process(e,t,a=!1){const u=a?0:2048,{h:d,r:h}=this,w=h[0],x=h[1],M=h[2],B=h[3],E=h[4],S=h[5],k=h[6],C=h[7],q=h[8],O=h[9],U=u8to16(e,t+0),P=u8to16(e,t+2),L=u8to16(e,t+4),J=u8to16(e,t+6),Y=u8to16(e,t+8),ae=u8to16(e,t+10),oe=u8to16(e,t+12),ue=u8to16(e,t+14);let se=d[0]+(U&8191),ie=d[1]+((U>>>13|P<<3)&8191),ce=d[2]+((P>>>10|L<<6)&8191),$=d[3]+((L>>>7|J<<9)&8191),n=d[4]+((J>>>4|Y<<12)&8191),l=d[5]+(Y>>>1&8191),c=d[6]+((Y>>>14|ae<<2)&8191),p=d[7]+((ae>>>11|oe<<5)&8191),y=d[8]+((oe>>>8|ue<<8)&8191),b=d[9]+(ue>>>5|u),_=0,v=_+se*w+ie*(5*O)+ce*(5*q)+$*(5*C)+n*(5*k);_=v>>>13,v&=8191,v+=l*(5*S)+c*(5*E)+p*(5*B)+y*(5*M)+b*(5*x),_+=v>>>13,v&=8191;let o=_+se*x+ie*w+ce*(5*O)+$*(5*q)+n*(5*C);_=o>>>13,o&=8191,o+=l*(5*k)+c*(5*S)+p*(5*E)+y*(5*B)+b*(5*M),_+=o>>>13,o&=8191;let m=_+se*M+ie*x+ce*w+$*(5*O)+n*(5*q);_=m>>>13,m&=8191,m+=l*(5*C)+c*(5*k)+p*(5*S)+y*(5*E)+b*(5*B),_+=m>>>13,m&=8191;let A=_+se*B+ie*M+ce*x+$*w+n*(5*O);_=A>>>13,A&=8191,A+=l*(5*q)+c*(5*C)+p*(5*k)+y*(5*S)+b*(5*E),_+=A>>>13,A&=8191;let I=_+se*E+ie*B+ce*M+$*x+n*w;_=I>>>13,I&=8191,I+=l*(5*O)+c*(5*q)+p*(5*C)+y*(5*k)+b*(5*S),_+=I>>>13,I&=8191;let F=_+se*S+ie*E+ce*B+$*M+n*x;_=F>>>13,F&=8191,F+=l*w+c*(5*O)+p*(5*q)+y*(5*C)+b*(5*k),_+=F>>>13,F&=8191;let X=_+se*k+ie*S+ce*E+$*B+n*M;_=X>>>13,X&=8191,X+=l*x+c*w+p*(5*O)+y*(5*q)+b*(5*C),_+=X>>>13,X&=8191;let V=_+se*C+ie*k+ce*S+$*E+n*B;_=V>>>13,V&=8191,V+=l*M+c*x+p*w+y*(5*O)+b*(5*q),_+=V>>>13,V&=8191;let T=_+se*q+ie*C+ce*k+$*S+n*E;_=T>>>13,T&=8191,T+=l*B+c*M+p*x+y*w+b*(5*O),_+=T>>>13,T&=8191;let D=_+se*O+ie*q+ce*C+$*k+n*S;_=D>>>13,D&=8191,D+=l*E+c*B+p*M+y*x+b*w,_+=D>>>13,D&=8191,_=(_<<2)+_|0,_=_+v|0,v=_&8191,_=_>>>13,o+=_,d[0]=v,d[1]=o,d[2]=m,d[3]=A,d[4]=I,d[5]=F,d[6]=X,d[7]=V,d[8]=T,d[9]=D}finalize(){const{h:e,pad:t}=this,a=new Uint16Array(10);let u=e[1]>>>13;e[1]&=8191;for(let w=2;w<10;w++)e[w]+=u,u=e[w]>>>13,e[w]&=8191;e[0]+=u*5,u=e[0]>>>13,e[0]&=8191,e[1]+=u,u=e[1]>>>13,e[1]&=8191,e[2]+=u,a[0]=e[0]+5,u=a[0]>>>13,a[0]&=8191;for(let w=1;w<10;w++)a[w]=e[w]+u,u=a[w]>>>13,a[w]&=8191;a[9]-=8192;let d=(u^1)-1;for(let w=0;w<10;w++)a[w]&=d;d=~d;for(let w=0;w<10;w++)e[w]=e[w]&d|a[w];e[0]=(e[0]|e[1]<<13)&65535,e[1]=(e[1]>>>3|e[2]<<10)&65535,e[2]=(e[2]>>>6|e[3]<<7)&65535,e[3]=(e[3]>>>9|e[4]<<4)&65535,e[4]=(e[4]>>>12|e[5]<<1|e[6]<<14)&65535,e[5]=(e[6]>>>2|e[7]<<11)&65535,e[6]=(e[7]>>>5|e[8]<<8)&65535,e[7]=(e[8]>>>8|e[9]<<5)&65535;let h=e[0]+t[0];e[0]=h&65535;for(let w=1;w<8;w++)h=(e[w]+t[w]|0)+(h>>>16)|0,e[w]=h&65535}update(e){exists3(this);const{buffer:t,blockLen:a}=this;e=toBytes3(e);const u=e.length;for(let d=0;d<u;){const h=Math.min(a-this.pos,u-d);if(h===a){for(;a<=u-d;d+=a)this.process(e,d);continue}t.set(e.subarray(d,d+h),this.pos),this.pos+=h,d+=h,this.pos===a&&(this.process(t,0,!1),this.pos=0)}return this}destroy(){this.h.fill(0),this.r.fill(0),this.buffer.fill(0),this.pad.fill(0)}digestInto(e){exists3(this),output3(e,this),this.finished=!0;const{buffer:t,h:a}=this;let{pos:u}=this;if(u){for(t[u++]=1;u<16;u++)t[u]=0;this.process(t,0,!0)}this.finalize();let d=0;for(let h=0;h<8;h++)e[d++]=a[h]>>>0,e[d++]=a[h]>>>8;return e}digest(){const{buffer:e,outputLen:t}=this;this.digestInto(e);const a=e.slice(0,t);return this.destroy(),a}};function wrapConstructorWithKey2(e){const t=(u,d)=>e(d).update(toBytes3(u)).digest(),a=e(new Uint8Array(32));return t.outputLen=a.outputLen,t.blockLen=a.blockLen,t.create=u=>e(u),t}wrapConstructorWithKey2(e=>new Poly1305(e));var _utf8ToBytes=e=>Uint8Array.from(e.split("").map(t=>t.charCodeAt(0))),sigma16=_utf8ToBytes("expand 16-byte k"),sigma32=_utf8ToBytes("expand 32-byte k"),sigma16_32=u32(sigma16),sigma32_32=u32(sigma32);sigma32_32.slice();function rotl(e,t){return e<<t|e>>>32-t}function isAligned32(e){return e.byteOffset%4===0}var BLOCK_LEN=64,BLOCK_LEN32=16,MAX_COUNTER=2**32-1,U32_EMPTY=new Uint32Array;function runCipher(e,t,a,u,d,h,w,x){const M=d.length,B=new Uint8Array(BLOCK_LEN),E=u32(B),S=isAligned32(d)&&isAligned32(h),k=S?u32(d):U32_EMPTY,C=S?u32(h):U32_EMPTY;for(let q=0;q<M;w++){if(e(t,a,u,E,w,x),w>=MAX_COUNTER)throw new Error("arx: counter overflow");const O=Math.min(BLOCK_LEN,M-q);if(S&&O===BLOCK_LEN){const U=q/4;if(q%4!==0)throw new Error("arx: invalid block position");for(let P=0,L;P<BLOCK_LEN32;P++)L=U+P,C[L]=k[L]^E[P];q+=BLOCK_LEN;continue}for(let U=0,P;U<O;U++)P=q+U,h[P]=d[P]^B[U];q+=O}}function createCipher(e,t){const{allowShortKeys:a,extendNonceFn:u,counterLength:d,counterRight:h,rounds:w}=checkOpts({allowShortKeys:!1,counterLength:8,counterRight:!1,rounds:20},t);if(typeof e!="function")throw new Error("core must be a function");return number3(d),number3(w),bool2(h),bool2(a),(x,M,B,E,S=0)=>{bytes3(x),bytes3(M),bytes3(B);const k=B.length;if(E||(E=new Uint8Array(k)),bytes3(E),number3(S),S<0||S>=MAX_COUNTER)throw new Error("arx: counter overflow");if(E.length<k)throw new Error(`arx: output (${E.length}) is shorter than data (${k})`);const C=[];let q=x.length,O,U;if(q===32)O=x.slice(),C.push(O),U=sigma32_32;else if(q===16&&a)O=new Uint8Array(32),O.set(x),O.set(x,16),U=sigma16_32,C.push(O);else throw new Error(`arx: invalid 32-byte key, got length=${q}`);isAligned32(M)||(M=M.slice(),C.push(M));const P=u32(O);if(u){if(M.length!==24)throw new Error("arx: extended nonce must be 24 bytes");u(U,P,u32(M.subarray(0,16)),P),M=M.subarray(16)}const L=16-d;if(L!==M.length)throw new Error(`arx: nonce must be ${L} or 16 bytes`);if(L!==12){const Y=new Uint8Array(12);Y.set(M,h?0:12-M.length),M=Y,C.push(M)}const J=u32(M);for(runCipher(e,U,P,J,B,E,S,w);C.length>0;)C.pop().fill(0);return E}}function chachaCore(e,t,a,u,d,h=20){let w=e[0],x=e[1],M=e[2],B=e[3],E=t[0],S=t[1],k=t[2],C=t[3],q=t[4],O=t[5],U=t[6],P=t[7],L=d,J=a[0],Y=a[1],ae=a[2],oe=w,ue=x,se=M,ie=B,ce=E,$=S,n=k,l=C,c=q,p=O,y=U,b=P,_=L,v=J,o=Y,m=ae;for(let I=0;I<h;I+=2)oe=oe+ce|0,_=rotl(_^oe,16),c=c+_|0,ce=rotl(ce^c,12),oe=oe+ce|0,_=rotl(_^oe,8),c=c+_|0,ce=rotl(ce^c,7),ue=ue+$|0,v=rotl(v^ue,16),p=p+v|0,$=rotl($^p,12),ue=ue+$|0,v=rotl(v^ue,8),p=p+v|0,$=rotl($^p,7),se=se+n|0,o=rotl(o^se,16),y=y+o|0,n=rotl(n^y,12),se=se+n|0,o=rotl(o^se,8),y=y+o|0,n=rotl(n^y,7),ie=ie+l|0,m=rotl(m^ie,16),b=b+m|0,l=rotl(l^b,12),ie=ie+l|0,m=rotl(m^ie,8),b=b+m|0,l=rotl(l^b,7),oe=oe+$|0,m=rotl(m^oe,16),y=y+m|0,$=rotl($^y,12),oe=oe+$|0,m=rotl(m^oe,8),y=y+m|0,$=rotl($^y,7),ue=ue+n|0,_=rotl(_^ue,16),b=b+_|0,n=rotl(n^b,12),ue=ue+n|0,_=rotl(_^ue,8),b=b+_|0,n=rotl(n^b,7),se=se+l|0,v=rotl(v^se,16),c=c+v|0,l=rotl(l^c,12),se=se+l|0,v=rotl(v^se,8),c=c+v|0,l=rotl(l^c,7),ie=ie+ce|0,o=rotl(o^ie,16),p=p+o|0,ce=rotl(ce^p,12),ie=ie+ce|0,o=rotl(o^ie,8),p=p+o|0,ce=rotl(ce^p,7);let A=0;u[A++]=w+oe|0,u[A++]=x+ue|0,u[A++]=M+se|0,u[A++]=B+ie|0,u[A++]=E+ce|0,u[A++]=S+$|0,u[A++]=k+n|0,u[A++]=C+l|0,u[A++]=q+c|0,u[A++]=O+p|0,u[A++]=U+y|0,u[A++]=P+b|0,u[A++]=L+_|0,u[A++]=J+v|0,u[A++]=Y+o|0,u[A++]=ae+m|0}var chacha20=createCipher(chachaCore,{counterRight:!1,counterLength:4,allowShortKeys:!1}),HMAC2=class extends Hash2{constructor(e,t){super(),this.finished=!1,this.destroyed=!1,assert_default.hash(e);const a=toBytes2(t);if(this.iHash=e.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const u=this.blockLen,d=new Uint8Array(u);d.set(a.length>u?e.create().update(a).digest():a);for(let h=0;h<d.length;h++)d[h]^=54;this.iHash.update(d),this.oHash=e.create();for(let h=0;h<d.length;h++)d[h]^=106;this.oHash.update(d),d.fill(0)}update(e){return assert_default.exists(this),this.iHash.update(e),this}digestInto(e){assert_default.exists(this),assert_default.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:t,iHash:a,finished:u,destroyed:d,blockLen:h,outputLen:w}=this;return e=e,e.finished=u,e.destroyed=d,e.blockLen=h,e.outputLen=w,e.oHash=t._cloneInto(e.oHash),e.iHash=a._cloneInto(e.iHash),e}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}},hmac2=(e,t,a)=>new HMAC2(e,t).update(a).digest();hmac2.create=(e,t)=>new HMAC2(e,t);function extract(e,t,a){return assert_default.hash(e),hmac2(e,toBytes2(a),toBytes2(t))}var HKDF_COUNTER=new Uint8Array([0]),EMPTY_BUFFER=new Uint8Array;function expand(e,t,a,u=32){if(assert_default.hash(e),assert_default.number(u),u>255*e.outputLen)throw new Error("Length should be <= 255*HashLen");const d=Math.ceil(u/e.outputLen);a===void 0&&(a=EMPTY_BUFFER);const h=new Uint8Array(d*e.outputLen),w=hmac2.create(e,t),x=w._cloneInto(),M=new Uint8Array(w.outputLen);for(let B=0;B<d;B++)HKDF_COUNTER[0]=B+1,x.update(B===0?EMPTY_BUFFER:M).update(a).update(HKDF_COUNTER).digestInto(M),h.set(M,e.outputLen*B),w._cloneInto(x);return w.destroy(),x.destroy(),M.fill(0),HKDF_COUNTER.fill(0),h.slice(0,u)}var __defProp2=Object.defineProperty,__export2=(e,t)=>{for(var a in t)__defProp2(e,a,{get:t[a],enumerable:!0})},verifiedSymbol2=Symbol("verified"),isRecord2=e=>e instanceof Object;function validateEvent2(e){if(!isRecord2(e)||typeof e.kind!="number"||typeof e.content!="string"||typeof e.created_at!="number"||typeof e.pubkey!="string"||!e.pubkey.match(/^[a-f0-9]{64}$/)||!Array.isArray(e.tags))return!1;for(let t=0;t<e.tags.length;t++){let a=e.tags[t];if(!Array.isArray(a))return!1;for(let u=0;u<a.length;u++)if(typeof a[u]!="string")return!1}return!0}var utils_exports2={};__export2(utils_exports2,{Queue:()=>Queue,QueueNode:()=>QueueNode,binarySearch:()=>binarySearch,bytesToHex:()=>bytesToHex2,hexToBytes:()=>hexToBytes2,insertEventIntoAscendingList:()=>insertEventIntoAscendingList,insertEventIntoDescendingList:()=>insertEventIntoDescendingList,normalizeURL:()=>normalizeURL,utf8Decoder:()=>utf8Decoder3,utf8Encoder:()=>utf8Encoder3});var utf8Decoder3=new TextDecoder("utf-8"),utf8Encoder3=new TextEncoder;function normalizeURL(e){try{e.indexOf("://")===-1&&(e="wss://"+e);let t=new URL(e);return t.protocol==="http:"?t.protocol="ws:":t.protocol==="https:"&&(t.protocol="wss:"),t.pathname=t.pathname.replace(/\/+/g,"/"),t.pathname.endsWith("/")&&(t.pathname=t.pathname.slice(0,-1)),(t.port==="80"&&t.protocol==="ws:"||t.port==="443"&&t.protocol==="wss:")&&(t.port=""),t.searchParams.sort(),t.hash="",t.toString()}catch{throw new Error(`Invalid URL: ${e}`)}}function insertEventIntoDescendingList(e,t){const[a,u]=binarySearch(e,d=>t.id===d.id?0:t.created_at===d.created_at?-1:d.created_at-t.created_at);return u||e.splice(a,0,t),e}function insertEventIntoAscendingList(e,t){const[a,u]=binarySearch(e,d=>t.id===d.id?0:t.created_at===d.created_at?-1:t.created_at-d.created_at);return u||e.splice(a,0,t),e}function binarySearch(e,t){let a=0,u=e.length-1;for(;a<=u;){const d=Math.floor((a+u)/2),h=t(e[d]);if(h===0)return[d,!0];h<0?u=d-1:a=d+1}return[a,!1]}var QueueNode=class{constructor(e){$e(this,"value");$e(this,"next",null);$e(this,"prev",null);this.value=e}},Queue=class{constructor(){$e(this,"first");$e(this,"last");this.first=null,this.last=null}enqueue(e){const t=new QueueNode(e);return this.last?this.last===this.first?(this.last=t,this.last.prev=this.first,this.first.next=t):(t.prev=this.last,this.last.next=t,this.last=t):(this.first=t,this.last=t),!0}dequeue(){if(!this.first)return null;if(this.first===this.last){const t=this.first;return this.first=null,this.last=null,t.value}const e=this.first;return this.first=e.next,this.first&&(this.first.prev=null),e.value}},JS2=class{generateSecretKey(){return schnorr.utils.randomPrivateKey()}getPublicKey(e){return bytesToHex2(schnorr.getPublicKey(e))}finalizeEvent(e,t){const a=e;return a.pubkey=bytesToHex2(schnorr.getPublicKey(t)),a.id=getEventHash2(a),a.sig=bytesToHex2(schnorr.sign(getEventHash2(a),t)),a[verifiedSymbol2]=!0,a}verifyEvent(e){if(typeof e[verifiedSymbol2]=="boolean")return e[verifiedSymbol2];const t=getEventHash2(e);if(t!==e.id)return e[verifiedSymbol2]=!1,!1;try{const a=schnorr.verify(e.sig,t,e.pubkey);return e[verifiedSymbol2]=a,a}catch{return e[verifiedSymbol2]=!1,!1}}};function serializeEvent2(e){if(!validateEvent2(e))throw new Error("can't serialize event with wrong or missing properties");return JSON.stringify([0,e.pubkey,e.created_at,e.kind,e.tags,e.content])}function getEventHash2(e){let t=sha2562(utf8Encoder3.encode(serializeEvent2(e)));return bytesToHex2(t)}var i2=new JS2,generateSecretKey2=i2.generateSecretKey,getPublicKey2=i2.getPublicKey,finalizeEvent2=i2.finalizeEvent,verifyEvent2=i2.verifyEvent,kinds_exports={};__export2(kinds_exports,{Application:()=>Application,BadgeAward:()=>BadgeAward,BadgeDefinition:()=>BadgeDefinition,BlockedRelaysList:()=>BlockedRelaysList,BlossomServerList:()=>BlossomServerList,BookmarkList:()=>BookmarkList,Bookmarksets:()=>Bookmarksets,Calendar:()=>Calendar,CalendarEventRSVP:()=>CalendarEventRSVP,ChannelCreation:()=>ChannelCreation,ChannelHideMessage:()=>ChannelHideMessage,ChannelMessage:()=>ChannelMessage,ChannelMetadata:()=>ChannelMetadata,ChannelMuteUser:()=>ChannelMuteUser,ChatMessage:()=>ChatMessage,ClassifiedListing:()=>ClassifiedListing,ClientAuth:()=>ClientAuth,Comment:()=>Comment,CommunitiesList:()=>CommunitiesList,CommunityDefinition:()=>CommunityDefinition,CommunityPostApproval:()=>CommunityPostApproval,Contacts:()=>Contacts,CreateOrUpdateProduct:()=>CreateOrUpdateProduct,CreateOrUpdateStall:()=>CreateOrUpdateStall,Curationsets:()=>Curationsets,Date:()=>Date2,DirectMessageRelaysList:()=>DirectMessageRelaysList,DraftClassifiedListing:()=>DraftClassifiedListing,DraftLong:()=>DraftLong,Emojisets:()=>Emojisets,EncryptedDirectMessage:()=>EncryptedDirectMessage,EventDeletion:()=>EventDeletion,FavoriteRelays:()=>FavoriteRelays,FileMessage:()=>FileMessage,FileMetadata:()=>FileMetadata,FileServerPreference:()=>FileServerPreference,Followsets:()=>Followsets,ForumThread:()=>ForumThread,GenericRepost:()=>GenericRepost,Genericlists:()=>Genericlists,GiftWrap:()=>GiftWrap,GroupMetadata:()=>GroupMetadata,HTTPAuth:()=>HTTPAuth,Handlerinformation:()=>Handlerinformation,Handlerrecommendation:()=>Handlerrecommendation,Highlights:()=>Highlights,InterestsList:()=>InterestsList,Interestsets:()=>Interestsets,JobFeedback:()=>JobFeedback,JobRequest:()=>JobRequest,JobResult:()=>JobResult,Label:()=>Label,LightningPubRPC:()=>LightningPubRPC,LiveChatMessage:()=>LiveChatMessage,LiveEvent:()=>LiveEvent,LongFormArticle:()=>LongFormArticle,Metadata:()=>Metadata,Mutelist:()=>Mutelist,NWCWalletInfo:()=>NWCWalletInfo,NWCWalletRequest:()=>NWCWalletRequest,NWCWalletResponse:()=>NWCWalletResponse,NormalVideo:()=>NormalVideo,NostrConnect:()=>NostrConnect,OpenTimestamps:()=>OpenTimestamps,Photo:()=>Photo,Pinlist:()=>Pinlist,Poll:()=>Poll,PollResponse:()=>PollResponse,PrivateDirectMessage:()=>PrivateDirectMessage,ProblemTracker:()=>ProblemTracker,ProfileBadges:()=>ProfileBadges,PublicChatsList:()=>PublicChatsList,Reaction:()=>Reaction,RecommendRelay:()=>RecommendRelay,RelayList:()=>RelayList,RelayReview:()=>RelayReview,Relaysets:()=>Relaysets,Report:()=>Report,Reporting:()=>Reporting,Repost:()=>Repost,Seal:()=>Seal,SearchRelaysList:()=>SearchRelaysList,ShortTextNote:()=>ShortTextNote,ShortVideo:()=>ShortVideo,Time:()=>Time,UserEmojiList:()=>UserEmojiList,UserStatuses:()=>UserStatuses,Voice:()=>Voice,VoiceComment:()=>VoiceComment,Zap:()=>Zap,ZapGoal:()=>ZapGoal,ZapRequest:()=>ZapRequest,classifyKind:()=>classifyKind,isAddressableKind:()=>isAddressableKind,isEphemeralKind:()=>isEphemeralKind,isKind:()=>isKind,isRegularKind:()=>isRegularKind,isReplaceableKind:()=>isReplaceableKind});function isRegularKind(e){return e<1e4&&e!==0&&e!==3}function isReplaceableKind(e){return e===0||e===3||1e4<=e&&e<2e4}function isEphemeralKind(e){return 2e4<=e&&e<3e4}function isAddressableKind(e){return 3e4<=e&&e<4e4}function classifyKind(e){return isRegularKind(e)?"regular":isReplaceableKind(e)?"replaceable":isEphemeralKind(e)?"ephemeral":isAddressableKind(e)?"parameterized":"unknown"}function isKind(e,t){const a=t instanceof Array?t:[t];return validateEvent2(e)&&a.includes(e.kind)||!1}var Metadata=0,ShortTextNote=1,RecommendRelay=2,Contacts=3,EncryptedDirectMessage=4,EventDeletion=5,Repost=6,Reaction=7,BadgeAward=8,ChatMessage=9,ForumThread=11,Seal=13,PrivateDirectMessage=14,FileMessage=15,GenericRepost=16,Photo=20,NormalVideo=21,ShortVideo=22,ChannelCreation=40,ChannelMetadata=41,ChannelMessage=42,ChannelHideMessage=43,ChannelMuteUser=44,OpenTimestamps=1040,GiftWrap=1059,Poll=1068,FileMetadata=1063,Comment=1111,LiveChatMessage=1311,Voice=1222,VoiceComment=1244,ProblemTracker=1971,Report=1984,Reporting=1984,Label=1985,CommunityPostApproval=4550,JobRequest=5999,JobResult=6999,JobFeedback=7e3,ZapGoal=9041,ZapRequest=9734,Zap=9735,Highlights=9802,PollResponse=1018,Mutelist=1e4,Pinlist=10001,RelayList=10002,BookmarkList=10003,CommunitiesList=10004,PublicChatsList=10005,BlockedRelaysList=10006,SearchRelaysList=10007,FavoriteRelays=10012,InterestsList=10015,UserEmojiList=10030,DirectMessageRelaysList=10050,FileServerPreference=10096,BlossomServerList=10063,NWCWalletInfo=13194,LightningPubRPC=21e3,ClientAuth=22242,NWCWalletRequest=23194,NWCWalletResponse=23195,NostrConnect=24133,HTTPAuth=27235,Followsets=3e4,Genericlists=30001,Relaysets=30002,Bookmarksets=30003,Curationsets=30004,ProfileBadges=30008,BadgeDefinition=30009,Interestsets=30015,CreateOrUpdateStall=30017,CreateOrUpdateProduct=30018,LongFormArticle=30023,DraftLong=30024,Emojisets=30030,Application=30078,LiveEvent=30311,UserStatuses=30315,ClassifiedListing=30402,DraftClassifiedListing=30403,Date2=31922,Time=31923,Calendar=31924,CalendarEventRSVP=31925,RelayReview=31987,Handlerrecommendation=31989,Handlerinformation=31990,CommunityDefinition=34550,GroupMetadata=39e3;function matchFilter(e,t){if(e.ids&&e.ids.indexOf(t.id)===-1||e.kinds&&e.kinds.indexOf(t.kind)===-1||e.authors&&e.authors.indexOf(t.pubkey)===-1)return!1;for(let a in e)if(a[0]==="#"){let u=a.slice(1),d=e[`#${u}`];if(d&&!t.tags.find(([h,w])=>h===a.slice(1)&&d.indexOf(w)!==-1))return!1}return!(e.since&&t.created_at<e.since||e.until&&t.created_at>e.until)}function matchFilters(e,t){for(let a=0;a<e.length;a++)if(matchFilter(e[a],t))return!0;return!1}var fakejson_exports={};__export2(fakejson_exports,{getHex64:()=>getHex64,getInt:()=>getInt,getSubscriptionId:()=>getSubscriptionId,matchEventId:()=>matchEventId,matchEventKind:()=>matchEventKind,matchEventPubkey:()=>matchEventPubkey});function getHex64(e,t){let a=t.length+3,u=e.indexOf(`"${t}":`)+a,d=e.slice(u).indexOf('"')+u+1;return e.slice(d,d+64)}function getInt(e,t){let a=t.length,u=e.indexOf(`"${t}":`)+a+3,d=e.slice(u),h=Math.min(d.indexOf(","),d.indexOf("}"));return parseInt(d.slice(0,h),10)}function getSubscriptionId(e){let t=e.slice(0,22).indexOf('"EVENT"');if(t===-1)return null;let a=e.slice(t+7+1).indexOf('"');if(a===-1)return null;let u=t+7+1+a,d=e.slice(u+1,80).indexOf('"');if(d===-1)return null;let h=u+1+d;return e.slice(u+1,h)}function matchEventId(e,t){return t===getHex64(e,"id")}function matchEventPubkey(e,t){return t===getHex64(e,"pubkey")}function matchEventKind(e,t){return t===getInt(e,"kind")}var nip42_exports={};__export2(nip42_exports,{makeAuthEvent:()=>makeAuthEvent});function makeAuthEvent(e,t){return{kind:ClientAuth,created_at:Math.floor(Date.now()/1e3),tags:[["relay",e],["challenge",t]],content:""}}async function yieldThread(){return new Promise((e,t)=>{try{if(typeof MessageChannel<"u"){const a=new MessageChannel,u=()=>{a.port1.removeEventListener("message",u),e()};a.port1.addEventListener("message",u),a.port2.postMessage(0),a.port1.start()}else typeof setImmediate<"u"?setImmediate(e):typeof setTimeout<"u"?setTimeout(e,0):e()}catch(a){console.error("during yield: ",a),t(a)}})}var alwaysTrue=e=>(e[verifiedSymbol2]=!0,!0),SendingOnClosedConnection=class extends Error{constructor(e,t){super(`Tried to send message '${e} on a closed connection to ${t}.`),this.name="SendingOnClosedConnection"}},AbstractRelay=class{constructor(e,t){$e(this,"url");$e(this,"_connected",!1);$e(this,"onclose",null);$e(this,"onnotice",e=>console.debug(`NOTICE from ${this.url}: ${e}`));$e(this,"onauth");$e(this,"baseEoseTimeout",4400);$e(this,"connectionTimeout",4400);$e(this,"publishTimeout",4400);$e(this,"pingFrequency",29e3);$e(this,"pingTimeout",2e4);$e(this,"resubscribeBackoff",[1e4,1e4,1e4,2e4,2e4,3e4,6e4]);$e(this,"openSubs",new Map);$e(this,"enablePing");$e(this,"enableReconnect");$e(this,"connectionTimeoutHandle");$e(this,"reconnectTimeoutHandle");$e(this,"pingIntervalHandle");$e(this,"reconnectAttempts",0);$e(this,"closedIntentionally",!1);$e(this,"connectionPromise");$e(this,"openCountRequests",new Map);$e(this,"openEventPublishes",new Map);$e(this,"ws");$e(this,"incomingMessageQueue",new Queue);$e(this,"queueRunning",!1);$e(this,"challenge");$e(this,"authPromise");$e(this,"serial",0);$e(this,"verifyEvent");$e(this,"_WebSocket");this.url=normalizeURL(e),this.verifyEvent=t.verifyEvent,this._WebSocket=t.websocketImplementation||WebSocket,this.enablePing=t.enablePing,this.enableReconnect=t.enableReconnect||!1}static async connect(e,t){const a=new AbstractRelay(e,t);return await a.connect(),a}closeAllSubscriptions(e){for(let[t,a]of this.openSubs)a.close(e);this.openSubs.clear();for(let[t,a]of this.openEventPublishes)a.reject(new Error(e));this.openEventPublishes.clear();for(let[t,a]of this.openCountRequests)a.reject(new Error(e));this.openCountRequests.clear()}get connected(){return this._connected}async reconnect(){const e=this.resubscribeBackoff[Math.min(this.reconnectAttempts,this.resubscribeBackoff.length-1)];this.reconnectAttempts++,this.reconnectTimeoutHandle=setTimeout(async()=>{try{await this.connect()}catch{}},e)}handleHardClose(e){var a;this.pingIntervalHandle&&(clearInterval(this.pingIntervalHandle),this.pingIntervalHandle=void 0),this._connected=!1,this.connectionPromise=void 0;const t=this.closedIntentionally;this.closedIntentionally=!1,(a=this.onclose)==null||a.call(this),this.enableReconnect&&!t?this.reconnect():this.closeAllSubscriptions(e)}async connect(){return this.connectionPromise?this.connectionPromise:(this.challenge=void 0,this.authPromise=void 0,this.connectionPromise=new Promise((e,t)=>{this.connectionTimeoutHandle=setTimeout(()=>{var a;t("connection timed out"),this.connectionPromise=void 0,(a=this.onclose)==null||a.call(this),this.closeAllSubscriptions("relay connection timed out")},this.connectionTimeout);try{this.ws=new this._WebSocket(this.url)}catch(a){clearTimeout(this.connectionTimeoutHandle),t(a);return}this.ws.onopen=()=>{this.reconnectTimeoutHandle&&(clearTimeout(this.reconnectTimeoutHandle),this.reconnectTimeoutHandle=void 0),clearTimeout(this.connectionTimeoutHandle),this._connected=!0;const a=this.reconnectAttempts>0;this.reconnectAttempts=0;for(const u of this.openSubs.values()){if(u.eosed=!1,a)for(let d=0;d<u.filters.length;d++)u.lastEmitted&&(u.filters[d].since=u.lastEmitted+1);u.fire()}this.enablePing&&(this.pingIntervalHandle=setInterval(()=>this.pingpong(),this.pingFrequency)),e()},this.ws.onerror=a=>{clearTimeout(this.connectionTimeoutHandle),t(a.message||"websocket error"),this.handleHardClose("relay connection errored")},this.ws.onclose=a=>{clearTimeout(this.connectionTimeoutHandle),t(a.message||"websocket closed"),this.handleHardClose("relay connection closed")},this.ws.onmessage=this._onmessage.bind(this)}),this.connectionPromise)}waitForPingPong(){return new Promise(e=>{this.ws.once("pong",()=>e(!0)),this.ws.ping()})}waitForDummyReq(){return new Promise((e,t)=>{if(!this.connectionPromise)return t(new Error(`no connection to ${this.url}, can't ping`));try{const a=this.subscribe([{ids:["aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"],limit:0}],{label:"forced-ping",oneose:()=>{e(!0),a.close()},onclose(){e(!0)},eoseTimeout:this.pingTimeout+1e3})}catch(a){t(a)}})}async pingpong(){var e,t,a;((e=this.ws)==null?void 0:e.readyState)===1&&(await Promise.any([this.ws&&this.ws.ping&&this.ws.once?this.waitForPingPong():this.waitForDummyReq(),new Promise(d=>setTimeout(()=>d(!1),this.pingTimeout))])||((t=this.ws)==null?void 0:t.readyState)===this._WebSocket.OPEN&&((a=this.ws)==null||a.close()))}async runQueue(){for(this.queueRunning=!0;this.handleNext()!==!1;)await yieldThread();this.queueRunning=!1}handleNext(){var a,u,d;const e=this.incomingMessageQueue.dequeue();if(!e)return!1;const t=getSubscriptionId(e);if(t){const h=this.openSubs.get(t);if(!h)return;const w=getHex64(e,"id"),x=(a=h.alreadyHaveEvent)==null?void 0:a.call(h,w);if((u=h.receivedEvent)==null||u.call(h,this,w),x)return}try{let h=JSON.parse(e);switch(h[0]){case"EVENT":{const w=this.openSubs.get(h[1]),x=h[2];this.verifyEvent(x)&&matchFilters(w.filters,x)&&w.onevent(x),(!w.lastEmitted||w.lastEmitted<x.created_at)&&(w.lastEmitted=x.created_at);return}case"COUNT":{const w=h[1],x=h[2],M=this.openCountRequests.get(w);M&&(M.resolve(x.count),this.openCountRequests.delete(w));return}case"EOSE":{const w=this.openSubs.get(h[1]);if(!w)return;w.receivedEose();return}case"OK":{const w=h[1],x=h[2],M=h[3],B=this.openEventPublishes.get(w);B&&(clearTimeout(B.timeout),x?B.resolve(M):B.reject(new Error(M)),this.openEventPublishes.delete(w));return}case"CLOSED":{const w=h[1],x=this.openSubs.get(w);if(!x)return;x.closed=!0,x.close(h[2]);return}case"NOTICE":{this.onnotice(h[1]);return}case"AUTH":{this.challenge=h[1],this.onauth&&this.auth(this.onauth);return}default:{const w=this.openSubs.get(h[1]);(d=w==null?void 0:w.oncustom)==null||d.call(w,h);return}}}catch{return}}async send(e){if(!this.connectionPromise)throw new SendingOnClosedConnection(e,this.url);this.connectionPromise.then(()=>{var t;(t=this.ws)==null||t.send(e)})}async auth(e){const t=this.challenge;if(!t)throw new Error("can't perform auth, no challenge was received");return this.authPromise?this.authPromise:(this.authPromise=new Promise(async(a,u)=>{try{let d=await e(makeAuthEvent(this.url,t)),h=setTimeout(()=>{let w=this.openEventPublishes.get(d.id);w&&(w.reject(new Error("auth timed out")),this.openEventPublishes.delete(d.id))},this.publishTimeout);this.openEventPublishes.set(d.id,{resolve:a,reject:u,timeout:h}),this.send('["AUTH",'+JSON.stringify(d)+"]")}catch(d){console.warn("subscribe auth function failed:",d)}}),this.authPromise)}async publish(e){const t=new Promise((a,u)=>{const d=setTimeout(()=>{const h=this.openEventPublishes.get(e.id);h&&(h.reject(new Error("publish timed out")),this.openEventPublishes.delete(e.id))},this.publishTimeout);this.openEventPublishes.set(e.id,{resolve:a,reject:u,timeout:d})});return this.send('["EVENT",'+JSON.stringify(e)+"]"),t}async count(e,t){this.serial++;const a=(t==null?void 0:t.id)||"count:"+this.serial,u=new Promise((d,h)=>{this.openCountRequests.set(a,{resolve:d,reject:h})});return this.send('["COUNT","'+a+'",'+JSON.stringify(e).substring(1)),u}subscribe(e,t){const a=this.prepareSubscription(e,t);return a.fire(),a}prepareSubscription(e,t){this.serial++;const a=t.id||(t.label?t.label+":":"sub:")+this.serial,u=new Subscription(this,a,e,t);return this.openSubs.set(a,u),u}close(){var e,t,a;this.closedIntentionally=!0,this.reconnectTimeoutHandle&&(clearTimeout(this.reconnectTimeoutHandle),this.reconnectTimeoutHandle=void 0),this.pingIntervalHandle&&(clearInterval(this.pingIntervalHandle),this.pingIntervalHandle=void 0),this.closeAllSubscriptions("relay connection closed by us"),this._connected=!1,(e=this.onclose)==null||e.call(this),((t=this.ws)==null?void 0:t.readyState)===this._WebSocket.OPEN&&((a=this.ws)==null||a.close())}_onmessage(e){this.incomingMessageQueue.enqueue(e.data),this.queueRunning||this.runQueue()}},Subscription=class{constructor(e,t,a,u){$e(this,"relay");$e(this,"id");$e(this,"lastEmitted");$e(this,"closed",!1);$e(this,"eosed",!1);$e(this,"filters");$e(this,"alreadyHaveEvent");$e(this,"receivedEvent");$e(this,"onevent");$e(this,"oneose");$e(this,"onclose");$e(this,"oncustom");$e(this,"eoseTimeout");$e(this,"eoseTimeoutHandle");if(a.length===0)throw new Error("subscription can't be created with zero filters");this.relay=e,this.filters=a,this.id=t,this.alreadyHaveEvent=u.alreadyHaveEvent,this.receivedEvent=u.receivedEvent,this.eoseTimeout=u.eoseTimeout||e.baseEoseTimeout,this.oneose=u.oneose,this.onclose=u.onclose,this.onevent=u.onevent||(d=>{console.warn(`onevent() callback not defined for subscription '${this.id}' in relay ${this.relay.url}. event received:`,d)})}fire(){this.relay.send('["REQ","'+this.id+'",'+JSON.stringify(this.filters).substring(1)),this.eoseTimeoutHandle=setTimeout(this.receivedEose.bind(this),this.eoseTimeout)}receivedEose(){var e;this.eosed||(clearTimeout(this.eoseTimeoutHandle),this.eosed=!0,(e=this.oneose)==null||e.call(this))}close(e="closed by caller"){var t;if(!this.closed&&this.relay.connected){try{this.relay.send('["CLOSE",'+JSON.stringify(this.id)+"]")}catch(a){if(!(a instanceof SendingOnClosedConnection))throw a}this.closed=!0}this.relay.openSubs.delete(this.id),(t=this.onclose)==null||t.call(this,e)}},_WebSocket;try{_WebSocket=WebSocket}catch{}var AbstractSimplePool=class{constructor(e){$e(this,"relays",new Map);$e(this,"seenOn",new Map);$e(this,"trackRelays",!1);$e(this,"verifyEvent");$e(this,"enablePing");$e(this,"enableReconnect");$e(this,"automaticallyAuth");$e(this,"trustedRelayURLs",new Set);$e(this,"_WebSocket");this.verifyEvent=e.verifyEvent,this._WebSocket=e.websocketImplementation,this.enablePing=e.enablePing,this.enableReconnect=e.enableReconnect||!1,this.automaticallyAuth=e.automaticallyAuth}async ensureRelay(e,t){e=normalizeURL(e);let a=this.relays.get(e);if(a||(a=new AbstractRelay(e,{verifyEvent:this.trustedRelayURLs.has(e)?alwaysTrue:this.verifyEvent,websocketImplementation:this._WebSocket,enablePing:this.enablePing,enableReconnect:this.enableReconnect}),a.onclose=()=>{a&&!a.enableReconnect&&this.relays.delete(e)},t!=null&&t.connectionTimeout&&(a.connectionTimeout=t.connectionTimeout),this.relays.set(e,a)),this.automaticallyAuth){const u=this.automaticallyAuth(e);u&&(a.onauth=u)}return await a.connect(),a}close(e){e.map(normalizeURL).forEach(t=>{var a;(a=this.relays.get(t))==null||a.close(),this.relays.delete(t)})}subscribe(e,t,a){const u=[];for(let d=0;d<e.length;d++){const h=normalizeURL(e[d]);u.find(w=>w.url===h)||u.push({url:h,filter:t})}return this.subscribeMap(u,a)}subscribeMany(e,t,a){const u=[],d=[];for(let h=0;h<e.length;h++){const w=normalizeURL(e[h]);d.indexOf(w)===-1&&(d.push(w),u.push({url:w,filter:t}))}return this.subscribeMap(u,a)}subscribeMap(e,t){const a=new Map;for(const k of e){const{url:C,filter:q}=k;a.has(C)||a.set(C,[]),a.get(C).push(q)}const u=Array.from(a.entries()).map(([k,C])=>({url:k,filters:C}));this.trackRelays&&(t.receivedEvent=(k,C)=>{let q=this.seenOn.get(C);q||(q=new Set,this.seenOn.set(C,q)),q.add(k)});const d=new Set,h=[],w=[];let x=k=>{var C;w[k]||(w[k]=!0,w.filter(q=>q).length===u.length&&((C=t.oneose)==null||C.call(t),x=()=>{}))};const M=[];let B=(k,C)=>{var q;M[k]||(x(k),M[k]=C,M.filter(O=>O).length===u.length&&((q=t.onclose)==null||q.call(t,M),B=()=>{}))};const E=k=>{var q;if((q=t.alreadyHaveEvent)!=null&&q.call(t,k))return!0;const C=d.has(k);return d.add(k),C},S=Promise.all(u.map(async({url:k,filters:C},q)=>{let O;try{O=await this.ensureRelay(k,{connectionTimeout:t.maxWait?Math.max(t.maxWait*.8,t.maxWait-1e3):void 0})}catch(P){B(q,(P==null?void 0:P.message)||String(P));return}let U=O.subscribe(C,{...t,oneose:()=>x(q),onclose:P=>{P.startsWith("auth-required: ")&&t.onauth?O.auth(t.onauth).then(()=>{O.subscribe(C,{...t,oneose:()=>x(q),onclose:L=>{B(q,L)},alreadyHaveEvent:E,eoseTimeout:t.maxWait})}).catch(L=>{B(q,`auth was required and attempted, but failed with: ${L}`)}):B(q,P)},alreadyHaveEvent:E,eoseTimeout:t.maxWait});h.push(U)}));return{async close(k){await S,h.forEach(C=>{C.close(k)})}}}subscribeEose(e,t,a){const u=this.subscribe(e,t,{...a,oneose(){u.close("closed automatically on eose")}});return u}subscribeManyEose(e,t,a){const u=this.subscribeMany(e,t,{...a,oneose(){u.close("closed automatically on eose")}});return u}async querySync(e,t,a){return new Promise(async u=>{const d=[];this.subscribeEose(e,t,{...a,onevent(h){d.push(h)},onclose(h){u(d)}})})}async get(e,t,a){t.limit=1;const u=await this.querySync(e,t,a);return u.sort((d,h)=>h.created_at-d.created_at),u[0]||null}publish(e,t,a){return e.map(normalizeURL).map(async(u,d,h)=>{if(h.indexOf(u)!==d)return Promise.reject("duplicate url");let w=await this.ensureRelay(u);return w.publish(t).catch(async x=>{if(x instanceof Error&&x.message.startsWith("auth-required: ")&&(a!=null&&a.onauth))return await w.auth(a.onauth),w.publish(t);throw x}).then(x=>{if(this.trackRelays){let M=this.seenOn.get(t.id);M||(M=new Set,this.seenOn.set(t.id,M)),M.add(w)}return x})})}listConnectionStatus(){const e=new Map;return this.relays.forEach((t,a)=>e.set(a,t.connected)),e}destroy(){this.relays.forEach(e=>e.close()),this.relays=new Map}},_WebSocket2;try{_WebSocket2=WebSocket}catch{}var SimplePool=class extends AbstractSimplePool{constructor(e){super({verifyEvent:verifyEvent2,websocketImplementation:_WebSocket2,...e})}},nip19_exports={};__export2(nip19_exports,{BECH32_REGEX:()=>BECH32_REGEX,Bech32MaxSize:()=>Bech32MaxSize,NostrTypeGuard:()=>NostrTypeGuard,decode:()=>decode,decodeNostrURI:()=>decodeNostrURI,encodeBytes:()=>encodeBytes,naddrEncode:()=>naddrEncode,neventEncode:()=>neventEncode,noteEncode:()=>noteEncode,nprofileEncode:()=>nprofileEncode,npubEncode:()=>npubEncode,nsecEncode:()=>nsecEncode});var NostrTypeGuard={isNProfile:e=>/^nprofile1[a-z\d]+$/.test(e||""),isNEvent:e=>/^nevent1[a-z\d]+$/.test(e||""),isNAddr:e=>/^naddr1[a-z\d]+$/.test(e||""),isNSec:e=>/^nsec1[a-z\d]{58}$/.test(e||""),isNPub:e=>/^npub1[a-z\d]{58}$/.test(e||""),isNote:e=>/^note1[a-z\d]+$/.test(e||""),isNcryptsec:e=>/^ncryptsec1[a-z\d]+$/.test(e||"")},Bech32MaxSize=5e3,BECH32_REGEX=/[\x21-\x7E]{1,83}1[023456789acdefghjklmnpqrstuvwxyz]{6,}/;function integerToUint8Array(e){const t=new Uint8Array(4);return t[0]=e>>24&255,t[1]=e>>16&255,t[2]=e>>8&255,t[3]=e&255,t}function decodeNostrURI(e){try{return e.startsWith("nostr:")&&(e=e.substring(6)),decode(e)}catch{return{type:"invalid",data:null}}}function decode(e){var d,h,w,x,M,B,E;let{prefix:t,words:a}=bech32.decode(e,Bech32MaxSize),u=new Uint8Array(bech32.fromWords(a));switch(t){case"nprofile":{let S=parseTLV(u);if(!((d=S[0])!=null&&d[0]))throw new Error("missing TLV 0 for nprofile");if(S[0][0].length!==32)throw new Error("TLV 0 should be 32 bytes");return{type:"nprofile",data:{pubkey:bytesToHex2(S[0][0]),relays:S[1]?S[1].map(k=>utf8Decoder3.decode(k)):[]}}}case"nevent":{let S=parseTLV(u);if(!((h=S[0])!=null&&h[0]))throw new Error("missing TLV 0 for nevent");if(S[0][0].length!==32)throw new Error("TLV 0 should be 32 bytes");if(S[2]&&S[2][0].length!==32)throw new Error("TLV 2 should be 32 bytes");if(S[3]&&S[3][0].length!==4)throw new Error("TLV 3 should be 4 bytes");return{type:"nevent",data:{id:bytesToHex2(S[0][0]),relays:S[1]?S[1].map(k=>utf8Decoder3.decode(k)):[],author:(w=S[2])!=null&&w[0]?bytesToHex2(S[2][0]):void 0,kind:(x=S[3])!=null&&x[0]?parseInt(bytesToHex2(S[3][0]),16):void 0}}}case"naddr":{let S=parseTLV(u);if(!((M=S[0])!=null&&M[0]))throw new Error("missing TLV 0 for naddr");if(!((B=S[2])!=null&&B[0]))throw new Error("missing TLV 2 for naddr");if(S[2][0].length!==32)throw new Error("TLV 2 should be 32 bytes");if(!((E=S[3])!=null&&E[0]))throw new Error("missing TLV 3 for naddr");if(S[3][0].length!==4)throw new Error("TLV 3 should be 4 bytes");return{type:"naddr",data:{identifier:utf8Decoder3.decode(S[0][0]),pubkey:bytesToHex2(S[2][0]),kind:parseInt(bytesToHex2(S[3][0]),16),relays:S[1]?S[1].map(k=>utf8Decoder3.decode(k)):[]}}}case"nsec":return{type:t,data:u};case"npub":case"note":return{type:t,data:bytesToHex2(u)};default:throw new Error(`unknown prefix ${t}`)}}function parseTLV(e){let t={},a=e;for(;a.length>0;){let u=a[0],d=a[1],h=a.slice(2,2+d);if(a=a.slice(2+d),h.length<d)throw new Error(`not enough data to read on TLV ${u}`);t[u]=t[u]||[],t[u].push(h)}return t}function nsecEncode(e){return encodeBytes("nsec",e)}function npubEncode(e){return encodeBytes("npub",hexToBytes2(e))}function noteEncode(e){return encodeBytes("note",hexToBytes2(e))}function encodeBech32(e,t){let a=bech32.toWords(t);return bech32.encode(e,a,Bech32MaxSize)}function encodeBytes(e,t){return encodeBech32(e,t)}function nprofileEncode(e){let t=encodeTLV({0:[hexToBytes2(e.pubkey)],1:(e.relays||[]).map(a=>utf8Encoder3.encode(a))});return encodeBech32("nprofile",t)}function neventEncode(e){let t;e.kind!==void 0&&(t=integerToUint8Array(e.kind));let a=encodeTLV({0:[hexToBytes2(e.id)],1:(e.relays||[]).map(u=>utf8Encoder3.encode(u)),2:e.author?[hexToBytes2(e.author)]:[],3:t?[new Uint8Array(t)]:[]});return encodeBech32("nevent",a)}function naddrEncode(e){let t=new ArrayBuffer(4);new DataView(t).setUint32(0,e.kind,!1);let a=encodeTLV({0:[utf8Encoder3.encode(e.identifier)],1:(e.relays||[]).map(u=>utf8Encoder3.encode(u)),2:[hexToBytes2(e.pubkey)],3:[new Uint8Array(t)]});return encodeBech32("naddr",a)}function encodeTLV(e){let t=[];return Object.entries(e).reverse().forEach(([a,u])=>{u.forEach(d=>{let h=new Uint8Array(d.length+2);h.set([parseInt(a)],0),h.set([d.length],1),h.set(d,2),t.push(h)})}),concatBytes3(...t)}var nip04_exports={};__export2(nip04_exports,{decrypt:()=>decrypt2,encrypt:()=>encrypt2});function encrypt2(e,t,a){const u=e instanceof Uint8Array?bytesToHex2(e):e,d=secp256k1.getSharedSecret(u,"02"+t),h=getNormalizedX(d);let w=Uint8Array.from(randomBytes2(16)),x=utf8Encoder3.encode(a),M=cbc(h,w).encrypt(x),B=base64.encode(new Uint8Array(M)),E=base64.encode(new Uint8Array(w.buffer));return`${B}?iv=${E}`}function decrypt2(e,t,a){const u=e instanceof Uint8Array?bytesToHex2(e):e;let[d,h]=a.split("?iv="),w=secp256k1.getSharedSecret(u,"02"+t),x=getNormalizedX(w),M=base64.decode(h),B=base64.decode(d),E=cbc(x,M).decrypt(B);return utf8Decoder3.decode(E)}function getNormalizedX(e){return e.slice(1,33)}var nip05_exports={};__export2(nip05_exports,{NIP05_REGEX:()=>NIP05_REGEX,isNip05:()=>isNip05,isValid:()=>isValid,queryProfile:()=>queryProfile,searchDomain:()=>searchDomain,useFetchImplementation:()=>useFetchImplementation});var NIP05_REGEX=/^(?:([\w.+-]+)@)?([\w_-]+(\.[\w_-]+)+)$/,isNip05=e=>NIP05_REGEX.test(e||""),_fetch;try{_fetch=fetch}catch(e){}function useFetchImplementation(e){_fetch=e}async function searchDomain(e,t=""){try{const a=`https://${e}/.well-known/nostr.json?name=${t}`,u=await _fetch(a,{redirect:"manual"});if(u.status!==200)throw Error("Wrong response code");return(await u.json()).names}catch{return{}}}async function queryProfile(e){var d;const t=e.match(NIP05_REGEX);if(!t)return null;const[,a="_",u]=t;try{const h=`https://${u}/.well-known/nostr.json?name=${a}`,w=await _fetch(h,{redirect:"manual"});if(w.status!==200)throw Error("Wrong response code");const x=await w.json(),M=x.names[a];return M?{pubkey:M,relays:(d=x.relays)==null?void 0:d[M]}:null}catch{return null}}async function isValid(e,t){const a=await queryProfile(t);return a?a.pubkey===e:!1}var nip10_exports={};__export2(nip10_exports,{parse:()=>parse});function parse(e){const t={reply:void 0,root:void 0,mentions:[],profiles:[],quotes:[]};let a,u;for(let d=e.tags.length-1;d>=0;d--){const h=e.tags[d];if(h[0]==="e"&&h[1]){const[w,x,M,B,E]=h,S={id:x,relays:M?[M]:[],author:E};if(B==="root"){t.root=S;continue}if(B==="reply"){t.reply=S;continue}if(B==="mention"){t.mentions.push(S);continue}a?u=S:a=S,t.mentions.push(S);continue}if(h[0]==="q"&&h[1]){const[w,x,M]=h;t.quotes.push({id:x,relays:M?[M]:[]})}if(h[0]==="p"&&h[1]){t.profiles.push({pubkey:h[1],relays:h[2]?[h[2]]:[]});continue}}return t.root||(t.root=u||a||t.reply),t.reply||(t.reply=a||t.root),[t.reply,t.root].forEach(d=>{if(!d)return;let h=t.mentions.indexOf(d);if(h!==-1&&t.mentions.splice(h,1),d.author){let w=t.profiles.find(x=>x.pubkey===d.author);w&&w.relays&&(d.relays||(d.relays=[]),w.relays.forEach(x=>{var M;((M=d.relays)==null?void 0:M.indexOf(x))===-1&&d.relays.push(x)}),w.relays=d.relays)}}),t.mentions.forEach(d=>{if(d.author){let h=t.profiles.find(w=>w.pubkey===d.author);h&&h.relays&&(d.relays||(d.relays=[]),h.relays.forEach(w=>{d.relays.indexOf(w)===-1&&d.relays.push(w)}),h.relays=d.relays)}}),t}var nip11_exports={};__export2(nip11_exports,{fetchRelayInformation:()=>fetchRelayInformation,useFetchImplementation:()=>useFetchImplementation2});var _fetch2;try{_fetch2=fetch}catch{}function useFetchImplementation2(e){_fetch2=e}async function fetchRelayInformation(e){return await(await fetch(e.replace("ws://","http://").replace("wss://","https://"),{headers:{Accept:"application/nostr+json"}})).json()}var nip13_exports={};__export2(nip13_exports,{fastEventHash:()=>fastEventHash,getPow:()=>getPow,minePow:()=>minePow});function getPow(e){let t=0;for(let a=0;a<64;a+=8){const u=parseInt(e.substring(a,a+8),16);if(u===0)t+=32;else{t+=Math.clz32(u);break}}return t}function minePow(e,t){let a=0;const u=e,d=["nonce",a.toString(),t.toString()];for(u.tags.push(d);;){const h=Math.floor(new Date().getTime()/1e3);if(h!==u.created_at&&(a=0,u.created_at=h),d[1]=(++a).toString(),u.id=fastEventHash(u),getPow(u.id)>=t)break}return u}function fastEventHash(e){return bytesToHex2(sha2562(utf8Encoder3.encode(JSON.stringify([0,e.pubkey,e.created_at,e.kind,e.tags,e.content]))))}var nip17_exports={};__export2(nip17_exports,{unwrapEvent:()=>unwrapEvent2,unwrapManyEvents:()=>unwrapManyEvents2,wrapEvent:()=>wrapEvent2,wrapManyEvents:()=>wrapManyEvents2});var nip59_exports={};__export2(nip59_exports,{createRumor:()=>createRumor,createSeal:()=>createSeal,createWrap:()=>createWrap,unwrapEvent:()=>unwrapEvent,unwrapManyEvents:()=>unwrapManyEvents,wrapEvent:()=>wrapEvent,wrapManyEvents:()=>wrapManyEvents});var nip44_exports={};__export2(nip44_exports,{decrypt:()=>decrypt22,encrypt:()=>encrypt22,getConversationKey:()=>getConversationKey,v2:()=>v2});var minPlaintextSize=1,maxPlaintextSize=65535;function getConversationKey(e,t){const a=secp256k1.getSharedSecret(e,"02"+t).subarray(1,33);return extract(sha2562,a,"nip44-v2")}function getMessageKeys(e,t){const a=expand(sha2562,e,t,76);return{chacha_key:a.subarray(0,32),chacha_nonce:a.subarray(32,44),hmac_key:a.subarray(44,76)}}function calcPaddedLen(e){if(!Number.isSafeInteger(e)||e<1)throw new Error("expected positive integer");if(e<=32)return 32;const t=1<<Math.floor(Math.log2(e-1))+1,a=t<=256?32:t/8;return a*(Math.floor((e-1)/a)+1)}function writeU16BE(e){if(!Number.isSafeInteger(e)||e<minPlaintextSize||e>maxPlaintextSize)throw new Error("invalid plaintext size: must be between 1 and 65535 bytes");const t=new Uint8Array(2);return new DataView(t.buffer).setUint16(0,e,!1),t}function pad(e){const t=utf8Encoder3.encode(e),a=t.length,u=writeU16BE(a),d=new Uint8Array(calcPaddedLen(a)-a);return concatBytes3(u,t,d)}function unpad(e){const t=new DataView(e.buffer).getUint16(0),a=e.subarray(2,2+t);if(t<minPlaintextSize||t>maxPlaintextSize||a.length!==t||e.length!==2+calcPaddedLen(t))throw new Error("invalid padding");return utf8Decoder3.decode(a)}function hmacAad(e,t,a){if(a.length!==32)throw new Error("AAD associated data must be 32 bytes");const u=concatBytes3(a,t);return hmac2(sha2562,e,u)}function decodePayload(e){if(typeof e!="string")throw new Error("payload must be a valid string");const t=e.length;if(t<132||t>87472)throw new Error("invalid payload length: "+t);if(e[0]==="#")throw new Error("unknown encryption version");let a;try{a=base64.decode(e)}catch(h){throw new Error("invalid base64: "+h.message)}const u=a.length;if(u<99||u>65603)throw new Error("invalid data length: "+u);const d=a[0];if(d!==2)throw new Error("unknown encryption version "+d);return{nonce:a.subarray(1,33),ciphertext:a.subarray(33,-32),mac:a.subarray(-32)}}function encrypt22(e,t,a=randomBytes2(32)){const{chacha_key:u,chacha_nonce:d,hmac_key:h}=getMessageKeys(t,a),w=pad(e),x=chacha20(u,d,w),M=hmacAad(h,x,a);return base64.encode(concatBytes3(new Uint8Array([2]),a,x,M))}function decrypt22(e,t){const{nonce:a,ciphertext:u,mac:d}=decodePayload(e),{chacha_key:h,chacha_nonce:w,hmac_key:x}=getMessageKeys(t,a),M=hmacAad(x,u,a);if(!equalBytes2(M,d))throw new Error("invalid MAC");const B=chacha20(h,w,u);return unpad(B)}var v2={utils:{getConversationKey,calcPaddedLen},encrypt:encrypt22,decrypt:decrypt22},TWO_DAYS=2*24*60*60,now=()=>Math.round(Date.now()/1e3),randomNow=()=>Math.round(now()-Math.random()*TWO_DAYS),nip44ConversationKey=(e,t)=>getConversationKey(e,t),nip44Encrypt=(e,t,a)=>encrypt22(JSON.stringify(e),nip44ConversationKey(t,a)),nip44Decrypt=(e,t)=>JSON.parse(decrypt22(e.content,nip44ConversationKey(t,e.pubkey)));function createRumor(e,t){const a={created_at:now(),content:"",tags:[],...e,pubkey:getPublicKey2(t)};return a.id=getEventHash2(a),a}function createSeal(e,t,a){return finalizeEvent2({kind:Seal,content:nip44Encrypt(e,t,a),created_at:randomNow(),tags:[]},t)}function createWrap(e,t){const a=generateSecretKey2();return finalizeEvent2({kind:GiftWrap,content:nip44Encrypt(e,a,t),created_at:randomNow(),tags:[["p",t]]},a)}function wrapEvent(e,t,a){const u=createRumor(e,t),d=createSeal(u,t,a);return createWrap(d,a)}function wrapManyEvents(e,t,a){if(!a||a.length===0)throw new Error("At least one recipient is required.");const u=getPublicKey2(t),d=[wrapEvent(e,t,u)];return a.forEach(h=>{d.push(wrapEvent(e,t,h))}),d}function unwrapEvent(e,t){const a=nip44Decrypt(e,t);return nip44Decrypt(a,t)}function unwrapManyEvents(e,t){let a=[];return e.forEach(u=>{a.push(unwrapEvent(u,t))}),a.sort((u,d)=>u.created_at-d.created_at),a}function createEvent(e,t,a,u){const d={created_at:Math.ceil(Date.now()/1e3),kind:PrivateDirectMessage,tags:[],content:t};return(Array.isArray(e)?e:[e]).forEach(({publicKey:w,relayUrl:x})=>{d.tags.push(x?["p",w,x]:["p",w])}),u&&d.tags.push(["e",u.eventId,u.relayUrl||"","reply"]),a&&d.tags.push(["subject",a]),d}function wrapEvent2(e,t,a,u,d){const h=createEvent(t,a,u,d);return wrapEvent(h,e,t.publicKey)}function wrapManyEvents2(e,t,a,u,d){if(!t||t.length===0)throw new Error("At least one recipient is required.");return[{publicKey:getPublicKey2(e)},...t].map(w=>wrapEvent2(e,w,a,u,d))}var unwrapEvent2=unwrapEvent,unwrapManyEvents2=unwrapManyEvents,nip18_exports={};__export2(nip18_exports,{finishRepostEvent:()=>finishRepostEvent,getRepostedEvent:()=>getRepostedEvent,getRepostedEventPointer:()=>getRepostedEventPointer});function finishRepostEvent(e,t,a,u){var w;let d;const h=[...e.tags??[],["e",t.id,a],["p",t.pubkey]];return t.kind===ShortTextNote?d=Repost:(d=GenericRepost,h.push(["k",String(t.kind)])),finalizeEvent2({kind:d,tags:h,content:e.content===""||(w=t.tags)!=null&&w.find(x=>x[0]==="-")?"":JSON.stringify(t),created_at:e.created_at},u)}function getRepostedEventPointer(e){if(![Repost,GenericRepost].includes(e.kind))return;let t,a;for(let u=e.tags.length-1;u>=0&&(t===void 0||a===void 0);u--){const d=e.tags[u];d.length>=2&&(d[0]==="e"&&t===void 0?t=d:d[0]==="p"&&a===void 0&&(a=d))}if(t!==void 0)return{id:t[1],relays:[t[2],a==null?void 0:a[2]].filter(u=>typeof u=="string"),author:a==null?void 0:a[1]}}function getRepostedEvent(e,{skipVerification:t}={}){const a=getRepostedEventPointer(e);if(a===void 0||e.content==="")return;let u;try{u=JSON.parse(e.content)}catch{return}if(u.id===a.id&&!(!t&&!verifyEvent2(u)))return u}var nip21_exports={};__export2(nip21_exports,{NOSTR_URI_REGEX:()=>NOSTR_URI_REGEX,parse:()=>parse2,test:()=>test});var NOSTR_URI_REGEX=new RegExp(`nostr:(${BECH32_REGEX.source})`);function test(e){return typeof e=="string"&&new RegExp(`^${NOSTR_URI_REGEX.source}$`).test(e)}function parse2(e){const t=e.match(new RegExp(`^${NOSTR_URI_REGEX.source}$`));if(!t)throw new Error(`Invalid Nostr URI: ${e}`);return{uri:t[0],value:t[1],decoded:decode(t[1])}}var nip25_exports={};__export2(nip25_exports,{finishReactionEvent:()=>finishReactionEvent,getReactedEventPointer:()=>getReactedEventPointer});function finishReactionEvent(e,t,a){const u=t.tags.filter(d=>d.length>=2&&(d[0]==="e"||d[0]==="p"));return finalizeEvent2({...e,kind:Reaction,tags:[...e.tags??[],...u,["e",t.id],["p",t.pubkey]],content:e.content??"+"},a)}function getReactedEventPointer(e){if(e.kind!==Reaction)return;let t,a;for(let u=e.tags.length-1;u>=0&&(t===void 0||a===void 0);u--){const d=e.tags[u];d.length>=2&&(d[0]==="e"&&t===void 0?t=d:d[0]==="p"&&a===void 0&&(a=d))}if(!(t===void 0||a===void 0))return{id:t[1],relays:[t[2],a[2]].filter(u=>u!==void 0),author:a[1]}}var nip27_exports={};__export2(nip27_exports,{parse:()=>parse3});var noCharacter=/\W/m,noURLCharacter=/[^\w\/] |[^\w\/]$|$|,| /m,MAX_HASHTAG_LENGTH=42;function*parse3(e){let t=[];if(typeof e!="string"){for(let h=0;h<e.tags.length;h++){const w=e.tags[h];w[0]==="emoji"&&w.length>=3&&t.push({type:"emoji",shortcode:w[1],url:w[2]})}e=e.content}const a=e.length;let u=0,d=0;e:for(;d<a;){const h=e.indexOf(":",d),w=e.indexOf("#",d);if(h===-1&&w===-1)break e;if(h===-1||w>=0&&w<h){if(w===0||e[w-1]===" "){const x=e.slice(w+1,w+MAX_HASHTAG_LENGTH).match(noCharacter),M=x?w+1+x.index:a;yield{type:"text",text:e.slice(u,w)},yield{type:"hashtag",value:e.slice(w+1,M)},d=M,u=d;continue e}d=w+1;continue e}if(e.slice(h-5,h)==="nostr"){const x=e.slice(h+60).match(noCharacter),M=x?h+60+x.index:a;try{let B,{data:E,type:S}=decode(e.slice(h+1,M));switch(S){case"npub":B={pubkey:E};break;case"note":B={id:E};break;case"nsec":d=M+1;continue;default:B=E}u!==h-5&&(yield{type:"text",text:e.slice(u,h-5)}),yield{type:"reference",pointer:B},d=M,u=d;continue e}catch{d=h+1;continue e}}else if(e.slice(h-5,h)==="https"||e.slice(h-4,h)==="http"){const x=e.slice(h+4).match(noURLCharacter),M=x?h+4+x.index:a,B=e[h-1]==="s"?5:4;try{let E=new URL(e.slice(h-B,M));if(E.hostname.indexOf(".")===-1)throw new Error("invalid url");if(u!==h-B&&(yield{type:"text",text:e.slice(u,h-B)}),/\.(png|jpe?g|gif|webp|heic|svg)$/i.test(E.pathname)){yield{type:"image",url:E.toString()},d=M,u=d;continue e}if(/\.(mp4|avi|webm|mkv|mov)$/i.test(E.pathname)){yield{type:"video",url:E.toString()},d=M,u=d;continue e}if(/\.(mp3|aac|ogg|opus|wav|flac)$/i.test(E.pathname)){yield{type:"audio",url:E.toString()},d=M,u=d;continue e}yield{type:"url",url:E.toString()},d=M,u=d;continue e}catch{d=M+1;continue e}}else if(e.slice(h-3,h)==="wss"||e.slice(h-2,h)==="ws"){const x=e.slice(h+4).match(noURLCharacter),M=x?h+4+x.index:a,B=e[h-1]==="s"?3:2;try{let E=new URL(e.slice(h-B,M));if(E.hostname.indexOf(".")===-1)throw new Error("invalid ws url");u!==h-B&&(yield{type:"text",text:e.slice(u,h-B)}),yield{type:"relay",url:E.toString()},d=M,u=d;continue e}catch{d=M+1;continue e}}else{for(let x=0;x<t.length;x++){const M=t[x];if(e[h+M.shortcode.length+1]===":"&&e.slice(h+1,h+M.shortcode.length+1)===M.shortcode){u!==h&&(yield{type:"text",text:e.slice(u,h)}),yield M,d=h+M.shortcode.length+2,u=d;continue e}}d=h+1;continue e}}u!==a&&(yield{type:"text",text:e.slice(u)})}var nip28_exports={};__export2(nip28_exports,{channelCreateEvent:()=>channelCreateEvent,channelHideMessageEvent:()=>channelHideMessageEvent,channelMessageEvent:()=>channelMessageEvent,channelMetadataEvent:()=>channelMetadataEvent,channelMuteUserEvent:()=>channelMuteUserEvent});var channelCreateEvent=(e,t)=>{let a;if(typeof e.content=="object")a=JSON.stringify(e.content);else if(typeof e.content=="string")a=e.content;else return;return finalizeEvent2({kind:ChannelCreation,tags:[...e.tags??[]],content:a,created_at:e.created_at},t)},channelMetadataEvent=(e,t)=>{let a;if(typeof e.content=="object")a=JSON.stringify(e.content);else if(typeof e.content=="string")a=e.content;else return;return finalizeEvent2({kind:ChannelMetadata,tags:[["e",e.channel_create_event_id],...e.tags??[]],content:a,created_at:e.created_at},t)},channelMessageEvent=(e,t)=>{const a=[["e",e.channel_create_event_id,e.relay_url,"root"]];return e.reply_to_channel_message_event_id&&a.push(["e",e.reply_to_channel_message_event_id,e.relay_url,"reply"]),finalizeEvent2({kind:ChannelMessage,tags:[...a,...e.tags??[]],content:e.content,created_at:e.created_at},t)},channelHideMessageEvent=(e,t)=>{let a;if(typeof e.content=="object")a=JSON.stringify(e.content);else if(typeof e.content=="string")a=e.content;else return;return finalizeEvent2({kind:ChannelHideMessage,tags:[["e",e.channel_message_event_id],...e.tags??[]],content:a,created_at:e.created_at},t)},channelMuteUserEvent=(e,t)=>{let a;if(typeof e.content=="object")a=JSON.stringify(e.content);else if(typeof e.content=="string")a=e.content;else return;return finalizeEvent2({kind:ChannelMuteUser,tags:[["p",e.pubkey_to_mute],...e.tags??[]],content:a,created_at:e.created_at},t)},nip30_exports={};__export2(nip30_exports,{EMOJI_SHORTCODE_REGEX:()=>EMOJI_SHORTCODE_REGEX,matchAll:()=>matchAll,regex:()=>regex,replaceAll:()=>replaceAll});var EMOJI_SHORTCODE_REGEX=/:(\w+):/,regex=()=>new RegExp(`\\B${EMOJI_SHORTCODE_REGEX.source}\\B`,"g");function*matchAll(e){const t=e.matchAll(regex());for(const a of t)try{const[u,d]=a;yield{shortcode:u,name:d,start:a.index,end:a.index+u.length}}catch{}}function replaceAll(e,t){return e.replaceAll(regex(),(a,u)=>t({shortcode:a,name:u}))}var nip39_exports={};__export2(nip39_exports,{useFetchImplementation:()=>useFetchImplementation3,validateGithub:()=>validateGithub});var _fetch3;try{_fetch3=fetch}catch{}function useFetchImplementation3(e){_fetch3=e}async function validateGithub(e,t,a){try{return await(await _fetch3(`https://gist.github.com/${t}/${a}/raw`)).text()===`Verifying that I control the following Nostr public key: ${e}`}catch{return!1}}var nip47_exports={};__export2(nip47_exports,{makeNwcRequestEvent:()=>makeNwcRequestEvent,parseConnectionString:()=>parseConnectionString});function parseConnectionString(e){const{host:t,pathname:a,searchParams:u}=new URL(e),d=a||t,h=u.get("relay"),w=u.get("secret");if(!d||!h||!w)throw new Error("invalid connection string");return{pubkey:d,relay:h,secret:w}}async function makeNwcRequestEvent(e,t,a){const d=encrypt2(t,e,JSON.stringify({method:"pay_invoice",params:{invoice:a}})),h={kind:NWCWalletRequest,created_at:Math.round(Date.now()/1e3),content:d,tags:[["p",e]]};return finalizeEvent2(h,t)}var nip54_exports={};__export2(nip54_exports,{normalizeIdentifier:()=>normalizeIdentifier});function normalizeIdentifier(e){return e=e.trim().toLowerCase(),e=e.normalize("NFKC"),Array.from(e).map(t=>new RegExp("\\p{Letter}","u").test(t)||new RegExp("\\p{Number}","u").test(t)?t:"-").join("")}var nip57_exports={};__export2(nip57_exports,{getSatoshisAmountFromBolt11:()=>getSatoshisAmountFromBolt11,getZapEndpoint:()=>getZapEndpoint,makeZapReceipt:()=>makeZapReceipt,makeZapRequest:()=>makeZapRequest,useFetchImplementation:()=>useFetchImplementation4,validateZapRequest:()=>validateZapRequest});var _fetch4;try{_fetch4=fetch}catch{}function useFetchImplementation4(e){_fetch4=e}async function getZapEndpoint(e){try{let t="",{lud06:a,lud16:u}=JSON.parse(e.content);if(u){let[w,x]=u.split("@");t=new URL(`/.well-known/lnurlp/${w}`,`https://${x}`).toString()}else if(a){let{words:w}=bech32.decode(a,1e3),x=bech32.fromWords(w);t=utf8Decoder3.decode(x)}else return null;let h=await(await _fetch4(t)).json();if(h.allowsNostr&&h.nostrPubkey)return h.callback}catch{}return null}function makeZapRequest(e){let t={kind:9734,created_at:Math.round(Date.now()/1e3),content:e.comment||"",tags:[["p","pubkey"in e?e.pubkey:e.event.pubkey],["amount",e.amount.toString()],["relays",...e.relays]]};if("event"in e){if(t.tags.push(["e",e.event.id]),isReplaceableKind(e.event.kind)){const a=["a",`${e.event.kind}:${e.event.pubkey}:`];t.tags.push(a)}else if(isAddressableKind(e.event.kind)){let a=e.event.tags.find(([d,h])=>d==="d"&&h);if(!a)throw new Error("d tag not found or is empty");const u=["a",`${e.event.kind}:${e.event.pubkey}:${a[1]}`];t.tags.push(u)}t.tags.push(["k",e.event.kind.toString()])}return t}function validateZapRequest(e){let t;try{t=JSON.parse(e)}catch{return"Invalid zap request JSON."}if(!validateEvent2(t))return"Zap request is not a valid Nostr event.";if(!verifyEvent2(t))return"Invalid signature on zap request.";let a=t.tags.find(([h,w])=>h==="p"&&w);if(!a)return"Zap request doesn't have a 'p' tag.";if(!a[1].match(/^[a-f0-9]{64}$/))return"Zap request 'p' tag is not valid hex.";let u=t.tags.find(([h,w])=>h==="e"&&w);return u&&!u[1].match(/^[a-f0-9]{64}$/)?"Zap request 'e' tag is not valid hex.":t.tags.find(([h,w])=>h==="relays"&&w)?null:"Zap request doesn't have a 'relays' tag."}function makeZapReceipt({zapRequest:e,preimage:t,bolt11:a,paidAt:u}){let d=JSON.parse(e),h=d.tags.filter(([x])=>x==="e"||x==="p"||x==="a"),w={kind:9735,created_at:Math.round(u.getTime()/1e3),content:"",tags:[...h,["P",d.pubkey],["bolt11",a],["description",e]]};return t&&w.tags.push(["preimage",t]),w}function getSatoshisAmountFromBolt11(e){if(e.length<50)return 0;e=e.substring(0,50);const t=e.lastIndexOf("1");if(t===-1)return 0;const a=e.substring(0,t);if(!a.startsWith("lnbc"))return 0;const u=a.substring(4);if(u.length<1)return 0;const d=u[u.length-1],h=d.charCodeAt(0)-48,w=h>=0&&h<=9;let x=u.length-1;if(w&&x++,x<1)return 0;const M=parseInt(u.substring(0,x));switch(d){case"m":return M*1e5;case"u":return M*100;case"n":return M/10;case"p":return M/1e4;default:return M*1e8}}var nip77_exports={};__export2(nip77_exports,{Negentropy:()=>Negentropy,NegentropyStorageVector:()=>NegentropyStorageVector,NegentropySync:()=>NegentropySync});var PROTOCOL_VERSION=97,ID_SIZE=32,FINGERPRINT_SIZE=16,Mode={Skip:0,Fingerprint:1,IdList:2},WrappedBuffer=class{constructor(e){$e(this,"_raw");$e(this,"length");typeof e=="number"?(this._raw=new Uint8Array(e),this.length=0):e instanceof Uint8Array?(this._raw=new Uint8Array(e),this.length=e.length):(this._raw=new Uint8Array(512),this.length=0)}unwrap(){return this._raw.subarray(0,this.length)}get capacity(){return this._raw.byteLength}extend(e){if(e instanceof WrappedBuffer&&(e=e.unwrap()),typeof e.length!="number")throw Error("bad length");const t=e.length+this.length;if(this.capacity<t){const a=this._raw,u=Math.max(this.capacity*2,t);this._raw=new Uint8Array(u),this._raw.set(a)}this._raw.set(e,this.length),this.length+=e.length}shift(){const e=this._raw[0];return this._raw=this._raw.subarray(1),this.length--,e}shiftN(e=1){const t=this._raw.subarray(0,e);return this._raw=this._raw.subarray(e),this.length-=e,t}};function decodeVarInt(e){let t=0;for(;;){if(e.length===0)throw Error("parse ends prematurely");let a=e.shift();if(t=t<<7|a&127,!(a&128))break}return t}function encodeVarInt(e){if(e===0)return new WrappedBuffer(new Uint8Array([0]));let t=[];for(;e!==0;)t.push(e&127),e>>>=7;t.reverse();for(let a=0;a<t.length-1;a++)t[a]|=128;return new WrappedBuffer(new Uint8Array(t))}function getByte(e){return getBytes(e,1)[0]}function getBytes(e,t){if(e.length<t)throw Error("parse ends prematurely");return e.shiftN(t)}var Accumulator=class{constructor(){$e(this,"buf");this.setToZero()}setToZero(){this.buf=new Uint8Array(ID_SIZE)}add(e){let t=0,a=0,u=new DataView(this.buf.buffer),d=new DataView(e.buffer);for(let h=0;h<8;h++){let w=h*4,x=u.getUint32(w,!0),M=d.getUint32(w,!0),B=x;B+=t,B+=M,B>4294967295&&(a=1),u.setUint32(w,B&4294967295,!0),t=a,a=0}}negate(){let e=new DataView(this.buf.buffer);for(let a=0;a<8;a++){let u=a*4;e.setUint32(u,~e.getUint32(u,!0))}let t=new Uint8Array(ID_SIZE);t[0]=1,this.add(t)}getFingerprint(e){let t=new WrappedBuffer;return t.extend(this.buf),t.extend(encodeVarInt(e)),sha2562(t.unwrap()).subarray(0,FINGERPRINT_SIZE)}},NegentropyStorageVector=class{constructor(){$e(this,"items");$e(this,"sealed");this.items=[],this.sealed=!1}insert(e,t){if(this.sealed)throw Error("already sealed");const a=hexToBytes3(t);if(a.byteLength!==ID_SIZE)throw Error("bad id size for added item");this.items.push({timestamp:e,id:a})}seal(){if(this.sealed)throw Error("already sealed");this.sealed=!0,this.items.sort(itemCompare);for(let e=1;e<this.items.length;e++)if(itemCompare(this.items[e-1],this.items[e])===0)throw Error("duplicate item inserted")}unseal(){this.sealed=!1}size(){return this._checkSealed(),this.items.length}getItem(e){if(this._checkSealed(),e>=this.items.length)throw Error("out of range");return this.items[e]}iterate(e,t,a){this._checkSealed(),this._checkBounds(e,t);for(let u=e;u<t&&a(this.items[u],u);++u);}findLowerBound(e,t,a){return this._checkSealed(),this._checkBounds(e,t),this._binarySearch(this.items,e,t,u=>itemCompare(u,a)<0)}fingerprint(e,t){let a=new Accumulator;return a.setToZero(),this.iterate(e,t,u=>(a.add(u.id),!0)),a.getFingerprint(t-e)}_checkSealed(){if(!this.sealed)throw Error("not sealed")}_checkBounds(e,t){if(e>t||t>this.items.length)throw Error("bad range")}_binarySearch(e,t,a,u){let d=a-t;for(;d>0;){let h=t,w=Math.floor(d/2);h+=w,u(e[h])?(t=++h,d-=w+1):d=w}return t}},Negentropy=class{constructor(e,t=6e4){$e(this,"storage");$e(this,"frameSizeLimit");$e(this,"lastTimestampIn");$e(this,"lastTimestampOut");if(t<4096)throw Error("frameSizeLimit too small");this.storage=e,this.frameSizeLimit=t,this.lastTimestampIn=0,this.lastTimestampOut=0}_bound(e,t){return{timestamp:e,id:t||new Uint8Array(0)}}initiate(){let e=new WrappedBuffer;return e.extend(new Uint8Array([PROTOCOL_VERSION])),this.splitRange(0,this.storage.size(),this._bound(Number.MAX_VALUE),e),bytesToHex3(e.unwrap())}reconcile(e,t,a){const u=new WrappedBuffer(hexToBytes3(e));this.lastTimestampIn=this.lastTimestampOut=0;let d=new WrappedBuffer;d.extend(new Uint8Array([PROTOCOL_VERSION]));let h=getByte(u);if(h<96||h>111)throw Error("invalid negentropy protocol version byte");if(h!==PROTOCOL_VERSION)throw Error("unsupported negentropy protocol version requested: "+(h-96));let w=this.storage.size(),x=this._bound(0),M=0,B=!1;for(;u.length!==0;){let E=new WrappedBuffer,S=()=>{B&&(B=!1,E.extend(this.encodeBound(x)),E.extend(encodeVarInt(Mode.Skip)))},k=this.decodeBound(u),C=decodeVarInt(u),q=M,O=this.storage.findLowerBound(M,w,k);if(C===Mode.Skip)B=!0;else if(C===Mode.Fingerprint){let U=getBytes(u,FINGERPRINT_SIZE),P=this.storage.fingerprint(q,O);compareUint8Array(U,P)!==0?(S(),this.splitRange(q,O,k,E)):B=!0}else if(C===Mode.IdList){let U=decodeVarInt(u),P={};for(let L=0;L<U;L++){let J=getBytes(u,ID_SIZE);P[bytesToHex3(J)]=J}if(B=!0,this.storage.iterate(q,O,L=>{let J=L.id;const Y=bytesToHex3(J);return P[Y]?delete P[bytesToHex3(J)]:t==null||t(Y),!0}),a)for(let L of Object.values(P))a(bytesToHex3(L))}else throw Error("unexpected mode");if(this.exceededFrameSizeLimit(d.length+E.length)){let U=this.storage.fingerprint(O,w);d.extend(this.encodeBound(this._bound(Number.MAX_VALUE))),d.extend(encodeVarInt(Mode.Fingerprint)),d.extend(U);break}else d.extend(E);M=O,x=k}return d.length===1?null:bytesToHex3(d.unwrap())}splitRange(e,t,a,u){let d=t-e,h=16;if(d<h*2)u.extend(this.encodeBound(a)),u.extend(encodeVarInt(Mode.IdList)),u.extend(encodeVarInt(d)),this.storage.iterate(e,t,w=>(u.extend(w.id),!0));else{let w=Math.floor(d/h),x=d%h,M=e;for(let B=0;B<h;B++){let E=w+(B<x?1:0),S=this.storage.fingerprint(M,M+E);M+=E;let k;if(M===t)k=a;else{let C,q;this.storage.iterate(M-1,M+1,(O,U)=>(U===M-1?C=O:q=O,!0)),k=this.getMinimalBound(C,q)}u.extend(this.encodeBound(k)),u.extend(encodeVarInt(Mode.Fingerprint)),u.extend(S)}}}exceededFrameSizeLimit(e){return e>this.frameSizeLimit-200}decodeTimestampIn(e){let t=decodeVarInt(e);return t=t===0?Number.MAX_VALUE:t-1,this.lastTimestampIn===Number.MAX_VALUE||t===Number.MAX_VALUE?(this.lastTimestampIn=Number.MAX_VALUE,Number.MAX_VALUE):(t+=this.lastTimestampIn,this.lastTimestampIn=t,t)}decodeBound(e){let t=this.decodeTimestampIn(e),a=decodeVarInt(e);if(a>ID_SIZE)throw Error("bound key too long");let u=getBytes(e,a);return{timestamp:t,id:u}}encodeTimestampOut(e){if(e===Number.MAX_VALUE)return this.lastTimestampOut=Number.MAX_VALUE,encodeVarInt(0);let t=e;return e-=this.lastTimestampOut,this.lastTimestampOut=t,encodeVarInt(e+1)}encodeBound(e){let t=new WrappedBuffer;return t.extend(this.encodeTimestampOut(e.timestamp)),t.extend(encodeVarInt(e.id.length)),t.extend(e.id),t}getMinimalBound(e,t){if(t.timestamp!==e.timestamp)return this._bound(t.timestamp);{let a=0,u=t.id,d=e.id;for(let h=0;h<ID_SIZE&&u[h]===d[h];h++)a++;return this._bound(t.timestamp,t.id.subarray(0,a+1))}}};function compareUint8Array(e,t){for(let a=0;a<e.byteLength;a++){if(e[a]<t[a])return-1;if(e[a]>t[a])return 1}return e.byteLength>t.byteLength?1:e.byteLength<t.byteLength?-1:0}function itemCompare(e,t){return e.timestamp===t.timestamp?compareUint8Array(e.id,t.id):e.timestamp-t.timestamp}var NegentropySync=class{constructor(e,t,a,u={}){$e(this,"relay");$e(this,"storage");$e(this,"neg");$e(this,"filter");$e(this,"subscription");$e(this,"onhave");$e(this,"onneed");this.relay=e,this.storage=t,this.neg=new Negentropy(t),this.onhave=u.onhave,this.onneed=u.onneed,this.filter=a,this.subscription=this.relay.prepareSubscription([{}],{label:u.label||"negentropy"}),this.subscription.oncustom=d=>{var h,w,x,M;switch(d[0]){case"NEG-MSG":{d.length<3&&console.warn(`got invalid NEG-MSG from ${this.relay.url}: ${d}`);try{const B=this.neg.reconcile(d[2],this.onhave,this.onneed);B?this.relay.send(`["NEG-MSG", "${this.subscription.id}", "${B}"]`):(this.close(),(h=u.onclose)==null||h.call(u))}catch(B){console.error("negentropy reconcile error:",B),(w=u==null?void 0:u.onclose)==null||w.call(u,`reconcile error: ${B}`)}break}case"NEG-CLOSE":{const B=d[2];console.warn("negentropy error:",B),(x=u.onclose)==null||x.call(u,B);break}case"NEG-ERR":(M=u.onclose)==null||M.call(u)}}}async start(){const e=this.neg.initiate();this.relay.send(`["NEG-OPEN","${this.subscription.id}",${JSON.stringify(this.filter)},"${e}"]`)}close(){this.relay.send(`["NEG-CLOSE","${this.subscription.id}"]`),this.subscription.close()}},nip98_exports={};__export2(nip98_exports,{getToken:()=>getToken,hashPayload:()=>hashPayload,unpackEventFromToken:()=>unpackEventFromToken,validateEvent:()=>validateEvent22,validateEventKind:()=>validateEventKind,validateEventMethodTag:()=>validateEventMethodTag,validateEventPayloadTag:()=>validateEventPayloadTag,validateEventTimestamp:()=>validateEventTimestamp,validateEventUrlTag:()=>validateEventUrlTag,validateToken:()=>validateToken});var _authorizationScheme="Nostr ";async function getToken(e,t,a,u=!1,d){const h={kind:HTTPAuth,tags:[["u",e],["method",t]],created_at:Math.round(new Date().getTime()/1e3),content:""};d&&h.tags.push(["payload",hashPayload(d)]);const w=await a(h);return(u?_authorizationScheme:"")+base64.encode(utf8Encoder3.encode(JSON.stringify(w)))}async function validateToken(e,t,a){const u=await unpackEventFromToken(e).catch(h=>{throw h});return await validateEvent22(u,t,a).catch(h=>{throw h})}async function unpackEventFromToken(e){if(!e)throw new Error("Missing token");e=e.replace(_authorizationScheme,"");const t=utf8Decoder3.decode(base64.decode(e));if(!t||t.length===0||!t.startsWith("{"))throw new Error("Invalid token");return JSON.parse(t)}function validateEventTimestamp(e){return e.created_at?Math.round(new Date().getTime()/1e3)-e.created_at<60:!1}function validateEventKind(e){return e.kind===HTTPAuth}function validateEventUrlTag(e,t){const a=e.tags.find(u=>u[0]==="u");return a?a.length>0&&a[1]===t:!1}function validateEventMethodTag(e,t){const a=e.tags.find(u=>u[0]==="method");return a?a.length>0&&a[1].toLowerCase()===t.toLowerCase():!1}function hashPayload(e){const t=sha2562(utf8Encoder3.encode(JSON.stringify(e)));return bytesToHex2(t)}function validateEventPayloadTag(e,t){const a=e.tags.find(d=>d[0]==="payload");if(!a)return!1;const u=hashPayload(t);return a.length>0&&a[1]===u}async function validateEvent22(e,t,a,u){if(!verifyEvent2(e))throw new Error("Invalid nostr event, signature invalid");if(!validateEventKind(e))throw new Error("Invalid nostr event, kind invalid");if(!validateEventTimestamp(e))throw new Error("Invalid nostr event, created_at timestamp invalid");if(!validateEventUrlTag(e,t))throw new Error("Invalid nostr event, url tag invalid");if(!validateEventMethodTag(e,a))throw new Error("Invalid nostr event, method tag invalid");if(u&&typeof u=="object"&&Object.keys(u).length>0&&!validateEventPayloadTag(e,u))throw new Error("Invalid nostr event, payload tag does not match request body hash");return!0}var NCC02Error=class extends Error{constructor(e,t,a){super(t),this.code=e,a&&(this.cause=a)}},NCC02Resolver=class{constructor(e,t={}){if(!Array.isArray(e))throw new Error("NCC02Resolver expects an array of relay URLs.");this.relays=e,this.pool=t.pool||new SimplePool,this.ownsPool=!t.pool,this.trustedCAPubkeys=new Set(t.trustedCAPubkeys||[])}close(){this.ownsPool&&this.pool&&this.pool.close(this.relays)}async _query(e){return new Promise(t=>{const a=[],u=this.pool.subscribeMany(this.relays,[e],{onevent(d){a.push(d)},oneose(){u.close(),t(a)}})})}async resolve(e,t,a={}){const{requireAttestation:u=!1,minLevel:d=null,standard:h="nostr-service-trust-v0.1"}=a;let w;try{w=await this._query({kinds:[KINDS.SERVICE_RECORD],authors:[e],"#d":[t]})}catch(k){throw new NCC02Error("RELAY_ERROR",`Failed to query relay for ${t}`,k)}if(!w||!w.length)throw new NCC02Error("NOT_FOUND",`No service record found for ${t}`);const x=w.sort((k,C)=>C.created_at!==k.created_at?C.created_at-k.created_at:k.id.localeCompare(C.id))[0];if(!verifyEvent2(x))throw new NCC02Error("INVALID_SIGNATURE","Service record signature verification failed");const M=Object.fromEntries(x.tags),B=Math.floor(Date.now()/1e3);if(!M.exp)throw new NCC02Error("MALFORMED_RECORD","Service record is missing required tag (exp)");if(M.u&&(M.u.startsWith("wss://")||M.u.startsWith("https://"))&&!M.k)throw new NCC02Error("MALFORMED_RECORD","Service record with 'https' or 'wss' endpoint must have a 'k' tag");const E=parseInt(M.exp);if(isNaN(E))throw new NCC02Error("MALFORMED_RECORD","Service record expiry tag is not a valid number");if(E<B)throw new NCC02Error("EXPIRED","Service record has expired");const S=[];if(u||d==="verified"||d==="hardened"){let k,C;try{[k,C]=await Promise.all([this._query({kinds:[KINDS.ATTESTATION],"#e":[x.id]}),this._query({kinds:[KINDS.REVOCATION]})])}catch(q){throw new NCC02Error("RELAY_ERROR","Failed to query relay for attestations/revocations",q)}for(const q of k)if(this.trustedCAPubkeys.has(q.pubkey)){const O=Object.fromEntries(q.tags);if(O.subj!==e||O.srv!==t||h&&O.std!==h||d&&!this._isLevelSufficient(O.lvl,d))continue;this._isAttestationValid(q,O,C)&&S.push({pubkey:q.pubkey,level:O.lvl,eventId:q.id})}if(u&&S.length===0)throw new NCC02Error("POLICY_FAILURE",`No trusted attestations meet the required policy for ${t}`)}return{endpoint:M.u,fingerprint:M.k,expiry:E,attestations:S,eventId:x.id,pubkey:x.pubkey}}_isLevelSufficient(e,t){const a={self:0,verified:1,hardened:2},u=e?a[e]??-1:-1,d=a[t]??0;return u>=d}_isAttestationValid(e,t,a){if(!verifyEvent2(e))return!1;const u=Math.floor(Date.now()/1e3);if(t.nbf){const d=parseInt(t.nbf);if(isNaN(d)||d>u)return!1}if(t.exp){const d=parseInt(t.exp);if(isNaN(d)||d<u)return!1}for(const d of a)if(Object.fromEntries(d.tags).e===e.id&&d.pubkey===e.pubkey&&verifyEvent2(d))return!1;return!0}verifyEndpoint(e,t){return e.fingerprint===t}};/*! Bundled license information:
23
+
24
+ @noble/hashes/esm/utils.js:
25
+ @noble/hashes/esm/utils.js:
26
+ (*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
27
+
28
+ @noble/curves/esm/abstract/utils.js:
29
+ @noble/curves/esm/abstract/modular.js:
30
+ @noble/curves/esm/abstract/curve.js:
31
+ @noble/curves/esm/abstract/weierstrass.js:
32
+ @noble/curves/esm/_shortw_utils.js:
33
+ @noble/curves/esm/secp256k1.js:
34
+ (*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
35
+
36
+ @scure/base/lib/esm/index.js:
37
+ (*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
38
+
39
+ @noble/ciphers/esm/utils.js:
40
+ (*! noble-ciphers - MIT License (c) 2023 Paul Miller (paulmillr.com) *)
41
+ */export{NCC05Resolver as N,NCC05Publisher as a,NCC02Resolver as b};