genosdb
Version:
GenosDB (GDB): distributed graph database in real-time, peer-to-peer, scalable storage - efficient querying of complex relationships.
1 lines • 193 kB
JavaScript
var _Y=Object.defineProperty;var bY=($,Q)=>{for(var J in Q)_Y($,J,{get:Q[J],enumerable:!0,configurable:!0,set:(Y)=>Q[J]=()=>Y})};var P$="6.15.0";var xY=function($,Q,J){const Y=Q.split("|").map((Z)=>Z.trim());for(let Z=0;Z<Y.length;Z++)switch(Q){case"any":return;case"bigint":case"boolean":case"number":case"string":if(typeof $===Q)return}const X=new Error(`invalid value for type ${Q}`);throw X.code="INVALID_ARGUMENT",X.argument=`value.${J}`,X.value=$,X};async function h0($){const Q=Object.keys($);return(await Promise.all(Q.map((Y)=>Promise.resolve($[Y])))).reduce((Y,X,Z)=>{return Y[Q[Z]]=X,Y},{})}function a($,Q,J){for(let Y in Q){let X=Q[Y];const Z=J?J[Y]:null;if(Z)xY(X,Z,Y);Object.defineProperty($,Y,{enumerable:!0,value:X,writable:!1})}}var y8=function($,Q){if($==null)return"null";if(Q==null)Q=new Set;if(typeof $==="object"){if(Q.has($))return"[Circular]";Q.add($)}if(Array.isArray($))return"[ "+$.map((J)=>y8(J,Q)).join(", ")+" ]";if($ instanceof Uint8Array){let Y="0x";for(let X=0;X<$.length;X++)Y+="0123456789abcdef"[$[X]>>4],Y+="0123456789abcdef"[$[X]&15];return Y}if(typeof $==="object"&&typeof $.toJSON==="function")return y8($.toJSON(),Q);switch(typeof $){case"boolean":case"number":case"symbol":return $.toString();case"bigint":return BigInt($).toString();case"string":return JSON.stringify($);case"object":{const J=Object.keys($);return J.sort(),"{ "+J.map((Y)=>`${y8(Y,Q)}: ${y8($[Y],Q)}`).join(", ")+" }"}}return"[ COULD NOT SERIALIZE ]"};function S$($,Q){return $&&$.code===Q}function Y$($,Q,J){let Y=$;{const Z=[];if(J){if(("message"in J)||("code"in J)||("name"in J))throw new Error(`value will overwrite populated values: ${y8(J)}`);for(let M in J){if(M==="shortMessage")continue;const q=J[M];Z.push(M+"="+y8(q))}}if(Z.push(`code=${Q}`),Z.push(`version=${P$}`),Z.length)$+=" ("+Z.join(", ")+")"}let X;switch(Q){case"INVALID_ARGUMENT":X=new TypeError($);break;case"NUMERIC_FAULT":case"BUFFER_OVERRUN":X=new RangeError($);break;default:X=new Error($)}if(a(X,{code:Q}),J)Object.assign(X,J);if(X.shortMessage==null)a(X,{shortMessage:Y});return X}function f($,Q,J,Y){if(!$)throw Y$(Q,J,Y)}function V($,Q,J,Y){f($,Q,"INVALID_ARGUMENT",{argument:J,value:Y})}function c8($){f(vY.indexOf($)>=0,"platform missing String.prototype.normalize","UNSUPPORTED_OPERATION",{operation:"String.prototype.normalize",info:{form:$}})}function n0($,Q,J){if(J==null)J="";if($!==Q){let Y=J,X="new";if(J)Y+=".",X+=" "+J;f(!1,`private constructor; use ${Y}from* methods`,"UNSUPPORTED_OPERATION",{operation:X})}}var vY=["NFD","NFC","NFKD","NFKC"].reduce(($,Q)=>{try{if("test".normalize(Q)!=="test")throw new Error("bad");if(Q==="NFD"){const J=String.fromCharCode(233).normalize("NFD"),Y=String.fromCharCode(101,769);if(J!==Y)throw new Error("broken")}$.push(Q)}catch(J){}return $},[]);var EQ=function($,Q,J){if($ instanceof Uint8Array){if(J)return new Uint8Array($);return $}if(typeof $==="string"&&$.match(/^0x(?:[0-9a-f][0-9a-f])*$/i)){const Y=new Uint8Array(($.length-2)/2);let X=2;for(let Z=0;Z<Y.length;Z++)Y[Z]=parseInt($.substring(X,X+2),16),X+=2;return Y}V(!1,"invalid BytesLike value",Q||"value",$)};function C($,Q){return EQ($,Q,!1)}function b0($,Q){return EQ($,Q,!0)}function D0($,Q){if(typeof $!=="string"||!$.match(/^0x[0-9A-Fa-f]*$/))return!1;if(typeof Q==="number"&&$.length!==2+2*Q)return!1;if(Q===!0&&$.length%2!==0)return!1;return!0}function y0($){return D0($,!0)||$ instanceof Uint8Array}function N($){const Q=C($);let J="0x";for(let Y=0;Y<Q.length;Y++){const X=Q[Y];J+=CQ[(X&240)>>4]+CQ[X&15]}return J}function l($){return"0x"+$.map((Q)=>N(Q).substring(2)).join("")}function o0($){if(D0($,!0))return($.length-2)/2;return C($).length}function u8($,Q,J){const Y=C($);if(J!=null&&J>Y.length)f(!1,"cannot slice beyond data bounds","BUFFER_OVERRUN",{buffer:Y,length:Y.length,offset:J});return N(Y.slice(Q==null?0:Q,J==null?Y.length:J))}var mY=function($,Q,J){const Y=C($);f(Q>=Y.length,"padding exceeds data length","BUFFER_OVERRUN",{buffer:new Uint8Array(Y),length:Q,offset:Q+1});const X=new Uint8Array(Q);if(X.fill(0),J)X.set(Y,Q-Y.length);else X.set(Y,0);return N(X)};function C0($,Q){return mY($,Q,!0)}var CQ="0123456789abcdef";function w$($,Q){let J=h($,"value");const Y=BigInt(q0(Q,"width")),X=C8<<Y-C8;if(J<N9){J=-J,f(J<=X,"too low","NUMERIC_FAULT",{operation:"toTwos",fault:"overflow",value:$});const Z=(C8<<Y)-C8;return(~J&Z)+C8}else f(J<X,"too high","NUMERIC_FAULT",{operation:"toTwos",fault:"overflow",value:$});return J}function A$($,Q){const J=X$($,"value"),Y=BigInt(q0(Q,"bits"));return J&(C8<<Y)-C8}function h($,Q){switch(typeof $){case"bigint":return $;case"number":return V(Number.isInteger($),"underflow",Q||"value",$),V($>=-p8&&$<=p8,"overflow",Q||"value",$),BigInt($);case"string":try{if($==="")throw new Error("empty string");if($[0]==="-"&&$[1]!=="-")return-BigInt($.substring(1));return BigInt($)}catch(J){V(!1,`invalid BigNumberish string: ${J.message}`,Q||"value",$)}}V(!1,"invalid BigNumberish value",Q||"value",$)}function X$($,Q){const J=h($,Q);return f(J>=N9,"unsigned value cannot be negative","NUMERIC_FAULT",{fault:"overflow",operation:"getUint",value:$}),J}function d8($){if($ instanceof Uint8Array){let Q="0x0";for(let J of $)Q+=PQ[J>>4],Q+=PQ[J&15];return BigInt(Q)}return h($)}function q0($,Q){switch(typeof $){case"bigint":return V($>=-p8&&$<=p8,"overflow",Q||"value",$),Number($);case"number":return V(Number.isInteger($),"underflow",Q||"value",$),V($>=-p8&&$<=p8,"overflow",Q||"value",$),$;case"string":try{if($==="")throw new Error("empty string");return q0(BigInt($),Q)}catch(J){V(!1,`invalid numeric string: ${J.message}`,Q||"value",$)}}V(!1,"invalid numeric value",Q||"value",$)}function x0($,Q){let Y=X$($,"value").toString(16);if(Q==null){if(Y.length%2)Y="0"+Y}else{const X=q0(Q,"width");f(X*2>=Y.length,`value exceeds width (${X} bytes)`,"NUMERIC_FAULT",{operation:"toBeHex",fault:"overflow",value:$});while(Y.length<X*2)Y="0"+Y}return"0x"+Y}function s($){const Q=X$($,"value");if(Q===N9)return new Uint8Array([]);let J=Q.toString(16);if(J.length%2)J="0"+J;const Y=new Uint8Array(J.length/2);for(let X=0;X<Y.length;X++){const Z=X*2;Y[X]=parseInt(J.substring(Z,Z+2),16)}return Y}function B$($){let Q=N(y0($)?$:s($)).substring(2);while(Q.startsWith("0"))Q=Q.substring(1);if(Q==="")Q="0";return"0x"+Q}var N9=BigInt(0),C8=BigInt(1),p8=9007199254740991,PQ="0123456789abcdef";var gY=function($){if(F$==null){F$={};for(let J=0;J<f$.length;J++)F$[f$[J]]=BigInt(J)}const Q=F$[$];return V(Q!=null,"invalid base58 value","letter",$),Q};function k$($){const Q=C($);let J=d8(Q),Y="";while(J)Y=f$[Number(J%C9)]+Y,J/=C9;for(let X=0;X<Q.length;X++){if(Q[X])break;Y=f$[0]+Y}return Y}function _$($){let Q=hY;for(let J=0;J<$.length;J++)Q*=C9,Q+=gY($[J]);return Q}var f$="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",F$=null,hY=BigInt(0),C9=BigInt(58);var yY=function($,Q,J,Y,X){V(!1,`invalid codepoint at offset ${Q}; ${$}`,"bytes",J)},SQ=function($,Q,J,Y,X){if($==="BAD_PREFIX"||$==="UNEXPECTED_CONTINUE"){let Z=0;for(let M=Q+1;M<J.length;M++){if(J[M]>>6!==2)break;Z++}return Z}if($==="OVERRUN")return J.length-Q-1;return 0},cY=function($,Q,J,Y,X){if($==="OVERLONG")return V(typeof X==="number","invalid bad code point for replacement","badCodepoint",X),Y.push(X),0;return Y.push(65533),SQ($,Q,J,Y,X)};function W0($,Q){if(V(typeof $==="string","invalid string value","str",$),Q!=null)c8(Q),$=$.normalize(Q);let J=[];for(let Y=0;Y<$.length;Y++){const X=$.charCodeAt(Y);if(X<128)J.push(X);else if(X<2048)J.push(X>>6|192),J.push(X&63|128);else if((X&64512)==55296){Y++;const Z=$.charCodeAt(Y);V(Y<$.length&&(Z&64512)===56320,"invalid surrogate pair","str",$);const M=65536+((X&1023)<<10)+(Z&1023);J.push(M>>18|240),J.push(M>>12&63|128),J.push(M>>6&63|128),J.push(M&63|128)}else J.push(X>>12|224),J.push(X>>6&63|128),J.push(X&63|128)}return new Uint8Array(J)}var wQ=Object.freeze({error:yY,ignore:SQ,replace:cY});var uY=function($){let Q=$.toString(16);while(Q.length<2)Q="0"+Q;return"0x"+Q},AQ=function($,Q,J){let Y=0;for(let X=0;X<J;X++)Y=Y*256+$[Q+X];return Y},BQ=function($,Q,J,Y){const X=[];while(J<Q+1+Y){const Z=FQ($,J);X.push(Z.result),J+=Z.consumed,f(J<=Q+1+Y,"child data too short","BUFFER_OVERRUN",{buffer:$,length:Y,offset:Q})}return{consumed:1+Y,result:X}},FQ=function($,Q){f($.length!==0,"data too short","BUFFER_OVERRUN",{buffer:$,length:0,offset:1});const J=(Y)=>{f(Y<=$.length,"data short segment too short","BUFFER_OVERRUN",{buffer:$,length:$.length,offset:Y})};if($[Q]>=248){const Y=$[Q]-247;J(Q+1+Y);const X=AQ($,Q+1,Y);return J(Q+1+Y+X),BQ($,Q,Q+1+Y,Y+X)}else if($[Q]>=192){const Y=$[Q]-192;return J(Q+1+Y),BQ($,Q,Q+1,Y)}else if($[Q]>=184){const Y=$[Q]-183;J(Q+1+Y);const X=AQ($,Q+1,Y);J(Q+1+Y+X);const Z=N($.slice(Q+1+Y,Q+1+Y+X));return{consumed:1+Y+X,result:Z}}else if($[Q]>=128){const Y=$[Q]-128;J(Q+1+Y);const X=N($.slice(Q+1,Q+1+Y));return{consumed:1+Y,result:X}}return{consumed:1,result:uY($[Q])}};function G8($){const Q=C($,"data"),J=FQ(Q,0);return V(J.consumed===Q.length,"unexpected junk after rlp payload","data",$),J.result}var fQ=function($){const Q=[];while($)Q.unshift($&255),$>>=8;return Q},_Q=function($){if(Array.isArray($)){let Y=[];if($.forEach(function(Z){Y=Y.concat(_Q(Z))}),Y.length<=55)return Y.unshift(192+Y.length),Y;const X=fQ(Y.length);return X.unshift(247+X.length),X.concat(Y)}const Q=Array.prototype.slice.call(C($,"object"));if(Q.length===1&&Q[0]<=127)return Q;else if(Q.length<=55)return Q.unshift(128+Q.length),Q;const J=fQ(Q.length);return J.unshift(183+J.length),J.concat(Q)};function w0($){let Q="0x";for(let J of _Q($))Q+=kQ[J>>4],Q+=kQ[J&15];return Q}var kQ="0123456789abcdef";function b$($){const Q=C($,"randomBytes");Q[6]=Q[6]&15|64,Q[8]=Q[8]&63|128;const J=N(Q);return[J.substring(2,10),J.substring(10,14),J.substring(14,18),J.substring(18,22),J.substring(22,34)].join("-")}var I0=function($){if(!Number.isSafeInteger($)||$<0)throw new Error(`Wrong positive integer: ${$}`)};var Z$=function($,...Q){if(!($ instanceof Uint8Array))throw new Error("Expected Uint8Array");if(Q.length>0&&!Q.includes($.length))throw new Error(`Expected Uint8Array of length ${Q}, not of length=${$.length}`)},x$=function($){if(typeof $!=="function"||typeof $.create!=="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");I0($.outputLen),I0($.blockLen)},i0=function($,Q=!0){if($.destroyed)throw new Error("Hash instance has been destroyed");if(Q&&$.finished)throw new Error("Hash#digest() has already been called")},v$=function($,Q){Z$($);const J=Q.outputLen;if($.length<J)throw new Error(`digestInto() expects output buffer of length at least ${J}`)};var m$=typeof globalThis==="object"&&("crypto"in globalThis)?globalThis.crypto:void 0;async function g$($,Q,J){let Y=Date.now();for(let X=0;X<$;X++){J(X);const Z=Date.now()-Y;if(Z>=0&&Z<Q)continue;await tY(),Y+=Z}}function eY($){if(typeof $!=="string")throw new Error(`utf8ToBytes expected string, got ${typeof $}`);return new Uint8Array((new TextEncoder()).encode($))}function c0($){if(typeof $==="string")$=eY($);if(!bQ($))throw new Error(`expected Uint8Array, got ${typeof $}`);return $}function xQ(...$){const Q=new Uint8Array($.reduce((Y,X)=>Y+X.length,0));let J=0;return $.forEach((Y)=>{if(!bQ(Y))throw new Error("Uint8Array expected");Q.set(Y,J),J+=Y.length}),Q}function h$($,Q){if(Q!==void 0&&$X.call(Q)!=="[object Object]")throw new Error("Options should be object or undefined");return Object.assign($,Q)}function W8($){const Q=(Y)=>$().update(c0(Y)).digest(),J=$();return Q.outputLen=J.outputLen,Q.blockLen=J.blockLen,Q.create=()=>$(),Q}function vQ($=32){if(m$&&typeof m$.getRandomValues==="function")return m$.getRandomValues(new Uint8Array($));throw new Error("crypto.getRandomValues must be defined")}/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */var bQ=($)=>$ instanceof Uint8Array;var l8=($)=>new Uint32Array($.buffer,$.byteOffset,Math.floor($.byteLength/4)),n8=($)=>new DataView($.buffer,$.byteOffset,$.byteLength),v0=($,Q)=>$<<32-Q|$>>>Q,sY=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!sY)throw new Error("Non little-endian hardware is not supported");var tY=async()=>{};class E8{clone(){return this._cloneInto()}}var $X={}.toString;class E9 extends E8{constructor($,Q){super();this.finished=!1,this.destroyed=!1,x$($);const J=c0(Q);if(this.iHash=$.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 Y=this.blockLen,X=new Uint8Array(Y);X.set(J.length>Y?$.create().update(J).digest():J);for(let Z=0;Z<X.length;Z++)X[Z]^=54;this.iHash.update(X),this.oHash=$.create();for(let Z=0;Z<X.length;Z++)X[Z]^=54^92;this.oHash.update(X),X.fill(0)}update($){return i0(this),this.iHash.update($),this}digestInto($){i0(this),Z$($,this.outputLen),this.finished=!0,this.iHash.digestInto($),this.oHash.update($),this.oHash.digestInto($),this.destroy()}digest(){const $=new Uint8Array(this.oHash.outputLen);return this.digestInto($),$}_cloneInto($){$||($=Object.create(Object.getPrototypeOf(this),{}));const{oHash:Q,iHash:J,finished:Y,destroyed:X,blockLen:Z,outputLen:M}=this;return $=$,$.finished=Y,$.destroyed=X,$.blockLen=Z,$.outputLen=M,$.oHash=Q._cloneInto($.oHash),$.iHash=J._cloneInto($.iHash),$}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}var P8=($,Q,J)=>new E9($,Q).update(J).digest();P8.create=($,Q)=>new E9($,Q);var QX=function($,Q,J,Y){x$($);const X=h$({dkLen:32,asyncTick:10},Y),{c:Z,dkLen:M,asyncTick:q}=X;if(I0(Z),I0(M),I0(q),Z<1)throw new Error("PBKDF2: iterations (c) should be >= 1");const U=c0(Q),G=c0(J),W=new Uint8Array(M),O=P8.create($,U),D=O._cloneInto().update(G);return{c:Z,dkLen:M,asyncTick:q,DK:W,PRF:O,PRFSalt:D}},JX=function($,Q,J,Y,X){if($.destroy(),Q.destroy(),Y)Y.destroy();return X.fill(0),J};function M$($,Q,J,Y){const{c:X,dkLen:Z,DK:M,PRF:q,PRFSalt:U}=QX($,Q,J,Y);let G;const W=new Uint8Array(4),O=n8(W),D=new Uint8Array(q.outputLen);for(let E=1,z=0;z<Z;E++,z+=q.outputLen){const I=M.subarray(z,z+q.outputLen);O.setInt32(0,E,!1),(G=U._cloneInto(G)).update(W).digestInto(D),I.set(D.subarray(0,I.length));for(let T=1;T<X;T++){q._cloneInto(G).update(D).digestInto(D);for(let L=0;L<I.length;L++)I[L]^=D[L]}}return JX(q,U,M,G,D)}var YX=function($,Q,J,Y){if(typeof $.setBigUint64==="function")return $.setBigUint64(Q,J,Y);const X=BigInt(32),Z=BigInt(4294967295),M=Number(J>>X&Z),q=Number(J&Z),U=Y?4:0,G=Y?0:4;$.setUint32(Q+U,M,Y),$.setUint32(Q+G,q,Y)};class S8 extends E8{constructor($,Q,J,Y){super();this.blockLen=$,this.outputLen=Q,this.padOffset=J,this.isLE=Y,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array($),this.view=n8(this.buffer)}update($){i0(this);const{view:Q,buffer:J,blockLen:Y}=this;$=c0($);const X=$.length;for(let Z=0;Z<X;){const M=Math.min(Y-this.pos,X-Z);if(M===Y){const q=n8($);for(;Y<=X-Z;Z+=Y)this.process(q,Z);continue}if(J.set($.subarray(Z,Z+M),this.pos),this.pos+=M,Z+=M,this.pos===Y)this.process(Q,0),this.pos=0}return this.length+=$.length,this.roundClean(),this}digestInto($){i0(this),v$($,this),this.finished=!0;const{buffer:Q,view:J,blockLen:Y,isLE:X}=this;let{pos:Z}=this;if(Q[Z++]=128,this.buffer.subarray(Z).fill(0),this.padOffset>Y-Z)this.process(J,0),Z=0;for(let W=Z;W<Y;W++)Q[W]=0;YX(J,Y-8,BigInt(this.length*8),X),this.process(J,0);const M=n8($),q=this.outputLen;if(q%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const U=q/4,G=this.get();if(U>G.length)throw new Error("_sha2: outputLen bigger than state");for(let W=0;W<U;W++)M.setUint32(4*W,G[W],X)}digest(){const{buffer:$,outputLen:Q}=this;this.digestInto($);const J=$.slice(0,Q);return this.destroy(),J}_cloneInto($){$||($=new this.constructor),$.set(...this.get());const{blockLen:Q,buffer:J,length:Y,finished:X,destroyed:Z,pos:M}=this;if($.length=Y,$.pos=M,$.finished=X,$.destroyed=Z,Y%Q)$.buffer.set(J);return $}}var XX=($,Q,J)=>$&Q^~$&J,ZX=($,Q,J)=>$&Q^$&J^Q&J,MX=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]),V8=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),z8=new Uint32Array(64);class mQ extends S8{constructor(){super(64,32,8,!1);this.A=V8[0]|0,this.B=V8[1]|0,this.C=V8[2]|0,this.D=V8[3]|0,this.E=V8[4]|0,this.F=V8[5]|0,this.G=V8[6]|0,this.H=V8[7]|0}get(){const{A:$,B:Q,C:J,D:Y,E:X,F:Z,G:M,H:q}=this;return[$,Q,J,Y,X,Z,M,q]}set($,Q,J,Y,X,Z,M,q){this.A=$|0,this.B=Q|0,this.C=J|0,this.D=Y|0,this.E=X|0,this.F=Z|0,this.G=M|0,this.H=q|0}process($,Q){for(let W=0;W<16;W++,Q+=4)z8[W]=$.getUint32(Q,!1);for(let W=16;W<64;W++){const O=z8[W-15],D=z8[W-2],E=v0(O,7)^v0(O,18)^O>>>3,z=v0(D,17)^v0(D,19)^D>>>10;z8[W]=z+z8[W-7]+E+z8[W-16]|0}let{A:J,B:Y,C:X,D:Z,E:M,F:q,G:U,H:G}=this;for(let W=0;W<64;W++){const O=v0(M,6)^v0(M,11)^v0(M,25),D=G+O+XX(M,q,U)+MX[W]+z8[W]|0,z=(v0(J,2)^v0(J,13)^v0(J,22))+ZX(J,Y,X)|0;G=U,U=q,q=M,M=Z+D|0,Z=X,X=Y,Y=J,J=D+z|0}J=J+this.A|0,Y=Y+this.B|0,X=X+this.C|0,Z=Z+this.D|0,M=M+this.E|0,q=q+this.F|0,U=U+this.G|0,G=G+this.H|0,this.set(J,Y,X,Z,M,q,U,G)}roundClean(){z8.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}var r0=W8(()=>new mQ);var gQ=function($,Q=!1){if(Q)return{h:Number($&y$),l:Number($>>P9&y$)};return{h:Number($>>P9&y$)|0,l:Number($&y$)|0}},S9=function($,Q=!1){let J=new Uint32Array($.length),Y=new Uint32Array($.length);for(let X=0;X<$.length;X++){const{h:Z,l:M}=gQ($[X],Q);[J[X],Y[X]]=[Z,M]}return[J,Y]},KX=function($,Q,J,Y){const X=(Q>>>0)+(Y>>>0);return{h:$+J+(X/4294967296|0)|0,l:X|0}},y$=BigInt(4294967295),P9=BigInt(32),qX=($,Q)=>BigInt($>>>0)<<P9|BigInt(Q>>>0),UX=($,Q,J)=>$>>>J,GX=($,Q,J)=>$<<32-J|Q>>>J,WX=($,Q,J)=>$>>>J|Q<<32-J,VX=($,Q,J)=>$<<32-J|Q>>>J,zX=($,Q,J)=>$<<64-J|Q>>>J-32,OX=($,Q,J)=>$>>>J-32|Q<<64-J,DX=($,Q)=>Q,IX=($,Q)=>$,w9=($,Q,J)=>$<<J|Q>>>32-J,A9=($,Q,J)=>Q<<J|$>>>32-J,B9=($,Q,J)=>Q<<J-32|$>>>64-J,F9=($,Q,J)=>$<<J-32|Q>>>64-J,RX=($,Q,J)=>($>>>0)+(Q>>>0)+(J>>>0),TX=($,Q,J,Y)=>Q+J+Y+($/4294967296|0)|0,LX=($,Q,J,Y)=>($>>>0)+(Q>>>0)+(J>>>0)+(Y>>>0),jX=($,Q,J,Y,X)=>Q+J+Y+X+($/4294967296|0)|0,HX=($,Q,J,Y,X)=>($>>>0)+(Q>>>0)+(J>>>0)+(Y>>>0)+(X>>>0),NX=($,Q,J,Y,X,Z)=>Q+J+Y+X+Z+($/4294967296|0)|0;var CX={fromBig:gQ,split:S9,toBig:qX,shrSH:UX,shrSL:GX,rotrSH:WX,rotrSL:VX,rotrBH:zX,rotrBL:OX,rotr32H:DX,rotr32L:IX,rotlSH:w9,rotlSL:A9,rotlBH:B9,rotlBL:F9,add:KX,add3L:RX,add3H:TX,add4L:LX,add4H:jX,add5H:NX,add5L:HX},x=CX;var[EX,PX]=(()=>x.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(($)=>BigInt($))))(),O8=new Uint32Array(80),D8=new Uint32Array(80);class hQ extends S8{constructor(){super(128,64,16,!1);this.Ah=1779033703|0,this.Al=4089235720|0,this.Bh=3144134277|0,this.Bl=2227873595|0,this.Ch=1013904242|0,this.Cl=4271175723|0,this.Dh=2773480762|0,this.Dl=1595750129|0,this.Eh=1359893119|0,this.El=2917565137|0,this.Fh=2600822924|0,this.Fl=725511199|0,this.Gh=528734635|0,this.Gl=4215389547|0,this.Hh=1541459225|0,this.Hl=327033209|0}get(){const{Ah:$,Al:Q,Bh:J,Bl:Y,Ch:X,Cl:Z,Dh:M,Dl:q,Eh:U,El:G,Fh:W,Fl:O,Gh:D,Gl:E,Hh:z,Hl:I}=this;return[$,Q,J,Y,X,Z,M,q,U,G,W,O,D,E,z,I]}set($,Q,J,Y,X,Z,M,q,U,G,W,O,D,E,z,I){this.Ah=$|0,this.Al=Q|0,this.Bh=J|0,this.Bl=Y|0,this.Ch=X|0,this.Cl=Z|0,this.Dh=M|0,this.Dl=q|0,this.Eh=U|0,this.El=G|0,this.Fh=W|0,this.Fl=O|0,this.Gh=D|0,this.Gl=E|0,this.Hh=z|0,this.Hl=I|0}process($,Q){for(let S=0;S<16;S++,Q+=4)O8[S]=$.getUint32(Q),D8[S]=$.getUint32(Q+=4);for(let S=16;S<80;S++){const k=O8[S-15]|0,P=D8[S-15]|0,K=x.rotrSH(k,P,1)^x.rotrSH(k,P,8)^x.shrSH(k,P,7),R=x.rotrSL(k,P,1)^x.rotrSL(k,P,8)^x.shrSL(k,P,7),j=O8[S-2]|0,w=D8[S-2]|0,B=x.rotrSH(j,w,19)^x.rotrBH(j,w,61)^x.shrSH(j,w,6),F=x.rotrSL(j,w,19)^x.rotrBL(j,w,61)^x.shrSL(j,w,6),_=x.add4L(R,F,D8[S-7],D8[S-16]),v=x.add4H(_,K,B,O8[S-7],O8[S-16]);O8[S]=v|0,D8[S]=_|0}let{Ah:J,Al:Y,Bh:X,Bl:Z,Ch:M,Cl:q,Dh:U,Dl:G,Eh:W,El:O,Fh:D,Fl:E,Gh:z,Gl:I,Hh:T,Hl:L}=this;for(let S=0;S<80;S++){const k=x.rotrSH(W,O,14)^x.rotrSH(W,O,18)^x.rotrBH(W,O,41),P=x.rotrSL(W,O,14)^x.rotrSL(W,O,18)^x.rotrBL(W,O,41),K=W&D^~W&z,R=O&E^~O&I,j=x.add5L(L,P,R,PX[S],D8[S]),w=x.add5H(j,T,k,K,EX[S],O8[S]),B=j|0,F=x.rotrSH(J,Y,28)^x.rotrBH(J,Y,34)^x.rotrBH(J,Y,39),_=x.rotrSL(J,Y,28)^x.rotrBL(J,Y,34)^x.rotrBL(J,Y,39),v=J&X^J&M^X&M,o=Y&Z^Y&q^Z&q;T=z|0,L=I|0,z=D|0,I=E|0,D=W|0,E=O|0,{h:W,l:O}=x.add(U|0,G|0,w|0,B|0),U=M|0,G=q|0,M=X|0,q=Z|0,X=J|0,Z=Y|0;const u=x.add3L(B,_,o);J=x.add3H(u,w,F,v),Y=u|0}({h:J,l:Y}=x.add(this.Ah|0,this.Al|0,J|0,Y|0)),{h:X,l:Z}=x.add(this.Bh|0,this.Bl|0,X|0,Z|0),{h:M,l:q}=x.add(this.Ch|0,this.Cl|0,M|0,q|0),{h:U,l:G}=x.add(this.Dh|0,this.Dl|0,U|0,G|0),{h:W,l:O}=x.add(this.Eh|0,this.El|0,W|0,O|0),{h:D,l:E}=x.add(this.Fh|0,this.Fl|0,D|0,E|0),{h:z,l:I}=x.add(this.Gh|0,this.Gl|0,z|0,I|0),{h:T,l:L}=x.add(this.Hh|0,this.Hl|0,T|0,L|0),this.set(J,Y,X,Z,M,q,U,G,W,O,D,E,z,I,T,L)}roundClean(){O8.fill(0),D8.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}var c$=W8(()=>new hQ);var SX=function(){if(typeof self!=="undefined")return self;if(typeof window!=="undefined")return window;if(typeof window!=="undefined")return window;throw new Error("unable to locate global object")};function f9($){switch($){case"sha256":return r0.create();case"sha512":return c$.create()}V(!1,"invalid hashing algorithm name","algorithm",$)}function uQ($,Q){const J={sha256:r0,sha512:c$}[$];return V(J!=null,"invalid hmac algorithm","algorithm",$),P8.create(J,Q)}function pQ($,Q,J,Y,X){const Z={sha256:r0,sha512:c$}[X];return V(Z!=null,"invalid pbkdf2 algorithm","algorithm",X),M$(Z,$,Q,{c:J,dkLen:Y})}function dQ($){f(cQ!=null,"platform does not support secure random numbers","UNSUPPORTED_OPERATION",{operation:"randomBytes"}),V(Number.isInteger($)&&$>0&&$<=1024,"invalid length","length",$);const Q=new Uint8Array($);return cQ.getRandomValues(Q),Q}var yQ=SX(),cQ=yQ.crypto||yQ.msCrypto;function a0($,Q,J){const Y=C(Q,"key"),X=C(J,"data");return N(oQ($,Y,X))}var lQ=!1,nQ=function($,Q,J){return uQ($,Q).update(J).digest()},oQ=nQ;a0._=nQ;a0.lock=function(){lQ=!0};a0.register=function($){if(lQ)throw new Error("computeHmac is locked");oQ=$};Object.freeze(a0);function bX($,Q=24){const J=new Uint32Array(10);for(let Y=24-Q;Y<24;Y++){for(let M=0;M<10;M++)J[M]=$[M]^$[M+10]^$[M+20]^$[M+30]^$[M+40];for(let M=0;M<10;M+=2){const q=(M+8)%10,U=(M+2)%10,G=J[U],W=J[U+1],O=iQ(G,W,1)^J[q],D=rQ(G,W,1)^J[q+1];for(let E=0;E<50;E+=10)$[M+E]^=O,$[M+E+1]^=D}let X=$[2],Z=$[3];for(let M=0;M<24;M++){const q=sQ[M],U=iQ(X,Z,q),G=rQ(X,Z,q),W=aQ[M];X=$[W],Z=$[W+1],$[W]=U,$[W+1]=G}for(let M=0;M<50;M+=10){for(let q=0;q<10;q++)J[q]=$[M+q];for(let q=0;q<10;q++)$[M+q]^=~J[(q+2)%10]&J[(q+4)%10]}$[0]^=kX[Y],$[1]^=_X[Y]}J.fill(0)}var[aQ,sQ,tQ]=[[],[],[]],wX=BigInt(0),q$=BigInt(1),AX=BigInt(2),BX=BigInt(7),FX=BigInt(256),fX=BigInt(113);for(let $=0,Q=q$,J=1,Y=0;$<24;$++){[J,Y]=[Y,(2*J+3*Y)%5],aQ.push(2*(5*Y+J)),sQ.push(($+1)*($+2)/2%64);let X=wX;for(let Z=0;Z<7;Z++)if(Q=(Q<<q$^(Q>>BX)*fX)%FX,Q&AX)X^=q$<<(q$<<BigInt(Z))-q$;tQ.push(X)}var[kX,_X]=S9(tQ,!0),iQ=($,Q,J)=>J>32?B9($,Q,J):w9($,Q,J),rQ=($,Q,J)=>J>32?F9($,Q,J):A9($,Q,J);class k9 extends E8{constructor($,Q,J,Y=!1,X=24){super();if(this.blockLen=$,this.suffix=Q,this.outputLen=J,this.enableXOF=Y,this.rounds=X,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,I0(J),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=l8(this.state)}keccak(){bX(this.state32,this.rounds),this.posOut=0,this.pos=0}update($){i0(this);const{blockLen:Q,state:J}=this;$=c0($);const Y=$.length;for(let X=0;X<Y;){const Z=Math.min(Q-this.pos,Y-X);for(let M=0;M<Z;M++)J[this.pos++]^=$[X++];if(this.pos===Q)this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:$,suffix:Q,pos:J,blockLen:Y}=this;if($[J]^=Q,(Q&128)!==0&&J===Y-1)this.keccak();$[Y-1]^=128,this.keccak()}writeInto($){i0(this,!1),Z$($),this.finish();const Q=this.state,{blockLen:J}=this;for(let Y=0,X=$.length;Y<X;){if(this.posOut>=J)this.keccak();const Z=Math.min(J-this.posOut,X-Y);$.set(Q.subarray(this.posOut,this.posOut+Z),Y),this.posOut+=Z,Y+=Z}return $}xofInto($){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto($)}xof($){return I0($),this.xofInto(new Uint8Array($))}digestInto($){if(v$($,this),this.finished)throw new Error("digest() was already called");return this.writeInto($),this.destroy(),$}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto($){const{blockLen:Q,suffix:J,outputLen:Y,rounds:X,enableXOF:Z}=this;return $||($=new k9(Q,J,Y,Z,X)),$.state32.set(this.state32),$.pos=this.pos,$.posOut=this.posOut,$.finished=this.finished,$.rounds=X,$.suffix=J,$.outputLen=Y,$.enableXOF=Z,$.destroyed=this.destroyed,$}}var xX=($,Q,J)=>W8(()=>new k9(Q,$,J));var eQ=xX(1,136,32);function d($){const Q=C($,"data");return N(JJ(Q))}var $J=!1,QJ=function($){return eQ($)},JJ=QJ;d._=QJ;d.lock=function(){$J=!0};d.register=function($){if($J)throw new TypeError("keccak256 is locked");JJ=$};Object.freeze(d);var YJ=function($,Q,J,Y){if($===0)return Q^J^Y;else if($===1)return Q&J|~Q&Y;else if($===2)return(Q|~J)^Y;else if($===3)return Q&Y|J&~Y;else return Q^(J|~Y)},vX=new Uint8Array([7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8]),XJ=Uint8Array.from({length:16},($,Q)=>Q),mX=XJ.map(($)=>(9*$+5)%16),_9=[XJ],b9=[mX];for(let $=0;$<4;$++)for(let Q of[_9,b9])Q.push(Q[$].map((J)=>vX[J]));var ZJ=[[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8],[12,13,11,15,6,9,9,7,12,15,11,13,7,8,7,7],[13,15,14,11,7,7,6,8,13,14,13,12,5,5,6,9],[14,11,12,14,8,6,5,5,15,12,15,14,9,9,8,6],[15,12,13,13,9,5,8,6,14,11,12,11,8,6,5,5]].map(($)=>new Uint8Array($)),gX=_9.map(($,Q)=>$.map((J)=>ZJ[Q][J])),hX=b9.map(($,Q)=>$.map((J)=>ZJ[Q][J])),yX=new Uint32Array([0,1518500249,1859775393,2400959708,2840853838]),cX=new Uint32Array([1352829926,1548603684,1836072691,2053994217,0]),u$=($,Q)=>$<<Q|$>>>32-Q,p$=new Uint32Array(16);class MJ extends S8{constructor(){super(64,20,8,!0);this.h0=1732584193|0,this.h1=4023233417|0,this.h2=2562383102|0,this.h3=271733878|0,this.h4=3285377520|0}get(){const{h0:$,h1:Q,h2:J,h3:Y,h4:X}=this;return[$,Q,J,Y,X]}set($,Q,J,Y,X){this.h0=$|0,this.h1=Q|0,this.h2=J|0,this.h3=Y|0,this.h4=X|0}process($,Q){for(let D=0;D<16;D++,Q+=4)p$[D]=$.getUint32(Q,!0);let J=this.h0|0,Y=J,X=this.h1|0,Z=X,M=this.h2|0,q=M,U=this.h3|0,G=U,W=this.h4|0,O=W;for(let D=0;D<5;D++){const E=4-D,z=yX[D],I=cX[D],T=_9[D],L=b9[D],S=gX[D],k=hX[D];for(let P=0;P<16;P++){const K=u$(J+YJ(D,X,M,U)+p$[T[P]]+z,S[P])+W|0;J=W,W=U,U=u$(M,10)|0,M=X,X=K}for(let P=0;P<16;P++){const K=u$(Y+YJ(E,Z,q,G)+p$[L[P]]+I,k[P])+O|0;Y=O,O=G,G=u$(q,10)|0,q=Z,Z=K}}this.set(this.h1+M+G|0,this.h2+U+O|0,this.h3+W+Y|0,this.h4+J+Z|0,this.h0+X+q|0)}roundClean(){p$.fill(0)}destroy(){this.destroyed=!0,this.buffer.fill(0),this.set(0,0,0,0,0)}}var qJ=W8(()=>new MJ);function s0($){const Q=C($,"data");return N(WJ(Q))}var UJ=!1,GJ=function($){return qJ($)},WJ=GJ;s0._=GJ;s0.lock=function(){UJ=!0};s0.register=function($){if(UJ)throw new TypeError("ripemd160 is locked");WJ=$};Object.freeze(s0);function E0($,Q,J,Y,X){const Z=C($,"password"),M=C(Q,"salt");return N(OJ(Z,M,J,Y,X))}var VJ=!1,zJ=function($,Q,J,Y,X){return pQ($,Q,J,Y,X)},OJ=zJ;E0._=zJ;E0.lock=function(){VJ=!0};E0.register=function($){if(VJ)throw new Error("pbkdf2 is locked");OJ=$};Object.freeze(E0);function Z0($){return KJ($)}var DJ=!1,IJ=function($){return new Uint8Array(dQ($))},KJ=IJ;Z0._=IJ;Z0.lock=function(){DJ=!0};Z0.register=function($){if(DJ)throw new Error("randomBytes is locked");KJ=$};Object.freeze(Z0);var RJ=function($,Q,J,Y,X,Z){let M=$[Q++]^J[Y++],q=$[Q++]^J[Y++],U=$[Q++]^J[Y++],G=$[Q++]^J[Y++],W=$[Q++]^J[Y++],O=$[Q++]^J[Y++],D=$[Q++]^J[Y++],E=$[Q++]^J[Y++],z=$[Q++]^J[Y++],I=$[Q++]^J[Y++],T=$[Q++]^J[Y++],L=$[Q++]^J[Y++],S=$[Q++]^J[Y++],k=$[Q++]^J[Y++],P=$[Q++]^J[Y++],K=$[Q++]^J[Y++],R=M,j=q,w=U,B=G,F=W,_=O,v=D,o=E,u=z,H=I,A=T,b=L,g=S,c=k,i=P,X0=K;for(let O0=0;O0<8;O0+=2)F^=p(R+g|0,7),u^=p(F+R|0,9),g^=p(u+F|0,13),R^=p(g+u|0,18),H^=p(_+j|0,7),c^=p(H+_|0,9),j^=p(c+H|0,13),_^=p(j+c|0,18),i^=p(A+v|0,7),w^=p(i+A|0,9),v^=p(w+i|0,13),A^=p(v+w|0,18),B^=p(X0+b|0,7),o^=p(B+X0|0,9),b^=p(o+B|0,13),X0^=p(b+o|0,18),j^=p(R+B|0,7),w^=p(j+R|0,9),B^=p(w+j|0,13),R^=p(B+w|0,18),v^=p(_+F|0,7),o^=p(v+_|0,9),F^=p(o+v|0,13),_^=p(F+o|0,18),b^=p(A+H|0,7),u^=p(b+A|0,9),H^=p(u+b|0,13),A^=p(H+u|0,18),g^=p(X0+i|0,7),c^=p(g+X0|0,9),i^=p(c+g|0,13),X0^=p(i+c|0,18);X[Z++]=M+R|0,X[Z++]=q+j|0,X[Z++]=U+w|0,X[Z++]=G+B|0,X[Z++]=W+F|0,X[Z++]=O+_|0,X[Z++]=D+v|0,X[Z++]=E+o|0,X[Z++]=z+u|0,X[Z++]=I+H|0,X[Z++]=T+A|0,X[Z++]=L+b|0,X[Z++]=S+g|0,X[Z++]=k+c|0,X[Z++]=P+i|0,X[Z++]=K+X0|0},o8=function($,Q,J,Y,X){let Z=Y+0,M=Y+16*X;for(let q=0;q<16;q++)J[M+q]=$[Q+(2*X-1)*16+q];for(let q=0;q<X;q++,Z+=16,Q+=16){if(RJ(J,M,$,Q,J,Z),q>0)M+=16;RJ(J,Z,$,Q+=16,J,M)}},TJ=function($,Q,J){const Y=h$({dkLen:32,asyncTick:10,maxmem:1073742848},J),{N:X,r:Z,p:M,dkLen:q,asyncTick:U,maxmem:G,onProgress:W}=Y;if(I0(X),I0(Z),I0(M),I0(q),I0(U),I0(G),W!==void 0&&typeof W!=="function")throw new Error("progressCb should be function");const O=128*Z,D=O/4;if(X<=1||(X&X-1)!==0||X>=2**(O/8)||X>4294967296)throw new Error("Scrypt: N must be larger than 1, a power of 2, less than 2^(128 * r / 8) and less than 2^32");if(M<0||M>137438953440/O)throw new Error("Scrypt: p must be a positive integer less than or equal to ((2^32 - 1) * 32) / (128 * r)");if(q<0||q>137438953440)throw new Error("Scrypt: dkLen should be positive integer less than or equal to (2^32 - 1) * 32");const E=O*(X+M);if(E>G)throw new Error(`Scrypt: parameters too large, ${E} (128 * r * (N + p)) > ${G} (maxmem)`);const z=M$(r0,$,Q,{c:1,dkLen:O*M}),I=l8(z),T=l8(new Uint8Array(O*X)),L=l8(new Uint8Array(O));let S=()=>{};if(W){const k=2*X*M,P=Math.max(Math.floor(k/1e4),1);let K=0;S=()=>{if(K++,W&&(!(K%P)||K===k))W(K/k)}}return{N:X,r:Z,p:M,dkLen:q,blockSize32:D,V:T,B32:I,B:z,tmp:L,blockMixCb:S,asyncTick:U}},LJ=function($,Q,J,Y,X){const Z=M$(r0,$,J,{c:1,dkLen:Q});return J.fill(0),Y.fill(0),X.fill(0),Z};function jJ($,Q,J){const{N:Y,r:X,p:Z,dkLen:M,blockSize32:q,V:U,B32:G,B:W,tmp:O,blockMixCb:D}=TJ($,Q,J);for(let E=0;E<Z;E++){const z=q*E;for(let I=0;I<q;I++)U[I]=G[z+I];for(let I=0,T=0;I<Y-1;I++)o8(U,T,U,T+=q,X),D();o8(U,(Y-1)*q,G,z,X),D();for(let I=0;I<Y;I++){const T=G[z+q-16]%Y;for(let L=0;L<q;L++)O[L]=G[z+L]^U[T*q+L];o8(O,0,G,z,X),D()}}return LJ($,M,W,U,O)}async function HJ($,Q,J){const{N:Y,r:X,p:Z,dkLen:M,blockSize32:q,V:U,B32:G,B:W,tmp:O,blockMixCb:D,asyncTick:E}=TJ($,Q,J);for(let z=0;z<Z;z++){const I=q*z;for(let L=0;L<q;L++)U[L]=G[I+L];let T=0;await g$(Y-1,E,()=>{o8(U,T,U,T+=q,X),D()}),o8(U,(Y-1)*q,G,I,X),D(),await g$(Y,E,()=>{const L=G[I+q-16]%Y;for(let S=0;S<q;S++)O[S]=G[I+S]^U[L*q+S];o8(O,0,G,I,X),D()})}return LJ($,M,W,U,O)}var p=($,Q)=>$<<Q|$>>>32-Q;async function t0($,Q,J,Y,X,Z,M){const q=C($,"passwd"),U=C(Q,"salt");return N(await SJ(q,U,J,Y,X,Z,M))}function e0($,Q,J,Y,X,Z){const M=C($,"passwd"),q=C(Q,"salt");return N(wJ(M,q,J,Y,X,Z))}var NJ=!1,CJ=!1,EJ=async function($,Q,J,Y,X,Z,M){return await HJ($,Q,{N:J,r:Y,p:X,dkLen:Z,onProgress:M})},PJ=function($,Q,J,Y,X,Z){return jJ($,Q,{N:J,r:Y,p:X,dkLen:Z})},SJ=EJ,wJ=PJ;t0._=EJ;t0.lock=function(){CJ=!0};t0.register=function($){if(CJ)throw new Error("scrypt is locked");SJ=$};Object.freeze(t0);e0._=PJ;e0.lock=function(){NJ=!0};e0.register=function($){if(NJ)throw new Error("scryptSync is locked");wJ=$};Object.freeze(e0);function V0($){const Q=C($,"data");return N(FJ(Q))}function U$($){const Q=C($,"data");return N(fJ(Q))}var AJ=function($){return f9("sha256").update($).digest()},BJ=function($){return f9("sha512").update($).digest()},FJ=AJ,fJ=BJ,kJ=!1,_J=!1;V0._=AJ;V0.lock=function(){kJ=!0};V0.register=function($){if(kJ)throw new Error("sha256 is locked");FJ=$};Object.freeze(V0);U$._=BJ;U$.lock=function(){_J=!0};U$.register=function($){if(_J)throw new Error("sha512 is locked");fJ=$};Object.freeze(V0);var g9={};bY(g9,{validateObject:()=>{{return K8}},utf8ToBytes:()=>{{return nX}},numberToVarBytesBE:()=>{{return dX}},numberToHexUnpadded:()=>{{return vJ}},numberToBytesLE:()=>{{return o$}},numberToBytesBE:()=>{{return I8}},hexToNumber:()=>{{return v9}},hexToBytes:()=>{{return A8}},equalBytes:()=>{{return lX}},ensureBytes:()=>{{return P0}},createHmacDrbg:()=>{{return m9}},concatBytes:()=>{{return i8}},bytesToNumberLE:()=>{{return n$}},bytesToNumberBE:()=>{{return $8}},bytesToHex:()=>{{return w8}},bitSet:()=>{{return rX}},bitMask:()=>{{return G$}},bitLen:()=>{{return oX}},bitGet:()=>{{return iX}}});function w8($){if(!l$($))throw new Error("Uint8Array expected");let Q="";for(let J=0;J<$.length;J++)Q+=pX[$[J]];return Q}function vJ($){const Q=$.toString(16);return Q.length&1?`0${Q}`:Q}function v9($){if(typeof $!=="string")throw new Error("hex string expected, got "+typeof $);return BigInt($===""?"0":`0x${$}`)}function A8($){if(typeof $!=="string")throw new Error("hex string expected, got "+typeof $);const Q=$.length;if(Q%2)throw new Error("padded hex string expected, got unpadded hex of length "+Q);const J=new Uint8Array(Q/2);for(let Y=0;Y<J.length;Y++){const X=Y*2,Z=$.slice(X,X+2),M=Number.parseInt(Z,16);if(Number.isNaN(M)||M<0)throw new Error("Invalid byte sequence");J[Y]=M}return J}function $8($){return v9(w8($))}function n$($){if(!l$($))throw new Error("Uint8Array expected");return v9(w8(Uint8Array.from($).reverse()))}function I8($,Q){return A8($.toString(16).padStart(Q*2,"0"))}function o$($,Q){return I8($,Q).reverse()}function dX($){return A8(vJ($))}function P0($,Q,J){let Y;if(typeof Q==="string")try{Y=A8(Q)}catch(Z){throw new Error(`${$} must be valid hex string, got "${Q}". Cause: ${Z}`)}else if(l$(Q))Y=Uint8Array.from(Q);else throw new Error(`${$} must be hex string or Uint8Array`);const X=Y.length;if(typeof J==="number"&&X!==J)throw new Error(`${$} expected ${J} bytes, got ${X}`);return Y}function i8(...$){const Q=new Uint8Array($.reduce((Y,X)=>Y+X.length,0));let J=0;return $.forEach((Y)=>{if(!l$(Y))throw new Error("Uint8Array expected");Q.set(Y,J),J+=Y.length}),Q}function lX($,Q){if($.length!==Q.length)return!1;for(let J=0;J<$.length;J++)if($[J]!==Q[J])return!1;return!0}function nX($){if(typeof $!=="string")throw new Error(`utf8ToBytes expected string, got ${typeof $}`);return new Uint8Array((new TextEncoder()).encode($))}function oX($){let Q;for(Q=0;$>xJ;$>>=d$,Q+=1);return Q}function iX($,Q){return $>>BigInt(Q)&d$}function m9($,Q,J){if(typeof $!=="number"||$<2)throw new Error("hashLen must be a number");if(typeof Q!=="number"||Q<2)throw new Error("qByteLen must be a number");if(typeof J!=="function")throw new Error("hmacFn must be a function");let Y=x9($),X=x9($),Z=0;const M=()=>{Y.fill(1),X.fill(0),Z=0},q=(...O)=>J(X,Y,...O),U=(O=x9())=>{if(X=q(bJ([0]),O),Y=q(),O.length===0)return;X=q(bJ([1]),O),Y=q()},G=()=>{if(Z++>=1000)throw new Error("drbg: tried 1000 values");let O=0;const D=[];while(O<Q){Y=q();const E=Y.slice();D.push(E),O+=Y.length}return i8(...D)};return(O,D)=>{M(),U(O);let E=void 0;while(!(E=D(G())))U();return M(),E}}function K8($,Q,J={}){const Y=(X,Z,M)=>{const q=aX[Z];if(typeof q!=="function")throw new Error(`Invalid validator "${Z}", expected function`);const U=$[X];if(M&&U===void 0)return;if(!q(U,$))throw new Error(`Invalid param ${String(X)}=${U} (${typeof U}), expected ${Z}`)};for(let[X,Z]of Object.entries(Q))Y(X,Z,!1);for(let[X,Z]of Object.entries(J))Y(X,Z,!0);return $}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */var xJ=BigInt(0),d$=BigInt(1),uX=BigInt(2),l$=($)=>$ instanceof Uint8Array,pX=Array.from({length:256},($,Q)=>Q.toString(16).padStart(2,"0")),rX=($,Q,J)=>{return $|(J?d$:xJ)<<BigInt(Q)},G$=($)=>(uX<<BigInt($-1))-d$,x9=($)=>new Uint8Array($),bJ=($)=>Uint8Array.from($),aX={bigint:($)=>typeof $==="bigint",function:($)=>typeof $==="function",boolean:($)=>typeof $==="boolean",string:($)=>typeof $==="string",stringOrUint8Array:($)=>typeof $==="string"||$ instanceof Uint8Array,isSafeInteger:($)=>Number.isSafeInteger($),array:($)=>Array.isArray($),field:($,Q)=>Q.Fp.isValid($),hash:($)=>typeof $==="function"&&Number.isSafeInteger($.outputLen)};function K0($,Q){const J=$%Q;return J>=M0?J:Q+J}function $Z($,Q,J){if(J<=M0||Q<M0)throw new Error("Expected power/modulo > 0");if(J===J0)return M0;let Y=J0;while(Q>M0){if(Q&J0)Y=Y*$%J;$=$*$%J,Q>>=J0}return Y}function S0($,Q,J){let Y=$;while(Q-- >M0)Y*=Y,Y%=J;return Y}function i$($,Q){if($===M0||Q<=M0)throw new Error(`invert: expected positive integers, got n=${$} mod=${Q}`);let J=K0($,Q),Y=Q,X=M0,Z=J0,M=J0,q=M0;while(J!==M0){const G=Y/J,W=Y%J,O=X-M*G,D=Z-q*G;Y=J,J=W,X=M,Z=q,M=O,q=D}if(Y!==J0)throw new Error("invert: does not exist");return K0(X,Q)}function QZ($){const Q=($-J0)/B8;let J,Y,X;for(J=$-J0,Y=0;J%B8===M0;J/=B8,Y++);for(X=B8;X<$&&$Z(X,Q,$)!==$-J0;X++);if(Y===1){const M=($+J0)/h9;return function q(U,G){const W=U.pow(G,M);if(!U.eql(U.sqr(W),G))throw new Error("Cannot find square root");return W}}const Z=(J+J0)/B8;return function M(q,U){if(q.pow(U,Q)===q.neg(q.ONE))throw new Error("Cannot find square root");let G=Y,W=q.pow(q.mul(q.ONE,X),J),O=q.pow(U,Z),D=q.pow(U,J);while(!q.eql(D,q.ONE)){if(q.eql(D,q.ZERO))return q.ZERO;let E=1;for(let I=q.sqr(D);E<G;E++){if(q.eql(I,q.ONE))break;I=q.sqr(I)}const z=q.pow(W,J0<<BigInt(G-E-1));W=q.sqr(z),O=q.mul(O,z),D=q.mul(D,W),G=E}return O}}function JZ($){if($%h9===sX){const Q=($+J0)/h9;return function J(Y,X){const Z=Y.pow(X,Q);if(!Y.eql(Y.sqr(Z),X))throw new Error("Cannot find square root");return Z}}if($%gJ===mJ){const Q=($-mJ)/gJ;return function J(Y,X){const Z=Y.mul(X,B8),M=Y.pow(Z,Q),q=Y.mul(X,M),U=Y.mul(Y.mul(q,B8),M),G=Y.mul(q,Y.sub(U,Y.ONE));if(!Y.eql(Y.sqr(G),X))throw new Error("Cannot find square root");return G}}if($%eX===tX);return QZ($)}function y9($){const Q={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},J=YZ.reduce((Y,X)=>{return Y[X]="function",Y},Q);return K8($,J)}function XZ($,Q,J){if(J<M0)throw new Error("Expected power > 0");if(J===M0)return $.ONE;if(J===J0)return Q;let Y=$.ONE,X=Q;while(J>M0){if(J&J0)Y=$.mul(Y,X);X=$.sqr(X),J>>=J0}return Y}function ZZ($,Q){const J=new Array(Q.length),Y=Q.reduce((Z,M,q)=>{if($.is0(M))return Z;return J[q]=Z,$.mul(Z,M)},$.ONE),X=$.inv(Y);return Q.reduceRight((Z,M,q)=>{if($.is0(M))return Z;return J[q]=$.mul(Z,J[q]),$.mul(Z,M)},X),J}function c9($,Q){const J=Q!==void 0?Q:$.toString(2).length,Y=Math.ceil(J/8);return{nBitLength:J,nByteLength:Y}}function hJ($,Q,J=!1,Y={}){if($<=M0)throw new Error(`Expected Field ORDER > 0, got ${$}`);const{nBitLength:X,nByteLength:Z}=c9($,Q);if(Z>2048)throw new Error("Field lengths over 2048 bytes are not supported");const M=JZ($),q=Object.freeze({ORDER:$,BITS:X,BYTES:Z,MASK:G$(X),ZERO:M0,ONE:J0,create:(U)=>K0(U,$),isValid:(U)=>{if(typeof U!=="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof U}`);return M0<=U&&U<$},is0:(U)=>U===M0,isOdd:(U)=>(U&J0)===J0,neg:(U)=>K0(-U,$),eql:(U,G)=>U===G,sqr:(U)=>K0(U*U,$),add:(U,G)=>K0(U+G,$),sub:(U,G)=>K0(U-G,$),mul:(U,G)=>K0(U*G,$),pow:(U,G)=>XZ(q,U,G),div:(U,G)=>K0(U*i$(G,$),$),sqrN:(U)=>U*U,addN:(U,G)=>U+G,subN:(U,G)=>U-G,mulN:(U,G)=>U*G,inv:(U)=>i$(U,$),sqrt:Y.sqrt||((U)=>M(q,U)),invertBatch:(U)=>ZZ(q,U),cmov:(U,G,W)=>W?G:U,toBytes:(U)=>J?o$(U,Z):I8(U,Z),fromBytes:(U)=>{if(U.length!==Z)throw new Error(`Fp.fromBytes: expected ${Z}, got ${U.length}`);return J?n$(U):$8(U)}});return Object.freeze(q)}function yJ($){if(typeof $!=="bigint")throw new Error("field order must be bigint");const Q=$.toString(2).length;return Math.ceil(Q/8)}function u9($){const Q=yJ($);return Q+Math.ceil(Q/2)}function cJ($,Q,J=!1){const Y=$.length,X=yJ(Q),Z=u9(Q);if(Y<16||Y<Z||Y>1024)throw new Error(`expected ${Z}-1024 bytes of input, got ${Y}`);const M=J?$8($):n$($),q=K0(M,Q-J0)+J0;return J?o$(q,X):I8(q,X)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */var M0=BigInt(0),J0=BigInt(1),B8=BigInt(2),sX=BigInt(3),h9=BigInt(4),mJ=BigInt(5),gJ=BigInt(8),tX=BigInt(9),eX=BigInt(16);var YZ=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function uJ($,Q){const J=(X,Z)=>{const M=Z.negate();return X?M:Z},Y=(X)=>{const Z=Math.ceil(Q/X)+1,M=2**(X-1);return{windows:Z,windowSize:M}};return{constTimeNegate:J,unsafeLadder(X,Z){let M=$.ZERO,q=X;while(Z>qZ){if(Z&p9)M=M.add(q);q=q.double(),Z>>=p9}return M},precomputeWindow(X,Z){const{windows:M,windowSize:q}=Y(Z),U=[];let G=X,W=G;for(let O=0;O<M;O++){W=G,U.push(W);for(let D=1;D<q;D++)W=W.add(G),U.push(W);G=W.double()}return U},wNAF(X,Z,M){const{windows:q,windowSize:U}=Y(X);let{ZERO:G,BASE:W}=$;const O=BigInt(2**X-1),D=2**X,E=BigInt(X);for(let z=0;z<q;z++){const I=z*U;let T=Number(M&O);if(M>>=E,T>U)T-=D,M+=p9;const L=I,S=I+Math.abs(T)-1,k=z%2!==0,P=T<0;if(T===0)W=W.add(J(k,Z[L]));else G=G.add(J(P,Z[S]))}return{p:G,f:W}},wNAFCached(X,Z,M,q){const U=X._WINDOW_SIZE||1;let G=Z.get(X);if(!G){if(G=this.precomputeWindow(X,U),U!==1)Z.set(X,q(G))}return this.wNAF(U,G,M)}}}function d9($){return y9($.Fp),K8($,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...c9($.n,$.nBitLength),...$,...{p:$.Fp.ORDER}})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */var qZ=BigInt(0),p9=BigInt(1);var UZ=function($){const Q=d9($);K8(Q,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:J,Fp:Y,a:X}=Q;if(J){if(!Y.eql(X,Y.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if(typeof J!=="object"||typeof J.beta!=="bigint"||typeof J.splitScalar!=="function")throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...Q})};function VZ($){const Q=UZ($),{Fp:J}=Q,Y=Q.toBytes||((z,I,T)=>{const L=I.toAffine();return i8(Uint8Array.from([4]),J.toBytes(L.x),J.toBytes(L.y))}),X=Q.fromBytes||((z)=>{const I=z.subarray(1),T=J.fromBytes(I.subarray(0,J.BYTES)),L=J.fromBytes(I.subarray(J.BYTES,2*J.BYTES));return{x:T,y:L}});function Z(z){const{a:I,b:T}=Q,L=J.sqr(z),S=J.mul(L,z);return J.add(J.add(S,J.mul(z,I)),T)}if(!J.eql(J.sqr(Q.Gy),Z(Q.Gx)))throw new Error("bad generator point: equation left != right");function M(z){return typeof z==="bigint"&&Q8<z&&z<Q.n}function q(z){if(!M(z))throw new Error("Expected valid bigint: 0 < bigint < curve.n")}function U(z){const{allowedPrivateKeyLengths:I,nByteLength:T,wrapPrivateKey:L,n:S}=Q;if(I&&typeof z!=="bigint"){if(z instanceof Uint8Array)z=w8(z);if(typeof z!=="string"||!I.includes(z.length))throw new Error("Invalid key");z=z.padStart(T*2,"0")}let k;try{k=typeof z==="bigint"?z:$8(P0("private key",z,T))}catch(P){throw new Error(`private key must be ${T} bytes, hex or bigint, not ${typeof z}`)}if(L)k=K0(k,S);return q(k),k}const G=new Map;function W(z){if(!(z instanceof O))throw new Error("ProjectivePoint expected")}class O{constructor(z,I,T){if(this.px=z,this.py=I,this.pz=T,z==null||!J.isValid(z))throw new Error("x required");if(I==null||!J.isValid(I))throw new Error("y required");if(T==null||!J.isValid(T))throw new Error("z required")}static fromAffine(z){const{x:I,y:T}=z||{};if(!z||!J.isValid(I)||!J.isValid(T))throw new Error("invalid affine point");if(z instanceof O)throw new Error("projective point not allowed");const L=(S)=>J.eql(S,J.ZERO);if(L(I)&&L(T))return O.ZERO;return new O(I,T,J.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(z){const I=J.invertBatch(z.map((T)=>T.pz));return z.map((T,L)=>T.toAffine(I[L])).map(O.fromAffine)}static fromHex(z){const I=O.fromAffine(X(P0("pointHex",z)));return I.assertValidity(),I}static fromPrivateKey(z){return O.BASE.multiply(U(z))}_setWindowSize(z){this._WINDOW_SIZE=z,G.delete(this)}assertValidity(){if(this.is0()){if(Q.allowInfinityPoint&&!J.is0(this.py))return;throw new Error("bad point: ZERO")}const{x:z,y:I}=this.toAffine();if(!J.isValid(z)||!J.isValid(I))throw new Error("bad point: x or y not FE");const T=J.sqr(I),L=Z(z);if(!J.eql(T,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:z}=this.toAffine();if(J.isOdd)return!J.isOdd(z);throw new Error("Field doesn't support isOdd")}equals(z){W(z);const{px:I,py:T,pz:L}=this,{px:S,py:k,pz:P}=z,K=J.eql(J.mul(I,P),J.mul(S,L)),R=J.eql(J.mul(T,P),J.mul(k,L));return K&&R}negate(){return new O(this.px,J.neg(this.py),this.pz)}double(){const{a:z,b:I}=Q,T=J.mul(I,pJ),{px:L,py:S,pz:k}=this;let{ZERO:P,ZERO:K,ZERO:R}=J,j=J.mul(L,L),w=J.mul(S,S),B=J.mul(k,k),F=J.mul(L,S);return F=J.add(F,F),R=J.mul(L,k),R=J.add(R,R),P=J.mul(z,R),K=J.mul(T,B),K=J.add(P,K),P=J.sub(w,K),K=J.add(w,K),K=J.mul(P,K),P=J.mul(F,P),R=J.mul(T,R),B=J.mul(z,B),F=J.sub(j,B),F=J.mul(z,F),F=J.add(F,R),R=J.add(j,j),j=J.add(R,j),j=J.add(j,B),j=J.mul(j,F),K=J.add(K,j),B=J.mul(S,k),B=J.add(B,B),j=J.mul(B,F),P=J.sub(P,j),R=J.mul(B,w),R=J.add(R,R),R=J.add(R,R),new O(P,K,R)}add(z){W(z);const{px:I,py:T,pz:L}=this,{px:S,py:k,pz:P}=z;let{ZERO:K,ZERO:R,ZERO:j}=J;const w=Q.a,B=J.mul(Q.b,pJ);let F=J.mul(I,S),_=J.mul(T,k),v=J.mul(L,P),o=J.add(I,T),u=J.add(S,k);o=J.mul(o,u),u=J.add(F,_),o=J.sub(o,u),u=J.add(I,L);let H=J.add(S,P);return u=J.mul(u,H),H=J.add(F,v),u=J.sub(u,H),H=J.add(T,L),K=J.add(k,P),H=J.mul(H,K),K=J.add(_,v),H=J.sub(H,K),j=J.mul(w,u),K=J.mul(B,v),j=J.add(K,j),K=J.sub(_,j),j=J.add(_,j),R=J.mul(K,j),_=J.add(F,F),_=J.add(_,F),v=J.mul(w,v),u=J.mul(B,u),_=J.add(_,v),v=J.sub(F,v),v=J.mul(w,v),u=J.add(u,v),F=J.mul(_,u),R=J.add(R,F),F=J.mul(H,u),K=J.mul(o,K),K=J.sub(K,F),F=J.mul(o,_),j=J.mul(H,j),j=J.add(j,F),new O(K,R,j)}subtract(z){return this.add(z.negate())}is0(){return this.equals(O.ZERO)}wNAF(z){return E.wNAFCached(this,G,z,(I)=>{const T=J.invertBatch(I.map((L)=>L.pz));return I.map((L,S)=>L.toAffine(T[S])).map(O.fromAffine)})}multiplyUnsafe(z){const I=O.ZERO;if(z===Q8)return I;if(q(z),z===A0)return this;const{endo:T}=Q;if(!T)return E.unsafeLadder(this,z);let{k1neg:L,k1:S,k2neg:k,k2:P}=T.splitScalar(z),K=I,R=I,j=this;while(S>Q8||P>Q8){if(S&A0)K=K.add(j);if(P&A0)R=R.add(j);j=j.double(),S>>=A0,P>>=A0}if(L)K=K.negate();if(k)R=R.negate();return R=new O(J.mul(R.px,T.beta),R.py,R.pz),K.add(R)}multiply(z){q(z);let I=z,T,L;const{endo:S}=Q;if(S){const{k1neg:k,k1:P,k2neg:K,k2:R}=S.splitScalar(I);let{p:j,f:w}=this.wNAF(P),{p:B,f:F}=this.wNAF(R);j=E.constTimeNegate(k,j),B=E.constTimeNegate(K,B),B=new O(J.mul(B.px,S.beta),B.py,B.pz),T=j.add(B),L=w.add(F)}else{const{p:k,f:P}=this.wNAF(I);T=k,L=P}return O.normalizeZ([T,L])[0]}multiplyAndAddUnsafe(z,I,T){const L=O.BASE,S=(P,K)=>K===Q8||K===A0||!P.equals(L)?P.multiplyUnsafe(K):P.multiply(K),k=S(this,I).add(S(z,T));return k.is0()?void 0:k}toAffine(z){const{px:I,py:T,pz:L}=this,S=this.is0();if(z==null)z=S?J.ONE:J.inv(L);const k=J.mul(I,z),P=J.mul(T,z),K=J.mul(L,z);if(S)return{x:J.ZERO,y:J.ZERO};if(!J.eql(K,J.ONE))throw new Error("invZ was invalid");return{x:k,y:P}}isTorsionFree(){const{h:z,isTorsionFree:I}=Q;if(z===A0)return!0;if(I)return I(O,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:z,clearCofactor:I}=Q;if(z===A0)return this;if(I)return I(O,this);return this.multiplyUnsafe(Q.h)}toRawBytes(z=!0){return this.assertValidity(),Y(O,this,z)}toHex(z=!0){return w8(this.toRawBytes(z))}}O.BASE=new O(Q.Gx,Q.Gy,J.ONE),O.ZERO=new O(J.ZERO,J.ONE,J.ZERO);const D=Q.nBitLength,E=uJ(O,Q.endo?Math.ceil(D/2):D);return{CURVE:Q,ProjectivePoint:O,normPrivateKeyToScalar:U,weierstrassEquation:Z,isWithinCurveOrder:M}}var zZ=function($){const Q=d9($);return K8(Q,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...Q})};function dJ($){const Q=zZ($),{Fp:J,n:Y}=Q,X=J.BYTES+1,Z=2*J.BYTES+1;function M(H){return Q