genosdb
Version:
GenosDB (GDB): distributed graph database in real-time, peer-to-peer, scalable storage - efficient querying of complex relationships.
1 lines • 243 kB
JavaScript
var c1=Object.defineProperty;var p1=(Q,Y)=>{for(var J in Y)c1(Q,J,{get:Y[J],enumerable:!0,configurable:!0,set:(X)=>Y[J]=()=>X})};var FQ="6.15.0";var u1=function(Q,Y,J){const X=Y.split("|").map((G)=>G.trim());for(let G=0;G<X.length;G++)switch(Y){case"any":return;case"bigint":case"boolean":case"number":case"string":if(typeof Q===Y)return}const q=new Error(`invalid value for type ${Y}`);throw q.code="INVALID_ARGUMENT",q.argument=`value.${J}`,q.value=Q,q};async function r0(Q){const Y=Object.keys(Q);return(await Promise.all(Y.map((X)=>Promise.resolve(Q[X])))).reduce((X,q,G)=>{return X[Y[G]]=q,X},{})}function s(Q,Y,J){for(let X in Y){let q=Y[X];const G=J?J[X]:null;if(G)u1(q,G,X);Object.defineProperty(Q,X,{enumerable:!0,value:q,writable:!1})}}var O9=function(Q,Y){if(Q==null)return"null";if(Y==null)Y=new Set;if(typeof Q==="object"){if(Y.has(Q))return"[Circular]";Y.add(Q)}if(Array.isArray(Q))return"[ "+Q.map((J)=>O9(J,Y)).join(", ")+" ]";if(Q instanceof Uint8Array){let X="0x";for(let q=0;q<Q.length;q++)X+="0123456789abcdef"[Q[q]>>4],X+="0123456789abcdef"[Q[q]&15];return X}if(typeof Q==="object"&&typeof Q.toJSON==="function")return O9(Q.toJSON(),Y);switch(typeof Q){case"boolean":case"number":case"symbol":return Q.toString();case"bigint":return BigInt(Q).toString();case"string":return JSON.stringify(Q);case"object":{const J=Object.keys(Q);return J.sort(),"{ "+J.map((X)=>`${O9(X,Y)}: ${O9(Q[X],Y)}`).join(", ")+" }"}}return"[ COULD NOT SERIALIZE ]"};function BQ(Q,Y){return Q&&Q.code===Y}function _9(Q,Y,J){let X=Q;{const G=[];if(J){if(("message"in J)||("code"in J)||("name"in J))throw new Error(`value will overwrite populated values: ${O9(J)}`);for(let U in J){if(U==="shortMessage")continue;const W=J[U];G.push(U+"="+O9(W))}}if(G.push(`code=${Y}`),G.push(`version=${FQ}`),G.length)Q+=" ("+G.join(", ")+")"}let q;switch(Y){case"INVALID_ARGUMENT":q=new TypeError(Q);break;case"NUMERIC_FAULT":case"BUFFER_OVERRUN":q=new RangeError(Q);break;default:q=new Error(Q)}if(s(q,{code:Y}),J)Object.assign(q,J);if(q.shortMessage==null)s(q,{shortMessage:X});return q}function x(Q,Y,J,X){if(!Q)throw _9(Y,J,X)}function O(Q,Y,J,X){x(Q,Y,"INVALID_ARGUMENT",{argument:J,value:X})}function I9(Q){x(d1.indexOf(Q)>=0,"platform missing String.prototype.normalize","UNSUPPORTED_OPERATION",{operation:"String.prototype.normalize",info:{form:Q}})}function U8(Q,Y,J){if(J==null)J="";if(Q!==Y){let X=J,q="new";if(J)X+=".",q+=" "+J;x(!1,`private constructor; use ${X}from* methods`,"UNSUPPORTED_OPERATION",{operation:q})}}var d1=["NFD","NFC","NFKD","NFKC"].reduce((Q,Y)=>{try{if("test".normalize(Y)!=="test")throw new Error("bad");if(Y==="NFD"){const J=String.fromCharCode(233).normalize("NFD"),X=String.fromCharCode(101,769);if(J!==X)throw new Error("broken")}Q.push(Y)}catch(J){}return Q},[]);var OY=function(Q,Y,J){if(Q instanceof Uint8Array){if(J)return new Uint8Array(Q);return Q}if(typeof Q==="string"&&Q.match(/^0x(?:[0-9a-f][0-9a-f])*$/i)){const X=new Uint8Array((Q.length-2)/2);let q=2;for(let G=0;G<X.length;G++)X[G]=parseInt(Q.substring(q,q+2),16),q+=2;return X}O(!1,"invalid BytesLike value",Y||"value",Q)};function N(Q,Y){return OY(Q,Y,!1)}function u0(Q,Y){return OY(Q,Y,!0)}function D0(Q,Y){if(typeof Q!=="string"||!Q.match(/^0x[0-9A-Fa-f]*$/))return!1;if(typeof Y==="number"&&Q.length!==2+2*Y)return!1;if(Y===!0&&Q.length%2!==0)return!1;return!0}function a0(Q){return D0(Q,!0)||Q instanceof Uint8Array}function T(Q){const Y=N(Q);let J="0x";for(let X=0;X<Y.length;X++){const q=Y[X];J+=jY[(q&240)>>4]+jY[q&15]}return J}function o(Q){return"0x"+Q.map((Y)=>T(Y).substring(2)).join("")}function W8(Q){if(D0(Q,!0))return(Q.length-2)/2;return N(Q).length}function L9(Q,Y,J){const X=N(Q);if(J!=null&&J>X.length)x(!1,"cannot slice beyond data bounds","BUFFER_OVERRUN",{buffer:X,length:X.length,offset:J});return T(X.slice(Y==null?0:Y,J==null?X.length:J))}var l1=function(Q,Y,J){const X=N(Q);x(Y>=X.length,"padding exceeds data length","BUFFER_OVERRUN",{buffer:new Uint8Array(X),length:Y,offset:Y+1});const q=new Uint8Array(Y);if(q.fill(0),J)q.set(X,Y-X.length);else q.set(X,0);return T(q)};function E0(Q,Y){return l1(Q,Y,!0)}var jY="0123456789abcdef";function EQ(Q,Y){let J=h(Q,"value");const X=BigInt(z0(Y,"width")),q=d8<<X-d8;if(J<gJ){J=-J,x(J<=q,"too low","NUMERIC_FAULT",{operation:"toTwos",fault:"overflow",value:Q});const G=(d8<<X)-d8;return(~J&G)+d8}else x(J<q,"too high","NUMERIC_FAULT",{operation:"toTwos",fault:"overflow",value:Q});return J}function SQ(Q,Y){const J=c9(Q,"value"),X=BigInt(z0(Y,"bits"));return J&(d8<<X)-d8}function h(Q,Y){switch(typeof Q){case"bigint":return Q;case"number":return O(Number.isInteger(Q),"underflow",Y||"value",Q),O(Q>=-D9&&Q<=D9,"overflow",Y||"value",Q),BigInt(Q);case"string":try{if(Q==="")throw new Error("empty string");if(Q[0]==="-"&&Q[1]!=="-")return-BigInt(Q.substring(1));return BigInt(Q)}catch(J){O(!1,`invalid BigNumberish string: ${J.message}`,Y||"value",Q)}}O(!1,"invalid BigNumberish value",Y||"value",Q)}function c9(Q,Y){const J=h(Q,Y);return x(J>=gJ,"unsigned value cannot be negative","NUMERIC_FAULT",{fault:"overflow",operation:"getUint",value:Q}),J}function R9(Q){if(Q instanceof Uint8Array){let Y="0x0";for(let J of Q)Y+=IY[J>>4],Y+=IY[J&15];return BigInt(Y)}return h(Q)}function z0(Q,Y){switch(typeof Q){case"bigint":return O(Q>=-D9&&Q<=D9,"overflow",Y||"value",Q),Number(Q);case"number":return O(Number.isInteger(Q),"underflow",Y||"value",Q),O(Q>=-D9&&Q<=D9,"overflow",Y||"value",Q),Q;case"string":try{if(Q==="")throw new Error("empty string");return z0(BigInt(Q),Y)}catch(J){O(!1,`invalid numeric string: ${J.message}`,Y||"value",Q)}}O(!1,"invalid numeric value",Y||"value",Q)}function d0(Q,Y){let X=c9(Q,"value").toString(16);if(Y==null){if(X.length%2)X="0"+X}else{const q=z0(Y,"width");x(q*2>=X.length,`value exceeds width (${q} bytes)`,"NUMERIC_FAULT",{operation:"toBeHex",fault:"overflow",value:Q});while(X.length<q*2)X="0"+X}return"0x"+X}function t(Q){const Y=c9(Q,"value");if(Y===gJ)return new Uint8Array([]);let J=Y.toString(16);if(J.length%2)J="0"+J;const X=new Uint8Array(J.length/2);for(let q=0;q<X.length;q++){const G=q*2;X[q]=parseInt(J.substring(G,G+2),16)}return X}function AQ(Q){let Y=T(a0(Q)?Q:t(Q)).substring(2);while(Y.startsWith("0"))Y=Y.substring(1);if(Y==="")Y="0";return"0x"+Y}var gJ=BigInt(0),d8=BigInt(1),D9=9007199254740991,IY="0123456789abcdef";var i1=function(Q){if(kQ==null){kQ={};for(let J=0;J<xQ.length;J++)kQ[xQ[J]]=BigInt(J)}const Y=kQ[Q];return O(Y!=null,"invalid base58 value","letter",Q),Y};function fQ(Q){const Y=N(Q);let J=R9(Y),X="";while(J)X=xQ[Number(J%yJ)]+X,J/=yJ;for(let q=0;q<Y.length;q++){if(Y[q])break;X=xQ[0]+X}return X}function bQ(Q){let Y=n1;for(let J=0;J<Q.length;J++)Y*=yJ,Y+=i1(Q[J]);return Y}var xQ="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",kQ=null,n1=BigInt(0),yJ=BigInt(58);var o1=function(Q,Y,J,X,q){O(!1,`invalid codepoint at offset ${Y}; ${Q}`,"bytes",J)},LY=function(Q,Y,J,X,q){if(Q==="BAD_PREFIX"||Q==="UNEXPECTED_CONTINUE"){let G=0;for(let U=Y+1;U<J.length;U++){if(J[U]>>6!==2)break;G++}return G}if(Q==="OVERRUN")return J.length-Y-1;return 0},r1=function(Q,Y,J,X,q){if(Q==="OVERLONG")return O(typeof q==="number","invalid bad code point for replacement","badCodepoint",q),X.push(q),0;return X.push(65533),LY(Q,Y,J,X,q)},a1=function(Q,Y){if(Y==null)Y=hJ.error;const J=N(Q,"bytes"),X=[];let q=0;while(q<J.length){const G=J[q++];if(G>>7===0){X.push(G);continue}let U=null,W=null;if((G&224)===192)U=1,W=127;else if((G&240)===224)U=2,W=2047;else if((G&248)===240)U=3,W=65535;else{if((G&192)===128)q+=Y("UNEXPECTED_CONTINUE",q-1,J,X);else q+=Y("BAD_PREFIX",q-1,J,X);continue}if(q-1+U>=J.length){q+=Y("OVERRUN",q-1,J,X);continue}let z=G&(1<<8-U-1)-1;for(let V=0;V<U;V++){let $=J[q];if(($&192)!=128){q+=Y("MISSING_CONTINUE",q,J,X),z=null;break}z=z<<6|$&63,q++}if(z===null)continue;if(z>1114111){q+=Y("OUT_OF_RANGE",q-1-U,J,X,z);continue}if(z>=55296&&z<=57343){q+=Y("UTF16_SURROGATE",q-1-U,J,X,z);continue}if(z<=W){q+=Y("OVERLONG",q-1-U,J,X,z);continue}X.push(z)}return X};function $0(Q,Y){if(O(typeof Q==="string","invalid string value","str",Q),Y!=null)I9(Y),Q=Q.normalize(Y);let J=[];for(let X=0;X<Q.length;X++){const q=Q.charCodeAt(X);if(q<128)J.push(q);else if(q<2048)J.push(q>>6|192),J.push(q&63|128);else if((q&64512)==55296){X++;const G=Q.charCodeAt(X);O(X<Q.length&&(G&64512)===56320,"invalid surrogate pair","str",Q);const U=65536+((q&1023)<<10)+(G&1023);J.push(U>>18|240),J.push(U>>12&63|128),J.push(U>>6&63|128),J.push(U&63|128)}else J.push(q>>12|224),J.push(q>>6&63|128),J.push(q&63|128)}return new Uint8Array(J)}var s1=function(Q){return Q.map((Y)=>{if(Y<=65535)return String.fromCharCode(Y);return Y-=65536,String.fromCharCode((Y>>10&1023)+55296,(Y&1023)+56320)}).join("")};function vQ(Q,Y){return s1(a1(Q,Y))}var hJ=Object.freeze({error:o1,ignore:LY,replace:r1});var t1=function(Q){let Y=Q.toString(16);while(Y.length<2)Y="0"+Y;return"0x"+Y},DY=function(Q,Y,J){let X=0;for(let q=0;q<J;q++)X=X*256+Q[Y+q];return X},RY=function(Q,Y,J,X){const q=[];while(J<Y+1+X){const G=HY(Q,J);q.push(G.result),J+=G.consumed,x(J<=Y+1+X,"child data too short","BUFFER_OVERRUN",{buffer:Q,length:X,offset:Y})}return{consumed:1+X,result:q}},HY=function(Q,Y){x(Q.length!==0,"data too short","BUFFER_OVERRUN",{buffer:Q,length:0,offset:1});const J=(X)=>{x(X<=Q.length,"data short segment too short","BUFFER_OVERRUN",{buffer:Q,length:Q.length,offset:X})};if(Q[Y]>=248){const X=Q[Y]-247;J(Y+1+X);const q=DY(Q,Y+1,X);return J(Y+1+X+q),RY(Q,Y,Y+1+X,X+q)}else if(Q[Y]>=192){const X=Q[Y]-192;return J(Y+1+X),RY(Q,Y,Y+1,X)}else if(Q[Y]>=184){const X=Q[Y]-183;J(Y+1+X);const q=DY(Q,Y+1,X);J(Y+1+X+q);const G=T(Q.slice(Y+1+X,Y+1+X+q));return{consumed:1+X+q,result:G}}else if(Q[Y]>=128){const X=Q[Y]-128;J(Y+1+X);const q=T(Q.slice(Y+1,Y+1+X));return{consumed:1+X,result:q}}return{consumed:1,result:t1(Q[Y])}};function F8(Q){const Y=N(Q,"data"),J=HY(Y,0);return O(J.consumed===Y.length,"unexpected junk after rlp payload","data",Q),J.result}var PY=function(Q){const Y=[];while(Q)Y.unshift(Q&255),Q>>=8;return Y},TY=function(Q){if(Array.isArray(Q)){let X=[];if(Q.forEach(function(G){X=X.concat(TY(G))}),X.length<=55)return X.unshift(192+X.length),X;const q=PY(X.length);return q.unshift(247+q.length),q.concat(X)}const Y=Array.prototype.slice.call(N(Q,"object"));if(Y.length===1&&Y[0]<=127)return Y;else if(Y.length<=55)return Y.unshift(128+Y.length),Y;const J=PY(Y.length);return J.unshift(183+J.length),J.concat(Y)};function b0(Q){let Y="0x";for(let J of TY(Q))Y+=CY[J>>4],Y+=CY[J&15];return Y}var CY="0123456789abcdef";function gQ(Q){const Y=N(Q,"randomBytes");Y[6]=Y[6]&15|64,Y[8]=Y[8]&63|128;const J=T(Y);return[J.substring(2,10),J.substring(10,14),J.substring(14,18),J.substring(18,22),J.substring(22,34)].join("-")}var R0=function(Q){if(!Number.isSafeInteger(Q)||Q<0)throw new Error(`Wrong positive integer: ${Q}`)};var p9=function(Q,...Y){if(!(Q instanceof Uint8Array))throw new Error("Expected Uint8Array");if(Y.length>0&&!Y.includes(Q.length))throw new Error(`Expected Uint8Array of length ${Y}, not of length=${Q.length}`)},yQ=function(Q){if(typeof Q!=="function"||typeof Q.create!=="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");R0(Q.outputLen),R0(Q.blockLen)},V8=function(Q,Y=!0){if(Q.destroyed)throw new Error("Hash instance has been destroyed");if(Y&&Q.finished)throw new Error("Hash#digest() has already been called")},hQ=function(Q,Y){p9(Q);const J=Y.outputLen;if(Q.length<J)throw new Error(`digestInto() expects output buffer of length at least ${J}`)};var mQ=typeof globalThis==="object"&&("crypto"in globalThis)?globalThis.crypto:void 0;async function _Q(Q,Y,J){let X=Date.now();for(let q=0;q<Q;q++){J(q);const G=Date.now()-X;if(G>=0&&G<Y)continue;await W7(),X+=G}}function V7(Q){if(typeof Q!=="string")throw new Error(`utf8ToBytes expected string, got ${typeof Q}`);return new Uint8Array((new TextEncoder()).encode(Q))}function s0(Q){if(typeof Q==="string")Q=V7(Q);if(!NY(Q))throw new Error(`expected Uint8Array, got ${typeof Q}`);return Q}function wY(...Q){const Y=new Uint8Array(Q.reduce((X,q)=>X+q.length,0));let J=0;return Q.forEach((X)=>{if(!NY(X))throw new Error("Uint8Array expected");Y.set(X,J),J+=X.length}),Y}function cQ(Q,Y){if(Y!==void 0&&z7.call(Y)!=="[object Object]")throw new Error("Options should be object or undefined");return Object.assign(Q,Y)}function B8(Q){const Y=(X)=>Q().update(s0(X)).digest(),J=Q();return Y.outputLen=J.outputLen,Y.blockLen=J.blockLen,Y.create=()=>Q(),Y}function FY(Q=32){if(mQ&&typeof mQ.getRandomValues==="function")return mQ.getRandomValues(new Uint8Array(Q));throw new Error("crypto.getRandomValues must be defined")}/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */var NY=(Q)=>Q instanceof Uint8Array;var H9=(Q)=>new Uint32Array(Q.buffer,Q.byteOffset,Math.floor(Q.byteLength/4)),P9=(Q)=>new DataView(Q.buffer,Q.byteOffset,Q.byteLength),l0=(Q,Y)=>Q<<32-Y|Q>>>Y,U7=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!U7)throw new Error("Non little-endian hardware is not supported");var W7=async()=>{};class l8{clone(){return this._cloneInto()}}var z7={}.toString;class mJ extends l8{constructor(Q,Y){super();this.finished=!1,this.destroyed=!1,yQ(Q);const J=s0(Y);if(this.iHash=Q.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 X=this.blockLen,q=new Uint8Array(X);q.set(J.length>X?Q.create().update(J).digest():J);for(let G=0;G<q.length;G++)q[G]^=54;this.iHash.update(q),this.oHash=Q.create();for(let G=0;G<q.length;G++)q[G]^=54^92;this.oHash.update(q),q.fill(0)}update(Q){return V8(this),this.iHash.update(Q),this}digestInto(Q){V8(this),p9(Q,this.outputLen),this.finished=!0,this.iHash.digestInto(Q),this.oHash.update(Q),this.oHash.digestInto(Q),this.destroy()}digest(){const Q=new Uint8Array(this.oHash.outputLen);return this.digestInto(Q),Q}_cloneInto(Q){Q||(Q=Object.create(Object.getPrototypeOf(this),{}));const{oHash:Y,iHash:J,finished:X,destroyed:q,blockLen:G,outputLen:U}=this;return Q=Q,Q.finished=X,Q.destroyed=q,Q.blockLen=G,Q.outputLen=U,Q.oHash=Y._cloneInto(Q.oHash),Q.iHash=J._cloneInto(Q.iHash),Q}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}var i8=(Q,Y,J)=>new mJ(Q,Y).update(J).digest();i8.create=(Q,Y)=>new mJ(Q,Y);var $7=function(Q,Y,J,X){yQ(Q);const q=cQ({dkLen:32,asyncTick:10},X),{c:G,dkLen:U,asyncTick:W}=q;if(R0(G),R0(U),R0(W),G<1)throw new Error("PBKDF2: iterations (c) should be >= 1");const z=s0(Y),V=s0(J),$=new Uint8Array(U),M=i8.create(Q,z),K=M._cloneInto().update(V);return{c:G,dkLen:U,asyncTick:W,DK:$,PRF:M,PRFSalt:K}},Z7=function(Q,Y,J,X,q){if(Q.destroy(),Y.destroy(),X)X.destroy();return q.fill(0),J};function u9(Q,Y,J,X){const{c:q,dkLen:G,DK:U,PRF:W,PRFSalt:z}=$7(Q,Y,J,X);let V;const $=new Uint8Array(4),M=P9($),K=new Uint8Array(W.outputLen);for(let j=1,Z=0;Z<G;j++,Z+=W.outputLen){const I=U.subarray(Z,Z+W.outputLen);M.setInt32(0,j,!1),(V=z._cloneInto(V)).update($).digestInto(K),I.set(K.subarray(0,I.length));for(let L=1;L<q;L++){W._cloneInto(V).update(K).digestInto(K);for(let D=0;D<I.length;D++)I[D]^=K[D]}}return Z7(W,z,U,V,K)}var M7=function(Q,Y,J,X){if(typeof Q.setBigUint64==="function")return Q.setBigUint64(Y,J,X);const q=BigInt(32),G=BigInt(4294967295),U=Number(J>>q&G),W=Number(J&G),z=X?4:0,V=X?0:4;Q.setUint32(Y+z,U,X),Q.setUint32(Y+V,W,X)};class n8 extends l8{constructor(Q,Y,J,X){super();this.blockLen=Q,this.outputLen=Y,this.padOffset=J,this.isLE=X,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(Q),this.view=P9(this.buffer)}update(Q){V8(this);const{view:Y,buffer:J,blockLen:X}=this;Q=s0(Q);const q=Q.length;for(let G=0;G<q;){const U=Math.min(X-this.pos,q-G);if(U===X){const W=P9(Q);for(;X<=q-G;G+=X)this.process(W,G);continue}if(J.set(Q.subarray(G,G+U),this.pos),this.pos+=U,G+=U,this.pos===X)this.process(Y,0),this.pos=0}return this.length+=Q.length,this.roundClean(),this}digestInto(Q){V8(this),hQ(Q,this),this.finished=!0;const{buffer:Y,view:J,blockLen:X,isLE:q}=this;let{pos:G}=this;if(Y[G++]=128,this.buffer.subarray(G).fill(0),this.padOffset>X-G)this.process(J,0),G=0;for(let $=G;$<X;$++)Y[$]=0;M7(J,X-8,BigInt(this.length*8),q),this.process(J,0);const U=P9(Q),W=this.outputLen;if(W%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const z=W/4,V=this.get();if(z>V.length)throw new Error("_sha2: outputLen bigger than state");for(let $=0;$<z;$++)U.setUint32(4*$,V[$],q)}digest(){const{buffer:Q,outputLen:Y}=this;this.digestInto(Q);const J=Q.slice(0,Y);return this.destroy(),J}_cloneInto(Q){Q||(Q=new this.constructor),Q.set(...this.get());const{blockLen:Y,buffer:J,length:X,finished:q,destroyed:G,pos:U}=this;if(Q.length=X,Q.pos=U,Q.finished=q,Q.destroyed=G,X%Y)Q.buffer.set(J);return Q}}var K7=(Q,Y,J)=>Q&Y^~Q&J,j7=(Q,Y,J)=>Q&Y^Q&J^Y&J,O7=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]),E8=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),S8=new Uint32Array(64);class BY extends n8{constructor(){super(64,32,8,!1);this.A=E8[0]|0,this.B=E8[1]|0,this.C=E8[2]|0,this.D=E8[3]|0,this.E=E8[4]|0,this.F=E8[5]|0,this.G=E8[6]|0,this.H=E8[7]|0}get(){const{A:Q,B:Y,C:J,D:X,E:q,F:G,G:U,H:W}=this;return[Q,Y,J,X,q,G,U,W]}set(Q,Y,J,X,q,G,U,W){this.A=Q|0,this.B=Y|0,this.C=J|0,this.D=X|0,this.E=q|0,this.F=G|0,this.G=U|0,this.H=W|0}process(Q,Y){for(let $=0;$<16;$++,Y+=4)S8[$]=Q.getUint32(Y,!1);for(let $=16;$<64;$++){const M=S8[$-15],K=S8[$-2],j=l0(M,7)^l0(M,18)^M>>>3,Z=l0(K,17)^l0(K,19)^K>>>10;S8[$]=Z+S8[$-7]+j+S8[$-16]|0}let{A:J,B:X,C:q,D:G,E:U,F:W,G:z,H:V}=this;for(let $=0;$<64;$++){const M=l0(U,6)^l0(U,11)^l0(U,25),K=V+M+K7(U,W,z)+O7[$]+S8[$]|0,Z=(l0(J,2)^l0(J,13)^l0(J,22))+j7(J,X,q)|0;V=z,z=W,W=U,U=G+K|0,G=q,q=X,X=J,J=K+Z|0}J=J+this.A|0,X=X+this.B|0,q=q+this.C|0,G=G+this.D|0,U=U+this.E|0,W=W+this.F|0,z=z+this.G|0,V=V+this.H|0,this.set(J,X,q,G,U,W,z,V)}roundClean(){S8.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}var z8=B8(()=>new BY);var EY=function(Q,Y=!1){if(Y)return{h:Number(Q&pQ),l:Number(Q>>_J&pQ)};return{h:Number(Q>>_J&pQ)|0,l:Number(Q&pQ)|0}},cJ=function(Q,Y=!1){let J=new Uint32Array(Q.length),X=new Uint32Array(Q.length);for(let q=0;q<Q.length;q++){const{h:G,l:U}=EY(Q[q],Y);[J[q],X[q]]=[G,U]}return[J,X]},w7=function(Q,Y,J,X){const q=(Y>>>0)+(X>>>0);return{h:Q+J+(q/4294967296|0)|0,l:q|0}},pQ=BigInt(4294967295),_J=BigInt(32),I7=(Q,Y)=>BigInt(Q>>>0)<<_J|BigInt(Y>>>0),L7=(Q,Y,J)=>Q>>>J,D7=(Q,Y,J)=>Q<<32-J|Y>>>J,R7=(Q,Y,J)=>Q>>>J|Y<<32-J,H7=(Q,Y,J)=>Q<<32-J|Y>>>J,P7=(Q,Y,J)=>Q<<64-J|Y>>>J-32,C7=(Q,Y,J)=>Q>>>J-32|Y<<64-J,T7=(Q,Y)=>Y,N7=(Q,Y)=>Q,pJ=(Q,Y,J)=>Q<<J|Y>>>32-J,uJ=(Q,Y,J)=>Y<<J|Q>>>32-J,dJ=(Q,Y,J)=>Y<<J-32|Q>>>64-J,lJ=(Q,Y,J)=>Q<<J-32|Y>>>64-J,F7=(Q,Y,J)=>(Q>>>0)+(Y>>>0)+(J>>>0),B7=(Q,Y,J,X)=>Y+J+X+(Q/4294967296|0)|0,E7=(Q,Y,J,X)=>(Q>>>0)+(Y>>>0)+(J>>>0)+(X>>>0),S7=(Q,Y,J,X,q)=>Y+J+X+q+(Q/4294967296|0)|0,A7=(Q,Y,J,X,q)=>(Q>>>0)+(Y>>>0)+(J>>>0)+(X>>>0)+(q>>>0),k7=(Q,Y,J,X,q,G)=>Y+J+X+q+G+(Q/4294967296|0)|0;var x7={fromBig:EY,split:cJ,toBig:I7,shrSH:L7,shrSL:D7,rotrSH:R7,rotrSL:H7,rotrBH:P7,rotrBL:C7,rotr32H:T7,rotr32L:N7,rotlSH:pJ,rotlSL:uJ,rotlBH:dJ,rotlBL:lJ,add:w7,add3L:F7,add3H:B7,add4L:E7,add4H:S7,add5H:k7,add5L:A7},v=x7;var[f7,b7]=(()=>v.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((Q)=>BigInt(Q))))(),A8=new Uint32Array(80),k8=new Uint32Array(80);class SY extends n8{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:Q,Al:Y,Bh:J,Bl:X,Ch:q,Cl:G,Dh:U,Dl:W,Eh:z,El:V,Fh:$,Fl:M,Gh:K,Gl:j,Hh:Z,Hl:I}=this;return[Q,Y,J,X,q,G,U,W,z,V,$,M,K,j,Z,I]}set(Q,Y,J,X,q,G,U,W,z,V,$,M,K,j,Z,I){this.Ah=Q|0,this.Al=Y|0,this.Bh=J|0,this.Bl=X|0,this.Ch=q|0,this.Cl=G|0,this.Dh=U|0,this.Dl=W|0,this.Eh=z|0,this.El=V|0,this.Fh=$|0,this.Fl=M|0,this.Gh=K|0,this.Gl=j|0,this.Hh=Z|0,this.Hl=I|0}process(Q,Y){for(let H=0;H<16;H++,Y+=4)A8[H]=Q.getUint32(Y),k8[H]=Q.getUint32(Y+=4);for(let H=16;H<80;H++){const F=A8[H-15]|0,R=k8[H-15]|0,C=v.rotrSH(F,R,1)^v.rotrSH(F,R,8)^v.shrSH(F,R,7),E=v.rotrSL(F,R,1)^v.rotrSL(F,R,8)^v.shrSL(F,R,7),P=A8[H-2]|0,f=k8[H-2]|0,S=v.rotrSH(P,f,19)^v.rotrBH(P,f,61)^v.shrSH(P,f,6),B=v.rotrSL(P,f,19)^v.rotrBL(P,f,61)^v.shrSL(P,f,6),k=v.add4L(E,B,k8[H-7],k8[H-16]),c=v.add4H(k,C,S,A8[H-7],A8[H-16]);A8[H]=c|0,k8[H]=k|0}let{Ah:J,Al:X,Bh:q,Bl:G,Ch:U,Cl:W,Dh:z,Dl:V,Eh:$,El:M,Fh:K,Fl:j,Gh:Z,Gl:I,Hh:L,Hl:D}=this;for(let H=0;H<80;H++){const F=v.rotrSH($,M,14)^v.rotrSH($,M,18)^v.rotrBH($,M,41),R=v.rotrSL($,M,14)^v.rotrSL($,M,18)^v.rotrBL($,M,41),C=$&K^~$&Z,E=M&j^~M&I,P=v.add5L(D,R,E,b7[H],k8[H]),f=v.add5H(P,L,F,C,f7[H],A8[H]),S=P|0,B=v.rotrSH(J,X,28)^v.rotrBH(J,X,34)^v.rotrBH(J,X,39),k=v.rotrSL(J,X,28)^v.rotrBL(J,X,34)^v.rotrBL(J,X,39),c=J&q^J&U^q&U,G0=X&G^X&W^G&W;L=Z|0,D=I|0,Z=K|0,I=j|0,K=$|0,j=M|0,{h:$,l:M}=v.add(z|0,V|0,f|0,S|0),z=U|0,V=W|0,U=q|0,W=G|0,q=J|0,G=X|0;const p=v.add3L(S,k,G0);J=v.add3H(p,f,B,c),X=p|0}({h:J,l:X}=v.add(this.Ah|0,this.Al|0,J|0,X|0)),{h:q,l:G}=v.add(this.Bh|0,this.Bl|0,q|0,G|0),{h:U,l:W}=v.add(this.Ch|0,this.Cl|0,U|0,W|0),{h:z,l:V}=v.add(this.Dh|0,this.Dl|0,z|0,V|0),{h:$,l:M}=v.add(this.Eh|0,this.El|0,$|0,M|0),{h:K,l:j}=v.add(this.Fh|0,this.Fl|0,K|0,j|0),{h:Z,l:I}=v.add(this.Gh|0,this.Gl|0,Z|0,I|0),{h:L,l:D}=v.add(this.Hh|0,this.Hl|0,L|0,D|0),this.set(J,X,q,G,U,W,z,V,$,M,K,j,Z,I,L,D)}roundClean(){A8.fill(0),k8.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 uQ=B8(()=>new SY);var v7=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 iJ(Q){switch(Q){case"sha256":return z8.create();case"sha512":return uQ.create()}O(!1,"invalid hashing algorithm name","algorithm",Q)}function xY(Q,Y){const J={sha256:z8,sha512:uQ}[Q];return O(J!=null,"invalid hmac algorithm","algorithm",Q),i8.create(J,Y)}function fY(Q,Y,J,X,q){const G={sha256:z8,sha512:uQ}[q];return O(G!=null,"invalid pbkdf2 algorithm","algorithm",q),u9(G,Q,Y,{c:J,dkLen:X})}function bY(Q){x(kY!=null,"platform does not support secure random numbers","UNSUPPORTED_OPERATION",{operation:"randomBytes"}),O(Number.isInteger(Q)&&Q>0&&Q<=1024,"invalid length","length",Q);const Y=new Uint8Array(Q);return kY.getRandomValues(Y),Y}var AY=v7(),kY=AY.crypto||AY.msCrypto;function $8(Q,Y,J){const X=N(Y,"key"),q=N(J,"data");return T(yY(Q,X,q))}var vY=!1,gY=function(Q,Y,J){return xY(Q,Y).update(J).digest()},yY=gY;$8._=gY;$8.lock=function(){vY=!0};$8.register=function(Q){if(vY)throw new Error("computeHmac is locked");yY=Q};Object.freeze($8);function u7(Q,Y=24){const J=new Uint32Array(10);for(let X=24-Y;X<24;X++){for(let U=0;U<10;U++)J[U]=Q[U]^Q[U+10]^Q[U+20]^Q[U+30]^Q[U+40];for(let U=0;U<10;U+=2){const W=(U+8)%10,z=(U+2)%10,V=J[z],$=J[z+1],M=hY(V,$,1)^J[W],K=mY(V,$,1)^J[W+1];for(let j=0;j<50;j+=10)Q[U+j]^=M,Q[U+j+1]^=K}let q=Q[2],G=Q[3];for(let U=0;U<24;U++){const W=cY[U],z=hY(q,G,W),V=mY(q,G,W),$=_Y[U];q=Q[$],G=Q[$+1],Q[$]=z,Q[$+1]=V}for(let U=0;U<50;U+=10){for(let W=0;W<10;W++)J[W]=Q[U+W];for(let W=0;W<10;W++)Q[U+W]^=~J[(W+2)%10]&J[(W+4)%10]}Q[0]^=c7[X],Q[1]^=p7[X]}J.fill(0)}var[_Y,cY,pY]=[[],[],[]],g7=BigInt(0),d9=BigInt(1),y7=BigInt(2),h7=BigInt(7),m7=BigInt(256),_7=BigInt(113);for(let Q=0,Y=d9,J=1,X=0;Q<24;Q++){[J,X]=[X,(2*J+3*X)%5],_Y.push(2*(5*X+J)),cY.push((Q+1)*(Q+2)/2%64);let q=g7;for(let G=0;G<7;G++)if(Y=(Y<<d9^(Y>>h7)*_7)%m7,Y&y7)q^=d9<<(d9<<BigInt(G))-d9;pY.push(q)}var[c7,p7]=cJ(pY,!0),hY=(Q,Y,J)=>J>32?dJ(Q,Y,J):pJ(Q,Y,J),mY=(Q,Y,J)=>J>32?lJ(Q,Y,J):uJ(Q,Y,J);class nJ extends l8{constructor(Q,Y,J,X=!1,q=24){super();if(this.blockLen=Q,this.suffix=Y,this.outputLen=J,this.enableXOF=X,this.rounds=q,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,R0(J),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=H9(this.state)}keccak(){u7(this.state32,this.rounds),this.posOut=0,this.pos=0}update(Q){V8(this);const{blockLen:Y,state:J}=this;Q=s0(Q);const X=Q.length;for(let q=0;q<X;){const G=Math.min(Y-this.pos,X-q);for(let U=0;U<G;U++)J[this.pos++]^=Q[q++];if(this.pos===Y)this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:Q,suffix:Y,pos:J,blockLen:X}=this;if(Q[J]^=Y,(Y&128)!==0&&J===X-1)this.keccak();Q[X-1]^=128,this.keccak()}writeInto(Q){V8(this,!1),p9(Q),this.finish();const Y=this.state,{blockLen:J}=this;for(let X=0,q=Q.length;X<q;){if(this.posOut>=J)this.keccak();const G=Math.min(J-this.posOut,q-X);Q.set(Y.subarray(this.posOut,this.posOut+G),X),this.posOut+=G,X+=G}return Q}xofInto(Q){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(Q)}xof(Q){return R0(Q),this.xofInto(new Uint8Array(Q))}digestInto(Q){if(hQ(Q,this),this.finished)throw new Error("digest() was already called");return this.writeInto(Q),this.destroy(),Q}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(Q){const{blockLen:Y,suffix:J,outputLen:X,rounds:q,enableXOF:G}=this;return Q||(Q=new nJ(Y,J,X,G,q)),Q.state32.set(this.state32),Q.pos=this.pos,Q.posOut=this.posOut,Q.finished=this.finished,Q.rounds=q,Q.suffix=J,Q.outputLen=X,Q.enableXOF=G,Q.destroyed=this.destroyed,Q}}var d7=(Q,Y,J)=>B8(()=>new nJ(Y,Q,J));var uY=d7(1,136,32);function i(Q){const Y=N(Q,"data");return T(iY(Y))}var dY=!1,lY=function(Q){return uY(Q)},iY=lY;i._=lY;i.lock=function(){dY=!0};i.register=function(Q){if(dY)throw new TypeError("keccak256 is locked");iY=Q};Object.freeze(i);var nY=function(Q,Y,J,X){if(Q===0)return Y^J^X;else if(Q===1)return Y&J|~Y&X;else if(Q===2)return(Y|~J)^X;else if(Q===3)return Y&X|J&~X;else return Y^(J|~X)},l7=new Uint8Array([7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8]),oY=Uint8Array.from({length:16},(Q,Y)=>Y),i7=oY.map((Q)=>(9*Q+5)%16),oJ=[oY],rJ=[i7];for(let Q=0;Q<4;Q++)for(let Y of[oJ,rJ])Y.push(Y[Q].map((J)=>l7[J]));var rY=[[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((Q)=>new Uint8Array(Q)),n7=oJ.map((Q,Y)=>Q.map((J)=>rY[Y][J])),o7=rJ.map((Q,Y)=>Q.map((J)=>rY[Y][J])),r7=new Uint32Array([0,1518500249,1859775393,2400959708,2840853838]),a7=new Uint32Array([1352829926,1548603684,1836072691,2053994217,0]),dQ=(Q,Y)=>Q<<Y|Q>>>32-Y,lQ=new Uint32Array(16);class aY extends n8{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:Q,h1:Y,h2:J,h3:X,h4:q}=this;return[Q,Y,J,X,q]}set(Q,Y,J,X,q){this.h0=Q|0,this.h1=Y|0,this.h2=J|0,this.h3=X|0,this.h4=q|0}process(Q,Y){for(let K=0;K<16;K++,Y+=4)lQ[K]=Q.getUint32(Y,!0);let J=this.h0|0,X=J,q=this.h1|0,G=q,U=this.h2|0,W=U,z=this.h3|0,V=z,$=this.h4|0,M=$;for(let K=0;K<5;K++){const j=4-K,Z=r7[K],I=a7[K],L=oJ[K],D=rJ[K],H=n7[K],F=o7[K];for(let R=0;R<16;R++){const C=dQ(J+nY(K,q,U,z)+lQ[L[R]]+Z,H[R])+$|0;J=$,$=z,z=dQ(U,10)|0,U=q,q=C}for(let R=0;R<16;R++){const C=dQ(X+nY(j,G,W,V)+lQ[D[R]]+I,F[R])+M|0;X=M,M=V,V=dQ(W,10)|0,W=G,G=C}}this.set(this.h1+U+V|0,this.h2+z+M|0,this.h3+$+X|0,this.h4+J+G|0,this.h0+q+W|0)}roundClean(){lQ.fill(0)}destroy(){this.destroyed=!0,this.buffer.fill(0),this.set(0,0,0,0,0)}}var sY=B8(()=>new aY);function Z8(Q){const Y=N(Q,"data");return T(QX(Y))}var tY=!1,eY=function(Q){return sY(Q)},QX=eY;Z8._=eY;Z8.lock=function(){tY=!0};Z8.register=function(Q){if(tY)throw new TypeError("ripemd160 is locked");QX=Q};Object.freeze(Z8);function S0(Q,Y,J,X,q){const G=N(Q,"password"),U=N(Y,"salt");return T(XX(G,U,J,X,q))}var JX=!1,YX=function(Q,Y,J,X,q){return fY(Q,Y,J,X,q)},XX=YX;S0._=YX;S0.lock=function(){JX=!0};S0.register=function(Q){if(JX)throw new Error("pbkdf2 is locked");XX=Q};Object.freeze(S0);function W0(Q){return UX(Q)}var qX=!1,GX=function(Q){return new Uint8Array(bY(Q))},UX=GX;W0._=GX;W0.lock=function(){qX=!0};W0.register=function(Q){if(qX)throw new Error("randomBytes is locked");UX=Q};Object.freeze(W0);var WX=function(Q,Y,J,X,q,G){let U=Q[Y++]^J[X++],W=Q[Y++]^J[X++],z=Q[Y++]^J[X++],V=Q[Y++]^J[X++],$=Q[Y++]^J[X++],M=Q[Y++]^J[X++],K=Q[Y++]^J[X++],j=Q[Y++]^J[X++],Z=Q[Y++]^J[X++],I=Q[Y++]^J[X++],L=Q[Y++]^J[X++],D=Q[Y++]^J[X++],H=Q[Y++]^J[X++],F=Q[Y++]^J[X++],R=Q[Y++]^J[X++],C=Q[Y++]^J[X++],E=U,P=W,f=z,S=V,B=$,k=M,c=K,G0=j,p=Z,w=I,b=L,g=D,u=H,l=F,r=R,U0=C;for(let L0=0;L0<8;L0+=2)B^=d(E+u|0,7),p^=d(B+E|0,9),u^=d(p+B|0,13),E^=d(u+p|0,18),w^=d(k+P|0,7),l^=d(w+k|0,9),P^=d(l+w|0,13),k^=d(P+l|0,18),r^=d(b+c|0,7),f^=d(r+b|0,9),c^=d(f+r|0,13),b^=d(c+f|0,18),S^=d(U0+g|0,7),G0^=d(S+U0|0,9),g^=d(G0+S|0,13),U0^=d(g+G0|0,18),P^=d(E+S|0,7),f^=d(P+E|0,9),S^=d(f+P|0,13),E^=d(S+f|0,18),c^=d(k+B|0,7),G0^=d(c+k|0,9),B^=d(G0+c|0,13),k^=d(B+G0|0,18),g^=d(b+w|0,7),p^=d(g+b|0,9),w^=d(p+g|0,13),b^=d(w+p|0,18),u^=d(U0+r|0,7),l^=d(u+U0|0,9),r^=d(l+u|0,13),U0^=d(r+l|0,18);q[G++]=U+E|0,q[G++]=W+P|0,q[G++]=z+f|0,q[G++]=V+S|0,q[G++]=$+B|0,q[G++]=M+k|0,q[G++]=K+c|0,q[G++]=j+G0|0,q[G++]=Z+p|0,q[G++]=I+w|0,q[G++]=L+b|0,q[G++]=D+g|0,q[G++]=H+u|0,q[G++]=F+l|0,q[G++]=R+r|0,q[G++]=C+U0|0},C9=function(Q,Y,J,X,q){let G=X+0,U=X+16*q;for(let W=0;W<16;W++)J[U+W]=Q[Y+(2*q-1)*16+W];for(let W=0;W<q;W++,G+=16,Y+=16){if(WX(J,U,Q,Y,J,G),W>0)U+=16;WX(J,G,Q,Y+=16,J,U)}},VX=function(Q,Y,J){const X=cQ({dkLen:32,asyncTick:10,maxmem:1073742848},J),{N:q,r:G,p:U,dkLen:W,asyncTick:z,maxmem:V,onProgress:$}=X;if(R0(q),R0(G),R0(U),R0(W),R0(z),R0(V),$!==void 0&&typeof $!=="function")throw new Error("progressCb should be function");const M=128*G,K=M/4;if(q<=1||(q&q-1)!==0||q>=2**(M/8)||q>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(U<0||U>137438953440/M)throw new Error("Scrypt: p must be a positive integer less than or equal to ((2^32 - 1) * 32) / (128 * r)");if(W<0||W>137438953440)throw new Error("Scrypt: dkLen should be positive integer less than or equal to (2^32 - 1) * 32");const j=M*(q+U);if(j>V)throw new Error(`Scrypt: parameters too large, ${j} (128 * r * (N + p)) > ${V} (maxmem)`);const Z=u9(z8,Q,Y,{c:1,dkLen:M*U}),I=H9(Z),L=H9(new Uint8Array(M*q)),D=H9(new Uint8Array(M));let H=()=>{};if($){const F=2*q*U,R=Math.max(Math.floor(F/1e4),1);let C=0;H=()=>{if(C++,$&&(!(C%R)||C===F))$(C/F)}}return{N:q,r:G,p:U,dkLen:W,blockSize32:K,V:L,B32:I,B:Z,tmp:D,blockMixCb:H,asyncTick:z}},zX=function(Q,Y,J,X,q){const G=u9(z8,Q,J,{c:1,dkLen:Y});return J.fill(0),X.fill(0),q.fill(0),G};function $X(Q,Y,J){const{N:X,r:q,p:G,dkLen:U,blockSize32:W,V:z,B32:V,B:$,tmp:M,blockMixCb:K}=VX(Q,Y,J);for(let j=0;j<G;j++){const Z=W*j;for(let I=0;I<W;I++)z[I]=V[Z+I];for(let I=0,L=0;I<X-1;I++)C9(z,L,z,L+=W,q),K();C9(z,(X-1)*W,V,Z,q),K();for(let I=0;I<X;I++){const L=V[Z+W-16]%X;for(let D=0;D<W;D++)M[D]=V[Z+D]^z[L*W+D];C9(M,0,V,Z,q),K()}}return zX(Q,U,$,z,M)}async function ZX(Q,Y,J){const{N:X,r:q,p:G,dkLen:U,blockSize32:W,V:z,B32:V,B:$,tmp:M,blockMixCb:K,asyncTick:j}=VX(Q,Y,J);for(let Z=0;Z<G;Z++){const I=W*Z;for(let D=0;D<W;D++)z[D]=V[I+D];let L=0;await _Q(X-1,j,()=>{C9(z,L,z,L+=W,q),K()}),C9(z,(X-1)*W,V,I,q),K(),await _Q(X,j,()=>{const D=V[I+W-16]%X;for(let H=0;H<W;H++)M[H]=V[I+H]^z[D*W+H];C9(M,0,V,I,q),K()})}return zX(Q,U,$,z,M)}var d=(Q,Y)=>Q<<Y|Q>>>32-Y;async function M8(Q,Y,J,X,q,G,U){const W=N(Q,"passwd"),z=N(Y,"salt");return T(await IX(W,z,J,X,q,G,U))}function K8(Q,Y,J,X,q,G){const U=N(Q,"passwd"),W=N(Y,"salt");return T(LX(U,W,J,X,q,G))}var MX=!1,KX=!1,jX=async function(Q,Y,J,X,q,G,U){return await ZX(Q,Y,{N:J,r:X,p:q,dkLen:G,onProgress:U})},OX=function(Q,Y,J,X,q,G){return $X(Q,Y,{N:J,r:X,p:q,dkLen:G})},IX=jX,LX=OX;M8._=jX;M8.lock=function(){KX=!0};M8.register=function(Q){if(KX)throw new Error("scrypt is locked");IX=Q};Object.freeze(M8);K8._=OX;K8.lock=function(){MX=!0};K8.register=function(Q){if(MX)throw new Error("scryptSync is locked");LX=Q};Object.freeze(K8);function j0(Q){const Y=N(Q,"data");return T(HX(Y))}function l9(Q){const Y=N(Q,"data");return T(PX(Y))}var DX=function(Q){return iJ("sha256").update(Q).digest()},RX=function(Q){return iJ("sha512").update(Q).digest()},HX=DX,PX=RX,CX=!1,TX=!1;j0._=DX;j0.lock=function(){CX=!0};j0.register=function(Q){if(CX)throw new Error("sha256 is locked");HX=Q};Object.freeze(j0);l9._=RX;l9.lock=function(){TX=!0};l9.register=function(Q){if(TX)throw new Error("sha512 is locked");PX=Q};Object.freeze(j0);var eJ={};p1(eJ,{validateObject:()=>{{return f8}},utf8ToBytes:()=>{{return JG}},numberToVarBytesBE:()=>{{return e7}},numberToHexUnpadded:()=>{{return FX}},numberToBytesLE:()=>{{return rQ}},numberToBytesBE:()=>{{return x8}},hexToNumber:()=>{{return sJ}},hexToBytes:()=>{{return r8}},equalBytes:()=>{{return QG}},ensureBytes:()=>{{return A0}},createHmacDrbg:()=>{{return tJ}},concatBytes:()=>{{return T9}},bytesToNumberLE:()=>{{return oQ}},bytesToNumberBE:()=>{{return j8}},bytesToHex:()=>{{return o8}},bitSet:()=>{{return qG}},bitMask:()=>{{return i9}},bitLen:()=>{{return YG}},bitGet:()=>{{return XG}}});function o8(Q){if(!nQ(Q))throw new Error("Uint8Array expected");let Y="";for(let J=0;J<Q.length;J++)Y+=t7[Q[J]];return Y}function FX(Q){const Y=Q.toString(16);return Y.length&1?`0${Y}`:Y}function sJ(Q){if(typeof Q!=="string")throw new Error("hex string expected, got "+typeof Q);return BigInt(Q===""?"0":`0x${Q}`)}function r8(Q){if(typeof Q!=="string")throw new Error("hex string expected, got "+typeof Q);const Y=Q.length;if(Y%2)throw new Error("padded hex string expected, got unpadded hex of length "+Y);const J=new Uint8Array(Y/2);for(let X=0;X<J.length;X++){const q=X*2,G=Q.slice(q,q+2),U=Number.parseInt(G,16);if(Number.isNaN(U)||U<0)throw new Error("Invalid byte sequence");J[X]=U}return J}function j8(Q){return sJ(o8(Q))}function oQ(Q){if(!nQ(Q))throw new Error("Uint8Array expected");return sJ(o8(Uint8Array.from(Q).reverse()))}function x8(Q,Y){return r8(Q.toString(16).padStart(Y*2,"0"))}function rQ(Q,Y){return x8(Q,Y).reverse()}function e7(Q){return r8(FX(Q))}function A0(Q,Y,J){let X;if(typeof Y==="string")try{X=r8(Y)}catch(G){throw new Error(`${Q} must be valid hex string, got "${Y}". Cause: ${G}`)}else if(nQ(Y))X=Uint8Array.from(Y);else throw new Error(`${Q} must be hex string or Uint8Array`);const q=X.length;if(typeof J==="number"&&q!==J)throw new Error(`${Q} expected ${J} bytes, got ${q}`);return X}function T9(...Q){const Y=new Uint8Array(Q.reduce((X,q)=>X+q.length,0));let J=0;return Q.forEach((X)=>{if(!nQ(X))throw new Error("Uint8Array expected");Y.set(X,J),J+=X.length}),Y}function QG(Q,Y){if(Q.length!==Y.length)return!1;for(let J=0;J<Q.length;J++)if(Q[J]!==Y[J])return!1;return!0}function JG(Q){if(typeof Q!=="string")throw new Error(`utf8ToBytes expected string, got ${typeof Q}`);return new Uint8Array((new TextEncoder()).encode(Q))}function YG(Q){let Y;for(Y=0;Q>wX;Q>>=iQ,Y+=1);return Y}function XG(Q,Y){return Q>>BigInt(Y)&iQ}function tJ(Q,Y,J){if(typeof Q!=="number"||Q<2)throw new Error("hashLen must be a number");if(typeof Y!=="number"||Y<2)throw new Error("qByteLen must be a number");if(typeof J!=="function")throw new Error("hmacFn must be a function");let X=aJ(Q),q=aJ(Q),G=0;const U=()=>{X.fill(1),q.fill(0),G=0},W=(...M)=>J(q,X,...M),z=(M=aJ())=>{if(q=W(NX([0]),M),X=W(),M.length===0)return;q=W(NX([1]),M),X=W()},V=()=>{if(G++>=1000)throw new Error("drbg: tried 1000 values");let M=0;const K=[];while(M<Y){X=W();const j=X.slice();K.push(j),M+=X.length}return T9(...K)};return(M,K)=>{U(),z(M);let j=void 0;while(!(j=K(V())))z();return U(),j}}function f8(Q,Y,J={}){const X=(q,G,U)=>{const W=GG[G];if(typeof W!=="function")throw new Error(`Invalid validator "${G}", expected function`);const z=Q[q];if(U&&z===void 0)return;if(!W(z,Q))throw new Error(`Invalid param ${String(q)}=${z} (${typeof z}), expected ${G}`)};for(let[q,G]of Object.entries(Y))X(q,G,!1);for(let[q,G]of Object.entries(J))X(q,G,!0);return Q}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */var wX=BigInt(0),iQ=BigInt(1),s7=BigInt(2),nQ=(Q)=>Q instanceof Uint8Array,t7=Array.from({length:256},(Q,Y)=>Y.toString(16).padStart(2,"0")),qG=(Q,Y,J)=>{return Q|(J?iQ:wX)<<BigInt(Y)},i9=(Q)=>(s7<<BigInt(Q-1))-iQ,aJ=(Q)=>new Uint8Array(Q),NX=(Q)=>Uint8Array.from(Q),GG={bigint:(Q)=>typeof Q==="bigint",function:(Q)=>typeof Q==="function",boolean:(Q)=>typeof Q==="boolean",string:(Q)=>typeof Q==="string",stringOrUint8Array:(Q)=>typeof Q==="string"||Q instanceof Uint8Array,isSafeInteger:(Q)=>Number.isSafeInteger(Q),array:(Q)=>Array.isArray(Q),field:(Q,Y)=>Y.Fp.isValid(Q),hash:(Q)=>typeof Q==="function"&&Number.isSafeInteger(Q.outputLen)};function H0(Q,Y){const J=Q%Y;return J>=V0?J:Y+J}function zG(Q,Y,J){if(J<=V0||Y<V0)throw new Error("Expected power/modulo > 0");if(J===X0)return V0;let X=X0;while(Y>V0){if(Y&X0)X=X*Q%J;Q=Q*Q%J,Y>>=X0}return X}function k0(Q,Y,J){let X=Q;while(Y-- >V0)X*=X,X%=J;return X}function aQ(Q,Y){if(Q===V0||Y<=V0)throw new Error(`invert: expected positive integers, got n=${Q} mod=${Y}`);let J=H0(Q,Y),X=Y,q=V0,G=X0,U=X0,W=V0;while(J!==V0){const V=X/J,$=X%J,M=q-U*V,K=G-W*V;X=J,J=$,q=U,G=W,U=M,W=K}if(X!==X0)throw new Error("invert: does not exist");return H0(q,Y)}function $G(Q){const Y=(Q-X0)/a8;let J,X,q;for(J=Q-X0,X=0;J%a8===V0;J/=a8,X++);for(q=a8;q<Q&&zG(q,Y,Q)!==Q-X0;q++);if(X===1){const U=(Q+X0)/Q5;return function W(z,V){const $=z.pow(V,U);if(!z.eql(z.sqr($),V))throw new Error("Cannot find square root");return $}}const G=(J+X0)/a8;return function U(W,z){if(W.pow(z,Y)===W.neg(W.ONE))throw new Error("Cannot find square root");let V=X,$=W.pow(W.mul(W.ONE,q),J),M=W.pow(z,G),K=W.pow(z,J);while(!W.eql(K,W.ONE)){if(W.eql(K,W.ZERO))return W.ZERO;let j=1;for(let I=W.sqr(K);j<V;j++){if(W.eql(I,W.ONE))break;I=W.sqr(I)}const Z=W.pow($,X0<<BigInt(V-j-1));$=W.sqr(Z),M=W.mul(M,Z),K=W.mul(K,$),V=j}return M}}function ZG(Q){if(Q%Q5===UG){const Y=(Q+X0)/Q5;return function J(X,q){const G=X.pow(q,Y);if(!X.eql(X.sqr(G),q))throw new Error("Cannot find square root");return G}}if(Q%EX===BX){const Y=(Q-BX)/EX;return function J(X,q){const G=X.mul(q,a8),U=X.pow(G,Y),W=X.mul(q,U),z=X.mul(X.mul(W,a8),U),V=X.mul(W,X.sub(z,X.ONE));if(!X.eql(X.sqr(V),q))throw new Error("Cannot find square root");return V}}if(Q%VG===WG);return $G(Q)}function J5(Q){const Y={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},J=MG.reduce((X,q)=>{return X[q]="function",X},Y);return f8(Q,J)}function KG(Q,Y,J){if(J<V0)throw new Error("Expected power > 0");if(J===V0)return Q.ONE;if(J===X0)return Y;let X=Q.ONE,q=Y;while(J>V0){if(J&X0)X=Q.mul(X,q);q=Q.sqr(q),J>>=X0}return X}function jG(Q,Y){const J=new Array(Y.length),X=Y.reduce((G,U,W)=>{if(Q.is0(U))return G;return J[W]=G,Q.mul(G,U)},Q.ONE),q=Q.inv(X);return Y.reduceRight((G,U,W)=>{if(Q.is0(U))return G;return J[W]=Q.mul(G,J[W]),Q.mul(G,U)},q),J}function Y5(Q,Y){const J=Y!==void 0?Y:Q.toString(2).length,X=Math.ceil(J/8);return{nBitLength:J,nByteLength:X}}function SX(Q,Y,J=!1,X={}){if(Q<=V0)throw new Error(`Expected Field ORDER > 0, got ${Q}`);const{nBitLength:q,nByteLength:G}=Y5(Q,Y);if(G>2048)throw new Error("Field lengths over 2048 bytes are not supported");const U=ZG(Q),W=Object.freeze({ORDER:Q,BITS:q,BYTES:G,MASK:i9(q),ZERO:V0,ONE:X0,create:(z)=>H0(z,Q),isValid:(z)=>{if(typeof z!=="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof z}`);return V0<=z&&z<Q},is0:(z)=>z===V0,isOdd:(z)=>(z&X0)===X0,neg:(z)=>H0(-z,Q),eql:(z,V)=>z===V,sqr:(z)=>H0(z*z,Q),add:(z,V)=>H0(z+V,Q),sub:(z,V)=>H0(z-V,Q),mul:(z,V)=>H0(z*V,Q),pow:(z,V)=>KG(W,z,V),div:(z,V)=>H0(z*aQ(V,Q),Q),sqrN:(z)=>z*z,addN:(z,V)=>z+V,subN:(z,V)=>z-V,mulN:(z,V)=>z*V,inv:(z)=>aQ(z,Q),sqrt:X.sqrt||((z)=>U(W,z)),invertBatch:(z)=>jG(W,z),cmov:(z,V,$)=>$?V:z,toBytes:(z)=>J?rQ(z,G):x8(z,G),fromBytes:(z)=>{if(z.length!==G)throw new Error(`Fp.fromBytes: expected ${G}, got ${z.length}`);return J?oQ(z):j8(z)}});return Object.freeze(W)}function AX(Q){if(typeof Q!=="bigint")throw new Error("field order must be bigint");const Y=Q.toString(2).length;return Math.ceil(Y/8)}function X5(Q){const Y=AX(Q);return Y+Math.ceil(Y/2)}function kX(Q,Y,J=!1){const X=Q.length,q=AX(Y),G=X5(Y);if(X<16||X<G||X>1024)throw new Error(`expected ${G}-1024 bytes of input, got ${X}`);const U=J?j8(Q):oQ(Q),W=H0(U,Y-X0)+X0;return J?rQ(W,q):x8(W,q)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */var V0=BigInt(0),X0=BigInt(1),a8=BigInt(2),UG=BigInt(3),Q5=BigInt(4),BX=BigInt(5),EX=BigInt(8),WG=BigInt(9),VG=BigInt(16);var MG=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function xX(Q,Y){const J=(q,G)=>{const U=G.negate();return q?U:G},X=(q)=>{const G=Math.ceil(Y/q)+1,U=2**(q-1);return{windows:G,windowSize:U}};return{constTimeNegate:J,unsafeLadder(q,G){let U=Q.ZERO,W=q;while(G>IG){if(G&q5)U=U.add(W);W=W.double(),G>>=q5}return U},precomputeWindow(q,G){const{windows:U,windowSize:W}=X(G),z=[];let V=q,$=V;for(let M=0;M<U;M++){$=V,z.push($);for(let K=1;K<W;K++)$=$.add(V),z.push($);V=$.double()}return z},wNAF(q,G,U){const{windows:W,windowSize:z}=X(q);let{ZERO:V,BASE:$}=Q;const M=BigInt(2**q-1),K=2**q,j=BigInt(q);for(let Z=0;Z<W;Z++){const I=Z*z;let L=Number(U&M);if(U>>=j,L>z)L-=K,U+=q5;const D=I,H=I+Math.abs(L)-1,F=Z%2!==0,R=L<0;if(L===0)$=$.add(J(F,G[D]));else V=V.add(J(R,G[H]))}return{p:V,f:$}},wNAFCached(q,G,U,W){const z=q._WINDOW_SIZE||1;let V=G.get(q);if(!V){if(V=this.precomputeWindow(q,z),z!==1)G.set(q,W(V))}return this.wNAF(z,V,U)}}}function G5(Q){return J5(Q.Fp),f8(Q,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...Y5(Q.n,Q.nBitLength),...Q,...{p:Q.Fp.ORDER}})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */var IG=BigInt(0),q5=BigInt(1);var LG=function(Q){const Y=G5(Q);f8(Y,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:J,Fp:X,a:q}=Y;if(J){if(!X.eql(q,X.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({...Y})};function HG(Q){const Y=LG(Q),{Fp:J}=Y,X=Y.toBytes||((Z,I,L)=>{const D=I.toAffine();return T9(Uint8Array.from([4]),J.toBytes(D.x),J.toBytes(D.y))}),q=Y.fromBytes||((Z)=>{const I=Z.subarray(1),L=J.fromBytes(I.subarray(0,J.BYTES)),D=J.fromBytes(I.subarray(J.BYTES,2*J.BYTES));return{x:L,y:D}});function G(Z){const{a:I,b:L}=Y,D=J.sqr(Z),H=J.mul(D,Z);return J.add(J.add(H,J.mul(Z,I)),L)}if(!J.eql(J.sqr(Y.Gy),G(Y.Gx)))throw new Error("bad generator point: equation left != right");function U(Z){return typeof Z==="bigint"&&O8<Z&&Z<Y.n}function W(Z){if(!U(Z))throw new Error("Expected valid bigint: 0 < bigint < curve.n")}function z(Z){const{allowedPrivateKeyLengths:I,nByteLength:L,wrapPrivateKey:D,n:H}=Y;if(I&&typeof Z!=="bigint"){if(Z instanceof Uint8Array)Z=o8(Z);if(typeof Z!=="string"||!I.includes(Z.length))throw new Error("Invalid key");Z=Z.padStart(L*2,"0")}let F;try{F=typeof Z==="bigint"?Z:j8(A0("private key",Z,L))}catch(R){throw new Error(`private key must be ${L} bytes, hex or bigint, not ${typeof Z}`)}if(D)F=H0(F,H);return W(F),F}const V=new Map;function $(Z){if(!(Z instanceof M))throw new Error("ProjectivePoint expected")}class M{constructor(Z,I,L){if(this.px=Z,this.py=I,this.pz=L,Z==null||!J.isValid(Z))throw new Error("x required");if(I==null||!J.isValid(I))throw new Error("y required");if(L==null||!J.isValid(L))throw new Error("z required")}static fromAffine(Z){const{x:I,y:L}=Z||{};if(!Z||!J.isValid(I)||!J.isValid(L))throw new Error("invalid affine point");if(Z instanceof M)throw new Error("projective point not allowed");const D=(H)=>J.eql(H,J.ZERO);if(D(I)&&D(L))return M.ZERO;return new M(I,L,J.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(Z){const I=J.invertBatch(Z.map((L)=>L.pz));return Z.map((L,D)=>L.toAffine(I[D])).map(M.fromAffine)}static fromHex(Z){const I=M.fromAffine(q(A0("pointHex",Z)));return I.assertValidity(),I}static fromPrivateKey(Z){return M.BASE.multiply(z(Z))}_setWindowSize(Z){this._WINDOW_SIZE=Z,V.delete(this)}assertValidity(){if(this.is0()){if(Y.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 L=J.sqr(I),D=G(Z);if(!J.eql(L,D))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){$(Z);const{px:I,py:L,pz:D}=this,{px:H,py:F,pz:R}=Z,C=J.eql(J.mul(I,R),J.mul(H,D)),E=J.eql(J.mul(L,R),J.mul(F,D));return C&&E}negate(){return new M(this.px,J.neg(this.py),this.pz)}double(){const{a:Z,b:I}=Y,L=J.mul(I,fX),{px:D,py:H,pz:F}=this;let{ZERO:R,ZERO:C,ZERO:E}=J,P=J.mul(D,D),f=J.mul(H,H),S=J.mul(F,F),B=J.mul(D,H);return B=J.add(B,B),E=J.mul(D,F),E=J.add(E,E),R=J.mul(Z,E),C=J.mul(L,S),C=J.add(R,C),R=J.sub(f,C),C=J.add(f,C),C=J.mul(R,C),R=J.mul(B,R),E=J.mul(L,E),S=J.mul(Z,S),B=J.sub(P,S),B=J.mul(Z,B),B=J.add(B,E),E=J.add(P,P),P=J.add(E,P),P=J.add(P,S),P=J.mul(P,B),C=J.add(C,P),S=J.mul(H,F),S=J.add(S,S),P=J.mul(S,B),R=J.sub(R,P),E=J.mul(S,f),E=J.add(E,E),E=J.add(E,E),new M(R,C,E)}add(Z){$(Z);const{px:I,py:L,pz:D}=this,{px:H,py:F,pz:R}=Z;let{ZERO:C,ZERO:E,ZERO:P}=J;const f=Y.a,S=J.mul(Y.b,fX);let B=J.mul(I,H),k=J.mul(L,F),c=J.mul(D,R),G0=J.add(I,L),p=J.add(H,F);G0=J.mul(G0,p),p=J.add(B,k),G0=J.sub(G0,p),p=J.add(I,D);let w=J.add(H,R);return p=J.mul(p,w),w=J.add(B,c),p=J.sub(p,w),w=J.add(L,D),C=J.add(F,R),w=J.mul(w,C),C=J.add(k,c),w=J.sub(w,C),P=J.mul(f,p),C=J.mul(S,c),P=J.add(C,P),C=J.sub(k,P),P=J.add(k,P),E=J.mul(C,P),k=J.add(B,B),k=J.add(k,B),c=J.mul(f,c),p=J.mul(S,p),k=J.add(k,c),c=J.sub(B,c),c=J.mul(f,c),p=J.add(p,c),B=J.mul(k,p),E=J.add(E,B),B=J.mul(w,p),C=J.mul(G0,C),C=J.sub(C,B),B=J.mul(G0,k),P=J.mul(w,P),P=J.add(P,B),new M(C,E,P)}subtract(Z){return this.add(Z.negate())}is0(){return this.equals(M.ZERO)}wNAF(Z){return j.wNAFCached(this,V,Z,(I)=>{const L=J.invertBatch(I.map((D)=>D.pz));return I.map((D,H)=>D.toAffine(L[H])).map(M.fromAffine)})}multiplyUnsafe(Z){const I=M.ZERO;if(Z===O8)return I;if(W(Z),Z===v0)return this;const{endo:L}=Y;if(!L)return j.unsafeLadder(this,Z);let{k1neg:D,k1:H,k2neg:F,k2:R}=L.splitScalar(Z),C=I,E=I,P=this;while(H>O8||R>O8){if(H&v0)C=C.add(P);if(R&v0)E=E.add(P);P=P.double(),H>>=v0,R>>=v0}if(D)C=C.negate();if(F)E=E.negate();return E=new M(J.mul(E.px,L.beta),E.py,E.pz),C.add(E)}multiply(Z){W(Z);let I=Z,L,D;const{endo:H}=Y;if(H){const{k1neg:F,k1:R,k2neg:C,k2:E}=H.splitScalar(I);let{p:P,f}=this.wNAF(R),{p:S,f:B}=this.wNAF(E);P=j.constTimeNegate(F,P),S=j.constTimeNegate(C,S),S=new M(J.mul(S.px,H.beta),S.py,S.pz),L=P.add(S),D=f.add(B)}else{const{p:F,f:R}=this.wNAF(I);L=F,D=R}return M.normalizeZ([L,D])[0]}multiplyAndAddUnsafe(Z,I,L){const D=M.BASE,H=(R,C)=>C===O8||C===v0||!R.equals(D)?R.multiplyUnsafe(C):R.multiply(C),F=H(this,I).add(H(Z,L));return F.is0()?void 0:F}toAffine(Z){const{px:I,py:L,pz:D}=this,H=this.is0();if(Z==null)Z=H?J.ONE:J.inv(D);const F=J.mul(I,Z),R=J.mul(L,Z),C=J.mul(D,Z);if(H)return{x:J.ZERO,y:J.ZERO};if