22 lines
534 KiB
JavaScript
22 lines
534 KiB
JavaScript
import{a as jv}from"./chunk-G6S5B3Z4.js";import{a as Uv}from"./chunk-JQ4TEJEX.js";import{a as Jn}from"./chunk-NRVH3QMH.js";import{a as Ov,b as kv,c as Lv,d as Kv,e as Dv,f as Rv}from"./chunk-IW7EDKR4.js";import{a as Bv}from"./chunk-YHVKZE66.js";import{a as vb,b as Tv,m as qv,n as Nv}from"./chunk-O5S4AKID.js";import{A as Ev,D as Iv,F as xv,G as Av,J as mb,K as Pv,d as Pr,e as Sv,f as Mv,g as Xd}from"./chunk-QO4BJAKR.js";import{c as L,g as yb,o as E,p as B,q as I}from"./chunk-QTLWQ5AJ.js";var eo=L(re=>{"use strict";E();I();Object.defineProperty(re,"__esModule",{value:!0});re.bytes=re.stringToBytes=re.str=re.bytesToString=re.hex=re.utf8=re.bech32m=re.bech32=re.base58check=re.base58xmr=re.base58xrp=re.base58flickr=re.base58=re.base64url=re.base64=re.base32crockford=re.base32hex=re.base32=re.base16=re.utils=re.assertNumber=void 0;function Yi(t){if(!Number.isSafeInteger(t))throw new Error(`Wrong integer: ${t}`)}re.assertNumber=Yi;function Nn(...t){let e=(i,o)=>a=>i(o(a)),r=Array.from(t).reverse().reduce((i,o)=>i?e(i,o.encode):o.encode,void 0),n=t.reduce((i,o)=>i?e(i,o.decode):o.decode,void 0);return{encode:r,decode:n}}function Qn(t){return{encode:e=>{if(!Array.isArray(e)||e.length&&typeof e[0]!="number")throw new Error("alphabet.encode input should be an array of numbers");return e.map(r=>{if(Yi(r),r<0||r>=t.length)throw new Error(`Digit index outside alphabet: ${r} (alphabet: ${t.length})`);return t[r]})},decode:e=>{if(!Array.isArray(e)||e.length&&typeof e[0]!="string")throw new Error("alphabet.decode input should be array of strings");return e.map(r=>{if(typeof r!="string")throw new Error(`alphabet.decode: not string element=${r}`);let n=t.indexOf(r);if(n===-1)throw new Error(`Unknown letter: "${r}". Allowed: ${t}`);return n})}}}function ei(t=""){if(typeof t!="string")throw new Error("join separator should be string");return{encode:e=>{if(!Array.isArray(e)||e.length&&typeof e[0]!="string")throw new Error("join.encode input should be array of strings");for(let r of e)if(typeof r!="string")throw new Error(`join.encode: non-string input=${r}`);return e.join(t)},decode:e=>{if(typeof e!="string")throw new Error("join.decode input should be string");return e.split(t)}}}function uu(t,e="="){if(Yi(t),typeof e!="string")throw new Error("padding chr should be string");return{encode(r){if(!Array.isArray(r)||r.length&&typeof r[0]!="string")throw new Error("padding.encode input should be array of strings");for(let n of r)if(typeof n!="string")throw new Error(`padding.encode: non-string input=${n}`);for(;r.length*t%8;)r.push(e);return r},decode(r){if(!Array.isArray(r)||r.length&&typeof r[0]!="string")throw new Error("padding.encode input should be array of strings");for(let i of r)if(typeof i!="string")throw new Error(`padding.decode: non-string input=${i}`);let n=r.length;if(n*t%8)throw new Error("Invalid padding: string should have whole number of bytes");for(;n>0&&r[n-1]===e;n--)if(!((n-1)*t%8))throw new Error("Invalid padding: string has too much padding");return r.slice(0,n)}}}function Ib(t){if(typeof t!="function")throw new Error("normalize fn should be function");return{encode:e=>e,decode:e=>t(e)}}function wb(t,e,r){if(e<2)throw new Error(`convertRadix: wrong from=${e}, base cannot be less than 2`);if(r<2)throw new Error(`convertRadix: wrong to=${r}, base cannot be less than 2`);if(!Array.isArray(t))throw new Error("convertRadix: data should be array");if(!t.length)return[];let n=0,i=[],o=Array.from(t);for(o.forEach(a=>{if(Yi(a),a<0||a>=e)throw new Error(`Wrong integer: ${a}`)});;){let a=0,c=!0;for(let l=n;l<o.length;l++){let m=o[l],S=e*a+m;if(!Number.isSafeInteger(S)||e*a/e!==a||S-m!==e*a)throw new Error("convertRadix: carry overflow");if(a=S%r,o[l]=Math.floor(S/r),!Number.isSafeInteger(o[l])||o[l]*r+a!==S)throw new Error("convertRadix: carry overflow");if(c)o[l]?c=!1:n=l;else continue}if(i.push(a),c)break}for(let a=0;a<t.length-1&&t[a]===0;a++)i.push(0);return i.reverse()}var xb=(t,e)=>e?xb(e,t%e):t,bc=(t,e)=>t+(e-xb(t,e));function Jd(t,e,r,n){if(!Array.isArray(t))throw new Error("convertRadix2: data should be array");if(e<=0||e>32)throw new Error(`convertRadix2: wrong from=${e}`);if(r<=0||r>32)throw new Error(`convertRadix2: wrong to=${r}`);if(bc(e,r)>32)throw new Error(`convertRadix2: carry overflow from=${e} to=${r} carryBits=${bc(e,r)}`);let i=0,o=0,a=2**r-1,c=[];for(let l of t){if(Yi(l),l>=2**e)throw new Error(`convertRadix2: invalid data word=${l} from=${e}`);if(i=i<<e|l,o+e>32)throw new Error(`convertRadix2: carry overflow pos=${o} from=${e}`);for(o+=e;o>=r;o-=r)c.push((i>>o-r&a)>>>0);i&=2**o-1}if(i=i<<r-o&a,!n&&o>=e)throw new Error("Excess padding");if(!n&&i)throw new Error(`Non-zero padding: ${i}`);return n&&o>0&&c.push(i>>>0),c}function Ab(t){return Yi(t),{encode:e=>{if(!(e instanceof Uint8Array))throw new Error("radix.encode input should be Uint8Array");return wb(Array.from(e),2**8,t)},decode:e=>{if(!Array.isArray(e)||e.length&&typeof e[0]!="number")throw new Error("radix.decode input should be array of strings");return Uint8Array.from(wb(e,t,2**8))}}}function Ti(t,e=!1){if(Yi(t),t<=0||t>32)throw new Error("radix2: bits should be in (0..32]");if(bc(8,t)>32||bc(t,8)>32)throw new Error("radix2: carry overflow");return{encode:r=>{if(!(r instanceof Uint8Array))throw new Error("radix2.encode input should be Uint8Array");return Jd(Array.from(r),8,t,!e)},decode:r=>{if(!Array.isArray(r)||r.length&&typeof r[0]!="number")throw new Error("radix2.decode input should be array of strings");return Uint8Array.from(Jd(r,t,8,e))}}}function _b(t){if(typeof t!="function")throw new Error("unsafeWrapper fn should be function");return function(...e){try{return t.apply(null,e)}catch{}}}function Pb(t,e){if(Yi(t),typeof e!="function")throw new Error("checksum fn should be function");return{encode(r){if(!(r instanceof Uint8Array))throw new Error("checksum.encode: input should be Uint8Array");let n=e(r).slice(0,t),i=new Uint8Array(r.length+t);return i.set(r),i.set(n,r.length),i},decode(r){if(!(r instanceof Uint8Array))throw new Error("checksum.decode: input should be Uint8Array");let n=r.slice(0,-t),i=e(n).slice(0,t),o=r.slice(-t);for(let a=0;a<t;a++)if(i[a]!==o[a])throw new Error("Invalid checksum");return n}}}re.utils={alphabet:Qn,chain:Nn,checksum:Pb,radix:Ab,radix2:Ti,join:ei,padding:uu};re.base16=Nn(Ti(4),Qn("0123456789ABCDEF"),ei(""));re.base32=Nn(Ti(5),Qn("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"),uu(5),ei(""));re.base32hex=Nn(Ti(5),Qn("0123456789ABCDEFGHIJKLMNOPQRSTUV"),uu(5),ei(""));re.base32crockford=Nn(Ti(5),Qn("0123456789ABCDEFGHJKMNPQRSTVWXYZ"),ei(""),Ib(t=>t.toUpperCase().replace(/O/g,"0").replace(/[IL]/g,"1")));re.base64=Nn(Ti(6),Qn("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),uu(6),ei(""));re.base64url=Nn(Ti(6),Qn("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),uu(6),ei(""));var el=t=>Nn(Ab(58),Qn(t),ei(""));re.base58=el("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");re.base58flickr=el("123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ");re.base58xrp=el("rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz");var Sb=[0,2,3,5,6,7,9,10,11];re.base58xmr={encode(t){let e="";for(let r=0;r<t.length;r+=8){let n=t.subarray(r,r+8);e+=re.base58.encode(n).padStart(Sb[n.length],"1")}return e},decode(t){let e=[];for(let r=0;r<t.length;r+=11){let n=t.slice(r,r+11),i=Sb.indexOf(n.length),o=re.base58.decode(n);for(let a=0;a<o.length-i;a++)if(o[a]!==0)throw new Error("base58xmr: wrong padding");e=e.concat(Array.from(o.slice(o.length-i)))}return Uint8Array.from(e)}};var Cv=t=>Nn(Pb(4,e=>t(t(e))),re.base58);re.base58check=Cv;var Qd=Nn(Qn("qpzry9x8gf2tvdw0s3jn54khce6mua7l"),ei("")),Mb=[996825010,642813549,513874426,1027748829,705979059];function ou(t){let e=t>>25,r=(t&33554431)<<5;for(let n=0;n<Mb.length;n++)(e>>n&1)===1&&(r^=Mb[n]);return r}function Eb(t,e,r=1){let n=t.length,i=1;for(let o=0;o<n;o++){let a=t.charCodeAt(o);if(a<33||a>126)throw new Error(`Invalid prefix (${t})`);i=ou(i)^a>>5}i=ou(i);for(let o=0;o<n;o++)i=ou(i)^t.charCodeAt(o)&31;for(let o of e)i=ou(i)^o;for(let o=0;o<6;o++)i=ou(i);return i^=r,Qd.encode(Jd([i%2**30],30,5,!1))}function Bb(t){let e=t==="bech32"?1:734539939,r=Ti(5),n=r.decode,i=r.encode,o=_b(n);function a(S,_,P=90){if(typeof S!="string")throw new Error(`bech32.encode prefix should be string, not ${typeof S}`);if(!Array.isArray(_)||_.length&&typeof _[0]!="number")throw new Error(`bech32.encode words should be array of numbers, not ${typeof _}`);let x=S.length+7+_.length;if(P!==!1&&x>P)throw new TypeError(`Length ${x} exceeds limit ${P}`);return S=S.toLowerCase(),`${S}1${Qd.encode(_)}${Eb(S,_,e)}`}function c(S,_=90){if(typeof S!="string")throw new Error(`bech32.decode input should be string, not ${typeof S}`);if(S.length<8||_!==!1&&S.length>_)throw new TypeError(`Wrong string length: ${S.length} (${S}). Expected (8..${_})`);let P=S.toLowerCase();if(S!==P&&S!==S.toUpperCase())throw new Error("String must be lowercase or uppercase");S=P;let x=S.lastIndexOf("1");if(x===0||x===-1)throw new Error('Letter "1" must be present between prefix and data only');let[T,M]=[S.slice(0,x),S.slice(x+1)];if(M.length<6)throw new Error("Data must be at least 6 characters long");let k=Qd.decode(M).slice(0,-6),N=Eb(T,k,e);if(!M.endsWith(N))throw new Error(`Invalid checksum in ${S}: expected "${N}"`);return{prefix:T,words:k}}let l=_b(c);function m(S){let{prefix:_,words:P}=c(S,!1);return{prefix:_,words:P,bytes:n(P)}}return{encode:a,decode:c,decodeToBytes:m,decodeUnsafe:l,fromWords:n,fromWordsUnsafe:o,toWords:i}}re.bech32=Bb("bech32");re.bech32m=Bb("bech32m");re.utf8={encode:t=>new TextDecoder().decode(t),decode:t=>new TextEncoder().encode(t)};re.hex=Nn(Ti(4),Qn("0123456789abcdef"),ei(""),Ib(t=>{if(typeof t!="string"||t.length%2)throw new TypeError(`hex.decode: expected string, got ${typeof t} with length ${t.length}`);return t.toLowerCase()}));var au={utf8:re.utf8,hex:re.hex,base16:re.base16,base32:re.base32,base64:re.base64,base64url:re.base64url,base58:re.base58,base58xmr:re.base58xmr},Tb=`Invalid encoding type. Available types: ${Object.keys(au).join(", ")}`,zv=(t,e)=>{if(typeof t!="string"||!au.hasOwnProperty(t))throw new TypeError(Tb);if(!(e instanceof Uint8Array))throw new TypeError("bytesToString() expects Uint8Array");return au[t].encode(e)};re.bytesToString=zv;re.str=re.bytesToString;var Fv=(t,e)=>{if(!au.hasOwnProperty(t))throw new TypeError(Tb);if(typeof e!="string")throw new TypeError("stringToBytes() expects string");return au[t].decode(e)};re.stringToBytes=Fv;re.bytes=re.stringToBytes});var Ob=L(Zi=>{"use strict";E();I();Object.defineProperty(Zi,"__esModule",{value:!0});Zi.base58=Zi.fromBase58=Zi.toBase58=void 0;var tl=eo();Object.defineProperty(Zi,"base58",{enumerable:!0,get:function(){return tl.base58}});function Hv(t){let e=B.Buffer.from(t);return tl.base58.encode(Uint8Array.from(e))}Zi.toBase58=Hv;function Vv(t){return tl.base58.decode(t)}Zi.fromBase58=Vv});var kb=L(pc=>{"use strict";E();I();Object.defineProperty(pc,"__esModule",{value:!0});pc.crypto=void 0;pc.crypto={node:void 0,web:typeof self=="object"&&"crypto"in self?self.crypto:void 0}});var er=L((oe,cu)=>{"use strict";E();I();Object.defineProperty(oe,"__esModule",{value:!0});oe.randomBytes=oe.wrapConstructorWithOpts=oe.wrapConstructor=oe.checkOpts=oe.Hash=oe.assertHash=oe.assertBytes=oe.assertBool=oe.assertNumber=oe.concatBytes=oe.toBytes=oe.utf8ToBytes=oe.asyncLoop=oe.nextTick=oe.hexToBytes=oe.bytesToHex=oe.isLE=oe.rotr=oe.createView=oe.u32=oe.u8=void 0;var gc=kb(),Wv=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength);oe.u8=Wv;var $v=t=>new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4));oe.u32=$v;var Gv=t=>new DataView(t.buffer,t.byteOffset,t.byteLength);oe.createView=Gv;var Yv=(t,e)=>t<<32-e|t>>>e;oe.rotr=Yv;oe.isLE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!oe.isLE)throw new Error("Non little-endian hardware is not supported");var Zv=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function Xv(t){let e="";for(let r=0;r<t.length;r++)e+=Zv[t[r]];return e}oe.bytesToHex=Xv;function Jv(t){if(typeof t!="string")throw new TypeError("hexToBytes: expected string, got "+typeof t);if(t.length%2)throw new Error("hexToBytes: received invalid unpadded hex");let e=new Uint8Array(t.length/2);for(let r=0;r<e.length;r++){let n=r*2,i=t.slice(n,n+2),o=Number.parseInt(i,16);if(Number.isNaN(o))throw new Error("Invalid byte sequence");e[r]=o}return e}oe.hexToBytes=Jv;oe.nextTick=(()=>{let t=typeof cu<"u"&&typeof cu.require=="function"&&cu.require.bind(cu);try{if(t){let{setImmediate:e}=t("timers");return()=>new Promise(r=>e(r))}}catch{}return()=>new Promise(e=>setTimeout(e,0))})();async function Qv(t,e,r){let n=Date.now();for(let i=0;i<t;i++){r(i);let o=Date.now()-n;o>=0&&o<e||(await(0,oe.nextTick)(),n+=o)}}oe.asyncLoop=Qv;function qb(t){if(typeof t!="string")throw new TypeError(`utf8ToBytes expected string, got ${typeof t}`);return new TextEncoder().encode(t)}oe.utf8ToBytes=qb;function il(t){if(typeof t=="string"&&(t=qb(t)),!(t instanceof Uint8Array))throw new TypeError(`Expected input type is Uint8Array (got ${typeof t})`);return t}oe.toBytes=il;function e3(...t){if(!t.every(n=>n instanceof Uint8Array))throw new Error("Uint8Array list expected");if(t.length===1)return t[0];let e=t.reduce((n,i)=>n+i.length,0),r=new Uint8Array(e);for(let n=0,i=0;n<t.length;n++){let o=t[n];r.set(o,i),i+=o.length}return r}oe.concatBytes=e3;function rl(t){if(!Number.isSafeInteger(t)||t<0)throw new Error(`Wrong positive integer: ${t}`)}oe.assertNumber=rl;function t3(t){if(typeof t!="boolean")throw new Error(`Expected boolean, not ${t}`)}oe.assertBool=t3;function r3(t,...e){if(!(t instanceof Uint8Array&&(!e.length||e.includes(t.length))))throw new TypeError(`Expected ${e} bytes, not ${typeof t} with length=${t.length}`)}oe.assertBytes=r3;function n3(t){if(typeof t!="function"||typeof t.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");rl(t.outputLen),rl(t.blockLen)}oe.assertHash=n3;var nl=class{clone(){return this._cloneInto()}};oe.Hash=nl;var i3=t=>Object.prototype.toString.call(t)==="[object Object]"&&t.constructor===Object;function s3(t,e){if(e!==void 0&&(typeof e!="object"||!i3(e)))throw new TypeError("Options should be object or undefined");return Object.assign(t,e)}oe.checkOpts=s3;function o3(t){let e=n=>t().update(il(n)).digest(),r=t();return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=()=>t(),e}oe.wrapConstructor=o3;function a3(t){let e=(n,i)=>t(i).update(il(n)).digest(),r=t({});return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=n=>t(n),e}oe.wrapConstructorWithOpts=a3;function u3(t=32){if(gc.crypto.web)return gc.crypto.web.getRandomValues(new Uint8Array(t));if(gc.crypto.node)return new Uint8Array(gc.crypto.node.randomBytes(t).buffer);throw new Error("The environment doesn't have randomBytes function")}oe.randomBytes=u3});var mc=L(yc=>{"use strict";E();I();Object.defineProperty(yc,"__esModule",{value:!0});yc.SHA2=void 0;var fu=er();function c3(t,e,r,n){if(typeof t.setBigUint64=="function")return t.setBigUint64(e,r,n);let i=BigInt(32),o=BigInt(4294967295),a=Number(r>>i&o),c=Number(r&o),l=n?4:0,m=n?0:4;t.setUint32(e+l,a,n),t.setUint32(e+m,c,n)}var sl=class extends fu.Hash{constructor(e,r,n,i){super(),this.blockLen=e,this.outputLen=r,this.padOffset=n,this.isLE=i,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=(0,fu.createView)(this.buffer)}update(e){if(this.destroyed)throw new Error("instance is destroyed");let{view:r,buffer:n,blockLen:i,finished:o}=this;if(o)throw new Error("digest() was already called");e=(0,fu.toBytes)(e);let a=e.length;for(let c=0;c<a;){let l=Math.min(i-this.pos,a-c);if(l===i){let m=(0,fu.createView)(e);for(;i<=a-c;c+=i)this.process(m,c);continue}n.set(e.subarray(c,c+l),this.pos),this.pos+=l,c+=l,this.pos===i&&(this.process(r,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){if(this.destroyed)throw new Error("instance is destroyed");if(!(e instanceof Uint8Array)||e.length<this.outputLen)throw new Error("_Sha2: Invalid output buffer");if(this.finished)throw new Error("digest() was already called");this.finished=!0;let{buffer:r,view:n,blockLen:i,isLE:o}=this,{pos:a}=this;r[a++]=128,this.buffer.subarray(a).fill(0),this.padOffset>i-a&&(this.process(n,0),a=0);for(let l=a;l<i;l++)r[l]=0;c3(n,i-8,BigInt(this.length*8),o),this.process(n,0);let c=(0,fu.createView)(e);this.get().forEach((l,m)=>c.setUint32(4*m,l,o))}digest(){let{buffer:e,outputLen:r}=this;this.digestInto(e);let n=e.slice(0,r);return this.destroy(),n}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());let{blockLen:r,buffer:n,length:i,finished:o,destroyed:a,pos:c}=this;return e.length=i,e.pos=c,e.finished=o,e.destroyed=a,i%r&&e.buffer.set(n),e}};yc.SHA2=sl});var No=L(vc=>{"use strict";E();I();Object.defineProperty(vc,"__esModule",{value:!0});vc.sha256=void 0;var f3=mc(),Ln=er(),d3=(t,e,r)=>t&e^~t&r,l3=(t,e,r)=>t&e^t&r^e&r,h3=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]),Xi=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Ji=new Uint32Array(64),ol=class extends f3.SHA2{constructor(){super(64,32,8,!1),this.A=Xi[0]|0,this.B=Xi[1]|0,this.C=Xi[2]|0,this.D=Xi[3]|0,this.E=Xi[4]|0,this.F=Xi[5]|0,this.G=Xi[6]|0,this.H=Xi[7]|0}get(){let{A:e,B:r,C:n,D:i,E:o,F:a,G:c,H:l}=this;return[e,r,n,i,o,a,c,l]}set(e,r,n,i,o,a,c,l){this.A=e|0,this.B=r|0,this.C=n|0,this.D=i|0,this.E=o|0,this.F=a|0,this.G=c|0,this.H=l|0}process(e,r){for(let _=0;_<16;_++,r+=4)Ji[_]=e.getUint32(r,!1);for(let _=16;_<64;_++){let P=Ji[_-15],x=Ji[_-2],T=(0,Ln.rotr)(P,7)^(0,Ln.rotr)(P,18)^P>>>3,M=(0,Ln.rotr)(x,17)^(0,Ln.rotr)(x,19)^x>>>10;Ji[_]=M+Ji[_-7]+T+Ji[_-16]|0}let{A:n,B:i,C:o,D:a,E:c,F:l,G:m,H:S}=this;for(let _=0;_<64;_++){let P=(0,Ln.rotr)(c,6)^(0,Ln.rotr)(c,11)^(0,Ln.rotr)(c,25),x=S+P+d3(c,l,m)+h3[_]+Ji[_]|0,M=((0,Ln.rotr)(n,2)^(0,Ln.rotr)(n,13)^(0,Ln.rotr)(n,22))+l3(n,i,o)|0;S=m,m=l,l=c,c=a+x|0,a=o,o=i,i=n,n=x+M|0}n=n+this.A|0,i=i+this.B|0,o=o+this.C|0,a=a+this.D|0,c=c+this.E|0,l=l+this.F|0,m=m+this.G|0,S=S+this.H|0,this.set(n,i,o,a,c,l,m,S)}roundClean(){Ji.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};vc.sha256=(0,Ln.wrapConstructor)(()=>new ol)});var Lo=L(ae=>{"use strict";E();I();Object.defineProperty(ae,"__esModule",{value:!0});ae.add5H=ae.add5L=ae.add4H=ae.add4L=ae.add3H=ae.add3L=ae.add=ae.rotlBL=ae.rotlBH=ae.rotlSL=ae.rotlSH=ae.rotr32L=ae.rotr32H=ae.rotrBL=ae.rotrBH=ae.rotrSL=ae.rotrSH=ae.shrSL=ae.shrSH=ae.toBig=ae.split=ae.fromBig=void 0;var wc=BigInt(2**32-1),al=BigInt(32);function Nb(t,e=!1){return e?{h:Number(t&wc),l:Number(t>>al&wc)}:{h:Number(t>>al&wc)|0,l:Number(t&wc)|0}}ae.fromBig=Nb;function b3(t,e=!1){let r=new Uint32Array(t.length),n=new Uint32Array(t.length);for(let i=0;i<t.length;i++){let{h:o,l:a}=Nb(t[i],e);[r[i],n[i]]=[o,a]}return[r,n]}ae.split=b3;var p3=(t,e)=>BigInt(t>>>0)<<al|BigInt(e>>>0);ae.toBig=p3;var g3=(t,e,r)=>t>>>r;ae.shrSH=g3;var y3=(t,e,r)=>t<<32-r|e>>>r;ae.shrSL=y3;var m3=(t,e,r)=>t>>>r|e<<32-r;ae.rotrSH=m3;var v3=(t,e,r)=>t<<32-r|e>>>r;ae.rotrSL=v3;var w3=(t,e,r)=>t<<64-r|e>>>r-32;ae.rotrBH=w3;var _3=(t,e,r)=>t>>>r-32|e<<64-r;ae.rotrBL=_3;var S3=(t,e)=>e;ae.rotr32H=S3;var M3=(t,e)=>t;ae.rotr32L=M3;var E3=(t,e,r)=>t<<r|e>>>32-r;ae.rotlSH=E3;var I3=(t,e,r)=>e<<r|t>>>32-r;ae.rotlSL=I3;var x3=(t,e,r)=>e<<r-32|t>>>64-r;ae.rotlBH=x3;var A3=(t,e,r)=>t<<r-32|e>>>64-r;ae.rotlBL=A3;function P3(t,e,r,n){let i=(e>>>0)+(n>>>0);return{h:t+r+(i/2**32|0)|0,l:i|0}}ae.add=P3;var B3=(t,e,r)=>(t>>>0)+(e>>>0)+(r>>>0);ae.add3L=B3;var T3=(t,e,r,n)=>e+r+n+(t/2**32|0)|0;ae.add3H=T3;var O3=(t,e,r,n)=>(t>>>0)+(e>>>0)+(r>>>0)+(n>>>0);ae.add4L=O3;var k3=(t,e,r,n,i)=>e+r+n+i+(t/2**32|0)|0;ae.add4H=k3;var q3=(t,e,r,n,i)=>(t>>>0)+(e>>>0)+(r>>>0)+(n>>>0)+(i>>>0);ae.add5L=q3;var N3=(t,e,r,n,i,o)=>e+r+n+i+o+(t/2**32|0)|0;ae.add5H=N3});var _c=L(ar=>{"use strict";E();I();var L3=ar&&ar.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),K3=ar&&ar.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),D3=ar&&ar.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&L3(e,t,r);return K3(e,t),e};Object.defineProperty(ar,"__esModule",{value:!0});ar.sha384=ar.sha512_256=ar.sha512=ar.SHA512=void 0;var R3=mc(),Fe=D3(Lo()),fl=er(),[U3,j3]=Fe.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(t=>BigInt(t))),Qi=new Uint32Array(80),es=new Uint32Array(80),Ko=class extends R3.SHA2{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){let{Ah:e,Al:r,Bh:n,Bl:i,Ch:o,Cl:a,Dh:c,Dl:l,Eh:m,El:S,Fh:_,Fl:P,Gh:x,Gl:T,Hh:M,Hl:k}=this;return[e,r,n,i,o,a,c,l,m,S,_,P,x,T,M,k]}set(e,r,n,i,o,a,c,l,m,S,_,P,x,T,M,k){this.Ah=e|0,this.Al=r|0,this.Bh=n|0,this.Bl=i|0,this.Ch=o|0,this.Cl=a|0,this.Dh=c|0,this.Dl=l|0,this.Eh=m|0,this.El=S|0,this.Fh=_|0,this.Fl=P|0,this.Gh=x|0,this.Gl=T|0,this.Hh=M|0,this.Hl=k|0}process(e,r){for(let K=0;K<16;K++,r+=4)Qi[K]=e.getUint32(r),es[K]=e.getUint32(r+=4);for(let K=16;K<80;K++){let z=Qi[K-15]|0,j=es[K-15]|0,U=Fe.rotrSH(z,j,1)^Fe.rotrSH(z,j,8)^Fe.shrSH(z,j,7),V=Fe.rotrSL(z,j,1)^Fe.rotrSL(z,j,8)^Fe.shrSL(z,j,7),H=Qi[K-2]|0,J=es[K-2]|0,q=Fe.rotrSH(H,J,19)^Fe.rotrBH(H,J,61)^Fe.shrSH(H,J,6),f=Fe.rotrSL(H,J,19)^Fe.rotrBL(H,J,61)^Fe.shrSL(H,J,6),v=Fe.add4L(V,f,es[K-7],es[K-16]),h=Fe.add4H(v,U,q,Qi[K-7],Qi[K-16]);Qi[K]=h|0,es[K]=v|0}let{Ah:n,Al:i,Bh:o,Bl:a,Ch:c,Cl:l,Dh:m,Dl:S,Eh:_,El:P,Fh:x,Fl:T,Gh:M,Gl:k,Hh:N,Hl:R}=this;for(let K=0;K<80;K++){let z=Fe.rotrSH(_,P,14)^Fe.rotrSH(_,P,18)^Fe.rotrBH(_,P,41),j=Fe.rotrSL(_,P,14)^Fe.rotrSL(_,P,18)^Fe.rotrBL(_,P,41),U=_&x^~_&M,V=P&T^~P&k,H=Fe.add5L(R,j,V,j3[K],es[K]),J=Fe.add5H(H,N,z,U,U3[K],Qi[K]),q=H|0,f=Fe.rotrSH(n,i,28)^Fe.rotrBH(n,i,34)^Fe.rotrBH(n,i,39),v=Fe.rotrSL(n,i,28)^Fe.rotrBL(n,i,34)^Fe.rotrBL(n,i,39),h=n&o^n&c^o&c,s=i&a^i&l^a&l;N=M|0,R=k|0,M=x|0,k=T|0,x=_|0,T=P|0,{h:_,l:P}=Fe.add(m|0,S|0,J|0,q|0),m=c|0,S=l|0,c=o|0,l=a|0,o=n|0,a=i|0;let u=Fe.add3L(q,v,s);n=Fe.add3H(u,J,f,h),i=u|0}({h:n,l:i}=Fe.add(this.Ah|0,this.Al|0,n|0,i|0)),{h:o,l:a}=Fe.add(this.Bh|0,this.Bl|0,o|0,a|0),{h:c,l}=Fe.add(this.Ch|0,this.Cl|0,c|0,l|0),{h:m,l:S}=Fe.add(this.Dh|0,this.Dl|0,m|0,S|0),{h:_,l:P}=Fe.add(this.Eh|0,this.El|0,_|0,P|0),{h:x,l:T}=Fe.add(this.Fh|0,this.Fl|0,x|0,T|0),{h:M,l:k}=Fe.add(this.Gh|0,this.Gl|0,M|0,k|0),{h:N,l:R}=Fe.add(this.Hh|0,this.Hl|0,N|0,R|0),this.set(n,i,o,a,c,l,m,S,_,P,x,T,M,k,N,R)}roundClean(){Qi.fill(0),es.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)}};ar.SHA512=Ko;var ul=class extends Ko{constructor(){super(),this.Ah=573645204,this.Al=-64227540,this.Bh=-1621794909,this.Bl=-934517566,this.Ch=596883563,this.Cl=1867755857,this.Dh=-1774684391,this.Dl=1497426621,this.Eh=-1775747358,this.El=-1467023389,this.Fh=-1101128155,this.Fl=1401305490,this.Gh=721525244,this.Gl=746961066,this.Hh=246885852,this.Hl=-2117784414,this.outputLen=32}},cl=class extends Ko{constructor(){super(),this.Ah=-876896931,this.Al=-1056596264,this.Bh=1654270250,this.Bl=914150663,this.Ch=-1856437926,this.Cl=812702999,this.Dh=355462360,this.Dl=-150054599,this.Eh=1731405415,this.El=-4191439,this.Fh=-1900787065,this.Fl=1750603025,this.Gh=-619958771,this.Gl=1694076839,this.Hh=1203062813,this.Hl=-1090891868,this.outputLen=48}};ar.sha512=(0,fl.wrapConstructor)(()=>new Ko);ar.sha512_256=(0,fl.wrapConstructor)(()=>new ul);ar.sha384=(0,fl.wrapConstructor)(()=>new cl)});var hl=L(Do=>{"use strict";E();I();Object.defineProperty(Do,"__esModule",{value:!0});Do.ripemd160=Do.RIPEMD160=void 0;var C3=mc(),z3=er(),F3=new Uint8Array([7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8]),Kb=Uint8Array.from({length:16},(t,e)=>e),H3=Kb.map(t=>(9*t+5)%16),dl=[Kb],ll=[H3];for(let t=0;t<4;t++)for(let e of[dl,ll])e.push(e[t].map(r=>F3[r]));var Db=[[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8],[12,13,11,15,6,9,9,7,12,15,11,13,7,8,7,7],[13,15,14,11,7,7,6,8,13,14,13,12,5,5,6,9],[14,11,12,14,8,6,5,5,15,12,15,14,9,9,8,6],[15,12,13,13,9,5,8,6,14,11,12,11,8,6,5,5]].map(t=>new Uint8Array(t)),V3=dl.map((t,e)=>t.map(r=>Db[e][r])),W3=ll.map((t,e)=>t.map(r=>Db[e][r])),$3=new Uint32Array([0,1518500249,1859775393,2400959708,2840853838]),G3=new Uint32Array([1352829926,1548603684,1836072691,2053994217,0]),Sc=(t,e)=>t<<e|t>>>32-e;function Lb(t,e,r,n){return t===0?e^r^n:t===1?e&r|~e&n:t===2?(e|~r)^n:t===3?e&n|r&~n:e^(r|~n)}var Mc=new Uint32Array(16),Ec=class extends C3.SHA2{constructor(){super(64,20,8,!0),this.h0=1732584193,this.h1=-271733879,this.h2=-1732584194,this.h3=271733878,this.h4=-1009589776}get(){let{h0:e,h1:r,h2:n,h3:i,h4:o}=this;return[e,r,n,i,o]}set(e,r,n,i,o){this.h0=e|0,this.h1=r|0,this.h2=n|0,this.h3=i|0,this.h4=o|0}process(e,r){for(let x=0;x<16;x++,r+=4)Mc[x]=e.getUint32(r,!0);let n=this.h0|0,i=n,o=this.h1|0,a=o,c=this.h2|0,l=c,m=this.h3|0,S=m,_=this.h4|0,P=_;for(let x=0;x<5;x++){let T=4-x,M=$3[x],k=G3[x],N=dl[x],R=ll[x],K=V3[x],z=W3[x];for(let j=0;j<16;j++){let U=Sc(n+Lb(x,o,c,m)+Mc[N[j]]+M,K[j])+_|0;n=_,_=m,m=Sc(c,10)|0,c=o,o=U}for(let j=0;j<16;j++){let U=Sc(i+Lb(T,a,l,S)+Mc[R[j]]+k,z[j])+P|0;i=P,P=S,S=Sc(l,10)|0,l=a,a=U}}this.set(this.h1+c+S|0,this.h2+m+P|0,this.h3+_+i|0,this.h4+n+a|0,this.h0+o+l|0)}roundClean(){Mc.fill(0)}destroy(){this.destroyed=!0,this.buffer.fill(0),this.set(0,0,0,0,0)}};Do.RIPEMD160=Ec;Do.ripemd160=(0,z3.wrapConstructor)(()=>new Ec)});var Ic=L(Qe=>{"use strict";E();I();var Y3=Qe&&Qe.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Z3=Qe&&Qe.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),X3=Qe&&Qe.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Y3(e,t,r);return Z3(e,t),e};Object.defineProperty(Qe,"__esModule",{value:!0});Qe.shake256=Qe.shake128=Qe.keccak_512=Qe.keccak_384=Qe.keccak_256=Qe.keccak_224=Qe.sha3_512=Qe.sha3_384=Qe.sha3_256=Qe.sha3_224=Qe.Keccak=Qe.keccakP=void 0;var lu=X3(Lo()),to=er(),[jb,Cb,zb]=[[],[],[]],J3=BigInt(0),du=BigInt(1),Q3=BigInt(2),ew=BigInt(7),tw=BigInt(256),rw=BigInt(113);for(let t=0,e=du,r=1,n=0;t<24;t++){[r,n]=[n,(2*r+3*n)%5],jb.push(2*(5*n+r)),Cb.push((t+1)*(t+2)/2%64);let i=J3;for(let o=0;o<7;o++)e=(e<<du^(e>>ew)*rw)%tw,e&Q3&&(i^=du<<(du<<BigInt(o))-du);zb.push(i)}var[nw,iw]=lu.split(zb,!0),Rb=(t,e,r)=>r>32?lu.rotlBH(t,e,r):lu.rotlSH(t,e,r),Ub=(t,e,r)=>r>32?lu.rotlBL(t,e,r):lu.rotlSL(t,e,r);function Fb(t,e=24){let r=new Uint32Array(10);for(let n=24-e;n<24;n++){for(let a=0;a<10;a++)r[a]=t[a]^t[a+10]^t[a+20]^t[a+30]^t[a+40];for(let a=0;a<10;a+=2){let c=(a+8)%10,l=(a+2)%10,m=r[l],S=r[l+1],_=Rb(m,S,1)^r[c],P=Ub(m,S,1)^r[c+1];for(let x=0;x<50;x+=10)t[a+x]^=_,t[a+x+1]^=P}let i=t[2],o=t[3];for(let a=0;a<24;a++){let c=Cb[a],l=Rb(i,o,c),m=Ub(i,o,c),S=jb[a];i=t[S],o=t[S+1],t[S]=l,t[S+1]=m}for(let a=0;a<50;a+=10){for(let c=0;c<10;c++)r[c]=t[a+c];for(let c=0;c<10;c++)t[a+c]^=~r[(c+2)%10]&r[(c+4)%10]}t[0]^=nw[n],t[1]^=iw[n]}r.fill(0)}Qe.keccakP=Fb;var ro=class extends to.Hash{constructor(e,r,n,i=!1,o=24){if(super(),this.blockLen=e,this.suffix=r,this.outputLen=n,this.enableXOF=i,this.rounds=o,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,(0,to.assertNumber)(n),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=(0,to.u32)(this.state)}keccak(){Fb(this.state32,this.rounds),this.posOut=0,this.pos=0}update(e){if(this.destroyed)throw new Error("instance is destroyed");if(this.finished)throw new Error("digest() was already called");let{blockLen:r,state:n}=this;e=(0,to.toBytes)(e);let i=e.length;for(let o=0;o<i;){let a=Math.min(r-this.pos,i-o);for(let c=0;c<a;c++)n[this.pos++]^=e[o++];this.pos===r&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;let{state:e,suffix:r,pos:n,blockLen:i}=this;e[n]^=r,(r&128)!==0&&n===i-1&&this.keccak(),e[i-1]^=128,this.keccak()}writeInto(e){if(this.destroyed)throw new Error("instance is destroyed");if(!(e instanceof Uint8Array))throw new Error("Keccak: invalid output buffer");this.finish();for(let r=0,n=e.length;r<n;){this.posOut>=this.blockLen&&this.keccak();let i=Math.min(this.blockLen-this.posOut,n-r);e.set(this.state.subarray(this.posOut,this.posOut+i),r),this.posOut+=i,r+=i}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return(0,to.assertNumber)(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(e.length<this.outputLen)throw new Error("Keccak: invalid output buffer");if(this.finished)throw new Error("digest() was already called");return this.finish(),this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(e){let{blockLen:r,suffix:n,outputLen:i,rounds:o,enableXOF:a}=this;return e||(e=new ro(r,n,i,a,o)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=o,e.suffix=n,e.outputLen=i,e.enableXOF=a,e.destroyed=this.destroyed,e}};Qe.Keccak=ro;var ts=(t,e,r)=>(0,to.wrapConstructor)(()=>new ro(e,t,r));Qe.sha3_224=ts(6,144,224/8);Qe.sha3_256=ts(6,136,256/8);Qe.sha3_384=ts(6,104,384/8);Qe.sha3_512=ts(6,72,512/8);Qe.keccak_224=ts(1,144,224/8);Qe.keccak_256=ts(1,136,256/8);Qe.keccak_384=ts(1,104,384/8);Qe.keccak_512=ts(1,72,512/8);var Hb=(t,e,r)=>(0,to.wrapConstructorWithOpts)((n={})=>new ro(e,t,n.dkLen!==void 0?n.dkLen:r,!0));Qe.shake128=Hb(31,168,128/8);Qe.shake256=Hb(31,136,256/8)});var xc=L(Ro=>{"use strict";E();I();Object.defineProperty(Ro,"__esModule",{value:!0});Ro.BLAKE2=Ro.SIGMA=void 0;var no=er();Ro.SIGMA=new Uint8Array([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3]);var bl=class extends no.Hash{constructor(e,r,n={},i,o,a){if(super(),this.blockLen=e,this.outputLen=r,this.length=0,this.pos=0,this.finished=!1,this.destroyed=!1,(0,no.assertNumber)(e),(0,no.assertNumber)(r),(0,no.assertNumber)(i),r<0||r>i)throw new Error("Blake2: outputLen bigger than keyLen");if(n.key!==void 0&&(n.key.length<1||n.key.length>i))throw new Error(`Key should be up 1..${i} byte long or undefined`);if(n.salt!==void 0&&n.salt.length!==o)throw new Error(`Salt should be ${o} byte long or undefined`);if(n.personalization!==void 0&&n.personalization.length!==a)throw new Error(`Personalization should be ${a} byte long or undefined`);this.buffer32=(0,no.u32)(this.buffer=new Uint8Array(e))}update(e){if(this.destroyed)throw new Error("instance is destroyed");let{finished:r,blockLen:n,buffer:i,buffer32:o}=this;if(r)throw new Error("digest() was already called");e=(0,no.toBytes)(e);let a=e.length;for(let c=0;c<a;){this.pos===n&&(this.compress(o,0,!1),this.pos=0);let l=Math.min(n-this.pos,a-c),m=e.byteOffset+c;if(l===n&&!(m%4)&&c+l<a){let S=new Uint32Array(e.buffer,m,Math.floor((a-c)/4));for(let _=0;c+n<a;_+=o.length,c+=n)this.length+=n,this.compress(S,_,!1);continue}i.set(e.subarray(c,c+l),this.pos),this.pos+=l,this.length+=l,c+=l}return this}digestInto(e){if(this.destroyed)throw new Error("instance is destroyed");if(!(e instanceof Uint8Array)||e.length<this.outputLen)throw new Error("_Blake2: Invalid output buffer");let{finished:r,pos:n,buffer32:i}=this;if(r)throw new Error("digest() was already called");this.finished=!0,this.buffer.subarray(n).fill(0),this.compress(i,0,!0);let o=(0,no.u32)(e);this.get().forEach((a,c)=>o[c]=a)}digest(){let{buffer:e,outputLen:r}=this;this.digestInto(e);let n=e.slice(0,r);return this.destroy(),n}_cloneInto(e){let{buffer:r,length:n,finished:i,destroyed:o,outputLen:a,pos:c}=this;return e||(e=new this.constructor({dkLen:a})),e.set(...this.get()),e.length=n,e.finished=i,e.destroyed=o,e.outputLen=a,e.buffer.set(r),e.pos=c,e}};Ro.BLAKE2=bl});var gl=L(ti=>{"use strict";E();I();var sw=ti&&ti.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ow=ti&&ti.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Wb=ti&&ti.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&sw(e,t,r);return ow(e,t),e};Object.defineProperty(ti,"__esModule",{value:!0});ti.blake2b=void 0;var Vb=Wb(xc()),wr=Wb(Lo()),Uo=er(),Ct=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),G=new Uint32Array(32);function rs(t,e,r,n,i,o){let a=i[o],c=i[o+1],l=G[2*t],m=G[2*t+1],S=G[2*e],_=G[2*e+1],P=G[2*r],x=G[2*r+1],T=G[2*n],M=G[2*n+1],k=wr.add3L(l,S,a);m=wr.add3H(k,m,_,c),l=k|0,{Dh:M,Dl:T}={Dh:M^m,Dl:T^l},{Dh:M,Dl:T}={Dh:wr.rotr32H(M,T),Dl:wr.rotr32L(M,T)},{h:x,l:P}=wr.add(x,P,M,T),{Bh:_,Bl:S}={Bh:_^x,Bl:S^P},{Bh:_,Bl:S}={Bh:wr.rotrSH(_,S,24),Bl:wr.rotrSL(_,S,24)},G[2*t]=l,G[2*t+1]=m,G[2*e]=S,G[2*e+1]=_,G[2*r]=P,G[2*r+1]=x,G[2*n]=T,G[2*n+1]=M}function ns(t,e,r,n,i,o){let a=i[o],c=i[o+1],l=G[2*t],m=G[2*t+1],S=G[2*e],_=G[2*e+1],P=G[2*r],x=G[2*r+1],T=G[2*n],M=G[2*n+1],k=wr.add3L(l,S,a);m=wr.add3H(k,m,_,c),l=k|0,{Dh:M,Dl:T}={Dh:M^m,Dl:T^l},{Dh:M,Dl:T}={Dh:wr.rotrSH(M,T,16),Dl:wr.rotrSL(M,T,16)},{h:x,l:P}=wr.add(x,P,M,T),{Bh:_,Bl:S}={Bh:_^x,Bl:S^P},{Bh:_,Bl:S}={Bh:wr.rotrBH(_,S,63),Bl:wr.rotrBL(_,S,63)},G[2*t]=l,G[2*t+1]=m,G[2*e]=S,G[2*e+1]=_,G[2*r]=P,G[2*r+1]=x,G[2*n]=T,G[2*n+1]=M}var pl=class extends Vb.BLAKE2{constructor(e={}){super(128,e.dkLen===void 0?64:e.dkLen,e,64,16,16),this.v0l=Ct[0]|0,this.v0h=Ct[1]|0,this.v1l=Ct[2]|0,this.v1h=Ct[3]|0,this.v2l=Ct[4]|0,this.v2h=Ct[5]|0,this.v3l=Ct[6]|0,this.v3h=Ct[7]|0,this.v4l=Ct[8]|0,this.v4h=Ct[9]|0,this.v5l=Ct[10]|0,this.v5h=Ct[11]|0,this.v6l=Ct[12]|0,this.v6h=Ct[13]|0,this.v7l=Ct[14]|0,this.v7h=Ct[15]|0;let r=e.key?e.key.length:0;if(this.v0l^=this.outputLen|r<<8|1<<16|1<<24,e.salt){let n=(0,Uo.u32)((0,Uo.toBytes)(e.salt));this.v4l^=n[0],this.v4h^=n[1],this.v5l^=n[2],this.v5h^=n[3]}if(e.personalization){let n=(0,Uo.u32)((0,Uo.toBytes)(e.personalization));this.v6l^=n[0],this.v6h^=n[1],this.v7l^=n[2],this.v7h^=n[3]}if(e.key){let n=new Uint8Array(this.blockLen);n.set((0,Uo.toBytes)(e.key)),this.update(n)}}get(){let{v0l:e,v0h:r,v1l:n,v1h:i,v2l:o,v2h:a,v3l:c,v3h:l,v4l:m,v4h:S,v5l:_,v5h:P,v6l:x,v6h:T,v7l:M,v7h:k}=this;return[e,r,n,i,o,a,c,l,m,S,_,P,x,T,M,k]}set(e,r,n,i,o,a,c,l,m,S,_,P,x,T,M,k){this.v0l=e|0,this.v0h=r|0,this.v1l=n|0,this.v1h=i|0,this.v2l=o|0,this.v2h=a|0,this.v3l=c|0,this.v3h=l|0,this.v4l=m|0,this.v4h=S|0,this.v5l=_|0,this.v5h=P|0,this.v6l=x|0,this.v6h=T|0,this.v7l=M|0,this.v7h=k|0}compress(e,r,n){this.get().forEach((l,m)=>G[m]=l),G.set(Ct,16);let{h:i,l:o}=wr.fromBig(BigInt(this.length));G[24]=Ct[8]^o,G[25]=Ct[9]^i,n&&(G[28]=~G[28],G[29]=~G[29]);let a=0,c=Vb.SIGMA;for(let l=0;l<12;l++)rs(0,4,8,12,e,r+2*c[a++]),ns(0,4,8,12,e,r+2*c[a++]),rs(1,5,9,13,e,r+2*c[a++]),ns(1,5,9,13,e,r+2*c[a++]),rs(2,6,10,14,e,r+2*c[a++]),ns(2,6,10,14,e,r+2*c[a++]),rs(3,7,11,15,e,r+2*c[a++]),ns(3,7,11,15,e,r+2*c[a++]),rs(0,5,10,15,e,r+2*c[a++]),ns(0,5,10,15,e,r+2*c[a++]),rs(1,6,11,12,e,r+2*c[a++]),ns(1,6,11,12,e,r+2*c[a++]),rs(2,7,8,13,e,r+2*c[a++]),ns(2,7,8,13,e,r+2*c[a++]),rs(3,4,9,14,e,r+2*c[a++]),ns(3,4,9,14,e,r+2*c[a++]);this.v0l^=G[0]^G[16],this.v0h^=G[1]^G[17],this.v1l^=G[2]^G[18],this.v1h^=G[3]^G[19],this.v2l^=G[4]^G[20],this.v2h^=G[5]^G[21],this.v3l^=G[6]^G[22],this.v3h^=G[7]^G[23],this.v4l^=G[8]^G[24],this.v4h^=G[9]^G[25],this.v5l^=G[10]^G[26],this.v5h^=G[11]^G[27],this.v6l^=G[12]^G[28],this.v6h^=G[13]^G[29],this.v7l^=G[14]^G[30],this.v7h^=G[15]^G[31],G.fill(0)}destroy(){this.destroyed=!0,this.buffer32.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}};ti.blake2b=(0,Uo.wrapConstructorWithOpts)(t=>new pl(t))});var hu=L(dt=>{"use strict";E();I();Object.defineProperty(dt,"__esModule",{value:!0});dt.sha3_512=dt.sha3_256=dt.ripemd160=dt.sha512=dt.sha256=dt.magicHash=dt.blake2=dt.keccak256=dt.keccak=dt.hash160=dt.doubleSha256=void 0;var Ac=No();Object.defineProperty(dt,"sha256",{enumerable:!0,get:function(){return Ac.sha256}});var aw=_c();Object.defineProperty(dt,"sha512",{enumerable:!0,get:function(){return aw.sha512}});var Gb=hl();Object.defineProperty(dt,"ripemd160",{enumerable:!0,get:function(){return Gb.ripemd160}});var jo=Ic();Object.defineProperty(dt,"sha3_256",{enumerable:!0,get:function(){return jo.sha3_256}});Object.defineProperty(dt,"sha3_512",{enumerable:!0,get:function(){return jo.sha3_512}});var uw=gl();function Yb(t){let e=(0,Ac.sha256)(t);return(0,Ac.sha256)(e)}dt.doubleSha256=Yb;function cw(t){let e=(0,Ac.sha256)(t);return(0,Gb.ripemd160)(e)}dt.hash160=cw;var fw=function(t,e=256){let r=B.Buffer.from(t);switch(e){case 224:return B.Buffer.from((0,jo.keccak_224)(r));case 256:return B.Buffer.from((0,jo.keccak_256)(r));case 384:return B.Buffer.from((0,jo.keccak_384)(r));case 512:return B.Buffer.from((0,jo.keccak_512)(r));default:throw new Error(`Invald algorithm: keccak${e}`)}};dt.keccak=fw;var dw=function(t){return(0,dt.keccak)(t)};dt.keccak256=dw;function lw(t,e,r){let n=Math.ceil(e/8);return(0,uw.blake2b)(t,{dkLen:n,key:r})}dt.blake2=lw;function $b(t){let e;return t<253?(e=B.Buffer.alloc(1),e.writeUInt8(t,0)):t<65536?(e=B.Buffer.alloc(1+2),e.writeUInt8(253,0),e.writeUInt16LE(t,1)):t<4294967296?(e=B.Buffer.alloc(1+4),e.writeUInt8(254,0),e.writeUInt32LE(t,1)):(e=B.Buffer.alloc(1+8),e.writeUInt8(255,0),e.writeInt32LE(t&-1,1),e.writeUInt32LE(Math.floor(t/4294967296),5)),e}var hw=B.Buffer.from(`Bitcoin Signed Message:
|
||
`);function bw(t,e){let r=e?B.Buffer.from(e,"utf8"):hw,n=$b(r.length),i=B.Buffer.from(t),o=$b(i.length),a=B.Buffer.concat([n,r,o,i]);return Yb(a)}dt.magicHash=bw});var Jb=L(Co=>{"use strict";E();I();Object.defineProperty(Co,"__esModule",{value:!0});Co.fromBase58Check=Co.toBase58Check=void 0;var Zb=hu(),nA=Ev(),Xb=eo();function pw(t){return(0,Xb.base58check)(Zb.sha256).encode(B.Buffer.from(t))}Co.toBase58Check=pw;function gw(t){let e=(0,Xb.base58check)(Zb.sha256);return B.Buffer.from(e.decode(t))}Co.fromBase58Check=gw});var Qb=L(zo=>{"use strict";E();I();Object.defineProperty(zo,"__esModule",{value:!0});zo.fromBech32=zo.toBech32=void 0;var Pc=eo();function yw(t,e,r){let n=B.Buffer.from(e),i=Pc.bech32.toWords(Uint8Array.from(n));return Pc.bech32.encode(t,i,r)}zo.toBech32=yw;function mw(t,e){let r=Pc.bech32.decode(t,e),n=Pc.bech32.fromWords(r.words);return[r.prefix,B.Buffer.from(n)]}zo.fromBech32=mw});var e1=L(ri=>{"use strict";E();I();Object.defineProperty(ri,"__esModule",{value:!0});ri.isHexPrefixed=ri.stripHexPrefix=ri.fromHex=ri.toHex=void 0;function vw(t,e=!1){let r=B.Buffer.from(t);return e?"0x"+r.toString("hex"):r.toString("hex")}ri.toHex=vw;function ww(t){return t.startsWith("0x")&&(t=t.substring(2)),B.Buffer.from(t,"hex")}ri.fromHex=ww;function _w(t){return t.startsWith("0x")?t.substring(2):t}ri.stripHexPrefix=_w;function Sw(t){return t.startsWith("0x")}ri.isHexPrefixed=Sw});var r1=L(Fo=>{"use strict";E();I();Object.defineProperty(Fo,"__esModule",{value:!0});Fo.fromBase64=Fo.toBase64=void 0;var t1=eo();function Mw(t){let e=B.Buffer.from(t);return t1.base64.encode(Uint8Array.from(e))}Fo.toBase64=Mw;function Ew(t){return t1.base64.decode(t)}Fo.fromBase64=Ew});var pu=L(bu=>{"use strict";E();I();Object.defineProperty(bu,"__esModule",{value:!0});bu.hmac=void 0;var Bc=er(),Tc=class extends Bc.Hash{constructor(e,r){super(),this.finished=!1,this.destroyed=!1,(0,Bc.assertHash)(e);let n=(0,Bc.toBytes)(r);if(this.iHash=e.create(),!(this.iHash instanceof Bc.Hash))throw new TypeError("Expected instance of class which extends utils.Hash");let i=this.blockLen=this.iHash.blockLen;this.outputLen=this.iHash.outputLen;let o=new Uint8Array(i);o.set(n.length>this.iHash.blockLen?e.create().update(n).digest():n);for(let a=0;a<o.length;a++)o[a]^=54;this.iHash.update(o),this.oHash=e.create();for(let a=0;a<o.length;a++)o[a]^=106;this.oHash.update(o),o.fill(0)}update(e){if(this.destroyed)throw new Error("instance is destroyed");return this.iHash.update(e),this}digestInto(e){if(this.destroyed)throw new Error("instance is destroyed");if(!(e instanceof Uint8Array)||e.length!==this.outputLen)throw new Error("HMAC: Invalid output buffer");if(this.finished)throw new Error("digest() was already called");this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){let e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||(e=Object.create(Object.getPrototypeOf(this),{}));let{oHash:r,iHash:n,finished:i,destroyed:o,blockLen:a,outputLen:c}=this;return e=e,e.finished=i,e.destroyed=o,e.blockLen=a,e.outputLen=c,e.oHash=r._cloneInto(e.oHash),e.iHash=n._cloneInto(e.iHash),e}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}},Iw=(t,e,r)=>new Tc(t,e).update(r).digest();bu.hmac=Iw;bu.hmac.create=(t,e)=>new Tc(t,e)});var s1=L(Ho=>{"use strict";E();I();Object.defineProperty(Ho,"__esModule",{value:!0});Ho.hmacSHA512=Ho.hmacSHA256=void 0;var n1=pu(),i1=hu();function xw(t,e){return B.Buffer.from((0,n1.hmac)(i1.sha256,t,e))}Ho.hmacSHA256=xw;function Aw(t,e){return B.Buffer.from((0,n1.hmac)(i1.sha512,t,e))}Ho.hmacSHA512=Aw});var o1=L(Vo=>{"use strict";E();I();Object.defineProperty(Vo,"__esModule",{value:!0});Vo.fromUtf8=Vo.toUtf8=void 0;function Pw(t){return new TextEncoder().encode(t)}Vo.toUtf8=Pw;function Bw(t){return new TextDecoder("utf-8",{fatal:!0}).decode(t)}Vo.fromUtf8=Bw});var ml=L(is=>{"use strict";E();I();Object.defineProperty(is,"__esModule",{value:!0});is.checkIsUndefined=is.checkIsDefined=is.check=void 0;var yl=(t,e)=>{if(!t)throw e=e||"Invalid statement",e=e instanceof Error?e:new Error(e),e};is.check=yl;var Tw=(t,e)=>(yl(typeof t<"u",e||"Expect defined but actually undefined"),t);is.checkIsDefined=Tw;var Ow=(t,e)=>{yl(typeof t>"u",e||`Expect undefined but actually ${t}`)};is.checkIsUndefined=Ow});var u1=L(ni=>{"use strict";E();I();Object.defineProperty(ni,"__esModule",{value:!0});ni.string2BigNumber=ni.bigNumber2String=ni.fromBigIntHex=ni.toBigIntHex=void 0;var a1=ur(),kw=ml(),qw=t=>{let e=t.integerValue().toString(16);return e="0x"+e,e};ni.toBigIntHex=qw;var Nw=t=>((0,kw.check)(t&&t.startsWith("0x"),`Invalid hex string. value: ${t}`),new a1.BigNumber(t).integerValue());ni.fromBigIntHex=Nw;var Lw=(t,e)=>t.integerValue().toString(e);ni.bigNumber2String=Lw;var Kw=(t,e)=>new a1.BigNumber(t,e);ni.string2BigNumber=Kw});var zt=L((c1,vl)=>{E();I();(function(t,e){"use strict";function r(q,f){if(!q)throw new Error(f||"Assertion failed")}function n(q,f){q.super_=f;var v=function(){};v.prototype=f.prototype,q.prototype=new v,q.prototype.constructor=q}function i(q,f,v){if(i.isBN(q))return q;this.negative=0,this.words=null,this.length=0,this.red=null,q!==null&&((f==="le"||f==="be")&&(v=f,f=10),this._init(q||0,f||10,v||"be"))}typeof t=="object"?t.exports=i:e.BN=i,i.BN=i,i.wordSize=26;var o;try{typeof window<"u"&&typeof window.Buffer<"u"?o=window.Buffer:o=Pr().Buffer}catch{}i.isBN=function(f){return f instanceof i?!0:f!==null&&typeof f=="object"&&f.constructor.wordSize===i.wordSize&&Array.isArray(f.words)},i.max=function(f,v){return f.cmp(v)>0?f:v},i.min=function(f,v){return f.cmp(v)<0?f:v},i.prototype._init=function(f,v,h){if(typeof f=="number")return this._initNumber(f,v,h);if(typeof f=="object")return this._initArray(f,v,h);v==="hex"&&(v=16),r(v===(v|0)&&v>=2&&v<=36),f=f.toString().replace(/\s+/g,"");var s=0;f[0]==="-"&&(s++,this.negative=1),s<f.length&&(v===16?this._parseHex(f,s,h):(this._parseBase(f,v,s),h==="le"&&this._initArray(this.toArray(),v,h)))},i.prototype._initNumber=function(f,v,h){f<0&&(this.negative=1,f=-f),f<67108864?(this.words=[f&67108863],this.length=1):f<4503599627370496?(this.words=[f&67108863,f/67108864&67108863],this.length=2):(r(f<9007199254740992),this.words=[f&67108863,f/67108864&67108863,1],this.length=3),h==="le"&&this._initArray(this.toArray(),v,h)},i.prototype._initArray=function(f,v,h){if(r(typeof f.length=="number"),f.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(f.length/3),this.words=new Array(this.length);for(var s=0;s<this.length;s++)this.words[s]=0;var u,b,y=0;if(h==="be")for(s=f.length-1,u=0;s>=0;s-=3)b=f[s]|f[s-1]<<8|f[s-2]<<16,this.words[u]|=b<<y&67108863,this.words[u+1]=b>>>26-y&67108863,y+=24,y>=26&&(y-=26,u++);else if(h==="le")for(s=0,u=0;s<f.length;s+=3)b=f[s]|f[s+1]<<8|f[s+2]<<16,this.words[u]|=b<<y&67108863,this.words[u+1]=b>>>26-y&67108863,y+=24,y>=26&&(y-=26,u++);return this.strip()};function a(q,f){var v=q.charCodeAt(f);return v>=65&&v<=70?v-55:v>=97&&v<=102?v-87:v-48&15}function c(q,f,v){var h=a(q,v);return v-1>=f&&(h|=a(q,v-1)<<4),h}i.prototype._parseHex=function(f,v,h){this.length=Math.ceil((f.length-v)/6),this.words=new Array(this.length);for(var s=0;s<this.length;s++)this.words[s]=0;var u=0,b=0,y;if(h==="be")for(s=f.length-1;s>=v;s-=2)y=c(f,v,s)<<u,this.words[b]|=y&67108863,u>=18?(u-=18,b+=1,this.words[b]|=y>>>26):u+=8;else{var g=f.length-v;for(s=g%2===0?v+1:v;s<f.length;s+=2)y=c(f,v,s)<<u,this.words[b]|=y&67108863,u>=18?(u-=18,b+=1,this.words[b]|=y>>>26):u+=8}this.strip()};function l(q,f,v,h){for(var s=0,u=Math.min(q.length,v),b=f;b<u;b++){var y=q.charCodeAt(b)-48;s*=h,y>=49?s+=y-49+10:y>=17?s+=y-17+10:s+=y}return s}i.prototype._parseBase=function(f,v,h){this.words=[0],this.length=1;for(var s=0,u=1;u<=67108863;u*=v)s++;s--,u=u/v|0;for(var b=f.length-h,y=b%s,g=Math.min(b,b-y)+h,d=0,w=h;w<g;w+=s)d=l(f,w,w+s,v),this.imuln(u),this.words[0]+d<67108864?this.words[0]+=d:this._iaddn(d);if(y!==0){var A=1;for(d=l(f,w,f.length,v),w=0;w<y;w++)A*=v;this.imuln(A),this.words[0]+d<67108864?this.words[0]+=d:this._iaddn(d)}this.strip()},i.prototype.copy=function(f){f.words=new Array(this.length);for(var v=0;v<this.length;v++)f.words[v]=this.words[v];f.length=this.length,f.negative=this.negative,f.red=this.red},i.prototype.clone=function(){var f=new i(null);return this.copy(f),f},i.prototype._expand=function(f){for(;this.length<f;)this.words[this.length++]=0;return this},i.prototype.strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},i.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},i.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var m=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],S=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],_=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];i.prototype.toString=function(f,v){f=f||10,v=v|0||1;var h;if(f===16||f==="hex"){h="";for(var s=0,u=0,b=0;b<this.length;b++){var y=this.words[b],g=((y<<s|u)&16777215).toString(16);u=y>>>24-s&16777215,u!==0||b!==this.length-1?h=m[6-g.length]+g+h:h=g+h,s+=2,s>=26&&(s-=26,b--)}for(u!==0&&(h=u.toString(16)+h);h.length%v!==0;)h="0"+h;return this.negative!==0&&(h="-"+h),h}if(f===(f|0)&&f>=2&&f<=36){var d=S[f],w=_[f];h="";var A=this.clone();for(A.negative=0;!A.isZero();){var p=A.modn(w).toString(f);A=A.idivn(w),A.isZero()?h=p+h:h=m[d-p.length]+p+h}for(this.isZero()&&(h="0"+h);h.length%v!==0;)h="0"+h;return this.negative!==0&&(h="-"+h),h}r(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var f=this.words[0];return this.length===2?f+=this.words[1]*67108864:this.length===3&&this.words[2]===1?f+=4503599627370496+this.words[1]*67108864:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-f:f},i.prototype.toJSON=function(){return this.toString(16)},i.prototype.toBuffer=function(f,v){return r(typeof o<"u"),this.toArrayLike(o,f,v)},i.prototype.toArray=function(f,v){return this.toArrayLike(Array,f,v)},i.prototype.toArrayLike=function(f,v,h){var s=this.byteLength(),u=h||Math.max(1,s);r(s<=u,"byte array longer than desired length"),r(u>0,"Requested array length <= 0"),this.strip();var b=v==="le",y=new f(u),g,d,w=this.clone();if(b){for(d=0;!w.isZero();d++)g=w.andln(255),w.iushrn(8),y[d]=g;for(;d<u;d++)y[d]=0}else{for(d=0;d<u-s;d++)y[d]=0;for(d=0;!w.isZero();d++)g=w.andln(255),w.iushrn(8),y[u-d-1]=g}return y},Math.clz32?i.prototype._countBits=function(f){return 32-Math.clz32(f)}:i.prototype._countBits=function(f){var v=f,h=0;return v>=4096&&(h+=13,v>>>=13),v>=64&&(h+=7,v>>>=7),v>=8&&(h+=4,v>>>=4),v>=2&&(h+=2,v>>>=2),h+v},i.prototype._zeroBits=function(f){if(f===0)return 26;var v=f,h=0;return(v&8191)===0&&(h+=13,v>>>=13),(v&127)===0&&(h+=7,v>>>=7),(v&15)===0&&(h+=4,v>>>=4),(v&3)===0&&(h+=2,v>>>=2),(v&1)===0&&h++,h},i.prototype.bitLength=function(){var f=this.words[this.length-1],v=this._countBits(f);return(this.length-1)*26+v};function P(q){for(var f=new Array(q.bitLength()),v=0;v<f.length;v++){var h=v/26|0,s=v%26;f[v]=(q.words[h]&1<<s)>>>s}return f}i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var f=0,v=0;v<this.length;v++){var h=this._zeroBits(this.words[v]);if(f+=h,h!==26)break}return f},i.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},i.prototype.toTwos=function(f){return this.negative!==0?this.abs().inotn(f).iaddn(1):this.clone()},i.prototype.fromTwos=function(f){return this.testn(f-1)?this.notn(f).iaddn(1).ineg():this.clone()},i.prototype.isNeg=function(){return this.negative!==0},i.prototype.neg=function(){return this.clone().ineg()},i.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},i.prototype.iuor=function(f){for(;this.length<f.length;)this.words[this.length++]=0;for(var v=0;v<f.length;v++)this.words[v]=this.words[v]|f.words[v];return this.strip()},i.prototype.ior=function(f){return r((this.negative|f.negative)===0),this.iuor(f)},i.prototype.or=function(f){return this.length>f.length?this.clone().ior(f):f.clone().ior(this)},i.prototype.uor=function(f){return this.length>f.length?this.clone().iuor(f):f.clone().iuor(this)},i.prototype.iuand=function(f){var v;this.length>f.length?v=f:v=this;for(var h=0;h<v.length;h++)this.words[h]=this.words[h]&f.words[h];return this.length=v.length,this.strip()},i.prototype.iand=function(f){return r((this.negative|f.negative)===0),this.iuand(f)},i.prototype.and=function(f){return this.length>f.length?this.clone().iand(f):f.clone().iand(this)},i.prototype.uand=function(f){return this.length>f.length?this.clone().iuand(f):f.clone().iuand(this)},i.prototype.iuxor=function(f){var v,h;this.length>f.length?(v=this,h=f):(v=f,h=this);for(var s=0;s<h.length;s++)this.words[s]=v.words[s]^h.words[s];if(this!==v)for(;s<v.length;s++)this.words[s]=v.words[s];return this.length=v.length,this.strip()},i.prototype.ixor=function(f){return r((this.negative|f.negative)===0),this.iuxor(f)},i.prototype.xor=function(f){return this.length>f.length?this.clone().ixor(f):f.clone().ixor(this)},i.prototype.uxor=function(f){return this.length>f.length?this.clone().iuxor(f):f.clone().iuxor(this)},i.prototype.inotn=function(f){r(typeof f=="number"&&f>=0);var v=Math.ceil(f/26)|0,h=f%26;this._expand(v),h>0&&v--;for(var s=0;s<v;s++)this.words[s]=~this.words[s]&67108863;return h>0&&(this.words[s]=~this.words[s]&67108863>>26-h),this.strip()},i.prototype.notn=function(f){return this.clone().inotn(f)},i.prototype.setn=function(f,v){r(typeof f=="number"&&f>=0);var h=f/26|0,s=f%26;return this._expand(h+1),v?this.words[h]=this.words[h]|1<<s:this.words[h]=this.words[h]&~(1<<s),this.strip()},i.prototype.iadd=function(f){var v;if(this.negative!==0&&f.negative===0)return this.negative=0,v=this.isub(f),this.negative^=1,this._normSign();if(this.negative===0&&f.negative!==0)return f.negative=0,v=this.isub(f),f.negative=1,v._normSign();var h,s;this.length>f.length?(h=this,s=f):(h=f,s=this);for(var u=0,b=0;b<s.length;b++)v=(h.words[b]|0)+(s.words[b]|0)+u,this.words[b]=v&67108863,u=v>>>26;for(;u!==0&&b<h.length;b++)v=(h.words[b]|0)+u,this.words[b]=v&67108863,u=v>>>26;if(this.length=h.length,u!==0)this.words[this.length]=u,this.length++;else if(h!==this)for(;b<h.length;b++)this.words[b]=h.words[b];return this},i.prototype.add=function(f){var v;return f.negative!==0&&this.negative===0?(f.negative=0,v=this.sub(f),f.negative^=1,v):f.negative===0&&this.negative!==0?(this.negative=0,v=f.sub(this),this.negative=1,v):this.length>f.length?this.clone().iadd(f):f.clone().iadd(this)},i.prototype.isub=function(f){if(f.negative!==0){f.negative=0;var v=this.iadd(f);return f.negative=1,v._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(f),this.negative=1,this._normSign();var h=this.cmp(f);if(h===0)return this.negative=0,this.length=1,this.words[0]=0,this;var s,u;h>0?(s=this,u=f):(s=f,u=this);for(var b=0,y=0;y<u.length;y++)v=(s.words[y]|0)-(u.words[y]|0)+b,b=v>>26,this.words[y]=v&67108863;for(;b!==0&&y<s.length;y++)v=(s.words[y]|0)+b,b=v>>26,this.words[y]=v&67108863;if(b===0&&y<s.length&&s!==this)for(;y<s.length;y++)this.words[y]=s.words[y];return this.length=Math.max(this.length,y),s!==this&&(this.negative=1),this.strip()},i.prototype.sub=function(f){return this.clone().isub(f)};function x(q,f,v){v.negative=f.negative^q.negative;var h=q.length+f.length|0;v.length=h,h=h-1|0;var s=q.words[0]|0,u=f.words[0]|0,b=s*u,y=b&67108863,g=b/67108864|0;v.words[0]=y;for(var d=1;d<h;d++){for(var w=g>>>26,A=g&67108863,p=Math.min(d,f.length-1),O=Math.max(0,d-q.length+1);O<=p;O++){var C=d-O|0;s=q.words[C]|0,u=f.words[O]|0,b=s*u+A,w+=b/67108864|0,A=b&67108863}v.words[d]=A|0,g=w|0}return g!==0?v.words[d]=g|0:v.length--,v.strip()}var T=function(f,v,h){var s=f.words,u=v.words,b=h.words,y=0,g,d,w,A=s[0]|0,p=A&8191,O=A>>>13,C=s[1]|0,F=C&8191,W=C>>>13,X=s[2]|0,ee=X&8191,te=X>>>13,Vt=s[3]|0,ie=Vt&8191,ne=Vt>>>13,sn=s[4]|0,se=sn&8191,ce=sn>>>13,Gi=s[5]|0,le=Gi&8191,he=Gi>>>13,Wa=s[6]|0,be=Wa&8191,pe=Wa>>>13,$a=s[7]|0,ge=$a&8191,ye=$a>>>13,Ga=s[8]|0,me=Ga&8191,ve=Ga>>>13,Ya=s[9]|0,we=Ya&8191,_e=Ya>>>13,Za=u[0]|0,Se=Za&8191,Me=Za>>>13,Xa=u[1]|0,Ee=Xa&8191,Ie=Xa>>>13,Ja=u[2]|0,xe=Ja&8191,Ae=Ja>>>13,Qa=u[3]|0,Pe=Qa&8191,Be=Qa>>>13,eu=u[4]|0,Te=eu&8191,Oe=eu>>>13,tu=u[5]|0,ke=tu&8191,qe=tu>>>13,ru=u[6]|0,Ne=ru&8191,Le=ru>>>13,nu=u[7]|0,Ke=nu&8191,De=nu>>>13,iu=u[8]|0,Re=iu&8191,Ue=iu>>>13,su=u[9]|0,je=su&8191,Ce=su>>>13;h.negative=f.negative^v.negative,h.length=19,g=Math.imul(p,Se),d=Math.imul(p,Me),d=d+Math.imul(O,Se)|0,w=Math.imul(O,Me);var qo=(y+g|0)+((d&8191)<<13)|0;y=(w+(d>>>13)|0)+(qo>>>26)|0,qo&=67108863,g=Math.imul(F,Se),d=Math.imul(F,Me),d=d+Math.imul(W,Se)|0,w=Math.imul(W,Me),g=g+Math.imul(p,Ee)|0,d=d+Math.imul(p,Ie)|0,d=d+Math.imul(O,Ee)|0,w=w+Math.imul(O,Ie)|0;var gt=(y+g|0)+((d&8191)<<13)|0;y=(w+(d>>>13)|0)+(gt>>>26)|0,gt&=67108863,g=Math.imul(ee,Se),d=Math.imul(ee,Me),d=d+Math.imul(te,Se)|0,w=Math.imul(te,Me),g=g+Math.imul(F,Ee)|0,d=d+Math.imul(F,Ie)|0,d=d+Math.imul(W,Ee)|0,w=w+Math.imul(W,Ie)|0,g=g+Math.imul(p,xe)|0,d=d+Math.imul(p,Ae)|0,d=d+Math.imul(O,xe)|0,w=w+Math.imul(O,Ae)|0;var yt=(y+g|0)+((d&8191)<<13)|0;y=(w+(d>>>13)|0)+(yt>>>26)|0,yt&=67108863,g=Math.imul(ie,Se),d=Math.imul(ie,Me),d=d+Math.imul(ne,Se)|0,w=Math.imul(ne,Me),g=g+Math.imul(ee,Ee)|0,d=d+Math.imul(ee,Ie)|0,d=d+Math.imul(te,Ee)|0,w=w+Math.imul(te,Ie)|0,g=g+Math.imul(F,xe)|0,d=d+Math.imul(F,Ae)|0,d=d+Math.imul(W,xe)|0,w=w+Math.imul(W,Ae)|0,g=g+Math.imul(p,Pe)|0,d=d+Math.imul(p,Be)|0,d=d+Math.imul(O,Pe)|0,w=w+Math.imul(O,Be)|0;var Rs=(y+g|0)+((d&8191)<<13)|0;y=(w+(d>>>13)|0)+(Rs>>>26)|0,Rs&=67108863,g=Math.imul(se,Se),d=Math.imul(se,Me),d=d+Math.imul(ce,Se)|0,w=Math.imul(ce,Me),g=g+Math.imul(ie,Ee)|0,d=d+Math.imul(ie,Ie)|0,d=d+Math.imul(ne,Ee)|0,w=w+Math.imul(ne,Ie)|0,g=g+Math.imul(ee,xe)|0,d=d+Math.imul(ee,Ae)|0,d=d+Math.imul(te,xe)|0,w=w+Math.imul(te,Ae)|0,g=g+Math.imul(F,Pe)|0,d=d+Math.imul(F,Be)|0,d=d+Math.imul(W,Pe)|0,w=w+Math.imul(W,Be)|0,g=g+Math.imul(p,Te)|0,d=d+Math.imul(p,Oe)|0,d=d+Math.imul(O,Te)|0,w=w+Math.imul(O,Oe)|0;var Us=(y+g|0)+((d&8191)<<13)|0;y=(w+(d>>>13)|0)+(Us>>>26)|0,Us&=67108863,g=Math.imul(le,Se),d=Math.imul(le,Me),d=d+Math.imul(he,Se)|0,w=Math.imul(he,Me),g=g+Math.imul(se,Ee)|0,d=d+Math.imul(se,Ie)|0,d=d+Math.imul(ce,Ee)|0,w=w+Math.imul(ce,Ie)|0,g=g+Math.imul(ie,xe)|0,d=d+Math.imul(ie,Ae)|0,d=d+Math.imul(ne,xe)|0,w=w+Math.imul(ne,Ae)|0,g=g+Math.imul(ee,Pe)|0,d=d+Math.imul(ee,Be)|0,d=d+Math.imul(te,Pe)|0,w=w+Math.imul(te,Be)|0,g=g+Math.imul(F,Te)|0,d=d+Math.imul(F,Oe)|0,d=d+Math.imul(W,Te)|0,w=w+Math.imul(W,Oe)|0,g=g+Math.imul(p,ke)|0,d=d+Math.imul(p,qe)|0,d=d+Math.imul(O,ke)|0,w=w+Math.imul(O,qe)|0;var js=(y+g|0)+((d&8191)<<13)|0;y=(w+(d>>>13)|0)+(js>>>26)|0,js&=67108863,g=Math.imul(be,Se),d=Math.imul(be,Me),d=d+Math.imul(pe,Se)|0,w=Math.imul(pe,Me),g=g+Math.imul(le,Ee)|0,d=d+Math.imul(le,Ie)|0,d=d+Math.imul(he,Ee)|0,w=w+Math.imul(he,Ie)|0,g=g+Math.imul(se,xe)|0,d=d+Math.imul(se,Ae)|0,d=d+Math.imul(ce,xe)|0,w=w+Math.imul(ce,Ae)|0,g=g+Math.imul(ie,Pe)|0,d=d+Math.imul(ie,Be)|0,d=d+Math.imul(ne,Pe)|0,w=w+Math.imul(ne,Be)|0,g=g+Math.imul(ee,Te)|0,d=d+Math.imul(ee,Oe)|0,d=d+Math.imul(te,Te)|0,w=w+Math.imul(te,Oe)|0,g=g+Math.imul(F,ke)|0,d=d+Math.imul(F,qe)|0,d=d+Math.imul(W,ke)|0,w=w+Math.imul(W,qe)|0,g=g+Math.imul(p,Ne)|0,d=d+Math.imul(p,Le)|0,d=d+Math.imul(O,Ne)|0,w=w+Math.imul(O,Le)|0;var Cs=(y+g|0)+((d&8191)<<13)|0;y=(w+(d>>>13)|0)+(Cs>>>26)|0,Cs&=67108863,g=Math.imul(ge,Se),d=Math.imul(ge,Me),d=d+Math.imul(ye,Se)|0,w=Math.imul(ye,Me),g=g+Math.imul(be,Ee)|0,d=d+Math.imul(be,Ie)|0,d=d+Math.imul(pe,Ee)|0,w=w+Math.imul(pe,Ie)|0,g=g+Math.imul(le,xe)|0,d=d+Math.imul(le,Ae)|0,d=d+Math.imul(he,xe)|0,w=w+Math.imul(he,Ae)|0,g=g+Math.imul(se,Pe)|0,d=d+Math.imul(se,Be)|0,d=d+Math.imul(ce,Pe)|0,w=w+Math.imul(ce,Be)|0,g=g+Math.imul(ie,Te)|0,d=d+Math.imul(ie,Oe)|0,d=d+Math.imul(ne,Te)|0,w=w+Math.imul(ne,Oe)|0,g=g+Math.imul(ee,ke)|0,d=d+Math.imul(ee,qe)|0,d=d+Math.imul(te,ke)|0,w=w+Math.imul(te,qe)|0,g=g+Math.imul(F,Ne)|0,d=d+Math.imul(F,Le)|0,d=d+Math.imul(W,Ne)|0,w=w+Math.imul(W,Le)|0,g=g+Math.imul(p,Ke)|0,d=d+Math.imul(p,De)|0,d=d+Math.imul(O,Ke)|0,w=w+Math.imul(O,De)|0;var zs=(y+g|0)+((d&8191)<<13)|0;y=(w+(d>>>13)|0)+(zs>>>26)|0,zs&=67108863,g=Math.imul(me,Se),d=Math.imul(me,Me),d=d+Math.imul(ve,Se)|0,w=Math.imul(ve,Me),g=g+Math.imul(ge,Ee)|0,d=d+Math.imul(ge,Ie)|0,d=d+Math.imul(ye,Ee)|0,w=w+Math.imul(ye,Ie)|0,g=g+Math.imul(be,xe)|0,d=d+Math.imul(be,Ae)|0,d=d+Math.imul(pe,xe)|0,w=w+Math.imul(pe,Ae)|0,g=g+Math.imul(le,Pe)|0,d=d+Math.imul(le,Be)|0,d=d+Math.imul(he,Pe)|0,w=w+Math.imul(he,Be)|0,g=g+Math.imul(se,Te)|0,d=d+Math.imul(se,Oe)|0,d=d+Math.imul(ce,Te)|0,w=w+Math.imul(ce,Oe)|0,g=g+Math.imul(ie,ke)|0,d=d+Math.imul(ie,qe)|0,d=d+Math.imul(ne,ke)|0,w=w+Math.imul(ne,qe)|0,g=g+Math.imul(ee,Ne)|0,d=d+Math.imul(ee,Le)|0,d=d+Math.imul(te,Ne)|0,w=w+Math.imul(te,Le)|0,g=g+Math.imul(F,Ke)|0,d=d+Math.imul(F,De)|0,d=d+Math.imul(W,Ke)|0,w=w+Math.imul(W,De)|0,g=g+Math.imul(p,Re)|0,d=d+Math.imul(p,Ue)|0,d=d+Math.imul(O,Re)|0,w=w+Math.imul(O,Ue)|0;var Fs=(y+g|0)+((d&8191)<<13)|0;y=(w+(d>>>13)|0)+(Fs>>>26)|0,Fs&=67108863,g=Math.imul(we,Se),d=Math.imul(we,Me),d=d+Math.imul(_e,Se)|0,w=Math.imul(_e,Me),g=g+Math.imul(me,Ee)|0,d=d+Math.imul(me,Ie)|0,d=d+Math.imul(ve,Ee)|0,w=w+Math.imul(ve,Ie)|0,g=g+Math.imul(ge,xe)|0,d=d+Math.imul(ge,Ae)|0,d=d+Math.imul(ye,xe)|0,w=w+Math.imul(ye,Ae)|0,g=g+Math.imul(be,Pe)|0,d=d+Math.imul(be,Be)|0,d=d+Math.imul(pe,Pe)|0,w=w+Math.imul(pe,Be)|0,g=g+Math.imul(le,Te)|0,d=d+Math.imul(le,Oe)|0,d=d+Math.imul(he,Te)|0,w=w+Math.imul(he,Oe)|0,g=g+Math.imul(se,ke)|0,d=d+Math.imul(se,qe)|0,d=d+Math.imul(ce,ke)|0,w=w+Math.imul(ce,qe)|0,g=g+Math.imul(ie,Ne)|0,d=d+Math.imul(ie,Le)|0,d=d+Math.imul(ne,Ne)|0,w=w+Math.imul(ne,Le)|0,g=g+Math.imul(ee,Ke)|0,d=d+Math.imul(ee,De)|0,d=d+Math.imul(te,Ke)|0,w=w+Math.imul(te,De)|0,g=g+Math.imul(F,Re)|0,d=d+Math.imul(F,Ue)|0,d=d+Math.imul(W,Re)|0,w=w+Math.imul(W,Ue)|0,g=g+Math.imul(p,je)|0,d=d+Math.imul(p,Ce)|0,d=d+Math.imul(O,je)|0,w=w+Math.imul(O,Ce)|0;var Hs=(y+g|0)+((d&8191)<<13)|0;y=(w+(d>>>13)|0)+(Hs>>>26)|0,Hs&=67108863,g=Math.imul(we,Ee),d=Math.imul(we,Ie),d=d+Math.imul(_e,Ee)|0,w=Math.imul(_e,Ie),g=g+Math.imul(me,xe)|0,d=d+Math.imul(me,Ae)|0,d=d+Math.imul(ve,xe)|0,w=w+Math.imul(ve,Ae)|0,g=g+Math.imul(ge,Pe)|0,d=d+Math.imul(ge,Be)|0,d=d+Math.imul(ye,Pe)|0,w=w+Math.imul(ye,Be)|0,g=g+Math.imul(be,Te)|0,d=d+Math.imul(be,Oe)|0,d=d+Math.imul(pe,Te)|0,w=w+Math.imul(pe,Oe)|0,g=g+Math.imul(le,ke)|0,d=d+Math.imul(le,qe)|0,d=d+Math.imul(he,ke)|0,w=w+Math.imul(he,qe)|0,g=g+Math.imul(se,Ne)|0,d=d+Math.imul(se,Le)|0,d=d+Math.imul(ce,Ne)|0,w=w+Math.imul(ce,Le)|0,g=g+Math.imul(ie,Ke)|0,d=d+Math.imul(ie,De)|0,d=d+Math.imul(ne,Ke)|0,w=w+Math.imul(ne,De)|0,g=g+Math.imul(ee,Re)|0,d=d+Math.imul(ee,Ue)|0,d=d+Math.imul(te,Re)|0,w=w+Math.imul(te,Ue)|0,g=g+Math.imul(F,je)|0,d=d+Math.imul(F,Ce)|0,d=d+Math.imul(W,je)|0,w=w+Math.imul(W,Ce)|0;var Vs=(y+g|0)+((d&8191)<<13)|0;y=(w+(d>>>13)|0)+(Vs>>>26)|0,Vs&=67108863,g=Math.imul(we,xe),d=Math.imul(we,Ae),d=d+Math.imul(_e,xe)|0,w=Math.imul(_e,Ae),g=g+Math.imul(me,Pe)|0,d=d+Math.imul(me,Be)|0,d=d+Math.imul(ve,Pe)|0,w=w+Math.imul(ve,Be)|0,g=g+Math.imul(ge,Te)|0,d=d+Math.imul(ge,Oe)|0,d=d+Math.imul(ye,Te)|0,w=w+Math.imul(ye,Oe)|0,g=g+Math.imul(be,ke)|0,d=d+Math.imul(be,qe)|0,d=d+Math.imul(pe,ke)|0,w=w+Math.imul(pe,qe)|0,g=g+Math.imul(le,Ne)|0,d=d+Math.imul(le,Le)|0,d=d+Math.imul(he,Ne)|0,w=w+Math.imul(he,Le)|0,g=g+Math.imul(se,Ke)|0,d=d+Math.imul(se,De)|0,d=d+Math.imul(ce,Ke)|0,w=w+Math.imul(ce,De)|0,g=g+Math.imul(ie,Re)|0,d=d+Math.imul(ie,Ue)|0,d=d+Math.imul(ne,Re)|0,w=w+Math.imul(ne,Ue)|0,g=g+Math.imul(ee,je)|0,d=d+Math.imul(ee,Ce)|0,d=d+Math.imul(te,je)|0,w=w+Math.imul(te,Ce)|0;var Ws=(y+g|0)+((d&8191)<<13)|0;y=(w+(d>>>13)|0)+(Ws>>>26)|0,Ws&=67108863,g=Math.imul(we,Pe),d=Math.imul(we,Be),d=d+Math.imul(_e,Pe)|0,w=Math.imul(_e,Be),g=g+Math.imul(me,Te)|0,d=d+Math.imul(me,Oe)|0,d=d+Math.imul(ve,Te)|0,w=w+Math.imul(ve,Oe)|0,g=g+Math.imul(ge,ke)|0,d=d+Math.imul(ge,qe)|0,d=d+Math.imul(ye,ke)|0,w=w+Math.imul(ye,qe)|0,g=g+Math.imul(be,Ne)|0,d=d+Math.imul(be,Le)|0,d=d+Math.imul(pe,Ne)|0,w=w+Math.imul(pe,Le)|0,g=g+Math.imul(le,Ke)|0,d=d+Math.imul(le,De)|0,d=d+Math.imul(he,Ke)|0,w=w+Math.imul(he,De)|0,g=g+Math.imul(se,Re)|0,d=d+Math.imul(se,Ue)|0,d=d+Math.imul(ce,Re)|0,w=w+Math.imul(ce,Ue)|0,g=g+Math.imul(ie,je)|0,d=d+Math.imul(ie,Ce)|0,d=d+Math.imul(ne,je)|0,w=w+Math.imul(ne,Ce)|0;var $s=(y+g|0)+((d&8191)<<13)|0;y=(w+(d>>>13)|0)+($s>>>26)|0,$s&=67108863,g=Math.imul(we,Te),d=Math.imul(we,Oe),d=d+Math.imul(_e,Te)|0,w=Math.imul(_e,Oe),g=g+Math.imul(me,ke)|0,d=d+Math.imul(me,qe)|0,d=d+Math.imul(ve,ke)|0,w=w+Math.imul(ve,qe)|0,g=g+Math.imul(ge,Ne)|0,d=d+Math.imul(ge,Le)|0,d=d+Math.imul(ye,Ne)|0,w=w+Math.imul(ye,Le)|0,g=g+Math.imul(be,Ke)|0,d=d+Math.imul(be,De)|0,d=d+Math.imul(pe,Ke)|0,w=w+Math.imul(pe,De)|0,g=g+Math.imul(le,Re)|0,d=d+Math.imul(le,Ue)|0,d=d+Math.imul(he,Re)|0,w=w+Math.imul(he,Ue)|0,g=g+Math.imul(se,je)|0,d=d+Math.imul(se,Ce)|0,d=d+Math.imul(ce,je)|0,w=w+Math.imul(ce,Ce)|0;var Gs=(y+g|0)+((d&8191)<<13)|0;y=(w+(d>>>13)|0)+(Gs>>>26)|0,Gs&=67108863,g=Math.imul(we,ke),d=Math.imul(we,qe),d=d+Math.imul(_e,ke)|0,w=Math.imul(_e,qe),g=g+Math.imul(me,Ne)|0,d=d+Math.imul(me,Le)|0,d=d+Math.imul(ve,Ne)|0,w=w+Math.imul(ve,Le)|0,g=g+Math.imul(ge,Ke)|0,d=d+Math.imul(ge,De)|0,d=d+Math.imul(ye,Ke)|0,w=w+Math.imul(ye,De)|0,g=g+Math.imul(be,Re)|0,d=d+Math.imul(be,Ue)|0,d=d+Math.imul(pe,Re)|0,w=w+Math.imul(pe,Ue)|0,g=g+Math.imul(le,je)|0,d=d+Math.imul(le,Ce)|0,d=d+Math.imul(he,je)|0,w=w+Math.imul(he,Ce)|0;var Ys=(y+g|0)+((d&8191)<<13)|0;y=(w+(d>>>13)|0)+(Ys>>>26)|0,Ys&=67108863,g=Math.imul(we,Ne),d=Math.imul(we,Le),d=d+Math.imul(_e,Ne)|0,w=Math.imul(_e,Le),g=g+Math.imul(me,Ke)|0,d=d+Math.imul(me,De)|0,d=d+Math.imul(ve,Ke)|0,w=w+Math.imul(ve,De)|0,g=g+Math.imul(ge,Re)|0,d=d+Math.imul(ge,Ue)|0,d=d+Math.imul(ye,Re)|0,w=w+Math.imul(ye,Ue)|0,g=g+Math.imul(be,je)|0,d=d+Math.imul(be,Ce)|0,d=d+Math.imul(pe,je)|0,w=w+Math.imul(pe,Ce)|0;var Zs=(y+g|0)+((d&8191)<<13)|0;y=(w+(d>>>13)|0)+(Zs>>>26)|0,Zs&=67108863,g=Math.imul(we,Ke),d=Math.imul(we,De),d=d+Math.imul(_e,Ke)|0,w=Math.imul(_e,De),g=g+Math.imul(me,Re)|0,d=d+Math.imul(me,Ue)|0,d=d+Math.imul(ve,Re)|0,w=w+Math.imul(ve,Ue)|0,g=g+Math.imul(ge,je)|0,d=d+Math.imul(ge,Ce)|0,d=d+Math.imul(ye,je)|0,w=w+Math.imul(ye,Ce)|0;var Xs=(y+g|0)+((d&8191)<<13)|0;y=(w+(d>>>13)|0)+(Xs>>>26)|0,Xs&=67108863,g=Math.imul(we,Re),d=Math.imul(we,Ue),d=d+Math.imul(_e,Re)|0,w=Math.imul(_e,Ue),g=g+Math.imul(me,je)|0,d=d+Math.imul(me,Ce)|0,d=d+Math.imul(ve,je)|0,w=w+Math.imul(ve,Ce)|0;var Js=(y+g|0)+((d&8191)<<13)|0;y=(w+(d>>>13)|0)+(Js>>>26)|0,Js&=67108863,g=Math.imul(we,je),d=Math.imul(we,Ce),d=d+Math.imul(_e,je)|0,w=Math.imul(_e,Ce);var Qs=(y+g|0)+((d&8191)<<13)|0;return y=(w+(d>>>13)|0)+(Qs>>>26)|0,Qs&=67108863,b[0]=qo,b[1]=gt,b[2]=yt,b[3]=Rs,b[4]=Us,b[5]=js,b[6]=Cs,b[7]=zs,b[8]=Fs,b[9]=Hs,b[10]=Vs,b[11]=Ws,b[12]=$s,b[13]=Gs,b[14]=Ys,b[15]=Zs,b[16]=Xs,b[17]=Js,b[18]=Qs,y!==0&&(b[19]=y,h.length++),h};Math.imul||(T=x);function M(q,f,v){v.negative=f.negative^q.negative,v.length=q.length+f.length;for(var h=0,s=0,u=0;u<v.length-1;u++){var b=s;s=0;for(var y=h&67108863,g=Math.min(u,f.length-1),d=Math.max(0,u-q.length+1);d<=g;d++){var w=u-d,A=q.words[w]|0,p=f.words[d]|0,O=A*p,C=O&67108863;b=b+(O/67108864|0)|0,C=C+y|0,y=C&67108863,b=b+(C>>>26)|0,s+=b>>>26,b&=67108863}v.words[u]=y,h=b,b=s}return h!==0?v.words[u]=h:v.length--,v.strip()}function k(q,f,v){var h=new N;return h.mulp(q,f,v)}i.prototype.mulTo=function(f,v){var h,s=this.length+f.length;return this.length===10&&f.length===10?h=T(this,f,v):s<63?h=x(this,f,v):s<1024?h=M(this,f,v):h=k(this,f,v),h};function N(q,f){this.x=q,this.y=f}N.prototype.makeRBT=function(f){for(var v=new Array(f),h=i.prototype._countBits(f)-1,s=0;s<f;s++)v[s]=this.revBin(s,h,f);return v},N.prototype.revBin=function(f,v,h){if(f===0||f===h-1)return f;for(var s=0,u=0;u<v;u++)s|=(f&1)<<v-u-1,f>>=1;return s},N.prototype.permute=function(f,v,h,s,u,b){for(var y=0;y<b;y++)s[y]=v[f[y]],u[y]=h[f[y]]},N.prototype.transform=function(f,v,h,s,u,b){this.permute(b,f,v,h,s,u);for(var y=1;y<u;y<<=1)for(var g=y<<1,d=Math.cos(2*Math.PI/g),w=Math.sin(2*Math.PI/g),A=0;A<u;A+=g)for(var p=d,O=w,C=0;C<y;C++){var F=h[A+C],W=s[A+C],X=h[A+C+y],ee=s[A+C+y],te=p*X-O*ee;ee=p*ee+O*X,X=te,h[A+C]=F+X,s[A+C]=W+ee,h[A+C+y]=F-X,s[A+C+y]=W-ee,C!==g&&(te=d*p-w*O,O=d*O+w*p,p=te)}},N.prototype.guessLen13b=function(f,v){var h=Math.max(v,f)|1,s=h&1,u=0;for(h=h/2|0;h;h=h>>>1)u++;return 1<<u+1+s},N.prototype.conjugate=function(f,v,h){if(!(h<=1))for(var s=0;s<h/2;s++){var u=f[s];f[s]=f[h-s-1],f[h-s-1]=u,u=v[s],v[s]=-v[h-s-1],v[h-s-1]=-u}},N.prototype.normalize13b=function(f,v){for(var h=0,s=0;s<v/2;s++){var u=Math.round(f[2*s+1]/v)*8192+Math.round(f[2*s]/v)+h;f[s]=u&67108863,u<67108864?h=0:h=u/67108864|0}return f},N.prototype.convert13b=function(f,v,h,s){for(var u=0,b=0;b<v;b++)u=u+(f[b]|0),h[2*b]=u&8191,u=u>>>13,h[2*b+1]=u&8191,u=u>>>13;for(b=2*v;b<s;++b)h[b]=0;r(u===0),r((u&-8192)===0)},N.prototype.stub=function(f){for(var v=new Array(f),h=0;h<f;h++)v[h]=0;return v},N.prototype.mulp=function(f,v,h){var s=2*this.guessLen13b(f.length,v.length),u=this.makeRBT(s),b=this.stub(s),y=new Array(s),g=new Array(s),d=new Array(s),w=new Array(s),A=new Array(s),p=new Array(s),O=h.words;O.length=s,this.convert13b(f.words,f.length,y,s),this.convert13b(v.words,v.length,w,s),this.transform(y,b,g,d,s,u),this.transform(w,b,A,p,s,u);for(var C=0;C<s;C++){var F=g[C]*A[C]-d[C]*p[C];d[C]=g[C]*p[C]+d[C]*A[C],g[C]=F}return this.conjugate(g,d,s),this.transform(g,d,O,b,s,u),this.conjugate(O,b,s),this.normalize13b(O,s),h.negative=f.negative^v.negative,h.length=f.length+v.length,h.strip()},i.prototype.mul=function(f){var v=new i(null);return v.words=new Array(this.length+f.length),this.mulTo(f,v)},i.prototype.mulf=function(f){var v=new i(null);return v.words=new Array(this.length+f.length),k(this,f,v)},i.prototype.imul=function(f){return this.clone().mulTo(f,this)},i.prototype.imuln=function(f){r(typeof f=="number"),r(f<67108864);for(var v=0,h=0;h<this.length;h++){var s=(this.words[h]|0)*f,u=(s&67108863)+(v&67108863);v>>=26,v+=s/67108864|0,v+=u>>>26,this.words[h]=u&67108863}return v!==0&&(this.words[h]=v,this.length++),this},i.prototype.muln=function(f){return this.clone().imuln(f)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(f){var v=P(f);if(v.length===0)return new i(1);for(var h=this,s=0;s<v.length&&v[s]===0;s++,h=h.sqr());if(++s<v.length)for(var u=h.sqr();s<v.length;s++,u=u.sqr())v[s]!==0&&(h=h.mul(u));return h},i.prototype.iushln=function(f){r(typeof f=="number"&&f>=0);var v=f%26,h=(f-v)/26,s=67108863>>>26-v<<26-v,u;if(v!==0){var b=0;for(u=0;u<this.length;u++){var y=this.words[u]&s,g=(this.words[u]|0)-y<<v;this.words[u]=g|b,b=y>>>26-v}b&&(this.words[u]=b,this.length++)}if(h!==0){for(u=this.length-1;u>=0;u--)this.words[u+h]=this.words[u];for(u=0;u<h;u++)this.words[u]=0;this.length+=h}return this.strip()},i.prototype.ishln=function(f){return r(this.negative===0),this.iushln(f)},i.prototype.iushrn=function(f,v,h){r(typeof f=="number"&&f>=0);var s;v?s=(v-v%26)/26:s=0;var u=f%26,b=Math.min((f-u)/26,this.length),y=67108863^67108863>>>u<<u,g=h;if(s-=b,s=Math.max(0,s),g){for(var d=0;d<b;d++)g.words[d]=this.words[d];g.length=b}if(b!==0)if(this.length>b)for(this.length-=b,d=0;d<this.length;d++)this.words[d]=this.words[d+b];else this.words[0]=0,this.length=1;var w=0;for(d=this.length-1;d>=0&&(w!==0||d>=s);d--){var A=this.words[d]|0;this.words[d]=w<<26-u|A>>>u,w=A&y}return g&&w!==0&&(g.words[g.length++]=w),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},i.prototype.ishrn=function(f,v,h){return r(this.negative===0),this.iushrn(f,v,h)},i.prototype.shln=function(f){return this.clone().ishln(f)},i.prototype.ushln=function(f){return this.clone().iushln(f)},i.prototype.shrn=function(f){return this.clone().ishrn(f)},i.prototype.ushrn=function(f){return this.clone().iushrn(f)},i.prototype.testn=function(f){r(typeof f=="number"&&f>=0);var v=f%26,h=(f-v)/26,s=1<<v;if(this.length<=h)return!1;var u=this.words[h];return!!(u&s)},i.prototype.imaskn=function(f){r(typeof f=="number"&&f>=0);var v=f%26,h=(f-v)/26;if(r(this.negative===0,"imaskn works only with positive numbers"),this.length<=h)return this;if(v!==0&&h++,this.length=Math.min(h,this.length),v!==0){var s=67108863^67108863>>>v<<v;this.words[this.length-1]&=s}return this.strip()},i.prototype.maskn=function(f){return this.clone().imaskn(f)},i.prototype.iaddn=function(f){return r(typeof f=="number"),r(f<67108864),f<0?this.isubn(-f):this.negative!==0?this.length===1&&(this.words[0]|0)<f?(this.words[0]=f-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(f),this.negative=1,this):this._iaddn(f)},i.prototype._iaddn=function(f){this.words[0]+=f;for(var v=0;v<this.length&&this.words[v]>=67108864;v++)this.words[v]-=67108864,v===this.length-1?this.words[v+1]=1:this.words[v+1]++;return this.length=Math.max(this.length,v+1),this},i.prototype.isubn=function(f){if(r(typeof f=="number"),r(f<67108864),f<0)return this.iaddn(-f);if(this.negative!==0)return this.negative=0,this.iaddn(f),this.negative=1,this;if(this.words[0]-=f,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var v=0;v<this.length&&this.words[v]<0;v++)this.words[v]+=67108864,this.words[v+1]-=1;return this.strip()},i.prototype.addn=function(f){return this.clone().iaddn(f)},i.prototype.subn=function(f){return this.clone().isubn(f)},i.prototype.iabs=function(){return this.negative=0,this},i.prototype.abs=function(){return this.clone().iabs()},i.prototype._ishlnsubmul=function(f,v,h){var s=f.length+h,u;this._expand(s);var b,y=0;for(u=0;u<f.length;u++){b=(this.words[u+h]|0)+y;var g=(f.words[u]|0)*v;b-=g&67108863,y=(b>>26)-(g/67108864|0),this.words[u+h]=b&67108863}for(;u<this.length-h;u++)b=(this.words[u+h]|0)+y,y=b>>26,this.words[u+h]=b&67108863;if(y===0)return this.strip();for(r(y===-1),y=0,u=0;u<this.length;u++)b=-(this.words[u]|0)+y,y=b>>26,this.words[u]=b&67108863;return this.negative=1,this.strip()},i.prototype._wordDiv=function(f,v){var h=this.length-f.length,s=this.clone(),u=f,b=u.words[u.length-1]|0,y=this._countBits(b);h=26-y,h!==0&&(u=u.ushln(h),s.iushln(h),b=u.words[u.length-1]|0);var g=s.length-u.length,d;if(v!=="mod"){d=new i(null),d.length=g+1,d.words=new Array(d.length);for(var w=0;w<d.length;w++)d.words[w]=0}var A=s.clone()._ishlnsubmul(u,1,g);A.negative===0&&(s=A,d&&(d.words[g]=1));for(var p=g-1;p>=0;p--){var O=(s.words[u.length+p]|0)*67108864+(s.words[u.length+p-1]|0);for(O=Math.min(O/b|0,67108863),s._ishlnsubmul(u,O,p);s.negative!==0;)O--,s.negative=0,s._ishlnsubmul(u,1,p),s.isZero()||(s.negative^=1);d&&(d.words[p]=O)}return d&&d.strip(),s.strip(),v!=="div"&&h!==0&&s.iushrn(h),{div:d||null,mod:s}},i.prototype.divmod=function(f,v,h){if(r(!f.isZero()),this.isZero())return{div:new i(0),mod:new i(0)};var s,u,b;return this.negative!==0&&f.negative===0?(b=this.neg().divmod(f,v),v!=="mod"&&(s=b.div.neg()),v!=="div"&&(u=b.mod.neg(),h&&u.negative!==0&&u.iadd(f)),{div:s,mod:u}):this.negative===0&&f.negative!==0?(b=this.divmod(f.neg(),v),v!=="mod"&&(s=b.div.neg()),{div:s,mod:b.mod}):(this.negative&f.negative)!==0?(b=this.neg().divmod(f.neg(),v),v!=="div"&&(u=b.mod.neg(),h&&u.negative!==0&&u.isub(f)),{div:b.div,mod:u}):f.length>this.length||this.cmp(f)<0?{div:new i(0),mod:this}:f.length===1?v==="div"?{div:this.divn(f.words[0]),mod:null}:v==="mod"?{div:null,mod:new i(this.modn(f.words[0]))}:{div:this.divn(f.words[0]),mod:new i(this.modn(f.words[0]))}:this._wordDiv(f,v)},i.prototype.div=function(f){return this.divmod(f,"div",!1).div},i.prototype.mod=function(f){return this.divmod(f,"mod",!1).mod},i.prototype.umod=function(f){return this.divmod(f,"mod",!0).mod},i.prototype.divRound=function(f){var v=this.divmod(f);if(v.mod.isZero())return v.div;var h=v.div.negative!==0?v.mod.isub(f):v.mod,s=f.ushrn(1),u=f.andln(1),b=h.cmp(s);return b<0||u===1&&b===0?v.div:v.div.negative!==0?v.div.isubn(1):v.div.iaddn(1)},i.prototype.modn=function(f){r(f<=67108863);for(var v=(1<<26)%f,h=0,s=this.length-1;s>=0;s--)h=(v*h+(this.words[s]|0))%f;return h},i.prototype.idivn=function(f){r(f<=67108863);for(var v=0,h=this.length-1;h>=0;h--){var s=(this.words[h]|0)+v*67108864;this.words[h]=s/f|0,v=s%f}return this.strip()},i.prototype.divn=function(f){return this.clone().idivn(f)},i.prototype.egcd=function(f){r(f.negative===0),r(!f.isZero());var v=this,h=f.clone();v.negative!==0?v=v.umod(f):v=v.clone();for(var s=new i(1),u=new i(0),b=new i(0),y=new i(1),g=0;v.isEven()&&h.isEven();)v.iushrn(1),h.iushrn(1),++g;for(var d=h.clone(),w=v.clone();!v.isZero();){for(var A=0,p=1;(v.words[0]&p)===0&&A<26;++A,p<<=1);if(A>0)for(v.iushrn(A);A-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(d),u.isub(w)),s.iushrn(1),u.iushrn(1);for(var O=0,C=1;(h.words[0]&C)===0&&O<26;++O,C<<=1);if(O>0)for(h.iushrn(O);O-- >0;)(b.isOdd()||y.isOdd())&&(b.iadd(d),y.isub(w)),b.iushrn(1),y.iushrn(1);v.cmp(h)>=0?(v.isub(h),s.isub(b),u.isub(y)):(h.isub(v),b.isub(s),y.isub(u))}return{a:b,b:y,gcd:h.iushln(g)}},i.prototype._invmp=function(f){r(f.negative===0),r(!f.isZero());var v=this,h=f.clone();v.negative!==0?v=v.umod(f):v=v.clone();for(var s=new i(1),u=new i(0),b=h.clone();v.cmpn(1)>0&&h.cmpn(1)>0;){for(var y=0,g=1;(v.words[0]&g)===0&&y<26;++y,g<<=1);if(y>0)for(v.iushrn(y);y-- >0;)s.isOdd()&&s.iadd(b),s.iushrn(1);for(var d=0,w=1;(h.words[0]&w)===0&&d<26;++d,w<<=1);if(d>0)for(h.iushrn(d);d-- >0;)u.isOdd()&&u.iadd(b),u.iushrn(1);v.cmp(h)>=0?(v.isub(h),s.isub(u)):(h.isub(v),u.isub(s))}var A;return v.cmpn(1)===0?A=s:A=u,A.cmpn(0)<0&&A.iadd(f),A},i.prototype.gcd=function(f){if(this.isZero())return f.abs();if(f.isZero())return this.abs();var v=this.clone(),h=f.clone();v.negative=0,h.negative=0;for(var s=0;v.isEven()&&h.isEven();s++)v.iushrn(1),h.iushrn(1);do{for(;v.isEven();)v.iushrn(1);for(;h.isEven();)h.iushrn(1);var u=v.cmp(h);if(u<0){var b=v;v=h,h=b}else if(u===0||h.cmpn(1)===0)break;v.isub(h)}while(!0);return h.iushln(s)},i.prototype.invm=function(f){return this.egcd(f).a.umod(f)},i.prototype.isEven=function(){return(this.words[0]&1)===0},i.prototype.isOdd=function(){return(this.words[0]&1)===1},i.prototype.andln=function(f){return this.words[0]&f},i.prototype.bincn=function(f){r(typeof f=="number");var v=f%26,h=(f-v)/26,s=1<<v;if(this.length<=h)return this._expand(h+1),this.words[h]|=s,this;for(var u=s,b=h;u!==0&&b<this.length;b++){var y=this.words[b]|0;y+=u,u=y>>>26,y&=67108863,this.words[b]=y}return u!==0&&(this.words[b]=u,this.length++),this},i.prototype.isZero=function(){return this.length===1&&this.words[0]===0},i.prototype.cmpn=function(f){var v=f<0;if(this.negative!==0&&!v)return-1;if(this.negative===0&&v)return 1;this.strip();var h;if(this.length>1)h=1;else{v&&(f=-f),r(f<=67108863,"Number is too big");var s=this.words[0]|0;h=s===f?0:s<f?-1:1}return this.negative!==0?-h|0:h},i.prototype.cmp=function(f){if(this.negative!==0&&f.negative===0)return-1;if(this.negative===0&&f.negative!==0)return 1;var v=this.ucmp(f);return this.negative!==0?-v|0:v},i.prototype.ucmp=function(f){if(this.length>f.length)return 1;if(this.length<f.length)return-1;for(var v=0,h=this.length-1;h>=0;h--){var s=this.words[h]|0,u=f.words[h]|0;if(s!==u){s<u?v=-1:s>u&&(v=1);break}}return v},i.prototype.gtn=function(f){return this.cmpn(f)===1},i.prototype.gt=function(f){return this.cmp(f)===1},i.prototype.gten=function(f){return this.cmpn(f)>=0},i.prototype.gte=function(f){return this.cmp(f)>=0},i.prototype.ltn=function(f){return this.cmpn(f)===-1},i.prototype.lt=function(f){return this.cmp(f)===-1},i.prototype.lten=function(f){return this.cmpn(f)<=0},i.prototype.lte=function(f){return this.cmp(f)<=0},i.prototype.eqn=function(f){return this.cmpn(f)===0},i.prototype.eq=function(f){return this.cmp(f)===0},i.red=function(f){return new H(f)},i.prototype.toRed=function(f){return r(!this.red,"Already a number in reduction context"),r(this.negative===0,"red works only with positives"),f.convertTo(this)._forceRed(f)},i.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(f){return this.red=f,this},i.prototype.forceRed=function(f){return r(!this.red,"Already a number in reduction context"),this._forceRed(f)},i.prototype.redAdd=function(f){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,f)},i.prototype.redIAdd=function(f){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,f)},i.prototype.redSub=function(f){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,f)},i.prototype.redISub=function(f){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,f)},i.prototype.redShl=function(f){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,f)},i.prototype.redMul=function(f){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,f),this.red.mul(this,f)},i.prototype.redIMul=function(f){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,f),this.red.imul(this,f)},i.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(f){return r(this.red&&!f.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,f)};var R={k256:null,p224:null,p192:null,p25519:null};function K(q,f){this.name=q,this.p=new i(f,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}K.prototype._tmp=function(){var f=new i(null);return f.words=new Array(Math.ceil(this.n/13)),f},K.prototype.ireduce=function(f){var v=f,h;do this.split(v,this.tmp),v=this.imulK(v),v=v.iadd(this.tmp),h=v.bitLength();while(h>this.n);var s=h<this.n?-1:v.ucmp(this.p);return s===0?(v.words[0]=0,v.length=1):s>0?v.isub(this.p):v.strip!==void 0?v.strip():v._strip(),v},K.prototype.split=function(f,v){f.iushrn(this.n,0,v)},K.prototype.imulK=function(f){return f.imul(this.k)};function z(){K.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}n(z,K),z.prototype.split=function(f,v){for(var h=4194303,s=Math.min(f.length,9),u=0;u<s;u++)v.words[u]=f.words[u];if(v.length=s,f.length<=9){f.words[0]=0,f.length=1;return}var b=f.words[9];for(v.words[v.length++]=b&h,u=10;u<f.length;u++){var y=f.words[u]|0;f.words[u-10]=(y&h)<<4|b>>>22,b=y}b>>>=22,f.words[u-10]=b,b===0&&f.length>10?f.length-=10:f.length-=9},z.prototype.imulK=function(f){f.words[f.length]=0,f.words[f.length+1]=0,f.length+=2;for(var v=0,h=0;h<f.length;h++){var s=f.words[h]|0;v+=s*977,f.words[h]=v&67108863,v=s*64+(v/67108864|0)}return f.words[f.length-1]===0&&(f.length--,f.words[f.length-1]===0&&f.length--),f};function j(){K.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}n(j,K);function U(){K.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}n(U,K);function V(){K.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}n(V,K),V.prototype.imulK=function(f){for(var v=0,h=0;h<f.length;h++){var s=(f.words[h]|0)*19+v,u=s&67108863;s>>>=26,f.words[h]=u,v=s}return v!==0&&(f.words[f.length++]=v),f},i._prime=function(f){if(R[f])return R[f];var v;if(f==="k256")v=new z;else if(f==="p224")v=new j;else if(f==="p192")v=new U;else if(f==="p25519")v=new V;else throw new Error("Unknown prime "+f);return R[f]=v,v};function H(q){if(typeof q=="string"){var f=i._prime(q);this.m=f.p,this.prime=f}else r(q.gtn(1),"modulus must be greater than 1"),this.m=q,this.prime=null}H.prototype._verify1=function(f){r(f.negative===0,"red works only with positives"),r(f.red,"red works only with red numbers")},H.prototype._verify2=function(f,v){r((f.negative|v.negative)===0,"red works only with positives"),r(f.red&&f.red===v.red,"red works only with red numbers")},H.prototype.imod=function(f){return this.prime?this.prime.ireduce(f)._forceRed(this):f.umod(this.m)._forceRed(this)},H.prototype.neg=function(f){return f.isZero()?f.clone():this.m.sub(f)._forceRed(this)},H.prototype.add=function(f,v){this._verify2(f,v);var h=f.add(v);return h.cmp(this.m)>=0&&h.isub(this.m),h._forceRed(this)},H.prototype.iadd=function(f,v){this._verify2(f,v);var h=f.iadd(v);return h.cmp(this.m)>=0&&h.isub(this.m),h},H.prototype.sub=function(f,v){this._verify2(f,v);var h=f.sub(v);return h.cmpn(0)<0&&h.iadd(this.m),h._forceRed(this)},H.prototype.isub=function(f,v){this._verify2(f,v);var h=f.isub(v);return h.cmpn(0)<0&&h.iadd(this.m),h},H.prototype.shl=function(f,v){return this._verify1(f),this.imod(f.ushln(v))},H.prototype.imul=function(f,v){return this._verify2(f,v),this.imod(f.imul(v))},H.prototype.mul=function(f,v){return this._verify2(f,v),this.imod(f.mul(v))},H.prototype.isqr=function(f){return this.imul(f,f.clone())},H.prototype.sqr=function(f){return this.mul(f,f)},H.prototype.sqrt=function(f){if(f.isZero())return f.clone();var v=this.m.andln(3);if(r(v%2===1),v===3){var h=this.m.add(new i(1)).iushrn(2);return this.pow(f,h)}for(var s=this.m.subn(1),u=0;!s.isZero()&&s.andln(1)===0;)u++,s.iushrn(1);r(!s.isZero());var b=new i(1).toRed(this),y=b.redNeg(),g=this.m.subn(1).iushrn(1),d=this.m.bitLength();for(d=new i(2*d*d).toRed(this);this.pow(d,g).cmp(y)!==0;)d.redIAdd(y);for(var w=this.pow(d,s),A=this.pow(f,s.addn(1).iushrn(1)),p=this.pow(f,s),O=u;p.cmp(b)!==0;){for(var C=p,F=0;C.cmp(b)!==0;F++)C=C.redSqr();r(F<O);var W=this.pow(w,new i(1).iushln(O-F-1));A=A.redMul(W),w=W.redSqr(),p=p.redMul(w),O=F}return A},H.prototype.invm=function(f){var v=f._invmp(this.m);return v.negative!==0?(v.negative=0,this.imod(v).redNeg()):this.imod(v)},H.prototype.pow=function(f,v){if(v.isZero())return new i(1).toRed(this);if(v.cmpn(1)===0)return f.clone();var h=4,s=new Array(1<<h);s[0]=new i(1).toRed(this),s[1]=f;for(var u=2;u<s.length;u++)s[u]=this.mul(s[u-1],f);var b=s[0],y=0,g=0,d=v.bitLength()%26;for(d===0&&(d=26),u=v.length-1;u>=0;u--){for(var w=v.words[u],A=d-1;A>=0;A--){var p=w>>A&1;if(b!==s[0]&&(b=this.sqr(b)),p===0&&y===0){g=0;continue}y<<=1,y|=p,g++,!(g!==h&&(u!==0||A!==0))&&(b=this.mul(b,s[y]),g=0,y=0)}d=26}return b},H.prototype.convertTo=function(f){var v=f.umod(this.m);return v===f?v.clone():v},H.prototype.convertFrom=function(f){var v=f.clone();return v.red=null,v},i.mont=function(f){return new J(f)};function J(q){H.call(this,q),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new i(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}n(J,H),J.prototype.convertTo=function(f){return this.imod(f.ushln(this.shift))},J.prototype.convertFrom=function(f){var v=this.imod(f.mul(this.rinv));return v.red=null,v},J.prototype.imul=function(f,v){if(f.isZero()||v.isZero())return f.words[0]=0,f.length=1,f;var h=f.imul(v),s=h.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),u=h.isub(s).iushrn(this.shift),b=u;return u.cmp(this.m)>=0?b=u.isub(this.m):u.cmpn(0)<0&&(b=u.iadd(this.m)),b._forceRed(this)},J.prototype.mul=function(f,v){if(f.isZero()||v.isZero())return new i(0)._forceRed(this);var h=f.mul(v),s=h.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),u=h.isub(s).iushrn(this.shift),b=u;return u.cmp(this.m)>=0?b=u.isub(this.m):u.cmpn(0)<0&&(b=u.iadd(this.m)),b._forceRed(this)},J.prototype.invm=function(f){var v=this.imod(f._invmp(this.m).mul(this.r2));return v._forceRed(this)}})(typeof vl>"u"||vl,c1)});var h1=L(Br=>{"use strict";E();I();var Dw=Br&&Br.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Br,"__esModule",{value:!0});Br.stripHexPrefix=Br.isHexPrefixed=Br.getLength=Br.decode=Br.encode=void 0;var Rw=Dw(zt());function d1(t){if(Array.isArray(t)){let e=[];for(let n=0;n<t.length;n++)e.push(d1(t[n]));let r=B.Buffer.concat(e);return B.Buffer.concat([f1(r.length,192),r])}else{let e=El(t);return e.length===1&&e[0]<128?e:B.Buffer.concat([f1(e.length,128),e])}}Br.encode=d1;function wl(t,e){if(t[0]==="0"&&t[1]==="0")throw new Error("invalid RLP: extra zeros");return parseInt(t,e)}function f1(t,e){if(t<56)return B.Buffer.from([t+e]);{let r=Sl(t),n=r.length/2,i=Sl(e+55+n);return B.Buffer.from(i+r,"hex")}}function Uw(t,e=!1){if(!t||t.length===0)return B.Buffer.from([]);let r=El(t),n=_l(r);if(e)return n;if(n.remainder.length!==0)throw new Error("invalid remainder");return n.data}Br.decode=Uw;function jw(t){if(!t||t.length===0)return B.Buffer.from([]);let e=El(t),r=e[0];if(r<=127)return e.length;if(r<=183)return r-127;if(r<=191)return r-182;if(r<=247)return r-191;{let n=r-246,i=wl(e.slice(1,n).toString("hex"),16);return n+i}}Br.getLength=jw;function _l(t){let e,r,n,i,o,a=[],c=t[0];if(c<=127)return{data:t.slice(0,1),remainder:t.slice(1)};if(c<=183){if(e=c-127,c===128?n=B.Buffer.from([]):n=t.slice(1,e),e===2&&n[0]<128)throw new Error("invalid rlp encoding: byte must be less 0x80");return{data:n,remainder:t.slice(e)}}else if(c<=191){if(r=c-182,t.length-1<r)throw new Error("invalid RLP: not enough bytes for string length");if(e=wl(t.slice(1,r).toString("hex"),16),e<=55)throw new Error("invalid RLP: expected string length to be greater than 55");if(n=t.slice(r,e+r),n.length<e)throw new Error("invalid RLP: not enough bytes for string");return{data:n,remainder:t.slice(e+r)}}else if(c<=247){for(e=c-191,i=t.slice(1,e);i.length;)o=_l(i),a.push(o.data),i=o.remainder;return{data:a,remainder:t.slice(e)}}else{r=c-246,e=wl(t.slice(1,r).toString("hex"),16);let l=r+e;if(l>t.length)throw new Error("invalid rlp: total length is larger than the data");if(i=t.slice(r,l),i.length===0)throw new Error("invalid rlp, List has a invalid length");for(;i.length;)o=_l(i),a.push(o.data),i=o.remainder;return{data:a,remainder:t.slice(l)}}}function Ml(t){return t.slice(0,2)==="0x"}Br.isHexPrefixed=Ml;function l1(t){return Ml(t)?t.slice(2):t}Br.stripHexPrefix=l1;function Sl(t){if(t<0)throw new Error("Invalid integer as argument, must be unsigned!");let e=t.toString(16);return e.length%2?`0${e}`:e}function Cw(t){return t.length%2?`0${t}`:t}function zw(t){let e=Sl(t);return B.Buffer.from(e,"hex")}function El(t){if(!B.Buffer.isBuffer(t)){if(typeof t=="string")return Ml(t)?B.Buffer.from(Cw(l1(t)),"hex"):B.Buffer.from(t);if(typeof t=="number"||typeof t=="bigint")return t?zw(t):B.Buffer.from([]);if(t==null)return B.Buffer.from([]);if(t instanceof Uint8Array)return B.Buffer.from(t);if(Rw.default.isBN(t))return B.Buffer.from(t.toArray());throw new Error("invalid type")}return t}});var b1=L(Wo=>{"use strict";E();I();Object.defineProperty(Wo,"__esModule",{value:!0});Wo.validateHexString=Wo.isHexString=void 0;function Fw(t,e){return t.match(/^0x[0-9A-Fa-f]*$/)?!(e&&t.length!==2+2*e):!1}Wo.isHexString=Fw;function Hw(t){if(!t)return!1;let e=t.toLowerCase().startsWith("0x")?t.substring(2).toLowerCase():t.toLowerCase();return!(e.length===0||e.length%2!==0||!e.match(/^[0-9A-Fa-f]*$/))}Wo.validateHexString=Hw});var p1=L(Oc=>{"use strict";E();I();Object.defineProperty(Oc,"__esModule",{value:!0});Oc.encode=void 0;function Vw(t){var e="0123456789abcdef";function r(j){var U,V="";for(U=0;U<=3;U++)V+=e.charAt(j>>U*8+4&15)+e.charAt(j>>U*8&15);return V}function n(j,U){var V=(j&65535)+(U&65535),H=(j>>16)+(U>>16)+(V>>16);return H<<16|V&65535}function i(j,U){return j<<U|j>>>32-U}function o(j,U,V,H,J,q){return n(i(n(n(U,j),n(H,q)),J),V)}function a(j,U,V,H,J,q,f){return o(U&V|~U&H,j,U,J,q,f)}function c(j,U,V,H,J,q,f){return o(U&H|V&~H,j,U,J,q,f)}function l(j,U,V,H,J,q,f){return o(U^V^H,j,U,J,q,f)}function m(j,U,V,H,J,q,f){return o(V^(U|~H),j,U,J,q,f)}function S(j){var U,V=(j.length+8>>6)+1,H=new Array(V*16);for(U=0;U<V*16;U++)H[U]=0;for(U=0;U<j.length;U++)H[U>>2]|=j.charCodeAt(U)<<U%4*8;return H[U>>2]|=128<<U%4*8,H[V*16-2]=j.length*8,H}var _,P=S(""+t),x=1732584193,T=-271733879,M=-1732584194,k=271733878,N,R,K,z;for(_=0;_<P.length;_+=16)N=x,R=T,K=M,z=k,x=a(x,T,M,k,P[_+0],7,-680876936),k=a(k,x,T,M,P[_+1],12,-389564586),M=a(M,k,x,T,P[_+2],17,606105819),T=a(T,M,k,x,P[_+3],22,-1044525330),x=a(x,T,M,k,P[_+4],7,-176418897),k=a(k,x,T,M,P[_+5],12,1200080426),M=a(M,k,x,T,P[_+6],17,-1473231341),T=a(T,M,k,x,P[_+7],22,-45705983),x=a(x,T,M,k,P[_+8],7,1770035416),k=a(k,x,T,M,P[_+9],12,-1958414417),M=a(M,k,x,T,P[_+10],17,-42063),T=a(T,M,k,x,P[_+11],22,-1990404162),x=a(x,T,M,k,P[_+12],7,1804603682),k=a(k,x,T,M,P[_+13],12,-40341101),M=a(M,k,x,T,P[_+14],17,-1502002290),T=a(T,M,k,x,P[_+15],22,1236535329),x=c(x,T,M,k,P[_+1],5,-165796510),k=c(k,x,T,M,P[_+6],9,-1069501632),M=c(M,k,x,T,P[_+11],14,643717713),T=c(T,M,k,x,P[_+0],20,-373897302),x=c(x,T,M,k,P[_+5],5,-701558691),k=c(k,x,T,M,P[_+10],9,38016083),M=c(M,k,x,T,P[_+15],14,-660478335),T=c(T,M,k,x,P[_+4],20,-405537848),x=c(x,T,M,k,P[_+9],5,568446438),k=c(k,x,T,M,P[_+14],9,-1019803690),M=c(M,k,x,T,P[_+3],14,-187363961),T=c(T,M,k,x,P[_+8],20,1163531501),x=c(x,T,M,k,P[_+13],5,-1444681467),k=c(k,x,T,M,P[_+2],9,-51403784),M=c(M,k,x,T,P[_+7],14,1735328473),T=c(T,M,k,x,P[_+12],20,-1926607734),x=l(x,T,M,k,P[_+5],4,-378558),k=l(k,x,T,M,P[_+8],11,-2022574463),M=l(M,k,x,T,P[_+11],16,1839030562),T=l(T,M,k,x,P[_+14],23,-35309556),x=l(x,T,M,k,P[_+1],4,-1530992060),k=l(k,x,T,M,P[_+4],11,1272893353),M=l(M,k,x,T,P[_+7],16,-155497632),T=l(T,M,k,x,P[_+10],23,-1094730640),x=l(x,T,M,k,P[_+13],4,681279174),k=l(k,x,T,M,P[_+0],11,-358537222),M=l(M,k,x,T,P[_+3],16,-722521979),T=l(T,M,k,x,P[_+6],23,76029189),x=l(x,T,M,k,P[_+9],4,-640364487),k=l(k,x,T,M,P[_+12],11,-421815835),M=l(M,k,x,T,P[_+15],16,530742520),T=l(T,M,k,x,P[_+2],23,-995338651),x=m(x,T,M,k,P[_+0],6,-198630844),k=m(k,x,T,M,P[_+7],10,1126891415),M=m(M,k,x,T,P[_+14],15,-1416354905),T=m(T,M,k,x,P[_+5],21,-57434055),x=m(x,T,M,k,P[_+12],6,1700485571),k=m(k,x,T,M,P[_+3],10,-1894986606),M=m(M,k,x,T,P[_+10],15,-1051523),T=m(T,M,k,x,P[_+1],21,-2054922799),x=m(x,T,M,k,P[_+8],6,1873313359),k=m(k,x,T,M,P[_+15],10,-30611744),M=m(M,k,x,T,P[_+6],15,-1560198380),T=m(T,M,k,x,P[_+13],21,1309151649),x=m(x,T,M,k,P[_+4],6,-145523070),k=m(k,x,T,M,P[_+11],10,-1120210379),M=m(M,k,x,T,P[_+2],15,718787259),T=m(T,M,k,x,P[_+9],21,-343485551),x=n(x,N),T=n(T,R),M=n(M,K),k=n(k,z);return r(x)+r(T)+r(M)+r(k)}Oc.encode=Vw});var xl=L(nt=>{"use strict";E();I();var Ww=nt&&nt.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),$w=nt&&nt.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),y1=nt&&nt.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Ww(e,t,r);return $w(e,t),e};Object.defineProperty(nt,"__esModule",{value:!0});nt.blake2s=nt.compress=nt.IV=void 0;var Gw=y1(Lo()),g1=y1(xc()),ii=er();nt.IV=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]);function ss(t,e,r,n,i){return t=t+e+i|0,n=(0,ii.rotr)(n^t,16),r=r+n|0,e=(0,ii.rotr)(e^r,12),{a:t,b:e,c:r,d:n}}function os(t,e,r,n,i){return t=t+e+i|0,n=(0,ii.rotr)(n^t,8),r=r+n|0,e=(0,ii.rotr)(e^r,7),{a:t,b:e,c:r,d:n}}function m1(t,e,r,n,i,o,a,c,l,m,S,_,P,x,T,M,k,N,R,K){let z=0;for(let j=0;j<n;j++)({a:i,b:l,c:P,d:k}=ss(i,l,P,k,r[e+t[z++]])),{a:i,b:l,c:P,d:k}=os(i,l,P,k,r[e+t[z++]]),{a:o,b:m,c:x,d:N}=ss(o,m,x,N,r[e+t[z++]]),{a:o,b:m,c:x,d:N}=os(o,m,x,N,r[e+t[z++]]),{a,b:S,c:T,d:R}=ss(a,S,T,R,r[e+t[z++]]),{a,b:S,c:T,d:R}=os(a,S,T,R,r[e+t[z++]]),{a:c,b:_,c:M,d:K}=ss(c,_,M,K,r[e+t[z++]]),{a:c,b:_,c:M,d:K}=os(c,_,M,K,r[e+t[z++]]),{a:i,b:m,c:T,d:K}=ss(i,m,T,K,r[e+t[z++]]),{a:i,b:m,c:T,d:K}=os(i,m,T,K,r[e+t[z++]]),{a:o,b:S,c:M,d:k}=ss(o,S,M,k,r[e+t[z++]]),{a:o,b:S,c:M,d:k}=os(o,S,M,k,r[e+t[z++]]),{a,b:_,c:P,d:N}=ss(a,_,P,N,r[e+t[z++]]),{a,b:_,c:P,d:N}=os(a,_,P,N,r[e+t[z++]]),{a:c,b:l,c:x,d:R}=ss(c,l,x,R,r[e+t[z++]]),{a:c,b:l,c:x,d:R}=os(c,l,x,R,r[e+t[z++]]);return{v0:i,v1:o,v2:a,v3:c,v4:l,v5:m,v6:S,v7:_,v8:P,v9:x,v10:T,v11:M,v12:k,v13:N,v14:R,v15:K}}nt.compress=m1;var Il=class extends g1.BLAKE2{constructor(e={}){super(64,e.dkLen===void 0?32:e.dkLen,e,32,8,8),this.v0=nt.IV[0]|0,this.v1=nt.IV[1]|0,this.v2=nt.IV[2]|0,this.v3=nt.IV[3]|0,this.v4=nt.IV[4]|0,this.v5=nt.IV[5]|0,this.v6=nt.IV[6]|0,this.v7=nt.IV[7]|0;let r=e.key?e.key.length:0;if(this.v0^=this.outputLen|r<<8|1<<16|1<<24,e.salt){let n=(0,ii.u32)((0,ii.toBytes)(e.salt));this.v4^=n[0],this.v5^=n[1]}if(e.personalization){let n=(0,ii.u32)((0,ii.toBytes)(e.personalization));this.v6^=n[0],this.v7^=n[1]}if(e.key){let n=new Uint8Array(this.blockLen);n.set((0,ii.toBytes)(e.key)),this.update(n)}}get(){let{v0:e,v1:r,v2:n,v3:i,v4:o,v5:a,v6:c,v7:l}=this;return[e,r,n,i,o,a,c,l]}set(e,r,n,i,o,a,c,l){this.v0=e|0,this.v1=r|0,this.v2=n|0,this.v3=i|0,this.v4=o|0,this.v5=a|0,this.v6=c|0,this.v7=l|0}compress(e,r,n){let{h:i,l:o}=Gw.fromBig(BigInt(this.length)),{v0:a,v1:c,v2:l,v3:m,v4:S,v5:_,v6:P,v7:x,v8:T,v9:M,v10:k,v11:N,v12:R,v13:K,v14:z,v15:j}=m1(g1.SIGMA,r,e,10,this.v0,this.v1,this.v2,this.v3,this.v4,this.v5,this.v6,this.v7,nt.IV[0],nt.IV[1],nt.IV[2],nt.IV[3],o^nt.IV[4],i^nt.IV[5],n?~nt.IV[6]:nt.IV[6],nt.IV[7]);this.v0^=a^T,this.v1^=c^M,this.v2^=l^k,this.v3^=m^N,this.v4^=S^R,this.v5^=_^K,this.v6^=P^z,this.v7^=x^j}destroy(){this.destroyed=!0,this.buffer32.fill(0),this.set(0,0,0,0,0,0,0,0)}};nt.blake2s=(0,ii.wrapConstructorWithOpts)(t=>new Il(t))});var kc=L($o=>{"use strict";E();I();Object.defineProperty($o,"__esModule",{value:!0});$o.pbkdf2Async=$o.pbkdf2=void 0;var Yw=pu(),si=er();function v1(t,e,r,n){(0,si.assertHash)(t);let i=(0,si.checkOpts)({dkLen:32,asyncTick:10},n),{c:o,dkLen:a,asyncTick:c}=i;if((0,si.assertNumber)(o),(0,si.assertNumber)(a),(0,si.assertNumber)(c),o<1)throw new Error("PBKDF2: iterations (c) should be >= 1");let l=(0,si.toBytes)(e),m=(0,si.toBytes)(r),S=new Uint8Array(a),_=Yw.hmac.create(t,l),P=_._cloneInto().update(m);return{c:o,dkLen:a,asyncTick:c,DK:S,PRF:_,PRFSalt:P}}function w1(t,e,r,n,i){return t.destroy(),e.destroy(),n&&n.destroy(),i.fill(0),r}function Zw(t,e,r,n){let{c:i,dkLen:o,DK:a,PRF:c,PRFSalt:l}=v1(t,e,r,n),m,S=new Uint8Array(4),_=(0,si.createView)(S),P=new Uint8Array(c.outputLen);for(let x=1,T=0;T<o;x++,T+=c.outputLen){let M=a.subarray(T,T+c.outputLen);_.setInt32(0,x,!1),(m=l._cloneInto(m)).update(S).digestInto(P),M.set(P.subarray(0,M.length));for(let k=1;k<i;k++){c._cloneInto(m).update(P).digestInto(P);for(let N=0;N<M.length;N++)M[N]^=P[N]}}return w1(c,l,a,m,P)}$o.pbkdf2=Zw;async function Xw(t,e,r,n){let{c:i,dkLen:o,asyncTick:a,DK:c,PRF:l,PRFSalt:m}=v1(t,e,r,n),S,_=new Uint8Array(4),P=(0,si.createView)(_),x=new Uint8Array(l.outputLen);for(let T=1,M=0;M<o;T++,M+=l.outputLen){let k=c.subarray(M,M+l.outputLen);P.setInt32(0,T,!1),(S=m._cloneInto(S)).update(_).digestInto(x),k.set(x.subarray(0,k.length)),await(0,si.asyncLoop)(i-1,a,N=>{l._cloneInto(S).update(x).digestInto(x);for(let R=0;R<k.length;R++)k[R]^=x[R]})}return w1(l,m,c,S,x)}$o.pbkdf2Async=Xw});var x1=L(Yo=>{"use strict";E();I();Object.defineProperty(Yo,"__esModule",{value:!0});Yo.scryptAsync=Yo.scrypt=void 0;var S1=No(),M1=kc(),on=er(),et=(t,e)=>t<<e|t>>>32-e;function _1(t,e,r,n,i,o){let a=t[e++]^r[n++],c=t[e++]^r[n++],l=t[e++]^r[n++],m=t[e++]^r[n++],S=t[e++]^r[n++],_=t[e++]^r[n++],P=t[e++]^r[n++],x=t[e++]^r[n++],T=t[e++]^r[n++],M=t[e++]^r[n++],k=t[e++]^r[n++],N=t[e++]^r[n++],R=t[e++]^r[n++],K=t[e++]^r[n++],z=t[e++]^r[n++],j=t[e++]^r[n++],U=a,V=c,H=l,J=m,q=S,f=_,v=P,h=x,s=T,u=M,b=k,y=N,g=R,d=K,w=z,A=j;for(let p=0;p<8;p+=2)q^=et(U+g|0,7),s^=et(q+U|0,9),g^=et(s+q|0,13),U^=et(g+s|0,18),u^=et(f+V|0,7),d^=et(u+f|0,9),V^=et(d+u|0,13),f^=et(V+d|0,18),w^=et(b+v|0,7),H^=et(w+b|0,9),v^=et(H+w|0,13),b^=et(v+H|0,18),J^=et(A+y|0,7),h^=et(J+A|0,9),y^=et(h+J|0,13),A^=et(y+h|0,18),V^=et(U+J|0,7),H^=et(V+U|0,9),J^=et(H+V|0,13),U^=et(J+H|0,18),v^=et(f+q|0,7),h^=et(v+f|0,9),q^=et(h+v|0,13),f^=et(q+h|0,18),y^=et(b+u|0,7),s^=et(y+b|0,9),u^=et(s+y|0,13),b^=et(u+s|0,18),g^=et(A+w|0,7),d^=et(g+A|0,9),w^=et(d+g|0,13),A^=et(w+d|0,18);i[o++]=a+U|0,i[o++]=c+V|0,i[o++]=l+H|0,i[o++]=m+J|0,i[o++]=S+q|0,i[o++]=_+f|0,i[o++]=P+v|0,i[o++]=x+h|0,i[o++]=T+s|0,i[o++]=M+u|0,i[o++]=k+b|0,i[o++]=N+y|0,i[o++]=R+g|0,i[o++]=K+d|0,i[o++]=z+w|0,i[o++]=j+A|0}function Go(t,e,r,n,i){let o=n+0,a=n+16*i;for(let c=0;c<16;c++)r[a+c]=t[e+(2*i-1)*16+c];for(let c=0;c<i;c++,o+=16,e+=16)_1(r,a,t,e,r,o),c>0&&(a+=16),_1(r,o,t,e+=16,r,a)}function E1(t,e,r){let n=(0,on.checkOpts)({dkLen:32,asyncTick:10,maxmem:1073742848},r),{N:i,r:o,p:a,dkLen:c,asyncTick:l,maxmem:m,onProgress:S}=n;if((0,on.assertNumber)(i),(0,on.assertNumber)(o),(0,on.assertNumber)(a),(0,on.assertNumber)(c),(0,on.assertNumber)(l),(0,on.assertNumber)(m),S!==void 0&&typeof S!="function")throw new Error("progressCb should be function");let _=128*o,P=_/4;if(i<=1||(i&i-1)!==0||i>=2**(_/8)||i>2**32)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(a<0||a>(2**32-1)*32/_)throw new Error("Scrypt: p must be a positive integer less than or equal to ((2^32 - 1) * 32) / (128 * r)");if(c<0||c>(2**32-1)*32)throw new Error("Scrypt: dkLen should be positive integer less than or equal to (2^32 - 1) * 32");let x=_*(i+a);if(x>m)throw new Error(`Scrypt: parameters too large, ${x} (128 * r * (N + p)) > ${m} (maxmem)`);let T=(0,M1.pbkdf2)(S1.sha256,t,e,{c:1,dkLen:_*a}),M=(0,on.u32)(T),k=(0,on.u32)(new Uint8Array(_*i)),N=(0,on.u32)(new Uint8Array(_)),R=()=>{};if(S){let K=2*i*a,z=Math.max(Math.floor(K/1e4),1),j=0;R=()=>{j++,S&&(!(j%z)||j===K)&&S(j/K)}}return{N:i,r:o,p:a,dkLen:c,blockSize32:P,V:k,B32:M,B:T,tmp:N,blockMixCb:R,asyncTick:l}}function I1(t,e,r,n,i){let o=(0,M1.pbkdf2)(S1.sha256,t,r,{c:1,dkLen:e});return r.fill(0),n.fill(0),i.fill(0),o}function Jw(t,e,r){let{N:n,r:i,p:o,dkLen:a,blockSize32:c,V:l,B32:m,B:S,tmp:_,blockMixCb:P}=E1(t,e,r);for(let x=0;x<o;x++){let T=c*x;for(let M=0;M<c;M++)l[M]=m[T+M];for(let M=0,k=0;M<n-1;M++)Go(l,k,l,k+=c,i),P();Go(l,(n-1)*c,m,T,i),P();for(let M=0;M<n;M++){let k=m[T+c-16]%n;for(let N=0;N<c;N++)_[N]=m[T+N]^l[k*c+N];Go(_,0,m,T,i),P()}}return I1(t,a,S,l,_)}Yo.scrypt=Jw;async function Qw(t,e,r){let{N:n,r:i,p:o,dkLen:a,blockSize32:c,V:l,B32:m,B:S,tmp:_,blockMixCb:P,asyncTick:x}=E1(t,e,r);for(let T=0;T<o;T++){let M=c*T;for(let N=0;N<c;N++)l[N]=m[M+N];let k=0;await(0,on.asyncLoop)(n-1,x,N=>{Go(l,k,l,k+=c,i),P()}),Go(l,(n-1)*c,m,M,i),P(),await(0,on.asyncLoop)(n,x,N=>{let R=m[M+c-16]%n;for(let K=0;K<c;K++)_[K]=m[M+K]^l[R*c+K];Go(_,0,m,M,i),P()})}return I1(t,a,S,l,_)}Yo.scryptAsync=Qw});var B1=L(oi=>{"use strict";E();I();var e6=oi&&oi.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),t6=oi&&oi.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Al=oi&&oi.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&e6(e,t,r);return t6(e,t),e};Object.defineProperty(oi,"__esModule",{value:!0});oi.blake3=void 0;var A1=Al(Lo()),r6=Al(xc()),Kn=Al(xl()),io=er(),an;(function(t){t[t.CHUNK_START=1]="CHUNK_START",t[t.CHUNK_END=2]="CHUNK_END",t[t.PARENT=4]="PARENT",t[t.ROOT=8]="ROOT",t[t.KEYED_HASH=16]="KEYED_HASH",t[t.DERIVE_KEY_CONTEXT=32]="DERIVE_KEY_CONTEXT",t[t.DERIVE_KEY_MATERIAL=64]="DERIVE_KEY_MATERIAL"})(an||(an={}));var P1=(()=>{let t=Array.from({length:16},(n,i)=>i),e=n=>[2,6,3,10,7,0,4,13,1,11,12,5,9,14,15,8].map(i=>n[i]),r=[];for(let n=0,i=t;n<7;n++,i=e(i))r.push(...i);return Uint8Array.from(r)})(),gu=class extends r6.BLAKE2{constructor(e={},r=0){if(super(64,e.dkLen===void 0?32:e.dkLen,{},Number.MAX_SAFE_INTEGER,0,0),this.flags=0,this.chunkPos=0,this.chunksDone=0,this.stack=[],this.posOut=0,this.bufferOut32=new Uint32Array(16),this.chunkOut=0,this.enableXOF=!0,this.outputLen=e.dkLen===void 0?32:e.dkLen,(0,io.assertNumber)(this.outputLen),e.key!==void 0&&e.context!==void 0)throw new Error("Blake3: only key or context can be specified at same time");if(e.key!==void 0){let n=(0,io.toBytes)(e.key);if(n.length!==32)throw new Error("Blake3: key should be 32 byte");this.IV=(0,io.u32)(n),this.flags=r|an.KEYED_HASH}else if(e.context!==void 0){let n=new gu({dkLen:32},an.DERIVE_KEY_CONTEXT).update(e.context).digest();this.IV=(0,io.u32)(n),this.flags=r|an.DERIVE_KEY_MATERIAL}else this.IV=Kn.IV.slice(),this.flags=r;this.state=this.IV.slice(),this.bufferOut=(0,io.u8)(this.bufferOut32)}get(){return[]}set(){}b2Compress(e,r,n,i=0){let{state:o,pos:a}=this,{h:c,l}=A1.fromBig(BigInt(e),!0),{v0:m,v1:S,v2:_,v3:P,v4:x,v5:T,v6:M,v7:k,v8:N,v9:R,v10:K,v11:z,v12:j,v13:U,v14:V,v15:H}=Kn.compress(P1,i,n,7,o[0],o[1],o[2],o[3],o[4],o[5],o[6],o[7],Kn.IV[0],Kn.IV[1],Kn.IV[2],Kn.IV[3],c,l,a,r);o[0]=m^N,o[1]=S^R,o[2]=_^K,o[3]=P^z,o[4]=x^j,o[5]=T^U,o[6]=M^V,o[7]=k^H}compress(e,r=0,n=!1){let i=this.flags;if(this.chunkPos||(i|=an.CHUNK_START),(this.chunkPos===15||n)&&(i|=an.CHUNK_END),n||(this.pos=this.blockLen),this.b2Compress(this.chunksDone,i,e,r),this.chunkPos+=1,this.chunkPos===16||n){let o=this.state;this.state=this.IV.slice();for(let a,c=this.chunksDone+1;(n||!(c&1))&&(a=this.stack.pop());c>>=1)this.buffer32.set(a,0),this.buffer32.set(o,8),this.pos=this.blockLen,this.b2Compress(0,this.flags|an.PARENT,this.buffer32,0),o=this.state,this.state=this.IV.slice();this.chunksDone++,this.chunkPos=0,this.stack.push(o)}this.pos=0}_cloneInto(e){e=super._cloneInto(e);let{IV:r,flags:n,state:i,chunkPos:o,posOut:a,chunkOut:c,stack:l,chunksDone:m}=this;return e.state.set(i.slice()),e.stack=l.map(S=>Uint32Array.from(S)),e.IV.set(r),e.flags=n,e.chunkPos=o,e.chunksDone=m,e.posOut=a,e.chunkOut=c,e.enableXOF=this.enableXOF,e.bufferOut32.set(this.bufferOut32),e}destroy(){this.destroyed=!0,this.state.fill(0),this.buffer32.fill(0),this.IV.fill(0),this.bufferOut32.fill(0);for(let e of this.stack)e.fill(0)}b2CompressOut(){let{state:e,pos:r,flags:n,buffer32:i,bufferOut32:o}=this,{h:a,l:c}=A1.fromBig(BigInt(this.chunkOut++)),{v0:l,v1:m,v2:S,v3:_,v4:P,v5:x,v6:T,v7:M,v8:k,v9:N,v10:R,v11:K,v12:z,v13:j,v14:U,v15:V}=Kn.compress(P1,0,i,7,e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],Kn.IV[0],Kn.IV[1],Kn.IV[2],Kn.IV[3],c,a,r,n);o[0]=l^k,o[1]=m^N,o[2]=S^R,o[3]=_^K,o[4]=P^z,o[5]=x^j,o[6]=T^U,o[7]=M^V,o[8]=e[0]^k,o[9]=e[1]^N,o[10]=e[2]^R,o[11]=e[3]^K,o[12]=e[4]^z,o[13]=e[5]^j,o[14]=e[6]^U,o[15]=e[7]^V,this.posOut=0}finish(){if(this.finished)return;this.finished=!0,this.buffer.fill(0,this.pos);let e=this.flags|an.ROOT;this.stack.length?(e|=an.PARENT,this.compress(this.buffer32,0,!0),this.chunksDone=0,this.pos=this.blockLen):e|=(this.chunkPos?0:an.CHUNK_START)|an.CHUNK_END,this.flags=e,this.b2CompressOut()}writeInto(e){if(this.destroyed)throw new Error("instance is destroyed");if(!(e instanceof Uint8Array))throw new Error("Blake3: Invalid output buffer");this.finish();let{blockLen:r,bufferOut:n}=this;for(let i=0,o=e.length;i<o;){this.posOut>=r&&this.b2CompressOut();let a=Math.min(this.blockLen-this.posOut,o-i);e.set(n.subarray(this.posOut,this.posOut+a),i),this.posOut+=a,i+=a}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF impossible after digest call");return this.writeInto(e)}xof(e){return(0,io.assertNumber)(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(e.length<this.outputLen)throw new Error("Blake3: Invalid output buffer");if(this.finished)throw new Error("digest() was already called");return this.enableXOF=!1,this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}};oi.blake3=(0,io.wrapConstructorWithOpts)(t=>new gu(t))});var so=L(de=>{"use strict";E();I();var T1=de&&de.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),n6=de&&de.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Pt=de&&de.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&T1(e,t,r)},Pl=de&&de.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&T1(e,t,r);return n6(e,t),e};Object.defineProperty(de,"__esModule",{value:!0});de.randomBytes=de.concatBytes=de.reverseBuffer=de.md5=de.rlp=void 0;Pt(Ob(),de);Pt(Jb(),de);Pt(Qb(),de);Pt(e1(),de);Pt(r1(),de);Pt(hu(),de);Pt(s1(),de);Pt(o1(),de);Pt(u1(),de);Pt(ml(),de);de.rlp=Pl(h1());Pt(b1(),de);de.md5=Pl(p1());Pt(eo(),de);Pt(No(),de);Pt(pu(),de);Pt(hl(),de);Pt(_c(),de);Pt(Ic(),de);Pt(gl(),de);Pt(xl(),de);Pt(kc(),de);Pt(x1(),de);Pt(B1(),de);var i6=Pl(er()),s6=Mv();function o6(t){if(t.length<1)return t;let e=t.length-1,r=0;for(let n=0;n<t.length/2;n++)r=t[n],t[n]=t[e],t[e]=r,e--;return t}de.reverseBuffer=o6;function a6(t,e){return i6.concatBytes(Uint8Array.from(t),Uint8Array.from(e))}de.concatBytes=a6;function u6(t){return s6(t)}de.randomBytes=u6});var Gr=L(O1=>{"use strict";E();I();var Dn=O1,c6=zt(),f6=Iv(),qc=Av();Dn.assert=f6;Dn.toArray=qc.toArray;Dn.zero2=qc.zero2;Dn.toHex=qc.toHex;Dn.encode=qc.encode;function d6(t,e,r){var n=new Array(Math.max(t.bitLength(),r)+1);n.fill(0);for(var i=1<<e+1,o=t.clone(),a=0;a<n.length;a++){var c,l=o.andln(i-1);o.isOdd()?(l>(i>>1)-1?c=(i>>1)-l:c=l,o.isubn(c)):c=0,n[a]=c,o.iushrn(1)}return n}Dn.getNAF=d6;function l6(t,e){var r=[[],[]];t=t.clone(),e=e.clone();for(var n=0,i=0,o;t.cmpn(-n)>0||e.cmpn(-i)>0;){var a=t.andln(3)+n&3,c=e.andln(3)+i&3;a===3&&(a=-1),c===3&&(c=-1);var l;(a&1)===0?l=0:(o=t.andln(7)+n&7,(o===3||o===5)&&c===2?l=-a:l=a),r[0].push(l);var m;(c&1)===0?m=0:(o=e.andln(7)+i&7,(o===3||o===5)&&a===2?m=-c:m=c),r[1].push(m),2*n===l+1&&(n=1-n),2*i===m+1&&(i=1-i),t.iushrn(1),e.iushrn(1)}return r}Dn.getJSF=l6;function h6(t,e,r){var n="_"+e;t.prototype[e]=function(){return this[n]!==void 0?this[n]:this[n]=r.call(this)}}Dn.cachedProperty=h6;function b6(t){return typeof t=="string"?Dn.toArray(t,"hex"):t}Dn.parseBytes=b6;function p6(t){return new c6(t,"hex","le")}Dn.intFromLE=p6});var mu=L((oP,k1)=>{"use strict";E();I();var yu=Gr(),oo=zt(),Nc=yu.getNAF,g6=yu.getJSF,Lc=yu.assert;function as(t,e){this.type=t,this.p=new oo(e.p,16),this.red=e.prime?oo.red(e.prime):oo.mont(this.p),this.zero=new oo(0).toRed(this.red),this.one=new oo(1).toRed(this.red),this.two=new oo(2).toRed(this.red),this.n=e.n&&new oo(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}k1.exports=as;as.prototype.point=function(){throw new Error("Not implemented")};as.prototype.validate=function(){throw new Error("Not implemented")};as.prototype._fixedNafMul=function(e,r){Lc(e.precomputed);var n=e._getDoubles(),i=Nc(r,1,this._bitLength),o=(1<<n.step+1)-(n.step%2===0?2:1);o/=3;var a=[],c,l;for(c=0;c<i.length;c+=n.step){l=0;for(var m=c+n.step-1;m>=c;m--)l=(l<<1)+i[m];a.push(l)}for(var S=this.jpoint(null,null,null),_=this.jpoint(null,null,null),P=o;P>0;P--){for(c=0;c<a.length;c++)l=a[c],l===P?_=_.mixedAdd(n.points[c]):l===-P&&(_=_.mixedAdd(n.points[c].neg()));S=S.add(_)}return S.toP()};as.prototype._wnafMul=function(e,r){var n=4,i=e._getNAFPoints(n);n=i.wnd;for(var o=i.points,a=Nc(r,n,this._bitLength),c=this.jpoint(null,null,null),l=a.length-1;l>=0;l--){for(var m=0;l>=0&&a[l]===0;l--)m++;if(l>=0&&m++,c=c.dblp(m),l<0)break;var S=a[l];Lc(S!==0),e.type==="affine"?S>0?c=c.mixedAdd(o[S-1>>1]):c=c.mixedAdd(o[-S-1>>1].neg()):S>0?c=c.add(o[S-1>>1]):c=c.add(o[-S-1>>1].neg())}return e.type==="affine"?c.toP():c};as.prototype._wnafMulAdd=function(e,r,n,i,o){var a=this._wnafT1,c=this._wnafT2,l=this._wnafT3,m=0,S,_,P;for(S=0;S<i;S++){P=r[S];var x=P._getNAFPoints(e);a[S]=x.wnd,c[S]=x.points}for(S=i-1;S>=1;S-=2){var T=S-1,M=S;if(a[T]!==1||a[M]!==1){l[T]=Nc(n[T],a[T],this._bitLength),l[M]=Nc(n[M],a[M],this._bitLength),m=Math.max(l[T].length,m),m=Math.max(l[M].length,m);continue}var k=[r[T],null,null,r[M]];r[T].y.cmp(r[M].y)===0?(k[1]=r[T].add(r[M]),k[2]=r[T].toJ().mixedAdd(r[M].neg())):r[T].y.cmp(r[M].y.redNeg())===0?(k[1]=r[T].toJ().mixedAdd(r[M]),k[2]=r[T].add(r[M].neg())):(k[1]=r[T].toJ().mixedAdd(r[M]),k[2]=r[T].toJ().mixedAdd(r[M].neg()));var N=[-3,-1,-5,-7,0,7,5,1,3],R=g6(n[T],n[M]);for(m=Math.max(R[0].length,m),l[T]=new Array(m),l[M]=new Array(m),_=0;_<m;_++){var K=R[0][_]|0,z=R[1][_]|0;l[T][_]=N[(K+1)*3+(z+1)],l[M][_]=0,c[T]=k}}var j=this.jpoint(null,null,null),U=this._wnafT4;for(S=m;S>=0;S--){for(var V=0;S>=0;){var H=!0;for(_=0;_<i;_++)U[_]=l[_][S]|0,U[_]!==0&&(H=!1);if(!H)break;V++,S--}if(S>=0&&V++,j=j.dblp(V),S<0)break;for(_=0;_<i;_++){var J=U[_];J!==0&&(J>0?P=c[_][J-1>>1]:J<0&&(P=c[_][-J-1>>1].neg()),P.type==="affine"?j=j.mixedAdd(P):j=j.add(P))}}for(S=0;S<i;S++)c[S]=null;return o?j:j.toP()};function un(t,e){this.curve=t,this.type=e,this.precomputed=null}as.BasePoint=un;un.prototype.eq=function(){throw new Error("Not implemented")};un.prototype.validate=function(){return this.curve.validate(this)};as.prototype.decodePoint=function(e,r){e=yu.toArray(e,r);var n=this.p.byteLength();if((e[0]===4||e[0]===6||e[0]===7)&&e.length-1===2*n){e[0]===6?Lc(e[e.length-1]%2===0):e[0]===7&&Lc(e[e.length-1]%2===1);var i=this.point(e.slice(1,1+n),e.slice(1+n,1+2*n));return i}else if((e[0]===2||e[0]===3)&&e.length-1===n)return this.pointFromX(e.slice(1,1+n),e[0]===3);throw new Error("Unknown point format")};un.prototype.encodeCompressed=function(e){return this.encode(e,!0)};un.prototype._encode=function(e){var r=this.curve.p.byteLength(),n=this.getX().toArray("be",r);return e?[this.getY().isEven()?2:3].concat(n):[4].concat(n,this.getY().toArray("be",r))};un.prototype.encode=function(e,r){return yu.encode(this._encode(r),e)};un.prototype.precompute=function(e){if(this.precomputed)return this;var r={doubles:null,naf:null,beta:null};return r.naf=this._getNAFPoints(8),r.doubles=this._getDoubles(4,e),r.beta=this._getBeta(),this.precomputed=r,this};un.prototype._hasDoubles=function(e){if(!this.precomputed)return!1;var r=this.precomputed.doubles;return r?r.points.length>=Math.ceil((e.bitLength()+1)/r.step):!1};un.prototype._getDoubles=function(e,r){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],i=this,o=0;o<r;o+=e){for(var a=0;a<e;a++)i=i.dbl();n.push(i)}return{step:e,points:n}};un.prototype._getNAFPoints=function(e){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var r=[this],n=(1<<e)-1,i=n===1?null:this.dbl(),o=1;o<n;o++)r[o]=r[o-1].add(i);return{wnd:e,points:r}};un.prototype._getBeta=function(){return null};un.prototype.dblp=function(e){for(var r=this,n=0;n<e;n++)r=r.dbl();return r}});var N1=L((cP,q1)=>{"use strict";E();I();var y6=Gr(),Bt=zt(),Bl=Xd(),Zo=mu(),m6=y6.assert;function cn(t){Zo.call(this,"short",t),this.a=new Bt(t.a,16).toRed(this.red),this.b=new Bt(t.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=this.a.fromRed().cmpn(0)===0,this.threeA=this.a.fromRed().sub(this.p).cmpn(-3)===0,this.endo=this._getEndomorphism(t),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}Bl(cn,Zo);q1.exports=cn;cn.prototype._getEndomorphism=function(e){if(!(!this.zeroA||!this.g||!this.n||this.p.modn(3)!==1)){var r,n;if(e.beta)r=new Bt(e.beta,16).toRed(this.red);else{var i=this._getEndoRoots(this.p);r=i[0].cmp(i[1])<0?i[0]:i[1],r=r.toRed(this.red)}if(e.lambda)n=new Bt(e.lambda,16);else{var o=this._getEndoRoots(this.n);this.g.mul(o[0]).x.cmp(this.g.x.redMul(r))===0?n=o[0]:(n=o[1],m6(this.g.mul(n).x.cmp(this.g.x.redMul(r))===0))}var a;return e.basis?a=e.basis.map(function(c){return{a:new Bt(c.a,16),b:new Bt(c.b,16)}}):a=this._getEndoBasis(n),{beta:r,lambda:n,basis:a}}};cn.prototype._getEndoRoots=function(e){var r=e===this.p?this.red:Bt.mont(e),n=new Bt(2).toRed(r).redInvm(),i=n.redNeg(),o=new Bt(3).toRed(r).redNeg().redSqrt().redMul(n),a=i.redAdd(o).fromRed(),c=i.redSub(o).fromRed();return[a,c]};cn.prototype._getEndoBasis=function(e){for(var r=this.n.ushrn(Math.floor(this.n.bitLength()/2)),n=e,i=this.n.clone(),o=new Bt(1),a=new Bt(0),c=new Bt(0),l=new Bt(1),m,S,_,P,x,T,M,k=0,N,R;n.cmpn(0)!==0;){var K=i.div(n);N=i.sub(K.mul(n)),R=c.sub(K.mul(o));var z=l.sub(K.mul(a));if(!_&&N.cmp(r)<0)m=M.neg(),S=o,_=N.neg(),P=R;else if(_&&++k===2)break;M=N,i=n,n=N,c=o,o=R,l=a,a=z}x=N.neg(),T=R;var j=_.sqr().add(P.sqr()),U=x.sqr().add(T.sqr());return U.cmp(j)>=0&&(x=m,T=S),_.negative&&(_=_.neg(),P=P.neg()),x.negative&&(x=x.neg(),T=T.neg()),[{a:_,b:P},{a:x,b:T}]};cn.prototype._endoSplit=function(e){var r=this.endo.basis,n=r[0],i=r[1],o=i.b.mul(e).divRound(this.n),a=n.b.neg().mul(e).divRound(this.n),c=o.mul(n.a),l=a.mul(i.a),m=o.mul(n.b),S=a.mul(i.b),_=e.sub(c).sub(l),P=m.add(S).neg();return{k1:_,k2:P}};cn.prototype.pointFromX=function(e,r){e=new Bt(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),i=n.redSqrt();if(i.redSqr().redSub(n).cmp(this.zero)!==0)throw new Error("invalid point");var o=i.fromRed().isOdd();return(r&&!o||!r&&o)&&(i=i.redNeg()),this.point(e,i)};cn.prototype.validate=function(e){if(e.inf)return!0;var r=e.x,n=e.y,i=this.a.redMul(r),o=r.redSqr().redMul(r).redIAdd(i).redIAdd(this.b);return n.redSqr().redISub(o).cmpn(0)===0};cn.prototype._endoWnafMulAdd=function(e,r,n){for(var i=this._endoWnafT1,o=this._endoWnafT2,a=0;a<e.length;a++){var c=this._endoSplit(r[a]),l=e[a],m=l._getBeta();c.k1.negative&&(c.k1.ineg(),l=l.neg(!0)),c.k2.negative&&(c.k2.ineg(),m=m.neg(!0)),i[a*2]=l,i[a*2+1]=m,o[a*2]=c.k1,o[a*2+1]=c.k2}for(var S=this._wnafMulAdd(1,i,o,a*2,n),_=0;_<a*2;_++)i[_]=null,o[_]=null;return S};function Wt(t,e,r,n){Zo.BasePoint.call(this,t,"affine"),e===null&&r===null?(this.x=null,this.y=null,this.inf=!0):(this.x=new Bt(e,16),this.y=new Bt(r,16),n&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}Bl(Wt,Zo.BasePoint);cn.prototype.point=function(e,r,n){return new Wt(this,e,r,n)};cn.prototype.pointFromJSON=function(e,r){return Wt.fromJSON(this,e,r)};Wt.prototype._getBeta=function(){if(!!this.curve.endo){var e=this.precomputed;if(e&&e.beta)return e.beta;var r=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(e){var n=this.curve,i=function(o){return n.point(o.x.redMul(n.endo.beta),o.y)};e.beta=r,r.precomputed={beta:null,naf:e.naf&&{wnd:e.naf.wnd,points:e.naf.points.map(i)},doubles:e.doubles&&{step:e.doubles.step,points:e.doubles.points.map(i)}}}return r}};Wt.prototype.toJSON=function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]};Wt.fromJSON=function(e,r,n){typeof r=="string"&&(r=JSON.parse(r));var i=e.point(r[0],r[1],n);if(!r[2])return i;function o(c){return e.point(c[0],c[1],n)}var a=r[2];return i.precomputed={beta:null,doubles:a.doubles&&{step:a.doubles.step,points:[i].concat(a.doubles.points.map(o))},naf:a.naf&&{wnd:a.naf.wnd,points:[i].concat(a.naf.points.map(o))}},i};Wt.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"};Wt.prototype.isInfinity=function(){return this.inf};Wt.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(this.x.cmp(e.x)===0)return this.curve.point(null,null);var r=this.y.redSub(e.y);r.cmpn(0)!==0&&(r=r.redMul(this.x.redSub(e.x).redInvm()));var n=r.redSqr().redISub(this.x).redISub(e.x),i=r.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,i)};Wt.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(e.cmpn(0)===0)return this.curve.point(null,null);var r=this.curve.a,n=this.x.redSqr(),i=e.redInvm(),o=n.redAdd(n).redIAdd(n).redIAdd(r).redMul(i),a=o.redSqr().redISub(this.x.redAdd(this.x)),c=o.redMul(this.x.redSub(a)).redISub(this.y);return this.curve.point(a,c)};Wt.prototype.getX=function(){return this.x.fromRed()};Wt.prototype.getY=function(){return this.y.fromRed()};Wt.prototype.mul=function(e){return e=new Bt(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)};Wt.prototype.mulAdd=function(e,r,n){var i=[this,r],o=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,o):this.curve._wnafMulAdd(1,i,o,2)};Wt.prototype.jmulAdd=function(e,r,n){var i=[this,r],o=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,o,!0):this.curve._wnafMulAdd(1,i,o,2,!0)};Wt.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||this.x.cmp(e.x)===0&&this.y.cmp(e.y)===0)};Wt.prototype.neg=function(e){if(this.inf)return this;var r=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var n=this.precomputed,i=function(o){return o.neg()};r.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(i)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(i)}}}return r};Wt.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var e=this.curve.jpoint(this.x,this.y,this.curve.one);return e};function tr(t,e,r,n){Zo.BasePoint.call(this,t,"jacobian"),e===null&&r===null&&n===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new Bt(0)):(this.x=new Bt(e,16),this.y=new Bt(r,16),this.z=new Bt(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}Bl(tr,Zo.BasePoint);cn.prototype.jpoint=function(e,r,n){return new tr(this,e,r,n)};tr.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),r=e.redSqr(),n=this.x.redMul(r),i=this.y.redMul(r).redMul(e);return this.curve.point(n,i)};tr.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)};tr.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var r=e.z.redSqr(),n=this.z.redSqr(),i=this.x.redMul(r),o=e.x.redMul(n),a=this.y.redMul(r.redMul(e.z)),c=e.y.redMul(n.redMul(this.z)),l=i.redSub(o),m=a.redSub(c);if(l.cmpn(0)===0)return m.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var S=l.redSqr(),_=S.redMul(l),P=i.redMul(S),x=m.redSqr().redIAdd(_).redISub(P).redISub(P),T=m.redMul(P.redISub(x)).redISub(a.redMul(_)),M=this.z.redMul(e.z).redMul(l);return this.curve.jpoint(x,T,M)};tr.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var r=this.z.redSqr(),n=this.x,i=e.x.redMul(r),o=this.y,a=e.y.redMul(r).redMul(this.z),c=n.redSub(i),l=o.redSub(a);if(c.cmpn(0)===0)return l.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var m=c.redSqr(),S=m.redMul(c),_=n.redMul(m),P=l.redSqr().redIAdd(S).redISub(_).redISub(_),x=l.redMul(_.redISub(P)).redISub(o.redMul(S)),T=this.z.redMul(c);return this.curve.jpoint(P,x,T)};tr.prototype.dblp=function(e){if(e===0)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var r;if(this.curve.zeroA||this.curve.threeA){var n=this;for(r=0;r<e;r++)n=n.dbl();return n}var i=this.curve.a,o=this.curve.tinv,a=this.x,c=this.y,l=this.z,m=l.redSqr().redSqr(),S=c.redAdd(c);for(r=0;r<e;r++){var _=a.redSqr(),P=S.redSqr(),x=P.redSqr(),T=_.redAdd(_).redIAdd(_).redIAdd(i.redMul(m)),M=a.redMul(P),k=T.redSqr().redISub(M.redAdd(M)),N=M.redISub(k),R=T.redMul(N);R=R.redIAdd(R).redISub(x);var K=S.redMul(l);r+1<e&&(m=m.redMul(x)),a=k,l=K,S=R}return this.curve.jpoint(a,S.redMul(o),l)};tr.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()};tr.prototype._zeroDbl=function(){var e,r,n;if(this.zOne){var i=this.x.redSqr(),o=this.y.redSqr(),a=o.redSqr(),c=this.x.redAdd(o).redSqr().redISub(i).redISub(a);c=c.redIAdd(c);var l=i.redAdd(i).redIAdd(i),m=l.redSqr().redISub(c).redISub(c),S=a.redIAdd(a);S=S.redIAdd(S),S=S.redIAdd(S),e=m,r=l.redMul(c.redISub(m)).redISub(S),n=this.y.redAdd(this.y)}else{var _=this.x.redSqr(),P=this.y.redSqr(),x=P.redSqr(),T=this.x.redAdd(P).redSqr().redISub(_).redISub(x);T=T.redIAdd(T);var M=_.redAdd(_).redIAdd(_),k=M.redSqr(),N=x.redIAdd(x);N=N.redIAdd(N),N=N.redIAdd(N),e=k.redISub(T).redISub(T),r=M.redMul(T.redISub(e)).redISub(N),n=this.y.redMul(this.z),n=n.redIAdd(n)}return this.curve.jpoint(e,r,n)};tr.prototype._threeDbl=function(){var e,r,n;if(this.zOne){var i=this.x.redSqr(),o=this.y.redSqr(),a=o.redSqr(),c=this.x.redAdd(o).redSqr().redISub(i).redISub(a);c=c.redIAdd(c);var l=i.redAdd(i).redIAdd(i).redIAdd(this.curve.a),m=l.redSqr().redISub(c).redISub(c);e=m;var S=a.redIAdd(a);S=S.redIAdd(S),S=S.redIAdd(S),r=l.redMul(c.redISub(m)).redISub(S),n=this.y.redAdd(this.y)}else{var _=this.z.redSqr(),P=this.y.redSqr(),x=this.x.redMul(P),T=this.x.redSub(_).redMul(this.x.redAdd(_));T=T.redAdd(T).redIAdd(T);var M=x.redIAdd(x);M=M.redIAdd(M);var k=M.redAdd(M);e=T.redSqr().redISub(k),n=this.y.redAdd(this.z).redSqr().redISub(P).redISub(_);var N=P.redSqr();N=N.redIAdd(N),N=N.redIAdd(N),N=N.redIAdd(N),r=T.redMul(M.redISub(e)).redISub(N)}return this.curve.jpoint(e,r,n)};tr.prototype._dbl=function(){var e=this.curve.a,r=this.x,n=this.y,i=this.z,o=i.redSqr().redSqr(),a=r.redSqr(),c=n.redSqr(),l=a.redAdd(a).redIAdd(a).redIAdd(e.redMul(o)),m=r.redAdd(r);m=m.redIAdd(m);var S=m.redMul(c),_=l.redSqr().redISub(S.redAdd(S)),P=S.redISub(_),x=c.redSqr();x=x.redIAdd(x),x=x.redIAdd(x),x=x.redIAdd(x);var T=l.redMul(P).redISub(x),M=n.redAdd(n).redMul(i);return this.curve.jpoint(_,T,M)};tr.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var e=this.x.redSqr(),r=this.y.redSqr(),n=this.z.redSqr(),i=r.redSqr(),o=e.redAdd(e).redIAdd(e),a=o.redSqr(),c=this.x.redAdd(r).redSqr().redISub(e).redISub(i);c=c.redIAdd(c),c=c.redAdd(c).redIAdd(c),c=c.redISub(a);var l=c.redSqr(),m=i.redIAdd(i);m=m.redIAdd(m),m=m.redIAdd(m),m=m.redIAdd(m);var S=o.redIAdd(c).redSqr().redISub(a).redISub(l).redISub(m),_=r.redMul(S);_=_.redIAdd(_),_=_.redIAdd(_);var P=this.x.redMul(l).redISub(_);P=P.redIAdd(P),P=P.redIAdd(P);var x=this.y.redMul(S.redMul(m.redISub(S)).redISub(c.redMul(l)));x=x.redIAdd(x),x=x.redIAdd(x),x=x.redIAdd(x);var T=this.z.redAdd(c).redSqr().redISub(n).redISub(l);return this.curve.jpoint(P,x,T)};tr.prototype.mul=function(e,r){return e=new Bt(e,r),this.curve._wnafMul(this,e)};tr.prototype.eq=function(e){if(e.type==="affine")return this.eq(e.toJ());if(this===e)return!0;var r=this.z.redSqr(),n=e.z.redSqr();if(this.x.redMul(n).redISub(e.x.redMul(r)).cmpn(0)!==0)return!1;var i=r.redMul(this.z),o=n.redMul(e.z);return this.y.redMul(o).redISub(e.y.redMul(i)).cmpn(0)===0};tr.prototype.eqXToP=function(e){var r=this.z.redSqr(),n=e.toRed(this.curve.red).redMul(r);if(this.x.cmp(n)===0)return!0;for(var i=e.clone(),o=this.curve.redN.redMul(r);;){if(i.iadd(this.curve.n),i.cmp(this.curve.p)>=0)return!1;if(n.redIAdd(o),this.x.cmp(n)===0)return!0}};tr.prototype.inspect=function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"};tr.prototype.isInfinity=function(){return this.z.cmpn(0)===0}});var D1=L((lP,K1)=>{"use strict";E();I();var Xo=zt(),L1=Xd(),Kc=mu(),v6=Gr();function Jo(t){Kc.call(this,"mont",t),this.a=new Xo(t.a,16).toRed(this.red),this.b=new Xo(t.b,16).toRed(this.red),this.i4=new Xo(4).toRed(this.red).redInvm(),this.two=new Xo(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}L1(Jo,Kc);K1.exports=Jo;Jo.prototype.validate=function(e){var r=e.normalize().x,n=r.redSqr(),i=n.redMul(r).redAdd(n.redMul(this.a)).redAdd(r),o=i.redSqrt();return o.redSqr().cmp(i)===0};function $t(t,e,r){Kc.BasePoint.call(this,t,"projective"),e===null&&r===null?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new Xo(e,16),this.z=new Xo(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}L1($t,Kc.BasePoint);Jo.prototype.decodePoint=function(e,r){return this.point(v6.toArray(e,r),1)};Jo.prototype.point=function(e,r){return new $t(this,e,r)};Jo.prototype.pointFromJSON=function(e){return $t.fromJSON(this,e)};$t.prototype.precompute=function(){};$t.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())};$t.fromJSON=function(e,r){return new $t(e,r[0],r[1]||e.one)};$t.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"};$t.prototype.isInfinity=function(){return this.z.cmpn(0)===0};$t.prototype.dbl=function(){var e=this.x.redAdd(this.z),r=e.redSqr(),n=this.x.redSub(this.z),i=n.redSqr(),o=r.redSub(i),a=r.redMul(i),c=o.redMul(i.redAdd(this.curve.a24.redMul(o)));return this.curve.point(a,c)};$t.prototype.add=function(){throw new Error("Not supported on Montgomery curve")};$t.prototype.diffAdd=function(e,r){var n=this.x.redAdd(this.z),i=this.x.redSub(this.z),o=e.x.redAdd(e.z),a=e.x.redSub(e.z),c=a.redMul(n),l=o.redMul(i),m=r.z.redMul(c.redAdd(l).redSqr()),S=r.x.redMul(c.redISub(l).redSqr());return this.curve.point(m,S)};$t.prototype.mul=function(e){for(var r=e.clone(),n=this,i=this.curve.point(null,null),o=this,a=[];r.cmpn(0)!==0;r.iushrn(1))a.push(r.andln(1));for(var c=a.length-1;c>=0;c--)a[c]===0?(n=n.diffAdd(i,o),i=i.dbl()):(i=n.diffAdd(i,o),n=n.dbl());return i};$t.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")};$t.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")};$t.prototype.eq=function(e){return this.getX().cmp(e.getX())===0};$t.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this};$t.prototype.getX=function(){return this.normalize(),this.x.fromRed()}});var j1=L((pP,U1)=>{"use strict";E();I();var w6=Gr(),Oi=zt(),R1=Xd(),Dc=mu(),_6=w6.assert;function ai(t){this.twisted=(t.a|0)!==1,this.mOneA=this.twisted&&(t.a|0)===-1,this.extended=this.mOneA,Dc.call(this,"edwards",t),this.a=new Oi(t.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new Oi(t.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new Oi(t.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),_6(!this.twisted||this.c.fromRed().cmpn(1)===0),this.oneC=(t.c|0)===1}R1(ai,Dc);U1.exports=ai;ai.prototype._mulA=function(e){return this.mOneA?e.redNeg():this.a.redMul(e)};ai.prototype._mulC=function(e){return this.oneC?e:this.c.redMul(e)};ai.prototype.jpoint=function(e,r,n,i){return this.point(e,r,n,i)};ai.prototype.pointFromX=function(e,r){e=new Oi(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr(),i=this.c2.redSub(this.a.redMul(n)),o=this.one.redSub(this.c2.redMul(this.d).redMul(n)),a=i.redMul(o.redInvm()),c=a.redSqrt();if(c.redSqr().redSub(a).cmp(this.zero)!==0)throw new Error("invalid point");var l=c.fromRed().isOdd();return(r&&!l||!r&&l)&&(c=c.redNeg()),this.point(e,c)};ai.prototype.pointFromY=function(e,r){e=new Oi(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr(),i=n.redSub(this.c2),o=n.redMul(this.d).redMul(this.c2).redSub(this.a),a=i.redMul(o.redInvm());if(a.cmp(this.zero)===0){if(r)throw new Error("invalid point");return this.point(this.zero,e)}var c=a.redSqrt();if(c.redSqr().redSub(a).cmp(this.zero)!==0)throw new Error("invalid point");return c.fromRed().isOdd()!==r&&(c=c.redNeg()),this.point(c,e)};ai.prototype.validate=function(e){if(e.isInfinity())return!0;e.normalize();var r=e.x.redSqr(),n=e.y.redSqr(),i=r.redMul(this.a).redAdd(n),o=this.c2.redMul(this.one.redAdd(this.d.redMul(r).redMul(n)));return i.cmp(o)===0};function ut(t,e,r,n,i){Dc.BasePoint.call(this,t,"projective"),e===null&&r===null&&n===null?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new Oi(e,16),this.y=new Oi(r,16),this.z=n?new Oi(n,16):this.curve.one,this.t=i&&new Oi(i,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}R1(ut,Dc.BasePoint);ai.prototype.pointFromJSON=function(e){return ut.fromJSON(this,e)};ai.prototype.point=function(e,r,n,i){return new ut(this,e,r,n,i)};ut.fromJSON=function(e,r){return new ut(e,r[0],r[1],r[2])};ut.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"};ut.prototype.isInfinity=function(){return this.x.cmpn(0)===0&&(this.y.cmp(this.z)===0||this.zOne&&this.y.cmp(this.curve.c)===0)};ut.prototype._extDbl=function(){var e=this.x.redSqr(),r=this.y.redSqr(),n=this.z.redSqr();n=n.redIAdd(n);var i=this.curve._mulA(e),o=this.x.redAdd(this.y).redSqr().redISub(e).redISub(r),a=i.redAdd(r),c=a.redSub(n),l=i.redSub(r),m=o.redMul(c),S=a.redMul(l),_=o.redMul(l),P=c.redMul(a);return this.curve.point(m,S,P,_)};ut.prototype._projDbl=function(){var e=this.x.redAdd(this.y).redSqr(),r=this.x.redSqr(),n=this.y.redSqr(),i,o,a,c,l,m;if(this.curve.twisted){c=this.curve._mulA(r);var S=c.redAdd(n);this.zOne?(i=e.redSub(r).redSub(n).redMul(S.redSub(this.curve.two)),o=S.redMul(c.redSub(n)),a=S.redSqr().redSub(S).redSub(S)):(l=this.z.redSqr(),m=S.redSub(l).redISub(l),i=e.redSub(r).redISub(n).redMul(m),o=S.redMul(c.redSub(n)),a=S.redMul(m))}else c=r.redAdd(n),l=this.curve._mulC(this.z).redSqr(),m=c.redSub(l).redSub(l),i=this.curve._mulC(e.redISub(c)).redMul(m),o=this.curve._mulC(c).redMul(r.redISub(n)),a=c.redMul(m);return this.curve.point(i,o,a)};ut.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()};ut.prototype._extAdd=function(e){var r=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),n=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),i=this.t.redMul(this.curve.dd).redMul(e.t),o=this.z.redMul(e.z.redAdd(e.z)),a=n.redSub(r),c=o.redSub(i),l=o.redAdd(i),m=n.redAdd(r),S=a.redMul(c),_=l.redMul(m),P=a.redMul(m),x=c.redMul(l);return this.curve.point(S,_,x,P)};ut.prototype._projAdd=function(e){var r=this.z.redMul(e.z),n=r.redSqr(),i=this.x.redMul(e.x),o=this.y.redMul(e.y),a=this.curve.d.redMul(i).redMul(o),c=n.redSub(a),l=n.redAdd(a),m=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(i).redISub(o),S=r.redMul(c).redMul(m),_,P;return this.curve.twisted?(_=r.redMul(l).redMul(o.redSub(this.curve._mulA(i))),P=c.redMul(l)):(_=r.redMul(l).redMul(o.redSub(i)),P=this.curve._mulC(c).redMul(l)),this.curve.point(S,_,P)};ut.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)};ut.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)};ut.prototype.mulAdd=function(e,r,n){return this.curve._wnafMulAdd(1,[this,r],[e,n],2,!1)};ut.prototype.jmulAdd=function(e,r,n){return this.curve._wnafMulAdd(1,[this,r],[e,n],2,!0)};ut.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this};ut.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())};ut.prototype.getX=function(){return this.normalize(),this.x.fromRed()};ut.prototype.getY=function(){return this.normalize(),this.y.fromRed()};ut.prototype.eq=function(e){return this===e||this.getX().cmp(e.getX())===0&&this.getY().cmp(e.getY())===0};ut.prototype.eqXToP=function(e){var r=e.toRed(this.curve.red).redMul(this.z);if(this.x.cmp(r)===0)return!0;for(var n=e.clone(),i=this.curve.redN.redMul(this.z);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(r.redIAdd(i),this.x.cmp(r)===0)return!0}};ut.prototype.toP=ut.prototype.normalize;ut.prototype.mixedAdd=ut.prototype.add});var Tl=L(C1=>{"use strict";E();I();var Rc=C1;Rc.base=mu();Rc.short=N1();Rc.mont=D1();Rc.edwards=j1()});var F1=L((_P,z1)=>{"use strict";E();I();z1.exports={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}}});var Uc=L(W1=>{"use strict";E();I();var kl=W1,us=mb(),Ol=Tl(),S6=Gr(),H1=S6.assert;function V1(t){t.type==="short"?this.curve=new Ol.short(t):t.type==="edwards"?this.curve=new Ol.edwards(t):this.curve=new Ol.mont(t),this.g=this.curve.g,this.n=this.curve.n,this.hash=t.hash,H1(this.g.validate(),"Invalid curve"),H1(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}kl.PresetCurve=V1;function cs(t,e){Object.defineProperty(kl,t,{configurable:!0,enumerable:!0,get:function(){var r=new V1(e);return Object.defineProperty(kl,t,{configurable:!0,enumerable:!0,value:r}),r}})}cs("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:us.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]});cs("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:us.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]});cs("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:us.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]});cs("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:us.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]});cs("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:us.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]});cs("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:us.sha256,gRed:!1,g:["9"]});cs("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:us.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var ql;try{ql=F1()}catch{ql=void 0}cs("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:us.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",ql]})});var G1=L((AP,$1)=>{"use strict";E();I();var M6=zt(),E6=Gr(),Nl=E6.assert;function cr(t,e){this.ec=t,this.priv=null,this.pub=null,e.priv&&this._importPrivate(e.priv,e.privEnc),e.pub&&this._importPublic(e.pub,e.pubEnc)}$1.exports=cr;cr.fromPublic=function(e,r,n){return r instanceof cr?r:new cr(e,{pub:r,pubEnc:n})};cr.fromPrivate=function(e,r,n){return r instanceof cr?r:new cr(e,{priv:r,privEnc:n})};cr.prototype.validate=function(){var e=this.getPublic();return e.isInfinity()?{result:!1,reason:"Invalid public key"}:e.validate()?e.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}};cr.prototype.getPublic=function(e,r){return typeof e=="string"&&(r=e,e=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),r?this.pub.encode(r,e):this.pub};cr.prototype.getPrivate=function(e){return e==="hex"?this.priv.toString(16,2):this.priv};cr.prototype._importPrivate=function(e,r){this.priv=new M6(e,r||16),this.priv=this.priv.umod(this.ec.curve.n)};cr.prototype._importPublic=function(e,r){if(e.x||e.y){this.ec.curve.type==="mont"?Nl(e.x,"Need x coordinate"):(this.ec.curve.type==="short"||this.ec.curve.type==="edwards")&&Nl(e.x&&e.y,"Need both x and y coordinate"),this.pub=this.ec.curve.point(e.x,e.y);return}this.pub=this.ec.curve.decodePoint(e,r)};cr.prototype.derive=function(e){return e.validate()||Nl(e.validate(),"public point not validated"),e.mul(this.priv).getX()};cr.prototype.sign=function(e,r,n){return this.ec.sign(e,this,r,n)};cr.prototype.verify=function(e,r){return this.ec.verify(e,r,this)};cr.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"}});var X1=L((TP,Z1)=>{"use strict";E();I();var jc=zt(),Dl=Gr(),I6=Dl.assert;function vu(t,e,r){if(e instanceof vu)return e;this._importDER(e,r)||(I6(e.r&&e.s,"Signature without r or s"),this.r=new jc(e.r,16),this.s=new jc(e.s,16),e.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=e.recoveryParam,this.curve=t,this.byteLength=this.curve.n.byteLength())}Z1.exports=vu;function x6(){this.place=0}function Ll(t,e){var r=t[e.place++];if(!(r&128))return r;var n=r&15;if(n===0||n>4)return!1;for(var i=0,o=0,a=e.place;o<n;o++,a++)i<<=8,i|=t[a],i>>>=0;return i<=127?!1:(e.place=a,i)}function Y1(t){for(var e=0,r=t.length-1;!t[e]&&!(t[e+1]&128)&&e<r;)e++;return e===0?t:t.slice(e)}vu.prototype._importDER=function(e,r){e=Dl.toArray(e,r);var n=new x6;if(e[n.place++]!==48)return!1;var i=Ll(e,n);if(i===!1||i+n.place!==e.length||e[n.place++]!==2)return!1;var o=Ll(e,n);if(o===!1)return!1;var a=e.slice(n.place,o+n.place);if(n.place+=o,e[n.place++]!==2)return!1;var c=Ll(e,n);if(c===!1||e.length!==c+n.place)return!1;var l=e.slice(n.place,c+n.place);if(a[0]===0)if(a[1]&128)a=a.slice(1);else return!1;if(l[0]===0)if(l[1]&128)l=l.slice(1);else return!1;return this.r=new jc(a),this.s=new jc(l),this.recoveryParam=null,!0};function Kl(t,e){if(e<128){t.push(e);return}var r=1+(Math.log(e)/Math.LN2>>>3);for(t.push(r|128);--r;)t.push(e>>>(r<<3)&255);t.push(e)}vu.prototype.toDER=function(e){var r=this.r.toArray(),n=this.s.toArray();for(r[0]&128&&(r=[0].concat(r)),n[0]&128&&(n=[0].concat(n)),r=Y1(r),n=Y1(n);!n[0]&&!(n[1]&128);)n=n.slice(1);var i=[2];Kl(i,r.length),i=i.concat(r),i.push(2),Kl(i,n.length);var o=i.concat(n),a=[48];return Kl(a,o.length),a=a.concat(o),Dl.encode(a,e)};vu.prototype.toBytes=function(){let e=this.r.toArray("be",this.byteLength),r=this.s.toArray("be",this.byteLength);return e.concat(r)}});var tp=L((qP,ep)=>{"use strict";E();I();var ao=zt(),J1=Pv(),A6=Gr(),Rl=Uc(),P6=xv(),Q1=A6.assert,Ul=G1(),Cc=X1();function fn(t){if(!(this instanceof fn))return new fn(t);typeof t=="string"&&(Q1(Object.prototype.hasOwnProperty.call(Rl,t),"Unknown curve "+t),t=Rl[t]),t instanceof Rl.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}ep.exports=fn;fn.prototype.keyPair=function(e){return new Ul(this,e)};fn.prototype.keyFromPrivate=function(e,r){return Ul.fromPrivate(this,e,r)};fn.prototype.keyFromPublic=function(e,r){return Ul.fromPublic(this,e,r)};fn.prototype.genKeyPair=function(e){e||(e={});for(var r=new J1({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||P6(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),i=this.n.sub(new ao(2));;){var o=new ao(r.generate(n));if(!(o.cmp(i)>0))return o.iaddn(1),this.keyFromPrivate(o)}};fn.prototype._truncateToN=function(e,r){var n=e.byteLength()*8-this.n.bitLength();return n>0&&(e=e.ushrn(n)),!r&&e.cmp(this.n)>=0?e.sub(this.n):e};fn.prototype.sign=function(e,r,n,i){typeof n=="object"&&(i=n,n=null),i||(i={}),r=this.keyFromPrivate(r,n),e=this._truncateToN(new ao(e,16));for(var o=this.n.byteLength(),a=r.getPrivate().toArray("be",o),c=e.toArray("be",o),l=new J1({hash:this.hash,entropy:a,nonce:c,pers:i.pers,persEnc:i.persEnc||"utf8"}),m=this.n.sub(new ao(1)),S=0;;S++){var _=i.k?i.k(S):new ao(l.generate(this.n.byteLength()));if(_=this._truncateToN(_,!0),!(_.cmpn(1)<=0||_.cmp(m)>=0)){var P=this.g.mul(_);if(!P.isInfinity()){var x=P.getX(),T=x.umod(this.n);if(T.cmpn(0)!==0){var M=_.invm(this.n).mul(T.mul(r.getPrivate()).iadd(e));if(M=M.umod(this.n),M.cmpn(0)!==0){var k=(P.getY().isOdd()?1:0)|(x.cmp(T)!==0?2:0);return i.canonical&&M.cmp(this.nh)>0&&(M=this.n.sub(M),k^=1),new Cc(this.curve,{r:T,s:M,recoveryParam:k})}}}}}};fn.prototype.verify=function(e,r,n,i){e=this._truncateToN(new ao(e,16)),n=this.keyFromPublic(n,i),r=new Cc(this.curve,r,"hex");var o=r.r,a=r.s;if(o.cmpn(1)<0||o.cmp(this.n)>=0||a.cmpn(1)<0||a.cmp(this.n)>=0)return!1;var c=a.invm(this.n),l=c.mul(e).umod(this.n),m=c.mul(o).umod(this.n),S;return this.curve._maxwellTrick?(S=this.g.jmulAdd(l,n.getPublic(),m),S.isInfinity()?!1:S.eqXToP(o)):(S=this.g.mulAdd(l,n.getPublic(),m),S.isInfinity()?!1:S.getX().umod(this.n).cmp(o)===0)};fn.prototype.recoverPubKey=function(t,e,r,n){Q1((3&r)===r,"The recovery param is more than two bits"),e=new Cc(this.curve,e,n);var i=this.n,o=new ao(t),a=e.r,c=e.s,l=r&1,m=r>>1;if(a.cmp(this.curve.p.umod(this.curve.n))>=0&&m)throw new Error("Unable to find sencond key candinate");m?a=this.curve.pointFromX(a.add(this.curve.n),l):a=this.curve.pointFromX(a,l);var S=e.r.invm(i),_=i.sub(o).mul(S).umod(i),P=c.mul(S).umod(i);return this.g.mulAdd(_,a,P)};fn.prototype.getKeyRecoveryParam=function(t,e,r,n){if(e=new Cc(this.curve,e,n),e.recoveryParam!==null)return e.recoveryParam;for(var i=0;i<4;i++){var o;try{o=this.recoverPubKey(t,e,i)}catch{continue}if(o.eq(r))return i}throw new Error("Unable to find valid recovery factor")}});var sp=L((KP,ip)=>{"use strict";E();I();var wu=Gr(),np=wu.assert,rp=wu.parseBytes,Qo=wu.cachedProperty;function Gt(t,e){this.eddsa=t,this._secret=rp(e.secret),t.isPoint(e.pub)?this._pub=e.pub:this._pubBytes=rp(e.pub)}Gt.fromPublic=function(e,r){return r instanceof Gt?r:new Gt(e,{pub:r})};Gt.fromSecret=function(e,r){return r instanceof Gt?r:new Gt(e,{secret:r})};Gt.prototype.secret=function(){return this._secret};Qo(Gt,"pubBytes",function(){return this.eddsa.encodePoint(this.pub())});Qo(Gt,"pub",function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())});Qo(Gt,"privBytes",function(){var e=this.eddsa,r=this.hash(),n=e.encodingLength-1,i=r.slice(0,e.encodingLength);return i[0]&=248,i[n]&=127,i[n]|=64,i});Qo(Gt,"priv",function(){return this.eddsa.decodeInt(this.privBytes())});Qo(Gt,"hash",function(){return this.eddsa.hash().update(this.secret()).digest()});Qo(Gt,"messagePrefix",function(){return this.hash().slice(this.eddsa.encodingLength)});Gt.prototype.sign=function(e){return np(this._secret,"KeyPair can only verify"),this.eddsa.sign(e,this)};Gt.prototype.verify=function(e,r){return this.eddsa.verify(e,r,this)};Gt.prototype.getSecret=function(e){return np(this._secret,"KeyPair is public only"),wu.encode(this.secret(),e)};Gt.prototype.getPublic=function(e){return wu.encode(this.pubBytes(),e)};ip.exports=Gt});var ap=L((UP,op)=>{"use strict";E();I();var B6=zt(),zc=Gr(),T6=zc.assert,Fc=zc.cachedProperty,O6=zc.parseBytes;function uo(t,e){this.eddsa=t,typeof e!="object"&&(e=O6(e)),Array.isArray(e)&&(e={R:e.slice(0,t.encodingLength),S:e.slice(t.encodingLength)}),T6(e.R&&e.S,"Signature without R or S"),t.isPoint(e.R)&&(this._R=e.R),e.S instanceof B6&&(this._S=e.S),this._Rencoded=Array.isArray(e.R)?e.R:e.Rencoded,this._Sencoded=Array.isArray(e.S)?e.S:e.Sencoded}Fc(uo,"S",function(){return this.eddsa.decodeInt(this.Sencoded())});Fc(uo,"R",function(){return this.eddsa.decodePoint(this.Rencoded())});Fc(uo,"Rencoded",function(){return this.eddsa.encodePoint(this.R())});Fc(uo,"Sencoded",function(){return this.eddsa.encodeInt(this.S())});uo.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())};uo.prototype.toHex=function(){return zc.encode(this.toBytes(),"hex").toUpperCase()};op.exports=uo});var lp=L((zP,dp)=>{"use strict";E();I();var k6=mb(),q6=Uc(),ea=Gr(),N6=ea.assert,cp=ea.parseBytes,fp=sp(),up=ap();function Tr(t){if(N6(t==="ed25519","only tested with ed25519 so far"),!(this instanceof Tr))return new Tr(t);t=q6[t].curve,this.curve=t,this.g=t.g,this.g.precompute(t.n.bitLength()+1),this.pointClass=t.point().constructor,this.encodingLength=Math.ceil(t.n.bitLength()/8),this.hash=k6.sha512}dp.exports=Tr;Tr.prototype.sign=function(e,r){e=cp(e);var n=this.keyFromSecret(r),i=this.hashInt(n.messagePrefix(),e),o=this.g.mul(i),a=this.encodePoint(o),c=this.hashInt(a,n.pubBytes(),e).mul(n.priv()),l=i.add(c).umod(this.curve.n);return this.makeSignature({R:o,S:l,Rencoded:a})};Tr.prototype.verify=function(e,r,n){e=cp(e),r=this.makeSignature(r);var i=this.keyFromPublic(n),o=this.hashInt(r.Rencoded(),i.pubBytes(),e),a=this.g.mul(r.S()),c=r.R().add(i.pub().mul(o));return c.eq(a)};Tr.prototype.hashInt=function(){for(var e=this.hash(),r=0;r<arguments.length;r++)e.update(arguments[r]);return ea.intFromLE(e.digest()).umod(this.curve.n)};Tr.prototype.keyFromPublic=function(e){return fp.fromPublic(this,e)};Tr.prototype.keyFromSecret=function(e){return fp.fromSecret(this,e)};Tr.prototype.makeSignature=function(e){return e instanceof up?e:new up(this,e)};Tr.prototype.encodePoint=function(e){var r=e.getY().toArray("le",this.encodingLength);return r[this.encodingLength-1]|=e.getX().isOdd()?128:0,r};Tr.prototype.decodePoint=function(e){e=ea.parseBytes(e);var r=e.length-1,n=e.slice(0,r).concat(e[r]&-129),i=(e[r]&128)!==0,o=ea.intFromLE(n);return this.curve.pointFromY(o,i)};Tr.prototype.encodeInt=function(e){return e.toArray("le",this.encodingLength)};Tr.prototype.decodeInt=function(e){return ea.intFromLE(e)};Tr.prototype.isPoint=function(e){return e instanceof this.pointClass}});var ta=L(dn=>{"use strict";E();I();Object.defineProperty(dn,"__esModule",{value:!0});dn.utils=dn.curves=dn.curve=dn.eddsa=dn.ec=void 0;var L6=Tl();dn.curve=L6;var K6=Uc();dn.curves=K6;var D6=tp();dn.ec=D6;var R6=lp();dn.eddsa=R6;var U6=Gr();dn.utils=U6});var pp=L((hp,bp)=>{"use strict";E();I();Object.defineProperty(hp,"__esModule",{value:!0});var j6=ta(),ui=new j6.ec("secp256k1"),Ye=ui.curve,ct=zt();function C6(t,e){let r=new ct(e);if(r.cmp(Ye.p)>=0)return null;r=r.toRed(Ye.red);let n=r.redSqr().redIMul(r).redIAdd(Ye.b).redSqrt();t===3!==n.isOdd()&&(n=n.redNeg());let i=r.redSqr().redIMul(r);return n.redSqr().redISub(i.redIAdd(Ye.b)).isZero()?ui.keyPair({pub:{x:r,y:n}}):null}function z6(t,e,r){let n=new ct(e),i=new ct(r);if(n.cmp(Ye.p)>=0||i.cmp(Ye.p)>=0||(n=n.toRed(Ye.red),i=i.toRed(Ye.red),(t===6||t===7)&&i.isOdd()!==(t===7)))return null;let o=n.redSqr().redIMul(n);return i.redSqr().redISub(o.redIAdd(Ye.b)).isZero()?ui.keyPair({pub:{x:n,y:i}}):null}function fs(t){let e=t[0];switch(e){case 2:case 3:return t.length!==33?null:C6(e,t.subarray(1,33));case 4:case 6:case 7:return t.length!==65?null:z6(e,t.subarray(1,33),t.subarray(33,65));default:return null}}bp.exports={contextRandomize(){return 0},privateKeyVerify(t){let e=new ct(t);return e.cmp(Ye.n)<0&&!e.isZero()},privateKeyNegate(t){let e=new ct(t);return B.Buffer.from(Ye.n.sub(e).umod(Ye.n).toArray("be",32))},privateKeyTweakAdd(t,e){let r=new ct(e);return r.cmp(Ye.n)>=0||(r.iadd(new ct(t)),r.cmp(Ye.n)>=0&&r.isub(Ye.n),r.isZero())?null:B.Buffer.from(r.toArray("be",32))},privateKeyTweakMul(t,e){let r=new ct(e);return r.cmp(Ye.n)>=0||r.isZero()?1:(r.imul(new ct(t)),r.cmp(Ye.n)>=0&&(r=r.umod(Ye.n)),B.Buffer.from(r.toArray("be",32)))},publicKeyVerify(t){let e=fs(t);return e==null?null:e.validate().result},publicKeyCreate(t,e){let r=new ct(t);if(r.cmp(Ye.n)>=0||r.isZero())return null;let n=ui.keyFromPrivate(t,null).getPublic();return B.Buffer.from(n.encode(null,e))},publicKeyConvert(t,e){let n=fs(t).getPublic();return B.Buffer.from(n.encode(null,e))},publicKeyNegate(t,e){let r=fs(t);if(r===null)return 1;let n=r.getPublic();return n.y=n.y.redNeg(),B.Buffer.from(n.encode(null,e))},publicKeyCombine(t,e){let r=new Array(t.length);for(let i=0;i<t.length;++i)if(r[i]=fs(t[i]),r[i]===null)return null;let n=r[0].getPublic();for(let i=1;i<r.length;++i)n=n.add(r[i].pub);return n.isInfinity()?null:B.Buffer.from(n.encode(null,e))},publicKeyTweakAdd(t,e,r){let n=fs(t);if(n===null||new ct(e).cmp(Ye.n)>=0)return null;let o=n.getPublic().add(Ye.g.mul(e));return o.isInfinity()?null:B.Buffer.from(o.encode(null,r))},publicKeyTweakMul(t,e,r){let n=fs(t);if(n===null)return null;let i=new ct(e);if(i.cmp(Ye.n)>=0||i.isZero())return null;let o=n.getPublic().mul(e);return B.Buffer.from(o.encode(null,r))},signatureNormalize(t){let e=new ct(t.subarray(0,32)),r=new ct(t.subarray(32,64));return e.cmp(Ye.n)>=0||r.cmp(Ye.n)>=0?null:(r.cmp(ui.nh)===1&&t.set(Ye.n.sub(r).toArrayLike(Uint8Array,"be",32),32),0)},signatureExport(t,e){let r=e.subarray(0,32),n=e.subarray(32,64);if(new ct(r).cmp(Ye.n)>=0||new ct(n).cmp(Ye.n)>=0)return 1;let{output:i}=t,o=i.subarray(4,4+33);o[0]=0,o.set(r,1);let a=33,c=0;for(;a>1&&o[c]===0&&!(o[c+1]&128);--a,++c);if(o=o.subarray(c),o[0]&128||a>1&&o[0]===0&&!(o[1]&128))return 1;let l=i.subarray(6+33,6+33+33);l[0]=0,l.set(n,1);let m=33,S=0;for(;m>1&&l[S]===0&&!(l[S+1]&128);--m,++S);return l=l.subarray(S),l[0]&128||m>1&&l[0]===0&&!(l[1]&128)?1:(t.outputlen=6+a+m,i[0]=48,i[1]=t.outputlen-2,i[2]=2,i[3]=o.length,i.set(o,4),i[4+a]=2,i[5+a]=l.length,i.set(l,6+a),0)},signatureImport(t,e){if(e.length<8||e.length>72||e[0]!==48||e[1]!==e.length-2||e[2]!==2)return 1;let r=e[3];if(r===0||5+r>=e.length||e[4+r]!==2)return 1;let n=e[5+r];if(n===0||6+r+n!==e.length||e[4]&128||r>1&&e[4]===0&&!(e[5]&128)||e[r+6]&128||n>1&&e[r+6]===0&&!(e[r+7]&128))return 1;let i=e.subarray(4,4+r);if(i.length===33&&i[0]===0&&(i=i.subarray(1)),i.length>32)return 1;let o=e.subarray(6+r);if(o.length===33&&o[0]===0&&(o=o.slice(1)),o.length>32)throw new Error("S length is too long");let a=new ct(i);a.cmp(Ye.n)>=0&&(a=new ct(0));let c=new ct(e.subarray(6+r));return c.cmp(Ye.n)>=0&&(c=new ct(0)),t.set(a.toArrayLike(Uint8Array,"be",32),0),t.set(c.toArrayLike(Uint8Array,"be",32),32),0},ecdsaSign(t,e){let r=new ct(e);return r.cmp(Ye.n)>=0||r.isZero()?null:ui.sign(t,e,{canonical:!0}).toBytes()},ecdsaVerify(t,e,r){let n={r:t.subarray(0,32),s:t.subarray(32,64)},i=new ct(n.r),o=new ct(n.s);if(i.cmp(Ye.n)>=0||o.cmp(Ye.n)>=0)return 1;if(o.cmp(ui.nh)===1||i.isZero()||o.isZero())return 3;let a=fs(r);if(a===null)return 2;let c=a.getPublic();return ui.verify(e,n,c)},ecdsaRecover(t,e,r,n){let i={r:t.slice(0,32),s:t.slice(32,64)},o=new ct(i.r),a=new ct(i.s);if(o.cmp(Ye.n)>=0||a.cmp(Ye.n)>=0)return 1;if(o.isZero()||a.isZero())return 2;let c;try{c=ui.recoverPubKey(r,i,e,null)}catch{return 2}return B.Buffer.from(c.encode(null,n))},ecdh(t,e,r,n,i,o,a){let c=fs(e);if(c===null)return 1;let l=new ct(r);if(l.cmp(Ye.n)>=0||l.isZero())return 2;let m=c.getPublic().mul(l);if(i===void 0){let S=m.encode(null,!0),_=ui.hash().update(S).digest();for(let P=0;P<32;++P)t[P]=_[P]}else{o||(o=new Uint8Array(32));let S=m.getX().toArray("be",32);for(let T=0;T<32;++T)o[T]=S[T];a||(a=new Uint8Array(32));let _=m.getY().toArray("be",32);for(let T=0;T<32;++T)a[T]=_[T];let P=i(o,a,n);if(!(P instanceof Uint8Array&&P.length===t.length))return 2;t.set(P)}return 0}}});var wp=L(Yt=>{"use strict";E();I();var F6=Yt&&Yt.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),H6=Yt&&Yt.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),V6=Yt&&Yt.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&F6(e,t,r);return H6(e,t),e};Object.defineProperty(Yt,"__esModule",{value:!0});Yt.fromSeed=Yt.fromPublicKey=Yt.fromPrivateKey=Yt.fromBase58=Yt.tinySecp256k1Interface=void 0;var jl=V6(so()),W6=eo(),$6=hu(),yp=(0,W6.base58check)($6.sha256),mp=pp(),rr=vb(),G6=Tv();function Y6(t){return{isPoint:e=>t.publicKeyVerify(e),isPrivate:e=>t.privateKeyVerify(e),pointAddScalar:(e,r,n)=>t.publicKeyTweakAdd(e,r,n),pointFromScalar:(e,r)=>t.publicKeyCreate(e,r),privateAdd:(e,r)=>t.privateKeyTweakAdd(new Uint8Array(e),r),sign:(e,r)=>t.ecdsaSign(e,r),verify:(e,r,n)=>t.ecdsaVerify(n,e,r)}}function Z6(t){return{isPoint:e=>t.publicKeyVerify(e),pointCompress:(e,r)=>Uint8Array.from(t.publicKeyConvert(e,r??!0)),isPrivate:e=>t.privateKeyVerify(e),pointFromScalar:(e,r)=>{let n=t.publicKeyCreate(e,r??!0);return n==null?null:Uint8Array.from(n)},sign:(e,r,n)=>Uint8Array.from(t.ecdsaSign(e,r)),verify:(e,r,n,i)=>t.ecdsaVerify(n,e,r)}}var ds=Y6(mp);Yt.tinySecp256k1Interface=Z6(mp);var Cl=rr.BufferN(32),X6=rr.compile({wif:rr.UInt8,bip32:{public:rr.UInt32,private:rr.UInt32}}),Wc={messagePrefix:`Bitcoin Signed Message:
|
||
`,bech32:"bc",bip32:{public:76067358,private:76066276},pubKeyHash:0,scriptHash:5,wif:128},gp=2147483648,J6=Math.pow(2,31)-1;function Q6(t){return rr.String(t)&&t.match(/^(m\/)?(\d+'?\/)*\d+'?$/)!==null}function e_(t){return rr.UInt32(t)&&t<=J6}var Hc=class{constructor(e,r,n,i,o=0,a=0,c=0){this.__D=e,this.__Q=r,this.chainCode=n,this.network=i,this.__DEPTH=o,this.__INDEX=a,this.__PARENT_FINGERPRINT=c,rr(X6,i),this.lowR=!1}get depth(){return this.__DEPTH}get index(){return this.__INDEX}get parentFingerprint(){return this.__PARENT_FINGERPRINT}get publicKey(){return this.__Q===void 0&&(this.__Q=B.Buffer.from(ds.pointFromScalar(this.__D,!0))),this.__Q}get privateKey(){return this.__D}get identifier(){return B.Buffer.from(jl.hash160(this.publicKey))}get fingerprint(){return this.identifier.slice(0,4)}get compressed(){return!0}isNeutered(){return this.__D===void 0}neutered(){return Vc(this.publicKey,this.chainCode,this.network,this.depth,this.index,this.parentFingerprint)}toBase58(){let e=this.network,r=this.isNeutered()?e.bip32.public:e.bip32.private,n=B.Buffer.allocUnsafe(78);return n.writeUInt32BE(r,0),n.writeUInt8(this.depth,4),n.writeUInt32BE(this.parentFingerprint,5),n.writeUInt32BE(this.index,9),this.chainCode.copy(n,13),this.isNeutered()?this.publicKey.copy(n,45):(n.writeUInt8(0,45),this.privateKey.copy(n,46)),yp.encode(n)}toWIF(){if(!this.privateKey)throw new TypeError("Missing private key");return G6.encode(this.network.wif,this.privateKey,!0)}derive(e){rr(rr.UInt32,e);let r=e>=gp,n=B.Buffer.allocUnsafe(37);if(r){if(this.isNeutered())throw new TypeError("Missing private key for hardened child key");n[0]=0,this.privateKey.copy(n,1),n.writeUInt32BE(e,33)}else this.publicKey.copy(n,0),n.writeUInt32BE(e,33);let i=jl.hmacSHA512(this.chainCode,n),o=i.slice(0,32),a=i.slice(32);if(!ds.isPrivate(o))return this.derive(e+1);let c;if(this.isNeutered()){let l=ds.pointAddScalar(this.publicKey,o,!0);if(l===null)return this.derive(e+1);c=Vc(l,a,this.network,this.depth+1,e,this.fingerprint.readUInt32BE(0))}else{let l=ds.privateAdd(this.privateKey,o);if(l==null)return this.derive(e+1);c=zl(l,a,this.network,this.depth+1,e,this.fingerprint.readUInt32BE(0))}return c}deriveHardened(e){return rr(e_,e),this.derive(e+gp)}derivePath(e){rr(Q6,e);let r=e.split("/");if(r[0]==="m"){if(this.parentFingerprint)throw new TypeError("Expected master, got child");r=r.slice(1)}return r.reduce((n,i)=>{let o;return i.slice(-1)==="'"?(o=parseInt(i.slice(0,-1),10),n.deriveHardened(o)):(o=parseInt(i,10),n.derive(o))},this)}sign(e){if(!this.privateKey)throw new Error("Missing private key");return ds.sign(e,this.privateKey)}verify(e,r){return ds.verify(e,this.publicKey,r)}};function t_(t,e){let r=B.Buffer.from(yp.decode(t));if(r.length!==78)throw new TypeError("Invalid buffer length");e=e||Wc;let n=r.readUInt32BE(0);if(n!==e.bip32.private&&n!==e.bip32.public)throw new TypeError("Invalid network version");let i=r[4],o=r.readUInt32BE(5);if(i===0&&o!==0)throw new TypeError("Invalid parent fingerprint");let a=r.readUInt32BE(9);if(i===0&&a!==0)throw new TypeError("Invalid index");let c=r.slice(13,45),l;if(n===e.bip32.private){if(r.readUInt8(45)!==0)throw new TypeError("Invalid private key");let m=r.slice(46,78);l=zl(m,c,e,i,a,o)}else{let m=r.slice(45,78);l=Vc(m,c,e,i,a,o)}return l}Yt.fromBase58=t_;function vp(t,e,r){return zl(t,e,r)}Yt.fromPrivateKey=vp;function zl(t,e,r,n,i,o){if(rr({privateKey:Cl,chainCode:Cl},{privateKey:t,chainCode:e}),r=r||Wc,!ds.isPrivate(t))throw new TypeError("Private key not in range [1, n)");return new Hc(t,void 0,e,r,n,i,o)}function r_(t,e,r){return Vc(t,e,r)}Yt.fromPublicKey=r_;function Vc(t,e,r,n,i,o){if(rr({publicKey:rr.BufferN(33),chainCode:Cl},{publicKey:t,chainCode:e}),r=r||Wc,!ds.isPoint(t))throw new TypeError("Point is not on the curve");return new Hc(void 0,t,e,r,n,i,o)}function n_(t,e){if(rr(rr.Buffer,t),t.length<16)throw new TypeError("Seed should be at least 128 bits");if(t.length>64)throw new TypeError("Seed should be at most 512 bits");e=e||Wc;let r=jl.hmacSHA512(B.Buffer.from("Bitcoin seed","utf8"),t),n=r.slice(0,32),i=r.slice(32);return vp(n,i,e)}Yt.fromSeed=n_});var _p=L(ln=>{"use strict";E();I();Object.defineProperty(ln,"__esModule",{value:!0});ln.fromPrivateKey=ln.fromPublicKey=ln.fromBase58=ln.fromSeed=ln.tinySecp256k1Interface=void 0;var _u=wp();Object.defineProperty(ln,"tinySecp256k1Interface",{enumerable:!0,get:function(){return _u.tinySecp256k1Interface}});Object.defineProperty(ln,"fromSeed",{enumerable:!0,get:function(){return _u.fromSeed}});Object.defineProperty(ln,"fromBase58",{enumerable:!0,get:function(){return _u.fromBase58}});Object.defineProperty(ln,"fromPublicKey",{enumerable:!0,get:function(){return _u.fromPublicKey}});Object.defineProperty(ln,"fromPrivateKey",{enumerable:!0,get:function(){return _u.fromPrivateKey}})});var Sp=L((rB,i_)=>{i_.exports=["abandon","ability","able","about","above","absent","absorb","abstract","absurd","abuse","access","accident","account","accuse","achieve","acid","acoustic","acquire","across","act","action","actor","actress","actual","adapt","add","addict","address","adjust","admit","adult","advance","advice","aerobic","affair","afford","afraid","again","age","agent","agree","ahead","aim","air","airport","aisle","alarm","album","alcohol","alert","alien","all","alley","allow","almost","alone","alpha","already","also","alter","always","amateur","amazing","among","amount","amused","analyst","anchor","ancient","anger","angle","angry","animal","ankle","announce","annual","another","answer","antenna","antique","anxiety","any","apart","apology","appear","apple","approve","april","arch","arctic","area","arena","argue","arm","armed","armor","army","around","arrange","arrest","arrive","arrow","art","artefact","artist","artwork","ask","aspect","assault","asset","assist","assume","asthma","athlete","atom","attack","attend","attitude","attract","auction","audit","august","aunt","author","auto","autumn","average","avocado","avoid","awake","aware","away","awesome","awful","awkward","axis","baby","bachelor","bacon","badge","bag","balance","balcony","ball","bamboo","banana","banner","bar","barely","bargain","barrel","base","basic","basket","battle","beach","bean","beauty","because","become","beef","before","begin","behave","behind","believe","below","belt","bench","benefit","best","betray","better","between","beyond","bicycle","bid","bike","bind","biology","bird","birth","bitter","black","blade","blame","blanket","blast","bleak","bless","blind","blood","blossom","blouse","blue","blur","blush","board","boat","body","boil","bomb","bone","bonus","book","boost","border","boring","borrow","boss","bottom","bounce","box","boy","bracket","brain","brand","brass","brave","bread","breeze","brick","bridge","brief","bright","bring","brisk","broccoli","broken","bronze","broom","brother","brown","brush","bubble","buddy","budget","buffalo","build","bulb","bulk","bullet","bundle","bunker","burden","burger","burst","bus","business","busy","butter","buyer","buzz","cabbage","cabin","cable","cactus","cage","cake","call","calm","camera","camp","can","canal","cancel","candy","cannon","canoe","canvas","canyon","capable","capital","captain","car","carbon","card","cargo","carpet","carry","cart","case","cash","casino","castle","casual","cat","catalog","catch","category","cattle","caught","cause","caution","cave","ceiling","celery","cement","census","century","cereal","certain","chair","chalk","champion","change","chaos","chapter","charge","chase","chat","cheap","check","cheese","chef","cherry","chest","chicken","chief","child","chimney","choice","choose","chronic","chuckle","chunk","churn","cigar","cinnamon","circle","citizen","city","civil","claim","clap","clarify","claw","clay","clean","clerk","clever","click","client","cliff","climb","clinic","clip","clock","clog","close","cloth","cloud","clown","club","clump","cluster","clutch","coach","coast","coconut","code","coffee","coil","coin","collect","color","column","combine","come","comfort","comic","common","company","concert","conduct","confirm","congress","connect","consider","control","convince","cook","cool","copper","copy","coral","core","corn","correct","cost","cotton","couch","country","couple","course","cousin","cover","coyote","crack","cradle","craft","cram","crane","crash","crater","crawl","crazy","cream","credit","creek","crew","cricket","crime","crisp","critic","crop","cross","crouch","crowd","crucial","cruel","cruise","crumble","crunch","crush","cry","crystal","cube","culture","cup","cupboard","curious","current","curtain","curve","cushion","custom","cute","cycle","dad","damage","damp","dance","danger","daring","dash","daughter","dawn","day","deal","debate","debris","decade","december","decide","decline","decorate","decrease","deer","defense","define","defy","degree","delay","deliver","demand","demise","denial","dentist","deny","depart","depend","deposit","depth","deputy","derive","describe","desert","design","desk","despair","destroy","detail","detect","develop","device","devote","diagram","dial","diamond","diary","dice","diesel","diet","differ","digital","dignity","dilemma","dinner","dinosaur","direct","dirt","disagree","discover","disease","dish","dismiss","disorder","display","distance","divert","divide","divorce","dizzy","doctor","document","dog","doll","dolphin","domain","donate","donkey","donor","door","dose","double","dove","draft","dragon","drama","drastic","draw","dream","dress","drift","drill","drink","drip","drive","drop","drum","dry","duck","dumb","dune","during","dust","dutch","duty","dwarf","dynamic","eager","eagle","early","earn","earth","easily","east","easy","echo","ecology","economy","edge","edit","educate","effort","egg","eight","either","elbow","elder","electric","elegant","element","elephant","elevator","elite","else","embark","embody","embrace","emerge","emotion","employ","empower","empty","enable","enact","end","endless","endorse","enemy","energy","enforce","engage","engine","enhance","enjoy","enlist","enough","enrich","enroll","ensure","enter","entire","entry","envelope","episode","equal","equip","era","erase","erode","erosion","error","erupt","escape","essay","essence","estate","eternal","ethics","evidence","evil","evoke","evolve","exact","example","excess","exchange","excite","exclude","excuse","execute","exercise","exhaust","exhibit","exile","exist","exit","exotic","expand","expect","expire","explain","expose","express","extend","extra","eye","eyebrow","fabric","face","faculty","fade","faint","faith","fall","false","fame","family","famous","fan","fancy","fantasy","farm","fashion","fat","fatal","father","fatigue","fault","favorite","feature","february","federal","fee","feed","feel","female","fence","festival","fetch","fever","few","fiber","fiction","field","figure","file","film","filter","final","find","fine","finger","finish","fire","firm","first","fiscal","fish","fit","fitness","fix","flag","flame","flash","flat","flavor","flee","flight","flip","float","flock","floor","flower","fluid","flush","fly","foam","focus","fog","foil","fold","follow","food","foot","force","forest","forget","fork","fortune","forum","forward","fossil","foster","found","fox","fragile","frame","frequent","fresh","friend","fringe","frog","front","frost","frown","frozen","fruit","fuel","fun","funny","furnace","fury","future","gadget","gain","galaxy","gallery","game","gap","garage","garbage","garden","garlic","garment","gas","gasp","gate","gather","gauge","gaze","general","genius","genre","gentle","genuine","gesture","ghost","giant","gift","giggle","ginger","giraffe","girl","give","glad","glance","glare","glass","glide","glimpse","globe","gloom","glory","glove","glow","glue","goat","goddess","gold","good","goose","gorilla","gospel","gossip","govern","gown","grab","grace","grain","grant","grape","grass","gravity","great","green","grid","grief","grit","grocery","group","grow","grunt","guard","guess","guide","guilt","guitar","gun","gym","habit","hair","half","hammer","hamster","hand","happy","harbor","hard","harsh","harvest","hat","have","hawk","hazard","head","health","heart","heavy","hedgehog","height","hello","helmet","help","hen","hero","hidden","high","hill","hint","hip","hire","history","hobby","hockey","hold","hole","holiday","hollow","home","honey","hood","hope","horn","horror","horse","hospital","host","hotel","hour","hover","hub","huge","human","humble","humor","hundred","hungry","hunt","hurdle","hurry","hurt","husband","hybrid","ice","icon","idea","identify","idle","ignore","ill","illegal","illness","image","imitate","immense","immune","impact","impose","improve","impulse","inch","include","income","increase","index","indicate","indoor","industry","infant","inflict","inform","inhale","inherit","initial","inject","injury","inmate","inner","innocent","input","inquiry","insane","insect","inside","inspire","install","intact","interest","into","invest","invite","involve","iron","island","isolate","issue","item","ivory","jacket","jaguar","jar","jazz","jealous","jeans","jelly","jewel","job","join","joke","journey","joy","judge","juice","jump","jungle","junior","junk","just","kangaroo","keen","keep","ketchup","key","kick","kid","kidney","kind","kingdom","kiss","kit","kitchen","kite","kitten","kiwi","knee","knife","knock","know","lab","label","labor","ladder","lady","lake","lamp","language","laptop","large","later","latin","laugh","laundry","lava","law","lawn","lawsuit","layer","lazy","leader","leaf","learn","leave","lecture","left","leg","legal","legend","leisure","lemon","lend","length","lens","leopard","lesson","letter","level","liar","liberty","library","license","life","lift","light","like","limb","limit","link","lion","liquid","list","little","live","lizard","load","loan","lobster","local","lock","logic","lonely","long","loop","lottery","loud","lounge","love","loyal","lucky","luggage","lumber","lunar","lunch","luxury","lyrics","machine","mad","magic","magnet","maid","mail","main","major","make","mammal","man","manage","mandate","mango","mansion","manual","maple","marble","march","margin","marine","market","marriage","mask","mass","master","match","material","math","matrix","matter","maximum","maze","meadow","mean","measure","meat","mechanic","medal","media","melody","melt","member","memory","mention","menu","mercy","merge","merit","merry","mesh","message","metal","method","middle","midnight","milk","million","mimic","mind","minimum","minor","minute","miracle","mirror","misery","miss","mistake","mix","mixed","mixture","mobile","model","modify","mom","moment","monitor","monkey","monster","month","moon","moral","more","morning","mosquito","mother","motion","motor","mountain","mouse","move","movie","much","muffin","mule","multiply","muscle","museum","mushroom","music","must","mutual","myself","mystery","myth","naive","name","napkin","narrow","nasty","nation","nature","near","neck","need","negative","neglect","neither","nephew","nerve","nest","net","network","neutral","never","news","next","nice","night","noble","noise","nominee","noodle","normal","north","nose","notable","note","nothing","notice","novel","now","nuclear","number","nurse","nut","oak","obey","object","oblige","obscure","observe","obtain","obvious","occur","ocean","october","odor","off","offer","office","often","oil","okay","old","olive","olympic","omit","once","one","onion","online","only","open","opera","opinion","oppose","option","orange","orbit","orchard","order","ordinary","organ","orient","original","orphan","ostrich","other","outdoor","outer","output","outside","oval","oven","over","own","owner","oxygen","oyster","ozone","pact","paddle","page","pair","palace","palm","panda","panel","panic","panther","paper","parade","parent","park","parrot","party","pass","patch","path","patient","patrol","pattern","pause","pave","payment","peace","peanut","pear","peasant","pelican","pen","penalty","pencil","people","pepper","perfect","permit","person","pet","phone","photo","phrase","physical","piano","picnic","picture","piece","pig","pigeon","pill","pilot","pink","pioneer","pipe","pistol","pitch","pizza","place","planet","plastic","plate","play","please","pledge","pluck","plug","plunge","poem","poet","point","polar","pole","police","pond","pony","pool","popular","portion","position","possible","post","potato","pottery","poverty","powder","power","practice","praise","predict","prefer","prepare","present","pretty","prevent","price","pride","primary","print","priority","prison","private","prize","problem","process","produce","profit","program","project","promote","proof","property","prosper","protect","proud","provide","public","pudding","pull","pulp","pulse","pumpkin","punch","pupil","puppy","purchase","purity","purpose","purse","push","put","puzzle","pyramid","quality","quantum","quarter","question","quick","quit","quiz","quote","rabbit","raccoon","race","rack","radar","radio","rail","rain","raise","rally","ramp","ranch","random","range","rapid","rare","rate","rather","raven","raw","razor","ready","real","reason","rebel","rebuild","recall","receive","recipe","record","recycle","reduce","reflect","reform","refuse","region","regret","regular","reject","relax","release","relief","rely","remain","remember","remind","remove","render","renew","rent","reopen","repair","repeat","replace","report","require","rescue","resemble","resist","resource","response","result","retire","retreat","return","reunion","reveal","review","reward","rhythm","rib","ribbon","rice","rich","ride","ridge","rifle","right","rigid","ring","riot","ripple","risk","ritual","rival","river","road","roast","robot","robust","rocket","romance","roof","rookie","room","rose","rotate","rough","round","route","royal","rubber","rude","rug","rule","run","runway","rural","sad","saddle","sadness","safe","sail","salad","salmon","salon","salt","salute","same","sample","sand","satisfy","satoshi","sauce","sausage","save","say","scale","scan","scare","scatter","scene","scheme","school","science","scissors","scorpion","scout","scrap","screen","script","scrub","sea","search","season","seat","second","secret","section","security","seed","seek","segment","select","sell","seminar","senior","sense","sentence","series","service","session","settle","setup","seven","shadow","shaft","shallow","share","shed","shell","sheriff","shield","shift","shine","ship","shiver","shock","shoe","shoot","shop","short","shoulder","shove","shrimp","shrug","shuffle","shy","sibling","sick","side","siege","sight","sign","silent","silk","silly","silver","similar","simple","since","sing","siren","sister","situate","six","size","skate","sketch","ski","skill","skin","skirt","skull","slab","slam","sleep","slender","slice","slide","slight","slim","slogan","slot","slow","slush","small","smart","smile","smoke","smooth","snack","snake","snap","sniff","snow","soap","soccer","social","sock","soda","soft","solar","soldier","solid","solution","solve","someone","song","soon","sorry","sort","soul","sound","soup","source","south","space","spare","spatial","spawn","speak","special","speed","spell","spend","sphere","spice","spider","spike","spin","spirit","split","spoil","sponsor","spoon","sport","spot","spray","spread","spring","spy","square","squeeze","squirrel","stable","stadium","staff","stage","stairs","stamp","stand","start","state","stay","steak","steel","stem","step","stereo","stick","still","sting","stock","stomach","stone","stool","story","stove","strategy","street","strike","strong","struggle","student","stuff","stumble","style","subject","submit","subway","success","such","sudden","suffer","sugar","suggest","suit","summer","sun","sunny","sunset","super","supply","supreme","sure","surface","surge","surprise","surround","survey","suspect","sustain","swallow","swamp","swap","swarm","swear","sweet","swift","swim","swing","switch","sword","symbol","symptom","syrup","system","table","tackle","tag","tail","talent","talk","tank","tape","target","task","taste","tattoo","taxi","teach","team","tell","ten","tenant","tennis","tent","term","test","text","thank","that","theme","then","theory","there","they","thing","this","thought","three","thrive","throw","thumb","thunder","ticket","tide","tiger","tilt","timber","time","tiny","tip","tired","tissue","title","toast","tobacco","today","toddler","toe","together","toilet","token","tomato","tomorrow","tone","tongue","tonight","tool","tooth","top","topic","topple","torch","tornado","tortoise","toss","total","tourist","toward","tower","town","toy","track","trade","traffic","tragic","train","transfer","trap","trash","travel","tray","treat","tree","trend","trial","tribe","trick","trigger","trim","trip","trophy","trouble","truck","true","truly","trumpet","trust","truth","try","tube","tuition","tumble","tuna","tunnel","turkey","turn","turtle","twelve","twenty","twice","twin","twist","two","type","typical","ugly","umbrella","unable","unaware","uncle","uncover","under","undo","unfair","unfold","unhappy","uniform","unique","unit","universe","unknown","unlock","until","unusual","unveil","update","upgrade","uphold","upon","upper","upset","urban","urge","usage","use","used","useful","useless","usual","utility","vacant","vacuum","vague","valid","valley","valve","van","vanish","vapor","various","vast","vault","vehicle","velvet","vendor","venture","venue","verb","verify","version","very","vessel","veteran","viable","vibrant","vicious","victory","video","view","village","vintage","violin","virtual","virus","visa","visit","visual","vital","vivid","vocal","voice","void","volcano","volume","vote","voyage","wage","wagon","wait","walk","wall","walnut","want","warfare","warm","warrior","wash","wasp","waste","water","wave","way","wealth","weapon","wear","weasel","weather","web","wedding","weekend","weird","welcome","west","wet","whale","what","wheat","wheel","when","where","whip","whisper","wide","width","wife","wild","will","win","window","wine","wing","wink","winner","winter","wire","wisdom","wise","wish","witness","wolf","woman","wonder","wood","wool","word","work","world","worry","worth","wrap","wreck","wrestle","wrist","write","wrong","yard","year","yellow","you","young","youth","zebra","zero","zone","zoo"]});var Hl=L(co=>{"use strict";E();I();Object.defineProperty(co,"__esModule",{value:!0});co._default=co.wordlists=void 0;var Fl={};co.wordlists=Fl;var $c;co._default=$c;try{co._default=$c=Sp(),Fl.english=$c,Fl.EN=$c}catch{}});var Vl=L(qt=>{"use strict";E();I();Object.defineProperty(qt,"__esModule",{value:!0});qt.wordlists=qt.getDefaultWordlist=qt.setDefaultWordlist=qt.validateMnemonic=qt.generateMnemonic=qt.entropyToMnemonic=qt.mnemonicToEntropy=qt.mnemonicToSeed=qt.mnemonicToSeedSync=void 0;var Ep=so(),Ip=kc(),Gc=Hl(),xp=_c(),Su=Gc._default,Mp="Invalid mnemonic",fo="Invalid entropy",s_="Invalid mnemonic checksum",Ap=`A wordlist is required but a default could not be found.
|
||
Please pass a 2048 word array explicitly.`;function o_(t,e,r,n,i){let o=(0,Ip.pbkdf2)(xp.sha512,t,e,{c:r,dkLen:n});return Promise.resolve(B.Buffer.from(o))}function Mu(t){return(t||"").normalize("NFKD")}function Pp(t,e,r){for(;t.length<r;)t=e+t;return t}function Bp(t){return parseInt(t,2)}function Tp(t){return t.map(e=>Pp(e.toString(2),"0",8)).join("")}function Op(t){let r=t.length*8/32,n=(0,Ep.sha256)(t);return Tp(Array.from(n)).slice(0,r)}function kp(t){return"mnemonic"+(t||"")}function a_(t,e){let r=B.Buffer.from(Mu(t),"utf8"),n=B.Buffer.from(kp(Mu(e)),"utf8"),i=(0,Ip.pbkdf2)(xp.sha512,r,n,{c:2048,dkLen:64});return B.Buffer.from(i)}qt.mnemonicToSeedSync=a_;function u_(t,e){return Promise.resolve().then(()=>{let r=B.Buffer.from(Mu(t),"utf8"),n=B.Buffer.from(kp(Mu(e)),"utf8");return o_(r,n,2048,64,"sha512")})}qt.mnemonicToSeed=u_;function qp(t,e){if(e=e||Su,!e)throw new Error(Ap);let r=Mu(t).split(" ");if(r.length%3!==0)throw new Error(Mp);let n=r.map(S=>{let _=e.indexOf(S);if(_===-1)throw new Error(Mp);return Pp(_.toString(2),"0",11)}).join(""),i=Math.floor(n.length/33)*32,o=n.slice(0,i),a=n.slice(i),c=o.match(/(.{1,8})/g).map(Bp);if(c.length<16)throw new Error(fo);if(c.length>32)throw new Error(fo);if(c.length%4!==0)throw new Error(fo);let l=B.Buffer.from(c);if(Op(l)!==a)throw new Error(s_);return l.toString("hex")}qt.mnemonicToEntropy=qp;function Np(t,e){if(B.Buffer.isBuffer(t)||(t=B.Buffer.from(t,"hex")),e=e||Su,!e)throw new Error(Ap);if(t.length<16)throw new TypeError(fo);if(t.length>32)throw new TypeError(fo);if(t.length%4!==0)throw new TypeError(fo);let r=Tp(Array.from(t)),n=Op(t),a=(r+n).match(/(.{1,11})/g).map(c=>{let l=Bp(c);return e[l]});return e[0]==="\u3042\u3044\u3053\u304F\u3057\u3093"?a.join("\u3000"):a.join(" ")}qt.entropyToMnemonic=Np;function c_(t,e,r){if(t=t||128,t%32!==0)throw new TypeError(fo);return e=e||Ep.randomBytes,Np(e(t/8),r)}qt.generateMnemonic=c_;function f_(t,e){try{qp(t,e)}catch{return!1}return!0}qt.validateMnemonic=f_;function d_(t){let e=Gc.wordlists[t];if(e)Su=e;else throw new Error('Could not find wordlist for language "'+t+'"')}qt.setDefaultWordlist=d_;function l_(){if(!Su)throw new Error("No Default Wordlist set");return Object.keys(Gc.wordlists).filter(t=>t==="JA"||t==="EN"?!1:Gc.wordlists[t].every((e,r)=>e===Su[r]))[0]}qt.getDefaultWordlist=l_;var h_=Hl();Object.defineProperty(qt,"wordlists",{enumerable:!0,get:function(){return h_.wordlists}})});var Kp=L(fr=>{"use strict";E();I();Object.defineProperty(fr,"__esModule",{value:!0});fr.unpadBuffer=fr.stripZeros=fr.setLengthRight=fr.setLengthLeft=fr.zeros=fr.assertIsBuffer=void 0;var b_=function(t){if(!B.Buffer.isBuffer(t)){let e=`This method only supports Buffer but input was: ${t}`;throw new Error(e)}};fr.assertIsBuffer=b_;var p_=function(t){return B.Buffer.allocUnsafe(t).fill(0)};fr.zeros=p_;var Lp=function(t,e,r){let n=(0,fr.zeros)(e);return r?t.length<e?(t.copy(n),n):t.slice(0,e):t.length<e?(t.copy(n,e-t.length),n):t.slice(-e)},g_=function(t,e){return B.Buffer.isBuffer(t)||(t=B.Buffer.from(t)),Lp(t,e,!1)};fr.setLengthLeft=g_;var y_=function(t,e){return B.Buffer.isBuffer(t)||(t=B.Buffer.from(t)),Lp(t,e,!0)};fr.setLengthRight=y_;var m_=function(t){let e=t[0];for(;t.length>0&&e.toString()==="0";)t=t.slice(1),e=t[0];return t};fr.stripZeros=m_;var v_=function(t){return B.Buffer.isBuffer(t)||(t=B.Buffer.from(t)),(0,fr.stripZeros)(t)};fr.unpadBuffer=v_});var Yc=L(Tt=>{"use strict";E();I();Object.defineProperty(Tt,"__esModule",{value:!0});Tt.isHexString=Tt.getKeys=Tt.fromAscii=Tt.fromUtf8=Tt.toAscii=Tt.arrayContainsArray=Tt.getBinarySize=Tt.padToEven=Tt.stripHexPrefix=Tt.isHexPrefixed=void 0;function Dp(t){if(typeof t!="string")throw new Error(`[isHexPrefixed] input must be type 'string', received type ${typeof t}`);return t[0]==="0"&&t[1]==="x"}Tt.isHexPrefixed=Dp;var w_=t=>{if(typeof t!="string")throw new Error(`[stripHexPrefix] input must be type 'string', received ${typeof t}`);return Dp(t)?t.slice(2):t};Tt.stripHexPrefix=w_;function Rp(t){let e=t;if(typeof e!="string")throw new Error(`[padToEven] value must be type 'string', received ${typeof e}`);return e.length%2&&(e=`0${e}`),e}Tt.padToEven=Rp;function __(t){if(typeof t!="string")throw new Error(`[getBinarySize] method requires input type 'string', received ${typeof t}`);return B.Buffer.byteLength(t,"utf8")}Tt.getBinarySize=__;function S_(t,e,r){if(Array.isArray(t)!==!0)throw new Error(`[arrayContainsArray] method requires input 'superset' to be an array, got type '${typeof t}'`);if(Array.isArray(e)!==!0)throw new Error(`[arrayContainsArray] method requires input 'subset' to be an array, got type '${typeof e}'`);return e[r===!0?"some":"every"](n=>t.indexOf(n)>=0)}Tt.arrayContainsArray=S_;function M_(t){let e="",r=0,n=t.length;for(t.substring(0,2)==="0x"&&(r=2);r<n;r+=2){let i=parseInt(t.substr(r,2),16);e+=String.fromCharCode(i)}return e}Tt.toAscii=M_;function E_(t){let e=B.Buffer.from(t,"utf8");return`0x${Rp(e.toString("hex")).replace(/^0+|0+$/g,"")}`}Tt.fromUtf8=E_;function I_(t){let e="";for(let r=0;r<t.length;r++){let i=t.charCodeAt(r).toString(16);e+=i.length<2?`0${i}`:i}return`0x${e}`}Tt.fromAscii=I_;function x_(t,e,r){if(!Array.isArray(t))throw new Error(`[getKeys] method expects input 'params' to be an array, got ${typeof t}`);if(typeof e!="string")throw new Error(`[getKeys] method expects input 'key' to be type 'string', got ${typeof t}`);let n=[];for(let i=0;i<t.length;i++){let o=t[i][e];if(r===!0&&!o)o="";else if(typeof o!="string")throw new Error(`invalid abi - expected type 'string', received ${typeof o}`);n.push(o)}return n}Tt.getKeys=x_;function A_(t,e){return!(typeof t!="string"||!t.match(/^0x[0-9A-Fa-f]*$/)||typeof e<"u"&&e>0&&t.length!==2+2*e)}Tt.isHexString=A_});var Up=L(ci=>{"use strict";E();I();Object.defineProperty(ci,"__esModule",{value:!0});ci.assertIsString=ci.assertIsArray=ci.assertIsBuffer=ci.assertIsHexString=void 0;var P_=Yc(),B_=function(t){if(!(0,P_.isHexString)(t)){let e=`This method only supports 0x-prefixed hex strings but input was: ${t}`;throw new Error(e)}};ci.assertIsHexString=B_;var T_=function(t){if(!B.Buffer.isBuffer(t)){let e=`This method only supports Buffer but input was: ${t}`;throw new Error(e)}};ci.assertIsBuffer=T_;var O_=function(t){if(!Array.isArray(t)){let e=`This method only supports number arrays but input was: ${t}`;throw new Error(e)}};ci.assertIsArray=O_;var k_=function(t){if(typeof t!="string"){let e=`This method only supports strings but input was: ${t}`;throw new Error(e)}};ci.assertIsString=k_});var Fp=L(Q=>{"use strict";E();I();Object.defineProperty(Q,"__esModule",{value:!0});Q.intToUnpaddedBuffer=Q.bigIntToUnpaddedBuffer=Q.bigIntToHex=Q.bufArrToArr=Q.arrToBufArr=Q.validateNoLeadingZeroes=Q.baToJSON=Q.toUtf8=Q.short=Q.addHexPrefix=Q.toUnsigned=Q.fromSigned=Q.bufferToInt=Q.bigIntToBuffer=Q.bufferToBigInt=Q.bufferToHex=Q.toBuffer=Q.unpadHexString=Q.unpadArray=Q.unpadBuffer=Q.setLengthRight=Q.setLengthLeft=Q.zeros=Q.intToBuffer=Q.intToHex=void 0;var Eu=Up(),lo=Yc(),q_=function(t){if(!Number.isSafeInteger(t)||t<0)throw new Error(`Received an invalid integer type: ${t}`);return`0x${t.toString(16)}`};Q.intToHex=q_;var N_=function(t){let e=(0,Q.intToHex)(t);return B.Buffer.from((0,lo.padToEven)(e.slice(2)),"hex")};Q.intToBuffer=N_;var L_=function(t){return B.Buffer.allocUnsafe(t).fill(0)};Q.zeros=L_;var jp=function(t,e,r){let n=(0,Q.zeros)(e);return r?t.length<e?(t.copy(n),n):t.slice(0,e):t.length<e?(t.copy(n,e-t.length),n):t.slice(-e)},K_=function(t,e){return(0,Eu.assertIsBuffer)(t),jp(t,e,!1)};Q.setLengthLeft=K_;var D_=function(t,e){return(0,Eu.assertIsBuffer)(t),jp(t,e,!0)};Q.setLengthRight=D_;var Wl=function(t){let e=t[0];for(;t.length>0&&e.toString()==="0";)t=t.slice(1),e=t[0];return t},R_=function(t){return(0,Eu.assertIsBuffer)(t),Wl(t)};Q.unpadBuffer=R_;var U_=function(t){return(0,Eu.assertIsArray)(t),Wl(t)};Q.unpadArray=U_;var j_=function(t){return(0,Eu.assertIsHexString)(t),t=(0,lo.stripHexPrefix)(t),"0x"+Wl(t)};Q.unpadHexString=j_;var C_=function(t){if(t==null)return B.Buffer.allocUnsafe(0);if(B.Buffer.isBuffer(t))return B.Buffer.from(t);if(Array.isArray(t)||t instanceof Uint8Array)return B.Buffer.from(t);if(typeof t=="string"){if(!(0,lo.isHexString)(t))throw new Error(`Cannot convert string to buffer. toBuffer only supports 0x-prefixed hex strings and this string was given: ${t}`);return B.Buffer.from((0,lo.padToEven)((0,lo.stripHexPrefix)(t)),"hex")}if(typeof t=="number")return(0,Q.intToBuffer)(t);if(typeof t=="bigint"){if(t<BigInt(0))throw new Error(`Cannot convert negative bigint to buffer. Given: ${t}`);let e=t.toString(16);return e.length%2&&(e="0"+e),B.Buffer.from(e,"hex")}if(t.toArray)return B.Buffer.from(t.toArray());if(t.toBuffer)return B.Buffer.from(t.toBuffer());throw new Error("invalid type")};Q.toBuffer=C_;var z_=function(t){return t=(0,Q.toBuffer)(t),"0x"+t.toString("hex")};Q.bufferToHex=z_;function $l(t){let e=(0,Q.bufferToHex)(t);return BigInt(e==="0x"?0:e)}Q.bufferToBigInt=$l;function Gl(t){return(0,Q.toBuffer)("0x"+t.toString(16))}Q.bigIntToBuffer=Gl;var F_=function(t){let e=Number($l(t));if(!Number.isSafeInteger(e))throw new Error("Number exceeds 53 bits");return e};Q.bufferToInt=F_;var H_=function(t){return BigInt.asIntN(256,$l(t))};Q.fromSigned=H_;var V_=function(t){return Gl(BigInt.asUintN(256,t))};Q.toUnsigned=V_;var W_=function(t){return typeof t!="string"||(0,lo.isHexPrefixed)(t)?t:"0x"+t};Q.addHexPrefix=W_;function $_(t,e=50){let r=B.Buffer.isBuffer(t)?t.toString("hex"):t;return r.length<=e?r:r.slice(0,e)+"\u2026"}Q.short=$_;var G_=function(t){let e=/^(00)+|(00)+$/g;if(t=(0,lo.stripHexPrefix)(t),t.length%2!==0)throw new Error("Invalid non-even hex string input for toUtf8() provided");return B.Buffer.from(t.replace(e,""),"hex").toString("utf8")};Q.toUtf8=G_;var Y_=function(t){if(B.Buffer.isBuffer(t))return`0x${t.toString("hex")}`;if(t instanceof Array){let e=[];for(let r=0;r<t.length;r++)e.push((0,Q.baToJSON)(t[r]));return e}};Q.baToJSON=Y_;var Z_=function(t){for(let[e,r]of Object.entries(t))if(r!==void 0&&r.length>0&&r[0]===0)throw new Error(`${e} cannot have leading zeroes, received: ${r.toString("hex")}`)};Q.validateNoLeadingZeroes=Z_;function Cp(t){return Array.isArray(t)?t.map(e=>Cp(e)):B.Buffer.from(t)}Q.arrToBufArr=Cp;function zp(t){return Array.isArray(t)?t.map(e=>zp(e)):Uint8Array.from(t??[])}Q.bufArrToArr=zp;var X_=t=>"0x"+t.toString(16);Q.bigIntToHex=X_;function J_(t){return(0,Q.unpadBuffer)(Gl(t))}Q.bigIntToUnpaddedBuffer=J_;function Q_(t){return(0,Q.unpadBuffer)((0,Q.intToBuffer)(t))}Q.intToUnpaddedBuffer=Q_});var $p=L((_B,Wp)=>{"use strict";E();I();var Zc=Kp(),ra=so(),Or=zt(),{isHexString:e8,stripHexPrefix:t8,padToEven:r8}=Yc(),{intToBuffer:n8,addHexPrefix:i8,bufferToHex:s8}=Fp(),mt=function(){};function Xc(t){return t.startsWith("int[")?"int256"+t.slice(3):t==="int"?"int256":t.startsWith("uint[")?"uint256"+t.slice(4):t==="uint"?"uint256":t.startsWith("fixed[")?"fixed128x128"+t.slice(5):t==="fixed"?"fixed128x128":t.startsWith("ufixed[")?"ufixed128x128"+t.slice(6):t==="ufixed"?"ufixed128x128":t}function Yl(t){if(t==null)return B.Buffer.allocUnsafe(0);if(B.Buffer.isBuffer(t))return B.Buffer.from(t);if(Array.isArray(t)||t instanceof Uint8Array)return B.Buffer.from(t);if(typeof t=="string"){if(!e8(t))throw new Error(`Cannot convert string to buffer. toBuffer only supports 0x-prefixed hex strings and this string was given: ${t}`);return B.Buffer.from(r8(t8(t)),"hex")}if(typeof t=="number")return n8(t);if(typeof t=="bigint"){if(t<BigInt(0))throw new Error(`Cannot convert negative bigint to buffer. Given: ${t}`);let e=t.toString(16);return e.length%2&&(e="0"+e),B.Buffer.from(e,"hex")}if(t.toArray)return B.Buffer.from(t.toArray());if(t.toBuffer)return B.Buffer.from(t.toBuffer());throw new Error("invalid type")}function o8(t){if(!!t){if(typeof t=="number"){if(t<0)return"0x";let e=Yl(t);t=s8(e)}if(typeof t!="string"){let e="eth-sig-util.normalize() requires hex string or integer input.";throw e+=` received ${typeof t}: ${t}`,new Error(e)}return i8(t.toLowerCase())}}mt.eventID=function(t,e){var r=t+"("+e.map(Xc).join(",")+")";return ra.keccak256(B.Buffer.from(r))};mt.methodID=function(t,e){return mt.eventID(t,e).slice(0,4)};function ls(t){return parseInt(/^\D+(\d+)$/.exec(t)[1],10)}function Zl(t){var e=/^\D+(\d+)x(\d+)$/.exec(t);return[parseInt(e[1],10),parseInt(e[2],10)]}function xu(t){var e=t.match(/(.*)\[(.*?)\]$/);return e?e[2]===""?"dynamic":parseInt(e[2],10):null}function ho(t){var e=typeof t;if(e==="string")return ra.isHexPrefixed(t)?new Or(ra.stripHexPrefix(t),16):new Or(t,10);if(e==="number")return new Or(t);if(t.toArray)return t;throw new Error("Argument is not a number")}function Vp(t){var e=/^(\w+)\((.*)\)$/.exec(t);if(e.length!==3)throw new Error("Invalid method signature");var r=/^(.+)\):\((.+)$/.exec(e[2]);if(r!==null&&r.length===3)return{method:e[1],args:r[1].split(","),retargs:r[2].split(",")};var n=e[2].split(",");return n.length===1&&n[0]===""&&(n=[]),{method:e[1],args:n}}function fi(t,e){var r,n,i,o;if(t==="address")return fi("uint160",ho(e));if(t==="bool")return fi("uint8",e?1:0);if(t==="string")return fi("bytes",B.Buffer.from(e,"utf8"));if(Iu(t)){if(typeof e.length>"u")throw new Error("Not an array?");if(r=xu(t),r!=="dynamic"&&r!==0&&e.length>r)throw new Error("Elements exceed array size: "+r);i=[],t=t.slice(0,t.lastIndexOf("[")),typeof e=="string"&&(e=JSON.parse(e));for(o in e)i.push(fi(t,e[o]));if(r==="dynamic"){var a=fi("uint256",e.length);i.unshift(a)}return B.Buffer.concat(i)}else{if(t==="bytes")return e=B.Buffer.from(e),i=B.Buffer.concat([fi("uint256",e.length),e]),e.length%32!==0&&(i=B.Buffer.concat([i,Zc.zeros(32-e.length%32)])),i;if(t.startsWith("bytes")){if(r=ls(t),r<1||r>32)throw new Error("Invalid bytes<N> width: "+r);return Zc.setLengthRight(e,32)}else if(t.startsWith("uint")){if(r=ls(t),r%8||r<8||r>256)throw new Error("Invalid uint<N> width: "+r);if(n=ho(e),n.bitLength()>r)throw new Error("Supplied uint exceeds width: "+r+" vs "+n.bitLength());if(n<0)throw new Error("Supplied uint is negative");return n.toArrayLike(B.Buffer,"be",32)}else if(t.startsWith("int")){if(r=ls(t),r%8||r<8||r>256)throw new Error("Invalid int<N> width: "+r);if(n=ho(e),n.bitLength()>r)throw new Error("Supplied int exceeds width: "+r+" vs "+n.bitLength());return n.toTwos(256).toArrayLike(B.Buffer,"be",32)}else if(t.startsWith("ufixed")){if(r=Zl(t),n=ho(e),n<0)throw new Error("Supplied ufixed is negative");return fi("uint256",n.mul(new Or(2).pow(new Or(r[1]))))}else if(t.startsWith("fixed"))return r=Zl(t),fi("int256",ho(e).mul(new Or(2).pow(new Or(r[1]))))}throw new Error("Unsupported or invalid type: "+t)}function Rn(t,e,r){typeof t=="string"&&(t=Xl(t));var n,i,o,a;if(t.name==="address")return Rn(t.rawType,e,r).toArrayLike(B.Buffer,"be",20).toString("hex");if(t.name==="bool")return Rn(t.rawType,e,r).toString()===new Or(1).toString();if(t.name==="string"){var c=Rn(t.rawType,e,r);return B.Buffer.from(c,"utf8").toString()}else if(t.isArray){for(o=[],n=t.size,t.size==="dynamic"&&(r=Rn("uint256",e,r).toNumber(),n=Rn("uint256",e,r).toNumber(),r=r+32),a=0;a<n;a++){var l=Rn(t.subArray,e,r);o.push(l),r+=t.subArray.memoryUsage}return o}else{if(t.name==="bytes")return r=Rn("uint256",e,r).toNumber(),n=Rn("uint256",e,r).toNumber(),e.slice(r+32,r+32+n);if(t.name.startsWith("bytes"))return e.slice(r,r+t.size);if(t.name.startsWith("uint")){if(i=new Or(e.slice(r,r+32),16,"be"),i.bitLength()>t.size)throw new Error("Decoded int exceeds width: "+t.size+" vs "+i.bitLength());return i}else if(t.name.startsWith("int")){if(i=new Or(e.slice(r,r+32),16,"be").fromTwos(256),i.bitLength()>t.size)throw new Error("Decoded uint exceeds width: "+t.size+" vs "+i.bitLength());return i}else if(t.name.startsWith("ufixed")){if(n=new Or(2).pow(new Or(t.size[1])),i=Rn("uint256",e,r),!i.mod(n).isZero())throw new Error("Decimals not supported yet");return i.div(n)}else if(t.name.startsWith("fixed")){if(n=new Or(2).pow(new Or(t.size[1])),i=Rn("int256",e,r),!i.mod(n).isZero())throw new Error("Decimals not supported yet");return i.div(n)}}throw new Error("Unsupported or invalid type: "+t.name)}function Xl(t){var e,r;if(Iu(t)){e=xu(t);var n=t.slice(0,t.lastIndexOf("["));return n=Xl(n),r={isArray:!0,name:t,size:e,memoryUsage:e==="dynamic"?32:n.memoryUsage*e,subArray:n},r}else{var i;switch(t){case"address":i="uint160";break;case"bool":i="uint8";break;case"string":i="bytes";break}if(r={rawType:i,name:t,memoryUsage:32},t.startsWith("bytes")&&t!=="bytes"||t.startsWith("uint")||t.startsWith("int")?r.size=ls(t):(t.startsWith("ufixed")||t.startsWith("fixed"))&&(r.size=Zl(t)),t.startsWith("bytes")&&t!=="bytes"&&(r.size<1||r.size>32))throw new Error("Invalid bytes<N> width: "+r.size);if((t.startsWith("uint")||t.startsWith("int"))&&(r.size%8||r.size<8||r.size>256))throw new Error("Invalid int/uint<N> width: "+r.size);return r}}function a8(t){return t==="string"||t==="bytes"||xu(t)==="dynamic"}function Iu(t){return t.lastIndexOf("]")===t.length-1}mt.rawEncode=function(t,e){var r=[],n=[],i=0;t.forEach(function(m){if(Iu(m)){var S=xu(m);S!=="dynamic"?i+=32*S:i+=32}else i+=32});for(var o=0;o<t.length;o++){var a=Xc(t[o]),c=e[o],l=fi(a,c);a8(a)?(r.push(fi("uint256",i)),n.push(l),i+=l.length):r.push(l)}return B.Buffer.concat(r.concat(n))};mt.rawDecode=function(t,e){var r=[];e=B.Buffer.from(e);for(var n=0,i=0;i<t.length;i++){var o=Xc(t[i]),a=Xl(o,e,n),c=Rn(a,e,n);n+=a.memoryUsage,r.push(c)}return r};mt.simpleEncode=function(t){var e=Array.prototype.slice.call(arguments).slice(1),r=Vp(t);if(e.length!==r.args.length)throw new Error("Argument count mismatch");return B.Buffer.concat([mt.methodID(r.method,r.args),mt.rawEncode(r.args,e)])};mt.simpleDecode=function(t,e){var r=Vp(t);if(!r.retargs)throw new Error("No return values in method");return mt.rawDecode(r.retargs,e)};function Hp(t,e){return t.startsWith("address")||t.startsWith("bytes")?"0x"+e.toString("hex"):e.toString()}mt.stringify=function(t,e){var r=[];for(var n in t){var i=t[n],o=e[n];/^[^\[]+\[.*\]$/.test(i)?o=o.map(function(a){return Hp(i,a)}).join(", "):o=Hp(i,o),r.push(o)}return r};mt.solidityHexValue=function(t,e,r){var n,i;if(Iu(t)){var o=t.replace(/\[.*?\]/,"");if(!Iu(o)){var a=xu(t);if(a!=="dynamic"&&a!==0&&e.length>a)throw new Error("Elements exceed array size: "+a)}var c=e.map(function(S){return mt.solidityHexValue(o,S,256)});return B.Buffer.concat(c)}else{if(t==="bytes")return e;if(t==="string")return B.Buffer.from(e,"utf8");if(t==="bool"){r=r||8;var l=Array(r/4).join("0");return B.Buffer.from(e?l+"1":l+"0","hex")}else if(t==="address"){var m=20;return r&&(m=r/8),Zc.setLengthLeft(Yl(e),m)}else if(t.startsWith("bytes")){if(n=ls(t),n<1||n>32)throw new Error("Invalid bytes<N> width: "+n);return typeof e=="number"&&(e=o8(e)),Zc.setLengthRight(Yl(e),n)}else if(t.startsWith("uint")){if(n=ls(t),n%8||n<8||n>256)throw new Error("Invalid uint<N> width: "+n);if(i=ho(e),i.bitLength()>n)throw new Error("Supplied uint exceeds width: "+n+" vs "+i.bitLength());return r=r||n,i.toArrayLike(B.Buffer,"be",r/8)}else if(t.startsWith("int")){if(n=ls(t),n%8||n<8||n>256)throw new Error("Invalid int<N> width: "+n);if(i=ho(e),i.bitLength()>n)throw new Error("Supplied int exceeds width: "+n+" vs "+i.bitLength());return r=r||n,i.toTwos(n).toArrayLike(B.Buffer,"be",r/8)}else throw new Error("Unsupported or invalid type: "+t)}};mt.solidityPack=function(t,e){if(t.length!==e.length)throw new Error("Number of types are not matching the values");for(var r=[],n=0;n<t.length;n++){var i=Xc(t[n]),o=e[n];r.push(mt.solidityHexValue(i,o,null))}return B.Buffer.concat(r)};mt.soliditySHA3=function(t,e){return ra.keccak256(mt.solidityPack(t,e))};mt.soliditySHA256=function(t,e){return ra.sha256(mt.solidityPack(t,e))};mt.solidityRIPEMD160=function(t,e){return ra.ripemd160(mt.solidityPack(t,e),!0)};function u8(t){return t>="0"&&t<="9"}mt.fromSerpent=function(t){for(var e=[],r=0;r<t.length;r++){var n=t[r];if(n==="s")e.push("bytes");else if(n==="b"){for(var i="bytes",o=r+1;o<t.length&&u8(t[o]);)i+=t[o]-"0",o++;r=o-1,e.push(i)}else if(n==="i")e.push("int256");else if(n==="a")e.push("int256[]");else throw new Error("Unsupported or invalid type: "+n)}return e};mt.toSerpent=function(t){for(var e=[],r=0;r<t.length;r++){var n=t[r];if(n==="bytes")e.push("s");else if(n.startsWith("bytes"))e.push("b"+ls(n));else if(n==="int256")e.push("i");else if(n==="int256[]")e.push("a");else throw new Error("Unsupported or invalid type: "+n)}return e.join("")};Wp.exports=mt});var Gp=L(hs=>{"use strict";E();I();Object.defineProperty(hs,"__esModule",{value:!0});hs.SoliditySHA3=hs.RawEncode=hs.ABI=void 0;var Jl=$p();hs.ABI=Jl;function c8(t,e){return Jl.rawEncode(t,e)}hs.RawEncode=c8;function f8(t,e){return Jl.soliditySHA3(t,e)}hs.SoliditySHA3=f8});var eg=L(Xe=>{"use strict";E();I();var d8=Xe&&Xe.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),l8=Xe&&Xe.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),h8=Xe&&Xe.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&d8(e,t,r);return l8(e,t),e},b8=Xe&&Xe.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Xe,"__esModule",{value:!0});Xe.loadUncompressedPublicKey=Xe.loadCompressedPublicKey=Xe.publicKeyConvert=Xe.publicKeyCreate=Xe.publicKeyVerify=Xe.privateKeyVerify=Xe.loadPublicKey=Xe.recover=Xe.verifyWithNoRecovery=Xe.verify=Xe.getV=Xe.sign=void 0;var p8=h8(ta()),Ft=new p8.ec("secp256k1"),Yp=so(),na=b8(zt());function g8(t,e,r=!0){let n=Ft.sign(Array.from(t),B.Buffer.from(e),{canonical:r});return{signature:n.toBytes(),recovery:n.recoveryParam}}Xe.sign=g8;function y8(t,e,r,n,i=!0){let o=Au(n);if(o==null)throw new Error("pubkey error");let a=Ft.keyPair({pub:{x:o.x,y:o.y}}).getPublic();return Ft.getKeyRecoveryParam(t,{r:e,s:r},a,i)}Xe.getV=y8;function m8(t,e,r,n){let i=Zp(e,r,t,!0);if(i==null)return!1;let o=Xp(n,!0);return o==null?!1:i.equals(o)}Xe.verify=m8;function v8(t,e,r){let n=Au(r);if(n==null)throw new Error("pubkey error");let i=Ft.keyPair({pub:{x:n.x,y:n.y}}),o={r:(0,Yp.toHex)(e.slice(0,32)),s:(0,Yp.toHex)(e.slice(32,64))};return i.verify(t,o)}Xe.verifyWithNoRecovery=v8;function Zp(t,e,r,n){let i={r:Array.from(t.slice(0,32)),s:Array.from(t.slice(32,64))},o=new na.default(i.r),a=new na.default(i.s);if(o.cmp(Ft.curve.n)>=0||a.cmp(Ft.curve.n)>=0||o.isZero()||a.isZero())return null;let c;try{c=Ft.recoverPubKey(Array.from(r),i,e,null)}catch{return null}return B.Buffer.from(c.encode(null,n))}Xe.recover=Zp;function Au(t){let e=B.Buffer.from(t),r=e[0];switch(r){case 2:case 3:return e.length!==33?null:Jp(r,e.subarray(1,33));case 4:case 6:case 7:return e.length!==65?null:Qp(r,e.subarray(1,33),e.subarray(33,65));default:return null}}Xe.loadPublicKey=Au;function w8(t){let e=new na.default(Array.from(t));return e.cmp(Ft.curve.n)<0&&!e.isZero()}Xe.privateKeyVerify=w8;function _8(t){return Au(t)!==null}Xe.publicKeyVerify=_8;function S8(t,e){let r=Ft.keyFromPrivate(Array.from(t),"bytes").getPublic();return B.Buffer.from(r.encode(null,e))}Xe.publicKeyCreate=S8;function Xp(t,e){let r=Au(t);if(r==null)return null;let n=Ft.keyPair({pub:{x:r.x,y:r.y}}).getPublic();return B.Buffer.from(n.encode(null,e))}Xe.publicKeyConvert=Xp;function Jp(t,e){let r=new na.default(Array.from(e));if(r.cmp(Ft.curve.p)>=0)return null;let n=r.toRed(Ft.curve.red),i=n.redSqr().redIMul(n).redIAdd(Ft.curve.b).redSqrt();t===3!==i.isOdd()&&(i=i.redNeg());let o=n.redSqr().redIMul(n);return i.redSqr().redISub(o.redIAdd(Ft.curve.b)).isZero()?{x:n,y:i}:null}Xe.loadCompressedPublicKey=Jp;function Qp(t,e,r){let n=new na.default(Array.from(e)),i=new na.default(Array.from(r));if(n.cmp(Ft.curve.p)>=0||i.cmp(Ft.curve.p)>=0)return null;let o=n.toRed(Ft.curve.red),a=i.toRed(Ft.curve.red);if((t===6||t===7)&&a.isOdd()!==(t===7))return null;let c=o.redSqr().redIMul(o);return a.redSqr().redISub(c.redIAdd(Ft.curve.b)).isZero()?{x:o,y:a}:null}Xe.loadUncompressedPublicKey=Qp});var ug=L(Ze=>{"use strict";E();I();var M8=Ze&&Ze.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),E8=Ze&&Ze.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),I8=Ze&&Ze.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&M8(e,t,r);return E8(e,t),e},x8=Ze&&Ze.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ze,"__esModule",{value:!0});Ze.ed25519_getDerivedPrivateKey=Ze.isValidPath=Ze.ed25519_getRandomPrivateKey=Ze.ed25519SignTest=Ze.fromSecret=Ze.fromSeed=Ze.privateKeyVerify=Ze.publicKeyVerify=Ze.publicKeyCreate=Ze.verify=Ze.sign=Ze.ed25519MulBase=void 0;var tg=I8(ta()),Un=so(),A8=x8(zt()),P8=Vl(),ki=new tg.eddsa("ed25519"),rg=ki.curve;function B8(t){let e=ki.curve.g;return ki.encodePoint(e.mul(tg.utils.intFromLE(t)))}Ze.ed25519MulBase=B8;function ng(t,e){let r=e;r.length==64&&(r=r.slice(0,32));let i=ki.keyFromSecret(Array.from(r)).sign(Array.from(t)).toBytes();return Uint8Array.from(i)}Ze.sign=ng;function ig(t,e,r){return ki.keyFromPublic(Array.from(r)).verify(Array.from(t),Array.from(e))}Ze.verify=ig;function Jc(t){let e=t;e.length==64&&(e=e.slice(0,32));let n=ki.keyFromSecret(Array.from(e)).getPublic();if(t.length==64&&!T8(t.slice(32,64),n))throw new Error("invalid public key");return Uint8Array.from(n)}Ze.publicKeyCreate=Jc;function T8(t,e){if(t.length!==e.length)return!1;for(let r=0;r<t.length;r++)if(t[r]!==e[r])return!1;return!0}function O8(t){let e=ki.decodePoint(Array.from(t));return rg.validate(e)}Ze.publicKeyVerify=O8;function sg(t){let e=new A8.default(Array.from(t));return e.cmp(rg.n)<0&&!e.isZero()}Ze.privateKeyVerify=sg;function k8(t){let e=ki.keyFromSecret(Array.from(t)),r=Uint8Array.from(e.getPublic());return{publicKey:r,secretKey:(0,Un.concatBytes)(t,r)}}Ze.fromSeed=k8;function q8(t){let e=t.slice(0,32),r=ki.keyFromSecret(Array.from(e));return{publicKey:Uint8Array.from(r.getPublic()),secretKey:Uint8Array.from(e)}}Ze.fromSecret=q8;function og(t){let e=(0,Un.sha256)("ed25519-test"),r=Jc(t),n=ng(e,t);return ig(e,n,r)}Ze.ed25519SignTest=og;function N8(t,e){for(;;){let r=(0,Un.randomBytes)(32);if(sg(r)&&og(r)){let n=Jc(r),i=t?(0,Un.concatBytes)(r,n):r;return e==="base58"?(0,Un.toBase58)(i):(0,Un.toHex)(i)}}}Ze.ed25519_getRandomPrivateKey=N8;var L8=new RegExp("^m(\\/[0-9]+')+$"),ag=t=>t.replace("'",""),K8=2147483648;function D8(t){let e=(0,Un.hmacSHA512)("ed25519 seed",t),r=e.slice(0,32),n=e.slice(32);return{key:r,chainCode:n}}function R8({key:t,chainCode:e},r){let n=B.Buffer.allocUnsafe(4);n.writeUInt32BE(r,0);let i=B.Buffer.concat([B.Buffer.alloc(1,0),t,n]),o=(0,Un.hmacSHA512)(e,i),a=o.slice(0,32),c=o.slice(32);return{key:a,chainCode:c}}var U8=t=>L8.test(t)?!t.split("/").slice(1).map(ag).some(isNaN):!1;Ze.isValidPath=U8;function j8(t,e,r=K8){if(!(0,Ze.isValidPath)(t))throw new Error("Invalid derivation path");let{key:n,chainCode:i}=D8(e);return t.split("/").slice(1).map(ag).map(a=>parseInt(a,10)).reduce((a,c)=>R8(a,c+r),{key:n,chainCode:i})}async function C8(t,e,r,n){let i=await(0,P8.mnemonicToSeed)(t),o=j8(e,i).key,a=Jc(o),c=r?(0,Un.concatBytes)(o,a):o;return n==="base58"?Promise.resolve((0,Un.toBase58)(c)):Promise.resolve((0,Un.toHex)(c))}Ze.ed25519_getDerivedPrivateKey=C8});var lg=L(st=>{"use strict";E();I();var z8=st&&st.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),F8=st&&st.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),H8=st&&st.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&z8(e,t,r);return F8(e,t),e},V8=st&&st.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(st,"__esModule",{value:!0});st.loadUncompressedPublicKey=st.loadCompressedPublicKey=st.publicKeyConvert=st.publicKeyCreate=st.publicKeyVerify=st.privateKeyVerify=st.loadPublicKey=st.recover=st.verify=st.sign=void 0;var W8=H8(ta()),_r=new W8.ec("p256"),ia=V8(zt());function $8(t,e,r=!0){let n=_r.sign(Array.from(t),B.Buffer.from(e),{canonical:r});return{signature:n.toBytes(),recovery:n.recoveryParam}}st.sign=$8;function G8(t,e,r,n){let i=cg(e,r,t,!1);return i==null?!1:i.equals(n)}st.verify=G8;function cg(t,e,r,n){let i={r:Array.from(t.slice(0,32)),s:Array.from(t.slice(32,64))},o=new ia.default(i.r),a=new ia.default(i.s);if(o.cmp(_r.curve.n)>=0||a.cmp(_r.curve.n)>=0||o.isZero()||a.isZero())return null;let c;try{c=_r.recoverPubKey(Array.from(r),i,e,null)}catch{return null}return B.Buffer.from(c.encode(null,n))}st.recover=cg;function Ql(t){let e=B.Buffer.from(t),r=e[0];switch(r){case 2:case 3:return e.length!==33?null:fg(r,e.subarray(1,33));case 4:case 6:case 7:return e.length!==65?null:dg(r,e.subarray(1,33),e.subarray(33,65));default:return null}}st.loadPublicKey=Ql;function Y8(t){let e=new ia.default(Array.from(t));return e.cmp(_r.curve.n)<0&&!e.isZero()}st.privateKeyVerify=Y8;function Z8(t){return Ql(t)!==null}st.publicKeyVerify=Z8;function X8(t,e){let r=_r.keyFromPrivate(Array.from(t),"bytes").getPublic();return B.Buffer.from(r.encode(null,e))}st.publicKeyCreate=X8;function J8(t,e){let r=Ql(t);if(r==null)return null;let n=_r.keyPair({pub:{x:r.x,y:r.y}}).getPublic();return B.Buffer.from(n.encode(null,e))}st.publicKeyConvert=J8;function fg(t,e){let r=new ia.default(Array.from(e));if(r.cmp(_r.curve.p)>=0)return null;let n=r.toRed(_r.curve.red),i=n.redSqr().redIMul(n).redIAdd(_r.curve.b).redSqrt();return t===3!==i.isOdd()&&(i=i.redNeg()),{x:n,y:i}}st.loadCompressedPublicKey=fg;function dg(t,e,r){let n=new ia.default(Array.from(e)),i=new ia.default(Array.from(r));if(n.cmp(_r.curve.p)>=0||i.cmp(_r.curve.p)>=0)return null;let o=n.toRed(_r.curve.red),a=i.toRed(_r.curve.red);if((t===6||t===7)&&a.isOdd()!==(t===7))return null;let c=o.redSqr().redIMul(o);return a.redSqr().redISub(c.redIAdd(_r.curve.b)).isZero()?{x:o,y:a}:null}st.loadUncompressedPublicKey=dg});var qi=L(ze=>{"use strict";E();I();Object.defineProperty(ze,"__esModule",{value:!0});ze.validateObject=ze.createHmacDrbg=ze.bitMask=ze.bitSet=ze.bitGet=ze.bitLen=ze.utf8ToBytes=ze.equalBytes=ze.concatBytes=ze.ensureBytes=ze.numberToVarBytesBE=ze.numberToBytesLE=ze.numberToBytesBE=ze.bytesToNumberLE=ze.bytesToNumberBE=ze.hexToBytes=ze.hexToNumber=ze.numberToHexUnpadded=ze.bytesToHex=void 0;var bg=BigInt(0),Qc=BigInt(1),Q8=BigInt(2),ef=t=>t instanceof Uint8Array,e4=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function th(t){if(!ef(t))throw new Error("Uint8Array expected");let e="";for(let r=0;r<t.length;r++)e+=e4[t[r]];return e}ze.bytesToHex=th;function pg(t){let e=t.toString(16);return e.length&1?`0${e}`:e}ze.numberToHexUnpadded=pg;function rh(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);return BigInt(t===""?"0":`0x${t}`)}ze.hexToNumber=rh;function tf(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);if(t.length%2)throw new Error("hex string is invalid: unpadded "+t.length);let e=new Uint8Array(t.length/2);for(let r=0;r<e.length;r++){let n=r*2,i=t.slice(n,n+2),o=Number.parseInt(i,16);if(Number.isNaN(o)||o<0)throw new Error("invalid byte sequence");e[r]=o}return e}ze.hexToBytes=tf;function t4(t){return rh(th(t))}ze.bytesToNumberBE=t4;function r4(t){if(!ef(t))throw new Error("Uint8Array expected");return rh(th(Uint8Array.from(t).reverse()))}ze.bytesToNumberLE=r4;var n4=(t,e)=>tf(t.toString(16).padStart(e*2,"0"));ze.numberToBytesBE=n4;var i4=(t,e)=>(0,ze.numberToBytesBE)(t,e).reverse();ze.numberToBytesLE=i4;var s4=t=>tf(pg(t));ze.numberToVarBytesBE=s4;function o4(t,e,r){let n;if(typeof e=="string")try{n=tf(e)}catch(o){throw new Error(`${t} must be valid hex string, got "${e}". Cause: ${o}`)}else if(ef(e))n=Uint8Array.from(e);else throw new Error(`${t} must be hex string or Uint8Array`);let i=n.length;if(typeof r=="number"&&i!==r)throw new Error(`${t} expected ${r} bytes, got ${i}`);return n}ze.ensureBytes=o4;function gg(...t){let e=new Uint8Array(t.reduce((n,i)=>n+i.length,0)),r=0;return t.forEach(n=>{if(!ef(n))throw new Error("Uint8Array expected");e.set(n,r),r+=n.length}),e}ze.concatBytes=gg;function a4(t,e){if(t.length!==e.length)return!1;for(let r=0;r<t.length;r++)if(t[r]!==e[r])return!1;return!0}ze.equalBytes=a4;function u4(t){if(typeof t!="string")throw new Error(`utf8ToBytes expected string, got ${typeof t}`);return new TextEncoder().encode(t)}ze.utf8ToBytes=u4;function c4(t){let e;for(e=0;t>bg;t>>=Qc,e+=1);return e}ze.bitLen=c4;var f4=(t,e)=>t>>BigInt(e)&Qc;ze.bitGet=f4;var d4=(t,e,r)=>t|(r?Qc:bg)<<BigInt(e);ze.bitSet=d4;var l4=t=>(Q8<<BigInt(t-1))-Qc;ze.bitMask=l4;var eh=t=>new Uint8Array(t),hg=t=>Uint8Array.from(t);function h4(t,e,r){if(typeof t!="number"||t<2)throw new Error("hashLen must be a number");if(typeof e!="number"||e<2)throw new Error("qByteLen must be a number");if(typeof r!="function")throw new Error("hmacFn must be a function");let n=eh(t),i=eh(t),o=0,a=()=>{n.fill(1),i.fill(0),o=0},c=(..._)=>r(i,n,..._),l=(_=eh())=>{i=c(hg([0]),_),n=c(),_.length!==0&&(i=c(hg([1]),_),n=c())},m=()=>{if(o++>=1e3)throw new Error("drbg: tried 1000 values");let _=0,P=[];for(;_<e;){n=c();let x=n.slice();P.push(x),_+=n.length}return gg(...P)};return(_,P)=>{a(),l(_);let x;for(;!(x=P(m()));)l();return a(),x}}ze.createHmacDrbg=h4;var b4={bigint:t=>typeof t=="bigint",function:t=>typeof t=="function",boolean:t=>typeof t=="boolean",string:t=>typeof t=="string",isSafeInteger:t=>Number.isSafeInteger(t),array:t=>Array.isArray(t),field:(t,e)=>e.Fp.isValid(t),hash:t=>typeof t=="function"&&Number.isSafeInteger(t.outputLen)};function p4(t,e,r={}){let n=(i,o,a)=>{let c=b4[o];if(typeof c!="function")throw new Error(`Invalid validator "${o}", expected function`);let l=t[i];if(!(a&&l===void 0)&&!c(l,t))throw new Error(`Invalid param ${String(i)}=${l} (${typeof l}), expected ${o}`)};for(let[i,o]of Object.entries(e))n(i,o,!1);for(let[i,o]of Object.entries(r))n(i,o,!0);return t}ze.validateObject=p4});var bo=L($e=>{"use strict";E();I();Object.defineProperty($e,"__esModule",{value:!0});$e.hashToPrivateScalar=$e.FpSqrtEven=$e.FpSqrtOdd=$e.Field=$e.nLength=$e.FpIsSquare=$e.FpDiv=$e.FpInvertBatch=$e.FpPow=$e.validateField=$e.isNegativeLE=$e.FpSqrt=$e.tonelliShanks=$e.invert=$e.pow2=$e.pow=$e.mod=void 0;var Ni=qi(),Ht=BigInt(0),lt=BigInt(1),bs=BigInt(2),g4=BigInt(3),nh=BigInt(4),yg=BigInt(5),mg=BigInt(8),y4=BigInt(9),m4=BigInt(16);function hn(t,e){let r=t%e;return r>=Ht?r:e+r}$e.mod=hn;function vg(t,e,r){if(r<=Ht||e<Ht)throw new Error("Expected power/modulo > 0");if(r===lt)return Ht;let n=lt;for(;e>Ht;)e<&&(n=n*t%r),t=t*t%r,e>>=lt;return n}$e.pow=vg;function v4(t,e,r){let n=t;for(;e-- >Ht;)n*=n,n%=r;return n}$e.pow2=v4;function rf(t,e){if(t===Ht||e<=Ht)throw new Error(`invert: expected positive integers, got n=${t} mod=${e}`);let r=hn(t,e),n=e,i=Ht,o=lt,a=lt,c=Ht;for(;r!==Ht;){let m=n/r,S=n%r,_=i-a*m,P=o-c*m;n=r,r=S,i=a,o=c,a=_,c=P}if(n!==lt)throw new Error("invert: does not exist");return hn(i,e)}$e.invert=rf;function wg(t){let e=(t-lt)/bs,r,n,i;for(r=t-lt,n=0;r%bs===Ht;r/=bs,n++);for(i=bs;i<t&&vg(i,e,t)!==t-lt;i++);if(n===1){let a=(t+lt)/nh;return function(l,m){let S=l.pow(m,a);if(!l.eql(l.sqr(S),m))throw new Error("Cannot find square root");return S}}let o=(r+lt)/bs;return function(c,l){if(c.pow(l,e)===c.neg(c.ONE))throw new Error("Cannot find square root");let m=n,S=c.pow(c.mul(c.ONE,i),r),_=c.pow(l,o),P=c.pow(l,r);for(;!c.eql(P,c.ONE);){if(c.eql(P,c.ZERO))return c.ZERO;let x=1;for(let M=c.sqr(P);x<m&&!c.eql(M,c.ONE);x++)M=c.sqr(M);let T=c.pow(S,lt<<BigInt(m-x-1));S=c.sqr(T),_=c.mul(_,T),P=c.mul(P,S),m=x}return _}}$e.tonelliShanks=wg;function _g(t){if(t%nh===g4){let e=(t+lt)/nh;return function(n,i){let o=n.pow(i,e);if(!n.eql(n.sqr(o),i))throw new Error("Cannot find square root");return o}}if(t%mg===yg){let e=(t-yg)/mg;return function(n,i){let o=n.mul(i,bs),a=n.pow(o,e),c=n.mul(i,a),l=n.mul(n.mul(c,bs),a),m=n.mul(c,n.sub(l,n.ONE));if(!n.eql(n.sqr(m),i))throw new Error("Cannot find square root");return m}}return t%m4,wg(t)}$e.FpSqrt=_g;var w4=(t,e)=>(hn(t,e)<)===lt;$e.isNegativeLE=w4;var _4=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function S4(t){let e={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},r=_4.reduce((n,i)=>(n[i]="function",n),e);return(0,Ni.validateObject)(t,r)}$e.validateField=S4;function Sg(t,e,r){if(r<Ht)throw new Error("Expected power > 0");if(r===Ht)return t.ONE;if(r===lt)return e;let n=t.ONE,i=e;for(;r>Ht;)r<&&(n=t.mul(n,i)),i=t.sqr(i),r>>=lt;return n}$e.FpPow=Sg;function Mg(t,e){let r=new Array(e.length),n=e.reduce((o,a,c)=>t.is0(a)?o:(r[c]=o,t.mul(o,a)),t.ONE),i=t.inv(n);return e.reduceRight((o,a,c)=>t.is0(a)?o:(r[c]=t.mul(o,r[c]),t.mul(o,a)),i),r}$e.FpInvertBatch=Mg;function M4(t,e,r){return t.mul(e,typeof r=="bigint"?rf(r,t.ORDER):t.inv(r))}$e.FpDiv=M4;function E4(t){let e=(t.ORDER-lt)/bs;return r=>{let n=t.pow(r,e);return t.eql(n,t.ZERO)||t.eql(n,t.ONE)}}$e.FpIsSquare=E4;function ih(t,e){let r=e!==void 0?e:t.toString(2).length,n=Math.ceil(r/8);return{nBitLength:r,nByteLength:n}}$e.nLength=ih;function I4(t,e,r=!1,n={}){if(t<=Ht)throw new Error(`Expected Fp ORDER > 0, got ${t}`);let{nBitLength:i,nByteLength:o}=ih(t,e);if(o>2048)throw new Error("Field lengths over 2048 bytes are not supported");let a=_g(t),c=Object.freeze({ORDER:t,BITS:i,BYTES:o,MASK:(0,Ni.bitMask)(i),ZERO:Ht,ONE:lt,create:l=>hn(l,t),isValid:l=>{if(typeof l!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof l}`);return Ht<=l&&l<t},is0:l=>l===Ht,isOdd:l=>(l<)===lt,neg:l=>hn(-l,t),eql:(l,m)=>l===m,sqr:l=>hn(l*l,t),add:(l,m)=>hn(l+m,t),sub:(l,m)=>hn(l-m,t),mul:(l,m)=>hn(l*m,t),pow:(l,m)=>Sg(c,l,m),div:(l,m)=>hn(l*rf(m,t),t),sqrN:l=>l*l,addN:(l,m)=>l+m,subN:(l,m)=>l-m,mulN:(l,m)=>l*m,inv:l=>rf(l,t),sqrt:n.sqrt||(l=>a(c,l)),invertBatch:l=>Mg(c,l),cmov:(l,m,S)=>S?m:l,toBytes:l=>r?(0,Ni.numberToBytesLE)(l,o):(0,Ni.numberToBytesBE)(l,o),fromBytes:l=>{if(l.length!==o)throw new Error(`Fp.fromBytes: expected ${o}, got ${l.length}`);return r?(0,Ni.bytesToNumberLE)(l):(0,Ni.bytesToNumberBE)(l)}});return Object.freeze(c)}$e.Field=I4;function x4(t,e){if(!t.isOdd)throw new Error("Field doesn't have isOdd");let r=t.sqrt(e);return t.isOdd(r)?r:t.neg(r)}$e.FpSqrtOdd=x4;function A4(t,e){if(!t.isOdd)throw new Error("Field doesn't have isOdd");let r=t.sqrt(e);return t.isOdd(r)?t.neg(r):r}$e.FpSqrtEven=A4;function P4(t,e,r=!1){t=(0,Ni.ensureBytes)("privateHash",t);let n=t.length,i=ih(e).nByteLength+8;if(i<24||n<i||n>1024)throw new Error(`hashToPrivateScalar: expected ${i}-1024 bytes of input, got ${n}`);let o=r?(0,Ni.bytesToNumberLE)(t):(0,Ni.bytesToNumberBE)(t);return hn(o,e-lt)+lt}$e.hashToPrivateScalar=P4});var Ig=L(sa=>{"use strict";E();I();Object.defineProperty(sa,"__esModule",{value:!0});sa.validateBasic=sa.wNAF=void 0;var Eg=bo(),B4=qi(),T4=BigInt(0),sh=BigInt(1);function O4(t,e){let r=(i,o)=>{let a=o.negate();return i?a:o},n=i=>{let o=Math.ceil(e/i)+1,a=2**(i-1);return{windows:o,windowSize:a}};return{constTimeNegate:r,unsafeLadder(i,o){let a=t.ZERO,c=i;for(;o>T4;)o&sh&&(a=a.add(c)),c=c.double(),o>>=sh;return a},precomputeWindow(i,o){let{windows:a,windowSize:c}=n(o),l=[],m=i,S=m;for(let _=0;_<a;_++){S=m,l.push(S);for(let P=1;P<c;P++)S=S.add(m),l.push(S);m=S.double()}return l},wNAF(i,o,a){let{windows:c,windowSize:l}=n(i),m=t.ZERO,S=t.BASE,_=BigInt(2**i-1),P=2**i,x=BigInt(i);for(let T=0;T<c;T++){let M=T*l,k=Number(a&_);a>>=x,k>l&&(k-=P,a+=sh);let N=M,R=M+Math.abs(k)-1,K=T%2!==0,z=k<0;k===0?S=S.add(r(K,o[N])):m=m.add(r(z,o[R]))}return{p:m,f:S}},wNAFCached(i,o,a,c){let l=i._WINDOW_SIZE||1,m=o.get(i);return m||(m=this.precomputeWindow(i,l),l!==1&&o.set(i,c(m))),this.wNAF(l,m,a)}}}sa.wNAF=O4;function k4(t){return(0,Eg.validateField)(t.Fp),(0,B4.validateObject)(t,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...(0,Eg.nLength)(t.n,t.nBitLength),...t,p:t.Fp.ORDER})}sa.validateBasic=k4});var sf=L(ht=>{"use strict";E();I();var q4=ht&&ht.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),N4=ht&&ht.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Ag=ht&&ht.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&q4(e,t,r);return N4(e,t),e};Object.defineProperty(ht,"__esModule",{value:!0});ht.mapToCurveSimpleSWU=ht.SWUFpSqrtRatio=ht.weierstrass=ht.weierstrassPoints=ht.DER=void 0;var Pu=Ag(bo()),Nt=Ag(qi()),di=qi(),oh=Ig();function L4(t){let e=(0,oh.validateBasic)(t);Nt.validateObject(e,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});let{endo:r,Fp:n,a:i}=e;if(r){if(!n.eql(i,n.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if(typeof r!="object"||typeof r.beta!="bigint"||typeof r.splitScalar!="function")throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...e})}var{bytesToNumberBE:K4,hexToBytes:D4}=Nt;ht.DER={Err:class extends Error{constructor(e=""){super(e)}},_parseInt(t){let{Err:e}=ht.DER;if(t.length<2||t[0]!==2)throw new e("Invalid signature integer tag");let r=t[1],n=t.subarray(2,r+2);if(!r||n.length!==r)throw new e("Invalid signature integer: wrong length");if(n[0]&128)throw new e("Invalid signature integer: negative");if(n[0]===0&&!(n[1]&128))throw new e("Invalid signature integer: unnecessary leading zero");return{d:K4(n),l:t.subarray(r+2)}},toSig(t){let{Err:e}=ht.DER,r=typeof t=="string"?D4(t):t;if(!(r instanceof Uint8Array))throw new Error("ui8a expected");let n=r.length;if(n<2||r[0]!=48)throw new e("Invalid signature tag");if(r[1]!==n-2)throw new e("Invalid signature: incorrect length");let{d:i,l:o}=ht.DER._parseInt(r.subarray(2)),{d:a,l:c}=ht.DER._parseInt(o);if(c.length)throw new e("Invalid signature: left bytes after parsing");return{r:i,s:a}},hexFromSig(t){let e=m=>Number.parseInt(m[0],16)&8?"00"+m:m,r=m=>{let S=m.toString(16);return S.length&1?`0${S}`:S},n=e(r(t.s)),i=e(r(t.r)),o=n.length/2,a=i.length/2,c=r(o),l=r(a);return`30${r(a+o+4)}02${l}${i}02${c}${n}`}};var jn=BigInt(0),Ot=BigInt(1),ps=BigInt(2),nf=BigInt(3),xg=BigInt(4);function Pg(t){let e=L4(t),{Fp:r}=e,n=e.toBytes||((T,M,k)=>{let N=M.toAffine();return Nt.concatBytes(Uint8Array.from([4]),r.toBytes(N.x),r.toBytes(N.y))}),i=e.fromBytes||(T=>{let M=T.subarray(1),k=r.fromBytes(M.subarray(0,r.BYTES)),N=r.fromBytes(M.subarray(r.BYTES,2*r.BYTES));return{x:k,y:N}});function o(T){let{a:M,b:k}=e,N=r.sqr(T),R=r.mul(N,T);return r.add(r.add(R,r.mul(T,M)),k)}if(!r.eql(r.sqr(e.Gy),o(e.Gx)))throw new Error("bad generator point: equation left != right");function a(T){return typeof T=="bigint"&&jn<T&&T<e.n}function c(T){if(!a(T))throw new Error("Expected valid bigint: 0 < bigint < curve.n")}function l(T){let{allowedPrivateKeyLengths:M,nByteLength:k,wrapPrivateKey:N,n:R}=e;if(M&&typeof T!="bigint"){if(T instanceof Uint8Array&&(T=Nt.bytesToHex(T)),typeof T!="string"||!M.includes(T.length))throw new Error("Invalid key");T=T.padStart(k*2,"0")}let K;try{K=typeof T=="bigint"?T:Nt.bytesToNumberBE((0,di.ensureBytes)("private key",T,k))}catch{throw new Error(`private key must be ${k} bytes, hex or bigint, not ${typeof T}`)}return N&&(K=Pu.mod(K,R)),c(K),K}let m=new Map;function S(T){if(!(T instanceof _))throw new Error("ProjectivePoint expected")}class _{constructor(M,k,N){if(this.px=M,this.py=k,this.pz=N,M==null||!r.isValid(M))throw new Error("x required");if(k==null||!r.isValid(k))throw new Error("y required");if(N==null||!r.isValid(N))throw new Error("z required")}static fromAffine(M){let{x:k,y:N}=M||{};if(!M||!r.isValid(k)||!r.isValid(N))throw new Error("invalid affine point");if(M instanceof _)throw new Error("projective point not allowed");let R=K=>r.eql(K,r.ZERO);return R(k)&&R(N)?_.ZERO:new _(k,N,r.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(M){let k=r.invertBatch(M.map(N=>N.pz));return M.map((N,R)=>N.toAffine(k[R])).map(_.fromAffine)}static fromHex(M){let k=_.fromAffine(i((0,di.ensureBytes)("pointHex",M)));return k.assertValidity(),k}static fromPrivateKey(M){return _.BASE.multiply(l(M))}_setWindowSize(M){this._WINDOW_SIZE=M,m.delete(this)}assertValidity(){if(this.is0()){if(e.allowInfinityPoint)return;throw new Error("bad point: ZERO")}let{x:M,y:k}=this.toAffine();if(!r.isValid(M)||!r.isValid(k))throw new Error("bad point: x or y not FE");let N=r.sqr(k),R=o(M);if(!r.eql(N,R))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){let{y:M}=this.toAffine();if(r.isOdd)return!r.isOdd(M);throw new Error("Field doesn't support isOdd")}equals(M){S(M);let{px:k,py:N,pz:R}=this,{px:K,py:z,pz:j}=M,U=r.eql(r.mul(k,j),r.mul(K,R)),V=r.eql(r.mul(N,j),r.mul(z,R));return U&&V}negate(){return new _(this.px,r.neg(this.py),this.pz)}double(){let{a:M,b:k}=e,N=r.mul(k,nf),{px:R,py:K,pz:z}=this,j=r.ZERO,U=r.ZERO,V=r.ZERO,H=r.mul(R,R),J=r.mul(K,K),q=r.mul(z,z),f=r.mul(R,K);return f=r.add(f,f),V=r.mul(R,z),V=r.add(V,V),j=r.mul(M,V),U=r.mul(N,q),U=r.add(j,U),j=r.sub(J,U),U=r.add(J,U),U=r.mul(j,U),j=r.mul(f,j),V=r.mul(N,V),q=r.mul(M,q),f=r.sub(H,q),f=r.mul(M,f),f=r.add(f,V),V=r.add(H,H),H=r.add(V,H),H=r.add(H,q),H=r.mul(H,f),U=r.add(U,H),q=r.mul(K,z),q=r.add(q,q),H=r.mul(q,f),j=r.sub(j,H),V=r.mul(q,J),V=r.add(V,V),V=r.add(V,V),new _(j,U,V)}add(M){S(M);let{px:k,py:N,pz:R}=this,{px:K,py:z,pz:j}=M,U=r.ZERO,V=r.ZERO,H=r.ZERO,J=e.a,q=r.mul(e.b,nf),f=r.mul(k,K),v=r.mul(N,z),h=r.mul(R,j),s=r.add(k,N),u=r.add(K,z);s=r.mul(s,u),u=r.add(f,v),s=r.sub(s,u),u=r.add(k,R);let b=r.add(K,j);return u=r.mul(u,b),b=r.add(f,h),u=r.sub(u,b),b=r.add(N,R),U=r.add(z,j),b=r.mul(b,U),U=r.add(v,h),b=r.sub(b,U),H=r.mul(J,u),U=r.mul(q,h),H=r.add(U,H),U=r.sub(v,H),H=r.add(v,H),V=r.mul(U,H),v=r.add(f,f),v=r.add(v,f),h=r.mul(J,h),u=r.mul(q,u),v=r.add(v,h),h=r.sub(f,h),h=r.mul(J,h),u=r.add(u,h),f=r.mul(v,u),V=r.add(V,f),f=r.mul(b,u),U=r.mul(s,U),U=r.sub(U,f),f=r.mul(s,v),H=r.mul(b,H),H=r.add(H,f),new _(U,V,H)}subtract(M){return this.add(M.negate())}is0(){return this.equals(_.ZERO)}wNAF(M){return x.wNAFCached(this,m,M,k=>{let N=r.invertBatch(k.map(R=>R.pz));return k.map((R,K)=>R.toAffine(N[K])).map(_.fromAffine)})}multiplyUnsafe(M){let k=_.ZERO;if(M===jn)return k;if(c(M),M===Ot)return this;let{endo:N}=e;if(!N)return x.unsafeLadder(this,M);let{k1neg:R,k1:K,k2neg:z,k2:j}=N.splitScalar(M),U=k,V=k,H=this;for(;K>jn||j>jn;)K&Ot&&(U=U.add(H)),j&Ot&&(V=V.add(H)),H=H.double(),K>>=Ot,j>>=Ot;return R&&(U=U.negate()),z&&(V=V.negate()),V=new _(r.mul(V.px,N.beta),V.py,V.pz),U.add(V)}multiply(M){c(M);let k=M,N,R,{endo:K}=e;if(K){let{k1neg:z,k1:j,k2neg:U,k2:V}=K.splitScalar(k),{p:H,f:J}=this.wNAF(j),{p:q,f}=this.wNAF(V);H=x.constTimeNegate(z,H),q=x.constTimeNegate(U,q),q=new _(r.mul(q.px,K.beta),q.py,q.pz),N=H.add(q),R=J.add(f)}else{let{p:z,f:j}=this.wNAF(k);N=z,R=j}return _.normalizeZ([N,R])[0]}multiplyAndAddUnsafe(M,k,N){let R=_.BASE,K=(j,U)=>U===jn||U===Ot||!j.equals(R)?j.multiplyUnsafe(U):j.multiply(U),z=K(this,k).add(K(M,N));return z.is0()?void 0:z}toAffine(M){let{px:k,py:N,pz:R}=this,K=this.is0();M==null&&(M=K?r.ONE:r.inv(R));let z=r.mul(k,M),j=r.mul(N,M),U=r.mul(R,M);if(K)return{x:r.ZERO,y:r.ZERO};if(!r.eql(U,r.ONE))throw new Error("invZ was invalid");return{x:z,y:j}}isTorsionFree(){let{h:M,isTorsionFree:k}=e;if(M===Ot)return!0;if(k)return k(_,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){let{h:M,clearCofactor:k}=e;return M===Ot?this:k?k(_,this):this.multiplyUnsafe(e.h)}toRawBytes(M=!0){return this.assertValidity(),n(_,this,M)}toHex(M=!0){return Nt.bytesToHex(this.toRawBytes(M))}}_.BASE=new _(e.Gx,e.Gy,r.ONE),_.ZERO=new _(r.ZERO,r.ONE,r.ZERO);let P=e.nBitLength,x=(0,oh.wNAF)(_,e.endo?Math.ceil(P/2):P);return{CURVE:e,ProjectivePoint:_,normPrivateKeyToScalar:l,weierstrassEquation:o,isWithinCurveOrder:a}}ht.weierstrassPoints=Pg;function R4(t){let e=(0,oh.validateBasic)(t);return Nt.validateObject(e,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...e})}function U4(t){let e=R4(t),{Fp:r,n}=e,i=r.BYTES+1,o=2*r.BYTES+1;function a(u){return jn<u&&u<r.ORDER}function c(u){return Pu.mod(u,n)}function l(u){return Pu.invert(u,n)}let{ProjectivePoint:m,normPrivateKeyToScalar:S,weierstrassEquation:_,isWithinCurveOrder:P}=Pg({...e,toBytes(u,b,y){let g=b.toAffine(),d=r.toBytes(g.x),w=Nt.concatBytes;return y?w(Uint8Array.from([b.hasEvenY()?2:3]),d):w(Uint8Array.from([4]),d,r.toBytes(g.y))},fromBytes(u){let b=u.length,y=u[0],g=u.subarray(1);if(b===i&&(y===2||y===3)){let d=Nt.bytesToNumberBE(g);if(!a(d))throw new Error("Point is not on curve");let w=_(d),A=r.sqrt(w),p=(A&Ot)===Ot;return(y&1)===1!==p&&(A=r.neg(A)),{x:d,y:A}}else if(b===o&&y===4){let d=r.fromBytes(g.subarray(0,r.BYTES)),w=r.fromBytes(g.subarray(r.BYTES,2*r.BYTES));return{x:d,y:w}}else throw new Error(`Point of length ${b} was invalid. Expected ${i} compressed bytes or ${o} uncompressed bytes`)}}),x=u=>Nt.bytesToHex(Nt.numberToBytesBE(u,e.nByteLength));function T(u){let b=n>>Ot;return u>b}function M(u){return T(u)?c(-u):u}let k=(u,b,y)=>Nt.bytesToNumberBE(u.slice(b,y));class N{constructor(b,y,g){this.r=b,this.s=y,this.recovery=g,this.assertValidity()}static fromCompact(b){let y=e.nByteLength;return b=(0,di.ensureBytes)("compactSignature",b,y*2),new N(k(b,0,y),k(b,y,2*y))}static fromDER(b){let{r:y,s:g}=ht.DER.toSig((0,di.ensureBytes)("DER",b));return new N(y,g)}assertValidity(){if(!P(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!P(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(b){return new N(this.r,this.s,b)}recoverPublicKey(b){let{r:y,s:g,recovery:d}=this,w=V((0,di.ensureBytes)("msgHash",b));if(d==null||![0,1,2,3].includes(d))throw new Error("recovery id invalid");let A=d===2||d===3?y+e.n:y;if(A>=r.ORDER)throw new Error("recovery id 2 or 3 invalid");let p=(d&1)===0?"02":"03",O=m.fromHex(p+x(A)),C=l(A),F=c(-w*C),W=c(g*C),X=m.BASE.multiplyAndAddUnsafe(O,F,W);if(!X)throw new Error("point at infinify");return X.assertValidity(),X}hasHighS(){return T(this.s)}normalizeS(){return this.hasHighS()?new N(this.r,c(-this.s),this.recovery):this}toDERRawBytes(){return Nt.hexToBytes(this.toDERHex())}toDERHex(){return ht.DER.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return Nt.hexToBytes(this.toCompactHex())}toCompactHex(){return x(this.r)+x(this.s)}}let R={isValidPrivateKey(u){try{return S(u),!0}catch{return!1}},normPrivateKeyToScalar:S,randomPrivateKey:()=>{let u=e.randomBytes(r.BYTES+8),b=Pu.hashToPrivateScalar(u,n);return Nt.numberToBytesBE(b,e.nByteLength)},precompute(u=8,b=m.BASE){return b._setWindowSize(u),b.multiply(BigInt(3)),b}};function K(u,b=!0){return m.fromPrivateKey(u).toRawBytes(b)}function z(u){let b=u instanceof Uint8Array,y=typeof u=="string",g=(b||y)&&u.length;return b?g===i||g===o:y?g===2*i||g===2*o:u instanceof m}function j(u,b,y=!0){if(z(u))throw new Error("first arg must be private key");if(!z(b))throw new Error("second arg must be public key");return m.fromHex(b).multiply(S(u)).toRawBytes(y)}let U=e.bits2int||function(u){let b=Nt.bytesToNumberBE(u),y=u.length*8-e.nBitLength;return y>0?b>>BigInt(y):b},V=e.bits2int_modN||function(u){return c(U(u))},H=Nt.bitMask(e.nBitLength);function J(u){if(typeof u!="bigint")throw new Error("bigint expected");if(!(jn<=u&&u<H))throw new Error(`bigint expected < 2^${e.nBitLength}`);return Nt.numberToBytesBE(u,e.nByteLength)}function q(u,b,y=f){if(["recovered","canonical"].some(te=>te in y))throw new Error("sign() legacy options not supported");let{hash:g,randomBytes:d}=e,{lowS:w,prehash:A,extraEntropy:p}=y;w==null&&(w=!0),u=(0,di.ensureBytes)("msgHash",u),A&&(u=(0,di.ensureBytes)("prehashed msgHash",g(u)));let O=V(u),C=S(b),F=[J(C),J(O)];if(p!=null){let te=p===!0?d(r.BYTES):p;F.push((0,di.ensureBytes)("extraEntropy",te,r.BYTES))}let W=Nt.concatBytes(...F),X=O;function ee(te){let Vt=U(te);if(!P(Vt))return;let ie=l(Vt),ne=m.BASE.multiply(Vt).toAffine(),sn=c(ne.x);if(sn===jn)return;let se=c(ie*c(X+sn*C));if(se===jn)return;let ce=(ne.x===sn?0:2)|Number(ne.y&Ot),Gi=se;return w&&T(se)&&(Gi=M(se),ce^=1),new N(sn,Gi,ce)}return{seed:W,k2sig:ee}}let f={lowS:e.lowS,prehash:!1},v={lowS:e.lowS,prehash:!1};function h(u,b,y=f){let{seed:g,k2sig:d}=q(u,b,y),w=e;return Nt.createHmacDrbg(w.hash.outputLen,w.nByteLength,w.hmac)(g,d)}m.BASE._setWindowSize(8);function s(u,b,y,g=v){let d=u;if(b=(0,di.ensureBytes)("msgHash",b),y=(0,di.ensureBytes)("publicKey",y),"strict"in g)throw new Error("options.strict was renamed to lowS");let{lowS:w,prehash:A}=g,p,O;try{if(typeof d=="string"||d instanceof Uint8Array)try{p=N.fromDER(d)}catch(ne){if(!(ne instanceof ht.DER.Err))throw ne;p=N.fromCompact(d)}else if(typeof d=="object"&&typeof d.r=="bigint"&&typeof d.s=="bigint"){let{r:ne,s:sn}=d;p=new N(ne,sn)}else throw new Error("PARSE");O=m.fromHex(y)}catch(ne){if(ne.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(w&&p.hasHighS())return!1;A&&(b=e.hash(b));let{r:C,s:F}=p,W=V(b),X=l(F),ee=c(W*X),te=c(C*X),Vt=m.BASE.multiplyAndAddUnsafe(O,ee,te)?.toAffine();return Vt?c(Vt.x)===C:!1}return{CURVE:e,getPublicKey:K,getSharedSecret:j,sign:h,verify:s,ProjectivePoint:m,Signature:N,utils:R}}ht.weierstrass=U4;function Bg(t,e){let r=t.ORDER,n=jn;for(let T=r-Ot;T%ps===jn;T/=ps)n+=Ot;let i=n,o=ps<<i-Ot-Ot,a=o*ps,c=(r-Ot)/a,l=(c-Ot)/ps,m=a-Ot,S=o,_=t.pow(e,c),P=t.pow(e,(c+Ot)/ps),x=(T,M)=>{let k=_,N=t.pow(M,m),R=t.sqr(N);R=t.mul(R,M);let K=t.mul(T,R);K=t.pow(K,l),K=t.mul(K,N),N=t.mul(K,M),R=t.mul(K,T);let z=t.mul(R,N);K=t.pow(z,S);let j=t.eql(K,t.ONE);N=t.mul(R,P),K=t.mul(z,k),R=t.cmov(N,R,j),z=t.cmov(K,z,j);for(let U=i;U>Ot;U--){let V=U-ps;V=ps<<V-Ot;let H=t.pow(z,V),J=t.eql(H,t.ONE);N=t.mul(R,k),k=t.mul(k,k),H=t.mul(z,k),R=t.cmov(N,R,J),z=t.cmov(H,z,J)}return{isValid:j,value:R}};if(t.ORDER%xg===nf){let T=(t.ORDER-nf)/xg,M=t.sqrt(t.neg(e));x=(k,N)=>{let R=t.sqr(N),K=t.mul(k,N);R=t.mul(R,K);let z=t.pow(R,T);z=t.mul(z,K);let j=t.mul(z,M),U=t.mul(t.sqr(z),N),V=t.eql(U,k),H=t.cmov(j,z,V);return{isValid:V,value:H}}}return x}ht.SWUFpSqrtRatio=Bg;function j4(t,e){if(Pu.validateField(t),!t.isValid(e.A)||!t.isValid(e.B)||!t.isValid(e.Z))throw new Error("mapToCurveSimpleSWU: invalid opts");let r=Bg(t,e.Z);if(!t.isOdd)throw new Error("Fp.isOdd is not implemented!");return n=>{let i,o,a,c,l,m,S,_;i=t.sqr(n),i=t.mul(i,e.Z),o=t.sqr(i),o=t.add(o,i),a=t.add(o,t.ONE),a=t.mul(a,e.B),c=t.cmov(e.Z,t.neg(o),!t.eql(o,t.ZERO)),c=t.mul(c,e.A),o=t.sqr(a),m=t.sqr(c),l=t.mul(m,e.A),o=t.add(o,l),o=t.mul(o,a),m=t.mul(m,c),l=t.mul(m,e.B),o=t.add(o,l),S=t.mul(i,a);let{isValid:P,value:x}=r(o,m);_=t.mul(i,n),_=t.mul(_,x),S=t.cmov(S,a,P),_=t.cmov(_,x,P);let T=t.isOdd(n)===t.isOdd(_);return _=t.cmov(t.neg(_),_,T),S=t.div(S,c),{x:S,y:_}}}ht.mapToCurveSimpleSWU=j4});var kg=L(bn=>{"use strict";E();I();Object.defineProperty(bn,"__esModule",{value:!0});bn.createHasher=bn.isogenyMap=bn.hash_to_field=bn.expand_message_xof=bn.expand_message_xmd=void 0;var C4=bo(),Cn=qi();function z4(t){if(t instanceof Uint8Array)return t;if(typeof t=="string")return(0,Cn.utf8ToBytes)(t);throw new Error("DST must be Uint8Array or string")}var F4=Cn.bytesToNumberBE;function gs(t,e){if(t<0||t>=1<<8*e)throw new Error(`bad I2OSP call: value=${t} length=${e}`);let r=Array.from({length:e}).fill(0);for(let n=e-1;n>=0;n--)r[n]=t&255,t>>>=8;return new Uint8Array(r)}function H4(t,e){let r=new Uint8Array(t.length);for(let n=0;n<t.length;n++)r[n]=t[n]^e[n];return r}function Bu(t){if(!(t instanceof Uint8Array))throw new Error("Uint8Array expected")}function uh(t){if(!Number.isSafeInteger(t))throw new Error("number expected")}function Tg(t,e,r,n){Bu(t),Bu(e),uh(r),e.length>255&&(e=n((0,Cn.concatBytes)((0,Cn.utf8ToBytes)("H2C-OVERSIZE-DST-"),e)));let{outputLen:i,blockLen:o}=n,a=Math.ceil(r/i);if(a>255)throw new Error("Invalid xmd length");let c=(0,Cn.concatBytes)(e,gs(e.length,1)),l=gs(0,o),m=gs(r,2),S=new Array(a),_=n((0,Cn.concatBytes)(l,t,m,gs(0,1),c));S[0]=n((0,Cn.concatBytes)(_,gs(1,1),c));for(let x=1;x<=a;x++){let T=[H4(_,S[x-1]),gs(x+1,1),c];S[x]=n((0,Cn.concatBytes)(...T))}return(0,Cn.concatBytes)(...S).slice(0,r)}bn.expand_message_xmd=Tg;function Og(t,e,r,n,i){if(Bu(t),Bu(e),uh(r),e.length>255){let o=Math.ceil(2*n/8);e=i.create({dkLen:o}).update((0,Cn.utf8ToBytes)("H2C-OVERSIZE-DST-")).update(e).digest()}if(r>65535||e.length>255)throw new Error("expand_message_xof: invalid lenInBytes");return i.create({dkLen:r}).update(t).update(gs(r,2)).update(e).update(gs(e.length,1)).digest()}bn.expand_message_xof=Og;function ah(t,e,r){(0,Cn.validateObject)(r,{DST:"string",p:"bigint",m:"isSafeInteger",k:"isSafeInteger",hash:"hash"});let{p:n,k:i,m:o,hash:a,expand:c,DST:l}=r;Bu(t),uh(e);let m=z4(l),S=n.toString(2).length,_=Math.ceil((S+i)/8),P=e*o*_,x;if(c==="xmd")x=Tg(t,m,P,a);else if(c==="xof")x=Og(t,m,P,i,a);else if(c==="_internal_pass")x=t;else throw new Error('expand must be "xmd" or "xof"');let T=new Array(e);for(let M=0;M<e;M++){let k=new Array(o);for(let N=0;N<o;N++){let R=_*(N+M*o),K=x.subarray(R,R+_);k[N]=(0,C4.mod)(F4(K),n)}T[M]=k}return T}bn.hash_to_field=ah;function V4(t,e){let r=e.map(n=>Array.from(n).reverse());return(n,i)=>{let[o,a,c,l]=r.map(m=>m.reduce((S,_)=>t.add(t.mul(S,n),_)));return n=t.div(o,a),i=t.mul(i,t.div(c,l)),{x:n,y:i}}}bn.isogenyMap=V4;function W4(t,e,r){if(typeof e!="function")throw new Error("mapToCurve() must be defined");return{hashToCurve(n,i){let o=ah(n,2,{...r,DST:r.DST,...i}),a=t.fromAffine(e(o[0])),c=t.fromAffine(e(o[1])),l=a.add(c).clearCofactor();return l.assertValidity(),l},encodeToCurve(n,i){let o=ah(n,1,{...r,DST:r.encodeDST,...i}),a=t.fromAffine(e(o[0])).clearCofactor();return a.assertValidity(),a}}}bn.createHasher=W4});var ch=L(oa=>{"use strict";E();I();Object.defineProperty(oa,"__esModule",{value:!0});oa.createCurve=oa.getHash=void 0;var $4=pu(),qg=er(),G4=sf();function Ng(t){return{hash:t,hmac:(e,...r)=>(0,$4.hmac)(t,e,(0,qg.concatBytes)(...r)),randomBytes:qg.randomBytes}}oa.getHash=Ng;function Y4(t,e){let r=n=>(0,G4.weierstrass)({...t,...Ng(n)});return Object.freeze({...r(e),create:r})}oa.createCurve=Y4});var Hg=L(Lt=>{"use strict";E();I();var Z4=Lt&&Lt.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),X4=Lt&&Lt.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),J4=Lt&&Lt.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Z4(e,t,r);return X4(e,t),e},fh;Object.defineProperty(Lt,"__esModule",{value:!0});Lt.encodeToCurve=Lt.hashToCurve=Lt.schnorr=Lt.secp256k1=void 0;var of=No(),Q4=er(),Zt=bo(),e5=sf(),dr=qi(),Dg=J4(kg()),t5=ch(),ff=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),af=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),Rg=BigInt(1),uf=BigInt(2),Lg=(t,e)=>(t+e/uf)/e;function Ug(t){let e=ff,r=BigInt(3),n=BigInt(6),i=BigInt(11),o=BigInt(22),a=BigInt(23),c=BigInt(44),l=BigInt(88),m=t*t*t%e,S=m*m*t%e,_=(0,Zt.pow2)(S,r,e)*S%e,P=(0,Zt.pow2)(_,r,e)*S%e,x=(0,Zt.pow2)(P,uf,e)*m%e,T=(0,Zt.pow2)(x,i,e)*x%e,M=(0,Zt.pow2)(T,o,e)*T%e,k=(0,Zt.pow2)(M,c,e)*M%e,N=(0,Zt.pow2)(k,l,e)*k%e,R=(0,Zt.pow2)(N,c,e)*M%e,K=(0,Zt.pow2)(R,r,e)*S%e,z=(0,Zt.pow2)(K,a,e)*T%e,j=(0,Zt.pow2)(z,n,e)*m%e,U=(0,Zt.pow2)(j,uf,e);if(!ys.eql(ys.sqr(U),t))throw new Error("Cannot find square root");return U}var ys=(0,Zt.Field)(ff,void 0,void 0,{sqrt:Ug});Lt.secp256k1=(0,t5.createCurve)({a:BigInt(0),b:BigInt(7),Fp:ys,n:af,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:t=>{let e=af,r=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-Rg*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),o=r,a=BigInt("0x100000000000000000000000000000000"),c=Lg(o*t,e),l=Lg(-n*t,e),m=(0,Zt.mod)(t-c*r-l*i,e),S=(0,Zt.mod)(-c*n-l*o,e),_=m>a,P=S>a;if(_&&(m=e-m),P&&(S=e-S),m>a||S>a)throw new Error("splitScalar: Endomorphism failed, k="+t);return{k1neg:_,k1:m,k2neg:P,k2:S}}}},of.sha256);var df=BigInt(0),jg=t=>typeof t=="bigint"&&df<t&&t<ff,r5=t=>typeof t=="bigint"&&df<t&&t<af,Kg={};function cf(t,...e){let r=Kg[t];if(r===void 0){let n=(0,of.sha256)(Uint8Array.from(t,i=>i.charCodeAt(0)));r=(0,dr.concatBytes)(n,n),Kg[t]=r}return(0,of.sha256)((0,dr.concatBytes)(r,...e))}var bh=t=>t.toRawBytes(!0).slice(1),lh=t=>(0,dr.numberToBytesBE)(t,32),dh=t=>(0,Zt.mod)(t,ff),Tu=t=>(0,Zt.mod)(t,af),ph=Lt.secp256k1.ProjectivePoint,n5=(t,e,r)=>ph.BASE.multiplyAndAddUnsafe(t,e,r);function hh(t){let e=Lt.secp256k1.utils.normPrivateKeyToScalar(t),r=ph.fromPrivateKey(e);return{scalar:r.hasEvenY()?e:Tu(-e),bytes:bh(r)}}function Cg(t){if(!jg(t))throw new Error("bad x: need 0 < x < p");let e=dh(t*t),r=dh(e*t+BigInt(7)),n=Ug(r);n%uf!==df&&(n=dh(-n));let i=new ph(t,n,Rg);return i.assertValidity(),i}function zg(...t){return Tu((0,dr.bytesToNumberBE)(cf("BIP0340/challenge",...t)))}function i5(t){return hh(t).bytes}function s5(t,e,r=(0,Q4.randomBytes)(32)){let n=(0,dr.ensureBytes)("message",t),{bytes:i,scalar:o}=hh(e),a=(0,dr.ensureBytes)("auxRand",r,32),c=lh(o^(0,dr.bytesToNumberBE)(cf("BIP0340/aux",a))),l=cf("BIP0340/nonce",c,i,n),m=Tu((0,dr.bytesToNumberBE)(l));if(m===df)throw new Error("sign failed: k is zero");let{bytes:S,scalar:_}=hh(m),P=zg(S,i,n),x=new Uint8Array(64);if(x.set(S,0),x.set(lh(Tu(_+P*o)),32),!Fg(x,n,i))throw new Error("sign: Invalid signature produced");return x}function Fg(t,e,r){let n=(0,dr.ensureBytes)("signature",t,64),i=(0,dr.ensureBytes)("message",e),o=(0,dr.ensureBytes)("publicKey",r,32);try{let a=Cg((0,dr.bytesToNumberBE)(o)),c=(0,dr.bytesToNumberBE)(n.subarray(0,32));if(!jg(c))return!1;let l=(0,dr.bytesToNumberBE)(n.subarray(32,64));if(!r5(l))return!1;let m=zg(lh(c),bh(a),i),S=n5(a,l,Tu(-m));return!(!S||!S.hasEvenY()||S.toAffine().x!==c)}catch{return!1}}Lt.schnorr={getPublicKey:i5,sign:s5,verify:Fg,utils:{randomPrivateKey:Lt.secp256k1.utils.randomPrivateKey,lift_x:Cg,pointToBytes:bh,numberToBytesBE:dr.numberToBytesBE,bytesToNumberBE:dr.bytesToNumberBE,taggedHash:cf,mod:Zt.mod}};var o5=Dg.isogenyMap(ys,[["0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa8c7","0x7d3d4c80bc321d5b9f315cea7fd44c5d595d2fc0bf63b92dfff1044f17c6581","0x534c328d23f234e6e2a413deca25caece4506144037c40314ecbd0b53d9dd262","0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa88c"],["0xd35771193d94918a9ca34ccbb7b640dd86cd409542f8487d9fe6b745781eb49b","0xedadc6f64383dc1df7c4b2d51b54225406d36b641f5e41bbc52a56612a8c6d14","0x0000000000000000000000000000000000000000000000000000000000000001"],["0x4bda12f684bda12f684bda12f684bda12f684bda12f684bda12f684b8e38e23c","0xc75e0c32d5cb7c0fa9d0a54b12a0a6d5647ab046d686da6fdffc90fc201d71a3","0x29a6194691f91a73715209ef6512e576722830a201be2018a765e85a9ecee931","0x2f684bda12f684bda12f684bda12f684bda12f684bda12f684bda12f38e38d84"],["0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffff93b","0x7a06534bb8bdb49fd5e9e6632722c2989467c1bfc8e8d978dfb425d2685c2573","0x6484aa716545ca2cf3a70c3fa8fe337e0a3d21162f0d6299a7bf8192bfd2a76f","0x0000000000000000000000000000000000000000000000000000000000000001"]].map(t=>t.map(e=>BigInt(e)))),a5=(0,e5.mapToCurveSimpleSWU)(ys,{A:BigInt("0x3f8731abdd661adca08a5558f0f5d272e953d363cb6f0e5d405447c01a444533"),B:BigInt("1771"),Z:ys.create(BigInt("-11"))});fh=Dg.createHasher(Lt.secp256k1.ProjectivePoint,t=>{let{x:e,y:r}=a5(ys.create(t[0]));return o5(e,r)},{DST:"secp256k1_XMD:SHA-256_SSWU_RO_",encodeDST:"secp256k1_XMD:SHA-256_SSWU_NU_",p:ys.ORDER,m:1,k:128,expand:"xmd",hash:of.sha256}),Lt.hashToCurve=fh.hashToCurve,Lt.encodeToCurve=fh.encodeToCurve});var $g=L(ms=>{"use strict";E();I();Object.defineProperty(ms,"__esModule",{value:!0});ms.poseidon=ms.splitConstants=ms.validateOpts=void 0;var Vg=bo();function Wg(t){let{Fp:e}=t;(0,Vg.validateField)(e);for(let l of["t","roundsFull","roundsPartial"])if(typeof t[l]!="number"||!Number.isSafeInteger(t[l]))throw new Error(`Poseidon: invalid param ${l}=${t[l]} (${typeof t[l]})`);if(t.reversePartialPowIdx!==void 0&&typeof t.reversePartialPowIdx!="boolean")throw new Error(`Poseidon: invalid param reversePartialPowIdx=${t.reversePartialPowIdx}`);let r=t.sboxPower;if(r===void 0&&(r=5),typeof r!="number"||!Number.isSafeInteger(r))throw new Error(`Poseidon wrong sboxPower=${r}`);let n=BigInt(r),i=l=>(0,Vg.FpPow)(e,l,n);if(r===3?i=l=>e.mul(e.sqrN(l),l):r===5&&(i=l=>e.mul(e.sqrN(e.sqrN(l)),l)),t.roundsFull%2!==0)throw new Error(`Poseidon roundsFull is not even: ${t.roundsFull}`);let o=t.roundsFull+t.roundsPartial;if(!Array.isArray(t.roundConstants)||t.roundConstants.length!==o)throw new Error("Poseidon: wrong round constants");let a=t.roundConstants.map(l=>{if(!Array.isArray(l)||l.length!==t.t)throw new Error(`Poseidon wrong round constants: ${l}`);return l.map(m=>{if(typeof m!="bigint"||!e.isValid(m))throw new Error(`Poseidon wrong round constant=${m}`);return e.create(m)})});if(!Array.isArray(t.mds)||t.mds.length!==t.t)throw new Error("Poseidon: wrong MDS matrix");let c=t.mds.map(l=>{if(!Array.isArray(l)||l.length!==t.t)throw new Error(`Poseidon MDS matrix row: ${l}`);return l.map(m=>{if(typeof m!="bigint")throw new Error(`Poseidon MDS matrix value=${m}`);return e.create(m)})});return Object.freeze({...t,rounds:o,sboxFn:i,roundConstants:a,mds:c})}ms.validateOpts=Wg;function u5(t,e){if(typeof e!="number")throw new Error("poseidonSplitConstants: wrong t");if(!Array.isArray(t)||t.length%e)throw new Error("poseidonSplitConstants: wrong rc");let r=[],n=[];for(let i=0;i<t.length;i++)n.push(t[i]),n.length===e&&(r.push(n),n=[]);return r}ms.splitConstants=u5;function c5(t){let{t:e,Fp:r,rounds:n,sboxFn:i,reversePartialPowIdx:o}=Wg(t),a=Math.floor(t.roundsFull/2),c=o?e-1:0,l=(S,_,P)=>(S=S.map((x,T)=>r.add(x,t.roundConstants[P][T])),_?S=S.map(x=>i(x)):S[c]=i(S[c]),S=t.mds.map(x=>x.reduce((T,M,k)=>r.add(T,r.mulN(M,S[k])),r.ZERO)),S),m=function(_){if(!Array.isArray(_)||_.length!==e)throw new Error(`Poseidon: wrong values (expected array of bigints with length ${e})`);_=_.map(x=>{if(typeof x!="bigint")throw new Error(`Poseidon: wrong value=${x} (${typeof x})`);return r.create(x)});let P=0;for(let x=0;x<a;x++)_=l(_,!0,P++);for(let x=0;x<t.roundsPartial;x++)_=l(_,!1,P++);for(let x=0;x<a;x++)_=l(_,!0,P++);if(P!==n)throw new Error(`Poseidon: wrong number of rounds: last round=${P}, total=${n}`);return _};return m.roundConstants=t.roundConstants,m}ms.poseidon=c5});var oy=L(Z=>{"use strict";E();I();var f5=Z&&Z.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),d5=Z&&Z.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),l5=Z&&Z.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&f5(e,t,r);return d5(e,t),e};Object.defineProperty(Z,"__esModule",{value:!0});Z.poseidonHashMany=Z.poseidonHashSingle=Z.poseidonHashFunc=Z.poseidonHash=Z.poseidonSmall=Z.poseidonCreate=Z.poseidonBasic=Z._poseidonMDS=Z.Fp251=Z.Fp253=Z.keccak=Z.computeHashOnElements=Z.hashChain=Z.pedersen=Z.getAccountPath=Z.ethSigToPrivate=Z.getStarkKey=Z.grindKey=Z.utils=Z.Signature=Z.ProjectivePoint=Z.CURVE=Z.verify=Z.sign=Z.getSharedSecret=Z.getPublicKey=Z._starkCurve=void 0;var h5=Ic(),mh=No(),b5=er(),go=bo(),p5=$g(),g5=sf(),lr=l5(qi()),y5=ch(),hf=BigInt("3618502788666131213697322783095070105526743751716087489154079457884512865583"),Zg=252;function Gg(t){for(;t[0]===0;)t=t.subarray(1);let e=t.length*8-Zg,r=lr.bytesToNumberBE(t);return e>0?r>>BigInt(e):r}function Xg(t){return typeof t=="string"&&(t=wh(t),t.length&1&&(t="0"+t)),lr.hexToBytes(t)}var yo=(0,g5.weierstrass)({a:BigInt(1),b:BigInt("3141592653589793238462643383279502884197169399375105820974944592307816406665"),Fp:(0,go.Field)(BigInt("0x800000000000011000000000000000000000000000000000000000000000001")),n:hf,nBitLength:Zg,Gx:BigInt("874739451078007766457464989774322083649278607533249481151382481072868806602"),Gy:BigInt("152666792071518830868575557812948353041420400780739481342941381225525861407"),h:BigInt(1),lowS:!1,...(0,y5.getHash)(mh.sha256),bits2int:Gg,bits2int_modN:t=>{let e=lr.bytesToNumberBE(t).toString(16);return e.length===63&&(t=Xg(e+"0")),(0,go.mod)(Gg(t),hf)}});Z._starkCurve=yo;function po(t){return lr.ensureBytes("",typeof t=="string"?Xg(t):t)}function vh(t){return lr.bytesToHex(po(t)).padStart(64,"0")}function Jg(t,e=!1){return yo.getPublicKey(vh(t),e)}Z.getPublicKey=Jg;function m5(t,e){return yo.getSharedSecret(vh(t),e)}Z.getSharedSecret=m5;function v5(t,e,r){return yo.sign(po(t),vh(e),r)}Z.sign=v5;function w5(t,e,r){let n=t instanceof Qg?t:po(t);return yo.verify(n,po(e),po(r))}Z.verify=w5;var{CURVE:_5,ProjectivePoint:aa,Signature:Qg,utils:S5}=yo;Z.CURVE=_5;Z.ProjectivePoint=aa;Z.Signature=Qg;Z.utils=S5;function ey(t){return`0x${lr.bytesToHex(t.subarray(1)).replace(/^0+/gm,"")}`}function wh(t){return t.replace(/^0x/i,"")}function M5(t){return`0x${t.toString(16)}`}function ty(t){let e=po(t),r=2n**256n,n=r-(0,go.mod)(r,hf);for(let i=0;;i++){let o=gh(lr.concatBytes(e,lr.numberToVarBytesBE(BigInt(i))));if(o<n)return(0,go.mod)(o,hf).toString(16);if(i===1e5)throw new Error("grindKey is broken: tried 100k vals")}}Z.grindKey=ty;function E5(t){return ey(Jg(t,!0))}Z.getStarkKey=E5;function I5(t){if(t=wh(t),t.length!==130)throw new Error("Wrong ethereum signature");return ty(t.substring(0,64))}Z.ethSigToPrivate=I5;var x5=2n**31n-1n,lf=t=>Number(t&x5);function A5(t,e,r,n){let i=lf(gh(t)),o=lf(gh(e)),a=lr.hexToNumber(wh(r));return`m/2645'/${i}'/${o}'/${lf(a)}'/${lf(a>>31n)}'/${n}`}Z.getAccountPath=A5;var Ou=[new aa(2089986280348253421170679821480865132823066470938446095505822317253594081284n,1713931329540660377023406109199410414810705867260802078187082345529207694986n,1n),new aa(996781205833008774514500082376783249102396023663454813447423147977397232763n,1668503676786377725805489344771023921079126552019160156920634619255970485781n,1n),new aa(2251563274489750535117886426533222435294046428347329203627021249169616184184n,1798716007562728905295480679789526322175868328062420237419143593021674992973n,1n),new aa(2138414695194151160943305727036575959195309218611738193261179310511854807447n,113410276730064486255102093846540133784865286929052426931474106396135072156n,1n),new aa(2379962749567351885752724891227938183011949129833673362440656643086021394946n,776496453633298175483985398648758586525933812536653089401905292063708816422n,1n)];function ry(t,e){let r=[],n=t;for(let i=0;i<248;i++)r.push(n),n=n.double();n=e;for(let i=0;i<4;i++)r.push(n),n=n.double();return r}var P5=ry(Ou[1],Ou[2]),B5=ry(Ou[3],Ou[4]);function ny(t){let e;if(typeof t=="bigint")e=t;else if(typeof t=="number"){if(!Number.isSafeInteger(t))throw new Error(`Invalid pedersenArg: ${t}`);e=BigInt(t)}else e=lr.bytesToNumberBE(po(t));if(!(0n<=e&&e<yo.CURVE.Fp.ORDER))throw new Error(`PedersenArg should be 0 <= value < CURVE.P: ${e}`);return e}function Yg(t,e,r){let n=ny(e);for(let i=0;i<252;i++){let o=r[i];if(o.equals(t))throw new Error("Same point");(n&1n)!==0n&&(t=t.add(o)),n>>=1n}return t}function _h(t,e){let r=Ou[0];return r=Yg(r,t,P5),r=Yg(r,e,B5),ey(r.toRawBytes(!0))}Z.pedersen=_h;function T5(t,e=_h){if(!Array.isArray(t)||t.length<1)throw new Error("data should be array of at least 1 element");return t.length===1?M5(ny(t[0])):Array.from(t).reverse().reduce((r,n)=>e(n,r))}Z.hashChain=T5;var O5=(t,e=_h)=>[0,...t,t.length].reduce((r,n)=>e(r,n));Z.computeHashOnElements=O5;var k5=lr.bitMask(250),q5=t=>lr.bytesToNumberBE((0,h5.keccak_256)(t))&k5;Z.keccak=q5;var gh=t=>lr.bytesToNumberBE((0,mh.sha256)(t));Z.Fp253=(0,go.Field)(BigInt("14474011154664525231415395255581126252639794253786371766033694892385558855681"));Z.Fp251=(0,go.Field)(BigInt("3618502788666131213697322783095070105623107215331596699973092056135872020481"));function yh(t,e,r){let n=t.fromBytes((0,mh.sha256)((0,b5.utf8ToBytes)(`${e}${r}`)));return t.create(n)}function iy(t,e,r,n=0){let i=[],o=[];for(let a=0;a<r;a++)i.push(yh(t,`${e}x`,n*r+a)),o.push(yh(t,`${e}y`,n*r+a));if(new Set([...i,...o]).size!==2*r)throw new Error("X and Y values are not distinct");return i.map(a=>o.map(c=>t.inv(t.sub(a,c))))}Z._poseidonMDS=iy;var N5=[[3,1,1],[1,-1,1],[1,1,-2]].map(t=>t.map(BigInt));function Sh(t,e){if((0,go.validateField)(t.Fp),!Number.isSafeInteger(t.rate)||!Number.isSafeInteger(t.capacity))throw new Error(`Wrong poseidon opts: ${t}`);let r=t.rate+t.capacity,n=t.roundsFull+t.roundsPartial,i=[];for(let a=0;a<n;a++){let c=[];for(let l=0;l<r;l++)c.push(yh(t.Fp,"Hades",r*a+l));i.push(c)}let o=(0,p5.poseidon)({...t,t:r,sboxPower:3,reversePartialPowIdx:!0,mds:e,roundConstants:i});return o.m=r,o.rate=t.rate,o.capacity=t.capacity,o}Z.poseidonBasic=Sh;function L5(t,e=0){let r=t.rate+t.capacity;if(!Number.isSafeInteger(e))throw new Error(`Wrong mdsAttempt=${e}`);return Sh(t,iy(t.Fp,"HadesMDS",r,e))}Z.poseidonCreate=L5;Z.poseidonSmall=Sh({Fp:Z.Fp251,rate:2,capacity:1,roundsFull:8,roundsPartial:83},N5);function sy(t,e,r=Z.poseidonSmall){return r([t,e,2n])[0]}Z.poseidonHash=sy;function K5(t,e,r=Z.poseidonSmall){return lr.numberToVarBytesBE(sy(lr.bytesToNumberBE(t),lr.bytesToNumberBE(e),r))}Z.poseidonHashFunc=K5;function D5(t,e=Z.poseidonSmall){return e([t,0n,1n])[0]}Z.poseidonHashSingle=D5;function R5(t,e=Z.poseidonSmall){let{m:r,rate:n}=e;if(!Array.isArray(t))throw new Error("bigint array expected in values");let i=Array.from(t);for(i.push(1n);i.length%n!==0;)i.push(0n);let o=new Array(r).fill(0n);for(let a=0;a<i.length;a+=n){for(let c=0;c<n;c++)o[c]+=i[a+c];o=e(o)}return o[0]}Z.poseidonHashMany=R5});var cy=L(hr=>{"use strict";E();I();var U5=hr&&hr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),j5=hr&&hr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ay=hr&&hr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&U5(e,t,r);return j5(e,t),e};Object.defineProperty(hr,"__esModule",{value:!0});hr.bytesToHex=hr.hexToBytes=hr.stark=hr.secp256k1=void 0;hr.secp256k1=ay(Hg());hr.stark=ay(oy());var uy=qi();Object.defineProperty(hr,"hexToBytes",{enumerable:!0,get:function(){return uy.hexToBytes}});Object.defineProperty(hr,"bytesToHex",{enumerable:!0,get:function(){return uy.bytesToHex}})});var fy=L(br=>{"use strict";E();I();var C5=br&&br.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),z5=br&&br.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),bf=br&&br.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&C5(e,t,r);return z5(e,t),e};Object.defineProperty(br,"__esModule",{value:!0});br.schnorr=br.p256=br.ed25519=br.secp256k1=void 0;br.secp256k1=bf(eg());br.ed25519=bf(ug());br.p256=bf(lg());br.schnorr=bf(cy())});var ly=L(ua=>{"use strict";E();I();var F5=ua&&ua.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(ua,"__esModule",{value:!0});ua.Decimal=void 0;var mo=F5(zt()),dy=100,Kt=class{static fromUserInput(e,r){Kt.verifyFractionalDigits(r);let n=e.match(/[^0-9.]/);if(n)throw new Error(`Invalid character at position ${n.index+1}`);let i,o;if(e.search(/\./)===-1)i=e,o="";else{let c=e.split(".");switch(c.length){case 0:case 1:throw new Error("Fewer than two elements in split result. This must not happen here.");case 2:if(!c[1])throw new Error("Fractional part missing");i=c[0],o=c[1].replace(/0+$/,"");break;default:throw new Error("More than one separator found")}}if(o.length>r)throw new Error("Got more fractional digits than supported");let a=`${i}${o.padEnd(r,"0")}`;return new Kt(a,r)}static fromAtomics(e,r){return Kt.verifyFractionalDigits(r),new Kt(e,r)}static zero(e){return Kt.verifyFractionalDigits(e),new Kt("0",e)}static one(e){return Kt.verifyFractionalDigits(e),new Kt("1"+"0".repeat(e),e)}static verifyFractionalDigits(e){if(!Number.isInteger(e))throw new Error("Fractional digits is not an integer");if(e<0)throw new Error("Fractional digits must not be negative");if(e>dy)throw new Error(`Fractional digits must not exceed ${dy}`)}static compare(e,r){if(e.fractionalDigits!==r.fractionalDigits)throw new Error("Fractional digits do not match");return e.data.atomics.cmp(new mo.default(r.atomics))}get atomics(){return this.data.atomics.toString()}get fractionalDigits(){return this.data.fractionalDigits}constructor(e,r){this.data={atomics:new mo.default(e),fractionalDigits:r}}toString(){let e=new mo.default(10).pow(new mo.default(this.data.fractionalDigits)),r=this.data.atomics.div(e),n=this.data.atomics.mod(e);if(n.isZero())return r.toString();{let o=n.toString().padStart(this.data.fractionalDigits,"0").replace(/0+$/,"");return`${r.toString()}.${o}`}}toFloatApproximation(){let e=Number(this.toString());if(Number.isNaN(e))throw new Error("Conversion to number failed");return e}plus(e){if(this.fractionalDigits!==e.fractionalDigits)throw new Error("Fractional digits do not match");let r=this.data.atomics.add(new mo.default(e.atomics));return new Kt(r.toString(),this.fractionalDigits)}minus(e){if(this.fractionalDigits!==e.fractionalDigits)throw new Error("Fractional digits do not match");let r=this.data.atomics.sub(new mo.default(e.atomics));if(r.ltn(0))throw new Error("Difference must not be negative");return new Kt(r.toString(),this.fractionalDigits)}multiply(e){let r=this.data.atomics.mul(new mo.default(e.toString()));return new Kt(r.toString(),this.fractionalDigits)}equals(e){return Kt.compare(this,e)===0}isLessThan(e){return Kt.compare(this,e)<0}isLessThanOrEqual(e){return Kt.compare(this,e)<=0}isGreaterThan(e){return Kt.compare(this,e)>0}isGreaterThanOrEqual(e){return Kt.compare(this,e)>=0}};ua.Decimal=Kt});var hy=L(pn=>{"use strict";E();I();var H5=pn&&pn.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(pn,"__esModule",{value:!0});pn.Uint64=pn.Uint53=pn.Int53=pn.Uint32=void 0;var pf=H5(zt()),V5=new pf.default("18446744073709551615",10,"be"),vo=class{static fromBigEndianBytes(e){return vo.fromBytes(e)}static fromBytes(e,r="be"){if(e.length!==4)throw new Error("Invalid input length. Expected 4 bytes.");for(let i=0;i<e.length;++i)if(!Number.isInteger(e[i])||e[i]>255||e[i]<0)throw new Error("Invalid value in byte. Found: "+e[i]);let n=r==="be"?e:Array.from(e).reverse();return new vo(n[0]*2**24+n[1]*2**16+n[2]*2**8+n[3])}static fromString(e){if(!e.match(/^[0-9]+$/))throw new Error("Invalid string format");return new vo(Number.parseInt(e,10))}constructor(e){if(Number.isNaN(e))throw new Error("Input is not a number");if(!Number.isInteger(e))throw new Error("Input is not an integer");if(e<0||e>4294967295)throw new Error("Input not in uint32 range: "+e.toString());this.data=e}toBytesBigEndian(){return new Uint8Array([Math.floor(this.data/2**24)&255,Math.floor(this.data/2**16)&255,Math.floor(this.data/2**8)&255,Math.floor(this.data/2**0)&255])}toBytesLittleEndian(){return new Uint8Array([Math.floor(this.data/2**0)&255,Math.floor(this.data/2**8)&255,Math.floor(this.data/2**16)&255,Math.floor(this.data/2**24)&255])}toNumber(){return this.data}toString(){return this.data.toString()}};pn.Uint32=vo;var wo=class{static fromString(e){if(!e.match(/^-?[0-9]+$/))throw new Error("Invalid string format");return new wo(Number.parseInt(e,10))}constructor(e){if(Number.isNaN(e))throw new Error("Input is not a number");if(!Number.isInteger(e))throw new Error("Input is not an integer");if(e<Number.MIN_SAFE_INTEGER||e>Number.MAX_SAFE_INTEGER)throw new Error("Input not in int53 range: "+e.toString());this.data=e}toNumber(){return this.data}toString(){return this.data.toString()}};pn.Int53=wo;var ku=class{static fromString(e){let r=wo.fromString(e);return new ku(r.toNumber())}constructor(e){let r=new wo(e);if(r.toNumber()<0)throw new Error("Input is negative");this.data=r}toNumber(){return this.data.toNumber()}toString(){return this.data.toString()}};pn.Uint53=ku;var vs=class{static fromBytesBigEndian(e){return vs.fromBytes(e)}static fromBytes(e,r="be"){if(e.length!==8)throw new Error("Invalid input length. Expected 8 bytes.");for(let i=0;i<e.length;++i)if(!Number.isInteger(e[i])||e[i]>255||e[i]<0)throw new Error("Invalid value in byte. Found: "+e[i]);let n=r==="be"?Array.from(e):Array.from(e).reverse();return new vs(new pf.default(n))}static fromString(e){if(!e.match(/^[0-9]+$/))throw new Error("Invalid string format");return new vs(new pf.default(e,10,"be"))}static fromNumber(e){if(Number.isNaN(e))throw new Error("Input is not a number");if(!Number.isInteger(e))throw new Error("Input is not an integer");let r;try{r=new pf.default(e)}catch{throw new Error("Input is not a safe integer")}return new vs(r)}constructor(e){if(e.isNeg())throw new Error("Input is negative");if(e.gt(V5))throw new Error("Input exceeds uint64 range");this.data=e}toBytesBigEndian(){return Uint8Array.from(this.data.toArray("be",8))}toBytesLittleEndian(){return Uint8Array.from(this.data.toArray("le",8))}toString(){return this.data.toString(10)}toNumber(){return this.data.toNumber()}};pn.Uint64=vs});var by=L(gn=>{"use strict";E();I();Object.defineProperty(gn,"__esModule",{value:!0});gn.Uint64=gn.Uint53=gn.Uint32=gn.Int53=gn.Decimal=void 0;var W5=ly();Object.defineProperty(gn,"Decimal",{enumerable:!0,get:function(){return W5.Decimal}});var gf=hy();Object.defineProperty(gn,"Int53",{enumerable:!0,get:function(){return gf.Int53}});Object.defineProperty(gn,"Uint32",{enumerable:!0,get:function(){return gf.Uint32}});Object.defineProperty(gn,"Uint53",{enumerable:!0,get:function(){return gf.Uint53}});Object.defineProperty(gn,"Uint64",{enumerable:!0,get:function(){return gf.Uint64}})});var yy=L((gy,Mh)=>{E();I();var py=function(t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var e=null;try{e=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch{}function r(h,s,u){this.low=h|0,this.high=s|0,this.unsigned=!!u}r.prototype.__isLong__,Object.defineProperty(r.prototype,"__isLong__",{value:!0});function n(h){return(h&&h.__isLong__)===!0}function i(h){var s=Math.clz32(h&-h);return h?31-s:s}r.isLong=n;var o={},a={};function c(h,s){var u,b,y;return s?(h>>>=0,(y=0<=h&&h<256)&&(b=a[h],b)?b:(u=m(h,0,!0),y&&(a[h]=u),u)):(h|=0,(y=-128<=h&&h<128)&&(b=o[h],b)?b:(u=m(h,h<0?-1:0,!1),y&&(o[h]=u),u))}r.fromInt=c;function l(h,s){if(isNaN(h))return s?z:K;if(s){if(h<0)return z;if(h>=k)return J}else{if(h<=-N)return q;if(h+1>=N)return H}return h<0?l(-h,s).neg():m(h%M|0,h/M|0,s)}r.fromNumber=l;function m(h,s,u){return new r(h,s,u)}r.fromBits=m;var S=Math.pow;function _(h,s,u){if(h.length===0)throw Error("empty string");if(typeof s=="number"?(u=s,s=!1):s=!!s,h==="NaN"||h==="Infinity"||h==="+Infinity"||h==="-Infinity")return s?z:K;if(u=u||10,u<2||36<u)throw RangeError("radix");var b;if((b=h.indexOf("-"))>0)throw Error("interior hyphen");if(b===0)return _(h.substring(1),s,u).neg();for(var y=l(S(u,8)),g=K,d=0;d<h.length;d+=8){var w=Math.min(8,h.length-d),A=parseInt(h.substring(d,d+w),u);if(w<8){var p=l(S(u,w));g=g.mul(p).add(l(A))}else g=g.mul(y),g=g.add(l(A))}return g.unsigned=s,g}r.fromString=_;function P(h,s){return typeof h=="number"?l(h,s):typeof h=="string"?_(h,s):m(h.low,h.high,typeof s=="boolean"?s:h.unsigned)}r.fromValue=P;var x=1<<16,T=1<<24,M=x*x,k=M*M,N=k/2,R=c(T),K=c(0);r.ZERO=K;var z=c(0,!0);r.UZERO=z;var j=c(1);r.ONE=j;var U=c(1,!0);r.UONE=U;var V=c(-1);r.NEG_ONE=V;var H=m(-1,2147483647,!1);r.MAX_VALUE=H;var J=m(-1,-1,!0);r.MAX_UNSIGNED_VALUE=J;var q=m(0,-2147483648,!1);r.MIN_VALUE=q;var f=r.prototype;f.toInt=function(){return this.unsigned?this.low>>>0:this.low},f.toNumber=function(){return this.unsigned?(this.high>>>0)*M+(this.low>>>0):this.high*M+(this.low>>>0)},f.toString=function(s){if(s=s||10,s<2||36<s)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())if(this.eq(q)){var u=l(s),b=this.div(u),y=b.mul(u).sub(this);return b.toString(s)+y.toInt().toString(s)}else return"-"+this.neg().toString(s);for(var g=l(S(s,6),this.unsigned),d=this,w="";;){var A=d.div(g),p=d.sub(A.mul(g)).toInt()>>>0,O=p.toString(s);if(d=A,d.isZero())return O+w;for(;O.length<6;)O="0"+O;w=""+O+w}},f.getHighBits=function(){return this.high},f.getHighBitsUnsigned=function(){return this.high>>>0},f.getLowBits=function(){return this.low},f.getLowBitsUnsigned=function(){return this.low>>>0},f.getNumBitsAbs=function(){if(this.isNegative())return this.eq(q)?64:this.neg().getNumBitsAbs();for(var s=this.high!=0?this.high:this.low,u=31;u>0&&(s&1<<u)==0;u--);return this.high!=0?u+33:u+1},f.isZero=function(){return this.high===0&&this.low===0},f.eqz=f.isZero,f.isNegative=function(){return!this.unsigned&&this.high<0},f.isPositive=function(){return this.unsigned||this.high>=0},f.isOdd=function(){return(this.low&1)===1},f.isEven=function(){return(this.low&1)===0},f.equals=function(s){return n(s)||(s=P(s)),this.unsigned!==s.unsigned&&this.high>>>31===1&&s.high>>>31===1?!1:this.high===s.high&&this.low===s.low},f.eq=f.equals,f.notEquals=function(s){return!this.eq(s)},f.neq=f.notEquals,f.ne=f.notEquals,f.lessThan=function(s){return this.comp(s)<0},f.lt=f.lessThan,f.lessThanOrEqual=function(s){return this.comp(s)<=0},f.lte=f.lessThanOrEqual,f.le=f.lessThanOrEqual,f.greaterThan=function(s){return this.comp(s)>0},f.gt=f.greaterThan,f.greaterThanOrEqual=function(s){return this.comp(s)>=0},f.gte=f.greaterThanOrEqual,f.ge=f.greaterThanOrEqual,f.compare=function(s){if(n(s)||(s=P(s)),this.eq(s))return 0;var u=this.isNegative(),b=s.isNegative();return u&&!b?-1:!u&&b?1:this.unsigned?s.high>>>0>this.high>>>0||s.high===this.high&&s.low>>>0>this.low>>>0?-1:1:this.sub(s).isNegative()?-1:1},f.comp=f.compare,f.negate=function(){return!this.unsigned&&this.eq(q)?q:this.not().add(j)},f.neg=f.negate,f.add=function(s){n(s)||(s=P(s));var u=this.high>>>16,b=this.high&65535,y=this.low>>>16,g=this.low&65535,d=s.high>>>16,w=s.high&65535,A=s.low>>>16,p=s.low&65535,O=0,C=0,F=0,W=0;return W+=g+p,F+=W>>>16,W&=65535,F+=y+A,C+=F>>>16,F&=65535,C+=b+w,O+=C>>>16,C&=65535,O+=u+d,O&=65535,m(F<<16|W,O<<16|C,this.unsigned)},f.subtract=function(s){return n(s)||(s=P(s)),this.add(s.neg())},f.sub=f.subtract,f.multiply=function(s){if(this.isZero())return this;if(n(s)||(s=P(s)),e){var u=e.mul(this.low,this.high,s.low,s.high);return m(u,e.get_high(),this.unsigned)}if(s.isZero())return this.unsigned?z:K;if(this.eq(q))return s.isOdd()?q:K;if(s.eq(q))return this.isOdd()?q:K;if(this.isNegative())return s.isNegative()?this.neg().mul(s.neg()):this.neg().mul(s).neg();if(s.isNegative())return this.mul(s.neg()).neg();if(this.lt(R)&&s.lt(R))return l(this.toNumber()*s.toNumber(),this.unsigned);var b=this.high>>>16,y=this.high&65535,g=this.low>>>16,d=this.low&65535,w=s.high>>>16,A=s.high&65535,p=s.low>>>16,O=s.low&65535,C=0,F=0,W=0,X=0;return X+=d*O,W+=X>>>16,X&=65535,W+=g*O,F+=W>>>16,W&=65535,W+=d*p,F+=W>>>16,W&=65535,F+=y*O,C+=F>>>16,F&=65535,F+=g*p,C+=F>>>16,F&=65535,F+=d*A,C+=F>>>16,F&=65535,C+=b*O+y*p+g*A+d*w,C&=65535,m(W<<16|X,C<<16|F,this.unsigned)},f.mul=f.multiply,f.divide=function(s){if(n(s)||(s=P(s)),s.isZero())throw Error("division by zero");if(e){if(!this.unsigned&&this.high===-2147483648&&s.low===-1&&s.high===-1)return this;var u=(this.unsigned?e.div_u:e.div_s)(this.low,this.high,s.low,s.high);return m(u,e.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?z:K;var b,y,g;if(this.unsigned){if(s.unsigned||(s=s.toUnsigned()),s.gt(this))return z;if(s.gt(this.shru(1)))return U;g=z}else{if(this.eq(q)){if(s.eq(j)||s.eq(V))return q;if(s.eq(q))return j;var d=this.shr(1);return b=d.div(s).shl(1),b.eq(K)?s.isNegative()?j:V:(y=this.sub(s.mul(b)),g=b.add(y.div(s)),g)}else if(s.eq(q))return this.unsigned?z:K;if(this.isNegative())return s.isNegative()?this.neg().div(s.neg()):this.neg().div(s).neg();if(s.isNegative())return this.div(s.neg()).neg();g=K}for(y=this;y.gte(s);){b=Math.max(1,Math.floor(y.toNumber()/s.toNumber()));for(var w=Math.ceil(Math.log(b)/Math.LN2),A=w<=48?1:S(2,w-48),p=l(b),O=p.mul(s);O.isNegative()||O.gt(y);)b-=A,p=l(b,this.unsigned),O=p.mul(s);p.isZero()&&(p=j),g=g.add(p),y=y.sub(O)}return g},f.div=f.divide,f.modulo=function(s){if(n(s)||(s=P(s)),e){var u=(this.unsigned?e.rem_u:e.rem_s)(this.low,this.high,s.low,s.high);return m(u,e.get_high(),this.unsigned)}return this.sub(this.div(s).mul(s))},f.mod=f.modulo,f.rem=f.modulo,f.not=function(){return m(~this.low,~this.high,this.unsigned)},f.countLeadingZeros=function(){return this.high?Math.clz32(this.high):Math.clz32(this.low)+32},f.clz=f.countLeadingZeros,f.countTrailingZeros=function(){return this.low?i(this.low):i(this.high)+32},f.ctz=f.countTrailingZeros,f.and=function(s){return n(s)||(s=P(s)),m(this.low&s.low,this.high&s.high,this.unsigned)},f.or=function(s){return n(s)||(s=P(s)),m(this.low|s.low,this.high|s.high,this.unsigned)},f.xor=function(s){return n(s)||(s=P(s)),m(this.low^s.low,this.high^s.high,this.unsigned)},f.shiftLeft=function(s){return n(s)&&(s=s.toInt()),(s&=63)===0?this:s<32?m(this.low<<s,this.high<<s|this.low>>>32-s,this.unsigned):m(0,this.low<<s-32,this.unsigned)},f.shl=f.shiftLeft,f.shiftRight=function(s){return n(s)&&(s=s.toInt()),(s&=63)===0?this:s<32?m(this.low>>>s|this.high<<32-s,this.high>>s,this.unsigned):m(this.high>>s-32,this.high>=0?0:-1,this.unsigned)},f.shr=f.shiftRight,f.shiftRightUnsigned=function(s){return n(s)&&(s=s.toInt()),(s&=63)===0?this:s<32?m(this.low>>>s|this.high<<32-s,this.high>>>s,this.unsigned):s===32?m(this.high,0,this.unsigned):m(this.high>>>s-32,0,this.unsigned)},f.shru=f.shiftRightUnsigned,f.shr_u=f.shiftRightUnsigned,f.rotateLeft=function(s){var u;return n(s)&&(s=s.toInt()),(s&=63)===0?this:s===32?m(this.high,this.low,this.unsigned):s<32?(u=32-s,m(this.low<<s|this.high>>>u,this.high<<s|this.low>>>u,this.unsigned)):(s-=32,u=32-s,m(this.high<<s|this.low>>>u,this.low<<s|this.high>>>u,this.unsigned))},f.rotl=f.rotateLeft,f.rotateRight=function(s){var u;return n(s)&&(s=s.toInt()),(s&=63)===0?this:s===32?m(this.high,this.low,this.unsigned):s<32?(u=32-s,m(this.high<<u|this.low>>>s,this.low<<u|this.high>>>s,this.unsigned)):(s-=32,u=32-s,m(this.low<<u|this.high>>>s,this.high<<u|this.low>>>s,this.unsigned))},f.rotr=f.rotateRight,f.toSigned=function(){return this.unsigned?m(this.low,this.high,!1):this},f.toUnsigned=function(){return this.unsigned?this:m(this.low,this.high,!0)},f.toBytes=function(s){return s?this.toBytesLE():this.toBytesBE()},f.toBytesLE=function(){var s=this.high,u=this.low;return[u&255,u>>>8&255,u>>>16&255,u>>>24,s&255,s>>>8&255,s>>>16&255,s>>>24]},f.toBytesBE=function(){var s=this.high,u=this.low;return[s>>>24,s>>>16&255,s>>>8&255,s&255,u>>>24,u>>>16&255,u>>>8&255,u&255]},r.fromBytes=function(s,u,b){return b?r.fromBytesLE(s,u):r.fromBytesBE(s,u)},r.fromBytesLE=function(s,u){return new r(s[0]|s[1]<<8|s[2]<<16|s[3]<<24,s[4]|s[5]<<8|s[6]<<16|s[7]<<24,u)},r.fromBytesBE=function(s,u){return new r(s[4]<<24|s[5]<<16|s[6]<<8|s[7],s[0]<<24|s[1]<<16|s[2]<<8|s[3],u)};var v=r;return t.default=v,"default"in t?t.default:t}({});typeof define=="function"&&define.amd?define([],function(){return py}):typeof Mh=="object"&&typeof gy=="object"&&(Mh.exports=py)});var ur=L(ue=>{"use strict";E();I();var my=ue&&ue.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),$5=ue&&ue.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),zn=ue&&ue.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&my(e,t,r);return $5(e,t),e},vy=ue&&ue.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&my(e,t,r)},yf=ue&&ue.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(ue,"__esModule",{value:!0});ue.secp256k1=ue.ed25519=ue.Long=ue._m0=ue.protobuf=ue.typeforce=ue.safeBuffer=ue.BigNumber=ue.BN=ue.math=ue.signUtil=ue.abi=ue.elliptic=ue.bip39=ue.bip32=ue.base=void 0;ue.base=zn(so());ue.bip32=zn(_p());ue.bip39=zn(Vl());ue.elliptic=zn(ta());ue.abi=zn(Gp());ue.signUtil=zn(fy());ue.math=zn(by());var G5=yf(zt());ue.BN=G5.default;var Y5=yf(Bv());ue.BigNumber=Y5.default;var Z5=yf(Sv());ue.safeBuffer=Z5.default;var X5=vb();ue.typeforce=X5;ue.protobuf=zn(Ov());ue._m0=zn(kv());var J5=yf(yy());ue.Long=J5.default;ue.ed25519=zn(qv());ue.secp256k1=zn(Nv());vy((Kv(),yb(Lv)),ue);vy((Rv(),yb(Dv)),ue)});var _y=L(wy=>{"use strict";E();I();Object.defineProperty(wy,"__esModule",{value:!0})});var la=L(D=>{"use strict";E();I();Object.defineProperty(D,"__esModule",{value:!0});D.s16=D.s8=D.nu64be=D.u48be=D.u40be=D.u32be=D.u24be=D.u16be=D.nu64=D.u48=D.u40=D.u32=D.u24=D.u16=D.u8=D.offset=D.greedy=D.Constant=D.UTF8=D.CString=D.Blob=D.Boolean=D.BitField=D.BitStructure=D.VariantLayout=D.Union=D.UnionLayoutDiscriminator=D.UnionDiscriminator=D.Structure=D.Sequence=D.DoubleBE=D.Double=D.FloatBE=D.Float=D.NearInt64BE=D.NearInt64=D.NearUInt64BE=D.NearUInt64=D.IntBE=D.Int=D.UIntBE=D.UInt=D.OffsetLayout=D.GreedyCount=D.ExternalLayout=D.bindConstructorLayout=D.nameWithProperty=D.Layout=D.uint8ArrayToBuffer=D.checkUint8Array=void 0;D.constant=D.utf8=D.cstr=D.blob=D.unionLayoutDiscriminator=D.union=D.seq=D.bits=D.struct=D.f64be=D.f64=D.f32be=D.f32=D.ns64be=D.s48be=D.s40be=D.s32be=D.s24be=D.s16be=D.ns64=D.s48=D.s40=D.s32=D.s24=void 0;var Ih=Pr();function da(t){if(!(t instanceof Uint8Array))throw new TypeError("b must be a Uint8Array")}D.checkUint8Array=da;function tt(t){return da(t),Ih.Buffer.from(t.buffer,t.byteOffset,t.length)}D.uint8ArrayToBuffer=tt;var it=class{constructor(e,r){if(!Number.isInteger(e))throw new TypeError("span must be an integer");this.span=e,this.property=r}makeDestinationObject(){return{}}getSpan(e,r){if(0>this.span)throw new RangeError("indeterminate span");return this.span}replicate(e){let r=Object.create(this.constructor.prototype);return Object.assign(r,this),r.property=e,r}fromArray(e){}};D.Layout=it;function xh(t,e){return e.property?t+"["+e.property+"]":t}D.nameWithProperty=xh;function Q5(t,e){if(typeof t!="function")throw new TypeError("Class must be constructor");if(Object.prototype.hasOwnProperty.call(t,"layout_"))throw new Error("Class is already bound to a layout");if(!(e&&e instanceof it))throw new TypeError("layout must be a Layout");if(Object.prototype.hasOwnProperty.call(e,"boundConstructor_"))throw new Error("layout is already bound to a constructor");t.layout_=e,e.boundConstructor_=t,e.makeDestinationObject=()=>new t,Object.defineProperty(t.prototype,"encode",{value(r,n){return e.encode(this,r,n)},writable:!0}),Object.defineProperty(t,"decode",{value(r,n){return e.decode(r,n)},writable:!0})}D.bindConstructorLayout=Q5;var pr=class extends it{isCount(){throw new Error("ExternalLayout is abstract")}};D.ExternalLayout=pr;var mf=class extends pr{constructor(e=1,r){if(!Number.isInteger(e)||0>=e)throw new TypeError("elementSpan must be a (positive) integer");super(-1,r),this.elementSpan=e}isCount(){return!0}decode(e,r=0){da(e);let n=e.length-r;return Math.floor(n/this.elementSpan)}encode(e,r,n){return 0}};D.GreedyCount=mf;var qu=class extends pr{constructor(e,r=0,n){if(!(e instanceof it))throw new TypeError("layout must be a Layout");if(!Number.isInteger(r))throw new TypeError("offset must be integer or undefined");super(e.span,n||e.property),this.layout=e,this.offset=r}isCount(){return this.layout instanceof kr||this.layout instanceof Yr}decode(e,r=0){return this.layout.decode(e,r+this.offset)}encode(e,r,n=0){return this.layout.encode(e,r,n+this.offset)}};D.OffsetLayout=qu;var kr=class extends it{constructor(e,r){if(super(e,r),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(e,r=0){return tt(e).readUIntLE(r,this.span)}encode(e,r,n=0){return tt(r).writeUIntLE(e,n,this.span),this.span}};D.UInt=kr;var Yr=class extends it{constructor(e,r){if(super(e,r),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(e,r=0){return tt(e).readUIntBE(r,this.span)}encode(e,r,n=0){return tt(r).writeUIntBE(e,n,this.span),this.span}};D.UIntBE=Yr;var Li=class extends it{constructor(e,r){if(super(e,r),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(e,r=0){return tt(e).readIntLE(r,this.span)}encode(e,r,n=0){return tt(r).writeIntLE(e,n,this.span),this.span}};D.Int=Li;var ws=class extends it{constructor(e,r){if(super(e,r),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(e,r=0){return tt(e).readIntBE(r,this.span)}encode(e,r,n=0){return tt(r).writeIntBE(e,n,this.span),this.span}};D.IntBE=ws;var Eh=Math.pow(2,32);function Lf(t){let e=Math.floor(t/Eh),r=t-e*Eh;return{hi32:e,lo32:r}}function Kf(t,e){return t*Eh+e}var vf=class extends it{constructor(e){super(8,e)}decode(e,r=0){let n=tt(e),i=n.readUInt32LE(r),o=n.readUInt32LE(r+4);return Kf(o,i)}encode(e,r,n=0){let i=Lf(e),o=tt(r);return o.writeUInt32LE(i.lo32,n),o.writeUInt32LE(i.hi32,n+4),8}};D.NearUInt64=vf;var wf=class extends it{constructor(e){super(8,e)}decode(e,r=0){let n=tt(e),i=n.readUInt32BE(r),o=n.readUInt32BE(r+4);return Kf(i,o)}encode(e,r,n=0){let i=Lf(e),o=tt(r);return o.writeUInt32BE(i.hi32,n),o.writeUInt32BE(i.lo32,n+4),8}};D.NearUInt64BE=wf;var _f=class extends it{constructor(e){super(8,e)}decode(e,r=0){let n=tt(e),i=n.readUInt32LE(r),o=n.readInt32LE(r+4);return Kf(o,i)}encode(e,r,n=0){let i=Lf(e),o=tt(r);return o.writeUInt32LE(i.lo32,n),o.writeInt32LE(i.hi32,n+4),8}};D.NearInt64=_f;var Sf=class extends it{constructor(e){super(8,e)}decode(e,r=0){let n=tt(e),i=n.readInt32BE(r),o=n.readUInt32BE(r+4);return Kf(i,o)}encode(e,r,n=0){let i=Lf(e),o=tt(r);return o.writeInt32BE(i.hi32,n),o.writeUInt32BE(i.lo32,n+4),8}};D.NearInt64BE=Sf;var Mf=class extends it{constructor(e){super(4,e)}decode(e,r=0){return tt(e).readFloatLE(r)}encode(e,r,n=0){return tt(r).writeFloatLE(e,n),4}};D.Float=Mf;var Ef=class extends it{constructor(e){super(4,e)}decode(e,r=0){return tt(e).readFloatBE(r)}encode(e,r,n=0){return tt(r).writeFloatBE(e,n),4}};D.FloatBE=Ef;var If=class extends it{constructor(e){super(8,e)}decode(e,r=0){return tt(e).readDoubleLE(r)}encode(e,r,n=0){return tt(r).writeDoubleLE(e,n),8}};D.Double=If;var xf=class extends it{constructor(e){super(8,e)}decode(e,r=0){return tt(e).readDoubleBE(r)}encode(e,r,n=0){return tt(r).writeDoubleBE(e,n),8}};D.DoubleBE=xf;var Af=class extends it{constructor(e,r,n){if(!(e instanceof it))throw new TypeError("elementLayout must be a Layout");if(!(r instanceof pr&&r.isCount()||Number.isInteger(r)&&0<=r))throw new TypeError("count must be non-negative integer or an unsigned integer ExternalLayout");let i=-1;!(r instanceof pr)&&0<e.span&&(i=r*e.span),super(i,n),this.elementLayout=e,this.count=r}getSpan(e,r=0){if(0<=this.span)return this.span;let n=0,i=this.count;if(i instanceof pr&&(i=i.decode(e,r)),0<this.elementLayout.span)n=i*this.elementLayout.span;else{let o=0;for(;o<i;)n+=this.elementLayout.getSpan(e,r+n),++o}return n}decode(e,r=0){let n=[],i=0,o=this.count;for(o instanceof pr&&(o=o.decode(e,r));i<o;)n.push(this.elementLayout.decode(e,r)),r+=this.elementLayout.getSpan(e,r),i+=1;return n}encode(e,r,n=0){let i=this.elementLayout,o=e.reduce((a,c)=>a+i.encode(c,r,n+a),0);return this.count instanceof pr&&this.count.encode(e.length,r,n),o}};D.Sequence=Af;var Pf=class extends it{constructor(e,r,n){if(!(Array.isArray(e)&&e.reduce((o,a)=>o&&a instanceof it,!0)))throw new TypeError("fields must be array of Layout instances");typeof r=="boolean"&&n===void 0&&(n=r,r=void 0);for(let o of e)if(0>o.span&&o.property===void 0)throw new Error("fields cannot contain unnamed variable-length layout");let i=-1;try{i=e.reduce((o,a)=>o+a.getSpan(),0)}catch{}super(i,r),this.fields=e,this.decodePrefixes=!!n}getSpan(e,r=0){if(0<=this.span)return this.span;let n=0;try{n=this.fields.reduce((i,o)=>{let a=o.getSpan(e,r);return r+=a,i+a},0)}catch{throw new RangeError("indeterminate span")}return n}decode(e,r=0){da(e);let n=this.makeDestinationObject();for(let i of this.fields)if(i.property!==void 0&&(n[i.property]=i.decode(e,r)),r+=i.getSpan(e,r),this.decodePrefixes&&e.length===r)break;return n}encode(e,r,n=0){let i=n,o=0,a=0;for(let c of this.fields){let l=c.span;if(a=0<l?l:0,c.property!==void 0){let m=e[c.property];m!==void 0&&(a=c.encode(m,r,n),0>l&&(l=c.getSpan(r,n)))}o=n,n+=l}return o+a-i}fromArray(e){let r=this.makeDestinationObject();for(let n of this.fields)n.property!==void 0&&0<e.length&&(r[n.property]=e.shift());return r}offsetOf(e){if(typeof e!="string")throw new TypeError("property must be string");let r=0;for(let n of this.fields){if(n.property===e)return r;0>n.span?r=-1:0<=r&&(r+=n.span)}}};D.Structure=Pf;var Nu=class{constructor(e){this.property=e}decode(e,r){throw new Error("UnionDiscriminator is abstract")}encode(e,r,n){throw new Error("UnionDiscriminator is abstract")}};D.UnionDiscriminator=Nu;var fa=class extends Nu{constructor(e,r){if(!(e instanceof pr&&e.isCount()))throw new TypeError("layout must be an unsigned integer ExternalLayout");super(r||e.property||"variant"),this.layout=e}decode(e,r){return this.layout.decode(e,r)}encode(e,r,n){return this.layout.encode(e,r,n)}};D.UnionLayoutDiscriminator=fa;var Lu=class extends it{constructor(e,r,n){let i;if(e instanceof kr||e instanceof Yr)i=new fa(new qu(e));else if(e instanceof pr&&e.isCount())i=new fa(e);else if(e instanceof Nu)i=e;else throw new TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");if(r===void 0&&(r=null),!(r===null||r instanceof it))throw new TypeError("defaultLayout must be null or a Layout");if(r!==null){if(0>r.span)throw new Error("defaultLayout must have constant span");r.property===void 0&&(r=r.replicate("content"))}let o=-1;r&&(o=r.span,0<=o&&(e instanceof kr||e instanceof Yr)&&(o+=i.layout.span)),super(o,n),this.discriminator=i,this.usesPrefixDiscriminator=e instanceof kr||e instanceof Yr,this.defaultLayout=r,this.registry={};let a=this.defaultGetSourceVariant.bind(this);this.getSourceVariant=function(c){return a(c)},this.configGetSourceVariant=function(c){a=c.bind(this)}}getSpan(e,r=0){if(0<=this.span)return this.span;let n=this.getVariant(e,r);if(!n)throw new Error("unable to determine span for unrecognized variant");return n.getSpan(e,r)}defaultGetSourceVariant(e){if(Object.prototype.hasOwnProperty.call(e,this.discriminator.property)){if(this.defaultLayout&&this.defaultLayout.property&&Object.prototype.hasOwnProperty.call(e,this.defaultLayout.property))return;let r=this.registry[e[this.discriminator.property]];if(r&&(!r.layout||r.property&&Object.prototype.hasOwnProperty.call(e,r.property)))return r}else for(let r in this.registry){let n=this.registry[r];if(n.property&&Object.prototype.hasOwnProperty.call(e,n.property))return n}throw new Error("unable to infer src variant")}decode(e,r=0){let n,i=this.discriminator,o=i.decode(e,r),a=this.registry[o];if(a===void 0){let c=this.defaultLayout,l=0;this.usesPrefixDiscriminator&&(l=i.layout.span),n=this.makeDestinationObject(),n[i.property]=o,n[c.property]=c.decode(e,r+l)}else n=a.decode(e,r);return n}encode(e,r,n=0){let i=this.getSourceVariant(e);if(i===void 0){let o=this.discriminator,a=this.defaultLayout,c=0;return this.usesPrefixDiscriminator&&(c=o.layout.span),o.encode(e[o.property],r,n),c+a.encode(e[a.property],r,n+c)}return i.encode(e,r,n)}addVariant(e,r,n){let i=new Bf(this,e,r,n);return this.registry[e]=i,i}getVariant(e,r=0){let n;return e instanceof Uint8Array?n=this.discriminator.decode(e,r):n=e,this.registry[n]}};D.Union=Lu;var Bf=class extends it{constructor(e,r,n,i){if(!(e instanceof Lu))throw new TypeError("union must be a Union");if(!Number.isInteger(r)||0>r)throw new TypeError("variant must be a (non-negative) integer");if(typeof n=="string"&&i===void 0&&(i=n,n=null),n){if(!(n instanceof it))throw new TypeError("layout must be a Layout");if(e.defaultLayout!==null&&0<=n.span&&n.span>e.defaultLayout.span)throw new Error("variant span exceeds span of containing union");if(typeof i!="string")throw new TypeError("variant must have a String property")}let o=e.span;0>e.span&&(o=n?n.span:0,0<=o&&e.usesPrefixDiscriminator&&(o+=e.discriminator.layout.span)),super(o,i),this.union=e,this.variant=r,this.layout=n||null}getSpan(e,r=0){if(0<=this.span)return this.span;let n=0;this.union.usesPrefixDiscriminator&&(n=this.union.discriminator.layout.span);let i=0;return this.layout&&(i=this.layout.getSpan(e,r+n)),n+i}decode(e,r=0){let n=this.makeDestinationObject();if(this!==this.union.getVariant(e,r))throw new Error("variant mismatch");let i=0;return this.union.usesPrefixDiscriminator&&(i=this.union.discriminator.layout.span),this.layout?n[this.property]=this.layout.decode(e,r+i):this.property?n[this.property]=!0:this.union.usesPrefixDiscriminator&&(n[this.union.discriminator.property]=this.variant),n}encode(e,r,n=0){let i=0;if(this.union.usesPrefixDiscriminator&&(i=this.union.discriminator.layout.span),this.layout&&!Object.prototype.hasOwnProperty.call(e,this.property))throw new TypeError("variant lacks property "+this.property);this.union.discriminator.encode(this.variant,r,n);let o=i;if(this.layout&&(this.layout.encode(e[this.property],r,n+i),o+=this.layout.getSpan(r,n+i),0<=this.union.span&&o>this.union.span))throw new Error("encoded variant overruns containing union");return o}fromArray(e){if(this.layout)return this.layout.fromArray(e)}};D.VariantLayout=Bf;function ca(t){return 0>t&&(t+=4294967296),t}var Ku=class extends it{constructor(e,r,n){if(!(e instanceof kr||e instanceof Yr))throw new TypeError("word must be a UInt or UIntBE layout");if(typeof r=="string"&&n===void 0&&(n=r,r=!1),4<e.span)throw new RangeError("word cannot exceed 32 bits");super(e.span,n),this.word=e,this.msb=!!r,this.fields=[];let i=0;this._packedSetValue=function(o){return i=ca(o),this},this._packedGetValue=function(){return i}}decode(e,r=0){let n=this.makeDestinationObject(),i=this.word.decode(e,r);this._packedSetValue(i);for(let o of this.fields)o.property!==void 0&&(n[o.property]=o.decode(e));return n}encode(e,r,n=0){let i=this.word.decode(r,n);this._packedSetValue(i);for(let o of this.fields)if(o.property!==void 0){let a=e[o.property];a!==void 0&&o.encode(a)}return this.word.encode(this._packedGetValue(),r,n)}addField(e,r){let n=new Du(this,e,r);return this.fields.push(n),n}addBoolean(e){let r=new Tf(this,e);return this.fields.push(r),r}fieldFor(e){if(typeof e!="string")throw new TypeError("property must be string");for(let r of this.fields)if(r.property===e)return r}};D.BitStructure=Ku;var Du=class{constructor(e,r,n){if(!(e instanceof Ku))throw new TypeError("container must be a BitStructure");if(!Number.isInteger(r)||0>=r)throw new TypeError("bits must be positive integer");let i=8*e.span,o=e.fields.reduce((a,c)=>a+c.bits,0);if(r+o>i)throw new Error("bits too long for span remainder ("+(i-o)+" of "+i+" remain)");this.container=e,this.bits=r,this.valueMask=(1<<r)-1,r===32&&(this.valueMask=4294967295),this.start=o,this.container.msb&&(this.start=i-o-r),this.wordMask=ca(this.valueMask<<this.start),this.property=n}decode(e,r){let n=this.container._packedGetValue();return ca(n&this.wordMask)>>>this.start}encode(e){if(typeof e!="number"||!Number.isInteger(e)||e!==ca(e&this.valueMask))throw new TypeError(xh("BitField.encode",this)+" value must be integer not exceeding "+this.valueMask);let r=this.container._packedGetValue(),n=ca(e<<this.start);this.container._packedSetValue(ca(r&~this.wordMask)|n)}};D.BitField=Du;var Tf=class extends Du{constructor(e,r){super(e,1,r)}decode(e,r){return!!super.decode(e,r)}encode(e){typeof e=="boolean"&&(e=+e),super.encode(e)}};D.Boolean=Tf;var Of=class extends it{constructor(e,r){if(!(e instanceof pr&&e.isCount()||Number.isInteger(e)&&0<=e))throw new TypeError("length must be positive integer or an unsigned integer ExternalLayout");let n=-1;e instanceof pr||(n=e),super(n,r),this.length=e}getSpan(e,r){let n=this.span;return 0>n&&(n=this.length.decode(e,r)),n}decode(e,r=0){let n=this.span;return 0>n&&(n=this.length.decode(e,r)),tt(e).slice(r,r+n)}encode(e,r,n){let i=this.length;if(this.length instanceof pr&&(i=e.length),!(e instanceof Uint8Array&&i===e.length))throw new TypeError(xh("Blob.encode",this)+" requires (length "+i+") Uint8Array as src");if(n+i>r.length)throw new RangeError("encoding overruns Uint8Array");let o=tt(e);return tt(r).write(o.toString("hex"),n,i,"hex"),this.length instanceof pr&&this.length.encode(i,r,n),i}};D.Blob=Of;var kf=class extends it{constructor(e){super(-1,e)}getSpan(e,r=0){da(e);let n=r;for(;n<e.length&&e[n]!==0;)n+=1;return 1+n-r}decode(e,r=0){let n=this.getSpan(e,r);return tt(e).slice(r,r+n-1).toString("utf-8")}encode(e,r,n=0){typeof e!="string"&&(e=String(e));let i=Ih.Buffer.from(e,"utf8"),o=i.length;if(n+o>r.length)throw new RangeError("encoding overruns Buffer");let a=tt(r);return i.copy(a,n),a[n+o]=0,o+1}};D.CString=kf;var qf=class extends it{constructor(e,r){if(typeof e=="string"&&r===void 0&&(r=e,e=void 0),e===void 0)e=-1;else if(!Number.isInteger(e))throw new TypeError("maxSpan must be an integer");super(-1,r),this.maxSpan=e}getSpan(e,r=0){return da(e),e.length-r}decode(e,r=0){let n=this.getSpan(e,r);if(0<=this.maxSpan&&this.maxSpan<n)throw new RangeError("text length exceeds maxSpan");return tt(e).slice(r,r+n).toString("utf-8")}encode(e,r,n=0){typeof e!="string"&&(e=String(e));let i=Ih.Buffer.from(e,"utf8"),o=i.length;if(0<=this.maxSpan&&this.maxSpan<o)throw new RangeError("text length exceeds maxSpan");if(n+o>r.length)throw new RangeError("encoding overruns Buffer");return i.copy(tt(r),n),o}};D.UTF8=qf;var Nf=class extends it{constructor(e,r){super(0,r),this.value=e}decode(e,r){return this.value}encode(e,r,n){return 0}};D.Constant=Nf;D.greedy=(t,e)=>new mf(t,e);D.offset=(t,e,r)=>new qu(t,e,r);D.u8=t=>new kr(1,t);D.u16=t=>new kr(2,t);D.u24=t=>new kr(3,t);D.u32=t=>new kr(4,t);D.u40=t=>new kr(5,t);D.u48=t=>new kr(6,t);D.nu64=t=>new vf(t);D.u16be=t=>new Yr(2,t);D.u24be=t=>new Yr(3,t);D.u32be=t=>new Yr(4,t);D.u40be=t=>new Yr(5,t);D.u48be=t=>new Yr(6,t);D.nu64be=t=>new wf(t);D.s8=t=>new Li(1,t);D.s16=t=>new Li(2,t);D.s24=t=>new Li(3,t);D.s32=t=>new Li(4,t);D.s40=t=>new Li(5,t);D.s48=t=>new Li(6,t);D.ns64=t=>new _f(t);D.s16be=t=>new ws(2,t);D.s24be=t=>new ws(3,t);D.s32be=t=>new ws(4,t);D.s40be=t=>new ws(5,t);D.s48be=t=>new ws(6,t);D.ns64be=t=>new Sf(t);D.f32=t=>new Mf(t);D.f32be=t=>new Ef(t);D.f64=t=>new If(t);D.f64be=t=>new xf(t);D.struct=(t,e,r)=>new Pf(t,e,r);D.bits=(t,e,r)=>new Ku(t,e,r);D.seq=(t,e,r)=>new Af(t,e,r);D.union=(t,e,r)=>new Lu(t,e,r);D.unionLayoutDiscriminator=(t,e)=>new fa(t,e);D.blob=(t,e)=>new Of(t,e);D.cstr=t=>new kf(t);D.utf8=(t,e)=>new qf(t,e);D.constant=(t,e)=>new Nf(t,e)});var ha=L(Df=>{"use strict";E();I();Object.defineProperty(Df,"__esModule",{value:!0});Df.encodeDecode=void 0;var e7=t=>{let e=t.decode.bind(t),r=t.encode.bind(t);return{decode:e,encode:r}};Df.encodeDecode=e7});var Uf=L(ba=>{"use strict";E();I();Object.defineProperty(ba,"__esModule",{value:!0});var Rf;function t7(t){{let e=B.Buffer.from(t);e.reverse();let r=e.toString("hex");return r.length===0?BigInt(0):BigInt(`0x${r}`)}return Rf.toBigInt(t,!1)}ba.toBigIntLE=t7;function r7(t){{let e=t.toString("hex");return e.length===0?BigInt(0):BigInt(`0x${e}`)}return Rf.toBigInt(t,!0)}ba.toBigIntBE=r7;function n7(t,e){{let r=t.toString(16),n=B.Buffer.from(r.padStart(e*2,"0").slice(0,e*2),"hex");return n.reverse(),n}return Rf.fromBigInt(t,B.Buffer.allocUnsafe(e),!1)}ba.toBufferLE=n7;function i7(t,e){{let r=t.toString(16);return B.Buffer.from(r.padStart(e*2,"0").slice(0,e*2),"hex")}return Rf.fromBigInt(t,B.Buffer.allocUnsafe(e),!0)}ba.toBufferBE=i7});var Ah=L(ot=>{"use strict";E();I();Object.defineProperty(ot,"__esModule",{value:!0});ot.u256be=ot.u256=ot.u192be=ot.u192=ot.u128be=ot.u128=ot.u64be=ot.u64=ot.bigIntBE=ot.bigInt=void 0;var Sy=Pr(),My=la(),jf=Uf(),Ey=ha(),s7=t=>e=>{let r=(0,My.blob)(t,e),{encode:n,decode:i}=(0,Ey.encodeDecode)(r),o=r;return o.decode=(a,c)=>{let l=i(a,c);return(0,jf.toBigIntLE)(Sy.Buffer.from(l))},o.encode=(a,c,l)=>{let m=(0,jf.toBufferLE)(a,t);return n(m,c,l)},o};ot.bigInt=s7;var o7=t=>e=>{let r=(0,My.blob)(t,e),{encode:n,decode:i}=(0,Ey.encodeDecode)(r),o=r;return o.decode=(a,c)=>{let l=i(a,c);return(0,jf.toBigIntBE)(Sy.Buffer.from(l))},o.encode=(a,c,l)=>{let m=(0,jf.toBufferBE)(a,t);return n(m,c,l)},o};ot.bigIntBE=o7;ot.u64=(0,ot.bigInt)(8);ot.u64be=(0,ot.bigIntBE)(8);ot.u128=(0,ot.bigInt)(16);ot.u128be=(0,ot.bigIntBE)(16);ot.u192=(0,ot.bigInt)(24);ot.u192be=(0,ot.bigIntBE)(24);ot.u256=(0,ot.bigInt)(32);ot.u256be=(0,ot.bigIntBE)(32)});var xy=L(_s=>{"use strict";E();I();Object.defineProperty(_s,"__esModule",{value:!0});_s.decimal=_s.WAD=void 0;var Iy=ur(),a7=ha(),u7=Ah();_s.WAD=new Iy.BigNumber("1e+18");var c7=t=>{let e=(0,u7.u128)(t),{encode:r,decode:n}=(0,a7.encodeDecode)(e),i=e;return i.decode=(o,a)=>{let c=n(o,a).toString();return new Iy.BigNumber(c).div(_s.WAD)},i.encode=(o,a,c)=>{let l=BigInt(o.times(_s.WAD).integerValue().toString());return r(l,a,c)},i};_s.decimal=c7});var Ay=L(Cf=>{"use strict";E();I();Object.defineProperty(Cf,"__esModule",{value:!0});Cf.bool=void 0;var f7=la(),d7=ha(),l7=t=>{let e=(0,f7.u8)(t),{encode:r,decode:n}=(0,d7.encodeDecode)(e),i=e;return i.decode=(o,a)=>!!n(o,a),i.encode=(o,a,c)=>{let l=Number(o);return r(l,a,c)},i};Cf.bool=l7});var Py=L(zf=>{"use strict";E();I();Object.defineProperty(zf,"__esModule",{value:!0});zf.publicKey=void 0;var h7=la(),b7=St(),p7=ha(),g7=t=>{let e=(0,h7.blob)(32,t),{encode:r,decode:n}=(0,p7.encodeDecode)(e),i=e;return i.decode=(o,a)=>{let c=n(o,a);return new b7.PublicKey(c)},i.encode=(o,a,c)=>{let l=o.toBuffer();return r(l,a,c)},i};zf.publicKey=g7});var By=L(yn=>{"use strict";E();I();var y7=yn&&yn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),pa=yn&&yn.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&y7(e,t,r)};Object.defineProperty(yn,"__esModule",{value:!0});pa(ha(),yn);pa(Ah(),yn);pa(xy(),yn);pa(Ay(),yn);pa(Py(),yn);pa(la(),yn)});var Xt=L(Ss=>{"use strict";E();I();var m7=Ss&&Ss.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Ty=Ss&&Ss.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&m7(e,t,r)};Object.defineProperty(Ss,"__esModule",{value:!0});Ty(la(),Ss);Ty(By(),Ss)});var Ph=L(li=>{"use strict";E();I();var v7=li&&li.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),w7=li&&li.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_7=li&&li.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&v7(e,t,r);return w7(e,t),e};Object.defineProperty(li,"__esModule",{value:!0});li.FeeCalculatorLayout=void 0;var S7=_7(Xt());li.FeeCalculatorLayout=S7.nu64("lamportsPerSignature")});var Oy=L(Fn=>{"use strict";E();I();Object.defineProperty(Fn,"__esModule",{value:!0});Fn.SOLANA_SCHEMA=Fn.Enum=Fn.Struct=void 0;var M7=Pr(),Bh=jv(),Ff=class{constructor(e){Object.assign(this,e)}encode(){return M7.Buffer.from((0,Bh.serialize)(Fn.SOLANA_SCHEMA,this))}static decode(e){return(0,Bh.deserialize)(Fn.SOLANA_SCHEMA,this,e)}static decodeUnchecked(e){return(0,Bh.deserializeUnchecked)(Fn.SOLANA_SCHEMA,this,e)}};Fn.Struct=Ff;var Th=class extends Ff{constructor(e){if(super(e),this.enum="",Object.keys(e).length!==1)throw new Error("Enum can only take single value");Object.keys(e).map(r=>{this.enum=r})}};Fn.Enum=Th;Fn.SOLANA_SCHEMA=new Map});var _o=L(Hf=>{"use strict";E();I();Object.defineProperty(Hf,"__esModule",{value:!0});Hf.toBuffer=void 0;var Oh=Pr(),E7=t=>Oh.Buffer.isBuffer(t)?t:t instanceof Uint8Array?Oh.Buffer.from(t.buffer,t.byteOffset,t.byteLength):Oh.Buffer.from(t);Hf.toBuffer=E7});var Zr=L(vn=>{"use strict";E();I();Object.defineProperty(vn,"__esModule",{value:!0});vn.PublicKey=vn.PUBLIC_KEY_LENGTH=vn.MAX_SEED_LENGTH=void 0;var ky=ur(),Ki=Pr(),Ly=Oy(),I7=_o(),Ru=ur();vn.MAX_SEED_LENGTH=32;vn.PUBLIC_KEY_LENGTH=32;function x7(t){return t._bn!==void 0}var qy=1,mn=class extends Ly.Struct{constructor(e){if(super({}),x7(e))this._bn=e._bn;else{if(typeof e=="string"){let r=Ru.base.fromBase58(e);if(r.length!=vn.PUBLIC_KEY_LENGTH)throw new Error("Invalid public key input");this._bn=new ky.BN(r)}else this._bn=new ky.BN(e);if(this._bn.byteLength()>vn.PUBLIC_KEY_LENGTH)throw new Error("Invalid public key input")}}static unique(){let e=new mn(qy);return qy+=1,new mn(e.toBuffer())}equals(e){return this._bn.eq(e._bn)}toBase58(){return Ru.base.toBase58(this.toBytes())}toJSON(){return this.toBase58()}toBytes(){let e=this.toBuffer();return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}toBuffer(){let e=this._bn.toArrayLike(Ki.Buffer);if(e.length===vn.PUBLIC_KEY_LENGTH)return e;let r=Ki.Buffer.alloc(32);return e.copy(r,32-e.length),r}get[Symbol.toStringTag](){return`PublicKey(${this.toString()})`}toString(){return this.toBase58()}static async createWithSeed(e,r,n){let i=Ki.Buffer.concat([e.toBuffer(),Ki.Buffer.from(r),n.toBuffer()]),o=Ru.base.sha256(i);return new mn(o)}static createProgramAddressSync(e,r){let n=Ki.Buffer.alloc(0);e.forEach(function(o){if(o.length>vn.MAX_SEED_LENGTH)throw new TypeError("Max seed length exceeded");n=Ki.Buffer.concat([n,(0,I7.toBuffer)(o)])}),n=Ki.Buffer.concat([n,r.toBuffer(),Ki.Buffer.from("ProgramDerivedAddress")]);let i=Ru.base.sha256(n);if(Ny(i))throw new Error("Invalid seeds, address must fall off the curve");return new mn(i)}static async createProgramAddress(e,r){return this.createProgramAddressSync(e,r)}static findProgramAddressSync(e,r){let n=255,i;for(;n!=0;){try{let o=e.concat(Ki.Buffer.from([n]));i=this.createProgramAddressSync(o,r)}catch(o){if(o instanceof TypeError)throw o;n--;continue}return[i,n]}throw new Error("Unable to find a viable program address nonce")}static async findProgramAddress(e,r){return this.findProgramAddressSync(e,r)}static isOnCurve(e){let r=new mn(e);return Ny(r.toBytes())==1}};vn.PublicKey=mn;mn.default=new mn("11111111111111111111111111111111");Ly.SOLANA_SCHEMA.set(mn,{kind:"struct",fields:[["_bn","u256"]]});function Ny(t){try{return Ru.signUtil.ed25519.publicKeyVerify(t)?1:0}catch{return 0}}});var Ky=L(Wf=>{"use strict";E();I();Object.defineProperty(Wf,"__esModule",{value:!0});Wf.Keypair=void 0;var A7=Zr(),Vf=ur(),Uu=class{constructor(e){this._keypair=e}static fromSecretKey(e,r){if(!r||!r.skipValidation){let o=new TextEncoder().encode("@solana/web3.js-validation-v1"),a=Vf.signUtil.ed25519.sign(o,e),c=Vf.signUtil.ed25519.publicKeyCreate(e);if(!Vf.signUtil.ed25519.verify(o,a,c))throw new Error("provided secretKey is invalid")}let n=Vf.signUtil.ed25519.publicKeyCreate(e);return new Uu({publicKey:n,secretKey:e})}get publicKey(){return new A7.PublicKey(this._keypair.publicKey)}get secretKey(){return this._keypair.secretKey}};Wf.Keypair=Uu});var Gf=L($f=>{"use strict";E();I();Object.defineProperty($f,"__esModule",{value:!0});$f.MessageAccountKeys=void 0;var kh=class{constructor(e,r){this.staticAccountKeys=e,this.accountKeysFromLookups=r}keySegments(){let e=[this.staticAccountKeys];return this.accountKeysFromLookups&&(e.push(this.accountKeysFromLookups.writable),e.push(this.accountKeysFromLookups.readonly)),e}get(e){for(let r of this.keySegments()){if(e<r.length)return r[e];e-=r.length}}get length(){return this.keySegments().flat().length}compileInstructions(e){if(this.length>255+1)throw new Error("Account index overflow encountered during compilation");let n=new Map;this.keySegments().flat().forEach((o,a)=>{n.set(o.toBase58(),a)});let i=o=>{let a=n.get(o.toBase58());if(a===void 0)throw new Error("Encountered an unknown instruction account key during compilation");return a};return e.map(o=>({programIdIndex:i(o.programId),accountKeyIndexes:o.keys.map(a=>i(a.pubkey)),data:o.data}))}};$f.MessageAccountKeys=kh});var Di=L(at=>{"use strict";E();I();var P7=at&&at.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),B7=at&&at.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),T7=at&&at.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&P7(e,t,r);return B7(e,t),e};Object.defineProperty(at,"__esModule",{value:!0});at.getAlloc=at.voteInit=at.lockup=at.authorized=at.rustString=at.uint64=at.signature=at.publicKey=void 0;var Dy=Pr(),nr=T7(Xt()),O7=(t="publicKey")=>nr.blob(32,t);at.publicKey=O7;var k7=(t="signature")=>nr.blob(64,t);at.signature=k7;var q7=(t="uint64")=>nr.blob(8,t);at.uint64=q7;var N7=(t="string")=>{let e=nr.struct([nr.u32("length"),nr.u32("lengthPadding"),nr.blob(nr.offset(nr.u32(),-8),"chars")],t),r=e.decode.bind(e),n=e.encode.bind(e),i=e;return i.decode=(o,a)=>r(o,a).chars.toString(),i.encode=(o,a,c)=>{let l={chars:Dy.Buffer.from(o,"utf8")};return n(l,a,c)},i.alloc=o=>nr.u32().span+nr.u32().span+Dy.Buffer.from(o,"utf8").length,i};at.rustString=N7;var L7=(t="authorized")=>nr.struct([(0,at.publicKey)("staker"),(0,at.publicKey)("withdrawer")],t);at.authorized=L7;var K7=(t="lockup")=>nr.struct([nr.ns64("unixTimestamp"),nr.ns64("epoch"),(0,at.publicKey)("custodian")],t);at.lockup=K7;var D7=(t="voteInit")=>nr.struct([(0,at.publicKey)("nodePubkey"),(0,at.publicKey)("authorizedVoter"),(0,at.publicKey)("authorizedWithdrawer"),nr.u8("commission")],t);at.voteInit=D7;function Ry(t,e){let r=i=>{if(i.span>=0)return i.span;if(typeof i.alloc=="function")return i.alloc(e[i.property]);if("count"in i&&"elementLayout"in i){let o=e[i.property];if(Array.isArray(o))return o.length*r(i.elementLayout)}else if("fields"in i)return Ry({layout:i},e[i.property]);return 0},n=0;return t.layout.fields.forEach(i=>{n+=r(i)}),n}at.getAlloc=Ry});var So=L(Ms=>{"use strict";E();I();Object.defineProperty(Ms,"__esModule",{value:!0});Ms.SIGNATURE_LENGTH_IN_BYTES=Ms.VERSION_PREFIX_MASK=Ms.PACKET_DATA_SIZE=void 0;Ms.PACKET_DATA_SIZE=1280-40-8;Ms.VERSION_PREFIX_MASK=127;Ms.SIGNATURE_LENGTH_IN_BYTES=64});var ju=L(ga=>{"use strict";E();I();Object.defineProperty(ga,"__esModule",{value:!0});ga.encodeLength=ga.decodeLength=void 0;function R7(t){let e=0,r=0;for(;;){let n=t.shift();if(e|=(n&127)<<r*7,r+=1,(n&128)===0)break}return e}ga.decodeLength=R7;function U7(t,e){let r=e;for(;;){let n=r&127;if(r>>=7,r==0){t.push(n);break}else n|=128,t.push(n)}}ga.encodeLength=U7});var Mo=L(qh=>{"use strict";E();I();Object.defineProperty(qh,"__esModule",{value:!0});function j7(t,e){if(!t)throw new Error(e||"Assertion failed")}qh.default=j7});var Nh=L(ya=>{"use strict";E();I();var C7=ya&&ya.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(ya,"__esModule",{value:!0});ya.CompiledKeys=void 0;var Yf=C7(Mo()),Cu=Zr(),zu=class{constructor(e,r){this.payer=e,this.keyMetaMap=r}static compile(e,r){let n=new Map,i=a=>{let c=a.toBase58(),l=n.get(c);return l===void 0&&(l={isSigner:!1,isWritable:!1,isInvoked:!1},n.set(c,l)),l},o=i(r);o.isSigner=!0,o.isWritable=!0;for(let a of e){i(a.programId).isInvoked=!0;for(let c of a.keys){let l=i(c.pubkey);l.isSigner||(l.isSigner=c.isSigner),l.isWritable||(l.isWritable=c.isWritable)}}return new zu(r,n)}getMessageComponents(){let e=[...this.keyMetaMap.entries()];(0,Yf.default)(e.length<=256,"Max static account keys length exceeded");let r=e.filter(([,l])=>l.isSigner&&l.isWritable),n=e.filter(([,l])=>l.isSigner&&!l.isWritable),i=e.filter(([,l])=>!l.isSigner&&l.isWritable),o=e.filter(([,l])=>!l.isSigner&&!l.isWritable),a={numRequiredSignatures:r.length+n.length,numReadonlySignedAccounts:n.length,numReadonlyUnsignedAccounts:o.length};{(0,Yf.default)(r.length>0,"Expected at least one writable signer key");let[l]=r[0];(0,Yf.default)(l===this.payer.toBase58(),"Expected first writable signer key to be the fee payer")}let c=[...r.map(([l])=>new Cu.PublicKey(l)),...n.map(([l])=>new Cu.PublicKey(l)),...i.map(([l])=>new Cu.PublicKey(l)),...o.map(([l])=>new Cu.PublicKey(l))];return[a,c]}extractTableLookup(e){let[r,n]=this.drainKeysFoundInLookupTable(e.state.addresses,a=>!a.isSigner&&!a.isInvoked&&a.isWritable),[i,o]=this.drainKeysFoundInLookupTable(e.state.addresses,a=>!a.isSigner&&!a.isInvoked&&!a.isWritable);if(!(r.length===0&&i.length===0))return[{accountKey:e.key,writableIndexes:r,readonlyIndexes:i},{writable:n,readonly:o}]}drainKeysFoundInLookupTable(e,r){let n=new Array,i=new Array;for(let[o,a]of this.keyMetaMap.entries())if(r(a)){let c=new Cu.PublicKey(o),l=e.findIndex(m=>m.equals(c));l>=0&&((0,Yf.default)(l<256,"Max lookup table index exceeded"),n.push(l),i.push(c),this.keyMetaMap.delete(o))}return[n,i]}};ya.CompiledKeys=zu});var Kh=L(hi=>{"use strict";E();I();var z7=hi&&hi.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),F7=hi&&hi.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Lh=hi&&hi.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&z7(e,t,r);return F7(e,t),e};Object.defineProperty(hi,"__esModule",{value:!0});hi.Message=void 0;var ma=ur(),wn=Pr(),qr=Lh(Xt()),va=Zr(),Uy=Lh(Di()),jy=So(),Es=Lh(ju()),H7=_o(),V7=Nh(),Cy=Gf(),wa=class{constructor(e){this.indexToProgramIds=new Map,this.header=e.header,this.accountKeys=e.accountKeys.map(r=>new va.PublicKey(r)),this.recentBlockhash=e.recentBlockhash,this.instructions=e.instructions,this.instructions.forEach(r=>this.indexToProgramIds.set(r.programIdIndex,this.accountKeys[r.programIdIndex]))}get version(){return"legacy"}get staticAccountKeys(){return this.accountKeys}get compiledInstructions(){return this.instructions.map(e=>({programIdIndex:e.programIdIndex,accountKeyIndexes:e.accounts,data:ma.base.fromBase58(e.data)}))}get addressTableLookups(){return[]}getAccountKeys(){return new Cy.MessageAccountKeys(this.staticAccountKeys)}static compile(e){let r=V7.CompiledKeys.compile(e.instructions,e.payerKey),[n,i]=r.getMessageComponents(),a=new Cy.MessageAccountKeys(i).compileInstructions(e.instructions).map(c=>({programIdIndex:c.programIdIndex,accounts:c.accountKeyIndexes,data:ma.base.toBase58(c.data)}));return new wa({header:n,accountKeys:i,recentBlockhash:e.recentBlockhash,instructions:a})}isAccountSigner(e){return e<this.header.numRequiredSignatures}isAccountWritable(e){let r=this.header.numRequiredSignatures;if(e>=this.header.numRequiredSignatures){let n=e-r,o=this.accountKeys.length-r-this.header.numReadonlyUnsignedAccounts;return n<o}else{let n=r-this.header.numReadonlySignedAccounts;return e<n}}isProgramId(e){return this.indexToProgramIds.has(e)}programIds(){return[...this.indexToProgramIds.values()]}nonProgramIds(){return this.accountKeys.filter((e,r)=>!this.isProgramId(r))}serialize(){let e=this.accountKeys.length,r=[];Es.encodeLength(r,e);let n=this.instructions.map(_=>{let{accounts:P,programIdIndex:x}=_,T=Array.from(ma.base.fromBase58(_.data)),M=[];Es.encodeLength(M,P.length);let k=[];return Es.encodeLength(k,T.length),{programIdIndex:x,keyIndicesCount:wn.Buffer.from(M),keyIndices:P,dataLength:wn.Buffer.from(k),data:T}}),i=[];Es.encodeLength(i,n.length);let o=wn.Buffer.alloc(jy.PACKET_DATA_SIZE);wn.Buffer.from(i).copy(o);let a=i.length;n.forEach(_=>{let x=qr.struct([qr.u8("programIdIndex"),qr.blob(_.keyIndicesCount.length,"keyIndicesCount"),qr.seq(qr.u8("keyIndex"),_.keyIndices.length,"keyIndices"),qr.blob(_.dataLength.length,"dataLength"),qr.seq(qr.u8("userdatum"),_.data.length,"data")]).encode(_,o,a);a+=x}),o=o.slice(0,a);let c=qr.struct([qr.blob(1,"numRequiredSignatures"),qr.blob(1,"numReadonlySignedAccounts"),qr.blob(1,"numReadonlyUnsignedAccounts"),qr.blob(r.length,"keyCount"),qr.seq(Uy.publicKey("key"),e,"keys"),Uy.publicKey("recentBlockhash")]),l={numRequiredSignatures:wn.Buffer.from([this.header.numRequiredSignatures]),numReadonlySignedAccounts:wn.Buffer.from([this.header.numReadonlySignedAccounts]),numReadonlyUnsignedAccounts:wn.Buffer.from([this.header.numReadonlyUnsignedAccounts]),keyCount:wn.Buffer.from(r),keys:this.accountKeys.map(_=>(0,H7.toBuffer)(_.toBytes())),recentBlockhash:ma.base.fromBase58(this.recentBlockhash)},m=wn.Buffer.alloc(2048),S=c.encode(l,m);return o.copy(m,S),m.slice(0,S+o.length)}static from(e){let r=[...e],n=r.shift();if(n!==(n&jy.VERSION_PREFIX_MASK))throw new Error("Versioned messages must be deserialized with VersionedMessage.deserialize()");let i=r.shift(),o=r.shift(),a=Es.decodeLength(r),c=[];for(let P=0;P<a;P++){let x=r.slice(0,va.PUBLIC_KEY_LENGTH);r=r.slice(va.PUBLIC_KEY_LENGTH),c.push(new va.PublicKey(wn.Buffer.from(x)))}let l=r.slice(0,va.PUBLIC_KEY_LENGTH);r=r.slice(va.PUBLIC_KEY_LENGTH);let m=Es.decodeLength(r),S=[];for(let P=0;P<m;P++){let x=r.shift(),T=Es.decodeLength(r),M=r.slice(0,T);r=r.slice(T);let k=Es.decodeLength(r),N=r.slice(0,k),R=ma.base.toBase58(wn.Buffer.from(N));r=r.slice(k),S.push({programIdIndex:x,accounts:M,data:R})}let _={header:{numRequiredSignatures:n,numReadonlySignedAccounts:i,numReadonlyUnsignedAccounts:o},recentBlockhash:ma.base.toBase58(wn.Buffer.from(l)),accountKeys:c,instructions:S};return new wa(_)}};hi.Message=wa});var Uh=L(_n=>{"use strict";E();I();var W7=_n&&_n.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),$7=_n&&_n.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Rh=_n&&_n.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&W7(e,t,r);return $7(e,t),e},G7=_n&&_n.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(_n,"__esModule",{value:!0});_n.MessageV0=void 0;var zy=ur(),ft=Rh(Xt()),Dh=Rh(Di()),Fu=Zr(),Nr=Rh(ju()),Fy=G7(Mo()),Zf=So(),Y7=Nh(),Hy=Gf(),_a=class{constructor(e){this.header=e.header,this.staticAccountKeys=e.staticAccountKeys,this.recentBlockhash=e.recentBlockhash,this.compiledInstructions=e.compiledInstructions,this.addressTableLookups=e.addressTableLookups}get version(){return 0}get numAccountKeysFromLookups(){let e=0;for(let r of this.addressTableLookups)e+=r.readonlyIndexes.length+r.writableIndexes.length;return e}getAccountKeys(e){let r;if(e&&"accountKeysFromLookups"in e&&e.accountKeysFromLookups){if(this.numAccountKeysFromLookups!=e.accountKeysFromLookups.writable.length+e.accountKeysFromLookups.readonly.length)throw new Error("Failed to get account keys because of a mismatch in the number of account keys from lookups");r=e.accountKeysFromLookups}else if(e&&"addressLookupTableAccounts"in e&&e.addressLookupTableAccounts)r=this.resolveAddressTableLookups(e.addressLookupTableAccounts);else if(this.addressTableLookups.length>0)throw new Error("Failed to get account keys because address table lookups were not resolved");return new Hy.MessageAccountKeys(this.staticAccountKeys,r)}isAccountSigner(e){return e<this.header.numRequiredSignatures}isAccountWritable(e){let r=this.header.numRequiredSignatures,n=this.staticAccountKeys.length;if(e>=n){let i=e-n,o=this.addressTableLookups.reduce((a,c)=>a+c.writableIndexes.length,0);return i<o}else if(e>=this.header.numRequiredSignatures){let i=e-r,a=n-r-this.header.numReadonlyUnsignedAccounts;return i<a}else{let i=r-this.header.numReadonlySignedAccounts;return e<i}}resolveAddressTableLookups(e){let r={writable:[],readonly:[]};for(let n of this.addressTableLookups){let i=e.find(o=>o.key.equals(n.accountKey));if(!i)throw new Error(`Failed to find address lookup table account for table key ${n.accountKey.toBase58()}`);for(let o of n.writableIndexes)if(o<i.state.addresses.length)r.writable.push(i.state.addresses[o]);else throw new Error(`Failed to find address for index ${o} in address lookup table ${n.accountKey.toBase58()}`);for(let o of n.readonlyIndexes)if(o<i.state.addresses.length)r.readonly.push(i.state.addresses[o]);else throw new Error(`Failed to find address for index ${o} in address lookup table ${n.accountKey.toBase58()}`)}return r}static compile(e){let r=Y7.CompiledKeys.compile(e.instructions,e.payerKey),n=new Array,i={writable:new Array,readonly:new Array},o=e.addressLookupTableAccounts||[];for(let S of o){let _=r.extractTableLookup(S);if(_!==void 0){let[P,{writable:x,readonly:T}]=_;n.push(P),i.writable.push(...x),i.readonly.push(...T)}}let[a,c]=r.getMessageComponents(),m=new Hy.MessageAccountKeys(c,i).compileInstructions(e.instructions);return new _a({header:a,staticAccountKeys:c,recentBlockhash:e.recentBlockhash,compiledInstructions:m,addressTableLookups:n})}serialize(){let e=Array();Nr.encodeLength(e,this.staticAccountKeys.length);let r=this.serializeInstructions(),n=Array();Nr.encodeLength(n,this.compiledInstructions.length);let i=this.serializeAddressTableLookups(),o=Array();Nr.encodeLength(o,this.addressTableLookups.length);let a=ft.struct([ft.u8("prefix"),ft.struct([ft.u8("numRequiredSignatures"),ft.u8("numReadonlySignedAccounts"),ft.u8("numReadonlyUnsignedAccounts")],"header"),ft.blob(e.length,"staticAccountKeysLength"),ft.seq(Dh.publicKey(),this.staticAccountKeys.length,"staticAccountKeys"),Dh.publicKey("recentBlockhash"),ft.blob(n.length,"instructionsLength"),ft.blob(r.length,"serializedInstructions"),ft.blob(o.length,"addressTableLookupsLength"),ft.blob(i.length,"serializedAddressTableLookups")]),c=new Uint8Array(Zf.PACKET_DATA_SIZE),l=1<<7,m=a.encode({prefix:l,header:this.header,staticAccountKeysLength:new Uint8Array(e),staticAccountKeys:this.staticAccountKeys.map(S=>S.toBytes()),recentBlockhash:zy.base.fromBase58(this.recentBlockhash),instructionsLength:new Uint8Array(n),serializedInstructions:r,addressTableLookupsLength:new Uint8Array(o),serializedAddressTableLookups:i},c);return c.slice(0,m)}serializeInstructions(){let e=0,r=new Uint8Array(Zf.PACKET_DATA_SIZE);for(let n of this.compiledInstructions){let i=Array();Nr.encodeLength(i,n.accountKeyIndexes.length);let o=Array();Nr.encodeLength(o,n.data.length);let a=ft.struct([ft.u8("programIdIndex"),ft.blob(i.length,"encodedAccountKeyIndexesLength"),ft.seq(ft.u8(),n.accountKeyIndexes.length,"accountKeyIndexes"),ft.blob(o.length,"encodedDataLength"),ft.blob(n.data.length,"data")]);e+=a.encode({programIdIndex:n.programIdIndex,encodedAccountKeyIndexesLength:new Uint8Array(i),accountKeyIndexes:n.accountKeyIndexes,encodedDataLength:new Uint8Array(o),data:n.data},r,e)}return r.slice(0,e)}serializeAddressTableLookups(){let e=0,r=new Uint8Array(Zf.PACKET_DATA_SIZE);for(let n of this.addressTableLookups){let i=Array();Nr.encodeLength(i,n.writableIndexes.length);let o=Array();Nr.encodeLength(o,n.readonlyIndexes.length);let a=ft.struct([Dh.publicKey("accountKey"),ft.blob(i.length,"encodedWritableIndexesLength"),ft.seq(ft.u8(),n.writableIndexes.length,"writableIndexes"),ft.blob(o.length,"encodedReadonlyIndexesLength"),ft.seq(ft.u8(),n.readonlyIndexes.length,"readonlyIndexes")]);e+=a.encode({accountKey:n.accountKey.toBytes(),encodedWritableIndexesLength:new Uint8Array(i),writableIndexes:n.writableIndexes,encodedReadonlyIndexesLength:new Uint8Array(o),readonlyIndexes:n.readonlyIndexes},r,e)}return r.slice(0,e)}static deserialize(e){let r=[...e],n=r.shift(),i=n&Zf.VERSION_PREFIX_MASK;(0,Fy.default)(n!==i,"Expected versioned message but received legacy message");let o=i;(0,Fy.default)(o===0,`Expected versioned message with version 0 but found version ${o}`);let a={numRequiredSignatures:r.shift(),numReadonlySignedAccounts:r.shift(),numReadonlyUnsignedAccounts:r.shift()},c=[],l=Nr.decodeLength(r);for(let T=0;T<l;T++)c.push(new Fu.PublicKey(r.splice(0,Fu.PUBLIC_KEY_LENGTH)));let m=zy.base.toBase58(r.splice(0,Fu.PUBLIC_KEY_LENGTH)),S=Nr.decodeLength(r),_=[];for(let T=0;T<S;T++){let M=r.shift(),k=Nr.decodeLength(r),N=r.splice(0,k),R=Nr.decodeLength(r),K=new Uint8Array(r.splice(0,R));_.push({programIdIndex:M,accountKeyIndexes:N,data:K})}let P=Nr.decodeLength(r),x=[];for(let T=0;T<P;T++){let M=new Fu.PublicKey(r.splice(0,Fu.PUBLIC_KEY_LENGTH)),k=Nr.decodeLength(r),N=r.splice(0,k),R=Nr.decodeLength(r),K=r.splice(0,R);x.push({accountKey:M,writableIndexes:N,readonlyIndexes:K})}return new _a({header:a,staticAccountKeys:c,recentBlockhash:m,compiledInstructions:_,addressTableLookups:x})}};_n.MessageV0=_a});var jh=L(Hu=>{"use strict";E();I();Object.defineProperty(Hu,"__esModule",{value:!0});Hu.VersionedMessage=void 0;var Z7=So(),X7=Kh(),J7=Uh();Hu.VersionedMessage={deserializeMessageVersion(t){let e=t[0],r=e&Z7.VERSION_PREFIX_MASK;return r===e?"legacy":r},deserialize:t=>{let e=Hu.VersionedMessage.deserializeMessageVersion(t);if(e==="legacy")return X7.Message.from(t);if(e===0)return J7.MessageV0.deserialize(t);throw new Error(`Transaction message version ${e} deserialization is not supported`)}}});var Jf=L(bi=>{"use strict";E();I();var Q7=bi&&bi.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Xf=bi&&bi.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Q7(e,t,r)};Object.defineProperty(bi,"__esModule",{value:!0});Xf(Gf(),bi);Xf(Kh(),bi);Xf(jh(),bi);Xf(Uh(),bi)});var Ch=L(Sn=>{"use strict";E();I();var e9=Sn&&Sn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),t9=Sn&&Sn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$y=Sn&&Sn.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&e9(e,t,r);return t9(e,t),e};Object.defineProperty(Sn,"__esModule",{value:!0});Sn.NonceAccount=Sn.NONCE_ACCOUNT_LENGTH=void 0;var Qf=$y(Xt()),Vy=$y(Di()),Wy=Zr(),r9=Ph(),n9=_o(),Gy=Qf.struct([Qf.u32("version"),Qf.u32("state"),Vy.publicKey("authorizedPubkey"),Vy.publicKey("nonce"),Qf.struct([r9.FeeCalculatorLayout],"feeCalculator")]);Sn.NONCE_ACCOUNT_LENGTH=Gy.span;var Vu=class{constructor(e){this.authorizedPubkey=e.authorizedPubkey,this.nonce=e.nonce,this.feeCalculator=e.feeCalculator}static fromAccountData(e){let r=Gy.decode((0,n9.toBuffer)(e),0);return new Vu({authorizedPubkey:new Wy.PublicKey(r.authorizedPubkey),nonce:new Wy.PublicKey(r.nonce).toString(),feeCalculator:r.feeCalculator})}};Sn.NonceAccount=Vu});var Wu=L(pi=>{"use strict";E();I();Object.defineProperty(pi,"__esModule",{value:!0});pi.u256=pi.u192=pi.u128=pi.u64=void 0;var i9=Pr(),s9=Xt(),Yy=Uf(),o9=t=>{let e=t.decode.bind(t),r=t.encode.bind(t);return{decode:e,encode:r}},ed=t=>e=>{let r=(0,s9.blob)(t,e),{encode:n,decode:i}=o9(r),o=r;return o.decode=(a,c)=>{let l=i(a,c);return(0,Yy.toBigIntLE)(i9.Buffer.from(l))},o.encode=(a,c,l)=>{let m=(0,Yy.toBufferLE)(a,t);return n(m,c,l)},o};pi.u64=ed(8);pi.u128=ed(16);pi.u192=ed(24);pi.u256=ed(32)});var $u=L(Mn=>{"use strict";E();I();var a9=Mn&&Mn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),u9=Mn&&Mn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),c9=Mn&&Mn.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&a9(e,t,r);return u9(e,t),e};Object.defineProperty(Mn,"__esModule",{value:!0});Mn.decodeData=Mn.encodeData=void 0;var f9=Pr(),d9=c9(Di());function l9(t,e){let r=t.layout.span>=0?t.layout.span:d9.getAlloc(t,e),n=f9.Buffer.alloc(r),i=Object.assign({instruction:t.index},e);return t.layout.encode(i,n),n}Mn.encodeData=l9;function h9(t,e){let r;try{r=t.layout.decode(e)}catch(n){throw new Error("invalid instruction; "+n)}if(r.instruction!==t.index)throw new Error(`invalid instruction; instruction index mismatch ${r.instruction} != ${t.index}`);return r}Mn.decodeData=h9});var zh=L(Dt=>{"use strict";E();I();Object.defineProperty(Dt,"__esModule",{value:!0});Dt.SYSVAR_STAKE_HISTORY_PUBKEY=Dt.SYSVAR_SLOT_HISTORY_PUBKEY=Dt.SYSVAR_SLOT_HASHES_PUBKEY=Dt.SYSVAR_REWARDS_PUBKEY=Dt.SYSVAR_RENT_PUBKEY=Dt.SYSVAR_RECENT_BLOCKHASHES_PUBKEY=Dt.SYSVAR_INSTRUCTIONS_PUBKEY=Dt.SYSVAR_EPOCH_SCHEDULE_PUBKEY=Dt.SYSVAR_CLOCK_PUBKEY=void 0;var Ri=Zr();Dt.SYSVAR_CLOCK_PUBKEY=new Ri.PublicKey("SysvarC1ock11111111111111111111111111111111");Dt.SYSVAR_EPOCH_SCHEDULE_PUBKEY=new Ri.PublicKey("SysvarEpochSchedu1e111111111111111111111111");Dt.SYSVAR_INSTRUCTIONS_PUBKEY=new Ri.PublicKey("Sysvar1nstructions1111111111111111111111111");Dt.SYSVAR_RECENT_BLOCKHASHES_PUBKEY=new Ri.PublicKey("SysvarRecentB1ockHashes11111111111111111111");Dt.SYSVAR_RENT_PUBKEY=new Ri.PublicKey("SysvarRent111111111111111111111111111111111");Dt.SYSVAR_REWARDS_PUBKEY=new Ri.PublicKey("SysvarRewards111111111111111111111111111111");Dt.SYSVAR_SLOT_HASHES_PUBKEY=new Ri.PublicKey("SysvarS1otHashes111111111111111111111111111");Dt.SYSVAR_SLOT_HISTORY_PUBKEY=new Ri.PublicKey("SysvarS1otHistory11111111111111111111111111");Dt.SYSVAR_STAKE_HISTORY_PUBKEY=new Ri.PublicKey("SysvarStakeHistory1111111111111111111111111")});var Zy=L(Is=>{"use strict";E();I();Object.defineProperty(Is,"__esModule",{value:!0});Is.TransactionExpiredNonceInvalidError=Is.TransactionExpiredTimeoutError=Is.TransactionExpiredBlockheightExceededError=void 0;var td=class extends Error{constructor(e){super(`Signature ${e} has expired: block height exceeded.`),this.signature=e}};Is.TransactionExpiredBlockheightExceededError=td;Object.defineProperty(td.prototype,"name",{value:"TransactionExpiredBlockheightExceededError"});var rd=class extends Error{constructor(e,r){super(`Transaction was not confirmed in ${r.toFixed(2)} seconds. It is unknown if it succeeded or failed. Check signature ${e} using the Solana Explorer or CLI tools.`),this.signature=e}};Is.TransactionExpiredTimeoutError=rd;Object.defineProperty(rd.prototype,"name",{value:"TransactionExpiredTimeoutError"});var nd=class extends Error{constructor(e){super(`Signature ${e} has expired: the nonce is no longer valid.`),this.signature=e}};Is.TransactionExpiredNonceInvalidError=nd;Object.defineProperty(nd.prototype,"name",{value:"TransactionExpiredNonceInvalidError"})});var Fh=L(Lr=>{"use strict";E();I();var b9=Lr&&Lr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),p9=Lr&&Lr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),g9=Lr&&Lr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&b9(e,t,r);return p9(e,t),e},y9=Lr&&Lr.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Lr,"__esModule",{value:!0});Lr.Transaction=Lr.TransactionInstruction=void 0;var ji=Pr(),Gu=So(),Xy=Jf(),m9=Zr(),Jy=g9(ju()),v9=_o(),Ui=y9(Mo()),Eo=ur(),w9=ji.Buffer.alloc(Gu.SIGNATURE_LENGTH_IN_BYTES).fill(0),Yu=class{constructor(e){this.data=ji.Buffer.alloc(0),this.programId=e.programId,this.keys=e.keys,e.data&&(this.data=e.data)}toJSON(){return{keys:this.keys.map(({pubkey:e,isSigner:r,isWritable:n})=>({pubkey:e.toJSON(),isSigner:r,isWritable:n})),programId:this.programId.toJSON(),data:[...this.data]}}};Lr.TransactionInstruction=Yu;var Sa=class{get signature(){return this.signatures.length>0?this.signatures[0].signature:null}constructor(e){if(this.signatures=[],this.instructions=[],!!e)if(e.feePayer&&(this.feePayer=e.feePayer),e.signatures&&(this.signatures=e.signatures),Object.prototype.hasOwnProperty.call(e,"nonceInfo")){let{minContextSlot:r,nonceInfo:n}=e;this.minNonceContextSlot=r,this.nonceInfo=n}else if(Object.prototype.hasOwnProperty.call(e,"lastValidBlockHeight")){let{blockhash:r,lastValidBlockHeight:n}=e;this.recentBlockhash=r,this.lastValidBlockHeight=n}else{let{recentBlockhash:r,nonceInfo:n}=e;n&&(this.nonceInfo=n),this.recentBlockhash=r}}toJSON(){return{recentBlockhash:this.recentBlockhash||null,feePayer:this.feePayer?this.feePayer.toJSON():null,nonceInfo:this.nonceInfo?{nonce:this.nonceInfo.nonce,nonceInstruction:this.nonceInfo.nonceInstruction.toJSON()}:null,instructions:this.instructions.map(e=>e.toJSON()),signers:this.signatures.map(({publicKey:e})=>e.toJSON())}}add(...e){if(e.length===0)throw new Error("No instructions");return e.forEach(r=>{"instructions"in r?this.instructions=this.instructions.concat(r.instructions):"data"in r&&"programId"in r&&"keys"in r?this.instructions.push(r):this.instructions.push(new Yu(r))}),this}compileMessage(){if(this._message&&JSON.stringify(this.toJSON())===JSON.stringify(this._json))return this._message;let e,r;if(this.nonceInfo?(e=this.nonceInfo.nonce,this.instructions[0]!=this.nonceInfo.nonceInstruction?r=[this.nonceInfo.nonceInstruction,...this.instructions]:r=this.instructions):(e=this.recentBlockhash,r=this.instructions),!e)throw new Error("Transaction recentBlockhash required");r.length<1&&console.warn("No instructions provided");let n;if(this.feePayer)n=this.feePayer;else if(this.signatures.length>0&&this.signatures[0].publicKey)n=this.signatures[0].publicKey;else throw new Error("Transaction fee payer required");for(let M=0;M<r.length;M++)if(r[M].programId===void 0)throw new Error(`Transaction instruction index ${M} has undefined program id`);let i=[],o=[];r.forEach(M=>{M.keys.forEach(N=>{o.push({...N})});let k=M.programId.toString();i.includes(k)||i.push(k)}),i.forEach(M=>{o.push({pubkey:new m9.PublicKey(M),isSigner:!1,isWritable:!1})});let a=[];o.forEach(M=>{let k=M.pubkey.toString(),N=a.findIndex(R=>R.pubkey.toString()===k);N>-1?(a[N].isWritable=a[N].isWritable||M.isWritable,a[N].isSigner=a[N].isSigner||M.isSigner):a.push(M)}),a.sort(function(M,k){return M.isSigner!==k.isSigner?M.isSigner?-1:1:M.isWritable!==k.isWritable?M.isWritable?-1:1:M.pubkey.toBase58().localeCompare(k.pubkey.toBase58())});let c=a.findIndex(M=>M.pubkey.equals(n));if(c>-1){let[M]=a.splice(c,1);M.isSigner=!0,M.isWritable=!0,a.unshift(M)}else a.unshift({pubkey:n,isSigner:!0,isWritable:!0});for(let M of this.signatures){let k=a.findIndex(N=>N.pubkey.equals(M.publicKey));if(k>-1)a[k].isSigner||(a[k].isSigner=!0,console.warn("Transaction references a signature that is unnecessary, only the fee payer and instruction signer accounts should sign a transaction. This behavior is deprecated and will throw an error in the next major version release."));else throw new Error(`unknown signer: ${M.publicKey.toString()}`)}let l=0,m=0,S=0,_=[],P=[];a.forEach(({pubkey:M,isSigner:k,isWritable:N})=>{k?(_.push(M.toString()),l+=1,N||(m+=1)):(P.push(M.toString()),N||(S+=1))});let x=_.concat(P),T=r.map(M=>{let{data:k,programId:N}=M;return{programIdIndex:x.indexOf(N.toString()),accounts:M.keys.map(R=>x.indexOf(R.pubkey.toString())),data:Eo.base.toBase58(k)}});return T.forEach(M=>{(0,Ui.default)(M.programIdIndex>=0),M.accounts.forEach(k=>(0,Ui.default)(k>=0))}),new Xy.Message({header:{numRequiredSignatures:l,numReadonlySignedAccounts:m,numReadonlyUnsignedAccounts:S},accountKeys:x,recentBlockhash:e,instructions:T})}_compile(){let e=this.compileMessage(),r=e.accountKeys.slice(0,e.header.numRequiredSignatures);return this.signatures.length===r.length&&this.signatures.every((i,o)=>r[o].equals(i.publicKey))||(this.signatures=r.map(n=>({signature:null,publicKey:n}))),e}serializeMessage(){return this._compile().serialize()}setSigners(...e){if(e.length===0)throw new Error("No signers");let r=new Set;this.signatures=e.filter(n=>{let i=n.toString();return r.has(i)?!1:(r.add(i),!0)}).map(n=>({signature:null,publicKey:n}))}sign(...e){if(e.length===0)throw new Error("No signers");let r=new Set,n=[];for(let o of e){let a=o.publicKey.toString();r.has(a)||(r.add(a),n.push(o))}this.signatures=n.map(o=>({signature:null,publicKey:o.publicKey}));let i=this._compile();this._partialSign(i,...n)}partialSign(...e){if(e.length===0)throw new Error("No signers");let r=new Set,n=[];for(let o of e){let a=o.publicKey.toString();r.has(a)||(r.add(a),n.push(o))}let i=this._compile();this._partialSign(i,...n)}_partialSign(e,...r){let n=e.serialize();r.forEach(i=>{let o=Eo.signUtil.ed25519.sign(n,i.secretKey);this._addSignature(i.publicKey,(0,v9.toBuffer)(o))})}addSignature(e,r){this._compile(),this._addSignature(e,r)}_addSignature(e,r){(0,Ui.default)(r.length===64);let n=this.signatures.findIndex(i=>e.equals(i.publicKey));if(n<0)throw new Error(`unknown signer: ${e.toString()}`);this.signatures[n].signature=ji.Buffer.from(r)}verifySignatures(e){return this._verifySignatures(this.serializeMessage(),e===void 0?!0:e)}_verifySignatures(e,r){for(let{signature:n,publicKey:i}of this.signatures)if(n===null){if(r)return!1}else if(!Eo.signUtil.ed25519.verify(e,n,i.toBytes()))return!1;return!0}serialize(e){let{requireAllSignatures:r,verifySignatures:n}=Object.assign({requireAllSignatures:!0,verifySignatures:!0},e),i=this.serializeMessage();if(n&&!this._verifySignatures(i,r))throw new Error("Signature verification failed");return this._serialize(i)}_serialize(e){let{signatures:r}=this,n=[];Jy.encodeLength(n,r.length);let i=n.length+r.length*64+e.length,o=ji.Buffer.alloc(i);return(0,Ui.default)(r.length<256),ji.Buffer.from(n).copy(o,0),r.forEach(({signature:a},c)=>{a!==null&&((0,Ui.default)(a.length===64,"signature has invalid length"),ji.Buffer.from(a).copy(o,n.length+c*64))}),e.copy(o,n.length+r.length*64),(0,Ui.default)(o.length<=Gu.PACKET_DATA_SIZE,`Transaction too large: ${o.length} > ${Gu.PACKET_DATA_SIZE}`),o}get keys(){return(0,Ui.default)(this.instructions.length===1),this.instructions[0].keys.map(e=>e.pubkey)}get programId(){return(0,Ui.default)(this.instructions.length===1),this.instructions[0].programId}get data(){return(0,Ui.default)(this.instructions.length===1),this.instructions[0].data}static from(e){let r=[...e],n=Jy.decodeLength(r),i=[];for(let o=0;o<n;o++){let a=r.slice(0,Gu.SIGNATURE_LENGTH_IN_BYTES);r=r.slice(Gu.SIGNATURE_LENGTH_IN_BYTES),i.push(Eo.base.toBase58(ji.Buffer.from(a)))}return Sa.populate(Xy.Message.from(r),i)}static populate(e,r=[]){let n=new Sa;return n.recentBlockhash=e.recentBlockhash,e.header.numRequiredSignatures>0&&(n.feePayer=e.accountKeys[0]),r.forEach((i,o)=>{let a={signature:i==Eo.base.toBase58(w9)?null:ji.Buffer.from(Eo.base.fromBase58(i)),publicKey:e.accountKeys[o]};n.signatures.push(a)}),e.instructions.forEach(i=>{let o=i.accounts.map(a=>{let c=e.accountKeys[a];return{pubkey:c,isSigner:n.signatures.some(l=>l.publicKey.toString()===c.toString())||e.isAccountSigner(a),isWritable:e.isAccountWritable(a)}});n.instructions.push(new Yu({keys:o,programId:e.accountKeys[i.programIdIndex],data:ji.Buffer.from(Eo.base.fromBase58(i.data))}))}),n._message=e,n._json=n.toJSON(),n}};Lr.Transaction=Sa});var tm=L(Ma=>{"use strict";E();I();var _9=Ma&&Ma.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ma,"__esModule",{value:!0});Ma.TransactionMessage=void 0;var Qy=_9(Mo()),S9=_o(),em=Jf(),M9=Fh(),Zu=class{constructor(e){this.payerKey=e.payerKey,this.instructions=e.instructions,this.recentBlockhash=e.recentBlockhash}static decompile(e,r){let{header:n,compiledInstructions:i,recentBlockhash:o}=e,{numRequiredSignatures:a,numReadonlySignedAccounts:c,numReadonlyUnsignedAccounts:l}=n,m=a-c;(0,Qy.default)(m>0,"Message header is invalid");let S=e.staticAccountKeys.length-a-l;(0,Qy.default)(S>=0,"Message header is invalid");let _=e.getAccountKeys(r),P=_.get(0);if(P===void 0)throw new Error("Failed to decompile message because no account keys were found");let x=[];for(let T of i){let M=[];for(let N of T.accountKeyIndexes){let R=_.get(N);if(R===void 0)throw new Error(`Failed to find key for account key index ${N}`);let K=N<a,z;K?z=N<m:N<_.staticAccountKeys.length?z=N-a<S:z=N-_.staticAccountKeys.length<_.accountKeysFromLookups.writable.length,M.push({pubkey:R,isSigner:N<n.numRequiredSignatures,isWritable:z})}let k=_.get(T.programIdIndex);if(k===void 0)throw new Error(`Failed to find program id for program id index ${T.programIdIndex}`);x.push(new M9.TransactionInstruction({programId:k,data:(0,S9.toBuffer)(T.data),keys:M}))}return new Zu({payerKey:P,instructions:x,recentBlockhash:o})}compileToLegacyMessage(){return em.Message.compile({payerKey:this.payerKey,recentBlockhash:this.recentBlockhash,instructions:this.instructions})}compileToV0Message(e){return em.MessageV0.compile({payerKey:this.payerKey,recentBlockhash:this.recentBlockhash,instructions:this.instructions,addressLookupTableAccounts:e})}};Ma.TransactionMessage=Zu});var im=L(En=>{"use strict";E();I();var E9=En&&En.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),I9=En&&En.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Hh=En&&En.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&E9(e,t,r);return I9(e,t),e},x9=En&&En.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(En,"__esModule",{value:!0});En.VersionedTransaction=void 0;var id=Hh(Xt()),sd=x9(Mo()),A9=jh(),rm=So(),nm=Hh(ju()),P9=Hh(Di()),B9=ur(),T9=Pr(),Xu=class{get signature(){return this.signatures.length>0?T9.Buffer.from(this.signatures[0]):null}get version(){return this.message.version}constructor(e,r){if(r!==void 0)(0,sd.default)(r.length===e.header.numRequiredSignatures,"Expected signatures length to be equal to the number of required signatures"),this.signatures=r;else{let n=[];for(let i=0;i<e.header.numRequiredSignatures;i++)n.push(new Uint8Array(rm.SIGNATURE_LENGTH_IN_BYTES));this.signatures=n}this.message=e}serialize(){let e=this.message.serialize(),r=Array();nm.encodeLength(r,this.signatures.length);let n=id.struct([id.blob(r.length,"encodedSignaturesLength"),id.seq(P9.signature(),this.signatures.length,"signatures"),id.blob(e.length,"serializedMessage")]),i=new Uint8Array(2048),o=n.encode({encodedSignaturesLength:new Uint8Array(r),signatures:this.signatures,serializedMessage:e},i);return i.slice(0,o)}static deserialize(e){let r=[...e],n=[],i=nm.decodeLength(r);for(let a=0;a<i;a++)n.push(new Uint8Array(r.splice(0,rm.SIGNATURE_LENGTH_IN_BYTES)));let o=A9.VersionedMessage.deserialize(new Uint8Array(r));return new Xu(o,n)}sign(e){let r=this.message.serialize(),n=this.message.staticAccountKeys.slice(0,this.message.header.numRequiredSignatures);for(let i of e){let o=n.findIndex(a=>a.equals(i.publicKey));(0,sd.default)(o>=0,`Cannot sign with non signer key ${i.publicKey.toBase58()}`),this.signatures[o]=B9.signUtil.ed25519.sign(r,i.secretKey)}}addSignature(e,r){(0,sd.default)(r.byteLength===64,"Signature must be 64 bytes long");let i=this.message.staticAccountKeys.slice(0,this.message.header.numRequiredSignatures).findIndex(o=>o.equals(e));(0,sd.default)(i>=0,`Can not add signature; \`${e.toBase58()}\` is not required to sign this transaction`),this.signatures[i]=r}};En.VersionedTransaction=Xu});var Qu=L(Hn=>{"use strict";E();I();var O9=Hn&&Hn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Ju=Hn&&Hn.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&O9(e,t,r)};Object.defineProperty(Hn,"__esModule",{value:!0});Ju(So(),Hn);Ju(Zy(),Hn);Ju(Fh(),Hn);Ju(tm(),Hn);Ju(im(),Hn)});var Wh=L(He=>{"use strict";E();I();var k9=He&&He.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),q9=He&&He.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),am=He&&He.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&k9(e,t,r);return q9(e,t),e};Object.defineProperty(He,"__esModule",{value:!0});He.SystemProgram=He.SYSTEM_INSTRUCTION_LAYOUTS=He.SystemInstruction=void 0;var Je=am(Xt()),vt=$u(),Sr=am(Di()),sm=Ch(),In=Zr(),ec=zh(),gi=Qu(),Vn=_o(),om=Wu(),Vh=class{constructor(){}static decodeInstructionType(e){this.checkProgramId(e.programId);let n=Je.u32("instruction").decode(e.data),i;for(let[o,a]of Object.entries(He.SYSTEM_INSTRUCTION_LAYOUTS))if(a.index==n){i=o;break}if(!i)throw new Error("Instruction type incorrect; not a SystemInstruction");return i}static decodeCreateAccount(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,2);let{lamports:r,space:n,programId:i}=(0,vt.decodeData)(He.SYSTEM_INSTRUCTION_LAYOUTS.Create,e.data);return{fromPubkey:e.keys[0].pubkey,newAccountPubkey:e.keys[1].pubkey,lamports:r,space:n,programId:new In.PublicKey(i)}}static decodeTransfer(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,2);let{lamports:r}=(0,vt.decodeData)(He.SYSTEM_INSTRUCTION_LAYOUTS.Transfer,e.data);return{fromPubkey:e.keys[0].pubkey,toPubkey:e.keys[1].pubkey,lamports:r}}static decodeTransferWithSeed(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,3);let{lamports:r,seed:n,programId:i}=(0,vt.decodeData)(He.SYSTEM_INSTRUCTION_LAYOUTS.TransferWithSeed,e.data);return{fromPubkey:e.keys[0].pubkey,basePubkey:e.keys[1].pubkey,toPubkey:e.keys[2].pubkey,lamports:r,seed:n,programId:new In.PublicKey(i)}}static decodeAllocate(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,1);let{space:r}=(0,vt.decodeData)(He.SYSTEM_INSTRUCTION_LAYOUTS.Allocate,e.data);return{accountPubkey:e.keys[0].pubkey,space:r}}static decodeAllocateWithSeed(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,1);let{base:r,seed:n,space:i,programId:o}=(0,vt.decodeData)(He.SYSTEM_INSTRUCTION_LAYOUTS.AllocateWithSeed,e.data);return{accountPubkey:e.keys[0].pubkey,basePubkey:new In.PublicKey(r),seed:n,space:i,programId:new In.PublicKey(o)}}static decodeAssign(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,1);let{programId:r}=(0,vt.decodeData)(He.SYSTEM_INSTRUCTION_LAYOUTS.Assign,e.data);return{accountPubkey:e.keys[0].pubkey,programId:new In.PublicKey(r)}}static decodeAssignWithSeed(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,1);let{base:r,seed:n,programId:i}=(0,vt.decodeData)(He.SYSTEM_INSTRUCTION_LAYOUTS.AssignWithSeed,e.data);return{accountPubkey:e.keys[0].pubkey,basePubkey:new In.PublicKey(r),seed:n,programId:new In.PublicKey(i)}}static decodeCreateWithSeed(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,2);let{base:r,seed:n,lamports:i,space:o,programId:a}=(0,vt.decodeData)(He.SYSTEM_INSTRUCTION_LAYOUTS.CreateWithSeed,e.data);return{fromPubkey:e.keys[0].pubkey,newAccountPubkey:e.keys[1].pubkey,basePubkey:new In.PublicKey(r),seed:n,lamports:i,space:o,programId:new In.PublicKey(a)}}static decodeNonceInitialize(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,3);let{authorized:r}=(0,vt.decodeData)(He.SYSTEM_INSTRUCTION_LAYOUTS.InitializeNonceAccount,e.data);return{noncePubkey:e.keys[0].pubkey,authorizedPubkey:new In.PublicKey(r)}}static decodeNonceAdvance(e){return this.checkProgramId(e.programId),this.checkKeyLength(e.keys,3),(0,vt.decodeData)(He.SYSTEM_INSTRUCTION_LAYOUTS.AdvanceNonceAccount,e.data),{noncePubkey:e.keys[0].pubkey,authorizedPubkey:e.keys[2].pubkey}}static decodeNonceWithdraw(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,5);let{lamports:r}=(0,vt.decodeData)(He.SYSTEM_INSTRUCTION_LAYOUTS.WithdrawNonceAccount,e.data);return{noncePubkey:e.keys[0].pubkey,toPubkey:e.keys[1].pubkey,authorizedPubkey:e.keys[4].pubkey,lamports:r}}static decodeNonceAuthorize(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,2);let{authorized:r}=(0,vt.decodeData)(He.SYSTEM_INSTRUCTION_LAYOUTS.AuthorizeNonceAccount,e.data);return{noncePubkey:e.keys[0].pubkey,authorizedPubkey:e.keys[1].pubkey,newAuthorizedPubkey:new In.PublicKey(r)}}static checkProgramId(e){if(!e.equals(xs.programId))throw new Error("invalid instruction; programId is not SystemProgram")}static checkKeyLength(e,r){if(e.length<r)throw new Error(`invalid instruction; found ${e.length} keys, expected at least ${r}`)}};He.SystemInstruction=Vh;He.SYSTEM_INSTRUCTION_LAYOUTS=Object.freeze({Create:{index:0,layout:Je.struct([Je.u32("instruction"),Je.ns64("lamports"),Je.ns64("space"),Sr.publicKey("programId")])},Assign:{index:1,layout:Je.struct([Je.u32("instruction"),Sr.publicKey("programId")])},Transfer:{index:2,layout:Je.struct([Je.u32("instruction"),(0,om.u64)("lamports")])},CreateWithSeed:{index:3,layout:Je.struct([Je.u32("instruction"),Sr.publicKey("base"),Sr.rustString("seed"),Je.ns64("lamports"),Je.ns64("space"),Sr.publicKey("programId")])},AdvanceNonceAccount:{index:4,layout:Je.struct([Je.u32("instruction")])},WithdrawNonceAccount:{index:5,layout:Je.struct([Je.u32("instruction"),Je.ns64("lamports")])},InitializeNonceAccount:{index:6,layout:Je.struct([Je.u32("instruction"),Sr.publicKey("authorized")])},AuthorizeNonceAccount:{index:7,layout:Je.struct([Je.u32("instruction"),Sr.publicKey("authorized")])},Allocate:{index:8,layout:Je.struct([Je.u32("instruction"),Je.ns64("space")])},AllocateWithSeed:{index:9,layout:Je.struct([Je.u32("instruction"),Sr.publicKey("base"),Sr.rustString("seed"),Je.ns64("space"),Sr.publicKey("programId")])},AssignWithSeed:{index:10,layout:Je.struct([Je.u32("instruction"),Sr.publicKey("base"),Sr.rustString("seed"),Sr.publicKey("programId")])},TransferWithSeed:{index:11,layout:Je.struct([Je.u32("instruction"),(0,om.u64)("lamports"),Sr.rustString("seed"),Sr.publicKey("programId")])},UpgradeNonceAccount:{index:12,layout:Je.struct([Je.u32("instruction")])}});var xs=class{constructor(){}static createAccount(e){let r=He.SYSTEM_INSTRUCTION_LAYOUTS.Create,n=(0,vt.encodeData)(r,{lamports:e.lamports,space:e.space,programId:(0,Vn.toBuffer)(e.programId.toBuffer())});return new gi.TransactionInstruction({keys:[{pubkey:e.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:e.newAccountPubkey,isSigner:!0,isWritable:!0}],programId:this.programId,data:n})}static transfer(e){let r,n;if("basePubkey"in e){let i=He.SYSTEM_INSTRUCTION_LAYOUTS.TransferWithSeed;r=(0,vt.encodeData)(i,{lamports:BigInt(e.lamports),seed:e.seed,programId:(0,Vn.toBuffer)(e.programId.toBuffer())}),n=[{pubkey:e.fromPubkey,isSigner:!1,isWritable:!0},{pubkey:e.basePubkey,isSigner:!0,isWritable:!1},{pubkey:e.toPubkey,isSigner:!1,isWritable:!0}]}else{let i=He.SYSTEM_INSTRUCTION_LAYOUTS.Transfer;r=(0,vt.encodeData)(i,{lamports:BigInt(e.lamports)}),n=[{pubkey:e.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:e.toPubkey,isSigner:!1,isWritable:!0}]}return new gi.TransactionInstruction({keys:n,programId:this.programId,data:r})}static assign(e){let r,n;if("basePubkey"in e){let i=He.SYSTEM_INSTRUCTION_LAYOUTS.AssignWithSeed;r=(0,vt.encodeData)(i,{base:(0,Vn.toBuffer)(e.basePubkey.toBuffer()),seed:e.seed,programId:(0,Vn.toBuffer)(e.programId.toBuffer())}),n=[{pubkey:e.accountPubkey,isSigner:!1,isWritable:!0},{pubkey:e.basePubkey,isSigner:!0,isWritable:!1}]}else{let i=He.SYSTEM_INSTRUCTION_LAYOUTS.Assign;r=(0,vt.encodeData)(i,{programId:(0,Vn.toBuffer)(e.programId.toBuffer())}),n=[{pubkey:e.accountPubkey,isSigner:!0,isWritable:!0}]}return new gi.TransactionInstruction({keys:n,programId:this.programId,data:r})}static createAccountWithSeed(e){let r=He.SYSTEM_INSTRUCTION_LAYOUTS.CreateWithSeed,n=(0,vt.encodeData)(r,{base:(0,Vn.toBuffer)(e.basePubkey.toBuffer()),seed:e.seed,lamports:e.lamports,space:e.space,programId:(0,Vn.toBuffer)(e.programId.toBuffer())}),i=[{pubkey:e.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:e.newAccountPubkey,isSigner:!1,isWritable:!0}];return e.basePubkey!=e.fromPubkey&&i.push({pubkey:e.basePubkey,isSigner:!0,isWritable:!1}),new gi.TransactionInstruction({keys:i,programId:this.programId,data:n})}static createNonceAccount(e){let r=new gi.Transaction;"basePubkey"in e&&"seed"in e?r.add(xs.createAccountWithSeed({fromPubkey:e.fromPubkey,newAccountPubkey:e.noncePubkey,basePubkey:e.basePubkey,seed:e.seed,lamports:e.lamports,space:sm.NONCE_ACCOUNT_LENGTH,programId:this.programId})):r.add(xs.createAccount({fromPubkey:e.fromPubkey,newAccountPubkey:e.noncePubkey,lamports:e.lamports,space:sm.NONCE_ACCOUNT_LENGTH,programId:this.programId}));let n={noncePubkey:e.noncePubkey,authorizedPubkey:e.authorizedPubkey};return r.add(this.nonceInitialize(n)),r}static nonceInitialize(e){let r=He.SYSTEM_INSTRUCTION_LAYOUTS.InitializeNonceAccount,n=(0,vt.encodeData)(r,{authorized:(0,Vn.toBuffer)(e.authorizedPubkey.toBuffer())}),i={keys:[{pubkey:e.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:ec.SYSVAR_RECENT_BLOCKHASHES_PUBKEY,isSigner:!1,isWritable:!1},{pubkey:ec.SYSVAR_RENT_PUBKEY,isSigner:!1,isWritable:!1}],programId:this.programId,data:n};return new gi.TransactionInstruction(i)}static nonceAdvance(e){let r=He.SYSTEM_INSTRUCTION_LAYOUTS.AdvanceNonceAccount,n=(0,vt.encodeData)(r),i={keys:[{pubkey:e.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:ec.SYSVAR_RECENT_BLOCKHASHES_PUBKEY,isSigner:!1,isWritable:!1},{pubkey:e.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:n};return new gi.TransactionInstruction(i)}static nonceWithdraw(e){let r=He.SYSTEM_INSTRUCTION_LAYOUTS.WithdrawNonceAccount,n=(0,vt.encodeData)(r,{lamports:e.lamports});return new gi.TransactionInstruction({keys:[{pubkey:e.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:e.toPubkey,isSigner:!1,isWritable:!0},{pubkey:ec.SYSVAR_RECENT_BLOCKHASHES_PUBKEY,isSigner:!1,isWritable:!1},{pubkey:ec.SYSVAR_RENT_PUBKEY,isSigner:!1,isWritable:!1},{pubkey:e.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:n})}static nonceAuthorize(e){let r=He.SYSTEM_INSTRUCTION_LAYOUTS.AuthorizeNonceAccount,n=(0,vt.encodeData)(r,{authorized:(0,Vn.toBuffer)(e.newAuthorizedPubkey.toBuffer())});return new gi.TransactionInstruction({keys:[{pubkey:e.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:e.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:n})}static allocate(e){let r,n;if("basePubkey"in e){let i=He.SYSTEM_INSTRUCTION_LAYOUTS.AllocateWithSeed;r=(0,vt.encodeData)(i,{base:(0,Vn.toBuffer)(e.basePubkey.toBuffer()),seed:e.seed,space:e.space,programId:(0,Vn.toBuffer)(e.programId.toBuffer())}),n=[{pubkey:e.accountPubkey,isSigner:!1,isWritable:!0},{pubkey:e.basePubkey,isSigner:!0,isWritable:!1}]}else{let i=He.SYSTEM_INSTRUCTION_LAYOUTS.Allocate;r=(0,vt.encodeData)(i,{space:e.space}),n=[{pubkey:e.accountPubkey,isSigner:!0,isWritable:!0}]}return new gi.TransactionInstruction({keys:n,programId:this.programId,data:r})}};He.SystemProgram=xs;xs.programId=new In.PublicKey("11111111111111111111111111111111")});var um=L(od=>{"use strict";E();I();Object.defineProperty(od,"__esModule",{value:!0});od.decodeData=void 0;function N9(t,e){let r;try{r=t.layout.decode(e)}catch(n){throw new Error("invalid instruction; "+n)}if(r.typeIndex!==t.index)throw new Error(`invalid account data; account type mismatch ${r.typeIndex} != ${t.index}`);return r}od.decodeData=N9});var bm=L(xn=>{"use strict";E();I();var L9=xn&&xn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),K9=xn&&xn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),lm=xn&&xn.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&L9(e,t,r);return K9(e,t),e},D9=xn&&xn.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(xn,"__esModule",{value:!0});xn.AddressLookupTableAccount=void 0;var yi=lm(Xt()),cm=D9(Mo()),hm=lm(Di()),fm=Zr(),R9=Wu(),U9=um(),dm=56,$h=class{constructor(e){this.key=e.key,this.state=e.state}isActive(){let e=BigInt("0xffffffffffffffff");return this.state.deactivationSlot===e}static deserialize(e){let r=(0,U9.decodeData)(j9,e),n=e.length-dm;(0,cm.default)(n>=0,"lookup table is invalid"),(0,cm.default)(n%32===0,"lookup table is invalid");let i=n/32,{addresses:o}=yi.struct([yi.seq(hm.publicKey(),i,"addresses")]).decode(e.slice(dm));return{deactivationSlot:r.deactivationSlot,lastExtendedSlot:r.lastExtendedSlot,lastExtendedSlotStartIndex:r.lastExtendedStartIndex,authority:r.authority.length!==0?new fm.PublicKey(r.authority[0]):void 0,addresses:o.map(a=>new fm.PublicKey(a))}}};xn.AddressLookupTableAccount=$h;var j9={index:1,layout:yi.struct([yi.u32("typeIndex"),(0,R9.u64)("deactivationSlot"),yi.nu64("lastExtendedSlot"),yi.u8("lastExtendedStartIndex"),yi.u8(),yi.seq(hm.publicKey(),yi.offset(yi.u8(),-1),"authority")])}});var mm=L(bt=>{"use strict";E();I();var ym=bt&&bt.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),C9=bt&&bt.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Yh=bt&&bt.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&ym(e,t,r);return C9(e,t),e},z9=bt&&bt.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&ym(e,t,r)};Object.defineProperty(bt,"__esModule",{value:!0});bt.AddressLookupTableProgram=bt.AddressLookupTableInstruction=bt.LOOKUP_TABLE_INSTRUCTION_LAYOUTS=void 0;var F9=Uf(),Mr=Yh(Xt()),H9=Yh(Di()),Zh=Zr(),pm=Yh(Wu()),gm=Wh(),tc=Qu(),Io=$u();z9(bm(),bt);bt.LOOKUP_TABLE_INSTRUCTION_LAYOUTS=Object.freeze({CreateLookupTable:{index:0,layout:Mr.struct([Mr.u32("instruction"),pm.u64("recentSlot"),Mr.u8("bumpSeed")])},FreezeLookupTable:{index:1,layout:Mr.struct([Mr.u32("instruction")])},ExtendLookupTable:{index:2,layout:Mr.struct([Mr.u32("instruction"),pm.u64(),Mr.seq(H9.publicKey(),Mr.offset(Mr.u32(),-8),"addresses")])},DeactivateLookupTable:{index:3,layout:Mr.struct([Mr.u32("instruction")])},CloseLookupTable:{index:4,layout:Mr.struct([Mr.u32("instruction")])}});var Gh=class{constructor(){}static decodeInstructionType(e){this.checkProgramId(e.programId);let n=Mr.u32("instruction").decode(e.data),i;for(let[o,a]of Object.entries(bt.LOOKUP_TABLE_INSTRUCTION_LAYOUTS))if(a.index==n){i=o;break}if(!i)throw new Error("Invalid Instruction. Should be a LookupTable Instruction");return i}static decodeCreateLookupTable(e){this.checkProgramId(e.programId),this.checkKeysLength(e.keys,4);let{recentSlot:r}=(0,Io.decodeData)(bt.LOOKUP_TABLE_INSTRUCTION_LAYOUTS.CreateLookupTable,e.data);return{authority:e.keys[1].pubkey,payer:e.keys[2].pubkey,recentSlot:Number(r)}}static decodeExtendLookupTable(e){if(this.checkProgramId(e.programId),e.keys.length<2)throw new Error(`invalid instruction; found ${e.keys.length} keys, expected at least 2`);let{addresses:r}=(0,Io.decodeData)(bt.LOOKUP_TABLE_INSTRUCTION_LAYOUTS.ExtendLookupTable,e.data);return{lookupTable:e.keys[0].pubkey,authority:e.keys[1].pubkey,payer:e.keys.length>2?e.keys[2].pubkey:void 0,addresses:r.map(n=>new Zh.PublicKey(n))}}static decodeCloseLookupTable(e){return this.checkProgramId(e.programId),this.checkKeysLength(e.keys,3),{lookupTable:e.keys[0].pubkey,authority:e.keys[1].pubkey,recipient:e.keys[2].pubkey}}static decodeFreezeLookupTable(e){return this.checkProgramId(e.programId),this.checkKeysLength(e.keys,2),{lookupTable:e.keys[0].pubkey,authority:e.keys[1].pubkey}}static decodeDeactivateLookupTable(e){return this.checkProgramId(e.programId),this.checkKeysLength(e.keys,2),{lookupTable:e.keys[0].pubkey,authority:e.keys[1].pubkey}}static checkProgramId(e){if(!e.equals(rc.programId))throw new Error("invalid instruction; programId is not AddressLookupTable Program")}static checkKeysLength(e,r){if(e.length<r)throw new Error(`invalid instruction; found ${e.length} keys, expected at least ${r}`)}};bt.AddressLookupTableInstruction=Gh;var rc=class{constructor(){}static createLookupTable(e){let[r,n]=Zh.PublicKey.findProgramAddressSync([e.authority.toBuffer(),(0,F9.toBufferLE)(BigInt(e.recentSlot),8)],this.programId),i=bt.LOOKUP_TABLE_INSTRUCTION_LAYOUTS.CreateLookupTable,o=(0,Io.encodeData)(i,{recentSlot:BigInt(e.recentSlot),bumpSeed:n}),a=[{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:e.authority,isSigner:!0,isWritable:!1},{pubkey:e.payer,isSigner:!0,isWritable:!0},{pubkey:gm.SystemProgram.programId,isSigner:!1,isWritable:!1}];return[new tc.TransactionInstruction({programId:this.programId,keys:a,data:o}),r]}static freezeLookupTable(e){let r=bt.LOOKUP_TABLE_INSTRUCTION_LAYOUTS.FreezeLookupTable,n=(0,Io.encodeData)(r),i=[{pubkey:e.lookupTable,isSigner:!1,isWritable:!0},{pubkey:e.authority,isSigner:!0,isWritable:!1}];return new tc.TransactionInstruction({programId:this.programId,keys:i,data:n})}static extendLookupTable(e){let r=bt.LOOKUP_TABLE_INSTRUCTION_LAYOUTS.ExtendLookupTable,n=(0,Io.encodeData)(r,{addresses:e.addresses.map(o=>o.toBytes())}),i=[{pubkey:e.lookupTable,isSigner:!1,isWritable:!0},{pubkey:e.authority,isSigner:!0,isWritable:!1}];return e.payer&&i.push({pubkey:e.payer,isSigner:!0,isWritable:!0},{pubkey:gm.SystemProgram.programId,isSigner:!1,isWritable:!1}),new tc.TransactionInstruction({programId:this.programId,keys:i,data:n})}static deactivateLookupTable(e){let r=bt.LOOKUP_TABLE_INSTRUCTION_LAYOUTS.DeactivateLookupTable,n=(0,Io.encodeData)(r),i=[{pubkey:e.lookupTable,isSigner:!1,isWritable:!0},{pubkey:e.authority,isSigner:!0,isWritable:!1}];return new tc.TransactionInstruction({programId:this.programId,keys:i,data:n})}static closeLookupTable(e){let r=bt.LOOKUP_TABLE_INSTRUCTION_LAYOUTS.CloseLookupTable,n=(0,Io.encodeData)(r),i=[{pubkey:e.lookupTable,isSigner:!1,isWritable:!0},{pubkey:e.authority,isSigner:!0,isWritable:!1},{pubkey:e.recipient,isSigner:!1,isWritable:!0}];return new tc.TransactionInstruction({programId:this.programId,keys:i,data:n})}};bt.AddressLookupTableProgram=rc;rc.programId=new Zh.PublicKey("AddressLookupTab1e1111111111111111111111111")});var ud=L(Mt=>{"use strict";E();I();var V9=Mt&&Mt.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),W9=Mt&&Mt.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$9=Mt&&Mt.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&V9(e,t,r);return W9(e,t),e};Object.defineProperty(Mt,"__esModule",{value:!0});Mt.ComputeBudgetProgram=Mt.COMPUTE_BUDGET_INSTRUCTION_LAYOUTS=Mt.ComputeBudgetInstruction=void 0;var Xr=$9(Xt()),As=$u(),G9=Zr(),ad=Qu(),Y9=Wu(),Xh=class{constructor(){}static decodeInstructionType(e){this.checkProgramId(e.programId);let n=Xr.u8("instruction").decode(e.data),i;for(let[o,a]of Object.entries(Mt.COMPUTE_BUDGET_INSTRUCTION_LAYOUTS))if(a.index==n){i=o;break}if(!i)throw new Error("Instruction type incorrect; not a ComputeBudgetInstruction");return i}static decodeRequestUnits(e){this.checkProgramId(e.programId);let{units:r,additionalFee:n}=(0,As.decodeData)(Mt.COMPUTE_BUDGET_INSTRUCTION_LAYOUTS.RequestUnits,e.data);return{units:r,additionalFee:n}}static decodeRequestHeapFrame(e){this.checkProgramId(e.programId);let{bytes:r}=(0,As.decodeData)(Mt.COMPUTE_BUDGET_INSTRUCTION_LAYOUTS.RequestHeapFrame,e.data);return{bytes:r}}static decodeSetComputeUnitLimit(e){this.checkProgramId(e.programId);let{units:r}=(0,As.decodeData)(Mt.COMPUTE_BUDGET_INSTRUCTION_LAYOUTS.SetComputeUnitLimit,e.data);return{units:r}}static decodeSetComputeUnitPrice(e){this.checkProgramId(e.programId);let{microLamports:r}=(0,As.decodeData)(Mt.COMPUTE_BUDGET_INSTRUCTION_LAYOUTS.SetComputeUnitPrice,e.data);return{microLamports:r}}static checkProgramId(e){if(!e.equals(nc.programId))throw new Error("invalid instruction; programId is not ComputeBudgetProgram")}};Mt.ComputeBudgetInstruction=Xh;Mt.COMPUTE_BUDGET_INSTRUCTION_LAYOUTS=Object.freeze({RequestUnits:{index:0,layout:Xr.struct([Xr.u8("instruction"),Xr.u32("units"),Xr.u32("additionalFee")])},RequestHeapFrame:{index:1,layout:Xr.struct([Xr.u8("instruction"),Xr.u32("bytes")])},SetComputeUnitLimit:{index:2,layout:Xr.struct([Xr.u8("instruction"),Xr.u32("units")])},SetComputeUnitPrice:{index:3,layout:Xr.struct([Xr.u8("instruction"),(0,Y9.u64)("microLamports")])}});var nc=class{constructor(){}static requestUnits(e){let r=Mt.COMPUTE_BUDGET_INSTRUCTION_LAYOUTS.RequestUnits,n=(0,As.encodeData)(r,e);return new ad.TransactionInstruction({keys:[],programId:this.programId,data:n})}static requestHeapFrame(e){let r=Mt.COMPUTE_BUDGET_INSTRUCTION_LAYOUTS.RequestHeapFrame,n=(0,As.encodeData)(r,e);return new ad.TransactionInstruction({keys:[],programId:this.programId,data:n})}static setComputeUnitLimit(e){let r=Mt.COMPUTE_BUDGET_INSTRUCTION_LAYOUTS.SetComputeUnitLimit,n=(0,As.encodeData)(r,e);return new ad.TransactionInstruction({keys:[],programId:this.programId,data:n})}static setComputeUnitPrice(e){let r=Mt.COMPUTE_BUDGET_INSTRUCTION_LAYOUTS.SetComputeUnitPrice,n=(0,As.encodeData)(r,{microLamports:BigInt(e.microLamports)});return new ad.TransactionInstruction({keys:[],programId:this.programId,data:n})}};Mt.ComputeBudgetProgram=nc;nc.programId=new G9.PublicKey("ComputeBudget111111111111111111111111111111")});var vm=L(Ci=>{"use strict";E();I();var Z9=Ci&&Ci.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Jh=Ci&&Ci.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Z9(e,t,r)};Object.defineProperty(Ci,"__esModule",{value:!0});Jh(mm(),Ci);Jh(Wh(),Ci);Jh(ud(),Ci)});var St=L(ir=>{"use strict";E();I();var X9=ir&&ir.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),zi=ir&&ir.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&X9(e,t,r)};Object.defineProperty(ir,"__esModule",{value:!0});ir.LAMPORTS_PER_SOL=void 0;zi(_y(),ir);zi(Ph(),ir);zi(Ky(),ir);zi(Jf(),ir);zi(Ch(),ir);zi(vm(),ir);zi(Zr(),ir);zi(Qu(),ir);zi(zh(),ir);ir.LAMPORTS_PER_SOL=1e9});var mi=L(Er=>{"use strict";E();I();Object.defineProperty(Er,"__esModule",{value:!0});Er.programSupportsExtensions=Er.NATIVE_MINT_2022=Er.NATIVE_MINT=Er.ASSOCIATED_TOKEN_PROGRAM_ID=Er.TOKEN_2022_PROGRAM_ID=Er.TOKEN_PROGRAM_ID=void 0;var ic=St();Er.TOKEN_PROGRAM_ID=new ic.PublicKey("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA");Er.TOKEN_2022_PROGRAM_ID=new ic.PublicKey("TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb");Er.ASSOCIATED_TOKEN_PROGRAM_ID=new ic.PublicKey("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL");Er.NATIVE_MINT=new ic.PublicKey("So11111111111111111111111111111111111111112");Er.NATIVE_MINT_2022=new ic.PublicKey("9pan9bMn5HatX4EJdBwg9VgCa7Uz5HL8N1m5D3NdXejP");function J9(t){return t!==Er.TOKEN_PROGRAM_ID}Er.programSupportsExtensions=J9});var Fi=L(wt=>{"use strict";E();I();Object.defineProperty(wt,"__esModule",{value:!0});wt.TokenInvalidInstructionTypeError=wt.TokenInvalidInstructionDataError=wt.TokenInvalidInstructionKeysError=wt.TokenInvalidInstructionProgramError=wt.TokenOwnerOffCurveError=wt.TokenInvalidOwnerError=wt.TokenInvalidMintError=wt.TokenInvalidAccountSizeError=wt.TokenInvalidAccountOwnerError=wt.TokenAccountNotFoundError=wt.TokenError=void 0;var Jr=class extends Error{constructor(e){super(e)}};wt.TokenError=Jr;var Qh=class extends Jr{constructor(){super(...arguments),this.name="TokenAccountNotFoundError"}};wt.TokenAccountNotFoundError=Qh;var e0=class extends Jr{constructor(){super(...arguments),this.name="TokenInvalidAccountOwnerError"}};wt.TokenInvalidAccountOwnerError=e0;var t0=class extends Jr{constructor(){super(...arguments),this.name="TokenInvalidAccountSizeError"}};wt.TokenInvalidAccountSizeError=t0;var r0=class extends Jr{constructor(){super(...arguments),this.name="TokenInvalidMintError"}};wt.TokenInvalidMintError=r0;var n0=class extends Jr{constructor(){super(...arguments),this.name="TokenInvalidOwnerError"}};wt.TokenInvalidOwnerError=n0;var i0=class extends Jr{constructor(){super(...arguments),this.name="TokenOwnerOffCurveError"}};wt.TokenOwnerOffCurveError=i0;var s0=class extends Jr{constructor(){super(...arguments),this.name="TokenInvalidInstructionProgramError"}};wt.TokenInvalidInstructionProgramError=s0;var o0=class extends Jr{constructor(){super(...arguments),this.name="TokenInvalidInstructionKeysError"}};wt.TokenInvalidInstructionKeysError=o0;var a0=class extends Jr{constructor(){super(...arguments),this.name="TokenInvalidInstructionDataError"}};wt.TokenInvalidInstructionDataError=a0;var u0=class extends Jr{constructor(){super(...arguments),this.name="TokenInvalidInstructionTypeError"}};wt.TokenInvalidInstructionTypeError=u0});var Ps=L(sc=>{"use strict";E();I();Object.defineProperty(sc,"__esModule",{value:!0});sc.TokenInstruction=void 0;var Q9;(function(t){t[t.InitializeMint=0]="InitializeMint",t[t.InitializeAccount=1]="InitializeAccount",t[t.InitializeMultisig=2]="InitializeMultisig",t[t.Transfer=3]="Transfer",t[t.Approve=4]="Approve",t[t.Revoke=5]="Revoke",t[t.SetAuthority=6]="SetAuthority",t[t.MintTo=7]="MintTo",t[t.Burn=8]="Burn",t[t.CloseAccount=9]="CloseAccount",t[t.FreezeAccount=10]="FreezeAccount",t[t.ThawAccount=11]="ThawAccount",t[t.TransferChecked=12]="TransferChecked",t[t.ApproveChecked=13]="ApproveChecked",t[t.MintToChecked=14]="MintToChecked",t[t.BurnChecked=15]="BurnChecked",t[t.InitializeAccount2=16]="InitializeAccount2",t[t.SyncNative=17]="SyncNative",t[t.InitializeAccount3=18]="InitializeAccount3",t[t.InitializeMultisig2=19]="InitializeMultisig2",t[t.InitializeMint2=20]="InitializeMint2"})(Q9=sc.TokenInstruction||(sc.TokenInstruction={}))});var xo=L(cd=>{"use strict";E();I();Object.defineProperty(cd,"__esModule",{value:!0});cd.addSigners=void 0;var eS=St();function tS(t,e,r){if(r.length){t.push({pubkey:e,isSigner:!1,isWritable:!1});for(let n of r)t.push({pubkey:n instanceof eS.PublicKey?n:n.publicKey,isSigner:!0,isWritable:!1})}else t.push({pubkey:e,isSigner:!0,isWritable:!1});return t}cd.addSigners=tS});var Mm=L(Kr=>{"use strict";E();I();Object.defineProperty(Kr,"__esModule",{value:!0});Kr.decodeTransferInstructionUnchecked=Kr.decodeTransferInstruction=Kr.createTransferInstruction=Kr.transferInstructionData=void 0;var c0=Xt(),rS=St(),wm=mi(),fd=Fi(),nS=xo(),_m=Ps();Kr.transferInstructionData=(0,c0.struct)([(0,c0.u8)("instruction"),(0,c0.u64)("amount")]);function iS(t,e,r,n,i=[],o=wm.TOKEN_PROGRAM_ID){let a=(0,nS.addSigners)([{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:e,isSigner:!1,isWritable:!0}],r,i),c=B.Buffer.alloc(Kr.transferInstructionData.span);return Kr.transferInstructionData.encode({instruction:_m.TokenInstruction.Transfer,amount:BigInt(n)},c),new rS.TransactionInstruction({keys:a,programId:o,data:c})}Kr.createTransferInstruction=iS;function sS(t,e=wm.TOKEN_PROGRAM_ID){if(!t.programId.equals(e))throw new fd.TokenInvalidInstructionProgramError;if(t.data.length!==Kr.transferInstructionData.span)throw new fd.TokenInvalidInstructionDataError;let{keys:{source:r,destination:n,owner:i,multiSigners:o},data:a}=Sm(t);if(a.instruction!==_m.TokenInstruction.Transfer)throw new fd.TokenInvalidInstructionTypeError;if(!r||!n||!i)throw new fd.TokenInvalidInstructionKeysError;return{programId:e,keys:{source:r,destination:n,owner:i,multiSigners:o},data:a}}Kr.decodeTransferInstruction=sS;function Sm({programId:t,keys:[e,r,n,...i],data:o}){return{programId:t,keys:{source:e,destination:r,owner:n,multiSigners:i},data:Kr.transferInstructionData.decode(o)}}Kr.decodeTransferInstructionUnchecked=Sm});var Am=L(Dr=>{"use strict";E();I();Object.defineProperty(Dr,"__esModule",{value:!0});Dr.decodeTransferCheckedInstructionUnchecked=Dr.decodeTransferCheckedInstruction=Dr.createTransferCheckedInstruction=Dr.transferCheckedInstructionData=void 0;var dd=Xt(),oS=St(),Em=mi(),ld=Fi(),aS=xo(),Im=Ps();Dr.transferCheckedInstructionData=(0,dd.struct)([(0,dd.u8)("instruction"),(0,dd.u64)("amount"),(0,dd.u8)("decimals")]);function uS(t,e,r,n,i,o,a=[],c=Em.TOKEN_PROGRAM_ID){let l=(0,aS.addSigners)([{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:e,isSigner:!1,isWritable:!1},{pubkey:r,isSigner:!1,isWritable:!0}],n,a),m=B.Buffer.alloc(Dr.transferCheckedInstructionData.span);return Dr.transferCheckedInstructionData.encode({instruction:Im.TokenInstruction.TransferChecked,amount:BigInt(i),decimals:o},m),new oS.TransactionInstruction({keys:l,programId:c,data:m})}Dr.createTransferCheckedInstruction=uS;function cS(t,e=Em.TOKEN_PROGRAM_ID){if(!t.programId.equals(e))throw new ld.TokenInvalidInstructionProgramError;if(t.data.length!==Dr.transferCheckedInstructionData.span)throw new ld.TokenInvalidInstructionDataError;let{keys:{source:r,mint:n,destination:i,owner:o,multiSigners:a},data:c}=xm(t);if(c.instruction!==Im.TokenInstruction.TransferChecked)throw new ld.TokenInvalidInstructionTypeError;if(!r||!n||!i||!o)throw new ld.TokenInvalidInstructionKeysError;return{programId:e,keys:{source:r,mint:n,destination:i,owner:o,multiSigners:a},data:c}}Dr.decodeTransferCheckedInstruction=cS;function xm({programId:t,keys:[e,r,n,i,...o],data:a}){return{programId:t,keys:{source:e,mint:r,destination:n,owner:i,multiSigners:o},data:Dr.transferCheckedInstructionData.decode(a)}}Dr.decodeTransferCheckedInstructionUnchecked=xm});var Bm=L(hd=>{"use strict";E();I();Object.defineProperty(hd,"__esModule",{value:!0});hd.createAssociatedTokenAccountInstruction=void 0;var f0=St(),Pm=mi();function fS(t,e,r,n,i=Pm.TOKEN_PROGRAM_ID,o=Pm.ASSOCIATED_TOKEN_PROGRAM_ID){let a=[{pubkey:t,isSigner:!0,isWritable:!0},{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!1,isWritable:!1},{pubkey:f0.SystemProgram.programId,isSigner:!1,isWritable:!1},{pubkey:i,isSigner:!1,isWritable:!1},{pubkey:f0.SYSVAR_RENT_PUBKEY,isSigner:!1,isWritable:!1}];return new f0.TransactionInstruction({keys:a,programId:o,data:B.Buffer.alloc(0)})}hd.createAssociatedTokenAccountInstruction=fS});var qm=L(Rr=>{"use strict";E();I();Object.defineProperty(Rr,"__esModule",{value:!0});Rr.decodeBurnInstructionUnchecked=Rr.decodeBurnInstruction=Rr.createBurnInstruction=Rr.burnInstructionData=void 0;var d0=Xt(),dS=St(),Tm=mi(),bd=Fi(),lS=xo(),Om=Ps();Rr.burnInstructionData=(0,d0.struct)([(0,d0.u8)("instruction"),(0,d0.u64)("amount")]);function hS(t,e,r,n,i=[],o=Tm.TOKEN_PROGRAM_ID){let a=(0,lS.addSigners)([{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:e,isSigner:!1,isWritable:!0}],r,i),c=B.Buffer.alloc(Rr.burnInstructionData.span);return Rr.burnInstructionData.encode({instruction:Om.TokenInstruction.Burn,amount:BigInt(n)},c),new dS.TransactionInstruction({keys:a,programId:o,data:c})}Rr.createBurnInstruction=hS;function bS(t,e=Tm.TOKEN_PROGRAM_ID){if(!t.programId.equals(e))throw new bd.TokenInvalidInstructionProgramError;if(t.data.length!==Rr.burnInstructionData.span)throw new bd.TokenInvalidInstructionDataError;let{keys:{account:r,mint:n,owner:i,multiSigners:o},data:a}=km(t);if(a.instruction!==Om.TokenInstruction.Burn)throw new bd.TokenInvalidInstructionTypeError;if(!r||!n||!i)throw new bd.TokenInvalidInstructionKeysError;return{programId:e,keys:{account:r,mint:n,owner:i,multiSigners:o},data:a}}Rr.decodeBurnInstruction=bS;function km({programId:t,keys:[e,r,n,...i],data:o}){return{programId:t,keys:{account:e,mint:r,owner:n,multiSigners:i},data:Rr.burnInstructionData.decode(o)}}Rr.decodeBurnInstructionUnchecked=km});var Dm=L(Ur=>{"use strict";E();I();Object.defineProperty(Ur,"__esModule",{value:!0});Ur.decodeBurnCheckedInstructionUnchecked=Ur.decodeBurnCheckedInstruction=Ur.createBurnCheckedInstruction=Ur.burnCheckedInstructionData=void 0;var pd=Xt(),pS=St(),Nm=mi(),gd=Fi(),gS=xo(),Lm=Ps();Ur.burnCheckedInstructionData=(0,pd.struct)([(0,pd.u8)("instruction"),(0,pd.u64)("amount"),(0,pd.u8)("decimals")]);function yS(t,e,r,n,i,o=[],a=Nm.TOKEN_PROGRAM_ID){let c=(0,gS.addSigners)([{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:e,isSigner:!1,isWritable:!0}],r,o),l=B.Buffer.alloc(Ur.burnCheckedInstructionData.span);return Ur.burnCheckedInstructionData.encode({instruction:Lm.TokenInstruction.BurnChecked,amount:BigInt(n),decimals:i},l),new pS.TransactionInstruction({keys:c,programId:a,data:l})}Ur.createBurnCheckedInstruction=yS;function mS(t,e=Nm.TOKEN_PROGRAM_ID){if(!t.programId.equals(e))throw new gd.TokenInvalidInstructionProgramError;if(t.data.length!==Ur.burnCheckedInstructionData.span)throw new gd.TokenInvalidInstructionDataError;let{keys:{account:r,mint:n,owner:i,multiSigners:o},data:a}=Km(t);if(a.instruction!==Lm.TokenInstruction.BurnChecked)throw new gd.TokenInvalidInstructionTypeError;if(!r||!n||!i)throw new gd.TokenInvalidInstructionKeysError;return{programId:e,keys:{account:r,mint:n,owner:i,multiSigners:o},data:a}}Ur.decodeBurnCheckedInstruction=mS;function Km({programId:t,keys:[e,r,n,...i],data:o}){return{programId:t,keys:{account:e,mint:r,owner:n,multiSigners:i},data:Ur.burnCheckedInstructionData.decode(o)}}Ur.decodeBurnCheckedInstructionUnchecked=Km});var Cm=L(jr=>{"use strict";E();I();Object.defineProperty(jr,"__esModule",{value:!0});jr.decodeMintToInstructionUnchecked=jr.decodeMintToInstruction=jr.createMintToInstruction=jr.mintToInstructionData=void 0;var l0=Xt(),vS=St(),Rm=mi(),yd=Fi(),wS=xo(),Um=Ps();jr.mintToInstructionData=(0,l0.struct)([(0,l0.u8)("instruction"),(0,l0.u64)("amount")]);function _S(t,e,r,n,i=[],o=Rm.TOKEN_PROGRAM_ID){let a=(0,wS.addSigners)([{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:e,isSigner:!1,isWritable:!0}],r,i),c=B.Buffer.alloc(jr.mintToInstructionData.span);return jr.mintToInstructionData.encode({instruction:Um.TokenInstruction.MintTo,amount:BigInt(n)},c),new vS.TransactionInstruction({keys:a,programId:o,data:c})}jr.createMintToInstruction=_S;function SS(t,e=Rm.TOKEN_PROGRAM_ID){if(!t.programId.equals(e))throw new yd.TokenInvalidInstructionProgramError;if(t.data.length!==jr.mintToInstructionData.span)throw new yd.TokenInvalidInstructionDataError;let{keys:{mint:r,destination:n,authority:i,multiSigners:o},data:a}=jm(t);if(a.instruction!==Um.TokenInstruction.MintTo)throw new yd.TokenInvalidInstructionTypeError;if(!r||!n||!i)throw new yd.TokenInvalidInstructionKeysError;return{programId:e,keys:{mint:r,destination:n,authority:i,multiSigners:o},data:a}}jr.decodeMintToInstruction=SS;function jm({programId:t,keys:[e,r,n,...i],data:o}){return{programId:t,keys:{mint:e,destination:r,authority:n,multiSigners:i},data:jr.mintToInstructionData.decode(o)}}jr.decodeMintToInstructionUnchecked=jm});var Vm=L(Cr=>{"use strict";E();I();Object.defineProperty(Cr,"__esModule",{value:!0});Cr.decodeMintToCheckedInstructionUnchecked=Cr.decodeMintToCheckedInstruction=Cr.createMintToCheckedInstruction=Cr.mintToCheckedInstructionData=void 0;var md=Xt(),MS=St(),zm=mi(),vd=Fi(),ES=xo(),Fm=Ps();Cr.mintToCheckedInstructionData=(0,md.struct)([(0,md.u8)("instruction"),(0,md.u64)("amount"),(0,md.u8)("decimals")]);function IS(t,e,r,n,i,o=[],a=zm.TOKEN_PROGRAM_ID){let c=(0,ES.addSigners)([{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:e,isSigner:!1,isWritable:!0}],r,o),l=B.Buffer.alloc(Cr.mintToCheckedInstructionData.span);return Cr.mintToCheckedInstructionData.encode({instruction:Fm.TokenInstruction.MintToChecked,amount:BigInt(n),decimals:i},l),new MS.TransactionInstruction({keys:c,programId:a,data:l})}Cr.createMintToCheckedInstruction=IS;function xS(t,e=zm.TOKEN_PROGRAM_ID){if(!t.programId.equals(e))throw new vd.TokenInvalidInstructionProgramError;if(t.data.length!==Cr.mintToCheckedInstructionData.span)throw new vd.TokenInvalidInstructionDataError;let{keys:{mint:r,destination:n,authority:i,multiSigners:o},data:a}=Hm(t);if(a.instruction!==Fm.TokenInstruction.MintToChecked)throw new vd.TokenInvalidInstructionTypeError;if(!r||!n||!i)throw new vd.TokenInvalidInstructionKeysError;return{programId:e,keys:{mint:r,destination:n,authority:i,multiSigners:o},data:a}}Cr.decodeMintToCheckedInstruction=xS;function Hm({programId:t,keys:[e,r,n,...i],data:o}){return{programId:t,keys:{mint:e,destination:r,authority:n,multiSigners:i},data:Cr.mintToCheckedInstructionData.decode(o)}}Cr.decodeMintToCheckedInstructionUnchecked=Hm});var Wm=L(zr=>{"use strict";E();I();var AS=zr&&zr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Bs=zr&&zr.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&AS(e,t,r)};Object.defineProperty(zr,"__esModule",{value:!0});Bs(Ps(),zr);Bs(Mm(),zr);Bs(Am(),zr);Bs(Bm(),zr);Bs(qm(),zr);Bs(Dm(),zr);Bs(Cm(),zr);Bs(Vm(),zr)});var wd=L(Wn=>{"use strict";E();I();var PS=Wn&&Wn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),h0=Wn&&Wn.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&PS(e,t,r)};Object.defineProperty(Wn,"__esModule",{value:!0});Wn.getAssociatedTokenAddress=void 0;var $m=St(),Gm=mi(),BS=Fi();h0(Wm(),Wn);h0(mi(),Wn);h0(Fi(),Wn);async function TS(t,e,r=!1,n=Gm.TOKEN_PROGRAM_ID,i=Gm.ASSOCIATED_TOKEN_PROGRAM_ID){if(!r&&!$m.PublicKey.isOnCurve(e.toBuffer()))throw new BS.TokenOwnerOffCurveError;let[o]=await $m.PublicKey.findProgramAddress([e.toBuffer(),n.toBuffer(),t.toBuffer()],i);return o}Wn.getAssociatedTokenAddress=TS});var yr=L(gr=>{"use strict";E();I();Object.defineProperty(gr,"__esModule",{value:!0});gr.isElementCollectionFixedSizeBeet=gr.isFixableBeet=gr.assertFixedSizeBeet=gr.isFixedSizeBeet=gr.BEET_TYPE_ARG_INNER=gr.BEET_TYPE_ARG_LEN=gr.BEET_PACKAGE=void 0;var OS=Jn();gr.BEET_PACKAGE="@metaplex-foundation/beet";gr.BEET_TYPE_ARG_LEN="len";gr.BEET_TYPE_ARG_INNER="Beet<{innner}>";function Ym(t){return Object.keys(t).includes("byteSize")}gr.isFixedSizeBeet=Ym;function kS(t,e=`${t} should have been a fixed beet`){(0,OS.strict)(Ym(t),e)}gr.assertFixedSizeBeet=kS;function qS(t){return typeof t.toFixedFromData=="function"&&typeof t.toFixedFromValue=="function"}gr.isFixableBeet=qS;function NS(t){let e=Object.keys(t);return e.includes("length")&&e.includes("elementByteSize")&&e.includes("lenPrefixByteSize")}gr.isElementCollectionFixedSizeBeet=NS});var Xm=L((Zm,b0)=>{E();I();(function(t,e){"use strict";function r(h,s){if(!h)throw new Error(s||"Assertion failed")}function n(h,s){h.super_=s;var u=function(){};u.prototype=s.prototype,h.prototype=new u,h.prototype.constructor=h}function i(h,s,u){if(i.isBN(h))return h;this.negative=0,this.words=null,this.length=0,this.red=null,h!==null&&((s==="le"||s==="be")&&(u=s,s=10),this._init(h||0,s||10,u||"be"))}typeof t=="object"?t.exports=i:e.BN=i,i.BN=i,i.wordSize=26;var o;try{typeof window<"u"&&typeof window.Buffer<"u"?o=window.Buffer:o=Pr().Buffer}catch{}i.isBN=function(s){return s instanceof i?!0:s!==null&&typeof s=="object"&&s.constructor.wordSize===i.wordSize&&Array.isArray(s.words)},i.max=function(s,u){return s.cmp(u)>0?s:u},i.min=function(s,u){return s.cmp(u)<0?s:u},i.prototype._init=function(s,u,b){if(typeof s=="number")return this._initNumber(s,u,b);if(typeof s=="object")return this._initArray(s,u,b);u==="hex"&&(u=16),r(u===(u|0)&&u>=2&&u<=36),s=s.toString().replace(/\s+/g,"");var y=0;s[0]==="-"&&(y++,this.negative=1),y<s.length&&(u===16?this._parseHex(s,y,b):(this._parseBase(s,u,y),b==="le"&&this._initArray(this.toArray(),u,b)))},i.prototype._initNumber=function(s,u,b){s<0&&(this.negative=1,s=-s),s<67108864?(this.words=[s&67108863],this.length=1):s<4503599627370496?(this.words=[s&67108863,s/67108864&67108863],this.length=2):(r(s<9007199254740992),this.words=[s&67108863,s/67108864&67108863,1],this.length=3),b==="le"&&this._initArray(this.toArray(),u,b)},i.prototype._initArray=function(s,u,b){if(r(typeof s.length=="number"),s.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(s.length/3),this.words=new Array(this.length);for(var y=0;y<this.length;y++)this.words[y]=0;var g,d,w=0;if(b==="be")for(y=s.length-1,g=0;y>=0;y-=3)d=s[y]|s[y-1]<<8|s[y-2]<<16,this.words[g]|=d<<w&67108863,this.words[g+1]=d>>>26-w&67108863,w+=24,w>=26&&(w-=26,g++);else if(b==="le")for(y=0,g=0;y<s.length;y+=3)d=s[y]|s[y+1]<<8|s[y+2]<<16,this.words[g]|=d<<w&67108863,this.words[g+1]=d>>>26-w&67108863,w+=24,w>=26&&(w-=26,g++);return this._strip()};function a(h,s){var u=h.charCodeAt(s);if(u>=48&&u<=57)return u-48;if(u>=65&&u<=70)return u-55;if(u>=97&&u<=102)return u-87;r(!1,"Invalid character in "+h)}function c(h,s,u){var b=a(h,u);return u-1>=s&&(b|=a(h,u-1)<<4),b}i.prototype._parseHex=function(s,u,b){this.length=Math.ceil((s.length-u)/6),this.words=new Array(this.length);for(var y=0;y<this.length;y++)this.words[y]=0;var g=0,d=0,w;if(b==="be")for(y=s.length-1;y>=u;y-=2)w=c(s,u,y)<<g,this.words[d]|=w&67108863,g>=18?(g-=18,d+=1,this.words[d]|=w>>>26):g+=8;else{var A=s.length-u;for(y=A%2===0?u+1:u;y<s.length;y+=2)w=c(s,u,y)<<g,this.words[d]|=w&67108863,g>=18?(g-=18,d+=1,this.words[d]|=w>>>26):g+=8}this._strip()};function l(h,s,u,b){for(var y=0,g=0,d=Math.min(h.length,u),w=s;w<d;w++){var A=h.charCodeAt(w)-48;y*=b,A>=49?g=A-49+10:A>=17?g=A-17+10:g=A,r(A>=0&&g<b,"Invalid character"),y+=g}return y}i.prototype._parseBase=function(s,u,b){this.words=[0],this.length=1;for(var y=0,g=1;g<=67108863;g*=u)y++;y--,g=g/u|0;for(var d=s.length-b,w=d%y,A=Math.min(d,d-w)+b,p=0,O=b;O<A;O+=y)p=l(s,O,O+y,u),this.imuln(g),this.words[0]+p<67108864?this.words[0]+=p:this._iaddn(p);if(w!==0){var C=1;for(p=l(s,O,s.length,u),O=0;O<w;O++)C*=u;this.imuln(C),this.words[0]+p<67108864?this.words[0]+=p:this._iaddn(p)}this._strip()},i.prototype.copy=function(s){s.words=new Array(this.length);for(var u=0;u<this.length;u++)s.words[u]=this.words[u];s.length=this.length,s.negative=this.negative,s.red=this.red};function m(h,s){h.words=s.words,h.length=s.length,h.negative=s.negative,h.red=s.red}if(i.prototype._move=function(s){m(s,this)},i.prototype.clone=function(){var s=new i(null);return this.copy(s),s},i.prototype._expand=function(s){for(;this.length<s;)this.words[this.length++]=0;return this},i.prototype._strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},i.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{i.prototype[Symbol.for("nodejs.util.inspect.custom")]=S}catch{i.prototype.inspect=S}else i.prototype.inspect=S;function S(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var _=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],P=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],x=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];i.prototype.toString=function(s,u){s=s||10,u=u|0||1;var b;if(s===16||s==="hex"){b="";for(var y=0,g=0,d=0;d<this.length;d++){var w=this.words[d],A=((w<<y|g)&16777215).toString(16);g=w>>>24-y&16777215,y+=2,y>=26&&(y-=26,d--),g!==0||d!==this.length-1?b=_[6-A.length]+A+b:b=A+b}for(g!==0&&(b=g.toString(16)+b);b.length%u!==0;)b="0"+b;return this.negative!==0&&(b="-"+b),b}if(s===(s|0)&&s>=2&&s<=36){var p=P[s],O=x[s];b="";var C=this.clone();for(C.negative=0;!C.isZero();){var F=C.modrn(O).toString(s);C=C.idivn(O),C.isZero()?b=F+b:b=_[p-F.length]+F+b}for(this.isZero()&&(b="0"+b);b.length%u!==0;)b="0"+b;return this.negative!==0&&(b="-"+b),b}r(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var s=this.words[0];return this.length===2?s+=this.words[1]*67108864:this.length===3&&this.words[2]===1?s+=4503599627370496+this.words[1]*67108864:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-s:s},i.prototype.toJSON=function(){return this.toString(16,2)},o&&(i.prototype.toBuffer=function(s,u){return this.toArrayLike(o,s,u)}),i.prototype.toArray=function(s,u){return this.toArrayLike(Array,s,u)};var T=function(s,u){return s.allocUnsafe?s.allocUnsafe(u):new s(u)};i.prototype.toArrayLike=function(s,u,b){this._strip();var y=this.byteLength(),g=b||Math.max(1,y);r(y<=g,"byte array longer than desired length"),r(g>0,"Requested array length <= 0");var d=T(s,g),w=u==="le"?"LE":"BE";return this["_toArrayLike"+w](d,y),d},i.prototype._toArrayLikeLE=function(s,u){for(var b=0,y=0,g=0,d=0;g<this.length;g++){var w=this.words[g]<<d|y;s[b++]=w&255,b<s.length&&(s[b++]=w>>8&255),b<s.length&&(s[b++]=w>>16&255),d===6?(b<s.length&&(s[b++]=w>>24&255),y=0,d=0):(y=w>>>24,d+=2)}if(b<s.length)for(s[b++]=y;b<s.length;)s[b++]=0},i.prototype._toArrayLikeBE=function(s,u){for(var b=s.length-1,y=0,g=0,d=0;g<this.length;g++){var w=this.words[g]<<d|y;s[b--]=w&255,b>=0&&(s[b--]=w>>8&255),b>=0&&(s[b--]=w>>16&255),d===6?(b>=0&&(s[b--]=w>>24&255),y=0,d=0):(y=w>>>24,d+=2)}if(b>=0)for(s[b--]=y;b>=0;)s[b--]=0},Math.clz32?i.prototype._countBits=function(s){return 32-Math.clz32(s)}:i.prototype._countBits=function(s){var u=s,b=0;return u>=4096&&(b+=13,u>>>=13),u>=64&&(b+=7,u>>>=7),u>=8&&(b+=4,u>>>=4),u>=2&&(b+=2,u>>>=2),b+u},i.prototype._zeroBits=function(s){if(s===0)return 26;var u=s,b=0;return(u&8191)===0&&(b+=13,u>>>=13),(u&127)===0&&(b+=7,u>>>=7),(u&15)===0&&(b+=4,u>>>=4),(u&3)===0&&(b+=2,u>>>=2),(u&1)===0&&b++,b},i.prototype.bitLength=function(){var s=this.words[this.length-1],u=this._countBits(s);return(this.length-1)*26+u};function M(h){for(var s=new Array(h.bitLength()),u=0;u<s.length;u++){var b=u/26|0,y=u%26;s[u]=h.words[b]>>>y&1}return s}i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var s=0,u=0;u<this.length;u++){var b=this._zeroBits(this.words[u]);if(s+=b,b!==26)break}return s},i.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},i.prototype.toTwos=function(s){return this.negative!==0?this.abs().inotn(s).iaddn(1):this.clone()},i.prototype.fromTwos=function(s){return this.testn(s-1)?this.notn(s).iaddn(1).ineg():this.clone()},i.prototype.isNeg=function(){return this.negative!==0},i.prototype.neg=function(){return this.clone().ineg()},i.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},i.prototype.iuor=function(s){for(;this.length<s.length;)this.words[this.length++]=0;for(var u=0;u<s.length;u++)this.words[u]=this.words[u]|s.words[u];return this._strip()},i.prototype.ior=function(s){return r((this.negative|s.negative)===0),this.iuor(s)},i.prototype.or=function(s){return this.length>s.length?this.clone().ior(s):s.clone().ior(this)},i.prototype.uor=function(s){return this.length>s.length?this.clone().iuor(s):s.clone().iuor(this)},i.prototype.iuand=function(s){var u;this.length>s.length?u=s:u=this;for(var b=0;b<u.length;b++)this.words[b]=this.words[b]&s.words[b];return this.length=u.length,this._strip()},i.prototype.iand=function(s){return r((this.negative|s.negative)===0),this.iuand(s)},i.prototype.and=function(s){return this.length>s.length?this.clone().iand(s):s.clone().iand(this)},i.prototype.uand=function(s){return this.length>s.length?this.clone().iuand(s):s.clone().iuand(this)},i.prototype.iuxor=function(s){var u,b;this.length>s.length?(u=this,b=s):(u=s,b=this);for(var y=0;y<b.length;y++)this.words[y]=u.words[y]^b.words[y];if(this!==u)for(;y<u.length;y++)this.words[y]=u.words[y];return this.length=u.length,this._strip()},i.prototype.ixor=function(s){return r((this.negative|s.negative)===0),this.iuxor(s)},i.prototype.xor=function(s){return this.length>s.length?this.clone().ixor(s):s.clone().ixor(this)},i.prototype.uxor=function(s){return this.length>s.length?this.clone().iuxor(s):s.clone().iuxor(this)},i.prototype.inotn=function(s){r(typeof s=="number"&&s>=0);var u=Math.ceil(s/26)|0,b=s%26;this._expand(u),b>0&&u--;for(var y=0;y<u;y++)this.words[y]=~this.words[y]&67108863;return b>0&&(this.words[y]=~this.words[y]&67108863>>26-b),this._strip()},i.prototype.notn=function(s){return this.clone().inotn(s)},i.prototype.setn=function(s,u){r(typeof s=="number"&&s>=0);var b=s/26|0,y=s%26;return this._expand(b+1),u?this.words[b]=this.words[b]|1<<y:this.words[b]=this.words[b]&~(1<<y),this._strip()},i.prototype.iadd=function(s){var u;if(this.negative!==0&&s.negative===0)return this.negative=0,u=this.isub(s),this.negative^=1,this._normSign();if(this.negative===0&&s.negative!==0)return s.negative=0,u=this.isub(s),s.negative=1,u._normSign();var b,y;this.length>s.length?(b=this,y=s):(b=s,y=this);for(var g=0,d=0;d<y.length;d++)u=(b.words[d]|0)+(y.words[d]|0)+g,this.words[d]=u&67108863,g=u>>>26;for(;g!==0&&d<b.length;d++)u=(b.words[d]|0)+g,this.words[d]=u&67108863,g=u>>>26;if(this.length=b.length,g!==0)this.words[this.length]=g,this.length++;else if(b!==this)for(;d<b.length;d++)this.words[d]=b.words[d];return this},i.prototype.add=function(s){var u;return s.negative!==0&&this.negative===0?(s.negative=0,u=this.sub(s),s.negative^=1,u):s.negative===0&&this.negative!==0?(this.negative=0,u=s.sub(this),this.negative=1,u):this.length>s.length?this.clone().iadd(s):s.clone().iadd(this)},i.prototype.isub=function(s){if(s.negative!==0){s.negative=0;var u=this.iadd(s);return s.negative=1,u._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(s),this.negative=1,this._normSign();var b=this.cmp(s);if(b===0)return this.negative=0,this.length=1,this.words[0]=0,this;var y,g;b>0?(y=this,g=s):(y=s,g=this);for(var d=0,w=0;w<g.length;w++)u=(y.words[w]|0)-(g.words[w]|0)+d,d=u>>26,this.words[w]=u&67108863;for(;d!==0&&w<y.length;w++)u=(y.words[w]|0)+d,d=u>>26,this.words[w]=u&67108863;if(d===0&&w<y.length&&y!==this)for(;w<y.length;w++)this.words[w]=y.words[w];return this.length=Math.max(this.length,w),y!==this&&(this.negative=1),this._strip()},i.prototype.sub=function(s){return this.clone().isub(s)};function k(h,s,u){u.negative=s.negative^h.negative;var b=h.length+s.length|0;u.length=b,b=b-1|0;var y=h.words[0]|0,g=s.words[0]|0,d=y*g,w=d&67108863,A=d/67108864|0;u.words[0]=w;for(var p=1;p<b;p++){for(var O=A>>>26,C=A&67108863,F=Math.min(p,s.length-1),W=Math.max(0,p-h.length+1);W<=F;W++){var X=p-W|0;y=h.words[X]|0,g=s.words[W]|0,d=y*g+C,O+=d/67108864|0,C=d&67108863}u.words[p]=C|0,A=O|0}return A!==0?u.words[p]=A|0:u.length--,u._strip()}var N=function(s,u,b){var y=s.words,g=u.words,d=b.words,w=0,A,p,O,C=y[0]|0,F=C&8191,W=C>>>13,X=y[1]|0,ee=X&8191,te=X>>>13,Vt=y[2]|0,ie=Vt&8191,ne=Vt>>>13,sn=y[3]|0,se=sn&8191,ce=sn>>>13,Gi=y[4]|0,le=Gi&8191,he=Gi>>>13,Wa=y[5]|0,be=Wa&8191,pe=Wa>>>13,$a=y[6]|0,ge=$a&8191,ye=$a>>>13,Ga=y[7]|0,me=Ga&8191,ve=Ga>>>13,Ya=y[8]|0,we=Ya&8191,_e=Ya>>>13,Za=y[9]|0,Se=Za&8191,Me=Za>>>13,Xa=g[0]|0,Ee=Xa&8191,Ie=Xa>>>13,Ja=g[1]|0,xe=Ja&8191,Ae=Ja>>>13,Qa=g[2]|0,Pe=Qa&8191,Be=Qa>>>13,eu=g[3]|0,Te=eu&8191,Oe=eu>>>13,tu=g[4]|0,ke=tu&8191,qe=tu>>>13,ru=g[5]|0,Ne=ru&8191,Le=ru>>>13,nu=g[6]|0,Ke=nu&8191,De=nu>>>13,iu=g[7]|0,Re=iu&8191,Ue=iu>>>13,su=g[8]|0,je=su&8191,Ce=su>>>13,qo=g[9]|0,gt=qo&8191,yt=qo>>>13;b.negative=s.negative^u.negative,b.length=19,A=Math.imul(F,Ee),p=Math.imul(F,Ie),p=p+Math.imul(W,Ee)|0,O=Math.imul(W,Ie);var Rs=(w+A|0)+((p&8191)<<13)|0;w=(O+(p>>>13)|0)+(Rs>>>26)|0,Rs&=67108863,A=Math.imul(ee,Ee),p=Math.imul(ee,Ie),p=p+Math.imul(te,Ee)|0,O=Math.imul(te,Ie),A=A+Math.imul(F,xe)|0,p=p+Math.imul(F,Ae)|0,p=p+Math.imul(W,xe)|0,O=O+Math.imul(W,Ae)|0;var Us=(w+A|0)+((p&8191)<<13)|0;w=(O+(p>>>13)|0)+(Us>>>26)|0,Us&=67108863,A=Math.imul(ie,Ee),p=Math.imul(ie,Ie),p=p+Math.imul(ne,Ee)|0,O=Math.imul(ne,Ie),A=A+Math.imul(ee,xe)|0,p=p+Math.imul(ee,Ae)|0,p=p+Math.imul(te,xe)|0,O=O+Math.imul(te,Ae)|0,A=A+Math.imul(F,Pe)|0,p=p+Math.imul(F,Be)|0,p=p+Math.imul(W,Pe)|0,O=O+Math.imul(W,Be)|0;var js=(w+A|0)+((p&8191)<<13)|0;w=(O+(p>>>13)|0)+(js>>>26)|0,js&=67108863,A=Math.imul(se,Ee),p=Math.imul(se,Ie),p=p+Math.imul(ce,Ee)|0,O=Math.imul(ce,Ie),A=A+Math.imul(ie,xe)|0,p=p+Math.imul(ie,Ae)|0,p=p+Math.imul(ne,xe)|0,O=O+Math.imul(ne,Ae)|0,A=A+Math.imul(ee,Pe)|0,p=p+Math.imul(ee,Be)|0,p=p+Math.imul(te,Pe)|0,O=O+Math.imul(te,Be)|0,A=A+Math.imul(F,Te)|0,p=p+Math.imul(F,Oe)|0,p=p+Math.imul(W,Te)|0,O=O+Math.imul(W,Oe)|0;var Cs=(w+A|0)+((p&8191)<<13)|0;w=(O+(p>>>13)|0)+(Cs>>>26)|0,Cs&=67108863,A=Math.imul(le,Ee),p=Math.imul(le,Ie),p=p+Math.imul(he,Ee)|0,O=Math.imul(he,Ie),A=A+Math.imul(se,xe)|0,p=p+Math.imul(se,Ae)|0,p=p+Math.imul(ce,xe)|0,O=O+Math.imul(ce,Ae)|0,A=A+Math.imul(ie,Pe)|0,p=p+Math.imul(ie,Be)|0,p=p+Math.imul(ne,Pe)|0,O=O+Math.imul(ne,Be)|0,A=A+Math.imul(ee,Te)|0,p=p+Math.imul(ee,Oe)|0,p=p+Math.imul(te,Te)|0,O=O+Math.imul(te,Oe)|0,A=A+Math.imul(F,ke)|0,p=p+Math.imul(F,qe)|0,p=p+Math.imul(W,ke)|0,O=O+Math.imul(W,qe)|0;var zs=(w+A|0)+((p&8191)<<13)|0;w=(O+(p>>>13)|0)+(zs>>>26)|0,zs&=67108863,A=Math.imul(be,Ee),p=Math.imul(be,Ie),p=p+Math.imul(pe,Ee)|0,O=Math.imul(pe,Ie),A=A+Math.imul(le,xe)|0,p=p+Math.imul(le,Ae)|0,p=p+Math.imul(he,xe)|0,O=O+Math.imul(he,Ae)|0,A=A+Math.imul(se,Pe)|0,p=p+Math.imul(se,Be)|0,p=p+Math.imul(ce,Pe)|0,O=O+Math.imul(ce,Be)|0,A=A+Math.imul(ie,Te)|0,p=p+Math.imul(ie,Oe)|0,p=p+Math.imul(ne,Te)|0,O=O+Math.imul(ne,Oe)|0,A=A+Math.imul(ee,ke)|0,p=p+Math.imul(ee,qe)|0,p=p+Math.imul(te,ke)|0,O=O+Math.imul(te,qe)|0,A=A+Math.imul(F,Ne)|0,p=p+Math.imul(F,Le)|0,p=p+Math.imul(W,Ne)|0,O=O+Math.imul(W,Le)|0;var Fs=(w+A|0)+((p&8191)<<13)|0;w=(O+(p>>>13)|0)+(Fs>>>26)|0,Fs&=67108863,A=Math.imul(ge,Ee),p=Math.imul(ge,Ie),p=p+Math.imul(ye,Ee)|0,O=Math.imul(ye,Ie),A=A+Math.imul(be,xe)|0,p=p+Math.imul(be,Ae)|0,p=p+Math.imul(pe,xe)|0,O=O+Math.imul(pe,Ae)|0,A=A+Math.imul(le,Pe)|0,p=p+Math.imul(le,Be)|0,p=p+Math.imul(he,Pe)|0,O=O+Math.imul(he,Be)|0,A=A+Math.imul(se,Te)|0,p=p+Math.imul(se,Oe)|0,p=p+Math.imul(ce,Te)|0,O=O+Math.imul(ce,Oe)|0,A=A+Math.imul(ie,ke)|0,p=p+Math.imul(ie,qe)|0,p=p+Math.imul(ne,ke)|0,O=O+Math.imul(ne,qe)|0,A=A+Math.imul(ee,Ne)|0,p=p+Math.imul(ee,Le)|0,p=p+Math.imul(te,Ne)|0,O=O+Math.imul(te,Le)|0,A=A+Math.imul(F,Ke)|0,p=p+Math.imul(F,De)|0,p=p+Math.imul(W,Ke)|0,O=O+Math.imul(W,De)|0;var Hs=(w+A|0)+((p&8191)<<13)|0;w=(O+(p>>>13)|0)+(Hs>>>26)|0,Hs&=67108863,A=Math.imul(me,Ee),p=Math.imul(me,Ie),p=p+Math.imul(ve,Ee)|0,O=Math.imul(ve,Ie),A=A+Math.imul(ge,xe)|0,p=p+Math.imul(ge,Ae)|0,p=p+Math.imul(ye,xe)|0,O=O+Math.imul(ye,Ae)|0,A=A+Math.imul(be,Pe)|0,p=p+Math.imul(be,Be)|0,p=p+Math.imul(pe,Pe)|0,O=O+Math.imul(pe,Be)|0,A=A+Math.imul(le,Te)|0,p=p+Math.imul(le,Oe)|0,p=p+Math.imul(he,Te)|0,O=O+Math.imul(he,Oe)|0,A=A+Math.imul(se,ke)|0,p=p+Math.imul(se,qe)|0,p=p+Math.imul(ce,ke)|0,O=O+Math.imul(ce,qe)|0,A=A+Math.imul(ie,Ne)|0,p=p+Math.imul(ie,Le)|0,p=p+Math.imul(ne,Ne)|0,O=O+Math.imul(ne,Le)|0,A=A+Math.imul(ee,Ke)|0,p=p+Math.imul(ee,De)|0,p=p+Math.imul(te,Ke)|0,O=O+Math.imul(te,De)|0,A=A+Math.imul(F,Re)|0,p=p+Math.imul(F,Ue)|0,p=p+Math.imul(W,Re)|0,O=O+Math.imul(W,Ue)|0;var Vs=(w+A|0)+((p&8191)<<13)|0;w=(O+(p>>>13)|0)+(Vs>>>26)|0,Vs&=67108863,A=Math.imul(we,Ee),p=Math.imul(we,Ie),p=p+Math.imul(_e,Ee)|0,O=Math.imul(_e,Ie),A=A+Math.imul(me,xe)|0,p=p+Math.imul(me,Ae)|0,p=p+Math.imul(ve,xe)|0,O=O+Math.imul(ve,Ae)|0,A=A+Math.imul(ge,Pe)|0,p=p+Math.imul(ge,Be)|0,p=p+Math.imul(ye,Pe)|0,O=O+Math.imul(ye,Be)|0,A=A+Math.imul(be,Te)|0,p=p+Math.imul(be,Oe)|0,p=p+Math.imul(pe,Te)|0,O=O+Math.imul(pe,Oe)|0,A=A+Math.imul(le,ke)|0,p=p+Math.imul(le,qe)|0,p=p+Math.imul(he,ke)|0,O=O+Math.imul(he,qe)|0,A=A+Math.imul(se,Ne)|0,p=p+Math.imul(se,Le)|0,p=p+Math.imul(ce,Ne)|0,O=O+Math.imul(ce,Le)|0,A=A+Math.imul(ie,Ke)|0,p=p+Math.imul(ie,De)|0,p=p+Math.imul(ne,Ke)|0,O=O+Math.imul(ne,De)|0,A=A+Math.imul(ee,Re)|0,p=p+Math.imul(ee,Ue)|0,p=p+Math.imul(te,Re)|0,O=O+Math.imul(te,Ue)|0,A=A+Math.imul(F,je)|0,p=p+Math.imul(F,Ce)|0,p=p+Math.imul(W,je)|0,O=O+Math.imul(W,Ce)|0;var Ws=(w+A|0)+((p&8191)<<13)|0;w=(O+(p>>>13)|0)+(Ws>>>26)|0,Ws&=67108863,A=Math.imul(Se,Ee),p=Math.imul(Se,Ie),p=p+Math.imul(Me,Ee)|0,O=Math.imul(Me,Ie),A=A+Math.imul(we,xe)|0,p=p+Math.imul(we,Ae)|0,p=p+Math.imul(_e,xe)|0,O=O+Math.imul(_e,Ae)|0,A=A+Math.imul(me,Pe)|0,p=p+Math.imul(me,Be)|0,p=p+Math.imul(ve,Pe)|0,O=O+Math.imul(ve,Be)|0,A=A+Math.imul(ge,Te)|0,p=p+Math.imul(ge,Oe)|0,p=p+Math.imul(ye,Te)|0,O=O+Math.imul(ye,Oe)|0,A=A+Math.imul(be,ke)|0,p=p+Math.imul(be,qe)|0,p=p+Math.imul(pe,ke)|0,O=O+Math.imul(pe,qe)|0,A=A+Math.imul(le,Ne)|0,p=p+Math.imul(le,Le)|0,p=p+Math.imul(he,Ne)|0,O=O+Math.imul(he,Le)|0,A=A+Math.imul(se,Ke)|0,p=p+Math.imul(se,De)|0,p=p+Math.imul(ce,Ke)|0,O=O+Math.imul(ce,De)|0,A=A+Math.imul(ie,Re)|0,p=p+Math.imul(ie,Ue)|0,p=p+Math.imul(ne,Re)|0,O=O+Math.imul(ne,Ue)|0,A=A+Math.imul(ee,je)|0,p=p+Math.imul(ee,Ce)|0,p=p+Math.imul(te,je)|0,O=O+Math.imul(te,Ce)|0,A=A+Math.imul(F,gt)|0,p=p+Math.imul(F,yt)|0,p=p+Math.imul(W,gt)|0,O=O+Math.imul(W,yt)|0;var $s=(w+A|0)+((p&8191)<<13)|0;w=(O+(p>>>13)|0)+($s>>>26)|0,$s&=67108863,A=Math.imul(Se,xe),p=Math.imul(Se,Ae),p=p+Math.imul(Me,xe)|0,O=Math.imul(Me,Ae),A=A+Math.imul(we,Pe)|0,p=p+Math.imul(we,Be)|0,p=p+Math.imul(_e,Pe)|0,O=O+Math.imul(_e,Be)|0,A=A+Math.imul(me,Te)|0,p=p+Math.imul(me,Oe)|0,p=p+Math.imul(ve,Te)|0,O=O+Math.imul(ve,Oe)|0,A=A+Math.imul(ge,ke)|0,p=p+Math.imul(ge,qe)|0,p=p+Math.imul(ye,ke)|0,O=O+Math.imul(ye,qe)|0,A=A+Math.imul(be,Ne)|0,p=p+Math.imul(be,Le)|0,p=p+Math.imul(pe,Ne)|0,O=O+Math.imul(pe,Le)|0,A=A+Math.imul(le,Ke)|0,p=p+Math.imul(le,De)|0,p=p+Math.imul(he,Ke)|0,O=O+Math.imul(he,De)|0,A=A+Math.imul(se,Re)|0,p=p+Math.imul(se,Ue)|0,p=p+Math.imul(ce,Re)|0,O=O+Math.imul(ce,Ue)|0,A=A+Math.imul(ie,je)|0,p=p+Math.imul(ie,Ce)|0,p=p+Math.imul(ne,je)|0,O=O+Math.imul(ne,Ce)|0,A=A+Math.imul(ee,gt)|0,p=p+Math.imul(ee,yt)|0,p=p+Math.imul(te,gt)|0,O=O+Math.imul(te,yt)|0;var Gs=(w+A|0)+((p&8191)<<13)|0;w=(O+(p>>>13)|0)+(Gs>>>26)|0,Gs&=67108863,A=Math.imul(Se,Pe),p=Math.imul(Se,Be),p=p+Math.imul(Me,Pe)|0,O=Math.imul(Me,Be),A=A+Math.imul(we,Te)|0,p=p+Math.imul(we,Oe)|0,p=p+Math.imul(_e,Te)|0,O=O+Math.imul(_e,Oe)|0,A=A+Math.imul(me,ke)|0,p=p+Math.imul(me,qe)|0,p=p+Math.imul(ve,ke)|0,O=O+Math.imul(ve,qe)|0,A=A+Math.imul(ge,Ne)|0,p=p+Math.imul(ge,Le)|0,p=p+Math.imul(ye,Ne)|0,O=O+Math.imul(ye,Le)|0,A=A+Math.imul(be,Ke)|0,p=p+Math.imul(be,De)|0,p=p+Math.imul(pe,Ke)|0,O=O+Math.imul(pe,De)|0,A=A+Math.imul(le,Re)|0,p=p+Math.imul(le,Ue)|0,p=p+Math.imul(he,Re)|0,O=O+Math.imul(he,Ue)|0,A=A+Math.imul(se,je)|0,p=p+Math.imul(se,Ce)|0,p=p+Math.imul(ce,je)|0,O=O+Math.imul(ce,Ce)|0,A=A+Math.imul(ie,gt)|0,p=p+Math.imul(ie,yt)|0,p=p+Math.imul(ne,gt)|0,O=O+Math.imul(ne,yt)|0;var Ys=(w+A|0)+((p&8191)<<13)|0;w=(O+(p>>>13)|0)+(Ys>>>26)|0,Ys&=67108863,A=Math.imul(Se,Te),p=Math.imul(Se,Oe),p=p+Math.imul(Me,Te)|0,O=Math.imul(Me,Oe),A=A+Math.imul(we,ke)|0,p=p+Math.imul(we,qe)|0,p=p+Math.imul(_e,ke)|0,O=O+Math.imul(_e,qe)|0,A=A+Math.imul(me,Ne)|0,p=p+Math.imul(me,Le)|0,p=p+Math.imul(ve,Ne)|0,O=O+Math.imul(ve,Le)|0,A=A+Math.imul(ge,Ke)|0,p=p+Math.imul(ge,De)|0,p=p+Math.imul(ye,Ke)|0,O=O+Math.imul(ye,De)|0,A=A+Math.imul(be,Re)|0,p=p+Math.imul(be,Ue)|0,p=p+Math.imul(pe,Re)|0,O=O+Math.imul(pe,Ue)|0,A=A+Math.imul(le,je)|0,p=p+Math.imul(le,Ce)|0,p=p+Math.imul(he,je)|0,O=O+Math.imul(he,Ce)|0,A=A+Math.imul(se,gt)|0,p=p+Math.imul(se,yt)|0,p=p+Math.imul(ce,gt)|0,O=O+Math.imul(ce,yt)|0;var Zs=(w+A|0)+((p&8191)<<13)|0;w=(O+(p>>>13)|0)+(Zs>>>26)|0,Zs&=67108863,A=Math.imul(Se,ke),p=Math.imul(Se,qe),p=p+Math.imul(Me,ke)|0,O=Math.imul(Me,qe),A=A+Math.imul(we,Ne)|0,p=p+Math.imul(we,Le)|0,p=p+Math.imul(_e,Ne)|0,O=O+Math.imul(_e,Le)|0,A=A+Math.imul(me,Ke)|0,p=p+Math.imul(me,De)|0,p=p+Math.imul(ve,Ke)|0,O=O+Math.imul(ve,De)|0,A=A+Math.imul(ge,Re)|0,p=p+Math.imul(ge,Ue)|0,p=p+Math.imul(ye,Re)|0,O=O+Math.imul(ye,Ue)|0,A=A+Math.imul(be,je)|0,p=p+Math.imul(be,Ce)|0,p=p+Math.imul(pe,je)|0,O=O+Math.imul(pe,Ce)|0,A=A+Math.imul(le,gt)|0,p=p+Math.imul(le,yt)|0,p=p+Math.imul(he,gt)|0,O=O+Math.imul(he,yt)|0;var Xs=(w+A|0)+((p&8191)<<13)|0;w=(O+(p>>>13)|0)+(Xs>>>26)|0,Xs&=67108863,A=Math.imul(Se,Ne),p=Math.imul(Se,Le),p=p+Math.imul(Me,Ne)|0,O=Math.imul(Me,Le),A=A+Math.imul(we,Ke)|0,p=p+Math.imul(we,De)|0,p=p+Math.imul(_e,Ke)|0,O=O+Math.imul(_e,De)|0,A=A+Math.imul(me,Re)|0,p=p+Math.imul(me,Ue)|0,p=p+Math.imul(ve,Re)|0,O=O+Math.imul(ve,Ue)|0,A=A+Math.imul(ge,je)|0,p=p+Math.imul(ge,Ce)|0,p=p+Math.imul(ye,je)|0,O=O+Math.imul(ye,Ce)|0,A=A+Math.imul(be,gt)|0,p=p+Math.imul(be,yt)|0,p=p+Math.imul(pe,gt)|0,O=O+Math.imul(pe,yt)|0;var Js=(w+A|0)+((p&8191)<<13)|0;w=(O+(p>>>13)|0)+(Js>>>26)|0,Js&=67108863,A=Math.imul(Se,Ke),p=Math.imul(Se,De),p=p+Math.imul(Me,Ke)|0,O=Math.imul(Me,De),A=A+Math.imul(we,Re)|0,p=p+Math.imul(we,Ue)|0,p=p+Math.imul(_e,Re)|0,O=O+Math.imul(_e,Ue)|0,A=A+Math.imul(me,je)|0,p=p+Math.imul(me,Ce)|0,p=p+Math.imul(ve,je)|0,O=O+Math.imul(ve,Ce)|0,A=A+Math.imul(ge,gt)|0,p=p+Math.imul(ge,yt)|0,p=p+Math.imul(ye,gt)|0,O=O+Math.imul(ye,yt)|0;var Qs=(w+A|0)+((p&8191)<<13)|0;w=(O+(p>>>13)|0)+(Qs>>>26)|0,Qs&=67108863,A=Math.imul(Se,Re),p=Math.imul(Se,Ue),p=p+Math.imul(Me,Re)|0,O=Math.imul(Me,Ue),A=A+Math.imul(we,je)|0,p=p+Math.imul(we,Ce)|0,p=p+Math.imul(_e,je)|0,O=O+Math.imul(_e,Ce)|0,A=A+Math.imul(me,gt)|0,p=p+Math.imul(me,yt)|0,p=p+Math.imul(ve,gt)|0,O=O+Math.imul(ve,yt)|0;var Gd=(w+A|0)+((p&8191)<<13)|0;w=(O+(p>>>13)|0)+(Gd>>>26)|0,Gd&=67108863,A=Math.imul(Se,je),p=Math.imul(Se,Ce),p=p+Math.imul(Me,je)|0,O=Math.imul(Me,Ce),A=A+Math.imul(we,gt)|0,p=p+Math.imul(we,yt)|0,p=p+Math.imul(_e,gt)|0,O=O+Math.imul(_e,yt)|0;var Yd=(w+A|0)+((p&8191)<<13)|0;w=(O+(p>>>13)|0)+(Yd>>>26)|0,Yd&=67108863,A=Math.imul(Se,gt),p=Math.imul(Se,yt),p=p+Math.imul(Me,gt)|0,O=Math.imul(Me,yt);var Zd=(w+A|0)+((p&8191)<<13)|0;return w=(O+(p>>>13)|0)+(Zd>>>26)|0,Zd&=67108863,d[0]=Rs,d[1]=Us,d[2]=js,d[3]=Cs,d[4]=zs,d[5]=Fs,d[6]=Hs,d[7]=Vs,d[8]=Ws,d[9]=$s,d[10]=Gs,d[11]=Ys,d[12]=Zs,d[13]=Xs,d[14]=Js,d[15]=Qs,d[16]=Gd,d[17]=Yd,d[18]=Zd,w!==0&&(d[19]=w,b.length++),b};Math.imul||(N=k);function R(h,s,u){u.negative=s.negative^h.negative,u.length=h.length+s.length;for(var b=0,y=0,g=0;g<u.length-1;g++){var d=y;y=0;for(var w=b&67108863,A=Math.min(g,s.length-1),p=Math.max(0,g-h.length+1);p<=A;p++){var O=g-p,C=h.words[O]|0,F=s.words[p]|0,W=C*F,X=W&67108863;d=d+(W/67108864|0)|0,X=X+w|0,w=X&67108863,d=d+(X>>>26)|0,y+=d>>>26,d&=67108863}u.words[g]=w,b=d,d=y}return b!==0?u.words[g]=b:u.length--,u._strip()}function K(h,s,u){return R(h,s,u)}i.prototype.mulTo=function(s,u){var b,y=this.length+s.length;return this.length===10&&s.length===10?b=N(this,s,u):y<63?b=k(this,s,u):y<1024?b=R(this,s,u):b=K(this,s,u),b};function z(h,s){this.x=h,this.y=s}z.prototype.makeRBT=function(s){for(var u=new Array(s),b=i.prototype._countBits(s)-1,y=0;y<s;y++)u[y]=this.revBin(y,b,s);return u},z.prototype.revBin=function(s,u,b){if(s===0||s===b-1)return s;for(var y=0,g=0;g<u;g++)y|=(s&1)<<u-g-1,s>>=1;return y},z.prototype.permute=function(s,u,b,y,g,d){for(var w=0;w<d;w++)y[w]=u[s[w]],g[w]=b[s[w]]},z.prototype.transform=function(s,u,b,y,g,d){this.permute(d,s,u,b,y,g);for(var w=1;w<g;w<<=1)for(var A=w<<1,p=Math.cos(2*Math.PI/A),O=Math.sin(2*Math.PI/A),C=0;C<g;C+=A)for(var F=p,W=O,X=0;X<w;X++){var ee=b[C+X],te=y[C+X],Vt=b[C+X+w],ie=y[C+X+w],ne=F*Vt-W*ie;ie=F*ie+W*Vt,Vt=ne,b[C+X]=ee+Vt,y[C+X]=te+ie,b[C+X+w]=ee-Vt,y[C+X+w]=te-ie,X!==A&&(ne=p*F-O*W,W=p*W+O*F,F=ne)}},z.prototype.guessLen13b=function(s,u){var b=Math.max(u,s)|1,y=b&1,g=0;for(b=b/2|0;b;b=b>>>1)g++;return 1<<g+1+y},z.prototype.conjugate=function(s,u,b){if(!(b<=1))for(var y=0;y<b/2;y++){var g=s[y];s[y]=s[b-y-1],s[b-y-1]=g,g=u[y],u[y]=-u[b-y-1],u[b-y-1]=-g}},z.prototype.normalize13b=function(s,u){for(var b=0,y=0;y<u/2;y++){var g=Math.round(s[2*y+1]/u)*8192+Math.round(s[2*y]/u)+b;s[y]=g&67108863,g<67108864?b=0:b=g/67108864|0}return s},z.prototype.convert13b=function(s,u,b,y){for(var g=0,d=0;d<u;d++)g=g+(s[d]|0),b[2*d]=g&8191,g=g>>>13,b[2*d+1]=g&8191,g=g>>>13;for(d=2*u;d<y;++d)b[d]=0;r(g===0),r((g&-8192)===0)},z.prototype.stub=function(s){for(var u=new Array(s),b=0;b<s;b++)u[b]=0;return u},z.prototype.mulp=function(s,u,b){var y=2*this.guessLen13b(s.length,u.length),g=this.makeRBT(y),d=this.stub(y),w=new Array(y),A=new Array(y),p=new Array(y),O=new Array(y),C=new Array(y),F=new Array(y),W=b.words;W.length=y,this.convert13b(s.words,s.length,w,y),this.convert13b(u.words,u.length,O,y),this.transform(w,d,A,p,y,g),this.transform(O,d,C,F,y,g);for(var X=0;X<y;X++){var ee=A[X]*C[X]-p[X]*F[X];p[X]=A[X]*F[X]+p[X]*C[X],A[X]=ee}return this.conjugate(A,p,y),this.transform(A,p,W,d,y,g),this.conjugate(W,d,y),this.normalize13b(W,y),b.negative=s.negative^u.negative,b.length=s.length+u.length,b._strip()},i.prototype.mul=function(s){var u=new i(null);return u.words=new Array(this.length+s.length),this.mulTo(s,u)},i.prototype.mulf=function(s){var u=new i(null);return u.words=new Array(this.length+s.length),K(this,s,u)},i.prototype.imul=function(s){return this.clone().mulTo(s,this)},i.prototype.imuln=function(s){var u=s<0;u&&(s=-s),r(typeof s=="number"),r(s<67108864);for(var b=0,y=0;y<this.length;y++){var g=(this.words[y]|0)*s,d=(g&67108863)+(b&67108863);b>>=26,b+=g/67108864|0,b+=d>>>26,this.words[y]=d&67108863}return b!==0&&(this.words[y]=b,this.length++),u?this.ineg():this},i.prototype.muln=function(s){return this.clone().imuln(s)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(s){var u=M(s);if(u.length===0)return new i(1);for(var b=this,y=0;y<u.length&&u[y]===0;y++,b=b.sqr());if(++y<u.length)for(var g=b.sqr();y<u.length;y++,g=g.sqr())u[y]!==0&&(b=b.mul(g));return b},i.prototype.iushln=function(s){r(typeof s=="number"&&s>=0);var u=s%26,b=(s-u)/26,y=67108863>>>26-u<<26-u,g;if(u!==0){var d=0;for(g=0;g<this.length;g++){var w=this.words[g]&y,A=(this.words[g]|0)-w<<u;this.words[g]=A|d,d=w>>>26-u}d&&(this.words[g]=d,this.length++)}if(b!==0){for(g=this.length-1;g>=0;g--)this.words[g+b]=this.words[g];for(g=0;g<b;g++)this.words[g]=0;this.length+=b}return this._strip()},i.prototype.ishln=function(s){return r(this.negative===0),this.iushln(s)},i.prototype.iushrn=function(s,u,b){r(typeof s=="number"&&s>=0);var y;u?y=(u-u%26)/26:y=0;var g=s%26,d=Math.min((s-g)/26,this.length),w=67108863^67108863>>>g<<g,A=b;if(y-=d,y=Math.max(0,y),A){for(var p=0;p<d;p++)A.words[p]=this.words[p];A.length=d}if(d!==0)if(this.length>d)for(this.length-=d,p=0;p<this.length;p++)this.words[p]=this.words[p+d];else this.words[0]=0,this.length=1;var O=0;for(p=this.length-1;p>=0&&(O!==0||p>=y);p--){var C=this.words[p]|0;this.words[p]=O<<26-g|C>>>g,O=C&w}return A&&O!==0&&(A.words[A.length++]=O),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},i.prototype.ishrn=function(s,u,b){return r(this.negative===0),this.iushrn(s,u,b)},i.prototype.shln=function(s){return this.clone().ishln(s)},i.prototype.ushln=function(s){return this.clone().iushln(s)},i.prototype.shrn=function(s){return this.clone().ishrn(s)},i.prototype.ushrn=function(s){return this.clone().iushrn(s)},i.prototype.testn=function(s){r(typeof s=="number"&&s>=0);var u=s%26,b=(s-u)/26,y=1<<u;if(this.length<=b)return!1;var g=this.words[b];return!!(g&y)},i.prototype.imaskn=function(s){r(typeof s=="number"&&s>=0);var u=s%26,b=(s-u)/26;if(r(this.negative===0,"imaskn works only with positive numbers"),this.length<=b)return this;if(u!==0&&b++,this.length=Math.min(b,this.length),u!==0){var y=67108863^67108863>>>u<<u;this.words[this.length-1]&=y}return this._strip()},i.prototype.maskn=function(s){return this.clone().imaskn(s)},i.prototype.iaddn=function(s){return r(typeof s=="number"),r(s<67108864),s<0?this.isubn(-s):this.negative!==0?this.length===1&&(this.words[0]|0)<=s?(this.words[0]=s-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(s),this.negative=1,this):this._iaddn(s)},i.prototype._iaddn=function(s){this.words[0]+=s;for(var u=0;u<this.length&&this.words[u]>=67108864;u++)this.words[u]-=67108864,u===this.length-1?this.words[u+1]=1:this.words[u+1]++;return this.length=Math.max(this.length,u+1),this},i.prototype.isubn=function(s){if(r(typeof s=="number"),r(s<67108864),s<0)return this.iaddn(-s);if(this.negative!==0)return this.negative=0,this.iaddn(s),this.negative=1,this;if(this.words[0]-=s,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var u=0;u<this.length&&this.words[u]<0;u++)this.words[u]+=67108864,this.words[u+1]-=1;return this._strip()},i.prototype.addn=function(s){return this.clone().iaddn(s)},i.prototype.subn=function(s){return this.clone().isubn(s)},i.prototype.iabs=function(){return this.negative=0,this},i.prototype.abs=function(){return this.clone().iabs()},i.prototype._ishlnsubmul=function(s,u,b){var y=s.length+b,g;this._expand(y);var d,w=0;for(g=0;g<s.length;g++){d=(this.words[g+b]|0)+w;var A=(s.words[g]|0)*u;d-=A&67108863,w=(d>>26)-(A/67108864|0),this.words[g+b]=d&67108863}for(;g<this.length-b;g++)d=(this.words[g+b]|0)+w,w=d>>26,this.words[g+b]=d&67108863;if(w===0)return this._strip();for(r(w===-1),w=0,g=0;g<this.length;g++)d=-(this.words[g]|0)+w,w=d>>26,this.words[g]=d&67108863;return this.negative=1,this._strip()},i.prototype._wordDiv=function(s,u){var b=this.length-s.length,y=this.clone(),g=s,d=g.words[g.length-1]|0,w=this._countBits(d);b=26-w,b!==0&&(g=g.ushln(b),y.iushln(b),d=g.words[g.length-1]|0);var A=y.length-g.length,p;if(u!=="mod"){p=new i(null),p.length=A+1,p.words=new Array(p.length);for(var O=0;O<p.length;O++)p.words[O]=0}var C=y.clone()._ishlnsubmul(g,1,A);C.negative===0&&(y=C,p&&(p.words[A]=1));for(var F=A-1;F>=0;F--){var W=(y.words[g.length+F]|0)*67108864+(y.words[g.length+F-1]|0);for(W=Math.min(W/d|0,67108863),y._ishlnsubmul(g,W,F);y.negative!==0;)W--,y.negative=0,y._ishlnsubmul(g,1,F),y.isZero()||(y.negative^=1);p&&(p.words[F]=W)}return p&&p._strip(),y._strip(),u!=="div"&&b!==0&&y.iushrn(b),{div:p||null,mod:y}},i.prototype.divmod=function(s,u,b){if(r(!s.isZero()),this.isZero())return{div:new i(0),mod:new i(0)};var y,g,d;return this.negative!==0&&s.negative===0?(d=this.neg().divmod(s,u),u!=="mod"&&(y=d.div.neg()),u!=="div"&&(g=d.mod.neg(),b&&g.negative!==0&&g.iadd(s)),{div:y,mod:g}):this.negative===0&&s.negative!==0?(d=this.divmod(s.neg(),u),u!=="mod"&&(y=d.div.neg()),{div:y,mod:d.mod}):(this.negative&s.negative)!==0?(d=this.neg().divmod(s.neg(),u),u!=="div"&&(g=d.mod.neg(),b&&g.negative!==0&&g.isub(s)),{div:d.div,mod:g}):s.length>this.length||this.cmp(s)<0?{div:new i(0),mod:this}:s.length===1?u==="div"?{div:this.divn(s.words[0]),mod:null}:u==="mod"?{div:null,mod:new i(this.modrn(s.words[0]))}:{div:this.divn(s.words[0]),mod:new i(this.modrn(s.words[0]))}:this._wordDiv(s,u)},i.prototype.div=function(s){return this.divmod(s,"div",!1).div},i.prototype.mod=function(s){return this.divmod(s,"mod",!1).mod},i.prototype.umod=function(s){return this.divmod(s,"mod",!0).mod},i.prototype.divRound=function(s){var u=this.divmod(s);if(u.mod.isZero())return u.div;var b=u.div.negative!==0?u.mod.isub(s):u.mod,y=s.ushrn(1),g=s.andln(1),d=b.cmp(y);return d<0||g===1&&d===0?u.div:u.div.negative!==0?u.div.isubn(1):u.div.iaddn(1)},i.prototype.modrn=function(s){var u=s<0;u&&(s=-s),r(s<=67108863);for(var b=(1<<26)%s,y=0,g=this.length-1;g>=0;g--)y=(b*y+(this.words[g]|0))%s;return u?-y:y},i.prototype.modn=function(s){return this.modrn(s)},i.prototype.idivn=function(s){var u=s<0;u&&(s=-s),r(s<=67108863);for(var b=0,y=this.length-1;y>=0;y--){var g=(this.words[y]|0)+b*67108864;this.words[y]=g/s|0,b=g%s}return this._strip(),u?this.ineg():this},i.prototype.divn=function(s){return this.clone().idivn(s)},i.prototype.egcd=function(s){r(s.negative===0),r(!s.isZero());var u=this,b=s.clone();u.negative!==0?u=u.umod(s):u=u.clone();for(var y=new i(1),g=new i(0),d=new i(0),w=new i(1),A=0;u.isEven()&&b.isEven();)u.iushrn(1),b.iushrn(1),++A;for(var p=b.clone(),O=u.clone();!u.isZero();){for(var C=0,F=1;(u.words[0]&F)===0&&C<26;++C,F<<=1);if(C>0)for(u.iushrn(C);C-- >0;)(y.isOdd()||g.isOdd())&&(y.iadd(p),g.isub(O)),y.iushrn(1),g.iushrn(1);for(var W=0,X=1;(b.words[0]&X)===0&&W<26;++W,X<<=1);if(W>0)for(b.iushrn(W);W-- >0;)(d.isOdd()||w.isOdd())&&(d.iadd(p),w.isub(O)),d.iushrn(1),w.iushrn(1);u.cmp(b)>=0?(u.isub(b),y.isub(d),g.isub(w)):(b.isub(u),d.isub(y),w.isub(g))}return{a:d,b:w,gcd:b.iushln(A)}},i.prototype._invmp=function(s){r(s.negative===0),r(!s.isZero());var u=this,b=s.clone();u.negative!==0?u=u.umod(s):u=u.clone();for(var y=new i(1),g=new i(0),d=b.clone();u.cmpn(1)>0&&b.cmpn(1)>0;){for(var w=0,A=1;(u.words[0]&A)===0&&w<26;++w,A<<=1);if(w>0)for(u.iushrn(w);w-- >0;)y.isOdd()&&y.iadd(d),y.iushrn(1);for(var p=0,O=1;(b.words[0]&O)===0&&p<26;++p,O<<=1);if(p>0)for(b.iushrn(p);p-- >0;)g.isOdd()&&g.iadd(d),g.iushrn(1);u.cmp(b)>=0?(u.isub(b),y.isub(g)):(b.isub(u),g.isub(y))}var C;return u.cmpn(1)===0?C=y:C=g,C.cmpn(0)<0&&C.iadd(s),C},i.prototype.gcd=function(s){if(this.isZero())return s.abs();if(s.isZero())return this.abs();var u=this.clone(),b=s.clone();u.negative=0,b.negative=0;for(var y=0;u.isEven()&&b.isEven();y++)u.iushrn(1),b.iushrn(1);do{for(;u.isEven();)u.iushrn(1);for(;b.isEven();)b.iushrn(1);var g=u.cmp(b);if(g<0){var d=u;u=b,b=d}else if(g===0||b.cmpn(1)===0)break;u.isub(b)}while(!0);return b.iushln(y)},i.prototype.invm=function(s){return this.egcd(s).a.umod(s)},i.prototype.isEven=function(){return(this.words[0]&1)===0},i.prototype.isOdd=function(){return(this.words[0]&1)===1},i.prototype.andln=function(s){return this.words[0]&s},i.prototype.bincn=function(s){r(typeof s=="number");var u=s%26,b=(s-u)/26,y=1<<u;if(this.length<=b)return this._expand(b+1),this.words[b]|=y,this;for(var g=y,d=b;g!==0&&d<this.length;d++){var w=this.words[d]|0;w+=g,g=w>>>26,w&=67108863,this.words[d]=w}return g!==0&&(this.words[d]=g,this.length++),this},i.prototype.isZero=function(){return this.length===1&&this.words[0]===0},i.prototype.cmpn=function(s){var u=s<0;if(this.negative!==0&&!u)return-1;if(this.negative===0&&u)return 1;this._strip();var b;if(this.length>1)b=1;else{u&&(s=-s),r(s<=67108863,"Number is too big");var y=this.words[0]|0;b=y===s?0:y<s?-1:1}return this.negative!==0?-b|0:b},i.prototype.cmp=function(s){if(this.negative!==0&&s.negative===0)return-1;if(this.negative===0&&s.negative!==0)return 1;var u=this.ucmp(s);return this.negative!==0?-u|0:u},i.prototype.ucmp=function(s){if(this.length>s.length)return 1;if(this.length<s.length)return-1;for(var u=0,b=this.length-1;b>=0;b--){var y=this.words[b]|0,g=s.words[b]|0;if(y!==g){y<g?u=-1:y>g&&(u=1);break}}return u},i.prototype.gtn=function(s){return this.cmpn(s)===1},i.prototype.gt=function(s){return this.cmp(s)===1},i.prototype.gten=function(s){return this.cmpn(s)>=0},i.prototype.gte=function(s){return this.cmp(s)>=0},i.prototype.ltn=function(s){return this.cmpn(s)===-1},i.prototype.lt=function(s){return this.cmp(s)===-1},i.prototype.lten=function(s){return this.cmpn(s)<=0},i.prototype.lte=function(s){return this.cmp(s)<=0},i.prototype.eqn=function(s){return this.cmpn(s)===0},i.prototype.eq=function(s){return this.cmp(s)===0},i.red=function(s){return new f(s)},i.prototype.toRed=function(s){return r(!this.red,"Already a number in reduction context"),r(this.negative===0,"red works only with positives"),s.convertTo(this)._forceRed(s)},i.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(s){return this.red=s,this},i.prototype.forceRed=function(s){return r(!this.red,"Already a number in reduction context"),this._forceRed(s)},i.prototype.redAdd=function(s){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,s)},i.prototype.redIAdd=function(s){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,s)},i.prototype.redSub=function(s){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,s)},i.prototype.redISub=function(s){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,s)},i.prototype.redShl=function(s){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,s)},i.prototype.redMul=function(s){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,s),this.red.mul(this,s)},i.prototype.redIMul=function(s){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,s),this.red.imul(this,s)},i.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(s){return r(this.red&&!s.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,s)};var j={k256:null,p224:null,p192:null,p25519:null};function U(h,s){this.name=h,this.p=new i(s,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}U.prototype._tmp=function(){var s=new i(null);return s.words=new Array(Math.ceil(this.n/13)),s},U.prototype.ireduce=function(s){var u=s,b;do this.split(u,this.tmp),u=this.imulK(u),u=u.iadd(this.tmp),b=u.bitLength();while(b>this.n);var y=b<this.n?-1:u.ucmp(this.p);return y===0?(u.words[0]=0,u.length=1):y>0?u.isub(this.p):u.strip!==void 0?u.strip():u._strip(),u},U.prototype.split=function(s,u){s.iushrn(this.n,0,u)},U.prototype.imulK=function(s){return s.imul(this.k)};function V(){U.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}n(V,U),V.prototype.split=function(s,u){for(var b=4194303,y=Math.min(s.length,9),g=0;g<y;g++)u.words[g]=s.words[g];if(u.length=y,s.length<=9){s.words[0]=0,s.length=1;return}var d=s.words[9];for(u.words[u.length++]=d&b,g=10;g<s.length;g++){var w=s.words[g]|0;s.words[g-10]=(w&b)<<4|d>>>22,d=w}d>>>=22,s.words[g-10]=d,d===0&&s.length>10?s.length-=10:s.length-=9},V.prototype.imulK=function(s){s.words[s.length]=0,s.words[s.length+1]=0,s.length+=2;for(var u=0,b=0;b<s.length;b++){var y=s.words[b]|0;u+=y*977,s.words[b]=u&67108863,u=y*64+(u/67108864|0)}return s.words[s.length-1]===0&&(s.length--,s.words[s.length-1]===0&&s.length--),s};function H(){U.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}n(H,U);function J(){U.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}n(J,U);function q(){U.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}n(q,U),q.prototype.imulK=function(s){for(var u=0,b=0;b<s.length;b++){var y=(s.words[b]|0)*19+u,g=y&67108863;y>>>=26,s.words[b]=g,u=y}return u!==0&&(s.words[s.length++]=u),s},i._prime=function(s){if(j[s])return j[s];var u;if(s==="k256")u=new V;else if(s==="p224")u=new H;else if(s==="p192")u=new J;else if(s==="p25519")u=new q;else throw new Error("Unknown prime "+s);return j[s]=u,u};function f(h){if(typeof h=="string"){var s=i._prime(h);this.m=s.p,this.prime=s}else r(h.gtn(1),"modulus must be greater than 1"),this.m=h,this.prime=null}f.prototype._verify1=function(s){r(s.negative===0,"red works only with positives"),r(s.red,"red works only with red numbers")},f.prototype._verify2=function(s,u){r((s.negative|u.negative)===0,"red works only with positives"),r(s.red&&s.red===u.red,"red works only with red numbers")},f.prototype.imod=function(s){return this.prime?this.prime.ireduce(s)._forceRed(this):(m(s,s.umod(this.m)._forceRed(this)),s)},f.prototype.neg=function(s){return s.isZero()?s.clone():this.m.sub(s)._forceRed(this)},f.prototype.add=function(s,u){this._verify2(s,u);var b=s.add(u);return b.cmp(this.m)>=0&&b.isub(this.m),b._forceRed(this)},f.prototype.iadd=function(s,u){this._verify2(s,u);var b=s.iadd(u);return b.cmp(this.m)>=0&&b.isub(this.m),b},f.prototype.sub=function(s,u){this._verify2(s,u);var b=s.sub(u);return b.cmpn(0)<0&&b.iadd(this.m),b._forceRed(this)},f.prototype.isub=function(s,u){this._verify2(s,u);var b=s.isub(u);return b.cmpn(0)<0&&b.iadd(this.m),b},f.prototype.shl=function(s,u){return this._verify1(s),this.imod(s.ushln(u))},f.prototype.imul=function(s,u){return this._verify2(s,u),this.imod(s.imul(u))},f.prototype.mul=function(s,u){return this._verify2(s,u),this.imod(s.mul(u))},f.prototype.isqr=function(s){return this.imul(s,s.clone())},f.prototype.sqr=function(s){return this.mul(s,s)},f.prototype.sqrt=function(s){if(s.isZero())return s.clone();var u=this.m.andln(3);if(r(u%2===1),u===3){var b=this.m.add(new i(1)).iushrn(2);return this.pow(s,b)}for(var y=this.m.subn(1),g=0;!y.isZero()&&y.andln(1)===0;)g++,y.iushrn(1);r(!y.isZero());var d=new i(1).toRed(this),w=d.redNeg(),A=this.m.subn(1).iushrn(1),p=this.m.bitLength();for(p=new i(2*p*p).toRed(this);this.pow(p,A).cmp(w)!==0;)p.redIAdd(w);for(var O=this.pow(p,y),C=this.pow(s,y.addn(1).iushrn(1)),F=this.pow(s,y),W=g;F.cmp(d)!==0;){for(var X=F,ee=0;X.cmp(d)!==0;ee++)X=X.redSqr();r(ee<W);var te=this.pow(O,new i(1).iushln(W-ee-1));C=C.redMul(te),O=te.redSqr(),F=F.redMul(O),W=ee}return C},f.prototype.invm=function(s){var u=s._invmp(this.m);return u.negative!==0?(u.negative=0,this.imod(u).redNeg()):this.imod(u)},f.prototype.pow=function(s,u){if(u.isZero())return new i(1).toRed(this);if(u.cmpn(1)===0)return s.clone();var b=4,y=new Array(1<<b);y[0]=new i(1).toRed(this),y[1]=s;for(var g=2;g<y.length;g++)y[g]=this.mul(y[g-1],s);var d=y[0],w=0,A=0,p=u.bitLength()%26;for(p===0&&(p=26),g=u.length-1;g>=0;g--){for(var O=u.words[g],C=p-1;C>=0;C--){var F=O>>C&1;if(d!==y[0]&&(d=this.sqr(d)),F===0&&w===0){A=0;continue}w<<=1,w|=F,A++,!(A!==b&&(g!==0||C!==0))&&(d=this.mul(d,y[w]),A=0,w=0)}p=26}return d},f.prototype.convertTo=function(s){var u=s.umod(this.m);return u===s?u.clone():u},f.prototype.convertFrom=function(s){var u=s.clone();return u.red=null,u},i.mont=function(s){return new v(s)};function v(h){f.call(this,h),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new i(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}n(v,f),v.prototype.convertTo=function(s){return this.imod(s.ushln(this.shift))},v.prototype.convertFrom=function(s){var u=this.imod(s.mul(this.rinv));return u.red=null,u},v.prototype.imul=function(s,u){if(s.isZero()||u.isZero())return s.words[0]=0,s.length=1,s;var b=s.imul(u),y=b.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),g=b.isub(y).iushrn(this.shift),d=g;return g.cmp(this.m)>=0?d=g.isub(this.m):g.cmpn(0)<0&&(d=g.iadd(this.m)),d._forceRed(this)},v.prototype.mul=function(s,u){if(s.isZero()||u.isZero())return new i(0)._forceRed(this);var b=s.mul(u),y=b.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),g=b.isub(y).iushrn(this.shift),d=g;return g.cmp(this.m)>=0?d=g.isub(this.m):g.cmpn(0)<0&&(d=g.iadd(this.m)),d._forceRed(this)},v.prototype.invm=function(s){var u=this.imod(s._invmp(this.m).mul(this.r2));return u._forceRed(this)}})(typeof b0>"u"||b0,Zm)});var Ts=L(Ve=>{"use strict";E();I();var LS=Ve&&Ve.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ve,"__esModule",{value:!0});Ve.numbersTypeMap=Ve.bool=Ve.i512=Ve.i256=Ve.i128=Ve.i64=Ve.i32=Ve.i16=Ve.i8=Ve.u512=Ve.u256=Ve.u128=Ve.u64=Ve.u32=Ve.u16=Ve.u8=void 0;var Ea=LS(Xm()),Et=yr();Ve.u8={write:function(t,e,r){t.writeUInt8(r,e)},read:function(t,e){return t.readUInt8(e)},byteSize:1,description:"u8"};Ve.u16={write:function(t,e,r){t.writeUInt16LE(r,e)},read:function(t,e){return t.readUInt16LE(e)},byteSize:2,description:"u16"};Ve.u32={write:function(t,e,r){t.writeUInt32LE(r,e)},read:function(t,e){return t.readUInt32LE(e)},byteSize:4,description:"u32"};function _d(t,e){return{write:function(r,n,i){let a=(Ea.default.isBN(i)?i:new Ea.default(i)).toArray("le",this.byteSize);B.Buffer.from(a).copy(r,n,0,this.byteSize)},read:function(r,n){let i=r.slice(n,n+this.byteSize);return new Ea.default(i,"le")},byteSize:t,description:e}}Ve.u64=_d(8,"u64");Ve.u128=_d(16,"u128");Ve.u256=_d(32,"u256");Ve.u512=_d(64,"u512");Ve.i8={write:function(t,e,r){t.writeInt8(r,e)},read:function(t,e){return t.readInt8(e)},byteSize:1,description:"i8"};Ve.i16={write:function(t,e,r){t.writeInt16LE(r,e)},read:function(t,e){return t.readInt16LE(e)},byteSize:2,description:"i16"};Ve.i32={write:function(t,e,r){t.writeInt32LE(r,e)},read:function(t,e){return t.readInt32LE(e)},byteSize:4,description:"i32"};function Sd(t,e){let r=t*8;return{write:function(n,i,o){let c=(Ea.default.isBN(o)?o:new Ea.default(o)).toTwos(r).toArray("le",this.byteSize);B.Buffer.from(c).copy(n,i,0,this.byteSize)},read:function(n,i){let o=n.slice(i,i+this.byteSize);return new Ea.default(o,"le").fromTwos(r)},byteSize:t,description:e}}Ve.i64=Sd(8,"i64");Ve.i128=Sd(16,"i128");Ve.i256=Sd(32,"i256");Ve.i512=Sd(64,"i512");Ve.bool={write:function(t,e,r){let n=r?1:0;Ve.u8.write(t,e,n)},read:function(t,e){return Ve.u8.read(t,e)===1},byteSize:1,description:"bool"};Ve.numbersTypeMap={u8:{beet:"u8",isFixable:!1,sourcePack:Et.BEET_PACKAGE,ts:"number"},u16:{beet:"u16",isFixable:!1,sourcePack:Et.BEET_PACKAGE,ts:"number"},u32:{beet:"u32",isFixable:!1,sourcePack:Et.BEET_PACKAGE,ts:"number"},i8:{beet:"i8",isFixable:!1,sourcePack:Et.BEET_PACKAGE,ts:"number"},i16:{beet:"i16",isFixable:!1,sourcePack:Et.BEET_PACKAGE,ts:"number"},i32:{beet:"i32",isFixable:!1,sourcePack:Et.BEET_PACKAGE,ts:"number"},bool:{beet:"bool",isFixable:!1,sourcePack:Et.BEET_PACKAGE,ts:"boolean"},u64:{beet:"u64",isFixable:!1,sourcePack:Et.BEET_PACKAGE,ts:"bignum",pack:Et.BEET_PACKAGE},u128:{beet:"u128",isFixable:!1,sourcePack:Et.BEET_PACKAGE,ts:"bignum",pack:Et.BEET_PACKAGE},u256:{beet:"u256",isFixable:!1,sourcePack:Et.BEET_PACKAGE,ts:"bignum",pack:Et.BEET_PACKAGE},u512:{beet:"u512",isFixable:!1,sourcePack:Et.BEET_PACKAGE,ts:"bignum",pack:Et.BEET_PACKAGE},i64:{beet:"i64",isFixable:!1,sourcePack:Et.BEET_PACKAGE,ts:"bignum",pack:Et.BEET_PACKAGE},i128:{beet:"i128",isFixable:!1,sourcePack:Et.BEET_PACKAGE,ts:"bignum",pack:Et.BEET_PACKAGE},i256:{beet:"i256",isFixable:!1,sourcePack:Et.BEET_PACKAGE,ts:"bignum",pack:Et.BEET_PACKAGE},i512:{beet:"i512",isFixable:!1,sourcePack:Et.BEET_PACKAGE,ts:"bignum",pack:Et.BEET_PACKAGE}}});var y0=L((Rq,e2)=>{"use strict";E();I();var Jm={white:37,black:30,blue:34,cyan:36,green:32,magenta:35,red:31,yellow:33,brightBlack:90,brightRed:91,brightGreen:92,brightYellow:93,brightBlue:94,brightMagenta:95,brightCyan:96,brightWhite:97},Qm={bgBlack:40,bgRed:41,bgGreen:42,bgYellow:43,bgBlue:44,bgMagenta:45,bgCyan:46,bgWhite:47,bgBrightBlack:100,bgBrightRed:101,bgBrightGreen:102,bgBrightYellow:103,bgBrightBlue:104,bgBrightMagenta:105,bgBrightCyan:106,bgBrightWhite:107},p0={},g0={},oc={};Object.keys(Jm).forEach(function(t){var e=p0[t]="\x1B["+Jm[t]+"m",r=g0[t]="\x1B[39m";oc[t]=function(n){return e+n+r}});Object.keys(Qm).forEach(function(t){var e=p0[t]="\x1B["+Qm[t]+"m",r=g0[t]="\x1B[49m";oc[t]=function(n){return e+n+r}});e2.exports=oc;oc.open=p0;oc.close=g0});var Hi=L(Rt=>{"use strict";E();I();var r2=Rt&&Rt.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Rt,"__esModule",{value:!0});Rt.UnreachableCaseError=Rt.stringify=Rt.bytes=Rt.beetBytes=Rt.logTrace=Rt.logDebug=Rt.logInfo=Rt.logError=void 0;var Md=r2(Uv()),KS=r2(y0()),t2=yr(),{brightBlack:n2}=KS.default;Rt.logError=(0,Md.default)("beet:error");Rt.logInfo=(0,Md.default)("beet:info");Rt.logDebug=(0,Md.default)("beet:debug");Rt.logTrace=(0,Md.default)("beet:trace");function DS(t,e=!1){let r;if((0,t2.isFixableBeet)(t))r="? B";else if((0,t2.isElementCollectionFixedSizeBeet)(t)){let n=e?"length":t.length,i=t.lenPrefixByteSize;r=i>0?`${i} + (${t.elementByteSize} * ${n}) B (${t.byteSize} B)`:`(${t.elementByteSize} * ${n}) B (${t.byteSize} B)`}else r=`${t.byteSize} B`;return n2(r)}Rt.beetBytes=DS;function RS(t){return n2(`${t} B`)}Rt.bytes=RS;function US(t){return t.toString==="function"?t.toString():t}Rt.stringify=US;var m0=class extends Error{constructor(e){super(`Unreachable case: ${e}`)}};Rt.UnreachableCaseError=m0});var xa=L(Ia=>{"use strict";E();I();Object.defineProperty(Ia,"__esModule",{value:!0});Ia.fixBeetFromValue=Ia.fixBeetFromData=void 0;var Ed=yr(),i2=Hi();function jS(t,e,r){if((0,Ed.isFixedSizeBeet)(t))return t;if((0,Ed.isFixableBeet)(t))return t.toFixedFromData(e,r);throw new i2.UnreachableCaseError(t)}Ia.fixBeetFromData=jS;function CS(t,e){if((0,Ed.isFixedSizeBeet)(t))return t;if((0,Ed.isFixableBeet)(t))return t.toFixedFromValue(e);throw new i2.UnreachableCaseError(t)}Ia.fixBeetFromValue=CS});var Id=L(mr=>{"use strict";E();I();Object.defineProperty(mr,"__esModule",{value:!0});mr.collectionsTypeMap=mr.uint8Array=mr.fixedSizeUint8Array=mr.fixedSizeBuffer=mr.array=mr.fixedSizeArray=mr.uniformFixedSizeArray=void 0;var Aa=yr(),Ao=Jn(),Os=Ts(),Pa=yr(),o2=Hi(),s2=xa();function zS(t,e,r=!1){let n=t.byteSize*e,i=r?4+n:n;return{write:function(o,a,c){Ao.strict.equal(c.length,e,`array length ${c.length} should match len ${e}`),r&&(Os.u32.write(o,a,e),a+=4);for(let l=0;l<e;l++)t.write(o,a+l*t.byteSize,c[l])},read:function(o,a){if(r){let l=Os.u32.read(o,a);Ao.strict.equal(l,e,"invalid byte size"),a+=4}let c=new Array(e);for(let l=0;l<e;l++)c[l]=t.read(o,a+l*t.byteSize);return c},byteSize:i,length:e,elementByteSize:t.byteSize,lenPrefixByteSize:4,description:`Array<${t.description}>(${e})`}}mr.uniformFixedSizeArray=zS;function v0(t,e){let r=t.length,n=r===0?"<EMPTY>":t[0].description;return{write:function(i,o,a){Ao.strict.equal(a.length,r,`array length ${a.length} should match len ${r}`),Os.u32.write(i,o,r);let c=o+4;for(let l=0;l<r;l++){let m=t[l];m.write(i,c,a[l]),c+=m.byteSize}},read:function(i,o){let a=Os.u32.read(i,o);Ao.strict.equal(a,r,"invalid byte size");let c=o+4,l=new Array(r);for(let m=0;m<r;m++){let S=t[m];l[m]=S.read(i,c),c+=S.byteSize}return l},byteSize:4+e,length:r,description:`Array<${n}>(${r})[ 4 + ${e} ]`}}mr.fixedSizeArray=v0;function FS(t){return{toFixedFromData(e,r){let n=Os.u32.read(e,r);(0,o2.logTrace)(`${this.description}[${n}]`);let i=r+4,o=i,a=new Array(n);for(let c=0;c<n;c++){let l=(0,s2.fixBeetFromData)(t,e,o);a[c]=l,o+=l.byteSize}return v0(a,o-i)},toFixedFromValue(e){(0,Ao.strict)(Array.isArray(e),`${e} should be an array`);let r=0,n=new Array(e.length);for(let i=0;i<e.length;i++){let o=(0,s2.fixBeetFromValue)(t,e[i]);n[i]=o,r+=o.byteSize}return v0(n,r)},description:"array"}}mr.array=FS;function a2(t){return{write:function(e,r,n){n.copy(e,r,0,t)},read:function(e,r){return e.slice(r,r+t)},byteSize:t,description:`Buffer(${t})`}}mr.fixedSizeBuffer=a2;function w0(t,e=!1){let r=a2(t),n=e?t+4:t;return{write:function(i,o,a){Ao.strict.equal(a.byteLength,t,`Uint8Array length ${a.byteLength} should match len ${t}`),e&&(Os.u32.write(i,o,t),o+=4);let c=B.Buffer.from(a);r.write(i,o,c)},read:function(i,o){if(e){let c=Os.u32.read(i,o);Ao.strict.equal(c,t,"invalid byte size"),o+=4}let a=r.read(i,o);return Uint8Array.from(a)},byteSize:n,description:`Uint8Array(${t})`}}mr.fixedSizeUint8Array=w0;mr.uint8Array={toFixedFromData(t,e){let r=Os.u32.read(t,e);return(0,o2.logTrace)(`${this.description}[${r}]`),w0(r,!0)},toFixedFromValue(t){let e=t.byteLength;return w0(e,!0)},description:"Uint8Array"};mr.collectionsTypeMap={Array:{beet:"array",isFixable:!0,sourcePack:Pa.BEET_PACKAGE,ts:"Array",arg:Aa.BEET_TYPE_ARG_LEN},FixedSizeArray:{beet:"fixedSizeArray",isFixable:!1,sourcePack:Pa.BEET_PACKAGE,ts:"Array",arg:Aa.BEET_TYPE_ARG_LEN},UniformFixedSizeArray:{beet:"uniformFixedSizeArray",isFixable:!1,sourcePack:Pa.BEET_PACKAGE,ts:"Array",arg:Aa.BEET_TYPE_ARG_LEN},Buffer:{beet:"fixedSizeBuffer",isFixable:!1,sourcePack:Pa.BEET_PACKAGE,ts:"Buffer",arg:Aa.BEET_TYPE_ARG_LEN},FixedSizeUint8Array:{beet:"fixedSizeUint8Array",isFixable:!1,sourcePack:Pa.BEET_PACKAGE,ts:"Uint8Array",arg:Aa.BEET_TYPE_ARG_LEN},Uint8Array:{beet:"uint8Array",isFixable:!0,sourcePack:Pa.BEET_PACKAGE,ts:"Uint8Array",arg:Aa.BEET_TYPE_ARG_LEN}}});var x0=L(Fr=>{"use strict";E();I();Object.defineProperty(Fr,"__esModule",{value:!0});Fr.compositesTypeMap=Fr.coption=Fr.coptionSome=Fr.coptionNone=Fr.isNoneBuffer=Fr.isSomeBuffer=void 0;var ac=Jn(),_0=yr(),u2=yr(),f2=Hi(),c2=xa(),d2=0,l2=1;function E0(t,e){return t[e]===l2}Fr.isSomeBuffer=E0;function I0(t,e){return t[e]===d2}Fr.isNoneBuffer=I0;function S0(t){return(0,f2.logTrace)(`coptionNone(${t})`),{write:function(e,r,n){(0,ac.strict)(n==null,"coptionNone can only handle `null` values"),e[r]=d2},read:function(e,r){return(0,ac.strict)(I0(e,r),"coptionNone can only handle `NONE` data"),null},byteSize:1,description:`COption<None(${t})>`}}Fr.coptionNone=S0;function M0(t){let e=1+t.byteSize,r={write:function(n,i,o){(0,_0.assertFixedSizeBeet)(t,`coption inner type ${t.description} needs to be fixed before calling write`),(0,ac.strict)(o!=null,"coptionSome cannot handle `null` values"),n[i]=l2,t.write(n,i+1,o)},read:function(n,i){return(0,_0.assertFixedSizeBeet)(t,`coption inner type ${t.description} needs to be fixed before calling read`),(0,ac.strict)(E0(n,i),"coptionSome can only handle `SOME` data"),t.read(n,i+1)},description:`COption<${t.description}>[1 + ${t.byteSize}]`,byteSize:e,inner:t};return(0,f2.logTrace)(r.description),r}Fr.coptionSome=M0;function HS(t){return{toFixedFromData(e,r){if(E0(e,r)){let n=(0,c2.fixBeetFromData)(t,e,r+1);return M0(n)}else return(0,ac.strict)(I0(e,r),`Expected ${e} to hold a COption`),S0(t.description)},toFixedFromValue(e){return e==null?S0(t.description):M0((0,c2.fixBeetFromValue)(t,e))},description:`COption<${t.description}>`}}Fr.coption=HS;Fr.compositesTypeMap={option:{beet:"coption",isFixable:!0,sourcePack:u2.BEET_PACKAGE,ts:"COption<Inner>",arg:_0.BEET_TYPE_ARG_INNER,pack:u2.BEET_PACKAGE}}});var B0=L(vi=>{"use strict";E();I();Object.defineProperty(vi,"__esModule",{value:!0});vi.stringTypeMap=vi.utf8String=vi.fixedSizeUtf8String=void 0;var A0=yr(),h2=Jn(),P0=Ts(),VS=Hi(),WS=t=>({write:function(e,r,n){let i=B.Buffer.from(n,"utf8");h2.strict.equal(i.byteLength,t,`${n} has invalid byte size`),P0.u32.write(e,r,t),i.copy(e,r+4,0,t)},read:function(e,r){let n=P0.u32.read(e,r);return h2.strict.equal(n,t,"invalid byte size"),e.slice(r+4,r+4+t).toString("utf8")},elementByteSize:1,length:t,lenPrefixByteSize:4,byteSize:4+t,description:`Utf8String(4 + ${t})`});vi.fixedSizeUtf8String=WS;vi.utf8String={toFixedFromData(t,e){let r=P0.u32.read(t,e);return(0,VS.logTrace)(`${this.description}[${r}]`),(0,vi.fixedSizeUtf8String)(r)},toFixedFromValue(t){let e=B.Buffer.from(t).byteLength;return(0,vi.fixedSizeUtf8String)(e)},description:"Utf8String"};vi.stringTypeMap={fixedSizeString:{beet:"fixedSizeUtf8String",isFixable:!1,sourcePack:A0.BEET_PACKAGE,ts:"string",arg:A0.BEET_TYPE_ARG_LEN},string:{beet:"utf8String",isFixable:!0,sourcePack:A0.BEET_PACKAGE,ts:"string"}}});var k0=L(Ba=>{"use strict";E();I();Object.defineProperty(Ba,"__esModule",{value:!0});Ba.BeetReader=Ba.BeetWriter=void 0;var $S=Jn(),T0=class{constructor(e){this.buf=B.Buffer.alloc(e),this._offset=0}get buffer(){return this.buf}get offset(){return this._offset}maybeResize(e){this._offset+e>this.buf.length&&$S.strict.fail(`We shouldn't ever need to resize, but ${this._offset+e} > ${this.buf.length}`)}write(e,r){this.maybeResize(e.byteSize),e.write(this.buf,this._offset,r),this._offset+=e.byteSize}writeStruct(e,r){for(let[n,i]of r){let o=e[n];this.write(i,o)}}};Ba.BeetWriter=T0;var O0=class{constructor(e,r=0){this.buffer=e,this._offset=r}get offset(){return this._offset}read(e){let r=e.read(this.buffer,this._offset);return this._offset+=e.byteSize,r}readStruct(e){let r={};for(let[n,i]of e)r[n]=this.read(i);return r}};Ba.BeetReader=O0});var xd=L(ks=>{"use strict";E();I();Object.defineProperty(ks,"__esModule",{value:!0});ks.BeetArgsStruct=ks.isBeetStruct=ks.BeetStruct=void 0;var b2=k0(),Vi=Hi(),wi=class{constructor(e,r,n=wi.description){if(this.fields=e,this.construct=r,this.description=n,this.byteSize=this.getByteSize(),Vi.logDebug.enabled){let i=e.map(([o,a])=>`${String(o)}: ${a.description} ${(0,Vi.beetBytes)(a)}`).join(`
|
||
`);(0,Vi.logDebug)(`struct ${n} {
|
||
${i}
|
||
} ${(0,Vi.beetBytes)(this)}`)}}read(e,r){let[n]=this.deserialize(e,r);return n}write(e,r,n){let[i,o]=this.serialize(n);i.copy(e,r,0,o)}deserialize(e,r=0){Vi.logTrace.enabled&&((0,Vi.logTrace)("deserializing [%s] from %d bytes buffer",this.description,e.byteLength),(0,Vi.logTrace)(e),(0,Vi.logTrace)(e.toJSON().data));let n=new b2.BeetReader(e,r),i=n.readStruct(this.fields);return[this.construct(i),n.offset]}serialize(e,r=this.byteSize){(0,Vi.logTrace)("serializing [%s] %o to %d bytes buffer",this.description,e,r);let n=new b2.BeetWriter(r);return n.writeStruct(e,this.fields),[n.buffer,n.offset]}getByteSize(){return this.fields.reduce((e,[r,n])=>e+n.byteSize,0)}get type(){return wi.TYPE}};ks.BeetStruct=wi;wi.description="BeetStruct";wi.TYPE="BeetStruct";function GS(t){return t.type===wi.TYPE}ks.isBeetStruct=GS;var Ta=class extends wi{constructor(e,r=Ta.description){super(e,n=>n,r)}};ks.BeetArgsStruct=Ta;Ta.description="BeetArgsStruct"});var N0=L(_i=>{"use strict";E();I();var YS=_i&&_i.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(_i,"__esModule",{value:!0});_i.FixableBeetArgsStruct=_i.isFixableBeetStruct=_i.FixableBeetStruct=void 0;var p2=xa(),Ad=xd(),ZS=yr(),XS=Jn(),q0=Hi(),JS=YS(y0()),{brightBlack:QS}=JS.default,An=class{constructor(e,r,n=An.description){this.fields=e,this.construct=r,this.description=n;let i=0;if(q0.logDebug.enabled){let o=e.map(([c,l])=>((0,ZS.isFixedSizeBeet)(l)&&(i+=l.byteSize),`${c}: ${l.description} ${(0,q0.beetBytes)(l)}`)).join(`
|
||
`),a=`> ${i} B`;(0,q0.logDebug)(`struct ${n} {
|
||
${o}
|
||
} ${QS(a)}`)}}deserialize(e,r=0){return this.toFixedFromData(e,r).deserialize(e,r)}serialize(e,r){return this.toFixedFromValue(e).serialize(e,r)}toFixedFromData(e,r){let n=r,i=new Array(this.fields.length);for(let o=0;o<this.fields.length;o++){let[a,c]=this.fields[o],l=(0,p2.fixBeetFromData)(c,e,n);i[o]=[a,l],n+=l.byteSize}return this.description!==An.description?new Ad.BeetStruct(i,this.construct,this.description):new Ad.BeetStruct(i,this.construct)}toFixedFromValue(e){let r=Object.keys(e),n=new Array(this.fields.length);for(let i=0;i<this.fields.length;i++){let[o,a]=this.fields[i];(0,XS.strict)(r.includes(o),`Value with keys [ ${r} ] should include struct key '${o}' but doesn't.`);let c=e[o],l=(0,p2.fixBeetFromValue)(a,c);n[i]=[o,l]}return this.description!==An.description?new Ad.BeetStruct(n,this.construct,this.description):new Ad.BeetStruct(n,this.construct)}get type(){return An.TYPE}};_i.FixableBeetStruct=An;An.description="FixableBeetStruct";An.TYPE="FixableBeetStruct";function eM(t){return t.type===An.TYPE}_i.isFixableBeetStruct=eM;var Oa=class extends An{constructor(e,r=Oa.description){super(e,n=>n,r)}};_i.FixableBeetArgsStruct=Oa;Oa.description="FixableBeetArgsStruct"});var Pd=L(ka=>{"use strict";E();I();Object.defineProperty(ka,"__esModule",{value:!0});ka.unitTypeMap=ka.unit=void 0;var tM=yr();ka.unit={write:function(t,e,r){},read:function(t,e){},byteSize:0,description:"unit"};ka.unitTypeMap={unit:{beet:"unit",isFixable:!1,sourcePack:tM.BEET_PACKAGE,ts:"void"}}});var L0=L(Si=>{"use strict";E();I();Object.defineProperty(Si,"__esModule",{value:!0});Si.enumsTypeMap=Si.dataEnum=Si.uniformDataEnum=Si.fixedScalarEnum=void 0;var qs=yr(),$n=Ts(),qa=Jn(),rM=xd(),nM=N0(),iM=Pd();function g2(t,e){return e?`${t}`:t}function sM(t){let e=Object.keys(t);return{write(r,n,i){let o=typeof i=="number",a=g2(i,o);if(e.includes(a)||qa.fail(`${i} should be a variant of the provided enum type, i.e. [ ${Object.values(t).join(", ")} ], but isn't`),o)$n.u8.write(r,n,i);else{let c=t[a];$n.u8.write(r,n,c)}},read(r,n){let i=$n.u8.read(r,n),o=typeof i=="number",a=g2(i,o);return e.includes(a)||qa.fail(`${i} should be a of a variant of the provided enum type, i.e. [ ${Object.values(t).join(", ")} ], but isn't`),o?i:t[a]},byteSize:$n.u8.byteSize,description:"Enum"}}Si.fixedScalarEnum=sM;function oM(t){return{write:function(e,r,n){$n.u8.write(e,r,n.kind),t.write(e,r+1,n.data)},read:function(e,r){let n=$n.u8.read(e,r),i=t.read(e,r+1);return{kind:n,data:i}},byteSize:1+t.byteSize,description:`UniformDataEnum<${t.description}>`}}Si.uniformDataEnum=oM;function y2(t,e,r){return{write(n,i,o){$n.u8.write(n,i,e),t.write(n,i+$n.u8.byteSize,o)},read(n,i){let o=t.read(n,i+$n.u8.byteSize);return{__kind:r,...o}},byteSize:t.byteSize+$n.u8.byteSize,description:`EnumData<${t.description}>`}}function aM(t){for(let[e,r]of t)qa((0,rM.isBeetStruct)(r)||(0,nM.isFixableBeetStruct)(r)||r===iM.unit,"dataEnum: variants must be a data beet struct or a scalar unit");return{toFixedFromData(e,r){let n=$n.u8.read(e,r),i=t[n];qa(i!=null,`Discriminant ${n} out of range for ${t.length} variants`);let[o,a]=i,c=(0,qs.isFixedSizeBeet)(a)?a:a.toFixedFromData(e,r+1);return y2(c,n,o)},toFixedFromValue(e){if(e.__kind==null){let m=Object.keys(e).join(", "),S=t.map(([_])=>_).join(", ");qa.fail(`Value with fields [ ${m} ] is missing __kind, which needs to be set to one of [ ${S} ]`)}let r=t.findIndex(([m])=>m===e.__kind);if(r<0){let m=t.map(([S])=>S).join(", ");qa.fail(`${e.__kind} is not a valid kind, needs to be one of [ ${m} ]`)}let n=t[r],{__kind:i,...o}=e,[a,c]=n,l=(0,qs.isFixedSizeBeet)(c)?c:c.toFixedFromValue(o);return y2(l,r,a)},description:`DataEnum<${t.length} variants>`}}Si.dataEnum=aM;Si.enumsTypeMap={fixedScalarEnum:{beet:"fixedScalarEnum",isFixable:!1,sourcePack:qs.BEET_PACKAGE,ts:"<TypeName>",arg:qs.BEET_TYPE_ARG_INNER,pack:qs.BEET_PACKAGE},dataEnum:{beet:"dataEnum",isFixable:!1,sourcePack:qs.BEET_PACKAGE,ts:"DataEnum<Kind, Inner>",arg:qs.BEET_TYPE_ARG_INNER,pack:qs.BEET_PACKAGE}}});var K0=L(Na=>{"use strict";E();I();Object.defineProperty(Na,"__esModule",{value:!0});Na.aliasesTypeMap=Na.bytes=void 0;var m2=Id();Na.bytes=m2.uint8Array;Na.aliasesTypeMap={bytes:m2.collectionsTypeMap.Uint8Array}});var U0=L(Ns=>{"use strict";E();I();Object.defineProperty(Ns,"__esModule",{value:!0});Ns.tuplesTypeMap=Ns.tuple=Ns.fixedSizeTuple=void 0;var v2=yr(),D0=Jn(),w2=xa();function R0(t){let e=t.length,r=t.map(o=>o.description),n=t.map(o=>o.byteSize),i=n.reduce((o,a)=>o+a,0);return{write:function(o,a,c){D0.strict.equal(c.length,e,`tuple value element size ${c.length} should match len ${e}`);let l=a;for(let m=0;m<e;m++){let S=c[m],_=t[m];_.write(o,l,S),l+=_.byteSize}},read:function(o,a){let c=[],l=a;for(let m=0;m<e;m++){let S=t[m];c[m]=S.read(o,l),l+=S.byteSize}return c},byteSize:i,length:e,description:`FixedSizeTuple<${r.join(",")}>[ ${n.join(", ")} ]`}}Ns.fixedSizeTuple=R0;function uM(t){let e=t.length,r=t.map(n=>n.description);return{toFixedFromData(n,i){let o=i,a=new Array(e);for(let c=0;c<e;c++){let l=(0,w2.fixBeetFromData)(t[c],n,o);a[c]=l,o+=l.byteSize}return R0(a)},toFixedFromValue(n){(0,D0.strict)(Array.isArray(n),`${n} should be an array of tuple values`),D0.strict.equal(n.length,e,`There should be ${e} tuple values, but there are ${n.length}`);let i=new Array(e);for(let o=0;o<n.length;o++){let a=(0,w2.fixBeetFromValue)(t[o],n[o]);i[o]=a}return R0(i)},description:`Tuple<${r.join(",")}>`}}Ns.tuple=uM;Ns.tuplesTypeMap={Tuple:{beet:"tuple",isFixable:!0,sourcePack:v2.BEET_PACKAGE,ts:"[__tuple_elements__]"},FixedSizeTuple:{beet:"fixedSizeTuple",isFixable:!1,sourcePack:v2.BEET_PACKAGE,ts:"[__tuple_elements__]"}}});var z0=L(La=>{"use strict";E();I();Object.defineProperty(La,"__esModule",{value:!0});La.mapsTypeMap=La.map=void 0;var uc=yr(),C0=Ts(),cM=Hi(),j0=Jn();function Bd(t,e,r,n){let i=(0,uc.isFixedSizeBeet)(t),o=(0,uc.isFixedSizeBeet)(e);function a(){if(i&&o){let m=t.byteSize+e.byteSize;return{elementByteSize:m,byteSize:4+n*m}}else if(i){let m=0;for(let[_,P]of r.values())m+=P.byteSize;return{elementByteSize:t.byteSize+Math.ceil(m/n),byteSize:4+t.byteSize*n+m}}else if(o){let m=0;for(let[_,P]of r.values())m+=_.byteSize;return{elementByteSize:Math.ceil(m/n)+e.byteSize,byteSize:4+m+e.byteSize*n}}else{let m=0,S=0;for(let[P,x]of r.values())m+=P.byteSize,S+=x.byteSize;return{elementByteSize:Math.ceil(m/n+S/n),byteSize:4+m+S}}}let{elementByteSize:c,byteSize:l}=a();return{write:function(m,S,_){let P=S+4,x=0;for(let[T,M]of _.entries()){let k=i?t:null,N=o?e:null;if(k==null||N==null){let R=r.get(T);(0,j0.strict)(R!=null,`Should be able to find beet els for ${(0,cM.stringify)(T)}, but could not`),k??(k=R[0]),N??(N=R[1])}k.write(m,P,T),P+=k.byteSize,N.write(m,P,M),P+=N.byteSize,x++}C0.u32.write(m,S,x),j0.strict.equal(x,n,`Expected map to have size ${n}, but has ${x}.`)},read:function(m,S){let _=C0.u32.read(m,S);j0.strict.equal(_,n,`Expected map to have size ${n}, but has ${_}.`);let P=S+4,x=new Map;for(let T=0;T<_;T++){let M=i?t:t.toFixedFromData(m,P),k=M.read(m,P);P+=M.byteSize;let N=o?e:e.toFixedFromData(m,P),R=N.read(m,P);P+=N.byteSize,x.set(k,R)}return x},elementByteSize:c,byteSize:l,length:n,lenPrefixByteSize:4,description:`Map<${t.description}, ${e.description}>`}}function fM(t,e){let r=(0,uc.isFixedSizeBeet)(t),n=(0,uc.isFixedSizeBeet)(e);return{toFixedFromData(i,o){let a=C0.u32.read(i,o),c=o+4;if(r&&n)return Bd(t,e,new Map,a);let l=new Map;for(let m=0;m<a;m++){let S=r?t:t.toFixedFromData(i,c),_=S.read(i,c);c+=S.byteSize;let P=n?e:e.toFixedFromData(i,c);c+=P.byteSize,l.set(_,[S,P])}return Bd(t,e,l,a)},toFixedFromValue(i){let o=i.size;if(r&&n)return Bd(t,e,new Map,o);let a=new Map;for(let[c,l]of i){let m=r?t:t.toFixedFromValue(c),S=n?e:e.toFixedFromValue(l);a.set(c,[m,S])}return Bd(t,e,a,o)},description:`FixableMap<${t.description}, ${e.description}>`}}La.map=fM;La.mapsTypeMap={Map:{beet:"map",isFixable:!0,sourcePack:uc.BEET_PACKAGE,ts:"Map"}}});var W0=L(Ka=>{"use strict";E();I();Object.defineProperty(Ka,"__esModule",{value:!0});Ka.setsTypeMap=Ka.set=void 0;var V0=yr(),H0=Ts(),dM=Hi(),F0=Jn();function Td(t,e,r){let n=(0,V0.isFixedSizeBeet)(t);function i(){if(n){let c=t.byteSize;return{elementByteSize:c,byteSize:4+r*c}}else{let c=0;for(let m of e.values())c+=m.byteSize;return{elementByteSize:Math.ceil(c/r),byteSize:4+c}}}let{elementByteSize:o,byteSize:a}=i();return{write:function(c,l,m){let S=l+4,_=0;for(let P of m.keys()){let x=n?t:null;if(x==null){let T=e.get(P);(0,F0.strict)(T!=null,`Should be able to find beet el for ${(0,dM.stringify)(P)}, but could not`),x??(x=T)}x.write(c,S,P),S+=x.byteSize,_++}H0.u32.write(c,l,_),F0.strict.equal(_,r,`Expected set to have size ${r}, but has ${_}.`)},read:function(c,l){let m=H0.u32.read(c,l);F0.strict.equal(m,r,`Expected set to have size ${r}, but has ${m}.`);let S=l+4,_=new Set;for(let P=0;P<m;P++){let x=n?t:t.toFixedFromData(c,S),T=x.read(c,S);S+=x.byteSize,_.add(T)}return _},elementByteSize:o,byteSize:a,length:r,lenPrefixByteSize:4,description:`Set<${t.description}>`}}function lM(t){let e=(0,V0.isFixedSizeBeet)(t);return{toFixedFromData(r,n){let i=H0.u32.read(r,n),o=n+4;if(e)return Td(t,new Map,i);let a=new Map;for(let c=0;c<i;c++){let l=e?t:t.toFixedFromData(r,o),m=l.read(r,o);o+=l.byteSize,a.set(m,l)}return Td(t,a,i)},toFixedFromValue(r){let n=r.size;if(e)return Td(t,new Map,n);let i=new Map;for(let o of r){let a=e?t:t.toFixedFromValue(o);i.set(o,a)}return Td(t,i,n)},description:`FixableSet<${t.description}>`}}Ka.set=lM;Ka.setsTypeMap={Set:{beet:"set",isFixable:!0,sourcePack:V0.BEET_PACKAGE,ts:"Set"}}});var Hr=L(It=>{"use strict";E();I();var hM=It&&It.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Ir=It&&It.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&hM(e,t,r)};Object.defineProperty(It,"__esModule",{value:!0});It.supportedTypeMap=void 0;var bM=Id(),pM=x0(),gM=Ts(),yM=B0(),mM=L0(),vM=K0(),wM=U0(),_M=z0(),SM=Pd(),MM=W0();Ir(K0(),It);Ir(Id(),It);Ir(x0(),It);Ir(L0(),It);Ir(z0(),It);Ir(Ts(),It);Ir(W0(),It);Ir(B0(),It);Ir(U0(),It);Ir(Pd(),It);Ir(xa(),It);Ir(k0(),It);Ir(xd(),It);Ir(N0(),It);Ir(yr(),It);It.supportedTypeMap={...bM.collectionsTypeMap,...yM.stringTypeMap,...pM.compositesTypeMap,...mM.enumsTypeMap,...gM.numbersTypeMap,...vM.aliasesTypeMap,...wM.tuplesTypeMap,..._M.mapsTypeMap,...MM.setsTypeMap,...SM.unitTypeMap}});var kd=L(Od=>{"use strict";E();I();Object.defineProperty(Od,"__esModule",{value:!0});Od.publicKey=void 0;var EM=St(),IM=Hr(),$0=(0,IM.fixedSizeUint8Array)(32);Od.publicKey={write:function(t,e,r){let n=r.toBytes();$0.write(t,e,n)},read:function(t,e){let r=$0.read(t,e);return new EM.PublicKey(r)},byteSize:$0.byteSize,description:"PublicKey"}});var Y0=L(Mi=>{"use strict";E();I();var xM=Mi&&Mi.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),AM=Mi&&Mi.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),PM=Mi&&Mi.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&xM(e,t,r);return AM(e,t),e};Object.defineProperty(Mi,"__esModule",{value:!0});Mi.seedsVecBeet=void 0;var G0=PM(Hr());Mi.seedsVecBeet=new G0.FixableBeetArgsStruct([["seeds",G0.array(G0.bytes)]],"SeedsVec")});var Z0=L(Ei=>{"use strict";E();I();var BM=Ei&&Ei.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),TM=Ei&&Ei.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),OM=Ei&&Ei.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&BM(e,t,r);return TM(e,t),e};Object.defineProperty(Ei,"__esModule",{value:!0});Ei.leafInfoBeet=void 0;var Da=OM(Hr());Ei.leafInfoBeet=new Da.FixableBeetArgsStruct([["leaf",Da.uniformFixedSizeArray(Da.u8,32)],["proof",Da.array(Da.uniformFixedSizeArray(Da.u8,32))]],"LeafInfo")});var X0=L(Jt=>{"use strict";E();I();var kM=Jt&&Jt.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),qM=Jt&&Jt.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_2=Jt&&Jt.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&kM(e,t,r);return qM(e,t),e};Object.defineProperty(Jt,"__esModule",{value:!0});Jt.payloadTypeBeet=Jt.isPayloadTypeNumber=Jt.isPayloadTypeMerkleProof=Jt.isPayloadTypeSeeds=Jt.isPayloadTypePubkey=void 0;var Ii=_2(Hr()),NM=_2(kd()),LM=Y0(),KM=Z0(),DM=t=>t.__kind==="Pubkey";Jt.isPayloadTypePubkey=DM;var RM=t=>t.__kind==="Seeds";Jt.isPayloadTypeSeeds=RM;var UM=t=>t.__kind==="MerkleProof";Jt.isPayloadTypeMerkleProof=UM;var jM=t=>t.__kind==="Number";Jt.isPayloadTypeNumber=jM;Jt.payloadTypeBeet=Ii.dataEnum([["Pubkey",new Ii.BeetArgsStruct([["fields",Ii.fixedSizeTuple([NM.publicKey])]],'PayloadTypeRecord["Pubkey"]')],["Seeds",new Ii.FixableBeetArgsStruct([["fields",Ii.tuple([LM.seedsVecBeet])]],'PayloadTypeRecord["Seeds"]')],["MerkleProof",new Ii.FixableBeetArgsStruct([["fields",Ii.tuple([KM.leafInfoBeet])]],'PayloadTypeRecord["MerkleProof"]')],["Number",new Ii.BeetArgsStruct([["fields",Ii.fixedSizeTuple([Ii.u64])]],'PayloadTypeRecord["Number"]')]])});var Q0=L(xi=>{"use strict";E();I();var CM=xi&&xi.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),zM=xi&&xi.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),FM=xi&&xi.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&CM(e,t,r);return zM(e,t),e};Object.defineProperty(xi,"__esModule",{value:!0});xi.payloadBeet=void 0;var J0=FM(Hr()),HM=X0();xi.payloadBeet=new J0.FixableBeetArgsStruct([["map",J0.map(J0.utf8String,HM.payloadTypeBeet)]],"Payload")});var qd=L(Ai=>{"use strict";E();I();var VM=Ai&&Ai.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),WM=Ai&&Ai.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$M=Ai&&Ai.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&VM(e,t,r);return WM(e,t),e};Object.defineProperty(Ai,"__esModule",{value:!0});Ai.authorizationDataBeet=void 0;var GM=$M(Hr()),YM=Q0();Ai.authorizationDataBeet=new GM.FixableBeetArgsStruct([["payload",YM.payloadBeet]],"AuthorizationData")});var eb=L(Pn=>{"use strict";E();I();var ZM=Pn&&Pn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),XM=Pn&&Pn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),JM=Pn&&Pn.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&ZM(e,t,r);return XM(e,t),e};Object.defineProperty(Pn,"__esModule",{value:!0});Pn.transferArgsBeet=Pn.isTransferArgsV1=void 0;var Nd=JM(Hr()),QM=qd(),eE=t=>t.__kind==="V1";Pn.isTransferArgsV1=eE;Pn.transferArgsBeet=Nd.dataEnum([["V1",new Nd.FixableBeetArgsStruct([["amount",Nd.u64],["authorizationData",Nd.coption(QM.authorizationDataBeet)]],'TransferArgsRecord["V1"]')]])});var E2=L(vr=>{"use strict";E();I();var tE=vr&&vr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),rE=vr&&vr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),M2=vr&&vr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&tE(e,t,r);return rE(e,t),e};Object.defineProperty(vr,"__esModule",{value:!0});vr.createTransferInstruction=vr.transferInstructionDiscriminator=vr.TransferStruct=void 0;var S2=M2(Hr()),tb=M2(St()),nE=eb();vr.TransferStruct=new S2.FixableBeetArgsStruct([["instructionDiscriminator",S2.u8],["transferArgs",nE.transferArgsBeet]],"TransferInstructionArgs");vr.transferInstructionDiscriminator=49;function iE(t,e,r=new tb.PublicKey("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s")){let[n]=vr.TransferStruct.serialize({instructionDiscriminator:vr.transferInstructionDiscriminator,...e}),i=[{pubkey:t.token,isWritable:!0,isSigner:!1},{pubkey:t.tokenOwner,isWritable:!1,isSigner:!1},{pubkey:t.destination,isWritable:!0,isSigner:!1},{pubkey:t.destinationOwner,isWritable:!1,isSigner:!1},{pubkey:t.mint,isWritable:!1,isSigner:!1},{pubkey:t.metadata,isWritable:!0,isSigner:!1},{pubkey:t.edition??r,isWritable:!1,isSigner:!1},{pubkey:t.ownerTokenRecord??r,isWritable:t.ownerTokenRecord!=null,isSigner:!1},{pubkey:t.destinationTokenRecord??r,isWritable:t.destinationTokenRecord!=null,isSigner:!1},{pubkey:t.authority,isWritable:!1,isSigner:!0},{pubkey:t.payer,isWritable:!0,isSigner:!0},{pubkey:t.systemProgram??tb.SystemProgram.programId,isWritable:!1,isSigner:!1},{pubkey:t.sysvarInstructions,isWritable:!1,isSigner:!1},{pubkey:t.splTokenProgram,isWritable:!1,isSigner:!1},{pubkey:t.splAtaProgram,isWritable:!1,isSigner:!1},{pubkey:t.authorizationRulesProgram??r,isWritable:!1,isSigner:!1},{pubkey:t.authorizationRules??r,isWritable:!1,isSigner:!1}];return new tb.TransactionInstruction({programId:r,keys:i,data:n})}vr.createTransferInstruction=iE});var I2=L(Po=>{"use strict";E();I();var sE=Po&&Po.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),oE=Po&&Po.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&sE(e,t,r)};Object.defineProperty(Po,"__esModule",{value:!0});oE(E2(),Po)});var A2=L(Qr=>{"use strict";E();I();var aE=Qr&&Qr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),uE=Qr&&Qr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),cE=Qr&&Qr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&aE(e,t,r);return uE(e,t),e};Object.defineProperty(Qr,"__esModule",{value:!0});Qr.authorityTypeBeet=Qr.AuthorityType=void 0;var fE=cE(Hr()),x2;(function(t){t[t.None=0]="None",t[t.Metadata=1]="Metadata",t[t.Holder=2]="Holder",t[t.MetadataDelegate=3]="MetadataDelegate",t[t.TokenDelegate=4]="TokenDelegate"})(x2=Qr.AuthorityType||(Qr.AuthorityType={}));Qr.authorityTypeBeet=fE.fixedScalarEnum(x2)});var B2=L(Ge=>{"use strict";E();I();var dE=Ge&&Ge.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),lE=Ge&&Ge.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),P2=Ge&&Ge.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&dE(e,t,r);return lE(e,t),e};Object.defineProperty(Ge,"__esModule",{value:!0});Ge.delegateArgsBeet=Ge.isDelegateArgsProgrammableConfigItemV1=Ge.isDelegateArgsCollectionItemV1=Ge.isDelegateArgsDataItemV1=Ge.isDelegateArgsAuthorityItemV1=Ge.isDelegateArgsProgrammableConfigV1=Ge.isDelegateArgsLockedTransferV1=Ge.isDelegateArgsStandardV1=Ge.isDelegateArgsStakingV1=Ge.isDelegateArgsUtilityV1=Ge.isDelegateArgsDataV1=Ge.isDelegateArgsTransferV1=Ge.isDelegateArgsSaleV1=Ge.isDelegateArgsCollectionV1=void 0;var rt=P2(Hr()),hE=P2(kd()),Bn=qd(),bE=t=>t.__kind==="CollectionV1";Ge.isDelegateArgsCollectionV1=bE;var pE=t=>t.__kind==="SaleV1";Ge.isDelegateArgsSaleV1=pE;var gE=t=>t.__kind==="TransferV1";Ge.isDelegateArgsTransferV1=gE;var yE=t=>t.__kind==="DataV1";Ge.isDelegateArgsDataV1=yE;var mE=t=>t.__kind==="UtilityV1";Ge.isDelegateArgsUtilityV1=mE;var vE=t=>t.__kind==="StakingV1";Ge.isDelegateArgsStakingV1=vE;var wE=t=>t.__kind==="StandardV1";Ge.isDelegateArgsStandardV1=wE;var _E=t=>t.__kind==="LockedTransferV1";Ge.isDelegateArgsLockedTransferV1=_E;var SE=t=>t.__kind==="ProgrammableConfigV1";Ge.isDelegateArgsProgrammableConfigV1=SE;var ME=t=>t.__kind==="AuthorityItemV1";Ge.isDelegateArgsAuthorityItemV1=ME;var EE=t=>t.__kind==="DataItemV1";Ge.isDelegateArgsDataItemV1=EE;var IE=t=>t.__kind==="CollectionItemV1";Ge.isDelegateArgsCollectionItemV1=IE;var xE=t=>t.__kind==="ProgrammableConfigItemV1";Ge.isDelegateArgsProgrammableConfigItemV1=xE;Ge.delegateArgsBeet=rt.dataEnum([["CollectionV1",new rt.FixableBeetArgsStruct([["authorizationData",rt.coption(Bn.authorizationDataBeet)]],'DelegateArgsRecord["CollectionV1"]')],["SaleV1",new rt.FixableBeetArgsStruct([["amount",rt.u64],["authorizationData",rt.coption(Bn.authorizationDataBeet)]],'DelegateArgsRecord["SaleV1"]')],["TransferV1",new rt.FixableBeetArgsStruct([["amount",rt.u64],["authorizationData",rt.coption(Bn.authorizationDataBeet)]],'DelegateArgsRecord["TransferV1"]')],["DataV1",new rt.FixableBeetArgsStruct([["authorizationData",rt.coption(Bn.authorizationDataBeet)]],'DelegateArgsRecord["DataV1"]')],["UtilityV1",new rt.FixableBeetArgsStruct([["amount",rt.u64],["authorizationData",rt.coption(Bn.authorizationDataBeet)]],'DelegateArgsRecord["UtilityV1"]')],["StakingV1",new rt.FixableBeetArgsStruct([["amount",rt.u64],["authorizationData",rt.coption(Bn.authorizationDataBeet)]],'DelegateArgsRecord["StakingV1"]')],["StandardV1",new rt.BeetArgsStruct([["amount",rt.u64]],'DelegateArgsRecord["StandardV1"]')],["LockedTransferV1",new rt.FixableBeetArgsStruct([["amount",rt.u64],["lockedAddress",hE.publicKey],["authorizationData",rt.coption(Bn.authorizationDataBeet)]],'DelegateArgsRecord["LockedTransferV1"]')],["ProgrammableConfigV1",new rt.FixableBeetArgsStruct([["authorizationData",rt.coption(Bn.authorizationDataBeet)]],'DelegateArgsRecord["ProgrammableConfigV1"]')],["AuthorityItemV1",new rt.FixableBeetArgsStruct([["authorizationData",rt.coption(Bn.authorizationDataBeet)]],'DelegateArgsRecord["AuthorityItemV1"]')],["DataItemV1",new rt.FixableBeetArgsStruct([["authorizationData",rt.coption(Bn.authorizationDataBeet)]],'DelegateArgsRecord["DataItemV1"]')],["CollectionItemV1",new rt.FixableBeetArgsStruct([["authorizationData",rt.coption(Bn.authorizationDataBeet)]],'DelegateArgsRecord["CollectionItemV1"]')],["ProgrammableConfigItemV1",new rt.FixableBeetArgsStruct([["authorizationData",rt.coption(Bn.authorizationDataBeet)]],'DelegateArgsRecord["ProgrammableConfigItemV1"]')]])});var O2=L(en=>{"use strict";E();I();var AE=en&&en.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),PE=en&&en.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),BE=en&&en.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&AE(e,t,r);return PE(e,t),e};Object.defineProperty(en,"__esModule",{value:!0});en.metadataDelegateRoleBeet=en.MetadataDelegateRole=void 0;var TE=BE(Hr()),T2;(function(t){t[t.AuthorityItem=0]="AuthorityItem",t[t.Collection=1]="Collection",t[t.Use=2]="Use",t[t.Data=3]="Data",t[t.ProgrammableConfig=4]="ProgrammableConfig",t[t.DataItem=5]="DataItem",t[t.CollectionItem=6]="CollectionItem",t[t.ProgrammableConfigItem=7]="ProgrammableConfigItem"})(T2=en.MetadataDelegateRole||(en.MetadataDelegateRole={}));en.metadataDelegateRoleBeet=TE.fixedScalarEnum(T2)});var q2=L(tn=>{"use strict";E();I();var OE=tn&&tn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),kE=tn&&tn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),qE=tn&&tn.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&OE(e,t,r);return kE(e,t),e};Object.defineProperty(tn,"__esModule",{value:!0});tn.tokenDelegateRoleBeet=tn.TokenDelegateRole=void 0;var NE=qE(Hr()),k2;(function(t){t[t.Sale=0]="Sale",t[t.Transfer=1]="Transfer",t[t.Utility=2]="Utility",t[t.Staking=3]="Staking",t[t.Standard=4]="Standard",t[t.LockedTransfer=5]="LockedTransfer",t[t.Migration=6]="Migration"})(k2=tn.TokenDelegateRole||(tn.TokenDelegateRole={}));tn.tokenDelegateRoleBeet=NE.fixedScalarEnum(k2)});var L2=L(rn=>{"use strict";E();I();var LE=rn&&rn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),KE=rn&&rn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),DE=rn&&rn.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&LE(e,t,r);return KE(e,t),e};Object.defineProperty(rn,"__esModule",{value:!0});rn.tokenStandardBeet=rn.TokenStandard=void 0;var RE=DE(Hr()),N2;(function(t){t[t.NonFungible=0]="NonFungible",t[t.FungibleAsset=1]="FungibleAsset",t[t.Fungible=2]="Fungible",t[t.NonFungibleEdition=3]="NonFungibleEdition",t[t.ProgrammableNonFungible=4]="ProgrammableNonFungible"})(N2=rn.TokenStandard||(rn.TokenStandard={}));rn.tokenStandardBeet=RE.fixedScalarEnum(N2)});var K2=L(sr=>{"use strict";E();I();var UE=sr&&sr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Gn=sr&&sr.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&UE(e,t,r)};Object.defineProperty(sr,"__esModule",{value:!0});Gn(A2(),sr);Gn(qd(),sr);Gn(B2(),sr);Gn(Z0(),sr);Gn(O2(),sr);Gn(Q0(),sr);Gn(X0(),sr);Gn(Y0(),sr);Gn(q2(),sr);Gn(L2(),sr);Gn(eb(),sr)});var Ls=L(nn=>{"use strict";E();I();var jE=nn&&nn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),D2=nn&&nn.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&jE(e,t,r)};Object.defineProperty(nn,"__esModule",{value:!0});nn.PROGRAM_ID=nn.PROGRAM_ADDRESS=void 0;var CE=St();D2(I2(),nn);D2(K2(),nn);nn.PROGRAM_ADDRESS="metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s";nn.PROGRAM_ID=new CE.PublicKey(nn.PROGRAM_ADDRESS)});var rb=L(Wi=>{"use strict";E();I();Object.defineProperty(Wi,"__esModule",{value:!0});Wi.isBigNumber=Wi.toOptionBigNumber=Wi.toBigNumber=void 0;var zE=ur(),FE=(t,e)=>new zE.BN(t,e);Wi.toBigNumber=FE;var HE=t=>t===null?null:(0,Wi.toBigNumber)(t);Wi.toOptionBigNumber=HE;var VE=t=>t?.__opaque__==="BigNumber";Wi.isBigNumber=VE});var U2=L(Ld=>{"use strict";E();I();Object.defineProperty(Ld,"__esModule",{value:!0});Ld.token=void 0;var R2=rb(),WE=(t,e=0,r="Token")=>(typeof t!="number"&&(t=(0,R2.toBigNumber)(t).toNumber()),{basisPoints:(0,R2.toBigNumber)(t*Math.pow(10,e)),currency:{symbol:r,decimals:e,namespace:"spl-token"}});Ld.token=WE});var C2=L(Kd=>{"use strict";E();I();Object.defineProperty(Kd,"__esModule",{value:!0});Kd.Pda=void 0;var j2=St(),cc=class extends j2.PublicKey{constructor(e,r){super(e),this.bump=r}static find(e,r){let[n,i]=j2.PublicKey.findProgramAddressSync(r,e);return new cc(n,i)}};Kd.Pda=cc});var F2=L(Pi=>{"use strict";E();I();Object.defineProperty(Pi,"__esModule",{value:!0});Pi.systemProgram=Pi.associatedTokenProgram=Pi.tokenProgram=Pi.tokenMetadataProgram=void 0;var $E=St(),GE=Ls(),z2=wd();Pi.tokenMetadataProgram={name:"TokenMetadataProgram",address:GE.PROGRAM_ID};Pi.tokenProgram={name:"TokenProgram",address:z2.TOKEN_PROGRAM_ID};Pi.associatedTokenProgram={name:"AssociatedTokenProgram",address:z2.ASSOCIATED_TOKEN_PROGRAM_ID};Pi.systemProgram={name:"SystemProgram",address:$E.SystemProgram.programId}});var H2=L(Ra=>{"use strict";E();I();Object.defineProperty(Ra,"__esModule",{value:!0});Ra.toPublicKey=Ra.PublicKey=void 0;var YE=St(),ZE=St();Object.defineProperty(Ra,"PublicKey",{enumerable:!0,get:function(){return ZE.PublicKey}});var XE=t=>typeof t=="object"&&"publicKey"in t?t.publicKey:typeof t=="object"&&"address"in t?t.address:new YE.PublicKey(t);Ra.toPublicKey=XE});var V2=L(xr=>{"use strict";E();I();Object.defineProperty(xr,"__esModule",{value:!0});xr.getSignerHistogram=xr.isIdentitySigner=xr.isKeypairSigner=xr.isSigner=void 0;var JE=t=>typeof t=="object"&&"publicKey"in t&&("secretKey"in t||"signTransaction"in t);xr.isSigner=JE;var QE=t=>(0,xr.isSigner)(t)&&"secretKey"in t&&t.secretKey!=null;xr.isKeypairSigner=QE;var eI=t=>(0,xr.isSigner)(t)&&!(0,xr.isKeypairSigner)(t);xr.isIdentitySigner=eI;var tI=t=>t.reduce((e,r)=>{let n=e.all.findIndex(({publicKey:c})=>c.equals(r.publicKey)),i=e.all[n]??null,o=i?(0,xr.isIdentitySigner)(i):!1,a=(0,xr.isIdentitySigner)(r);if(!i)e.all.push(r),a?e.identities.push(r):e.keypairs.push(r);else if(o&&!a){let c=e.identities.findIndex(({publicKey:l})=>l.equals(r.publicKey));e.all.splice(n,1),e.identities.splice(c,1),e.all.push(r),e.keypairs.push(r)}return e},{all:[],keypairs:[],identities:[]});xr.getSignerHistogram=tI});var ja=L(Tn=>{"use strict";E();I();var rI=Tn&&Tn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Ua=Tn&&Tn.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&rI(e,t,r)};Object.defineProperty(Tn,"__esModule",{value:!0});Ua(U2(),Tn);Ua(rb(),Tn);Ua(C2(),Tn);Ua(F2(),Tn);Ua(H2(),Tn);Ua(V2(),Tn)});var W2=L(Yn=>{"use strict";E();I();Object.defineProperty(Yn,"__esModule",{value:!0});Yn.getDefaultDelegateArgs=Yn.getMetadataDelegateRoleSeed=Yn.getMetadataDelegateRole=Yn.getTokenDelegateRole=void 0;var or=Ls(),nI={StandardV1:or.TokenDelegateRole.Standard,TransferV1:or.TokenDelegateRole.Transfer,LockedTransferV1:or.TokenDelegateRole.LockedTransfer,SaleV1:or.TokenDelegateRole.Sale,UtilityV1:or.TokenDelegateRole.Utility,StakingV1:or.TokenDelegateRole.Staking},iI={CollectionV1:or.MetadataDelegateRole.Collection,DataV1:or.MetadataDelegateRole.Data,ProgrammableConfigV1:or.MetadataDelegateRole.ProgrammableConfig},sI={[or.MetadataDelegateRole.AuthorityItem]:"authority_item_delegate",[or.MetadataDelegateRole.Collection]:"collection_delegate",[or.MetadataDelegateRole.Use]:"use_delegate",[or.MetadataDelegateRole.Data]:"data_delegate",[or.MetadataDelegateRole.ProgrammableConfig]:"programmable_config_delegate",[or.MetadataDelegateRole.DataItem]:"data_item_delegate",[or.MetadataDelegateRole.CollectionItem]:"collection_item_delegate",[or.MetadataDelegateRole.ProgrammableConfigItem]:"prog_config_item_delegate"},oI={CollectionV1:!1,DataV1:!1,ProgrammableConfigV1:!1,StandardV1:!0,TransferV1:!0,SaleV1:!0,UtilityV1:!0,StakingV1:!0,LockedTransferV1:!0},aI=t=>{let e=nI[t];if(!e)throw new Error(`UnreachableCaseError: ${t}`);return e};Yn.getTokenDelegateRole=aI;var uI=t=>{let e=iI[t];if(!e)throw new Error(`UnreachableCaseError: ${t}`);return e};Yn.getMetadataDelegateRole=uI;var cI=t=>sI[(0,Yn.getMetadataDelegateRole)(t)];Yn.getMetadataDelegateRoleSeed=cI;var fI=t=>{let e=oI[t];if(e===void 0)throw new Error(`UnreachableCaseError: ${t}`);if(e)throw new Error(`DelegateRoleRequiredDataError: ${t}`);return{__kind:t}};Yn.getDefaultDelegateArgs=fI});var nb=L(On=>{"use strict";E();I();Object.defineProperty(On,"__esModule",{value:!0});On.getMetadataDelegateRecord=On.getTokenRecord=On.getAssociatedTokenAccount=On.getMasterEdition=On.getMetadata=void 0;var To=Pr(),Dd=Ls(),Bo=ja(),dI=W2(),lI=t=>{let e=Dd.PROGRAM_ID;return Bo.Pda.find(e,[To.Buffer.from("metadata","utf8"),e.toBuffer(),t.toBuffer()])};On.getMetadata=lI;var hI=t=>{let e=Dd.PROGRAM_ID;return Bo.Pda.find(e,[To.Buffer.from("metadata","utf8"),e.toBuffer(),t.toBuffer(),To.Buffer.from("edition","utf8")])};On.getMasterEdition=hI;var bI=t=>Bo.Pda.find(Bo.associatedTokenProgram.address,[t.owner.toBuffer(),Bo.tokenProgram.address.toBuffer(),t.mint.toBuffer()]);On.getAssociatedTokenAccount=bI;var pI=t=>{let e=Dd.PROGRAM_ID;return Bo.Pda.find(e,[To.Buffer.from("metadata","utf8"),e.toBuffer(),t.mint.toBuffer(),To.Buffer.from("token_record","utf8"),t.token.toBuffer()])};On.getTokenRecord=pI;var gI=t=>{let e=Dd.PROGRAM_ID;return Bo.Pda.find(e,[To.Buffer.from("metadata","utf8"),e.toBuffer(),t.mint.toBuffer(),To.Buffer.from((0,dI.getMetadataDelegateRoleSeed)(t.type),"utf8"),t.updateAuthority.toBuffer(),t.delegate.toBuffer()])};On.getMetadataDelegateRecord=gI});var $2=L(Rd=>{"use strict";E();I();Object.defineProperty(Rd,"__esModule",{value:!0});Rd.parseTokenMetadataDelegateInput=void 0;var yI=ja(),ib=nb(),mI=(t,e,r)=>{if("updateAuthority"in e)return{isTokenDelegate:!1,delegate:e.delegate,approver:e.updateAuthority,delegateRecord:(0,ib.getMetadataDelegateRecord)({mint:t,type:e.type,updateAuthority:e.updateAuthority,delegate:(0,yI.isSigner)(e.delegate)?e.delegate.publicKey:e.delegate,programs:r})};let n=e.token??(0,ib.getAssociatedTokenAccount)({mint:t,owner:e.owner,programs:r});return{isTokenDelegate:!0,delegate:e.delegate,approver:e.owner,delegateRecord:(0,ib.getTokenRecord)({mint:t,token:n,programs:r}),tokenAccount:n}};Rd.parseTokenMetadataDelegateInput=mI});var Y2=L(Ca=>{"use strict";E();I();Object.defineProperty(Ca,"__esModule",{value:!0});Ca.getSignerFromTokenMetadataAuthority=Ca.parseTokenMetadataAuthorization=void 0;var Ud=Ls(),G2=$2(),vI=t=>{let e={accounts:{authorizationRules:t.authorizationDetails?.rules??null},signers:[],data:{authorizationData:t.authorizationDetails?.data??null}};if(t.authority.__kind==="metadata")e.accounts.authority=t.authority.updateAuthority.publicKey,e.accounts.token=t.authority.token,e.signers.push(t.authority.updateAuthority),e.data.authorityType=Ud.AuthorityType.Metadata;else if(t.authority.__kind==="metadataDelegate"){let{delegateRecord:r,approver:n}=(0,G2.parseTokenMetadataDelegateInput)(t.mint,t.authority,t.programs);e.accounts.authority=t.authority.delegate.publicKey,e.accounts.delegateRecord=r,e.accounts.approver=n,e.signers.push(t.authority.delegate),e.data.authorityType=Ud.AuthorityType.MetadataDelegate}else if(t.authority.__kind==="tokenDelegate"){let{delegateRecord:r,approver:n,tokenAccount:i}=(0,G2.parseTokenMetadataDelegateInput)(t.mint,t.authority,t.programs);e.accounts.authority=t.authority.delegate.publicKey,e.accounts.token=i,e.accounts.delegateRecord=r,e.accounts.approver=n,e.signers.push(t.authority.delegate),e.data.authorityType=Ud.AuthorityType.TokenDelegate}else if(t.authority.__kind==="holder")e.accounts.authority=t.authority.owner.publicKey,e.accounts.token=t.authority.token,e.signers.push(t.authority.owner),e.data.authorityType=Ud.AuthorityType.Holder;else throw new Error(`UnreachableCaseError: ${t.authority.__kind}`);return e};Ca.parseTokenMetadataAuthorization=vI;var wI=t=>{if(!("__kind"in t))return t;switch(t.__kind){case"metadata":return t.updateAuthority;case"metadataDelegate":case"tokenDelegate":return t.delegate;case"holder":return t.owner;default:throw new Error(`UnreachableCaseError: ${t.__kind}`)}};Ca.getSignerFromTokenMetadataAuthority=wI});var J2=L(Ks=>{"use strict";E();I();Object.defineProperty(Ks,"__esModule",{value:!0});Ks.getSerializedTransaction=Ks.getSignedTransaction=Ks.TransactionBuilder=void 0;var _I=St(),SI=ja(),Z2=ur(),$i=class{constructor(e={}){this.records=[],this.feePayer=void 0,this.context={},this.transactionOptions=e}static make(e){return new $i(e)}prepend(...e){let r=e.flatMap(n=>n instanceof $i?n.getInstructionsWithSigners():[n]);return this.records=[...r,...this.records],this}append(...e){let r=e.flatMap(n=>n instanceof $i?n.getInstructionsWithSigners():[n]);return this.records=[...this.records,...r],this}add(...e){return this.append(...e)}splitUsingKey(e,r=!0){let n=new $i(this.transactionOptions),i=new $i(this.transactionOptions),o=this.records.findIndex(a=>a.key===e);return o>-1?(o+=r?1:0,n.add(...this.records.slice(0,o)),i.add(...this.records.slice(o))):n.add(this),[n,i]}splitBeforeKey(e){return this.splitUsingKey(e,!1)}splitAfterKey(e){return this.splitUsingKey(e,!0)}getInstructionsWithSigners(){return this.records}getInstructions(){return this.records.map(e=>e.instruction)}getInstructionCount(){return this.records.length}isEmpty(){return this.getInstructionCount()===0}getSigners(){let e=this.feePayer==null?[]:[this.feePayer],r=this.records.flatMap(n=>n.signers);return[...e,...r]}setTransactionOptions(e){return this.transactionOptions=e,this}getTransactionOptions(){return this.transactionOptions}setFeePayer(e){return this.feePayer=e,this}getFeePayer(){return this.feePayer}setContext(e){return this.context=e,this}getContext(){return this.context}when(e,r){return e?r(this):this}unless(e,r){return this.when(!e,r)}toTransaction(e,r={}){r={...this.getTransactionOptions(),...r};let n=new _I.Transaction({feePayer:this.getFeePayer()?.publicKey,signatures:r.signatures,blockhash:e.blockhash,lastValidBlockHeight:e.lastValidBlockHeight});return n.add(...this.getInstructions()),n}};Ks.TransactionBuilder=$i;function X2(t,e,r){return!("records"in t)&&t.recentBlockhash&&t.lastValidBlockHeight&&(r={blockhash:t.recentBlockhash,lastValidBlockHeight:t.lastValidBlockHeight}),"records"in t&&(e=[...t.getSigners(),...e],t=t.toTransaction(r)),{transaction:t,signers:e,blockhashWithExpiryBlockHeight:r}}function MI(t,e){let{keypairs:r}=(0,SI.getSignerHistogram)(e);return r.length>0&&t.partialSign(...r),t}function EI(t,e=[],r){let n=X2(t,e,r);return t=n.transaction,e=n.signers,t=MI(t,e),Z2.base.toBase58(t.serialize())}Ks.getSignedTransaction=EI;function II(t,e=[],r){return t=X2(t,e,r).transaction,Z2.base.toBase58(t.serialize({requireAllSignatures:!1,verifySignatures:!1}))}Ks.getSerializedTransaction=II});var ev=L(Q2=>{"use strict";E();I();Object.defineProperty(Q2,"__esModule",{value:!0})});var sb=L(Ds=>{"use strict";E();I();var xI=Ds&&Ds.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),tv=Ds&&Ds.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&xI(e,t,r)};Object.defineProperty(Ds,"__esModule",{value:!0});tv(J2(),Ds);tv(ev(),Ds)});var rv=L(za=>{"use strict";E();I();Object.defineProperty(za,"__esModule",{value:!0});za.isProgrammable=za.isNonFungible=void 0;var jd=Ls(),AI=t=>t.tokenStandard===null||t.tokenStandard===jd.TokenStandard.NonFungible||t.tokenStandard===jd.TokenStandard.NonFungibleEdition||t.tokenStandard===jd.TokenStandard.ProgrammableNonFungible;za.isNonFungible=AI;var PI=t=>t.tokenStandard===jd.TokenStandard.ProgrammableNonFungible;za.isProgrammable=PI});var nv=L(Oo=>{"use strict";E();I();var BI=Oo&&Oo.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),TI=Oo&&Oo.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&BI(e,t,r)};Object.defineProperty(Oo,"__esModule",{value:!0});TI(rv(),Oo)});var ov=L(Cd=>{"use strict";E();I();Object.defineProperty(Cd,"__esModule",{value:!0});Cd.transferNftBuilder=void 0;var OI=Ls(),sv=St(),fc=ja(),Fa=nb(),iv=Y2(),kI=sb(),ob=nv(),qI=new sv.PublicKey("auth9SigNpDKz4sJJ1DfCTuZrZNSAgh9sFD3rboVmgg"),NI=(t,e,r)=>{let{nftOrSft:n,authority:i,toOwner:o,amount:a=(0,fc.token)(1),authorizationDetails:c}=t,l=t.fromOwner??(0,iv.getSignerFromTokenMetadataAuthority)(i).publicKey,m=(0,Fa.getMetadata)(n.address),S=(0,Fa.getMasterEdition)(n.address),_=t.fromToken??(0,Fa.getAssociatedTokenAccount)({mint:n.address,owner:l}),P=t.toToken??(0,Fa.getAssociatedTokenAccount)({mint:n.address,owner:o}),x=(0,Fa.getTokenRecord)({mint:n.address,token:_}),T=(0,Fa.getTokenRecord)({mint:n.address,token:P}),M=(0,iv.parseTokenMetadataAuthorization)({mint:n.address,authority:"__kind"in i?i:{__kind:"holder",owner:i,token:_},authorizationDetails:c,programs:r});return kI.TransactionBuilder.make().setFeePayer(e).add({instruction:(0,OI.createTransferInstruction)({token:_,tokenOwner:l,destination:P,destinationOwner:o,mint:n.address,metadata:m,edition:(0,ob.isNonFungible)(n)?S:void 0,ownerTokenRecord:(0,ob.isProgrammable)(n)?x:void 0,destinationTokenRecord:(0,ob.isProgrammable)(n)?T:void 0,authority:M.accounts.authority,payer:e.publicKey,systemProgram:fc.systemProgram.address,sysvarInstructions:sv.SYSVAR_INSTRUCTIONS_PUBKEY,splTokenProgram:fc.tokenProgram.address,splAtaProgram:fc.associatedTokenProgram.address,authorizationRules:M.accounts.authorizationRules,authorizationRulesProgram:qI},{transferArgs:{__kind:"V1",amount:a.basisPoints,...M.data}},fc.tokenMetadataProgram.address),signers:[e,...M.signers],key:t.instructionKey??"transferNft"})};Cd.transferNftBuilder=NI});var zd=L(Zn=>{"use strict";E();I();var LI=Zn&&Zn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),dc=Zn&&Zn.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&LI(e,t,r)};Object.defineProperty(Zn,"__esModule",{value:!0});dc(kd(),Zn);dc(Ls(),Zn);dc(ov(),Zn);dc(sb(),Zn);dc(ja(),Zn)});var ub=L(Vr=>{"use strict";E();I();var KI=Vr&&Vr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),DI=Vr&&Vr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ab=Vr&&Vr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&KI(e,t,r);return DI(e,t),e};Object.defineProperty(Vr,"__esModule",{value:!0});Vr.metaplex=Vr.web3=Vr.spl=void 0;Vr.spl=ab(wd());Vr.web3=ab(St());Vr.metaplex=ab(zd())});var uv=L(fe=>{"use strict";E();I();Object.defineProperty(fe,"__esModule",{value:!0});fe.validSignedTransaction=fe.getSerializedMplTransaction=fe.signMplTransaction=fe.createAndSignVersionedTransaction=fe.getSerializedVersionedTransaction=fe.getSerializedTokenTransferVersionedTransaction=fe.signTokenTransferVersionedTransaction=fe.signTransferVersionedTransaction=fe.getSerializedTransferVersionedTransaction=fe.getHardwareTransaction=fe.deserializeMessages=fe.signMessage=fe.appendTokenBurnInstruction=fe.appendTokenMintToInstruction=fe.appendTokenTransferInstruction=fe.appendTransferInstruction=fe.signTransaction=fe.appendInstruction=fe.createRawTransaction=fe.validAddress=fe.getNewAddress=void 0;var xt=ur(),$=ub(),Qt=St(),Ha=zd(),Bi=wd(),Ar=ud(),av=$u();function RI(t){if(!t)throw new Error("invalid key");let e=xt.base.fromBase58(t);if(e.length!=64)throw new Error("invalid key length");let r=xt.signUtil.ed25519.publicKeyCreate(e);return xt.base.toBase58(r)}fe.getNewAddress=RI;function UI(t){try{return xt.base.fromBase58(t).length==32}catch{return!1}}fe.validAddress=UI;function jI(t,e){return new $.web3.Transaction({feePayer:new $.web3.PublicKey(t),blockhash:e,lastValidBlockHeight:0})}fe.createRawTransaction=jI;async function CI(t,...e){t.add(...e)}fe.appendInstruction=CI;async function zI(t,...e){let r=[];return e.forEach(n=>{r.push($.web3.Keypair.fromSecretKey(xt.base.fromBase58(n)))}),t.sign(...r),t.signature?Promise.resolve(xt.base.toBase58(t.serialize())):Promise.reject("sign error")}fe.signTransaction=zI;async function FI(t,e,r,n){t.add($.web3.SystemProgram.transfer({fromPubkey:new $.web3.PublicKey(e),toPubkey:new $.web3.PublicKey(r),lamports:n}))}fe.appendTransferInstruction=FI;async function HI(t,e,r,n,i,o,a,c){let l=a===!0?Bi.TOKEN_2022_PROGRAM_ID:Bi.TOKEN_PROGRAM_ID,m=await $.spl.getAssociatedTokenAddress(new $.web3.PublicKey(n),new $.web3.PublicKey(e),!1,l),S=await $.spl.getAssociatedTokenAddress(new $.web3.PublicKey(n),new $.web3.PublicKey(r),!0,l);if(o&&t.add($.spl.createAssociatedTokenAccountInstruction(new $.web3.PublicKey(e),new $.web3.PublicKey(S),new $.web3.PublicKey(r),new $.web3.PublicKey(n),new $.web3.PublicKey(l))),a){if(!c)throw new Error("invalid decimal for token 2022");t.add($.spl.createTransferCheckedInstruction(new $.web3.PublicKey(m),new $.web3.PublicKey(n),new $.web3.PublicKey(S),new $.web3.PublicKey(e),i,c,[],new $.web3.PublicKey(l)))}else t.add($.spl.createTransferInstruction(new $.web3.PublicKey(m),new $.web3.PublicKey(S),new $.web3.PublicKey(e),i,[],new $.web3.PublicKey(l)))}fe.appendTokenTransferInstruction=HI;async function VI(t,e,r,n,i,o,a,c){let l=c===!0?Bi.TOKEN_2022_PROGRAM_ID:Bi.TOKEN_PROGRAM_ID,m=await $.spl.getAssociatedTokenAddress(new $.web3.PublicKey(n),new $.web3.PublicKey(r),!1,l);a&&t.add($.spl.createAssociatedTokenAccountInstruction(new $.web3.PublicKey(e),new $.web3.PublicKey(m),new $.web3.PublicKey(r),new $.web3.PublicKey(n),new $.web3.PublicKey(l))),t.add($.spl.createMintToInstruction(new $.web3.PublicKey(n),new $.web3.PublicKey(m),new $.web3.PublicKey(i),o,[],new $.web3.PublicKey(l)))}fe.appendTokenMintToInstruction=VI;async function WI(t,e,r,n,i,o){let a=o===!0?Bi.TOKEN_2022_PROGRAM_ID:Bi.TOKEN_PROGRAM_ID;t.add($.spl.createBurnInstruction(new $.web3.PublicKey(r),new $.web3.PublicKey(n),new $.web3.PublicKey(e),i,[],new $.web3.PublicKey(a)))}fe.appendTokenBurnInstruction=WI;async function $I(t,e){let r=xt.base.fromBase58(t),n=xt.signUtil.ed25519.sign(r,xt.base.fromBase58(e));return Promise.resolve(xt.base.toBase58(n))}fe.signMessage=$I;async function GI(t){let e=[];for(let r=0;r<t.length;r++){let n=!0,i=0,o=!1,a=0,c=t[r];try{let m=$.web3.VersionedTransaction.deserialize(xt.base.fromBase58(c)).message;for(let S=0;S<m.compiledInstructions.length;S++){let _=m.compiledInstructions[S];if(m.staticAccountKeys[_.programIdIndex].toBase58()==Ar.ComputeBudgetProgram.programId.toBase58()){let P=B.Buffer.from(_.data);try{let{units:x}=(0,av.decodeData)(Ar.COMPUTE_BUDGET_INSTRUCTION_LAYOUTS.SetComputeUnitLimit,P);i=x,o=!0}catch{}try{let{microLamports:x}=(0,av.decodeData)(Ar.COMPUTE_BUDGET_INSTRUCTION_LAYOUTS.SetComputeUnitPrice,P);a=x}catch{}}}o||(i=0,m.compiledInstructions.length>1&&(i=(m.compiledInstructions.length-1)*2e5))}catch(l){console.log(l),n=!1}e.push({deserialized:n,computeUnitLimit:i.toString(),computeUnitPrice:a.toString()})}return Promise.resolve(e)}fe.deserializeMessages=GI;async function YI(t,e,r){let n=$.web3.Transaction.from(xt.base.fromHex(t));return n.addSignature(new Qt.PublicKey(e),xt.base.fromHex(r)),n.signature?Promise.resolve(xt.base.toBase58(n.serialize())):Promise.reject("getHardwareTransaction error")}fe.getHardwareTransaction=YI;async function ZI(t,...e){let r=[];if(t.needPriorityFee&&t.computeUnitLimit&&t.computeUnitPrice){let n=Ar.ComputeBudgetProgram.setComputeUnitLimit({units:t.computeUnitLimit}),i=Ar.ComputeBudgetProgram.setComputeUnitPrice({microLamports:t.computeUnitPrice});r.push(n),r.push(i)}return r.push($.web3.SystemProgram.transfer({fromPubkey:new $.web3.PublicKey(t.from),toPubkey:new $.web3.PublicKey(t.to),lamports:t.amount})),cb(t.payer,t.blockHash,r,e)}fe.getSerializedTransferVersionedTransaction=ZI;async function XI(t,...e){let r=[];if(t.computeUnitLimit&&t.computeUnitPrice){let n=Ar.ComputeBudgetProgram.setComputeUnitLimit({units:t.computeUnitLimit}),i=Ar.ComputeBudgetProgram.setComputeUnitPrice({microLamports:t.computeUnitPrice});r.push(n),r.push(i)}return r.push($.web3.SystemProgram.transfer({fromPubkey:new $.web3.PublicKey(t.from),toPubkey:new $.web3.PublicKey(t.to),lamports:t.amount})),fb(t.payer,t.blockHash,r,e)}fe.signTransferVersionedTransaction=XI;async function JI(t,...e){let r=t.token2022===!0?Bi.TOKEN_2022_PROGRAM_ID:Bi.TOKEN_PROGRAM_ID,n=await $.spl.getAssociatedTokenAddress(new $.web3.PublicKey(t.mint),new $.web3.PublicKey(t.from),!1,r),i=await $.spl.getAssociatedTokenAddress(new $.web3.PublicKey(t.mint),new $.web3.PublicKey(t.to),!0,r),o=[];if(t.computeUnitLimit&&t.computeUnitPrice){let a=Ar.ComputeBudgetProgram.setComputeUnitLimit({units:t.computeUnitLimit}),c=Ar.ComputeBudgetProgram.setComputeUnitPrice({microLamports:t.computeUnitPrice});o.push(a),o.push(c)}return t.createAssociatedAddress&&o.push($.spl.createAssociatedTokenAccountInstruction(new $.web3.PublicKey(t.from),new $.web3.PublicKey(i),new $.web3.PublicKey(t.to),new $.web3.PublicKey(t.mint),new $.web3.PublicKey(r))),o.push($.spl.createTransferInstruction(new $.web3.PublicKey(n),new $.web3.PublicKey(i),new $.web3.PublicKey(t.from),t.amount,[],new $.web3.PublicKey(r))),fb(t.payer,t.blockHash,o,e)}fe.signTokenTransferVersionedTransaction=JI;async function QI(t,...e){let r=t.token2022===!0?Bi.TOKEN_2022_PROGRAM_ID:Bi.TOKEN_PROGRAM_ID,n=await $.spl.getAssociatedTokenAddress(new $.web3.PublicKey(t.mint),new $.web3.PublicKey(t.from),!1,r),i=await $.spl.getAssociatedTokenAddress(new $.web3.PublicKey(t.mint),new $.web3.PublicKey(t.to),!1,r),o=[];if(t.needPriorityFee&&t.computeUnitLimit&&t.computeUnitPrice){let a=Ar.ComputeBudgetProgram.setComputeUnitLimit({units:t.computeUnitLimit}),c=Ar.ComputeBudgetProgram.setComputeUnitPrice({microLamports:t.computeUnitPrice});o.push(a),o.push(c)}return t.createAssociatedAddress&&o.push($.spl.createAssociatedTokenAccountInstruction(new $.web3.PublicKey(t.from),new $.web3.PublicKey(i),new $.web3.PublicKey(t.to),new $.web3.PublicKey(t.mint),new $.web3.PublicKey(r))),o.push($.spl.createTransferInstruction(new $.web3.PublicKey(n),new $.web3.PublicKey(i),new $.web3.PublicKey(t.from),t.amount,[],new $.web3.PublicKey(r))),cb(t.payer,t.blockHash,o,e)}fe.getSerializedTokenTransferVersionedTransaction=QI;async function cb(t,e,r,n){let i=new Qt.TransactionMessage({payerKey:new Qt.PublicKey(t),recentBlockhash:e,instructions:r}).compileToV0Message(),o=new Qt.VersionedTransaction(i);return Promise.resolve(xt.base.toBase58(o.serialize()))}fe.getSerializedVersionedTransaction=cb;async function fb(t,e,r,n){let i=new Qt.TransactionMessage({payerKey:new Qt.PublicKey(t),recentBlockhash:e,instructions:r}).compileToV0Message(),o=new Qt.VersionedTransaction(i),a=[];return n.forEach(c=>{let l=Qt.Keypair.fromSecretKey(xt.base.fromBase58(c));a.push({publicKey:l.publicKey,secretKey:l.secretKey})}),o.sign(a),o.signature?Promise.resolve(xt.base.toBase58(o.serialize())):Promise.reject("sign error")}fe.createAndSignVersionedTransaction=fb;async function ex(t,e,r,n,i,o,a=Ha.TokenStandard.ProgrammableNonFungible,c,l){let m={tokenStandard:a,address:new Qt.PublicKey(n)},S={publicKey:new Qt.PublicKey(e),secretKey:xt.base.fromBase58(o)},_=(0,Ha.transferNftBuilder)({nftOrSft:m,authority:S,fromOwner:new Qt.PublicKey(e),toOwner:new Qt.PublicKey(r)},S);if(c&&l){let P=Ar.ComputeBudgetProgram.setComputeUnitLimit({units:c}),x=Ar.ComputeBudgetProgram.setComputeUnitPrice({microLamports:l});_.add({instruction:P,signers:[]}),_.add({instruction:x,signers:[]})}return(0,Ha.getSignedTransaction)(_,void 0,{blockhash:i,lastValidBlockHeight:0})}fe.signMplTransaction=ex;async function tx(t,e,r,n,i,o,a=Ha.TokenStandard.ProgrammableNonFungible,c,l){let m={tokenStandard:a,address:new Qt.PublicKey(n)},S={publicKey:new Qt.PublicKey(e),secretKey:xt.base.fromBase58(o)},_=(0,Ha.transferNftBuilder)({nftOrSft:m,authority:S,fromOwner:new Qt.PublicKey(e),toOwner:new Qt.PublicKey(r)},S);if(c&&l){let P=Ar.ComputeBudgetProgram.setComputeUnitLimit({units:c}),x=Ar.ComputeBudgetProgram.setComputeUnitPrice({microLamports:l});_.add({instruction:P,signers:[]}),_.add({instruction:x,signers:[]})}return(0,Ha.getSerializedTransaction)(_,void 0,{blockhash:i,lastValidBlockHeight:0})}fe.getSerializedMplTransaction=tx;function rx(t,e,r){if(e){let c=Qt.VersionedTransaction.deserialize(xt.base.fromBase58(t)),l=c.signature,m=c.message.serialize(),S=c.message.getAccountKeys().get(0)?.toBytes();if(!r&&!xt.signUtil.ed25519.verify(m,l,S))throw Error("signature error");return c}let n=Qt.Transaction.from(xt.base.fromBase58(t)),i=n.signature,o=n.serializeMessage(),a=n.feePayer.toBytes();if(!r&&!xt.signUtil.ed25519.verify(o,i,a))throw Error("signature error");return n}fe.validSignedTransaction=rx});var db=L(lc=>{"use strict";E();I();Object.defineProperty(lc,"__esModule",{value:!0});lc.SignType=void 0;var nx;(function(t){t[t.Secp256k1=1]="Secp256k1",t[t.ECDSA_P256=2]="ECDSA_P256",t[t.ED25519=3]="ED25519",t[t.StarknetSignType=4]="StarknetSignType",t[t.TezosSignType=5]="TezosSignType"})(nx=lc.SignType||(lc.SignType={}))});var cv=L(kn=>{"use strict";E();I();Object.defineProperty(kn,"__esModule",{value:!0});kn.CoinCurveMap=kn.MultiAddressCoins=kn.segwitType=kn.Currency=void 0;var We;(function(t){t[t.NULL=-1]="NULL",t[t.BTC=0]="BTC",t[t.TBTC=1]="TBTC",t[t.ETH=60]="ETH",t[t.LTC=2]="LTC",t[t.DOGE=3]="DOGE",t[t.BCH=145]="BCH",t[t.BSV=236]="BSV",t[t.TRX=195]="TRX",t[t.SOL=501]="SOL",t[t.APTOS=637]="APTOS",t[t.OMNI_USDT=20001]="OMNI_USDT",t[t.OMNI_USDT_TEST=20002]="OMNI_USDT_TEST",t[t.SUI=784]="SUI",t[t.ATOM=118]="ATOM",t[t.OSMO=1e3]="OSMO",t[t.EVMOS=1001]="EVMOS",t[t.AXL=1002]="AXL",t[t.CRO=1003]="CRO",t[t.Iris=1004]="Iris",t[t.Juno=1005]="Juno",t[t.Kava=1006]="Kava",t[t.Kujira=1007]="Kujira",t[t.SCRT=1008]="SCRT",t[t.Stargaze=1009]="Stargaze",t[t.Terra=1010]="Terra",t[t.ZKSPACE=1011]="ZKSPACE",t[t.ZKSYNC=804]="ZKSYNC",t[t.Stx=5757]="Stx",t[t.SEI=2837]="SEI",t[t.WAX=14001]="WAX",t[t.Starknet=9004]="Starknet",t[t.ADA=1815]="ADA",t[t.INJ=2892]="INJ",t[t.Celestia=2854]="Celestia",t[t.DYDX=2897]="DYDX",t[t.Kaspa=111111]="Kaspa",t[t.TON=607]="TON",t[t.NostrAssets=1237]="NostrAssets",t[t.Near=397]="Near"})(We=kn.Currency||(kn.Currency={}));var ix;(function(t){t[t.SEGWIT_NESTED=1]="SEGWIT_NESTED",t[t.SEGWIT_NESTED_49=2]="SEGWIT_NESTED_49",t[t.SEGWIT_NATIVE=3]="SEGWIT_NATIVE",t[t.SEGWIT_TAPROOT=4]="SEGWIT_TAPROOT"})(ix=kn.segwitType||(kn.segwitType={}));kn.MultiAddressCoins=[We.BTC,We.TBTC,We.LTC,We.DOGE,We.BSV,We.OMNI_USDT,We.OMNI_USDT_TEST];var pt="secp256k1",Fd="ed25519";kn.CoinCurveMap=new Map([[We.BTC,pt],[We.TBTC,pt],[We.ETH,pt],[We.LTC,pt],[We.DOGE,pt],[We.BCH,pt],[We.BSV,pt],[We.TRX,pt],[We.OMNI_USDT,pt],[We.OMNI_USDT_TEST,pt],[We.ATOM,pt],[We.OSMO,pt],[We.EVMOS,pt],[We.AXL,pt],[We.CRO,pt],[We.Iris,pt],[We.Juno,pt],[We.Kava,pt],[We.Kujira,pt],[We.SCRT,pt],[We.Stargaze,pt],[We.Terra,pt],[We.SEI,pt],[We.Celestia,pt],[We.DYDX,pt],[We.SOL,Fd],[We.APTOS,Fd],[We.SUI,Fd],[We.TON,Fd]])});var lb=L(Y=>{"use strict";E();I();Object.defineProperty(Y,"__esModule",{value:!0});Y.SignCommonMsgError=Y.EstimateFeeError=Y.validSignedTransactionError=Y.GetPayLoadError=Y.HardwareDerivePubKeyError=Y.CalcTxHashError=Y.SignMsgStep3Error=Y.SignMsgSetupError=Y.Ed25519Step3Error=Y.Ed25519Step2Error=Y.Ed25519Step1Error=Y.Ed25519SetupError=Y.EcdsaStep3Error=Y.EcdsaStep2Error=Y.EcdsaStep1Error=Y.EcdsaSetupError=Y.MPCShakeHandsError=Y.MPCStepError=Y.MPCAesKeyMissError=Y.GetHardWareMessageHashError=Y.GetHardwareSignedTransactionError=Y.GetHardwareRawTransactionError=Y.GetMpcTransactionError=Y.GetMpcRawTransactionError=Y.DerivePathError=Y.GenMnemonicError=Y.GenPrivateKeyError=Y.UnsupportedCoinError=Y.SignMsgError=Y.SignTxError=Y.ValidAddressError=Y.NewAddressError=Y.NotImplementedError=void 0;Y.NotImplementedError="no implementation method";Y.NewAddressError="generate address error";Y.ValidAddressError="valid address error";Y.SignTxError="sign tx error";Y.SignMsgError="sign message error";Y.UnsupportedCoinError="unsupported currency";Y.GenPrivateKeyError="generate private key error";Y.GenMnemonicError="generate mnemonic error";Y.DerivePathError="derive hdPath error";Y.GetMpcRawTransactionError="get mpc raw transaction error";Y.GetMpcTransactionError="get mpc transaction error";Y.GetHardwareRawTransactionError="get hardware raw transaction error";Y.GetHardwareSignedTransactionError="get hardware signed transaction error";Y.GetHardWareMessageHashError="get hardware message hash error";Y.MPCAesKeyMissError="mpc get aes key error";Y.MPCStepError="mpc step error";Y.MPCShakeHandsError="mpc shake hands error";Y.EcdsaSetupError="ecdsa setup error";Y.EcdsaStep1Error="ecdsa step1 error";Y.EcdsaStep2Error="ecdsa step2 error";Y.EcdsaStep3Error="ecdsa step3 error";Y.Ed25519SetupError="ed25519 setup error";Y.Ed25519Step1Error="ed25519 step1 error";Y.Ed25519Step2Error="ed25519 step2 error";Y.Ed25519Step3Error="ed25519 step3 error";Y.SignMsgSetupError="sign message setup error";Y.SignMsgStep3Error="sign message step3 error";Y.CalcTxHashError="calculate tx hash error";Y.HardwareDerivePubKeyError="derive sub pub key error";Y.GetPayLoadError="get payload error";Y.validSignedTransactionError="valid signed transaction error";Y.EstimateFeeError="estimate fee error";Y.SignCommonMsgError="sign common msg error"});var fv=L(Wr=>{"use strict";E();I();Object.defineProperty(Wr,"__esModule",{value:!0});Wr.jsonStringifyUniform=Wr.cloneObject=Wr.assertBufferLength=Wr.convert2BigNumber=Wr.convert2Number=Wr.buildCommonSignMsg=void 0;var Hd=ur();function sx(t,e){return`OKX Wallet Sign In
|
||
|
||
publicKey: ${t}
|
||
walletId: ${e}
|
||
host: api.wallet.okx
|
||
OKX Wallet Sign In`}Wr.buildCommonSignMsg=sx;function ox(t){if(t!=null)return typeof t=="string"?parseInt(t):t}Wr.convert2Number=ox;function ax(t){if(t!=null)return Hd.BigNumber.isBigNumber(t)?t:new Hd.BigNumber(t)}Wr.convert2BigNumber=ax;function ux(t,e){if(t.length!=e)throw Error("buffer length is illegal")}Wr.assertBufferLength=ux;function cx(t){return JSON.parse(JSON.stringify(t))}Wr.cloneObject=cx;function fx(t){return JSON.stringify(t,(e,r)=>r&&(r.type==="Buffer"||r instanceof Uint8Array?Hd.base.toHex(r):typeof r=="bigint"?r.toString():r))}Wr.jsonStringifyUniform=fx});var hb=L(ko=>{"use strict";E();I();var dx=ko&&ko.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),lx=ko&&ko.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&dx(e,t,r)};Object.defineProperty(ko,"__esModule",{value:!0});lx(fv(),ko)});var pv=L(_t=>{"use strict";E();I();Object.defineProperty(_t,"__esModule",{value:!0});_t.SimpleWallet=_t.BaseWallet=_t.ecdsaSign=_t.fromSigned=_t.padWithZeroes=_t.toUnsigned=_t.intToHex=_t.makeSignature=_t.secp256k1SignTest=void 0;var Ut=lb(),Va=db(),jt=ur(),hx=hb();function dv(t){let e=jt.base.sha256("secp256k1-test"),r=jt.signUtil.secp256k1.publicKeyCreate(t,!1),{signature:n,recovery:i}=jt.signUtil.secp256k1.sign(B.Buffer.from(e),t);return jt.signUtil.secp256k1.verify(e,n,i,r)}_t.secp256k1SignTest=dv;function lv(t,e,r){let n=(0,_t.fromSigned)(e),i=(0,_t.fromSigned)(r),o=t,a=bb((0,_t.toUnsigned)(n).toString("hex"),64),c=bb((0,_t.toUnsigned)(i).toString("hex"),64);return jt.base.stripHexPrefix(hv(o)).concat(a,c)}_t.makeSignature=lv;function hv(t){return`0x${t.toString(16)}`}_t.intToHex=hv;var bx=function(t){return B.Buffer.from(t.toTwos(256).toArray())};_t.toUnsigned=bx;function bb(t,e){if(t!==""&&!/^[a-f0-9]+$/iu.test(t))throw new Error(`Expected an unprefixed hex string. Received: ${t}`);if(e<0)throw new Error(`Expected a non-negative integer target length. Received: ${e}`);return String.prototype.padStart.call(t,e,"0")}_t.padWithZeroes=bb;var px=function(t){return new jt.BN(t).fromTwos(256)};_t.fromSigned=px;function bv(t,e,r){let{signature:n,recovery:i}=jt.signUtil.secp256k1.sign(t,e),o=B.Buffer.from(n.slice(0,32)),a=B.Buffer.from(n.slice(32,64));if(r&&!Number.isSafeInteger(r))throw new Error("The provided number is greater than MAX_SAFE_INTEGER (please use an alternative input type)");return{v:r?i+(r*2+35):i+27,r:o,s:a}}_t.ecdsaSign=bv;var Vd=class{getRandomPrivateKey(){try{for(;;){let e=jt.base.randomBytes(32);if(dv(e))return Promise.resolve(jt.base.toHex(e,!0))}}catch{}return Promise.reject(Ut.GenPrivateKeyError)}getDerivedPrivateKey(e){return jt.bip39.mnemonicToSeed(e.mnemonic).then(r=>{let n=jt.bip32.fromSeed(r).derivePath(e.hdPath);if(n.privateKey){let i=jt.base.toHex(n.privateKey);return Promise.resolve("0x"+i)}else return Promise.reject(Ut.GenPrivateKeyError)}).catch(r=>Promise.reject(Ut.GenPrivateKeyError))}getDerivedPath(e){return Promise.reject(Ut.NotImplementedError)}validPrivateKey(e){return Promise.reject(Ut.NotImplementedError)}signMessage(e){return Promise.reject(Ut.NotImplementedError)}async signCommonMsg(e){e.signType||(e.signType=Va.SignType.Secp256k1);let r;if(e.message.text)r=e.message.text;else{let c;if(e.publicKey?c=e.publicKey:c=(await this.getNewAddress({privateKey:e.privateKey,addressType:e.addressType,hrp:e.hrp,version:e.version})).publicKey,c.startsWith("0x")&&(c=c.substring(2)),!e.message.walletId)return Promise.reject("invalid walletId");r=(0,hx.buildCommonSignMsg)(c,e.message.walletId)}let n=jt.base.magicHash(r),i=e.privateKeyHex?e.privateKeyHex:e.privateKey,o=jt.base.fromHex(i);var a;switch(e.signType){case Va.SignType.Secp256k1:let{v:c,r:l,s:m}=bv(B.Buffer.from(n),o);return Promise.resolve(lv(c,l,m));case Va.SignType.ECDSA_P256:return a=jt.signUtil.p256.sign(B.Buffer.from(n),o).signature,Promise.resolve(jt.base.toHex(a));case Va.SignType.ED25519:return a=jt.signUtil.ed25519.sign(n,o),Promise.resolve(jt.base.toHex(a));case Va.SignType.StarknetSignType:return a=jt.signUtil.schnorr.stark.sign(n,o).toCompactRawBytes(),Promise.resolve(jt.base.toHex(a));case Va.SignType.TezosSignType:return Promise.reject("not support")}}verifyMessage(e){return Promise.reject(Ut.NotImplementedError)}ecRecover(e,r){return Promise.reject(Ut.NotImplementedError)}getAddressByPublicKey(e){return Promise.reject(Ut.NotImplementedError)}getMPCRawTransaction(e){return Promise.reject(Ut.NotImplementedError)}getMPCTransaction(e){return Promise.reject(Ut.NotImplementedError)}getMPCRawMessage(e){return Promise.reject(Ut.NotImplementedError)}getMPCSignedMessage(e){return Promise.reject(Ut.NotImplementedError)}getHardWareRawTransaction(e){return Promise.reject(Ut.NotImplementedError)}getHardWareSignedTransaction(e){return Promise.reject(Ut.NotImplementedError)}getHardWareMessageHash(e){return Promise.reject(Ut.NotImplementedError)}calcTxHash(e){return Promise.reject(Ut.NotImplementedError)}getRawTransaction(e){return Promise.reject(Ut.NotImplementedError)}validSignedTransaction(e){return Promise.reject(Ut.NotImplementedError)}estimateFee(e){return Promise.reject(Ut.NotImplementedError)}};_t.BaseWallet=Vd;var pb=class extends Vd{mockData(e,r){this.mockAddress=e,this.mockPublicKey=r}getNewAddress(e){return Promise.resolve({address:this.mockAddress,publicKey:this.mockPublicKey})}validAddress(e){throw new Error("Method not implemented.")}signTransaction(e){throw new Error("Method not implemented.")}};_t.SimpleWallet=pb});var gv=L(Xn=>{"use strict";E();I();var gx=Xn&&Xn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),hc=Xn&&Xn.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&gx(e,t,r)};Object.defineProperty(Xn,"__esModule",{value:!0});hc(db(),Xn);hc(cv(),Xn);hc(lb(),Xn);hc(pv(),Xn);hc(hb(),Xn)});var mv=L($d=>{"use strict";E();I();Object.defineProperty($d,"__esModule",{value:!0});$d.SolWallet=void 0;var At=gv(),qn=ur(),kt=vv(),Wd=ud(),yv=zd(),gb=class extends At.BaseWallet{async getDerivedPath(e){return`m/44'/501'/${e.index}'/0'`}async getRandomPrivateKey(){try{return Promise.resolve(qn.signUtil.ed25519.ed25519_getRandomPrivateKey(!0,"base58"))}catch{return Promise.reject(At.GenPrivateKeyError)}}async getDerivedPrivateKey(e){try{let r=await qn.signUtil.ed25519.ed25519_getDerivedPrivateKey(e.mnemonic,e.hdPath,!0,"base58");return Promise.resolve(r)}catch{return Promise.reject(At.GenPrivateKeyError)}}checkPrivateKey(e){let r=qn.base.fromBase58(e);return r.length==64&&!r.every(n=>n===0)}async getNewAddress(e){try{if(!this.checkPrivateKey(e.privateKey))return Promise.reject(At.NewAddressError);let r=kt.api.getNewAddress(e.privateKey),n={address:r,publicKey:qn.base.toHex(qn.base.fromBase58(r))};return Promise.resolve(n)}catch{return Promise.reject(At.NewAddressError)}}async validPrivateKey(e){let r;try{r=this.checkPrivateKey(e.privateKey)}catch{r=!1}let n={isValid:r,privateKey:e.privateKey};return Promise.resolve(n)}async validAddress(e){let r;try{r=qn.base.fromBase58(e.address).length==32}catch{r=!1}let n={isValid:r,address:e.address};return Promise.resolve(n)}async signCommonMsg(e){let r=qn.base.fromBase58(e.privateKey);return super.signCommonMsg({privateKey:e.privateKey,privateKeyHex:qn.base.toHex(r),message:e.message,signType:At.SignType.ED25519})}async signTransaction(e){try{let r=e.data,n=kt.api.createRawTransaction(r.payer,r.blockHash);if(r.computeUnitLimit&&r.computeUnitPrice){let o=Wd.ComputeBudgetProgram.setComputeUnitLimit({units:r.computeUnitLimit}),a=Wd.ComputeBudgetProgram.setComputeUnitPrice({microLamports:r.computeUnitPrice});n.add(o).add(a)}if(r.type==="transfer"){if(r.from==null||r.to==null||r.amount==null)return Promise.reject(At.SignTxError);if(r.version===0)return kt.api.signTransferVersionedTransaction(e.data,e.privateKey);await kt.api.appendTransferInstruction(n,r.from,r.to,r.amount)}else if(r.type==="tokenTransfer"){if(r.from==null||r.to==null||r.mint==null||r.amount==null||r.createAssociatedAddress==null)return Promise.reject(At.SignTxError);if(r.version===0)return kt.api.signTokenTransferVersionedTransaction(e.data,e.privateKey);await kt.api.appendTokenTransferInstruction(n,r.from,r.to,r.mint,r.amount,r.createAssociatedAddress,r.token2022,r.decimal)}else if(r.type==="mplTransfer"){if(r.from==null||r.to==null||r.mint==null)return Promise.reject(At.SignTxError);let o=r.tokenStandard??yv.TokenStandard.ProgrammableNonFungible;return await kt.api.signMplTransaction(r.payer,r.from,r.to,r.mint,r.blockHash,e.privateKey,o,r.computeUnitLimit,r.computeUnitPrice)}else return Promise.reject(At.SignTxError);if(!e.privateKey)return Promise.resolve(qn.base.toHex(n.serialize({verifySignatures:!1})));let i=await kt.api.signTransaction(n,e.privateKey);return Promise.resolve(i)}catch{return Promise.reject(At.SignTxError)}}async signMessage(e){try{let r=e.data,n=await kt.api.signMessage(r,e.privateKey);return Promise.resolve(n)}catch{return Promise.reject(At.SignTxError)}}async deserializeMessages(e){try{let r=await kt.api.deserializeMessages(e.data);return Promise.resolve(r)}catch{return Promise.reject("deserializeMessages error")}}async getSerializedTransaction(e){try{let r=e.data,n=kt.api.createRawTransaction(r.payer,r.blockHash);if(r.needPriorityFee&&r.computeUnitLimit&&r.computeUnitPrice){let o=Wd.ComputeBudgetProgram.setComputeUnitLimit({units:r.computeUnitLimit}),a=Wd.ComputeBudgetProgram.setComputeUnitPrice({microLamports:r.computeUnitPrice});n.add(o).add(a)}if(r.type==="transfer"){if(r.from==null||r.to==null||r.amount==null)return Promise.reject(At.SignTxError);if(r.version===0)return kt.api.getSerializedTransferVersionedTransaction(e.data,e.privateKey);await kt.api.appendTransferInstruction(n,r.from,r.to,r.amount)}else if(r.type==="tokenTransfer"){if(r.from==null||r.to==null||r.mint==null||r.amount==null||r.createAssociatedAddress==null)return Promise.reject(At.SignTxError);if(r.version===0)return kt.api.getSerializedTokenTransferVersionedTransaction(e.data,e.privateKey);await kt.api.appendTokenTransferInstruction(n,r.from,r.to,r.mint,r.amount,r.createAssociatedAddress,r.token2022,r.decimal)}else if(r.type==="mplTransfer"){if(r.from==null||r.to==null||r.mint==null)return Promise.reject(At.SignTxError);let o=r.tokenStandard??yv.TokenStandard.ProgrammableNonFungible;return r.needPriorityFee?await kt.api.getSerializedMplTransaction(r.payer,r.from,r.to,r.mint,r.blockHash,e.privateKey,o,r.computeUnitLimit,r.computeUnitPrice):await kt.api.getSerializedMplTransaction(r.payer,r.from,r.to,r.mint,r.blockHash,e.privateKey,o)}else return Promise.reject(At.SignTxError);let i=qn.base.toBase58(n.serialize({requireAllSignatures:!1,verifySignatures:!1}));return Promise.resolve(i)}catch{return Promise.reject(At.SignTxError)}}async calcTxHash(e){try{let r=qn.base.fromBase58(e.data),n;try{n=kt.web3.Transaction.from(r)}catch{n=kt.web3.VersionedTransaction.deserialize(r)}return n.signature==null?Promise.reject(At.CalcTxHashError):Promise.resolve(qn.base.toBase58(n.signature))}catch{return Promise.reject(At.CalcTxHashError)}}async getHardWareRawTransaction(e){try{return this.signTransaction(e)}catch{return Promise.reject(At.GetHardwareRawTransactionError)}}async getHardWareSignedTransaction(e){try{let r=kt.api.getHardwareTransaction(e.raw,e.pubKey,e.sig);return Promise.resolve(r)}catch{return Promise.reject(At.GetHardwareSignedTransactionError)}}async validSignedTransaction(e){try{let r=e.data?e.data.version:void 0,n=e.data?e.data.skipCheckSign:void 0,i=kt.api.validSignedTransaction(e.tx,r||!1,n||!1);return Promise.resolve((0,At.jsonStringifyUniform)(i))}catch{return Promise.reject(At.validSignedTransactionError)}}};$d.SolWallet=gb});var vv=L($r=>{E();I();var wv=$r&&$r.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),yx=$r&&$r.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),mx=$r&&$r.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&wv(e,t,r);return yx(e,t),e},_v=$r&&$r.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&wv(e,t,r)};Object.defineProperty($r,"__esModule",{value:!0});$r.api=void 0;$r.api=mx(uv());_v(ub(),$r);_v(mv(),$r)});export{vv as a};
|
||
|
||
window.inOKXExtension = true;
|
||
window.inMiniApp = false;
|
||
window.ASSETS_BUILD_TYPE = "publish";
|
||
|
||
//# sourceMappingURL=chunk-T2PTSF6H.js.map
|